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';
|
} from './interfaces';
|
||||||
import {
|
import {
|
||||||
GeneralCollectionTemplate,
|
GeneralCollectionTemplate,
|
||||||
ExpressionCollectionTemplate,
|
|
||||||
SqlCollectionTemplate,
|
SqlCollectionTemplate,
|
||||||
TreeCollectionTemplate,
|
TreeCollectionTemplate,
|
||||||
ViewCollectionTemplate,
|
ViewCollectionTemplate,
|
||||||
@ -180,7 +179,6 @@ export class CollectionPlugin extends Plugin {
|
|||||||
addCollectionTemplates() {
|
addCollectionTemplates() {
|
||||||
this.dataSourceManager.addCollectionTemplates([
|
this.dataSourceManager.addCollectionTemplates([
|
||||||
GeneralCollectionTemplate,
|
GeneralCollectionTemplate,
|
||||||
ExpressionCollectionTemplate,
|
|
||||||
SqlCollectionTemplate,
|
SqlCollectionTemplate,
|
||||||
TreeCollectionTemplate,
|
TreeCollectionTemplate,
|
||||||
ViewCollectionTemplate,
|
ViewCollectionTemplate,
|
||||||
|
@ -9,6 +9,5 @@
|
|||||||
|
|
||||||
export * from './general';
|
export * from './general';
|
||||||
export * from './tree';
|
export * from './tree';
|
||||||
export * from './expression';
|
|
||||||
export * from './view';
|
export * from './view';
|
||||||
export * from './sql';
|
export * from './sql';
|
||||||
|
@ -486,6 +486,7 @@ async function preloadOptions(scope, value: string) {
|
|||||||
TextArea.ReadPretty = function ReadPretty(props): JSX.Element {
|
TextArea.ReadPretty = function ReadPretty(props): JSX.Element {
|
||||||
const { value } = props;
|
const { value } = props;
|
||||||
const scope = typeof props.scope === 'function' ? props.scope() : props.scope;
|
const scope = typeof props.scope === 'function' ? props.scope() : props.scope;
|
||||||
|
const { wrapSSR, hashId, componentCls } = useStyles();
|
||||||
|
|
||||||
const [options, setOptions] = useState([]);
|
const [options, setOptions] = useState([]);
|
||||||
const keyLabelMap = useMemo(() => createOptionsValueLabelMap(options), [options]);
|
const keyLabelMap = useMemo(() => createOptionsValueLabelMap(options), [options]);
|
||||||
@ -499,21 +500,25 @@ TextArea.ReadPretty = function ReadPretty(props): JSX.Element {
|
|||||||
}, [scope, value]);
|
}, [scope, value]);
|
||||||
const html = renderHTML(value ?? '', keyLabelMap);
|
const html = renderHTML(value ?? '', keyLabelMap);
|
||||||
|
|
||||||
const content = (
|
const content = wrapSSR(
|
||||||
<span
|
<span
|
||||||
dangerouslySetInnerHTML={{ __html: html }}
|
dangerouslySetInnerHTML={{ __html: html }}
|
||||||
className={css`
|
className={cx(
|
||||||
overflow: auto;
|
componentCls,
|
||||||
|
hashId,
|
||||||
|
css`
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
.ant-tag {
|
.ant-tag {
|
||||||
display: inline;
|
display: inline;
|
||||||
line-height: 19px;
|
line-height: 19px;
|
||||||
margin: 0 0.25em;
|
margin: 0 0.25em;
|
||||||
padding: 2px 7px;
|
padding: 2px 7px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
`}
|
`,
|
||||||
/>
|
)}
|
||||||
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getOptions } from '@nocobase/evaluators/client';
|
import { getOptions } from '@nocobase/evaluators/client';
|
||||||
import { getConfigurableProperties } from './properties';
|
import { getConfigurableProperties, CollectionTemplate } from '@nocobase/client';
|
||||||
import { CollectionTemplate } from '../../data-source/collection-template/CollectionTemplate';
|
|
||||||
|
|
||||||
export class ExpressionCollectionTemplate extends CollectionTemplate {
|
export class ExpressionCollectionTemplate extends CollectionTemplate {
|
||||||
name = 'expression';
|
name = 'expression';
|
||||||
@ -21,7 +20,6 @@ export class ExpressionCollectionTemplate extends CollectionTemplate {
|
|||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
updatedAt: true,
|
updatedAt: true,
|
||||||
sortable: true,
|
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'engine',
|
name: 'engine',
|
@ -13,6 +13,7 @@ import WorkflowPlugin from '@nocobase/plugin-workflow/client';
|
|||||||
import DynamicCalculation from './DynamicCalculation';
|
import DynamicCalculation from './DynamicCalculation';
|
||||||
import { DynamicExpression } from './DynamicExpression';
|
import { DynamicExpression } from './DynamicExpression';
|
||||||
import { ExpressionFieldInterface } from './expression';
|
import { ExpressionFieldInterface } from './expression';
|
||||||
|
import { ExpressionCollectionTemplate } from './ExpressionCollectionTemplate';
|
||||||
|
|
||||||
export default class extends Plugin {
|
export default class extends Plugin {
|
||||||
async afterAdd() {
|
async afterAdd() {
|
||||||
@ -27,6 +28,9 @@ export default class extends Plugin {
|
|||||||
this.app.addComponents({
|
this.app.addComponents({
|
||||||
DynamicExpression,
|
DynamicExpression,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.dataSourceManager.addCollectionTemplates([ExpressionCollectionTemplate]);
|
||||||
|
|
||||||
const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
|
const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
|
||||||
const dynamicCalculation = new DynamicCalculation();
|
const dynamicCalculation = new DynamicCalculation();
|
||||||
workflow.instructions.register(dynamicCalculation.type, dynamicCalculation);
|
workflow.instructions.register(dynamicCalculation.type, dynamicCalculation);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user