mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
refactor(plugin-workflow-dc): move collection template to plugin and remove sort field (#4682)
* refactor(plugin-workflow-dc): move collection template to plugin and remove sort field * fix(client): fix variable component style
This commit is contained in:
parent
2b7544bdc4
commit
9bef416d51
@ -55,7 +55,6 @@ import {
|
||||
} from './interfaces';
|
||||
import {
|
||||
GeneralCollectionTemplate,
|
||||
ExpressionCollectionTemplate,
|
||||
SqlCollectionTemplate,
|
||||
TreeCollectionTemplate,
|
||||
ViewCollectionTemplate,
|
||||
@ -180,7 +179,6 @@ export class CollectionPlugin extends Plugin {
|
||||
addCollectionTemplates() {
|
||||
this.dataSourceManager.addCollectionTemplates([
|
||||
GeneralCollectionTemplate,
|
||||
ExpressionCollectionTemplate,
|
||||
SqlCollectionTemplate,
|
||||
TreeCollectionTemplate,
|
||||
ViewCollectionTemplate,
|
||||
|
@ -9,6 +9,5 @@
|
||||
|
||||
export * from './general';
|
||||
export * from './tree';
|
||||
export * from './expression';
|
||||
export * from './view';
|
||||
export * from './sql';
|
||||
|
@ -486,6 +486,7 @@ async function preloadOptions(scope, value: string) {
|
||||
TextArea.ReadPretty = function ReadPretty(props): JSX.Element {
|
||||
const { value } = props;
|
||||
const scope = typeof props.scope === 'function' ? props.scope() : props.scope;
|
||||
const { wrapSSR, hashId, componentCls } = useStyles();
|
||||
|
||||
const [options, setOptions] = useState([]);
|
||||
const keyLabelMap = useMemo(() => createOptionsValueLabelMap(options), [options]);
|
||||
@ -499,10 +500,13 @@ TextArea.ReadPretty = function ReadPretty(props): JSX.Element {
|
||||
}, [scope, value]);
|
||||
const html = renderHTML(value ?? '', keyLabelMap);
|
||||
|
||||
const content = (
|
||||
const content = wrapSSR(
|
||||
<span
|
||||
dangerouslySetInnerHTML={{ __html: html }}
|
||||
className={css`
|
||||
className={cx(
|
||||
componentCls,
|
||||
hashId,
|
||||
css`
|
||||
overflow: auto;
|
||||
|
||||
.ant-tag {
|
||||
@ -512,8 +516,9 @@ TextArea.ReadPretty = function ReadPretty(props): JSX.Element {
|
||||
padding: 2px 7px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
`}
|
||||
/>
|
||||
`,
|
||||
)}
|
||||
/>,
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -8,8 +8,7 @@
|
||||
*/
|
||||
|
||||
import { getOptions } from '@nocobase/evaluators/client';
|
||||
import { getConfigurableProperties } from './properties';
|
||||
import { CollectionTemplate } from '../../data-source/collection-template/CollectionTemplate';
|
||||
import { getConfigurableProperties, CollectionTemplate } from '@nocobase/client';
|
||||
|
||||
export class ExpressionCollectionTemplate extends CollectionTemplate {
|
||||
name = 'expression';
|
||||
@ -21,7 +20,6 @@ export class ExpressionCollectionTemplate extends CollectionTemplate {
|
||||
updatedBy: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
sortable: true,
|
||||
fields: [
|
||||
{
|
||||
name: 'engine',
|
@ -13,6 +13,7 @@ import WorkflowPlugin from '@nocobase/plugin-workflow/client';
|
||||
import DynamicCalculation from './DynamicCalculation';
|
||||
import { DynamicExpression } from './DynamicExpression';
|
||||
import { ExpressionFieldInterface } from './expression';
|
||||
import { ExpressionCollectionTemplate } from './ExpressionCollectionTemplate';
|
||||
|
||||
export default class extends Plugin {
|
||||
async afterAdd() {
|
||||
@ -27,6 +28,9 @@ export default class extends Plugin {
|
||||
this.app.addComponents({
|
||||
DynamicExpression,
|
||||
});
|
||||
|
||||
this.dataSourceManager.addCollectionTemplates([ExpressionCollectionTemplate]);
|
||||
|
||||
const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
|
||||
const dynamicCalculation = new DynamicCalculation();
|
||||
workflow.instructions.register(dynamicCalculation.type, dynamicCalculation);
|
||||
|
Loading…
x
Reference in New Issue
Block a user