@nocobase/client 0.7.0-alpha.21 → 0.7.0-alpha.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,17 @@ var __assign = (this && this.__assign) || function () {
13
13
  };
14
14
  return __assign.apply(this, arguments);
15
15
  };
16
+ var __rest = (this && this.__rest) || function (s, e) {
17
+ var t = {};
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
+ t[p] = s[p];
20
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
+ t[p[i]] = s[p[i]];
24
+ }
25
+ return t;
26
+ };
16
27
  var __read = (this && this.__read) || function (o, n) {
17
28
  var m = typeof Symbol === "function" && o[Symbol.iterator];
18
29
  if (!m) return o;
@@ -40,14 +51,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
40
51
  };
41
52
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
42
53
  import React from "react";
43
- import { observer } from "@formily/react";
54
+ import { observer, useForm } from "@formily/react";
44
55
  import { FormItem } from "@formily/antd";
45
- import { Cascader, Input, InputNumber, Select } from "antd";
56
+ import { Button, Cascader, Dropdown, Input, InputNumber, Menu, Select } from "antd";
46
57
  import { css } from "@emotion/css";
58
+ import { PlusOutlined, CloseCircleOutlined } from '@ant-design/icons';
47
59
  import { instructions, useNodeContext } from "./nodes";
48
60
  import { useFlowContext } from "./WorkflowCanvas";
49
61
  import { triggers } from "./triggers";
50
- import { SchemaComponent, useCompile } from "..";
62
+ import { SchemaComponent, useCollectionManager, useCompile } from "..";
51
63
  function NullRender() {
52
64
  return null;
53
65
  }
@@ -322,34 +334,55 @@ export function VariableComponent(_a) {
322
334
  }
323
335
  // NOTE: observer for watching useProps
324
336
  export var CollectionFieldset = observer(function (_a) {
325
- var value = _a.value, onChange = _a.onChange, useProps = _a.useProps;
326
- var fields = useProps().fields;
337
+ var _b;
338
+ var value = _a.value, onChange = _a.onChange;
327
339
  var compile = useCompile();
340
+ var getCollectionFields = useCollectionManager().getCollectionFields;
341
+ var data = useForm().values;
342
+ var fields = getCollectionFields((_b = data === null || data === void 0 ? void 0 : data.config) === null || _b === void 0 ? void 0 : _b.collection)
343
+ .filter(function (field) { return (!field.hidden
344
+ && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)); });
328
345
  var VTypes = __assign(__assign({}, VariableTypes), { constant: {
329
346
  title: '常量',
330
347
  value: 'constant',
331
348
  options: undefined
332
349
  } });
333
350
  return (_jsx("fieldset", __assign({ className: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-top: .5em;\n\n > .ant-formily-item{\n flex-direction: column;\n\n > .ant-formily-item-label{\n line-height: 32px;\n }\n }\n "], ["\n margin-top: .5em;\n\n > .ant-formily-item{\n flex-direction: column;\n\n > .ant-formily-item-label{\n line-height: 32px;\n }\n }\n "]))) }, { children: fields.length
334
- ? fields.map(function (field) {
335
- var _a, _b;
336
- var operand = typeof value[field.name] === 'string'
337
- ? parseStringValue(value[field.name], VTypes)
338
- : { type: 'constant', value: value[field.name] };
339
- return (_jsx(FormItem, __assign({ label: compile((_b = (_a = field.uiSchema) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : field.name), labelAlign: "left" }, { children: _jsx(VariableTypesContext.Provider, __assign({ value: VTypes }, { children: _jsx(Operand, __assign({ value: operand, onChange: function (next) {
340
- var _a, _b;
341
- if (next.type !== operand.type && next.type === 'constant') {
342
- onChange(__assign(__assign({}, value), (_a = {}, _a[field.name] = null, _a)));
343
- }
344
- else {
345
- var stringify = VTypes[next.type].stringify;
346
- onChange(__assign(__assign({}, value), (_b = {}, _b[field.name] = stringify(next), _b)));
347
- }
348
- } }, { children: operand.type === 'constant'
349
- ? _jsx(SchemaComponent, { schema: __assign(__assign({}, field.uiSchema), { name: field.name }) }, void 0)
350
- : null }), void 0) }), void 0) }), void 0));
351
- })
351
+ ? (_jsxs(_Fragment, { children: [fields
352
+ .filter(function (field) { return field.name in value; })
353
+ .map(function (field) {
354
+ var _a, _b;
355
+ var operand = typeof value[field.name] === 'string'
356
+ ? parseStringValue(value[field.name], VTypes)
357
+ : { type: 'constant', value: value[field.name] };
358
+ return (_jsx(FormItem, __assign({ label: compile((_b = (_a = field.uiSchema) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : field.name), labelAlign: "left", className: css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n .ant-formily-item-control-content-component{\n display: flex;\n }\n "], ["\n .ant-formily-item-control-content-component{\n display: flex;\n }\n "]))) }, { children: _jsxs(VariableTypesContext.Provider, __assign({ value: VTypes }, { children: [_jsx(Operand, __assign({ value: operand, onChange: function (next) {
359
+ var _a, _b;
360
+ if (next.type !== operand.type && next.type === 'constant') {
361
+ onChange(__assign(__assign({}, value), (_a = {}, _a[field.name] = null, _a)));
362
+ }
363
+ else {
364
+ var stringify = VTypes[next.type].stringify;
365
+ onChange(__assign(__assign({}, value), (_b = {}, _b[field.name] = stringify(next), _b)));
366
+ }
367
+ } }, { children: operand.type === 'constant'
368
+ ? _jsx(SchemaComponent, { schema: __assign(__assign({}, field.uiSchema), { name: field.name }) }, void 0)
369
+ : null }), void 0), _jsx(Button, { type: "link", icon: _jsx(CloseCircleOutlined, {}, void 0), onClick: function () {
370
+ var _a = value, _b = field.name, _ = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
371
+ onChange(rest);
372
+ } }, void 0)] }), void 0) }), field.name));
373
+ }), Object.keys(value).length < fields.length
374
+ ? (_jsx(Dropdown, __assign({ overlay: _jsx(Menu, __assign({ onClick: function (_a) {
375
+ var _b;
376
+ var key = _a.key;
377
+ return onChange(__assign(__assign({}, value), (_b = {}, _b[key] = null, _b)));
378
+ } }, { children: fields
379
+ .filter(function (field) { return !(field.name in value); })
380
+ .map(function (field) {
381
+ var _a, _b;
382
+ return (_jsx(Menu.Item, { children: compile((_b = (_a = field.uiSchema) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : field.name) }, field.name));
383
+ }) }), void 0) }, { children: _jsx(Button, __assign({ icon: _jsx(PlusOutlined, {}, void 0) }, { children: "\u6DFB\u52A0\u5B57\u6BB5" }), void 0) }), void 0))
384
+ : null] }, void 0))
352
385
  : _jsx("p", { children: "\u8BF7\u5148\u9009\u62E9\u6570\u636E\u8868" }, void 0) }), void 0));
353
386
  });
354
- var templateObject_1, templateObject_2, templateObject_3;
387
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
355
388
  //# sourceMappingURL=calculators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"calculators.js","sourceRoot":"","sources":["../../src/workflow/calculators.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAc,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEjD,SAAS,UAAU;IACjB,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,IAAM,WAAW,GAAG;IACzB;QACE,KAA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I,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;oCAC1D,QAAQ,uBAAM,KAAK,gBAAG,KAAK,CAAC,IAAI,IAAG,IAAI,OAAG,CAAC;iCAC5C;qCAAM;oCACG,IAAA,SAAS,GAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAtB,CAAuB;oCACxC,QAAQ,uBAAM,KAAK,gBAAG,KAAK,CAAC,IAAI,IAAG,SAAS,CAAC,IAAI,CAAC,OAAG,CAAC;iCACvD;4BACH,CAAC,gBAEA,OAAO,CAAC,IAAI,KAAK,UAAU;gCAC1B,CAAC,CAAC,KAAC,eAAe,IAAC,MAAM,wBAAO,KAAK,CAAC,QAAQ,KAAE,IAAI,EAAE,KAAK,CAAC,IAAI,cAAM;gCACtE,CAAC,CAAC,IAAI,YAEA,YACoB,YACvB,CACZ,CAAC;YACJ,CAAC,CAAC;YACJ,CAAC,CAAC,6EAAc,YAET,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { observer } from \"@formily/react\";\nimport { FormItem } from \"@formily/antd\";\nimport { Cascader, DatePicker, Input, InputNumber, Select } from \"antd\";\nimport { css } from \"@emotion/css\";\n\nimport { instructions, useNodeContext } from \"./nodes\";\nimport { useFlowContext } from \"./WorkflowCanvas\";\nimport { triggers } from \"./triggers\";\nimport { SchemaComponent, useCompile } from \"..\";\n\nfunction NullRender() {\n return null;\n}\n\nexport const calculators = [\n {\n value: 'boolean',\n title: '值比较',\n children: [\n { value: 'equal', name: '=' },\n { value: 'notEqual', name: '≠' },\n { value: 'gt', name: '>' },\n { value: 'gte', name: '≥' },\n { value: 'lt', name: '<' },\n { value: 'lte', name: '≤' }\n ]\n },\n {\n value: 'number',\n title: '算术运算',\n children: [\n { value: 'add', name: '+' },\n { value: 'minus', name: '-' },\n { value: 'multiple', name: '*' },\n { value: 'divide', name: '/' },\n { value: 'mod', name: '%' },\n ]\n },\n {\n value: 'string',\n title: '字符串',\n children: [\n { value: 'includes', name: '包含' },\n { value: 'notIncludes', name: '不包含' },\n { value: 'startsWith', name: '开头是' },\n { value: 'notStartsWith', name: '开头不是' },\n { value: 'endsWith', name: '结尾是' },\n { value: 'notEndsWith', name: '结尾不是' }\n ]\n },\n {\n value: 'date',\n title: '日期',\n children: []\n }\n];\n\nconst JT_VALUE_RE = /^\\s*\\{\\{([\\s\\S]*)\\}\\}\\s*$/;\n\nexport function parseStringValue(value: string, Types) {\n const matcher = value.match(JT_VALUE_RE);\n if (!matcher) {\n return { type: 'constant', value, options: { type: 'string' } };\n }\n\n const [type, ...paths] = matcher[1].split('.');\n\n return {\n type,\n options: paths.length ? (Types || VariableTypes)[type]?.parse(paths) : {}\n };\n}\n\nexport const BaseTypeSet = new Set(['boolean', 'number', 'string', 'date']);\n\nconst ConstantTypes = {\n string: {\n title: '字符串',\n value: 'string',\n component({ onChange, type, options, value }) {\n return (\n <Input\n value={value}\n onChange={ev => onChange({ value: ev.target.value, type, options })}\n />\n );\n },\n default: ''\n },\n number: {\n title: '数字',\n value: 'number',\n component({ onChange, type, options, value }) {\n return (\n <InputNumber\n value={value}\n onChange={v => onChange({ value: v, type, options })}\n />\n );\n },\n default: 0\n },\n boolean: {\n title: '逻辑值',\n value: 'boolean',\n component({ onChange, type, options, value }) {\n return (\n <Select value={value} onChange={v => onChange({ value: v, type, options })}>\n <Select.Option value={true}>真</Select.Option>\n <Select.Option value={false}>假</Select.Option>\n </Select>\n );\n },\n default: false\n },\n // date: {\n // title: '日期',\n // value: 'date',\n // component({ onChange, type, options, value }) {\n // return <DatePicker value={value} onChange={v => onChange({ value: v, type, options })}/>;\n // },\n // default: new Date()\n // }\n};\n\nexport const VariableTypes = {\n constant: {\n title: '常量',\n value: 'constant',\n options: Object.values(ConstantTypes).map(item => ({\n value: item.value,\n label: item.title\n })),\n component({ options = { type: 'string' } }) {\n return ConstantTypes[options.type]?.component ?? NullRender;\n },\n appendTypeValue({ options = { type: 'string' } }) {\n return options?.type ? [options.type] : [];\n },\n onTypeChange(old, [type, optionsType], onChange) {\n if (old?.options?.type === optionsType) {\n return;\n }\n const { default: value } = ConstantTypes[optionsType];\n onChange({\n value,\n type,\n options: { ...old.options, type: optionsType }\n });\n },\n parse(path) {\n return { path };\n }\n },\n $jobsMapByNodeId: {\n title: '节点数据',\n value: '$jobsMapByNodeId',\n options() {\n const node = useNodeContext();\n const stack = [];\n for (let current = node.upstream; current; current = current.upstream) {\n const { getter } = instructions.get(current.type);\n // Note: consider `getter` as the key of a value available node\n if (getter) {\n stack.push({\n value: current.id,\n label: current.title ?? `#${current.id}`\n });\n }\n }\n\n return stack;\n },\n component({ options }) {\n const { nodes } = useFlowContext();\n if (!options?.nodeId) {\n return NullRender;\n }\n const node = nodes.find(n => n.id == options.nodeId);\n if (!node) {\n return NullRender;\n }\n const instruction = instructions.get(node.type);\n return instruction?.getter ?? NullRender;\n },\n appendTypeValue({ options = {} }: { type: string, options: any }) {\n return options.nodeId ? [Number.parseInt(options.nodeId, 10)] : [];\n },\n onTypeChange(old, [type, nodeId], onChange) {\n onChange({\n // ...old,\n type,\n options: { nodeId }\n });\n },\n parse([nodeId, ...path]) {\n return { nodeId, path: path.join('.') };\n },\n stringify({ options }) {\n const stack = ['$jobsMapByNodeId'];\n if (options.nodeId) {\n stack.push(options.nodeId);\n if (options.path) {\n stack.push(options.path);\n }\n }\n return `{{${stack.join('.')}}}`;\n }\n },\n $context: {\n title: '触发数据',\n value: '$context',\n component() {\n const { workflow } = useFlowContext();\n const trigger = triggers.get(workflow.type);\n return trigger?.getter ?? NullRender;\n },\n parse([prefix, ...path]) {\n return { path: path.join('.') };\n },\n stringify({ options }) {\n const stack = ['$context'];\n if (options?.path) {\n stack.push(options.path);\n }\n return `{{${stack.join('.')}}}`;\n }\n },\n // calculation: Calculation\n};\n\nexport const VariableTypesContext = React.createContext(null);\n\nexport function useVariableTypes() {\n return React.useContext(VariableTypesContext);\n}\n\ninterface OperandProps {\n value: {\n type: string;\n value?: any;\n options?: any;\n };\n onChange(v: any): void;\n children?: React.ReactNode;\n}\n\nexport function Operand({\n value: operand = { type: 'constant', value: '', options: { type: 'string' } },\n onChange,\n children\n}: OperandProps) {\n const Types = useVariableTypes();\n\n const { type } = operand;\n\n const { component, appendTypeValue } = Types[type] || {};\n const VariableComponent = typeof component === 'function' ? component(operand) : NullRender;\n\n return (\n <div className={css`\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select,\n .ant-cascader-picker,\n .ant-picker,\n .ant-input-number,\n .ant-input-affix-wrapper{\n width: auto;\n }\n `}>\n <Cascader\n allowClear={false}\n value={[type, ...(appendTypeValue ? appendTypeValue(operand) : [])]}\n options={Object.values(Types).map((item: any) => {\n const options = typeof item.options === 'function' ? item.options() : item.options;\n return {\n label: item.title,\n value: item.value,\n children: options,\n disabled: options && !options.length,\n isLeaf: !options\n };\n })}\n onChange={(next: Array<string | number>) => {\n const { onTypeChange } = Types[next[0]];\n if (typeof onTypeChange === 'function') {\n onTypeChange(operand, next, onChange);\n } else {\n if (next[0] !== type) {\n onChange({ type: next[0], value: null });\n }\n }\n }}\n />\n {children ?? <VariableComponent {...operand} onChange={op => onChange({ ...op })} />}\n </div>\n );\n}\n\nexport function Calculation({ calculator, operands = [], onChange }) {\n return (\n <VariableTypesContext.Provider value={VariableTypes}>\n <div className={css`\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select{\n width: auto;\n min-width: 6em;\n }\n `}>\n <Operand value={operands[0]} onChange={(v => onChange({ calculator, operands: [v, operands[1]] }))} />\n {operands[0]\n ? (\n <>\n <Select value={calculator} onChange={v => onChange({ operands, calculator: v })}>\n {calculators.map(group => (\n <Select.OptGroup key={group.value} label={group.title}>\n {group.children.map(item => (\n <Select.Option key={item.value} value={item.value}>{item.name}</Select.Option>\n ))}\n </Select.OptGroup>\n ))}\n </Select>\n <Operand value={operands[1]} onChange={(v => onChange({ calculator, operands: [operands[0], v] }))} />\n </>\n )\n : null\n }\n </div>\n </VariableTypesContext.Provider>\n );\n}\n\nexport function VariableComponent({ value, onChange, renderSchemaComponent }) {\n const VTypes = { ...VariableTypes,\n constant: {\n title: '常量',\n value: 'constant',\n options: undefined\n }\n };\n\n const operand = typeof value === 'string'\n ? parseStringValue(value, VTypes)\n : { type: 'constant', value };\n\n return (\n <VariableTypesContext.Provider value={VTypes}>\n <Operand\n value={operand}\n onChange={(next) => {\n if (next.type !== operand.type && next.type === 'constant') {\n onChange(null);\n } else {\n const { stringify } = VTypes[next.type];\n onChange(stringify(next));\n }\n }}\n >\n {operand.type === 'constant' ? renderSchemaComponent() : null}\n </Operand>\n </VariableTypesContext.Provider>\n );\n}\n\n// NOTE: observer for watching useProps\nexport const CollectionFieldset = observer(({ value, onChange, useProps }: any) => {\n const { fields } = useProps();\n const compile = useCompile();\n\n const VTypes = { ...VariableTypes,\n constant: {\n title: '常量',\n value: 'constant',\n options: undefined\n }\n };\n\n return (\n <fieldset className={css`\n margin-top: .5em;\n\n > .ant-formily-item{\n flex-direction: column;\n\n > .ant-formily-item-label{\n line-height: 32px;\n }\n }\n `}>\n {fields.length\n ? fields.map(field => {\n const operand = typeof value[field.name] === 'string'\n ? parseStringValue(value[field.name], VTypes)\n : { type: 'constant', value: value[field.name] };\n\n return (\n <FormItem label={compile(field.uiSchema?.title ?? field.name)} labelAlign=\"left\">\n <VariableTypesContext.Provider value={VTypes}>\n <Operand\n value={operand}\n onChange={(next) => {\n if (next.type !== operand.type && next.type === 'constant') {\n onChange({ ...value, [field.name]: null });\n } else {\n const { stringify } = VTypes[next.type];\n onChange({ ...value, [field.name]: stringify(next) });\n }\n }}\n >\n {operand.type === 'constant'\n ? <SchemaComponent schema={{ ...field.uiSchema, name: field.name }} />\n : null\n }\n </Operand>\n </VariableTypesContext.Provider>\n </FormItem>\n );\n })\n : <p>请先选择数据表</p>\n }\n </fieldset>\n );\n});\n"]}
1
+ {"version":3,"file":"calculators.js","sourceRoot":"","sources":["../../src/workflow/calculators.tsx"],"names":[],"mappings":";;;;;;;;;;;;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OAAA,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAtB,CAAsB,CAAC;qCACvC,GAAG,CAAC,UAAA,KAAK;;oCAAI,OAAA,CACZ,KAAC,IAAI,CAAC,IAAI,cAAmB,OAAO,CAAC,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,KAAK,mCAAI,KAAK,CAAC,IAAI,CAAC,IAAzD,KAAK,CAAC,IAAI,CAA4D,CACvF,CAAA;iCAAA,CAAC,YACC,gBAEP,KAAC,MAAM,aAAC,IAAI,EAAE,KAAC,YAAY,aAAG,sDAAe,YACpC,CACZ;wBACD,CAAC,CAAC,IAAI,YAEP,CACJ;YACD,CAAC,CAAC,6EAAc,YAET,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { observer, useForm } from \"@formily/react\";\nimport { FormItem } from \"@formily/antd\";\nimport { Button, Cascader, Dropdown, Input, InputNumber, Menu, Select } from \"antd\";\nimport { css } from \"@emotion/css\";\nimport { PlusOutlined, CloseCircleOutlined } from '@ant-design/icons';\n\nimport { instructions, useNodeContext } from \"./nodes\";\nimport { useFlowContext } from \"./WorkflowCanvas\";\nimport { triggers } from \"./triggers\";\nimport { SchemaComponent, useCollectionManager, useCompile } from \"..\";\n\nfunction NullRender() {\n return null;\n}\n\nexport const calculators = [\n {\n value: 'boolean',\n title: '值比较',\n children: [\n { value: 'equal', name: '=' },\n { value: 'notEqual', name: '≠' },\n { value: 'gt', name: '>' },\n { value: 'gte', name: '≥' },\n { value: 'lt', name: '<' },\n { value: 'lte', name: '≤' }\n ]\n },\n {\n value: 'number',\n title: '算术运算',\n children: [\n { value: 'add', name: '+' },\n { value: 'minus', name: '-' },\n { value: 'multiple', name: '*' },\n { value: 'divide', name: '/' },\n { value: 'mod', name: '%' },\n ]\n },\n {\n value: 'string',\n title: '字符串',\n children: [\n { value: 'includes', name: '包含' },\n { value: 'notIncludes', name: '不包含' },\n { value: 'startsWith', name: '开头是' },\n { value: 'notStartsWith', name: '开头不是' },\n { value: 'endsWith', name: '结尾是' },\n { value: 'notEndsWith', name: '结尾不是' }\n ]\n },\n {\n value: 'date',\n title: '日期',\n children: []\n }\n];\n\nconst JT_VALUE_RE = /^\\s*\\{\\{([\\s\\S]*)\\}\\}\\s*$/;\n\nexport function parseStringValue(value: string, Types) {\n const matcher = value.match(JT_VALUE_RE);\n if (!matcher) {\n return { type: 'constant', value, options: { type: 'string' } };\n }\n\n const [type, ...paths] = matcher[1].split('.');\n\n return {\n type,\n options: paths.length ? (Types || VariableTypes)[type]?.parse(paths) : {}\n };\n}\n\nexport const BaseTypeSet = new Set(['boolean', 'number', 'string', 'date']);\n\nconst ConstantTypes = {\n string: {\n title: '字符串',\n value: 'string',\n component({ onChange, type, options, value }) {\n return (\n <Input\n value={value}\n onChange={ev => onChange({ value: ev.target.value, type, options })}\n />\n );\n },\n default: ''\n },\n number: {\n title: '数字',\n value: 'number',\n component({ onChange, type, options, value }) {\n return (\n <InputNumber\n value={value}\n onChange={v => onChange({ value: v, type, options })}\n />\n );\n },\n default: 0\n },\n boolean: {\n title: '逻辑值',\n value: 'boolean',\n component({ onChange, type, options, value }) {\n return (\n <Select value={value} onChange={v => onChange({ value: v, type, options })}>\n <Select.Option value={true}>真</Select.Option>\n <Select.Option value={false}>假</Select.Option>\n </Select>\n );\n },\n default: false\n },\n // date: {\n // title: '日期',\n // value: 'date',\n // component({ onChange, type, options, value }) {\n // return <DatePicker value={value} onChange={v => onChange({ value: v, type, options })}/>;\n // },\n // default: new Date()\n // }\n};\n\nexport const VariableTypes = {\n constant: {\n title: '常量',\n value: 'constant',\n options: Object.values(ConstantTypes).map(item => ({\n value: item.value,\n label: item.title\n })),\n component({ options = { type: 'string' } }) {\n return ConstantTypes[options.type]?.component ?? NullRender;\n },\n appendTypeValue({ options = { type: 'string' } }) {\n return options?.type ? [options.type] : [];\n },\n onTypeChange(old, [type, optionsType], onChange) {\n if (old?.options?.type === optionsType) {\n return;\n }\n const { default: value } = ConstantTypes[optionsType];\n onChange({\n value,\n type,\n options: { ...old.options, type: optionsType }\n });\n },\n parse(path) {\n return { path };\n }\n },\n $jobsMapByNodeId: {\n title: '节点数据',\n value: '$jobsMapByNodeId',\n options() {\n const node = useNodeContext();\n const stack = [];\n for (let current = node.upstream; current; current = current.upstream) {\n const { getter } = instructions.get(current.type);\n // Note: consider `getter` as the key of a value available node\n if (getter) {\n stack.push({\n value: current.id,\n label: current.title ?? `#${current.id}`\n });\n }\n }\n\n return stack;\n },\n component({ options }) {\n const { nodes } = useFlowContext();\n if (!options?.nodeId) {\n return NullRender;\n }\n const node = nodes.find(n => n.id == options.nodeId);\n if (!node) {\n return NullRender;\n }\n const instruction = instructions.get(node.type);\n return instruction?.getter ?? NullRender;\n },\n appendTypeValue({ options = {} }: { type: string, options: any }) {\n return options.nodeId ? [Number.parseInt(options.nodeId, 10)] : [];\n },\n onTypeChange(old, [type, nodeId], onChange) {\n onChange({\n // ...old,\n type,\n options: { nodeId }\n });\n },\n parse([nodeId, ...path]) {\n return { nodeId, path: path.join('.') };\n },\n stringify({ options }) {\n const stack = ['$jobsMapByNodeId'];\n if (options.nodeId) {\n stack.push(options.nodeId);\n if (options.path) {\n stack.push(options.path);\n }\n }\n return `{{${stack.join('.')}}}`;\n }\n },\n $context: {\n title: '触发数据',\n value: '$context',\n component() {\n const { workflow } = useFlowContext();\n const trigger = triggers.get(workflow.type);\n return trigger?.getter ?? NullRender;\n },\n parse([prefix, ...path]) {\n return { path: path.join('.') };\n },\n stringify({ options }) {\n const stack = ['$context'];\n if (options?.path) {\n stack.push(options.path);\n }\n return `{{${stack.join('.')}}}`;\n }\n },\n // calculation: Calculation\n};\n\nexport const VariableTypesContext = React.createContext(null);\n\nexport function useVariableTypes() {\n return React.useContext(VariableTypesContext);\n}\n\ninterface OperandProps {\n value: {\n type: string;\n value?: any;\n options?: any;\n };\n onChange(v: any): void;\n children?: React.ReactNode;\n}\n\nexport function Operand({\n value: operand = { type: 'constant', value: '', options: { type: 'string' } },\n onChange,\n children\n}: OperandProps) {\n const Types = useVariableTypes();\n\n const { type } = operand;\n\n const { component, appendTypeValue } = Types[type] || {};\n const VariableComponent = typeof component === 'function' ? component(operand) : NullRender;\n\n return (\n <div className={css`\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select,\n .ant-cascader-picker,\n .ant-picker,\n .ant-input-number,\n .ant-input-affix-wrapper{\n width: auto;\n }\n `}>\n <Cascader\n allowClear={false}\n value={[type, ...(appendTypeValue ? appendTypeValue(operand) : [])]}\n options={Object.values(Types).map((item: any) => {\n const options = typeof item.options === 'function' ? item.options() : item.options;\n return {\n label: item.title,\n value: item.value,\n children: options,\n disabled: options && !options.length,\n isLeaf: !options\n };\n })}\n onChange={(next: Array<string | number>) => {\n const { onTypeChange } = Types[next[0]];\n if (typeof onTypeChange === 'function') {\n onTypeChange(operand, next, onChange);\n } else {\n if (next[0] !== type) {\n onChange({ type: next[0], value: null });\n }\n }\n }}\n />\n {children ?? <VariableComponent {...operand} onChange={op => onChange({ ...op })} />}\n </div>\n );\n}\n\nexport function Calculation({ calculator, operands = [], onChange }) {\n return (\n <VariableTypesContext.Provider value={VariableTypes}>\n <div className={css`\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select{\n width: auto;\n min-width: 6em;\n }\n `}>\n <Operand value={operands[0]} onChange={(v => onChange({ calculator, operands: [v, operands[1]] }))} />\n {operands[0]\n ? (\n <>\n <Select value={calculator} onChange={v => onChange({ operands, calculator: v })}>\n {calculators.map(group => (\n <Select.OptGroup key={group.value} label={group.title}>\n {group.children.map(item => (\n <Select.Option key={item.value} value={item.value}>{item.name}</Select.Option>\n ))}\n </Select.OptGroup>\n ))}\n </Select>\n <Operand value={operands[1]} onChange={(v => onChange({ calculator, operands: [operands[0], v] }))} />\n </>\n )\n : null\n }\n </div>\n </VariableTypesContext.Provider>\n );\n}\n\nexport function VariableComponent({ value, onChange, renderSchemaComponent }) {\n const VTypes = { ...VariableTypes,\n constant: {\n title: '常量',\n value: 'constant',\n options: undefined\n }\n };\n\n const operand = typeof value === 'string'\n ? parseStringValue(value, VTypes)\n : { type: 'constant', value };\n\n return (\n <VariableTypesContext.Provider value={VTypes}>\n <Operand\n value={operand}\n onChange={(next) => {\n if (next.type !== operand.type && next.type === 'constant') {\n onChange(null);\n } else {\n const { stringify } = VTypes[next.type];\n onChange(stringify(next));\n }\n }}\n >\n {operand.type === 'constant' ? renderSchemaComponent() : null}\n </Operand>\n </VariableTypesContext.Provider>\n );\n}\n\n// NOTE: observer for watching useProps\nexport const CollectionFieldset = observer(({ value, onChange }: any) => {\n const compile = useCompile();\n const { getCollectionFields } = useCollectionManager();\n const { values: data } = useForm();\n const fields = getCollectionFields(data?.config?.collection)\n .filter(field => (\n !field.hidden\n && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)\n ));\n\n const VTypes = {\n ...VariableTypes,\n constant: {\n title: '常量',\n value: 'constant',\n options: undefined\n }\n };\n\n return (\n <fieldset className={css`\n margin-top: .5em;\n\n > .ant-formily-item{\n flex-direction: column;\n\n > .ant-formily-item-label{\n line-height: 32px;\n }\n }\n `}>\n {fields.length\n ? (\n <>\n {fields\n .filter(field => field.name in value)\n .map(field => {\n const operand = typeof value[field.name] === 'string'\n ? parseStringValue(value[field.name], VTypes)\n : { type: 'constant', value: value[field.name] };\n\n return (\n <FormItem key={field.name} label={compile(field.uiSchema?.title ?? field.name)} labelAlign=\"left\" className={css`\n .ant-formily-item-control-content-component{\n display: flex;\n }\n `}>\n <VariableTypesContext.Provider value={VTypes}>\n <Operand\n value={operand}\n onChange={(next) => {\n if (next.type !== operand.type && next.type === 'constant') {\n onChange({ ...value, [field.name]: null });\n } else {\n const { stringify } = VTypes[next.type];\n onChange({ ...value, [field.name]: stringify(next) });\n }\n }}\n >\n {operand.type === 'constant'\n ? <SchemaComponent schema={{ ...field.uiSchema, name: field.name }} />\n : null\n }\n </Operand>\n <Button\n type=\"link\"\n icon={<CloseCircleOutlined />}\n onClick={() => {\n const { [field.name]: _, ...rest } = value;\n onChange(rest);\n }}\n />\n </VariableTypesContext.Provider>\n </FormItem>\n );\n })}\n {Object.keys(value).length < fields.length\n ? (\n <Dropdown overlay={\n <Menu onClick={({ key }) => onChange({ ...value, [key]: null })}>\n {fields\n .filter(field => !(field.name in value))\n .map(field => (\n <Menu.Item key={field.name}>{compile(field.uiSchema?.title ?? field.name)}</Menu.Item>\n ))}\n </Menu>\n }>\n <Button icon={<PlusOutlined />}>添加字段</Button>\n </Dropdown>\n )\n : null\n }\n </>\n )\n : <p>请先选择数据表</p>\n }\n </fieldset>\n );\n});\n"]}
@@ -30,11 +30,6 @@ declare const _default: {
30
30
  className: string;
31
31
  };
32
32
  'x-component': string;
33
- 'x-component-props': {
34
- useProps(): {
35
- fields: any;
36
- };
37
- };
38
33
  };
39
34
  };
40
35
  };
@@ -49,11 +49,6 @@ declare const _default: {
49
49
  className: string;
50
50
  };
51
51
  'x-component': string;
52
- 'x-component-props': {
53
- useProps(): {
54
- fields: any;
55
- };
56
- };
57
52
  };
58
53
  };
59
54
  };
@@ -17,11 +17,6 @@ export declare const values: {
17
17
  className: string;
18
18
  };
19
19
  'x-component': string;
20
- 'x-component-props': {
21
- useProps(): {
22
- fields: any;
23
- };
24
- };
25
20
  };
26
21
  export declare const filter: {
27
22
  type: string;
@@ -4,7 +4,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
4
4
  };
5
5
  import { css } from "@emotion/css";
6
6
  import { useForm } from "@formily/react";
7
- import { useCollectionManager } from "../../collection-manager";
8
7
  import { useCollectionFilterOptions } from "../../collection-manager/action-hooks";
9
8
  export var collection = {
10
9
  type: 'string',
@@ -24,18 +23,7 @@ export var values = {
24
23
  labelAlign: 'left',
25
24
  className: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: column;\n "], ["\n flex-direction: column;\n "])))
26
25
  },
27
- 'x-component': 'CollectionFieldset',
28
- 'x-component-props': {
29
- useProps: function () {
30
- var _a;
31
- var getCollectionFields = useCollectionManager().getCollectionFields;
32
- var form = useForm().values;
33
- var fields = getCollectionFields((_a = form === null || form === void 0 ? void 0 : form.config) === null || _a === void 0 ? void 0 : _a.collection)
34
- .filter(function (field) { return (!field.hidden
35
- && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)); });
36
- return { fields: fields };
37
- }
38
- }
26
+ 'x-component': 'CollectionFieldset'
39
27
  };
40
28
  export var filter = {
41
29
  type: 'object',
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/workflow/schemas/collection.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAEnF,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,CAAC,+BAA+B,CAAC;IAChD,aAAa,EAAE,UAAU;IACzB,aAAa,EAAE,QAAQ;CACxB,CAAC;AAEF,MAAM,CAAC,IAAM,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,sBAAsB;IAC5B,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE;QACnB,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,GAAG,0GAAA,uCAEb,IAAA;KACF;IACD,aAAa,EAAE,oBAAoB;IACnC,mBAAmB,EAAE;QACnB,QAAQ;;YACE,IAAA,mBAAmB,GAAK,oBAAoB,EAAE,oBAA3B,CAA4B;YAC/C,IAAQ,IAAI,GAAK,OAAO,EAAE,OAAd,CAAe;YACnC,IAAM,MAAM,GAAG,mBAAmB,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,0CAAE,UAAU,CAAC;iBACzD,MAAM,CAAC,UAAA,KAAK,IAAI,OAAA,CACf,CAAC,KAAK,CAAC,MAAM;mBACV,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAC/D,EAHgB,CAGhB,CAAC,CAAC;YACL,OAAO,EAAE,MAAM,QAAA,EAAE,CAAC;QACpB,CAAC;KACF;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,sBAAsB;IAC5B,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE;QACnB,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,GAAG,0GAAA,uCAEb,IAAA;KACF;IACD,aAAa,EAAE,QAAQ;IACvB,mBAAmB,EAAE;QACnB,QAAQ;;YACE,IAAA,MAAM,GAAK,OAAO,EAAE,OAAd,CAAe;YAC7B,IAAM,OAAO,GAAG,0BAA0B,CAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,UAAU,CAAC,CAAC;YACtE,OAAO;gBACL,OAAO,SAAA;gBACP,SAAS,EAAE,GAAG,sIAAA,mEAGb,IAAA;aACF,CAAC;QACJ,CAAC;QACD,gBAAgB,EAAE,mBAAmB;KACtC;CACF,CAAC","sourcesContent":["import { css } from \"@emotion/css\";\nimport { useForm } from \"@formily/react\";\nimport { useCollectionManager } from \"../../collection-manager\";\nimport { useCollectionFilterOptions } from \"../../collection-manager/action-hooks\";\n\nexport const collection = {\n type: 'string',\n title: '数据表',\n name: 'config.collection',\n required: true,\n 'x-reactions': ['{{useCollectionDataSource()}}'],\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n};\n\nexport const values = {\n type: 'object',\n title: '数据内容',\n name: 'config.params.values',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'CollectionFieldset',\n 'x-component-props': {\n useProps() {\n const { getCollectionFields } = useCollectionManager();\n const { values: form } = useForm();\n const fields = getCollectionFields(form?.config?.collection)\n .filter(field => (\n !field.hidden\n && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)\n ));\n return { fields };\n }\n }\n};\n\nexport const filter = {\n type: 'object',\n title: '筛选条件',\n name: 'config.params.filter',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'Filter',\n 'x-component-props': {\n useProps() {\n const { values } = useForm();\n const options = useCollectionFilterOptions(values.config?.collection);\n return {\n options,\n className: css`\n position: relative;\n width: 100%;\n `\n };\n },\n dynamicComponent: 'VariableComponent'\n }\n};\n"]}
1
+ {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/workflow/schemas/collection.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAEnF,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,CAAC,+BAA+B,CAAC;IAChD,aAAa,EAAE,UAAU;IACzB,aAAa,EAAE,QAAQ;CACxB,CAAC;AAEF,MAAM,CAAC,IAAM,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,sBAAsB;IAC5B,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE;QACnB,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,GAAG,0GAAA,uCAEb,IAAA;KACF;IACD,aAAa,EAAE,oBAAoB;CACpC,CAAC;AAEF,MAAM,CAAC,IAAM,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,sBAAsB;IAC5B,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE;QACnB,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,GAAG,0GAAA,uCAEb,IAAA;KACF;IACD,aAAa,EAAE,QAAQ;IACvB,mBAAmB,EAAE;QACnB,QAAQ;;YACE,IAAA,MAAM,GAAK,OAAO,EAAE,OAAd,CAAe;YAC7B,IAAM,OAAO,GAAG,0BAA0B,CAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,UAAU,CAAC,CAAC;YACtE,OAAO;gBACL,OAAO,SAAA;gBACP,SAAS,EAAE,GAAG,sIAAA,mEAGb,IAAA;aACF,CAAC;QACJ,CAAC;QACD,gBAAgB,EAAE,mBAAmB;KACtC;CACF,CAAC","sourcesContent":["import { css } from \"@emotion/css\";\nimport { useForm } from \"@formily/react\";\nimport { useCollectionManager } from \"../../collection-manager\";\nimport { useCollectionFilterOptions } from \"../../collection-manager/action-hooks\";\n\nexport const collection = {\n type: 'string',\n title: '数据表',\n name: 'config.collection',\n required: true,\n 'x-reactions': ['{{useCollectionDataSource()}}'],\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n};\n\nexport const values = {\n type: 'object',\n title: '数据内容',\n name: 'config.params.values',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'CollectionFieldset'\n};\n\nexport const filter = {\n type: 'object',\n title: '筛选条件',\n name: 'config.params.filter',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'Filter',\n 'x-component-props': {\n useProps() {\n const { values } = useForm();\n const options = useCollectionFilterOptions(values.config?.collection);\n return {\n options,\n className: css`\n position: relative;\n width: 100%;\n `\n };\n },\n dynamicComponent: 'VariableComponent'\n }\n};\n"]}
@@ -14,6 +14,17 @@ var __assign = (this && this.__assign) || function () {
14
14
  };
15
15
  return __assign.apply(this, arguments);
16
16
  };
17
+ var __rest = (this && this.__rest) || function (s, e) {
18
+ var t = {};
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
20
+ t[p] = s[p];
21
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
22
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
24
+ t[p[i]] = s[p[i]];
25
+ }
26
+ return t;
27
+ };
17
28
  var __read = (this && this.__read) || function (o, n) {
18
29
  var m = typeof Symbol === "function" && o[Symbol.iterator];
19
30
  if (!m) return o;
@@ -50,6 +61,7 @@ var react_2 = require("@formily/react");
50
61
  var antd_1 = require("@formily/antd");
51
62
  var antd_2 = require("antd");
52
63
  var css_1 = require("@emotion/css");
64
+ var icons_1 = require("@ant-design/icons");
53
65
  var nodes_1 = require("./nodes");
54
66
  var WorkflowCanvas_1 = require("./WorkflowCanvas");
55
67
  var triggers_1 = require("./triggers");
@@ -333,34 +345,55 @@ function VariableComponent(_a) {
333
345
  exports.VariableComponent = VariableComponent;
334
346
  // NOTE: observer for watching useProps
335
347
  exports.CollectionFieldset = (0, react_2.observer)(function (_a) {
336
- var value = _a.value, onChange = _a.onChange, useProps = _a.useProps;
337
- var fields = useProps().fields;
348
+ var _b;
349
+ var value = _a.value, onChange = _a.onChange;
338
350
  var compile = (0, __1.useCompile)();
351
+ var getCollectionFields = (0, __1.useCollectionManager)().getCollectionFields;
352
+ var data = (0, react_2.useForm)().values;
353
+ var fields = getCollectionFields((_b = data === null || data === void 0 ? void 0 : data.config) === null || _b === void 0 ? void 0 : _b.collection)
354
+ .filter(function (field) { return (!field.hidden
355
+ && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)); });
339
356
  var VTypes = __assign(__assign({}, exports.VariableTypes), { constant: {
340
357
  title: '常量',
341
358
  value: 'constant',
342
359
  options: undefined
343
360
  } });
344
361
  return ((0, jsx_runtime_1.jsx)("fieldset", __assign({ className: (0, css_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-top: .5em;\n\n > .ant-formily-item{\n flex-direction: column;\n\n > .ant-formily-item-label{\n line-height: 32px;\n }\n }\n "], ["\n margin-top: .5em;\n\n > .ant-formily-item{\n flex-direction: column;\n\n > .ant-formily-item-label{\n line-height: 32px;\n }\n }\n "]))) }, { children: fields.length
345
- ? fields.map(function (field) {
346
- var _a, _b;
347
- var operand = typeof value[field.name] === 'string'
348
- ? parseStringValue(value[field.name], VTypes)
349
- : { type: 'constant', value: value[field.name] };
350
- return ((0, jsx_runtime_1.jsx)(antd_1.FormItem, __assign({ label: compile((_b = (_a = field.uiSchema) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : field.name), labelAlign: "left" }, { children: (0, jsx_runtime_1.jsx)(exports.VariableTypesContext.Provider, __assign({ value: VTypes }, { children: (0, jsx_runtime_1.jsx)(Operand, __assign({ value: operand, onChange: function (next) {
351
- var _a, _b;
352
- if (next.type !== operand.type && next.type === 'constant') {
353
- onChange(__assign(__assign({}, value), (_a = {}, _a[field.name] = null, _a)));
354
- }
355
- else {
356
- var stringify = VTypes[next.type].stringify;
357
- onChange(__assign(__assign({}, value), (_b = {}, _b[field.name] = stringify(next), _b)));
358
- }
359
- } }, { children: operand.type === 'constant'
360
- ? (0, jsx_runtime_1.jsx)(__1.SchemaComponent, { schema: __assign(__assign({}, field.uiSchema), { name: field.name }) }, void 0)
361
- : null }), void 0) }), void 0) }), void 0));
362
- })
362
+ ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [fields
363
+ .filter(function (field) { return field.name in value; })
364
+ .map(function (field) {
365
+ var _a, _b;
366
+ var operand = typeof value[field.name] === 'string'
367
+ ? parseStringValue(value[field.name], VTypes)
368
+ : { type: 'constant', value: value[field.name] };
369
+ return ((0, jsx_runtime_1.jsx)(antd_1.FormItem, __assign({ label: compile((_b = (_a = field.uiSchema) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : field.name), labelAlign: "left", className: (0, css_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n .ant-formily-item-control-content-component{\n display: flex;\n }\n "], ["\n .ant-formily-item-control-content-component{\n display: flex;\n }\n "]))) }, { children: (0, jsx_runtime_1.jsxs)(exports.VariableTypesContext.Provider, __assign({ value: VTypes }, { children: [(0, jsx_runtime_1.jsx)(Operand, __assign({ value: operand, onChange: function (next) {
370
+ var _a, _b;
371
+ if (next.type !== operand.type && next.type === 'constant') {
372
+ onChange(__assign(__assign({}, value), (_a = {}, _a[field.name] = null, _a)));
373
+ }
374
+ else {
375
+ var stringify = VTypes[next.type].stringify;
376
+ onChange(__assign(__assign({}, value), (_b = {}, _b[field.name] = stringify(next), _b)));
377
+ }
378
+ } }, { children: operand.type === 'constant'
379
+ ? (0, jsx_runtime_1.jsx)(__1.SchemaComponent, { schema: __assign(__assign({}, field.uiSchema), { name: field.name }) }, void 0)
380
+ : null }), void 0), (0, jsx_runtime_1.jsx)(antd_2.Button, { type: "link", icon: (0, jsx_runtime_1.jsx)(icons_1.CloseCircleOutlined, {}, void 0), onClick: function () {
381
+ var _a = value, _b = field.name, _ = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
382
+ onChange(rest);
383
+ } }, void 0)] }), void 0) }), field.name));
384
+ }), Object.keys(value).length < fields.length
385
+ ? ((0, jsx_runtime_1.jsx)(antd_2.Dropdown, __assign({ overlay: (0, jsx_runtime_1.jsx)(antd_2.Menu, __assign({ onClick: function (_a) {
386
+ var _b;
387
+ var key = _a.key;
388
+ return onChange(__assign(__assign({}, value), (_b = {}, _b[key] = null, _b)));
389
+ } }, { children: fields
390
+ .filter(function (field) { return !(field.name in value); })
391
+ .map(function (field) {
392
+ var _a, _b;
393
+ return ((0, jsx_runtime_1.jsx)(antd_2.Menu.Item, { children: compile((_b = (_a = field.uiSchema) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : field.name) }, field.name));
394
+ }) }), void 0) }, { children: (0, jsx_runtime_1.jsx)(antd_2.Button, __assign({ icon: (0, jsx_runtime_1.jsx)(icons_1.PlusOutlined, {}, void 0) }, { children: "\u6DFB\u52A0\u5B57\u6BB5" }), void 0) }), void 0))
395
+ : null] }, void 0))
363
396
  : (0, jsx_runtime_1.jsx)("p", { children: "\u8BF7\u5148\u9009\u62E9\u6570\u636E\u8868" }, void 0) }), void 0));
364
397
  });
365
- var templateObject_1, templateObject_2, templateObject_3;
398
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
366
399
  //# sourceMappingURL=calculators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"calculators.js","sourceRoot":"","sources":["../../src/workflow/calculators.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wCAA0C;AAC1C,sCAAyC;AACzC,6BAAwE;AACxE,oCAAmC;AAEnC,iCAAuD;AACvD,mDAAkD;AAClD,uCAAsC;AACtC,wBAAiD;AAEjD,SAAS,UAAU;IACjB,OAAO,IAAI,CAAC;AACd,CAAC;AAEY,QAAA,WAAW,GAAG;IACzB;QACE,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE;YACR,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE;YAC7B,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE;YAChC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;YAC1B,EA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I,CAAC,IAAI,CAAC,UAAtB,CAAuB;oCACxC,QAAQ,uBAAM,KAAK,gBAAG,KAAK,CAAC,IAAI,IAAG,SAAS,CAAC,IAAI,CAAC,OAAG,CAAC;iCACvD;4BACH,CAAC,gBAEA,OAAO,CAAC,IAAI,KAAK,UAAU;gCAC1B,CAAC,CAAC,uBAAC,mBAAe,IAAC,MAAM,wBAAO,KAAK,CAAC,QAAQ,KAAE,IAAI,EAAE,KAAK,CAAC,IAAI,cAAM;gCACtE,CAAC,CAAC,IAAI,YAEA,YACoB,YACvB,CACZ,CAAC;YACJ,CAAC,CAAC;YACJ,CAAC,CAAC,+FAAc,YAET,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { observer } from \"@formily/react\";\nimport { FormItem } from \"@formily/antd\";\nimport { Cascader, DatePicker, Input, InputNumber, Select } from \"antd\";\nimport { css } from \"@emotion/css\";\n\nimport { instructions, useNodeContext } from \"./nodes\";\nimport { useFlowContext } from \"./WorkflowCanvas\";\nimport { triggers } from \"./triggers\";\nimport { SchemaComponent, useCompile } from \"..\";\n\nfunction NullRender() {\n return null;\n}\n\nexport const calculators = [\n {\n value: 'boolean',\n title: '值比较',\n children: [\n { value: 'equal', name: '=' },\n { value: 'notEqual', name: '≠' },\n { value: 'gt', name: '>' },\n { value: 'gte', name: '≥' },\n { value: 'lt', name: '<' },\n { value: 'lte', name: '≤' }\n ]\n },\n {\n value: 'number',\n title: '算术运算',\n children: [\n { value: 'add', name: '+' },\n { value: 'minus', name: '-' },\n { value: 'multiple', name: '*' },\n { value: 'divide', name: '/' },\n { value: 'mod', name: '%' },\n ]\n },\n {\n value: 'string',\n title: '字符串',\n children: [\n { value: 'includes', name: '包含' },\n { value: 'notIncludes', name: '不包含' },\n { value: 'startsWith', name: '开头是' },\n { value: 'notStartsWith', name: '开头不是' },\n { value: 'endsWith', name: '结尾是' },\n { value: 'notEndsWith', name: '结尾不是' }\n ]\n },\n {\n value: 'date',\n title: '日期',\n children: []\n }\n];\n\nconst JT_VALUE_RE = /^\\s*\\{\\{([\\s\\S]*)\\}\\}\\s*$/;\n\nexport function parseStringValue(value: string, Types) {\n const matcher = value.match(JT_VALUE_RE);\n if (!matcher) {\n return { type: 'constant', value, options: { type: 'string' } };\n }\n\n const [type, ...paths] = matcher[1].split('.');\n\n return {\n type,\n options: paths.length ? (Types || VariableTypes)[type]?.parse(paths) : {}\n };\n}\n\nexport const BaseTypeSet = new Set(['boolean', 'number', 'string', 'date']);\n\nconst ConstantTypes = {\n string: {\n title: '字符串',\n value: 'string',\n component({ onChange, type, options, value }) {\n return (\n <Input\n value={value}\n onChange={ev => onChange({ value: ev.target.value, type, options })}\n />\n );\n },\n default: ''\n },\n number: {\n title: '数字',\n value: 'number',\n component({ onChange, type, options, value }) {\n return (\n <InputNumber\n value={value}\n onChange={v => onChange({ value: v, type, options })}\n />\n );\n },\n default: 0\n },\n boolean: {\n title: '逻辑值',\n value: 'boolean',\n component({ onChange, type, options, value }) {\n return (\n <Select value={value} onChange={v => onChange({ value: v, type, options })}>\n <Select.Option value={true}>真</Select.Option>\n <Select.Option value={false}>假</Select.Option>\n </Select>\n );\n },\n default: false\n },\n // date: {\n // title: '日期',\n // value: 'date',\n // component({ onChange, type, options, value }) {\n // return <DatePicker value={value} onChange={v => onChange({ value: v, type, options })}/>;\n // },\n // default: new Date()\n // }\n};\n\nexport const VariableTypes = {\n constant: {\n title: '常量',\n value: 'constant',\n options: Object.values(ConstantTypes).map(item => ({\n value: item.value,\n label: item.title\n })),\n component({ options = { type: 'string' } }) {\n return ConstantTypes[options.type]?.component ?? NullRender;\n },\n appendTypeValue({ options = { type: 'string' } }) {\n return options?.type ? [options.type] : [];\n },\n onTypeChange(old, [type, optionsType], onChange) {\n if (old?.options?.type === optionsType) {\n return;\n }\n const { default: value } = ConstantTypes[optionsType];\n onChange({\n value,\n type,\n options: { ...old.options, type: optionsType }\n });\n },\n parse(path) {\n return { path };\n }\n },\n $jobsMapByNodeId: {\n title: '节点数据',\n value: '$jobsMapByNodeId',\n options() {\n const node = useNodeContext();\n const stack = [];\n for (let current = node.upstream; current; current = current.upstream) {\n const { getter } = instructions.get(current.type);\n // Note: consider `getter` as the key of a value available node\n if (getter) {\n stack.push({\n value: current.id,\n label: current.title ?? `#${current.id}`\n });\n }\n }\n\n return stack;\n },\n component({ options }) {\n const { nodes } = useFlowContext();\n if (!options?.nodeId) {\n return NullRender;\n }\n const node = nodes.find(n => n.id == options.nodeId);\n if (!node) {\n return NullRender;\n }\n const instruction = instructions.get(node.type);\n return instruction?.getter ?? NullRender;\n },\n appendTypeValue({ options = {} }: { type: string, options: any }) {\n return options.nodeId ? [Number.parseInt(options.nodeId, 10)] : [];\n },\n onTypeChange(old, [type, nodeId], onChange) {\n onChange({\n // ...old,\n type,\n options: { nodeId }\n });\n },\n parse([nodeId, ...path]) {\n return { nodeId, path: path.join('.') };\n },\n stringify({ options }) {\n const stack = ['$jobsMapByNodeId'];\n if (options.nodeId) {\n stack.push(options.nodeId);\n if (options.path) {\n stack.push(options.path);\n }\n }\n return `{{${stack.join('.')}}}`;\n }\n },\n $context: {\n title: '触发数据',\n value: '$context',\n component() {\n const { workflow } = useFlowContext();\n const trigger = triggers.get(workflow.type);\n return trigger?.getter ?? NullRender;\n },\n parse([prefix, ...path]) {\n return { path: path.join('.') };\n },\n stringify({ options }) {\n const stack = ['$context'];\n if (options?.path) {\n stack.push(options.path);\n }\n return `{{${stack.join('.')}}}`;\n }\n },\n // calculation: Calculation\n};\n\nexport const VariableTypesContext = React.createContext(null);\n\nexport function useVariableTypes() {\n return React.useContext(VariableTypesContext);\n}\n\ninterface OperandProps {\n value: {\n type: string;\n value?: any;\n options?: any;\n };\n onChange(v: any): void;\n children?: React.ReactNode;\n}\n\nexport function Operand({\n value: operand = { type: 'constant', value: '', options: { type: 'string' } },\n onChange,\n children\n}: OperandProps) {\n const Types = useVariableTypes();\n\n const { type } = operand;\n\n const { component, appendTypeValue } = Types[type] || {};\n const VariableComponent = typeof component === 'function' ? component(operand) : NullRender;\n\n return (\n <div className={css`\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select,\n .ant-cascader-picker,\n .ant-picker,\n .ant-input-number,\n .ant-input-affix-wrapper{\n width: auto;\n }\n `}>\n <Cascader\n allowClear={false}\n value={[type, ...(appendTypeValue ? appendTypeValue(operand) : [])]}\n options={Object.values(Types).map((item: any) => {\n const options = typeof item.options === 'function' ? item.options() : item.options;\n return {\n label: item.title,\n value: item.value,\n children: options,\n disabled: options && !options.length,\n isLeaf: !options\n };\n })}\n onChange={(next: Array<string | number>) => {\n const { onTypeChange } = Types[next[0]];\n if (typeof onTypeChange === 'function') {\n onTypeChange(operand, next, onChange);\n } else {\n if (next[0] !== type) {\n onChange({ type: next[0], value: null });\n }\n }\n }}\n />\n {children ?? <VariableComponent {...operand} onChange={op => onChange({ ...op })} />}\n </div>\n );\n}\n\nexport function Calculation({ calculator, operands = [], onChange }) {\n return (\n <VariableTypesContext.Provider value={VariableTypes}>\n <div className={css`\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select{\n width: auto;\n min-width: 6em;\n }\n `}>\n <Operand value={operands[0]} onChange={(v => onChange({ calculator, operands: [v, operands[1]] }))} />\n {operands[0]\n ? (\n <>\n <Select value={calculator} onChange={v => onChange({ operands, calculator: v })}>\n {calculators.map(group => (\n <Select.OptGroup key={group.value} label={group.title}>\n {group.children.map(item => (\n <Select.Option key={item.value} value={item.value}>{item.name}</Select.Option>\n ))}\n </Select.OptGroup>\n ))}\n </Select>\n <Operand value={operands[1]} onChange={(v => onChange({ calculator, operands: [operands[0], v] }))} />\n </>\n )\n : null\n }\n </div>\n </VariableTypesContext.Provider>\n );\n}\n\nexport function VariableComponent({ value, onChange, renderSchemaComponent }) {\n const VTypes = { ...VariableTypes,\n constant: {\n title: '常量',\n value: 'constant',\n options: undefined\n }\n };\n\n const operand = typeof value === 'string'\n ? parseStringValue(value, VTypes)\n : { type: 'constant', value };\n\n return (\n <VariableTypesContext.Provider value={VTypes}>\n <Operand\n value={operand}\n onChange={(next) => {\n if (next.type !== operand.type && next.type === 'constant') {\n onChange(null);\n } else {\n const { stringify } = VTypes[next.type];\n onChange(stringify(next));\n }\n }}\n >\n {operand.type === 'constant' ? renderSchemaComponent() : null}\n </Operand>\n </VariableTypesContext.Provider>\n );\n}\n\n// NOTE: observer for watching useProps\nexport const CollectionFieldset = observer(({ value, onChange, useProps }: any) => {\n const { fields } = useProps();\n const compile = useCompile();\n\n const VTypes = { ...VariableTypes,\n constant: {\n title: '常量',\n value: 'constant',\n options: undefined\n }\n };\n\n return (\n <fieldset className={css`\n margin-top: .5em;\n\n > .ant-formily-item{\n flex-direction: column;\n\n > .ant-formily-item-label{\n line-height: 32px;\n }\n }\n `}>\n {fields.length\n ? fields.map(field => {\n const operand = typeof value[field.name] === 'string'\n ? parseStringValue(value[field.name], VTypes)\n : { type: 'constant', value: value[field.name] };\n\n return (\n <FormItem label={compile(field.uiSchema?.title ?? field.name)} labelAlign=\"left\">\n <VariableTypesContext.Provider value={VTypes}>\n <Operand\n value={operand}\n onChange={(next) => {\n if (next.type !== operand.type && next.type === 'constant') {\n onChange({ ...value, [field.name]: null });\n } else {\n const { stringify } = VTypes[next.type];\n onChange({ ...value, [field.name]: stringify(next) });\n }\n }}\n >\n {operand.type === 'constant'\n ? <SchemaComponent schema={{ ...field.uiSchema, name: field.name }} />\n : null\n }\n </Operand>\n </VariableTypesContext.Provider>\n </FormItem>\n );\n })\n : <p>请先选择数据表</p>\n }\n </fieldset>\n );\n});\n"]}
1
+ {"version":3,"file":"calculators.js","sourceRoot":"","sources":["../../src/workflow/calculators.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wCAAmD;AACnD,sCAAyC;AACzC,6BAAoF;AACpF,oCAAmC;AACnC,2CAAsE;AAEtE,iCAAuD;AACvD,mDAAkD;AA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AAC,aAAM,IACL,IAAI,EAAC,MAAM,EACX,IAAI,EAAE,uBAAC,2BAAmB,aAAG,EAC7B,OAAO,EAAE;4CACP,IAAqC,KAAA,KAAK,EAAlC,KAAC,KAAK,CAAC,IAAK,EAAE,CAAC,SAAA,EAAK,IAAI,cAA1B,uCAA4B,CAAQ,CAAC;4CAC3C,QAAQ,CAAC,IAAI,CAAC,CAAC;wCACjB,CAAC,WACD,aAC4B,KA9BnB,KAAK,CAAC,IAAI,CA+Bd,CACZ,CAAC;oBACJ,CAAC,CAAC,EACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM;wBACxC,CAAC,CAAC,CACA,uBAAC,eAAQ,aAAC,OAAO,EACf,uBAAC,WAAI,aAAC,OAAO,EAAE,UAAC,EAAO;;wCAAL,GAAG,SAAA;oCAAO,OAAA,QAAQ,uBAAM,KAAK,gBAAG,GAAG,IAAG,IAAI,OAAG;gCAAnC,CAAmC,gBAC5D,MAAM;qCACJ,MAAM,CAAC,UAAA,KAAK,IAAI,OAAA,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAtB,CAAsB,CAAC;qCACvC,GAAG,CAAC,UAAA,KAAK;;oCAAI,OAAA,CACZ,uBAAC,WAAI,CAAC,IAAI,cAAmB,OAAO,CAAC,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,KAAK,mCAAI,KAAK,CAAC,IAAI,CAAC,IAAzD,KAAK,CAAC,IAAI,CAA4D,CACvF,CAAA;iCAAA,CAAC,YACC,gBAEP,uBAAC,aAAM,aAAC,IAAI,EAAE,uBAAC,oBAAY,aAAG,sDAAe,YACpC,CACZ;wBACD,CAAC,CAAC,IAAI,YAEP,CACJ;YACD,CAAC,CAAC,+FAAc,YAET,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { observer, useForm } from \"@formily/react\";\nimport { FormItem } from \"@formily/antd\";\nimport { Button, Cascader, Dropdown, Input, InputNumber, Menu, Select } from \"antd\";\nimport { css } from \"@emotion/css\";\nimport { PlusOutlined, CloseCircleOutlined } from '@ant-design/icons';\n\nimport { instructions, useNodeContext } from \"./nodes\";\nimport { useFlowContext } from \"./WorkflowCanvas\";\nimport { triggers } from \"./triggers\";\nimport { SchemaComponent, useCollectionManager, useCompile } from \"..\";\n\nfunction NullRender() {\n return null;\n}\n\nexport const calculators = [\n {\n value: 'boolean',\n title: '值比较',\n children: [\n { value: 'equal', name: '=' },\n { value: 'notEqual', name: '≠' },\n { value: 'gt', name: '>' },\n { value: 'gte', name: '≥' },\n { value: 'lt', name: '<' },\n { value: 'lte', name: '≤' }\n ]\n },\n {\n value: 'number',\n title: '算术运算',\n children: [\n { value: 'add', name: '+' },\n { value: 'minus', name: '-' },\n { value: 'multiple', name: '*' },\n { value: 'divide', name: '/' },\n { value: 'mod', name: '%' },\n ]\n },\n {\n value: 'string',\n title: '字符串',\n children: [\n { value: 'includes', name: '包含' },\n { value: 'notIncludes', name: '不包含' },\n { value: 'startsWith', name: '开头是' },\n { value: 'notStartsWith', name: '开头不是' },\n { value: 'endsWith', name: '结尾是' },\n { value: 'notEndsWith', name: '结尾不是' }\n ]\n },\n {\n value: 'date',\n title: '日期',\n children: []\n }\n];\n\nconst JT_VALUE_RE = /^\\s*\\{\\{([\\s\\S]*)\\}\\}\\s*$/;\n\nexport function parseStringValue(value: string, Types) {\n const matcher = value.match(JT_VALUE_RE);\n if (!matcher) {\n return { type: 'constant', value, options: { type: 'string' } };\n }\n\n const [type, ...paths] = matcher[1].split('.');\n\n return {\n type,\n options: paths.length ? (Types || VariableTypes)[type]?.parse(paths) : {}\n };\n}\n\nexport const BaseTypeSet = new Set(['boolean', 'number', 'string', 'date']);\n\nconst ConstantTypes = {\n string: {\n title: '字符串',\n value: 'string',\n component({ onChange, type, options, value }) {\n return (\n <Input\n value={value}\n onChange={ev => onChange({ value: ev.target.value, type, options })}\n />\n );\n },\n default: ''\n },\n number: {\n title: '数字',\n value: 'number',\n component({ onChange, type, options, value }) {\n return (\n <InputNumber\n value={value}\n onChange={v => onChange({ value: v, type, options })}\n />\n );\n },\n default: 0\n },\n boolean: {\n title: '逻辑值',\n value: 'boolean',\n component({ onChange, type, options, value }) {\n return (\n <Select value={value} onChange={v => onChange({ value: v, type, options })}>\n <Select.Option value={true}>真</Select.Option>\n <Select.Option value={false}>假</Select.Option>\n </Select>\n );\n },\n default: false\n },\n // date: {\n // title: '日期',\n // value: 'date',\n // component({ onChange, type, options, value }) {\n // return <DatePicker value={value} onChange={v => onChange({ value: v, type, options })}/>;\n // },\n // default: new Date()\n // }\n};\n\nexport const VariableTypes = {\n constant: {\n title: '常量',\n value: 'constant',\n options: Object.values(ConstantTypes).map(item => ({\n value: item.value,\n label: item.title\n })),\n component({ options = { type: 'string' } }) {\n return ConstantTypes[options.type]?.component ?? NullRender;\n },\n appendTypeValue({ options = { type: 'string' } }) {\n return options?.type ? [options.type] : [];\n },\n onTypeChange(old, [type, optionsType], onChange) {\n if (old?.options?.type === optionsType) {\n return;\n }\n const { default: value } = ConstantTypes[optionsType];\n onChange({\n value,\n type,\n options: { ...old.options, type: optionsType }\n });\n },\n parse(path) {\n return { path };\n }\n },\n $jobsMapByNodeId: {\n title: '节点数据',\n value: '$jobsMapByNodeId',\n options() {\n const node = useNodeContext();\n const stack = [];\n for (let current = node.upstream; current; current = current.upstream) {\n const { getter } = instructions.get(current.type);\n // Note: consider `getter` as the key of a value available node\n if (getter) {\n stack.push({\n value: current.id,\n label: current.title ?? `#${current.id}`\n });\n }\n }\n\n return stack;\n },\n component({ options }) {\n const { nodes } = useFlowContext();\n if (!options?.nodeId) {\n return NullRender;\n }\n const node = nodes.find(n => n.id == options.nodeId);\n if (!node) {\n return NullRender;\n }\n const instruction = instructions.get(node.type);\n return instruction?.getter ?? NullRender;\n },\n appendTypeValue({ options = {} }: { type: string, options: any }) {\n return options.nodeId ? [Number.parseInt(options.nodeId, 10)] : [];\n },\n onTypeChange(old, [type, nodeId], onChange) {\n onChange({\n // ...old,\n type,\n options: { nodeId }\n });\n },\n parse([nodeId, ...path]) {\n return { nodeId, path: path.join('.') };\n },\n stringify({ options }) {\n const stack = ['$jobsMapByNodeId'];\n if (options.nodeId) {\n stack.push(options.nodeId);\n if (options.path) {\n stack.push(options.path);\n }\n }\n return `{{${stack.join('.')}}}`;\n }\n },\n $context: {\n title: '触发数据',\n value: '$context',\n component() {\n const { workflow } = useFlowContext();\n const trigger = triggers.get(workflow.type);\n return trigger?.getter ?? NullRender;\n },\n parse([prefix, ...path]) {\n return { path: path.join('.') };\n },\n stringify({ options }) {\n const stack = ['$context'];\n if (options?.path) {\n stack.push(options.path);\n }\n return `{{${stack.join('.')}}}`;\n }\n },\n // calculation: Calculation\n};\n\nexport const VariableTypesContext = React.createContext(null);\n\nexport function useVariableTypes() {\n return React.useContext(VariableTypesContext);\n}\n\ninterface OperandProps {\n value: {\n type: string;\n value?: any;\n options?: any;\n };\n onChange(v: any): void;\n children?: React.ReactNode;\n}\n\nexport function Operand({\n value: operand = { type: 'constant', value: '', options: { type: 'string' } },\n onChange,\n children\n}: OperandProps) {\n const Types = useVariableTypes();\n\n const { type } = operand;\n\n const { component, appendTypeValue } = Types[type] || {};\n const VariableComponent = typeof component === 'function' ? component(operand) : NullRender;\n\n return (\n <div className={css`\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select,\n .ant-cascader-picker,\n .ant-picker,\n .ant-input-number,\n .ant-input-affix-wrapper{\n width: auto;\n }\n `}>\n <Cascader\n allowClear={false}\n value={[type, ...(appendTypeValue ? appendTypeValue(operand) : [])]}\n options={Object.values(Types).map((item: any) => {\n const options = typeof item.options === 'function' ? item.options() : item.options;\n return {\n label: item.title,\n value: item.value,\n children: options,\n disabled: options && !options.length,\n isLeaf: !options\n };\n })}\n onChange={(next: Array<string | number>) => {\n const { onTypeChange } = Types[next[0]];\n if (typeof onTypeChange === 'function') {\n onTypeChange(operand, next, onChange);\n } else {\n if (next[0] !== type) {\n onChange({ type: next[0], value: null });\n }\n }\n }}\n />\n {children ?? <VariableComponent {...operand} onChange={op => onChange({ ...op })} />}\n </div>\n );\n}\n\nexport function Calculation({ calculator, operands = [], onChange }) {\n return (\n <VariableTypesContext.Provider value={VariableTypes}>\n <div className={css`\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select{\n width: auto;\n min-width: 6em;\n }\n `}>\n <Operand value={operands[0]} onChange={(v => onChange({ calculator, operands: [v, operands[1]] }))} />\n {operands[0]\n ? (\n <>\n <Select value={calculator} onChange={v => onChange({ operands, calculator: v })}>\n {calculators.map(group => (\n <Select.OptGroup key={group.value} label={group.title}>\n {group.children.map(item => (\n <Select.Option key={item.value} value={item.value}>{item.name}</Select.Option>\n ))}\n </Select.OptGroup>\n ))}\n </Select>\n <Operand value={operands[1]} onChange={(v => onChange({ calculator, operands: [operands[0], v] }))} />\n </>\n )\n : null\n }\n </div>\n </VariableTypesContext.Provider>\n );\n}\n\nexport function VariableComponent({ value, onChange, renderSchemaComponent }) {\n const VTypes = { ...VariableTypes,\n constant: {\n title: '常量',\n value: 'constant',\n options: undefined\n }\n };\n\n const operand = typeof value === 'string'\n ? parseStringValue(value, VTypes)\n : { type: 'constant', value };\n\n return (\n <VariableTypesContext.Provider value={VTypes}>\n <Operand\n value={operand}\n onChange={(next) => {\n if (next.type !== operand.type && next.type === 'constant') {\n onChange(null);\n } else {\n const { stringify } = VTypes[next.type];\n onChange(stringify(next));\n }\n }}\n >\n {operand.type === 'constant' ? renderSchemaComponent() : null}\n </Operand>\n </VariableTypesContext.Provider>\n );\n}\n\n// NOTE: observer for watching useProps\nexport const CollectionFieldset = observer(({ value, onChange }: any) => {\n const compile = useCompile();\n const { getCollectionFields } = useCollectionManager();\n const { values: data } = useForm();\n const fields = getCollectionFields(data?.config?.collection)\n .filter(field => (\n !field.hidden\n && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)\n ));\n\n const VTypes = {\n ...VariableTypes,\n constant: {\n title: '常量',\n value: 'constant',\n options: undefined\n }\n };\n\n return (\n <fieldset className={css`\n margin-top: .5em;\n\n > .ant-formily-item{\n flex-direction: column;\n\n > .ant-formily-item-label{\n line-height: 32px;\n }\n }\n `}>\n {fields.length\n ? (\n <>\n {fields\n .filter(field => field.name in value)\n .map(field => {\n const operand = typeof value[field.name] === 'string'\n ? parseStringValue(value[field.name], VTypes)\n : { type: 'constant', value: value[field.name] };\n\n return (\n <FormItem key={field.name} label={compile(field.uiSchema?.title ?? field.name)} labelAlign=\"left\" className={css`\n .ant-formily-item-control-content-component{\n display: flex;\n }\n `}>\n <VariableTypesContext.Provider value={VTypes}>\n <Operand\n value={operand}\n onChange={(next) => {\n if (next.type !== operand.type && next.type === 'constant') {\n onChange({ ...value, [field.name]: null });\n } else {\n const { stringify } = VTypes[next.type];\n onChange({ ...value, [field.name]: stringify(next) });\n }\n }}\n >\n {operand.type === 'constant'\n ? <SchemaComponent schema={{ ...field.uiSchema, name: field.name }} />\n : null\n }\n </Operand>\n <Button\n type=\"link\"\n icon={<CloseCircleOutlined />}\n onClick={() => {\n const { [field.name]: _, ...rest } = value;\n onChange(rest);\n }}\n />\n </VariableTypesContext.Provider>\n </FormItem>\n );\n })}\n {Object.keys(value).length < fields.length\n ? (\n <Dropdown overlay={\n <Menu onClick={({ key }) => onChange({ ...value, [key]: null })}>\n {fields\n .filter(field => !(field.name in value))\n .map(field => (\n <Menu.Item key={field.name}>{compile(field.uiSchema?.title ?? field.name)}</Menu.Item>\n ))}\n </Menu>\n }>\n <Button icon={<PlusOutlined />}>添加字段</Button>\n </Dropdown>\n )\n : null\n }\n </>\n )\n : <p>请先选择数据表</p>\n }\n </fieldset>\n );\n});\n"]}
@@ -30,11 +30,6 @@ declare const _default: {
30
30
  className: string;
31
31
  };
32
32
  'x-component': string;
33
- 'x-component-props': {
34
- useProps(): {
35
- fields: any;
36
- };
37
- };
38
33
  };
39
34
  };
40
35
  };
@@ -49,11 +49,6 @@ declare const _default: {
49
49
  className: string;
50
50
  };
51
51
  'x-component': string;
52
- 'x-component-props': {
53
- useProps(): {
54
- fields: any;
55
- };
56
- };
57
52
  };
58
53
  };
59
54
  };
@@ -17,11 +17,6 @@ export declare const values: {
17
17
  className: string;
18
18
  };
19
19
  'x-component': string;
20
- 'x-component-props': {
21
- useProps(): {
22
- fields: any;
23
- };
24
- };
25
20
  };
26
21
  export declare const filter: {
27
22
  type: string;
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.filter = exports.values = exports.collection = void 0;
8
8
  var css_1 = require("@emotion/css");
9
9
  var react_1 = require("@formily/react");
10
- var collection_manager_1 = require("../../collection-manager");
11
10
  var action_hooks_1 = require("../../collection-manager/action-hooks");
12
11
  exports.collection = {
13
12
  type: 'string',
@@ -27,18 +26,7 @@ exports.values = {
27
26
  labelAlign: 'left',
28
27
  className: (0, css_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: column;\n "], ["\n flex-direction: column;\n "])))
29
28
  },
30
- 'x-component': 'CollectionFieldset',
31
- 'x-component-props': {
32
- useProps: function () {
33
- var _a;
34
- var getCollectionFields = (0, collection_manager_1.useCollectionManager)().getCollectionFields;
35
- var form = (0, react_1.useForm)().values;
36
- var fields = getCollectionFields((_a = form === null || form === void 0 ? void 0 : form.config) === null || _a === void 0 ? void 0 : _a.collection)
37
- .filter(function (field) { return (!field.hidden
38
- && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)); });
39
- return { fields: fields };
40
- }
41
- }
29
+ 'x-component': 'CollectionFieldset'
42
30
  };
43
31
  exports.filter = {
44
32
  type: 'object',
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/workflow/schemas/collection.ts"],"names":[],"mappings":";;;;;;;AAAA,oCAAmC;AACnC,wCAAyC;AACzC,+DAAgE;AAChE,sEAAmF;AAEtE,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,KAAK,E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AQ;;YACE,IAAA,MAAM,GAAK,IAAA,eAAO,GAAE,OAAd,CAAe;YAC7B,IAAM,OAAO,GAAG,IAAA,yCAA0B,EAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,UAAU,CAAC,CAAC;YACtE,OAAO;gBACL,OAAO,SAAA;gBACP,SAAS,MAAE,SAAG,uIAAA,mEAGb,IAAA;aACF,CAAC;QACJ,CAAC;QACD,gBAAgB,EAAE,mBAAmB;KACtC;CACF,CAAC","sourcesContent":["import { css } from \"@emotion/css\";\nimport { useForm } from \"@formily/react\";\nimport { useCollectionManager } from \"../../collection-manager\";\nimport { useCollectionFilterOptions } from \"../../collection-manager/action-hooks\";\n\nexport const collection = {\n type: 'string',\n title: '数据表',\n name: 'config.collection',\n required: true,\n 'x-reactions': ['{{useCollectionDataSource()}}'],\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n};\n\nexport const values = {\n type: 'object',\n title: '数据内容',\n name: 'config.params.values',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'CollectionFieldset',\n 'x-component-props': {\n useProps() {\n const { getCollectionFields } = useCollectionManager();\n const { values: form } = useForm();\n const fields = getCollectionFields(form?.config?.collection)\n .filter(field => (\n !field.hidden\n && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)\n ));\n return { fields };\n }\n }\n};\n\nexport const filter = {\n type: 'object',\n title: '筛选条件',\n name: 'config.params.filter',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'Filter',\n 'x-component-props': {\n useProps() {\n const { values } = useForm();\n const options = useCollectionFilterOptions(values.config?.collection);\n return {\n options,\n className: css`\n position: relative;\n width: 100%;\n `\n };\n },\n dynamicComponent: 'VariableComponent'\n }\n};\n"]}
1
+ {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/workflow/schemas/collection.ts"],"names":[],"mappings":";;;;;;;AAAA,oCAAmC;AACnC,wCAAyC;AAEzC,sEAAmF;AAEtE,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,CAAC,+BAA+B,CAAC;IAChD,aAAa,EAAE,UAAU;IACzB,aAAa,EAAE,QAAQ;CACxB,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,sBAAsB;IAC5B,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE;QACnB,UAAU,EAAE,MAAM;QAClB,SAAS,MAAE,SAAG,2GAAA,uCAEb,IAAA;KACF;IACD,aAAa,EAAE,oBAAoB;CACpC,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,sBAAsB;IAC5B,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE;QACnB,UAAU,EAAE,MAAM;QAClB,SAAS,MAAE,SAAG,2GAAA,uCAEb,IAAA;KACF;IACD,aAAa,EAAE,QAAQ;IACvB,mBAAmB,EAAE;QACnB,QAAQ;;YACE,IAAA,MAAM,GAAK,IAAA,eAAO,GAAE,OAAd,CAAe;YAC7B,IAAM,OAAO,GAAG,IAAA,yCAA0B,EAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,UAAU,CAAC,CAAC;YACtE,OAAO;gBACL,OAAO,SAAA;gBACP,SAAS,MAAE,SAAG,uIAAA,mEAGb,IAAA;aACF,CAAC;QACJ,CAAC;QACD,gBAAgB,EAAE,mBAAmB;KACtC;CACF,CAAC","sourcesContent":["import { css } from \"@emotion/css\";\nimport { useForm } from \"@formily/react\";\nimport { useCollectionManager } from \"../../collection-manager\";\nimport { useCollectionFilterOptions } from \"../../collection-manager/action-hooks\";\n\nexport const collection = {\n type: 'string',\n title: '数据表',\n name: 'config.collection',\n required: true,\n 'x-reactions': ['{{useCollectionDataSource()}}'],\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n};\n\nexport const values = {\n type: 'object',\n title: '数据内容',\n name: 'config.params.values',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'CollectionFieldset'\n};\n\nexport const filter = {\n type: 'object',\n title: '筛选条件',\n name: 'config.params.filter',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'Filter',\n 'x-component-props': {\n useProps() {\n const { values } = useForm();\n const options = useCollectionFilterOptions(values.config?.collection);\n return {\n options,\n className: css`\n position: relative;\n width: 100%;\n `\n };\n },\n dynamicComponent: 'VariableComponent'\n }\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.7.0-alpha.21",
3
+ "version": "0.7.0-alpha.24",
4
4
  "license": "Apache-2.0",
5
5
  "licenses": [
6
6
  {
@@ -29,7 +29,7 @@
29
29
  "@formily/antd": "^2.0.15",
30
30
  "@formily/core": "^2.0.15",
31
31
  "@formily/react": "^2.0.15",
32
- "@nocobase/utils": "0.7.0-alpha.21",
32
+ "@nocobase/utils": "0.7.0-alpha.24",
33
33
  "ahooks": "^3.0.5",
34
34
  "antd": "~4.19.5",
35
35
  "axios": "^0.24.0",
@@ -66,5 +66,5 @@
66
66
  "@types/marked": "^4.0.1",
67
67
  "axios-mock-adapter": "^1.20.0"
68
68
  },
69
- "gitHead": "0bc409799b46c41468f434fd206cc70d4d69230b"
69
+ "gitHead": "1fb2dd884c4f2d2167f5dde40a15012a752e53ab"
70
70
  }
@@ -23,7 +23,7 @@ export const attachment: IField = {
23
23
  },
24
24
  },
25
25
  schemaInitialize(schema: ISchema, { block }) {
26
- if (['Table', 'Kanban'].includes(block)) {
26
+ if (['Table', 'KanbanV2'].includes(block)) {
27
27
  schema['x-component-props'] = schema['x-component-props'] || {};
28
28
  schema['x-component-props']['size'] = 'small';
29
29
  }
@@ -58,7 +58,7 @@ export const KanbanCardDesigner = (props: any) => {
58
58
  const { refresh } = useDesignable();
59
59
  const field = useField();
60
60
  const fieldSchema = useFieldSchema();
61
- const fields = useFormItemInitializerFields({ readPretty: true });
61
+ const fields = useFormItemInitializerFields({ readPretty: true, block: 'KanbanV2' });
62
62
  if (!designable) {
63
63
  return null;
64
64
  }
@@ -75,7 +75,6 @@ export const KanbanCardDesigner = (props: any) => {
75
75
  }
76
76
  return buf;
77
77
  }, null);
78
- console.log('schema', gridSchema)
79
78
  if (!gridSchema) {
80
79
  return;
81
80
  }
@@ -91,7 +91,7 @@ export const useFormItemInitializerFields = (options?: any) => {
91
91
  const { name, fields } = useCollection();
92
92
  const { getInterface } = useCollectionManager();
93
93
  const form = useForm();
94
- const { readPretty = form.readPretty } = options || {};
94
+ const { readPretty = form.readPretty, block = 'Form' } = options || {};
95
95
  return fields
96
96
  ?.filter((field) => field?.interface)
97
97
  ?.map((field) => {
@@ -112,7 +112,7 @@ export const useFormItemInitializerFields = (options?: any) => {
112
112
  component: 'CollectionFieldInitializer',
113
113
  remove: removeGridFormItem,
114
114
  schemaInitialize: (s) => {
115
- interfaceConfig?.schemaInitialize?.(s, { field, block: 'Form', readPretty });
115
+ interfaceConfig?.schemaInitialize?.(s, { field, block, readPretty });
116
116
  },
117
117
  schema,
118
118
  } as SchemaInitializerItemOptions;
@@ -1,13 +1,14 @@
1
1
  import React from "react";
2
- import { observer } from "@formily/react";
2
+ import { observer, useForm } from "@formily/react";
3
3
  import { FormItem } from "@formily/antd";
4
- import { Cascader, DatePicker, Input, InputNumber, Select } from "antd";
4
+ import { Button, Cascader, Dropdown, Input, InputNumber, Menu, Select } from "antd";
5
5
  import { css } from "@emotion/css";
6
+ import { PlusOutlined, CloseCircleOutlined } from '@ant-design/icons';
6
7
 
7
8
  import { instructions, useNodeContext } from "./nodes";
8
9
  import { useFlowContext } from "./WorkflowCanvas";
9
10
  import { triggers } from "./triggers";
10
- import { SchemaComponent, useCompile } from "..";
11
+ import { SchemaComponent, useCollectionManager, useCompile } from "..";
11
12
 
12
13
  function NullRender() {
13
14
  return null;
@@ -370,11 +371,18 @@ export function VariableComponent({ value, onChange, renderSchemaComponent }) {
370
371
  }
371
372
 
372
373
  // NOTE: observer for watching useProps
373
- export const CollectionFieldset = observer(({ value, onChange, useProps }: any) => {
374
- const { fields } = useProps();
374
+ export const CollectionFieldset = observer(({ value, onChange }: any) => {
375
375
  const compile = useCompile();
376
+ const { getCollectionFields } = useCollectionManager();
377
+ const { values: data } = useForm();
378
+ const fields = getCollectionFields(data?.config?.collection)
379
+ .filter(field => (
380
+ !field.hidden
381
+ && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)
382
+ ));
376
383
 
377
- const VTypes = { ...VariableTypes,
384
+ const VTypes = {
385
+ ...VariableTypes,
378
386
  constant: {
379
387
  title: '常量',
380
388
  value: 'constant',
@@ -395,34 +403,68 @@ export const CollectionFieldset = observer(({ value, onChange, useProps }: any)
395
403
  }
396
404
  `}>
397
405
  {fields.length
398
- ? fields.map(field => {
399
- const operand = typeof value[field.name] === 'string'
400
- ? parseStringValue(value[field.name], VTypes)
401
- : { type: 'constant', value: value[field.name] };
406
+ ? (
407
+ <>
408
+ {fields
409
+ .filter(field => field.name in value)
410
+ .map(field => {
411
+ const operand = typeof value[field.name] === 'string'
412
+ ? parseStringValue(value[field.name], VTypes)
413
+ : { type: 'constant', value: value[field.name] };
402
414
 
403
- return (
404
- <FormItem label={compile(field.uiSchema?.title ?? field.name)} labelAlign="left">
405
- <VariableTypesContext.Provider value={VTypes}>
406
- <Operand
407
- value={operand}
408
- onChange={(next) => {
409
- if (next.type !== operand.type && next.type === 'constant') {
410
- onChange({ ...value, [field.name]: null });
411
- } else {
412
- const { stringify } = VTypes[next.type];
413
- onChange({ ...value, [field.name]: stringify(next) });
415
+ return (
416
+ <FormItem key={field.name} label={compile(field.uiSchema?.title ?? field.name)} labelAlign="left" className={css`
417
+ .ant-formily-item-control-content-component{
418
+ display: flex;
419
+ }
420
+ `}>
421
+ <VariableTypesContext.Provider value={VTypes}>
422
+ <Operand
423
+ value={operand}
424
+ onChange={(next) => {
425
+ if (next.type !== operand.type && next.type === 'constant') {
426
+ onChange({ ...value, [field.name]: null });
427
+ } else {
428
+ const { stringify } = VTypes[next.type];
429
+ onChange({ ...value, [field.name]: stringify(next) });
430
+ }
431
+ }}
432
+ >
433
+ {operand.type === 'constant'
434
+ ? <SchemaComponent schema={{ ...field.uiSchema, name: field.name }} />
435
+ : null
414
436
  }
415
- }}
416
- >
417
- {operand.type === 'constant'
418
- ? <SchemaComponent schema={{ ...field.uiSchema, name: field.name }} />
419
- : null
420
- }
421
- </Operand>
422
- </VariableTypesContext.Provider>
423
- </FormItem>
424
- );
425
- })
437
+ </Operand>
438
+ <Button
439
+ type="link"
440
+ icon={<CloseCircleOutlined />}
441
+ onClick={() => {
442
+ const { [field.name]: _, ...rest } = value;
443
+ onChange(rest);
444
+ }}
445
+ />
446
+ </VariableTypesContext.Provider>
447
+ </FormItem>
448
+ );
449
+ })}
450
+ {Object.keys(value).length < fields.length
451
+ ? (
452
+ <Dropdown overlay={
453
+ <Menu onClick={({ key }) => onChange({ ...value, [key]: null })}>
454
+ {fields
455
+ .filter(field => !(field.name in value))
456
+ .map(field => (
457
+ <Menu.Item key={field.name}>{compile(field.uiSchema?.title ?? field.name)}</Menu.Item>
458
+ ))}
459
+ </Menu>
460
+ }>
461
+ <Button icon={<PlusOutlined />}>添加字段</Button>
462
+ </Dropdown>
463
+ )
464
+ : null
465
+ }
466
+ </>
467
+ )
426
468
  : <p>请先选择数据表</p>
427
469
  }
428
470
  </fieldset>
@@ -24,19 +24,7 @@ export const values = {
24
24
  flex-direction: column;
25
25
  `
26
26
  },
27
- 'x-component': 'CollectionFieldset',
28
- 'x-component-props': {
29
- useProps() {
30
- const { getCollectionFields } = useCollectionManager();
31
- const { values: form } = useForm();
32
- const fields = getCollectionFields(form?.config?.collection)
33
- .filter(field => (
34
- !field.hidden
35
- && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)
36
- ));
37
- return { fields };
38
- }
39
- }
27
+ 'x-component': 'CollectionFieldset'
40
28
  };
41
29
 
42
30
  export const filter = {