@nocobase/client 0.7.0-alpha.2 → 0.7.0-alpha.20

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.
Files changed (115) hide show
  1. package/esm/acl/Configuration/RoleConfigure.js +4 -4
  2. package/esm/acl/Configuration/RoleConfigure.js.map +1 -1
  3. package/esm/acl/Configuration/schemas/roles.js +1 -1
  4. package/esm/acl/Configuration/schemas/roles.js.map +1 -1
  5. package/esm/locale/index.d.ts +5 -0
  6. package/esm/locale/zh_CN.d.ts +5 -0
  7. package/esm/locale/zh_CN.js +5 -0
  8. package/esm/locale/zh_CN.js.map +1 -1
  9. package/esm/schema-component/antd/menu/Menu.js +1 -1
  10. package/esm/schema-component/antd/menu/Menu.js.map +1 -1
  11. package/esm/schema-initializer/buttons/BlockInitializers.d.ts +2 -11
  12. package/esm/schema-initializer/buttons/BlockInitializers.js +2 -0
  13. package/esm/schema-initializer/buttons/BlockInitializers.js.map +1 -1
  14. package/esm/workflow/calculators.js +2 -4
  15. package/esm/workflow/calculators.js.map +1 -1
  16. package/esm/workflow/nodes/calculation.d.ts +1 -1
  17. package/esm/workflow/nodes/calculation.js +9 -3
  18. package/esm/workflow/nodes/calculation.js.map +1 -1
  19. package/esm/workflow/nodes/condition.d.ts +3 -3
  20. package/esm/workflow/nodes/condition.js +15 -9
  21. package/esm/workflow/nodes/condition.js.map +1 -1
  22. package/esm/workflow/nodes/create.d.ts +3 -3
  23. package/esm/workflow/nodes/create.js +5 -5
  24. package/esm/workflow/nodes/create.js.map +1 -1
  25. package/esm/workflow/nodes/destroy.d.ts +2 -2
  26. package/esm/workflow/nodes/destroy.js +3 -3
  27. package/esm/workflow/nodes/destroy.js.map +1 -1
  28. package/esm/workflow/nodes/index.d.ts +1 -1
  29. package/esm/workflow/nodes/index.js +75 -56
  30. package/esm/workflow/nodes/index.js.map +1 -1
  31. package/esm/workflow/nodes/parallel.d.ts +2 -2
  32. package/esm/workflow/nodes/parallel.js +11 -5
  33. package/esm/workflow/nodes/parallel.js.map +1 -1
  34. package/esm/workflow/nodes/query.d.ts +3 -3
  35. package/esm/workflow/nodes/query.js +5 -5
  36. package/esm/workflow/nodes/query.js.map +1 -1
  37. package/esm/workflow/nodes/update.d.ts +2 -2
  38. package/esm/workflow/nodes/update.js +3 -3
  39. package/esm/workflow/nodes/update.js.map +1 -1
  40. package/esm/workflow/schemas/collection.js +10 -6
  41. package/esm/workflow/schemas/collection.js.map +1 -1
  42. package/esm/workflow/schemas/workflows.js +20 -12
  43. package/esm/workflow/schemas/workflows.js.map +1 -1
  44. package/esm/workflow/triggers/index.js +19 -9
  45. package/esm/workflow/triggers/index.js.map +1 -1
  46. package/esm/workflow/triggers/model.d.ts +18 -4
  47. package/esm/workflow/triggers/model.js +47 -9
  48. package/esm/workflow/triggers/model.js.map +1 -1
  49. package/lib/acl/Configuration/RoleConfigure.js +4 -4
  50. package/lib/acl/Configuration/RoleConfigure.js.map +1 -1
  51. package/lib/acl/Configuration/schemas/roles.js +1 -1
  52. package/lib/acl/Configuration/schemas/roles.js.map +1 -1
  53. package/lib/locale/index.d.ts +5 -0
  54. package/lib/locale/zh_CN.d.ts +5 -0
  55. package/lib/locale/zh_CN.js +5 -0
  56. package/lib/locale/zh_CN.js.map +1 -1
  57. package/lib/schema-component/antd/menu/Menu.js +1 -1
  58. package/lib/schema-component/antd/menu/Menu.js.map +1 -1
  59. package/lib/schema-initializer/buttons/BlockInitializers.d.ts +2 -11
  60. package/lib/schema-initializer/buttons/BlockInitializers.js +2 -0
  61. package/lib/schema-initializer/buttons/BlockInitializers.js.map +1 -1
  62. package/lib/workflow/calculators.js +2 -4
  63. package/lib/workflow/calculators.js.map +1 -1
  64. package/lib/workflow/nodes/calculation.d.ts +1 -1
  65. package/lib/workflow/nodes/calculation.js +9 -3
  66. package/lib/workflow/nodes/calculation.js.map +1 -1
  67. package/lib/workflow/nodes/condition.d.ts +3 -3
  68. package/lib/workflow/nodes/condition.js +13 -7
  69. package/lib/workflow/nodes/condition.js.map +1 -1
  70. package/lib/workflow/nodes/create.d.ts +3 -3
  71. package/lib/workflow/nodes/create.js +5 -5
  72. package/lib/workflow/nodes/create.js.map +1 -1
  73. package/lib/workflow/nodes/destroy.d.ts +2 -2
  74. package/lib/workflow/nodes/destroy.js +3 -3
  75. package/lib/workflow/nodes/destroy.js.map +1 -1
  76. package/lib/workflow/nodes/index.d.ts +1 -1
  77. package/lib/workflow/nodes/index.js +79 -60
  78. package/lib/workflow/nodes/index.js.map +1 -1
  79. package/lib/workflow/nodes/parallel.d.ts +2 -2
  80. package/lib/workflow/nodes/parallel.js +10 -4
  81. package/lib/workflow/nodes/parallel.js.map +1 -1
  82. package/lib/workflow/nodes/query.d.ts +3 -3
  83. package/lib/workflow/nodes/query.js +5 -5
  84. package/lib/workflow/nodes/query.js.map +1 -1
  85. package/lib/workflow/nodes/update.d.ts +2 -2
  86. package/lib/workflow/nodes/update.js +3 -3
  87. package/lib/workflow/nodes/update.js.map +1 -1
  88. package/lib/workflow/schemas/collection.js +10 -6
  89. package/lib/workflow/schemas/collection.js.map +1 -1
  90. package/lib/workflow/schemas/workflows.js +20 -12
  91. package/lib/workflow/schemas/workflows.js.map +1 -1
  92. package/lib/workflow/triggers/index.js +19 -9
  93. package/lib/workflow/triggers/index.js.map +1 -1
  94. package/lib/workflow/triggers/model.d.ts +18 -4
  95. package/lib/workflow/triggers/model.js +47 -9
  96. package/lib/workflow/triggers/model.js.map +1 -1
  97. package/package.json +4 -4
  98. package/src/acl/Configuration/RoleConfigure.tsx +4 -4
  99. package/src/acl/Configuration/schemas/roles.ts +1 -1
  100. package/src/locale/zh_CN.ts +5 -1
  101. package/src/schema-component/antd/menu/Menu.tsx +2 -1
  102. package/src/schema-initializer/buttons/BlockInitializers.tsx +2 -0
  103. package/src/workflow/calculators.tsx +2 -4
  104. package/src/workflow/nodes/calculation.tsx +4 -3
  105. package/src/workflow/nodes/condition.tsx +35 -12
  106. package/src/workflow/nodes/create.tsx +10 -7
  107. package/src/workflow/nodes/destroy.tsx +3 -3
  108. package/src/workflow/nodes/index.tsx +64 -59
  109. package/src/workflow/nodes/parallel.tsx +25 -5
  110. package/src/workflow/nodes/query.tsx +5 -5
  111. package/src/workflow/nodes/update.tsx +3 -3
  112. package/src/workflow/schemas/collection.ts +9 -7
  113. package/src/workflow/schemas/workflows.ts +20 -12
  114. package/src/workflow/triggers/index.tsx +11 -9
  115. package/src/workflow/triggers/model.tsx +48 -9
@@ -6,7 +6,7 @@ declare const _default: {
6
6
  type: string;
7
7
  group: string;
8
8
  fieldset: {
9
- collection: {
9
+ 'config.collection': {
10
10
  type: string;
11
11
  title: string;
12
12
  name: string;
@@ -15,7 +15,7 @@ declare const _default: {
15
15
  'x-decorator': string;
16
16
  'x-component': string;
17
17
  };
18
- params: {
18
+ 'config.params': {
19
19
  type: string;
20
20
  name: string;
21
21
  title: string;
@@ -8,10 +8,10 @@ exports.default = {
8
8
  type: 'update',
9
9
  group: 'model',
10
10
  fieldset: {
11
- collection: collection_1.collection,
12
- params: {
11
+ 'config.collection': collection_1.collection,
12
+ 'config.params': {
13
13
  type: 'object',
14
- name: 'params',
14
+ name: 'config.params',
15
15
  title: '',
16
16
  'x-decorator': 'FormItem',
17
17
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/workflow/nodes/update.tsx"],"names":[],"mappings":";;AAAA,2BAAgD;AAChD,8CAAuE;AACvE,oDAAmE;AAEnE,kBAAe;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE;QACR,UAAU,yBAAA;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,UAAU;YACzB,UAAU,EAAE;gBACV,MAAM,qBAAA;gBACN,MAAM,qBAAA;aACP;SACF;KACF;IACD,IAAI,EAAE,EAEL;IACD,KAAK,EAAE;QACL,uBAAuB,6BAAA;KACxB;IACD,UAAU,EAAE;QACV,iBAAiB,iCAAA;QACjB,kBAAkB,kCAAA;KACnB;CACF,CAAC","sourcesContent":["import { useCollectionDataSource } from '../..';\nimport { CollectionFieldset, VariableComponent } from '../calculators';\nimport { collection, filter, values } from '../schemas/collection';\n\nexport default {\n title: '更新数据',\n type: 'update',\n group: 'model',\n fieldset: {\n collection,\n params: {\n type: 'object',\n name: 'params',\n title: '',\n 'x-decorator': 'FormItem',\n properties: {\n filter,\n values\n }\n }\n },\n view: {\n\n },\n scope: {\n useCollectionDataSource\n },\n components: {\n VariableComponent,\n CollectionFieldset\n }\n};\n"]}
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/workflow/nodes/update.tsx"],"names":[],"mappings":";;AAAA,2BAAgD;AAChD,8CAAuE;AACvE,oDAAmE;AAEnE,kBAAe;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE;QACR,mBAAmB,EAAE,uBAAU;QAC/B,eAAe,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,UAAU;YACzB,UAAU,EAAE;gBACV,MAAM,qBAAA;gBACN,MAAM,qBAAA;aACP;SACF;KACF;IACD,IAAI,EAAE,EAEL;IACD,KAAK,EAAE;QACL,uBAAuB,6BAAA;KACxB;IACD,UAAU,EAAE;QACV,iBAAiB,iCAAA;QACjB,kBAAkB,kCAAA;KACnB;CACF,CAAC","sourcesContent":["import { useCollectionDataSource } from '../..';\nimport { CollectionFieldset, VariableComponent } from '../calculators';\nimport { collection, filter, values } from '../schemas/collection';\n\nexport default {\n title: '更新数据',\n type: 'update',\n group: 'model',\n fieldset: {\n 'config.collection': collection,\n 'config.params': {\n type: 'object',\n name: 'config.params',\n title: '',\n 'x-decorator': 'FormItem',\n properties: {\n filter,\n values\n }\n }\n },\n view: {\n\n },\n scope: {\n useCollectionDataSource\n },\n components: {\n VariableComponent,\n CollectionFieldset\n }\n};\n"]}
@@ -12,7 +12,7 @@ var action_hooks_1 = require("../../collection-manager/action-hooks");
12
12
  exports.collection = {
13
13
  type: 'string',
14
14
  title: '数据表',
15
- name: 'collection',
15
+ name: 'config.collection',
16
16
  required: true,
17
17
  'x-reactions': ['{{useCollectionDataSource()}}'],
18
18
  'x-decorator': 'FormItem',
@@ -21,7 +21,7 @@ exports.collection = {
21
21
  exports.values = {
22
22
  type: 'object',
23
23
  title: '数据内容',
24
- name: 'values',
24
+ name: 'config.params.values',
25
25
  'x-decorator': 'FormItem',
26
26
  'x-decorator-props': {
27
27
  labelAlign: 'left',
@@ -30,9 +30,12 @@ exports.values = {
30
30
  'x-component': 'CollectionFieldset',
31
31
  'x-component-props': {
32
32
  useProps: function () {
33
+ var _a;
33
34
  var getCollectionFields = (0, collection_manager_1.useCollectionManager)().getCollectionFields;
34
35
  var form = (0, react_1.useForm)().values;
35
- var fields = getCollectionFields(form.collection);
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)); });
36
39
  return { fields: fields };
37
40
  }
38
41
  }
@@ -40,7 +43,7 @@ exports.values = {
40
43
  exports.filter = {
41
44
  type: 'object',
42
45
  title: '筛选条件',
43
- name: 'filter',
46
+ name: 'config.params.filter',
44
47
  'x-decorator': 'FormItem',
45
48
  'x-decorator-props': {
46
49
  labelAlign: 'left',
@@ -49,11 +52,12 @@ exports.filter = {
49
52
  'x-component': 'Filter',
50
53
  'x-component-props': {
51
54
  useProps: function () {
55
+ var _a;
52
56
  var values = (0, react_1.useForm)().values;
53
- var options = (0, action_hooks_1.useCollectionFilterOptions)(values.collection);
57
+ var options = (0, action_hooks_1.useCollectionFilterOptions)((_a = values.config) === null || _a === void 0 ? void 0 : _a.collection);
54
58
  return {
55
59
  options: options,
56
- className: (0, css_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n padding: .5em 1em;\n border: 1px dashed #ddd;\n "], ["\n position: relative;\n width: 100%;\n padding: .5em 1em;\n border: 1px dashed #ddd;\n "])))
60
+ className: (0, css_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n "], ["\n position: relative;\n width: 100%;\n "])))
57
61
  };
58
62
  },
59
63
  dynamicComponent: 'VariableComponent'
@@ -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,EAAE,KAAK;IACZ,IAAI,EAAE,YAAY;IAClB,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,QAAQ;IACd,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE;QACnB,UAAU,EAAE,MAAM;QAClB,SAAS,MAAE,SAAG,2GAAA,uCAEb,IAAA;KACF;IACD,aAAa,EAAE,oBAAoB;IACnC,mBAAmB,EAAE;QACnB,QAAQ;YACE,IAAA,mBAAmB,GAAK,IAAA,yCAAoB,GAAE,oBAA3B,CAA4B;YAC/C,IAAQ,IAAI,GAAK,IAAA,eAAO,GAAE,OAAd,CAAe;YACnC,IAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACpD,OAAO,EAAE,MAAM,QAAA,EAAE,CAAC;QACpB,CAAC;KACF;CACF,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,QAAQ;IACd,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,MAAM,CAAC,UAAU,CAAC,CAAC;YAC9D,OAAO;gBACL,OAAO,SAAA;gBACP,SAAS,MAAE,SAAG,yMAAA,qIAKb,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: '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: '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.collection);\n return { fields };\n }\n }\n};\n\nexport const filter = {\n type: 'object',\n title: '筛选条件',\n name: '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.collection);\n return {\n options,\n className: css`\n position: relative;\n width: 100%;\n padding: .5em 1em;\n border: 1px dashed #ddd;\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;AACzC,+DAAgE;AAChE,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;IACnC,mBAAmB,EAAE;QACnB,QAAQ;;YACE,IAAA,mBAAmB,GAAK,IAAA,yCAAoB,GAAE,oBAA3B,CAA4B;YAC/C,IAAQ,IAAI,GAAK,IAAA,eAAO,GAAE,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;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 '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"]}
@@ -15,16 +15,6 @@ var collection = {
15
15
  required: true,
16
16
  },
17
17
  },
18
- // {
19
- // type: 'string',
20
- // name: 'description',
21
- // interface: 'textarea',
22
- // uiSchema: {
23
- // title: '描述',
24
- // type: 'string',
25
- // 'x-component': 'TextArea',
26
- // } as ISchema,
27
- // },
28
18
  {
29
19
  type: 'string',
30
20
  name: 'type',
@@ -37,6 +27,17 @@ var collection = {
37
27
  enum: [
38
28
  { value: 'model', label: '数据变动' }
39
29
  ],
30
+ required: true,
31
+ },
32
+ },
33
+ {
34
+ type: 'string',
35
+ name: 'description',
36
+ interface: 'textarea',
37
+ uiSchema: {
38
+ title: '描述',
39
+ type: 'string',
40
+ 'x-component': 'Input.TextArea',
40
41
  },
41
42
  },
42
43
  {
@@ -94,6 +95,13 @@ exports.workflowSchema = {
94
95
  type: 'void',
95
96
  title: '删除',
96
97
  'x-component': 'Action',
98
+ 'x-component-props': {
99
+ useAction: '{{ cm.useBulkDestroyAction }}',
100
+ confirm: {
101
+ title: "{{t('Delete record')}}",
102
+ content: "{{t('Are you sure you want to delete it?')}}",
103
+ },
104
+ },
97
105
  },
98
106
  create: {
99
107
  type: 'void',
@@ -113,11 +121,11 @@ exports.workflowSchema = {
113
121
  'x-component': 'CollectionField',
114
122
  'x-decorator': 'FormItem',
115
123
  },
116
- description: {
124
+ type: {
117
125
  'x-component': 'CollectionField',
118
126
  'x-decorator': 'FormItem',
119
127
  },
120
- type: {
128
+ description: {
121
129
  'x-component': 'CollectionField',
122
130
  'x-decorator': 'FormItem',
123
131
  },
@@ -1 +1 @@
1
- {"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../../src/workflow/schemas/workflows.ts"],"names":[],"mappings":";;;AAGA,IAAM,UAAU,GAAG;IACjB,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE;QACN;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE;gBACR,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,OAAO;gBACtB,QAAQ,EAAE,IAAI;aACJ;SACb;QACD,IAAI;QACJ,oBAAoB;QACpB,yBAAyB;QACzB,2BAA2B;QAC3B,gBAAgB;QAChB,mBAAmB;QACnB,sBAAsB;QACtB,iCAAiC;QACjC,kBAAkB;QAClB,KAAK;QACL;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,QAAQ;YACnB,QAAQ,EAAE;gBACR,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,QAAQ;gBACvB,aAAa,EAAE,UAAU;gBACzB,IAAI,EAAE;oBACJ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE;iBAClC;aACS;SACb;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE;gBACR,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE;oBACJ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;oBAC5B,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;iBAC9B;gBACD,aAAa,EAAE,aAAa;gBAC5B,aAAa,EAAE,UAAU;aACf;SACb;KACF;CACF,CAAC;AAEW,QAAA,cAAc,GAAY;IACrC,IAAI,EAAE,QAAQ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E,iBAAiB;4DAChC,aAAa,EAAE,UAAU;yDAC1B;wDACD,MAAM,EAAE;4DACN,IAAI,EAAE,MAAM;4DACZ,aAAa,EAAE,qBAAqB;4DACpC,UAAU,EAAE;gEACV,MAAM,EAAE;oEACN,KAAK,EAAE,mBAAmB;oEAC1B,aAAa,EAAE,QAAQ;oEACvB,mBAAmB,EAAE;wEACnB,SAAS,EAAE,0BAA0B;qEACtC;iEACF;gEACD,MAAM,EAAE;oEACN,KAAK,EAAE,mBAAmB;oEAC1B,aAAa,EAAE,QAAQ;oEACvB,mBAAmB,EAAE;wEACnB,IAAI,EAAE,SAAS;wEACf,SAAS,EAAE,0BAA0B;qEACtC;iEACF;6DACF;yDACF;qDACF;iDACF;6CACF;yCACF;wCACD,YAAY;wCACZ,kBAAkB;wCAClB,gCAAgC;wCAChC,kCAAkC;wCAClC,2BAA2B;wCAC3B,iBAAiB;wCACjB,yCAAyC;wCACzC,iEAAiE;wCACjE,SAAS;wCACT,0DAA0D;wCAC1D,OAAO;wCACP,KAAK;qCACN;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC","sourcesContent":["import { ISchema } from '@formily/react';\nimport { executionSchema } from './executions';\n\nconst collection = {\n name: 'workflows',\n fields: [\n {\n type: 'string',\n name: 'title',\n interface: 'input',\n uiSchema: {\n title: '流程名称',\n type: 'string',\n 'x-component': 'Input',\n required: true,\n } as ISchema,\n },\n // {\n // type: 'string',\n // name: 'description',\n // interface: 'textarea',\n // uiSchema: {\n // title: '描述',\n // type: 'string',\n // 'x-component': 'TextArea',\n // } as ISchema,\n // },\n {\n type: 'string',\n name: 'type',\n interface: 'select',\n uiSchema: {\n title: '触发方式',\n type: 'string',\n 'x-component': 'Select',\n 'x-decorator': 'FormItem',\n enum: [\n { value: 'model', label: '数据变动' }\n ],\n } as ISchema,\n },\n {\n type: 'boolean',\n name: 'enabled',\n interface: 'radio',\n uiSchema: {\n title: '状态',\n type: 'string',\n enum: [\n { label: '启用', value: true },\n { label: '禁用', value: false },\n ],\n 'x-component': 'Radio.Group',\n 'x-decorator': 'FormItem',\n } as ISchema\n }\n ],\n};\n\nexport const workflowSchema: ISchema = {\n type: 'object',\n properties: {\n provider: {\n type: 'void',\n 'x-decorator': 'ResourceActionProvider',\n 'x-decorator-props': {\n collection,\n resourceName: 'workflows',\n request: {\n resource: 'workflows',\n action: 'list',\n params: {\n pageSize: 50,\n filter: {},\n sort: ['createdAt'],\n except: ['config'],\n },\n },\n },\n 'x-component': 'CollectionProvider',\n 'x-component-props': {\n collection,\n },\n properties: {\n actions: {\n type: 'void',\n 'x-component': 'ActionBar',\n 'x-component-props': {\n style: {\n marginBottom: 16,\n },\n },\n properties: {\n delete: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n },\n create: {\n type: 'void',\n title: '添加工作流',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n },\n properties: {\n drawer: {\n type: 'void',\n 'x-component': 'Action.Drawer',\n 'x-decorator': 'Form',\n title: '添加工作流',\n properties: {\n title: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n description: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n type: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n footer: {\n type: 'void',\n 'x-component': 'Action.Drawer.Footer',\n properties: {\n cancel: {\n title: 'Cancel',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useCancelAction }}',\n },\n },\n submit: {\n title: 'Submit',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n useAction: '{{ cm.useCreateAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n },\n table: {\n type: 'void',\n 'x-component': 'Table.Void',\n 'x-component-props': {\n rowKey: 'id',\n rowSelection: {\n type: 'checkbox',\n },\n useDataSource: '{{ cm.useDataSourceFromRAC }}',\n },\n properties: {\n title: {\n type: 'void',\n 'x-decorator': 'Table.Column.Decorator',\n 'x-component': 'Table.Column',\n properties: {\n title: {\n type: 'string',\n 'x-component': 'CollectionField',\n 'x-read-pretty': true,\n },\n }\n },\n type: {\n type: 'void',\n 'x-decorator': 'Table.Column.Decorator',\n 'x-component': 'Table.Column',\n properties: {\n type: {\n type: 'string',\n 'x-component': 'CollectionField',\n 'x-read-pretty': true,\n },\n }\n },\n enabled: {\n type: 'void',\n 'x-decorator': 'Table.Column.Decorator',\n 'x-component': 'Table.Column',\n properties: {\n enabled: {\n type: 'boolean',\n 'x-component': 'CollectionField',\n 'x-read-pretty': true,\n default: false\n },\n }\n },\n actions: {\n type: 'void',\n title: '{{ t(\"Actions\") }}',\n 'x-component': 'Table.Column',\n properties: {\n actions: {\n type: 'void',\n 'x-component': 'Space',\n 'x-component-props': {\n split: '|',\n },\n properties: {\n config: {\n type: 'void',\n title: '配置流程',\n 'x-component': 'WorkflowLink'\n },\n // executions: {\n // type: 'void',\n // title: '执行历史',\n // 'x-component': 'Action.Link',\n // 'x-component-props': {\n // type: 'primary',\n // },\n // properties: {\n // drawer: {\n // type: 'void',\n // title: '执行历史',\n // 'x-component': 'Action.Drawer',\n // properties: executionSchema\n // }\n // }\n // },\n update: {\n type: 'void',\n title: '{{ t(\"Edit\") }}',\n 'x-component': 'Action.Link',\n 'x-component-props': {\n type: 'primary',\n },\n properties: {\n modal: {\n type: 'void',\n 'x-component': 'Action.Modal',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useValues: '{{ cm.useValuesFromRecord }}',\n },\n title: '编辑工作流',\n properties: {\n title: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n enabled: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n footer: {\n type: 'void',\n 'x-component': 'Action.Modal.Footer',\n properties: {\n cancel: {\n title: '{{ t(\"Cancel\") }}',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useCancelAction }}',\n },\n },\n submit: {\n title: '{{ t(\"Submit\") }}',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n useAction: '{{ cm.useUpdateAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n // delete: {\n // type: 'void',\n // title: '{{ t(\"Delete\") }}',\n // 'x-component': 'Action.Link',\n // 'x-component-props': {\n // confirm: {\n // title: \"{{t('Delete record')}}\",\n // content: \"{{t('Are you sure you want to delete it?')}}\",\n // },\n // useAction: '{{ cm.useDestroyActionAndRefreshCM }}',\n // },\n // },\n }\n }\n }\n }\n }\n }\n }\n }\n }\n};\n"]}
1
+ {"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../../src/workflow/schemas/workflows.ts"],"names":[],"mappings":";;;AAGA,IAAM,UAAU,GAAG;IACjB,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE;QACN;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE;gBACR,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,OAAO;gBACtB,QAAQ,EAAE,IAAI;aACJ;SACb;QACD;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,QAAQ;YACnB,QAAQ,EAAE;gBACR,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,QAAQ;gBACvB,aAAa,EAAE,UAAU;gBACzB,IAAI,EAAE;oBACJ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE;iBAClC;gBACD,QAAQ,EAAE,IAAI;aACJ;SACb;QACD;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,aAAa;YACnB,SAAS,EAAE,UAAU;YACrB,QAAQ,EAAE;gBACR,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,gBAAgB;aACrB;SACb;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,SAAS;YAC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port { executionSchema } from './executions';\n\nconst collection = {\n name: 'workflows',\n fields: [\n {\n type: 'string',\n name: 'title',\n interface: 'input',\n uiSchema: {\n title: '流程名称',\n type: 'string',\n 'x-component': 'Input',\n required: true,\n } as ISchema,\n },\n {\n type: 'string',\n name: 'type',\n interface: 'select',\n uiSchema: {\n title: '触发方式',\n type: 'string',\n 'x-component': 'Select',\n 'x-decorator': 'FormItem',\n enum: [\n { value: 'model', label: '数据变动' }\n ],\n required: true,\n } as ISchema,\n },\n {\n type: 'string',\n name: 'description',\n interface: 'textarea',\n uiSchema: {\n title: '描述',\n type: 'string',\n 'x-component': 'Input.TextArea',\n } as ISchema,\n },\n {\n type: 'boolean',\n name: 'enabled',\n interface: 'radio',\n uiSchema: {\n title: '状态',\n type: 'string',\n enum: [\n { label: '启用', value: true },\n { label: '禁用', value: false },\n ],\n 'x-component': 'Radio.Group',\n 'x-decorator': 'FormItem',\n } as ISchema\n }\n ],\n};\n\nexport const workflowSchema: ISchema = {\n type: 'object',\n properties: {\n provider: {\n type: 'void',\n 'x-decorator': 'ResourceActionProvider',\n 'x-decorator-props': {\n collection,\n resourceName: 'workflows',\n request: {\n resource: 'workflows',\n action: 'list',\n params: {\n pageSize: 50,\n filter: {},\n sort: ['createdAt'],\n except: ['config'],\n },\n },\n },\n 'x-component': 'CollectionProvider',\n 'x-component-props': {\n collection,\n },\n properties: {\n actions: {\n type: 'void',\n 'x-component': 'ActionBar',\n 'x-component-props': {\n style: {\n marginBottom: 16,\n },\n },\n properties: {\n delete: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useBulkDestroyAction }}',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n },\n },\n create: {\n type: 'void',\n title: '添加工作流',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n },\n properties: {\n drawer: {\n type: 'void',\n 'x-component': 'Action.Drawer',\n 'x-decorator': 'Form',\n title: '添加工作流',\n properties: {\n title: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n type: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n description: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n footer: {\n type: 'void',\n 'x-component': 'Action.Drawer.Footer',\n properties: {\n cancel: {\n title: 'Cancel',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useCancelAction }}',\n },\n },\n submit: {\n title: 'Submit',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n useAction: '{{ cm.useCreateAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n },\n table: {\n type: 'void',\n 'x-component': 'Table.Void',\n 'x-component-props': {\n rowKey: 'id',\n rowSelection: {\n type: 'checkbox',\n },\n useDataSource: '{{ cm.useDataSourceFromRAC }}',\n },\n properties: {\n title: {\n type: 'void',\n 'x-decorator': 'Table.Column.Decorator',\n 'x-component': 'Table.Column',\n properties: {\n title: {\n type: 'string',\n 'x-component': 'CollectionField',\n 'x-read-pretty': true,\n },\n }\n },\n type: {\n type: 'void',\n 'x-decorator': 'Table.Column.Decorator',\n 'x-component': 'Table.Column',\n properties: {\n type: {\n type: 'string',\n 'x-component': 'CollectionField',\n 'x-read-pretty': true,\n },\n }\n },\n enabled: {\n type: 'void',\n 'x-decorator': 'Table.Column.Decorator',\n 'x-component': 'Table.Column',\n properties: {\n enabled: {\n type: 'boolean',\n 'x-component': 'CollectionField',\n 'x-read-pretty': true,\n default: false\n },\n }\n },\n actions: {\n type: 'void',\n title: '{{ t(\"Actions\") }}',\n 'x-component': 'Table.Column',\n properties: {\n actions: {\n type: 'void',\n 'x-component': 'Space',\n 'x-component-props': {\n split: '|',\n },\n properties: {\n config: {\n type: 'void',\n title: '配置流程',\n 'x-component': 'WorkflowLink'\n },\n // executions: {\n // type: 'void',\n // title: '执行历史',\n // 'x-component': 'Action.Link',\n // 'x-component-props': {\n // type: 'primary',\n // },\n // properties: {\n // drawer: {\n // type: 'void',\n // title: '执行历史',\n // 'x-component': 'Action.Drawer',\n // properties: executionSchema\n // }\n // }\n // },\n update: {\n type: 'void',\n title: '{{ t(\"Edit\") }}',\n 'x-component': 'Action.Link',\n 'x-component-props': {\n type: 'primary',\n },\n properties: {\n modal: {\n type: 'void',\n 'x-component': 'Action.Modal',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useValues: '{{ cm.useValuesFromRecord }}',\n },\n title: '编辑工作流',\n properties: {\n title: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n enabled: {\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n },\n footer: {\n type: 'void',\n 'x-component': 'Action.Modal.Footer',\n properties: {\n cancel: {\n title: '{{ t(\"Cancel\") }}',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useCancelAction }}',\n },\n },\n submit: {\n title: '{{ t(\"Submit\") }}',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n useAction: '{{ cm.useUpdateAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n // delete: {\n // type: 'void',\n // title: '{{ t(\"Delete\") }}',\n // 'x-component': 'Action.Link',\n // 'x-component-props': {\n // confirm: {\n // title: \"{{t('Delete record')}}\",\n // content: \"{{t('Are you sure you want to delete it?')}}\",\n // },\n // useAction: '{{ cm.useDestroyActionAndRefreshCM }}',\n // },\n // },\n }\n }\n }\n }\n }\n }\n }\n }\n }\n};\n"]}
@@ -69,13 +69,14 @@ function useUpdateConfigAction() {
69
69
  return __awaiter(this, void 0, void 0, function () {
70
70
  return __generator(this, function (_a) {
71
71
  switch (_a.label) {
72
- case 0: return [4 /*yield*/, api.resource('workflows', record.id).update({
73
- filterByTk: record.id,
74
- values: {
75
- config: __assign(__assign({}, record.config), form.values)
76
- },
77
- })];
72
+ case 0: return [4 /*yield*/, form.submit()];
78
73
  case 1:
74
+ _a.sent();
75
+ return [4 /*yield*/, api.resource('workflows', record.id).update({
76
+ filterByTk: record.id,
77
+ values: form.values
78
+ })];
79
+ case 2:
79
80
  _a.sent();
80
81
  ctx.setVisible(false);
81
82
  refresh();
@@ -109,9 +110,17 @@ var TriggerConfig = function () {
109
110
  'x-component': 'Action.Drawer',
110
111
  'x-decorator': 'Form',
111
112
  'x-decorator-props': {
112
- initialValue: config
113
+ initialValue: { config: config }
113
114
  },
114
- properties: __assign(__assign({}, fieldset), { actions: {
115
+ properties: {
116
+ config: {
117
+ type: 'void',
118
+ name: 'config',
119
+ 'x-component': 'fieldset',
120
+ 'x-component-props': {},
121
+ properties: fieldset
122
+ },
123
+ actions: {
115
124
  type: 'void',
116
125
  'x-component': 'Action.Drawer.Footer',
117
126
  properties: {
@@ -131,7 +140,8 @@ var TriggerConfig = function () {
131
140
  }
132
141
  }
133
142
  }
134
- } })
143
+ }
144
+ }
135
145
  }
136
146
  }
137
147
  }, scope: scope }, void 0)] }), void 0));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workflow/triggers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wCAAkD;AAClD,oCAAkC;AAClC,yCAA2C;AAE3C,4BAA8G;AAC9G,kDAA4B;AAC5B,kCAAyC;AAGzC,SAAS,qBAAqB;IAC5B,IAAM,IAAI,GAAG,IAAA,eAAO,GAAE,CAAC;IACvB,IAAM,GAAG,GAAG,IAAA,gBAAY,GAAE,CAAC;IAC3B,IAAM,MAAM,GAAG,IAAA,aAAS,GAAE,CAAC;IAC3B,IAAM,GAAG,GAAG,IAAA,oBAAgB,GAAE,CAAC;IACvB,IAAA,OAAO,GAAK,IAAA,4BAAwB,GAAE,QAA/B,CAAgC;IAC/C,OAAO;QACC,GAAG;;;;gCACP,qBAAM,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC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I,EAAE,MAAM;oCACZ,aAAa,EAAE,sBAAsB;oCACrC,UAAU,EAAE;wCACV,MAAM,EAAE;4CACN,KAAK,EAAE,iBAAiB;4CACxB,aAAa,EAAE,QAAQ;4CACvB,mBAAmB,EAAE;gDACnB,SAAS,EAAE,0BAA0B;6CACtC;yCACF;wCACD,MAAM,EAAE;4CACN,KAAK,EAAE,iBAAiB;4CACxB,aAAa,EAAE,QAAQ;4CACvB,mBAAmB,EAAE;gDACnB,IAAI,EAAE,SAAS;gDACf,SAAS,EAAE,qBAAqB;6CACjC;yCACF;qCACF;iCACF,GACF;yBACF;qBACF;iBACF,EACD,KAAK,EAAE,KAAK,WACZ,aACE,CACP,CAAC;AACJ,CAAC,CAAA;AAxDY,QAAA,aAAa,iBAwDzB","sourcesContent":["import React from \"react\";\nimport { ISchema, useForm } from \"@formily/react\";\nimport { cx } from \"@emotion/css\";\nimport { Registry } from \"@nocobase/utils\";\n\nimport { SchemaComponent, useActionContext, useAPIClient, useRecord, useResourceActionContext } from '../../';\nimport model from './model';\nimport { nodeCardClass } from \"../style\";\n\n\nfunction useUpdateConfigAction() {\n const form = useForm();\n const api = useAPIClient();\n const record = useRecord();\n const ctx = useActionContext();\n const { refresh } = useResourceActionContext();\n return {\n async run() {\n await api.resource('workflows', record.id).update({\n filterByTk: record.id,\n values: {\n config: {\n ...record.config,\n ...form.values\n }\n },\n });\n ctx.setVisible(false);\n refresh();\n },\n };\n};\n\nexport interface Trigger {\n title: string;\n type: string;\n // group: string;\n options?: { label: string; value: any; key: string }[];\n fieldset: { [key: string]: ISchema };\n view?: ISchema;\n scope?: { [key: string]: any };\n components?: { [key: string]: any };\n render?(props): React.ReactElement;\n getter?(node: any): React.ReactElement;\n};\n\nexport const triggers = new Registry<Trigger>();\n\ntriggers.register('model', model);\n\nexport const TriggerConfig = () => {\n const { data } = useResourceActionContext();\n if (!data) {\n return null;\n }\n const { type, config } = data.data;\n const { title, fieldset, scope } = triggers.get(type);\n return (\n <div className={cx(nodeCardClass)}>\n <h4>{title}</h4>\n <SchemaComponent\n schema={{\n type: 'void',\n title: '触发器配置',\n 'x-component': 'Action.Link',\n name: 'drawer',\n properties: {\n drawer: {\n type: 'void',\n title: '触发器配置',\n 'x-component': 'Action.Drawer',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n initialValue: config\n },\n properties: {\n ...fieldset,\n actions: {\n type: 'void',\n 'x-component': 'Action.Drawer.Footer',\n properties: {\n cancel: {\n title: '{{t(\"Cancel\")}}',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useCancelAction }}',\n },\n },\n submit: {\n title: '{{t(\"Submit\")}}',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n useAction: useUpdateConfigAction\n }\n }\n }\n }\n }\n }\n }\n }}\n scope={scope}\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workflow/triggers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wCAAkD;AAClD,oCAAkC;AAClC,yCAA2C;AAE3C,4BAA0H;AAC1H,kDAA4B;AAC5B,kCAAyC;AAGzC,SAAS,qBAAqB;IAC5B,IAAM,IAAI,GAAG,IAAA,eAAO,GAAE,CAAC;IACvB,IAAM,GAAG,GAAG,IAAA,gBAAY,GAAE,CAAC;IAC3B,IAAM,MAAM,GAAG,IAAA,aAAS,GAAE,CAAC;IAC3B,IAAM,GAAG,GAAG,IAAA,oBAAgB,GAAE,CAAC;IACvB,IAAA,OAAO,GAAK,IAAA,4BAAwB,GAAE,QAA/B,CAAgC;IAC/C,OAAO;QACC,GAAG;;;;gCACP,qBAAM,IAAI,CAAC,MAAM,EAAE,EAAA;;4BAAnB,SAAmB,CAAC;4BACpB,qBAAM,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;oCAChD,UAAU,E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EAAE,UAAU;oCACzB,mBAAmB,EAAE,EAAE;oCACvB,UAAU,EAAE,QAAQ;iCACrB;gCACD,OAAO,EAAE;oCACP,IAAI,EAAE,MAAM;oCACZ,aAAa,EAAE,sBAAsB;oCACrC,UAAU,EAAE;wCACV,MAAM,EAAE;4CACN,KAAK,EAAE,iBAAiB;4CACxB,aAAa,EAAE,QAAQ;4CACvB,mBAAmB,EAAE;gDACnB,SAAS,EAAE,0BAA0B;6CACtC;yCACF;wCACD,MAAM,EAAE;4CACN,KAAK,EAAE,iBAAiB;4CACxB,aAAa,EAAE,QAAQ;4CACvB,mBAAmB,EAAE;gDACnB,IAAI,EAAE,SAAS;gDACf,SAAS,EAAE,qBAAqB;6CACjC;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF,EACD,KAAK,EAAE,KAAK,WACZ,aACE,CACP,CAAC;AACJ,CAAC,CAAA;AA9DY,QAAA,aAAa,iBA8DzB","sourcesContent":["import React from \"react\";\nimport { ISchema, useForm } from \"@formily/react\";\nimport { cx } from \"@emotion/css\";\nimport { Registry } from \"@nocobase/utils\";\n\nimport { SchemaComponent, useActionContext, useAPIClient, useRecord, useRequest, useResourceActionContext } from '../../';\nimport model from './model';\nimport { nodeCardClass } from \"../style\";\n\n\nfunction useUpdateConfigAction() {\n const form = useForm();\n const api = useAPIClient();\n const record = useRecord();\n const ctx = useActionContext();\n const { refresh } = useResourceActionContext();\n return {\n async run() {\n await form.submit();\n await api.resource('workflows', record.id).update({\n filterByTk: record.id,\n values: form.values\n });\n ctx.setVisible(false);\n refresh();\n },\n };\n};\n\nexport interface Trigger {\n title: string;\n type: string;\n // group: string;\n options?: { label: string; value: any; key: string }[];\n fieldset: { [key: string]: ISchema };\n view?: ISchema;\n scope?: { [key: string]: any };\n components?: { [key: string]: any };\n render?(props): React.ReactElement;\n getter?(node: any): React.ReactElement;\n};\n\nexport const triggers = new Registry<Trigger>();\n\ntriggers.register('model', model);\n\nexport const TriggerConfig = () => {\n const { data } = useResourceActionContext();\n if (!data) {\n return null;\n }\n const { type, config } = data.data;\n const { title, fieldset, scope } = triggers.get(type);\n return (\n <div className={cx(nodeCardClass)}>\n <h4>{title}</h4>\n <SchemaComponent\n schema={{\n type: 'void',\n title: '触发器配置',\n 'x-component': 'Action.Link',\n name: 'drawer',\n properties: {\n drawer: {\n type: 'void',\n title: '触发器配置',\n 'x-component': 'Action.Drawer',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n initialValue: { config }\n },\n properties: {\n config: {\n type: 'void',\n name: 'config',\n 'x-component': 'fieldset',\n 'x-component-props': {},\n properties: fieldset\n },\n actions: {\n type: 'void',\n 'x-component': 'Action.Drawer.Footer',\n properties: {\n cancel: {\n title: '{{t(\"Cancel\")}}',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useCancelAction }}',\n },\n },\n submit: {\n title: '{{t(\"Submit\")}}',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n useAction: useUpdateConfigAction\n }\n }\n }\n }\n }\n }\n }\n }}\n scope={scope}\n />\n </div>\n );\n}\n"]}
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { useCollectionDataSource } from '../../collection-manager';
3
+ declare function useCollectionFieldsDataSource(): (field: any) => void;
3
4
  declare const _default: {
4
5
  title: string;
5
6
  type: string;
6
7
  fieldset: {
7
- collection: {
8
+ 'config.collection': {
8
9
  type: string;
9
10
  title: string;
10
11
  name: string;
@@ -13,7 +14,7 @@ declare const _default: {
13
14
  'x-decorator': string;
14
15
  'x-component': string;
15
16
  };
16
- mode: {
17
+ 'config.mode': {
17
18
  type: string;
18
19
  title: string;
19
20
  name: string;
@@ -26,10 +27,22 @@ declare const _default: {
26
27
  }[];
27
28
  };
28
29
  };
29
- filter: {
30
- title: string;
30
+ 'config.changed': {
31
31
  type: string;
32
32
  name: string;
33
+ title: string;
34
+ description: string;
35
+ 'x-decorator': string;
36
+ 'x-component': string;
37
+ 'x-component-props': {
38
+ mode: string;
39
+ };
40
+ 'x-reactions': string[];
41
+ };
42
+ 'config.condition': {
43
+ name: string;
44
+ title: string;
45
+ type: string;
33
46
  'x-decorator': string;
34
47
  'x-decorator-props': {
35
48
  labelAlign: string;
@@ -47,6 +60,7 @@ declare const _default: {
47
60
  };
48
61
  scope: {
49
62
  useCollectionDataSource: typeof useCollectionDataSource;
63
+ useCollectionFieldsDataSource: typeof useCollectionFieldsDataSource;
50
64
  };
51
65
  getter({ type, options, onChange }: {
52
66
  type: any;
@@ -13,35 +13,73 @@ var __assign = (this && this.__assign) || function () {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  var jsx_runtime_1 = require("react/jsx-runtime");
15
15
  var antd_1 = require("antd");
16
+ var reactive_1 = require("@formily/reactive");
17
+ var react_1 = require("@formily/react");
16
18
  var collection_manager_1 = require("../../collection-manager");
17
19
  var schema_component_1 = require("../../schema-component");
18
20
  var WorkflowCanvas_1 = require("../WorkflowCanvas");
19
21
  var calculators_1 = require("../calculators");
20
22
  var collection_1 = require("../schemas/collection");
23
+ function useCollectionFieldsDataSource() {
24
+ var _a;
25
+ var compile = (0, schema_component_1.useCompile)();
26
+ var getCollectionFields = (0, collection_manager_1.useCollectionManager)().getCollectionFields;
27
+ var values = (0, react_1.useForm)().values;
28
+ var fields = getCollectionFields((_a = values === null || values === void 0 ? void 0 : values.config) === null || _a === void 0 ? void 0 : _a.collection);
29
+ return function (field) {
30
+ reactive_1.action.bound(function (data) {
31
+ field.dataSource = data
32
+ .filter(function (field) { return (!field.hidden
33
+ && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true)); })
34
+ .map(function (field) {
35
+ var _a;
36
+ return ({
37
+ label: compile((_a = field.uiSchema) === null || _a === void 0 ? void 0 : _a.title),
38
+ value: field.name
39
+ });
40
+ });
41
+ })(fields);
42
+ };
43
+ }
21
44
  exports.default = {
22
45
  title: '数据表事件',
23
46
  type: 'model',
24
47
  fieldset: {
25
- collection: collection_1.collection,
26
- mode: {
48
+ 'config.collection': collection_1.collection,
49
+ 'config.mode': {
27
50
  type: 'number',
28
51
  title: '触发时机',
29
- name: 'mode',
52
+ name: 'config.mode',
30
53
  'x-decorator': 'FormItem',
31
54
  'x-component': 'Select',
32
55
  'x-component-props': {
33
56
  options: [
34
- { value: 1, label: '新增数据' },
35
- { value: 2, label: '更新数据' },
36
- { value: 3, label: '新增或更新数据' },
37
- { value: 4, label: '删除数据' }
57
+ { value: 1, label: '新增数据后' },
58
+ { value: 2, label: '更新数据后' },
59
+ { value: 3, label: '新增或更新数据后' },
60
+ { value: 4, label: '删除数据后' }
38
61
  ]
39
62
  }
40
63
  },
41
- filter: __assign(__assign({}, collection_1.filter), { title: '满足条件' })
64
+ 'config.changed': {
65
+ type: 'array',
66
+ name: 'changed',
67
+ title: '发生变动的字段',
68
+ description: '只有被选中的某个字段发生变动时才会触发。如果不选择,则表示任何字段变动时都会触发。新增或删除数据时,任意字段都被认为发生变动。',
69
+ 'x-decorator': 'FormItem',
70
+ 'x-component': 'Select',
71
+ 'x-component-props': {
72
+ mode: 'multiple',
73
+ },
74
+ 'x-reactions': [
75
+ '{{useCollectionFieldsDataSource()}}'
76
+ ]
77
+ },
78
+ 'config.condition': __assign(__assign({}, collection_1.filter), { name: 'config.condition', title: '满足条件' })
42
79
  },
43
80
  scope: {
44
- useCollectionDataSource: collection_manager_1.useCollectionDataSource
81
+ useCollectionDataSource: collection_manager_1.useCollectionDataSource,
82
+ useCollectionFieldsDataSource: useCollectionFieldsDataSource
45
83
  },
46
84
  getter: function (_a) {
47
85
  var _b, _c;
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/workflow/triggers/model.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,6BAA8B;AAE9B,+DAAyF;AACzF,2DAAoD;AAEpD,oDAAmD;AACnD,8CAA6C;AAC7C,oDAA2D;AAE3D,kBAAe;IACb,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,OAAO;IACb,QAAQ,EA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AAI;gBACb,QAAQ,CAAC,EAAE,IAAI,MAAA,EAAE,OAAO,wBAAO,OAAO,KAAE,IAAI,EAAE,UAAQ,IAAM,GAAE,EAAE,CAAC,CAAC;YACpE,CAAC,gBAEA,UAAU,CAAC,MAAM;iBACf,MAAM,CAAC,UAAA,KAAK,YAAI,OAAA,yBAAW,CAAC,GAAG,CAAC,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,0CAAE,IAAI,CAAC,CAAA,EAAA,CAAC;iBACvD,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,CACd,uBAAC,aAAM,CAAC,MAAM,aAAkB,KAAK,EAAE,KAAK,CAAC,IAAI,gBAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAA7D,KAAK,CAAC,IAAI,CAAoE,CACnG,EAFe,CAEf,CAAC,YACK,CACV,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import React from 'react';\nimport { Select } from 'antd';\n\nimport { useCollectionDataSource, useCollectionManager } from '../../collection-manager';\nimport { useCompile } from '../../schema-component';\n\nimport { useFlowContext } from '../WorkflowCanvas';\nimport { BaseTypeSet } from '../calculators';\nimport { collection, filter } from '../schemas/collection';\n\nexport default {\n title: '数据表事件',\n type: 'model',\n fieldset: {\n collection,\n mode: {\n type: 'number',\n title: '触发时机',\n name: 'mode',\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n 'x-component-props': {\n options: [\n { value: 1, label: '新增数据' },\n { value: 2, label: '更新数据' },\n { value: 3, label: '新增或更新数据' },\n { value: 4, label: '删除数据' }\n ]\n }\n },\n filter: {\n ...filter,\n title: '满足条件'\n }\n },\n scope: {\n useCollectionDataSource\n },\n getter({ type, options, onChange }) {\n const compile = useCompile();\n const { collections = [] } = useCollectionManager();\n const { workflow } = useFlowContext();\n const collection = collections.find(item => item.name === workflow.config.collection) ?? { fields: [] };\n\n return (\n <Select\n placeholder=\"选择字段\"\n value={options?.path?.replace(/^data\\./, '')}\n onChange={(path) => {\n onChange({ type, options: { ...options, path: `data.${path}` } });\n }}\n >\n {collection.fields\n .filter(field => BaseTypeSet.has(field?.uiSchema?.type))\n .map(field => (\n <Select.Option key={field.name} value={field.name}>{compile(field.uiSchema.title)}</Select.Option>\n ))}\n </Select>\n );\n }\n};\n"]}
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/workflow/triggers/model.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,6BAA8B;AAC9B,8CAA2C;AAC3C,wCAAyC;AAEzC,+DAAyF;AACzF,2DAAoD;AAEpD,oDAAmD;AACnD,8CAA6C;AAC7C,oDAA2D;AAE3D,SAAS,6BAA6B;;IACpC,IAAM,OAAO,GAAG,IAAA,6BAAU,GAAE,CAAC;IACrB,IAAA,mBAAmB,GAAK,IAAA,yCAAoB,GAAE,oBAA3B,CAA4B;IAC/C,IAAA,MAAM,GAAK,IAAA,eAAO,GAAE,OAAd,CAAe;IAC7B,IAAM,MAAM,GAAG,mBAAmB,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,UAAU,CAAC,CAAC;IAE/D,OAAO,UAAC,KAAU;QAChB,iBAAM,CAAC,KAAK,CAAC,UAAC,IAAS;YACrB,KAAK,CAAC,UAAU,GAAG,IAAI;iBACpB,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,IAAI,CAAC,CAC9D,EAHgB,CAGhB,CAAC;iBACD,GAAG,CAAC,UAAA,KAAK;;gBAAI,OAAA,CAAC;oBACb,KAAK,EAAE,OAAO,CAAC,MAAA,KAAK,CAAC,QAAQ,0CAAE,KAAK,CAAC;oBACrC,KAAK,EAAE,KAAK,CAAC,IAAI;iBAClB,CAAC,CAAA;aAAA,CAA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AG,EAAE,KAAA,CAA4B;QAC5C,IAAA,QAAQ,GAAK,IAAA,+BAAc,GAAE,SAArB,CAAsB;QACtC,IAAM,UAAU,GAAG,MAAA,WAAW,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAxC,CAAwC,CAAC,mCAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAExG,OAAO,CACL,uBAAC,aAAM,aACL,WAAW,EAAC,0BAAM,EAClB,KAAK,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAC5C,QAAQ,EAAE,UAAC,IAAI;gBACb,QAAQ,CAAC,EAAE,IAAI,MAAA,EAAE,OAAO,wBAAO,OAAO,KAAE,IAAI,EAAE,UAAQ,IAAM,GAAE,EAAE,CAAC,CAAC;YACpE,CAAC,gBAEA,UAAU,CAAC,MAAM;iBACf,MAAM,CAAC,UAAA,KAAK,YAAI,OAAA,yBAAW,CAAC,GAAG,CAAC,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,0CAAE,IAAI,CAAC,CAAA,EAAA,CAAC;iBACvD,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,CACd,uBAAC,aAAM,CAAC,MAAM,aAAkB,KAAK,EAAE,KAAK,CAAC,IAAI,gBAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAA7D,KAAK,CAAC,IAAI,CAAoE,CACnG,EAFe,CAEf,CAAC,YACK,CACV,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import React from 'react';\nimport { Select } from 'antd';\nimport { action } from '@formily/reactive';\nimport { useForm } from '@formily/react';\n\nimport { useCollectionDataSource, useCollectionManager } from '../../collection-manager';\nimport { useCompile } from '../../schema-component';\n\nimport { useFlowContext } from '../WorkflowCanvas';\nimport { BaseTypeSet } from '../calculators';\nimport { collection, filter } from '../schemas/collection';\n\nfunction useCollectionFieldsDataSource() {\n const compile = useCompile();\n const { getCollectionFields } = useCollectionManager();\n const { values } = useForm();\n const fields = getCollectionFields(values?.config?.collection);\n\n return (field: any) => {\n action.bound((data: any) => {\n field.dataSource = data\n .filter(field => (\n !field.hidden\n && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true)\n ))\n .map(field => ({\n label: compile(field.uiSchema?.title),\n value: field.name\n }));\n })(fields);\n };\n}\n\nexport default {\n title: '数据表事件',\n type: 'model',\n fieldset: {\n 'config.collection': collection,\n 'config.mode': {\n type: 'number',\n title: '触发时机',\n name: 'config.mode',\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n 'x-component-props': {\n options: [\n { value: 1, label: '新增数据后' },\n { value: 2, label: '更新数据后' },\n { value: 3, label: '新增或更新数据后' },\n { value: 4, label: '删除数据后' }\n ]\n }\n },\n 'config.changed': {\n type: 'array',\n name: 'changed',\n title: '发生变动的字段',\n description: '只有被选中的某个字段发生变动时才会触发。如果不选择,则表示任何字段变动时都会触发。新增或删除数据时,任意字段都被认为发生变动。',\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n 'x-component-props': {\n mode: 'multiple',\n },\n 'x-reactions': [\n '{{useCollectionFieldsDataSource()}}'\n ]\n },\n 'config.condition': {\n ...filter,\n name: 'config.condition',\n title: '满足条件'\n }\n },\n scope: {\n useCollectionDataSource,\n useCollectionFieldsDataSource\n },\n getter({ type, options, onChange }) {\n const compile = useCompile();\n const { collections = [] } = useCollectionManager();\n const { workflow } = useFlowContext();\n const collection = collections.find(item => item.name === workflow.config.collection) ?? { fields: [] };\n\n return (\n <Select\n placeholder=\"选择字段\"\n value={options?.path?.replace(/^data\\./, '')}\n onChange={(path) => {\n onChange({ type, options: { ...options, path: `data.${path}` } });\n }}\n >\n {collection.fields\n .filter(field => BaseTypeSet.has(field?.uiSchema?.type))\n .map(field => (\n <Select.Option key={field.name} value={field.name}>{compile(field.uiSchema.title)}</Select.Option>\n ))}\n </Select>\n );\n }\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.7.0-alpha.2",
3
+ "version": "0.7.0-alpha.20",
4
4
  "license": "Apache-2.0",
5
5
  "licenses": [
6
6
  {
@@ -29,9 +29,9 @@
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.2",
32
+ "@nocobase/utils": "0.7.0-alpha.20",
33
33
  "ahooks": "^3.0.5",
34
- "antd": "^4.18.9",
34
+ "antd": "~4.19.5",
35
35
  "axios": "^0.24.0",
36
36
  "classnames": "^2.3.1",
37
37
  "file-saver": "^2.0.5",
@@ -66,5 +66,5 @@
66
66
  "@types/marked": "^4.0.1",
67
67
  "axios-mock-adapter": "^1.20.0"
68
68
  },
69
- "gitHead": "0e0e99ef79c0b25bb0b45ecaa477c049cb16afee"
69
+ "gitHead": "d2e0cbdb5d26ba66e87a9d7660b10f3ec30a3c4b"
70
70
  }
@@ -47,11 +47,11 @@ export const RoleConfigure = () => {
47
47
  title: t('Configure permissions'),
48
48
  'x-decorator': 'FormItem',
49
49
  'x-component': 'Checkbox',
50
- 'x-content': '允许配置系统,包括界面配置、数据表配置、权限配置、系统配置等全部配置项',
50
+ 'x-content': t('Allows configuration of the whole system, including UI, collections, permissions, etc.'),
51
51
  },
52
52
  'strategy.actions': {
53
- title: t('General action permissions'),
54
- description: '所有数据表都默认使用通用数据操作权限;同时,可以针对每个数据表单独配置权限。',
53
+ title: t('Global action permissions'),
54
+ description: t('All collections use general action permissions by default; permission configured individually will override the default one.'),
55
55
  'x-component': 'StrategyActions',
56
56
  'x-decorator': 'FormItem',
57
57
  },
@@ -59,7 +59,7 @@ export const RoleConfigure = () => {
59
59
  title: t('Menu permissions'),
60
60
  'x-decorator': 'FormItem',
61
61
  'x-component': 'Checkbox',
62
- 'x-content': '新增菜单项默认允许访问',
62
+ 'x-content': t('New menu items are allowed to be accessed by default.'),
63
63
  },
64
64
  },
65
65
  }}
@@ -241,7 +241,7 @@ export const roleSchema: ISchema = {
241
241
  properties: {
242
242
  tab1: {
243
243
  type: 'void',
244
- title: '{{t("Global permissions")}}',
244
+ title: '{{t("General permissions")}}',
245
245
  'x-component': 'Tabs.TabPane',
246
246
  'x-component-props': {},
247
247
  properties: {
@@ -364,8 +364,12 @@ export default {
364
364
 
365
365
  'Role display name': '角色名称',
366
366
  'Default role': '默认角色',
367
-
367
+ 'All collections use general action permissions by default; permission configured individually will override the default one.': '所有数据表都默认使用通用数据操作权限;同时,可以针对每个数据表单独配置权限。',
368
+ 'Allows configuration of the whole system, including UI, collections, permissions, etc.': '允许配置系统,包括界面配置、数据表配置、权限配置、系统配置等全部配置项',
369
+ 'New menu items are allowed to be accessed by default.': '新增菜单项默认允许访问',
368
370
  'Global permissions': '全局配置',
371
+ 'General permissions': '通用配置',
372
+ 'Global action permissions': '全局操作权限',
369
373
  'General action permissions': '通用操作权限',
370
374
  'Action display name': '操作名称',
371
375
  'Allow': '允许',
@@ -264,7 +264,8 @@ export const Menu: ComposedMenu = observer((props) => {
264
264
  }
265
265
  }}
266
266
  mode={mode === 'mix' ? 'horizontal' : mode}
267
- openKeys={defaultOpenKeys}
267
+ defaultOpenKeys={defaultOpenKeys}
268
+ defaultSelectedKeys={defaultSelectedKeys}
268
269
  selectedKeys={defaultSelectedKeys}
269
270
  >
270
271
  {designable && (
@@ -44,10 +44,12 @@ export const BlockInitializers = {
44
44
  ],
45
45
  },
46
46
  {
47
+ key: 'media',
47
48
  type: 'itemGroup',
48
49
  title: '{{t("Media")}}',
49
50
  children: [
50
51
  {
52
+ key: 'markdown',
51
53
  type: 'item',
52
54
  title: '{{t("Markdown")}}',
53
55
  component: 'MarkdownBlockInitializer',