@nocobase/client 0.7.0-alpha.26 → 0.7.0-alpha.29

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 (237) hide show
  1. package/esm/block-provider/hooks/index.js +10 -2
  2. package/esm/block-provider/hooks/index.js.map +1 -1
  3. package/esm/collection-manager/hooks/useCollection.d.ts +1 -0
  4. package/esm/collection-manager/types.d.ts +1 -0
  5. package/esm/collection-manager/types.js.map +1 -1
  6. package/esm/locale/en_US.d.ts +4 -0
  7. package/esm/locale/en_US.js +6 -1
  8. package/esm/locale/en_US.js.map +1 -1
  9. package/esm/locale/index.d.ts +29 -7
  10. package/esm/locale/zh_CN.d.ts +25 -7
  11. package/esm/locale/zh_CN.js +25 -7
  12. package/esm/locale/zh_CN.js.map +1 -1
  13. package/esm/schema-component/antd/action/Action.Designer.js +6 -6
  14. package/esm/schema-component/antd/action/Action.Designer.js.map +1 -1
  15. package/esm/schema-component/antd/action/Action.Drawer.js +60 -3
  16. package/esm/schema-component/antd/action/Action.Drawer.js.map +1 -1
  17. package/esm/schema-component/antd/action/Action.js +36 -19
  18. package/esm/schema-component/antd/action/Action.js.map +1 -1
  19. package/esm/schema-component/antd/action/context.d.ts +2 -0
  20. package/esm/schema-component/antd/action/context.js.map +1 -1
  21. package/esm/schema-component/antd/action/hooks.d.ts +2 -0
  22. package/esm/schema-component/antd/filter/Filter.Action.Designer.js +1 -1
  23. package/esm/schema-component/antd/filter/Filter.Action.Designer.js.map +1 -1
  24. package/esm/schema-component/antd/filter/FilterGroup.js +12 -9
  25. package/esm/schema-component/antd/filter/FilterGroup.js.map +1 -1
  26. package/esm/schema-component/antd/filter/FilterItem.js +1 -1
  27. package/esm/schema-component/antd/filter/FilterItem.js.map +1 -1
  28. package/esm/schema-component/antd/form-v2/Form.js +27 -3
  29. package/esm/schema-component/antd/form-v2/Form.js.map +1 -1
  30. package/esm/schema-component/antd/grid/Grid.d.ts +2 -0
  31. package/esm/schema-component/antd/grid/Grid.js +10 -3
  32. package/esm/schema-component/antd/grid/Grid.js.map +1 -1
  33. package/esm/schema-component/antd/menu/Menu.Designer.js +35 -23
  34. package/esm/schema-component/antd/menu/Menu.Designer.js.map +1 -1
  35. package/esm/schema-component/antd/menu/Menu.js +3 -3
  36. package/esm/schema-component/antd/menu/Menu.js.map +1 -1
  37. package/esm/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  38. package/esm/schema-component/antd/record-picker/ReadPrettyRecordPicker.js.map +1 -1
  39. package/esm/schema-component/antd/table/Table.Void.Designer.js +1 -1
  40. package/esm/schema-component/antd/table/Table.Void.Designer.js.map +1 -1
  41. package/esm/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  42. package/esm/schema-component/antd/table-v2/Table.Column.Designer.js.map +1 -1
  43. package/esm/schema-component/antd/table-v2/TableBlockDesigner.js +2 -2
  44. package/esm/schema-component/antd/table-v2/TableBlockDesigner.js.map +1 -1
  45. package/esm/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -1
  46. package/esm/schema-component/antd/table-v2/TableSelectorDesigner.js.map +1 -1
  47. package/esm/schema-component/antd/tabs/Tabs.Designer.js +13 -2
  48. package/esm/schema-component/antd/tabs/Tabs.Designer.js.map +1 -1
  49. package/esm/schema-component/common/dnd-context/index.js +2 -1
  50. package/esm/schema-component/common/dnd-context/index.js.map +1 -1
  51. package/esm/schema-initializer/buttons/BlockInitializers.js +1 -1
  52. package/esm/schema-initializer/buttons/BlockInitializers.js.map +1 -1
  53. package/esm/schema-initializer/buttons/CreateFormBlockInitializers.js +2 -1
  54. package/esm/schema-initializer/buttons/CreateFormBlockInitializers.js.map +1 -1
  55. package/esm/schema-initializer/buttons/FormItemInitializers.js +3 -13
  56. package/esm/schema-initializer/buttons/FormItemInitializers.js.map +1 -1
  57. package/esm/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +3 -13
  58. package/esm/schema-initializer/buttons/ReadPrettyFormItemInitializers.js.map +1 -1
  59. package/esm/schema-initializer/buttons/RecordBlockInitializers.js +2 -1
  60. package/esm/schema-initializer/buttons/RecordBlockInitializers.js.map +1 -1
  61. package/esm/schema-settings/GeneralSchemaDesigner.js +17 -6
  62. package/esm/schema-settings/GeneralSchemaDesigner.js.map +1 -1
  63. package/esm/schema-templates/schemas/uiSchemaTemplates.js +67 -10
  64. package/esm/schema-templates/schemas/uiSchemaTemplates.js.map +1 -1
  65. package/esm/workflow/WorkflowCanvas.js +2 -2
  66. package/esm/workflow/WorkflowCanvas.js.map +1 -1
  67. package/esm/workflow/WorkflowLink.js +1 -1
  68. package/esm/workflow/WorkflowLink.js.map +1 -1
  69. package/esm/workflow/calculators.js +7 -5
  70. package/esm/workflow/calculators.js.map +1 -1
  71. package/esm/workflow/nodes/condition.d.ts +1 -1
  72. package/esm/workflow/nodes/condition.js +16 -13
  73. package/esm/workflow/nodes/condition.js.map +1 -1
  74. package/esm/workflow/nodes/create.d.ts +1 -0
  75. package/esm/workflow/nodes/index.js +4 -4
  76. package/esm/workflow/nodes/index.js.map +1 -1
  77. package/esm/workflow/nodes/parallel.js +8 -5
  78. package/esm/workflow/nodes/parallel.js.map +1 -1
  79. package/esm/workflow/nodes/query.js +1 -1
  80. package/esm/workflow/nodes/query.js.map +1 -1
  81. package/esm/workflow/nodes/update.d.ts +2 -1
  82. package/esm/workflow/nodes/update.js +12 -1
  83. package/esm/workflow/nodes/update.js.map +1 -1
  84. package/esm/workflow/schemas/collection.d.ts +1 -0
  85. package/esm/workflow/schemas/collection.js +3 -2
  86. package/esm/workflow/schemas/collection.js.map +1 -1
  87. package/esm/workflow/schemas/workflows.js +3 -2
  88. package/esm/workflow/schemas/workflows.js.map +1 -1
  89. package/esm/workflow/style.d.ts +1 -0
  90. package/esm/workflow/style.js +5 -4
  91. package/esm/workflow/style.js.map +1 -1
  92. package/esm/workflow/triggers/{model.d.ts → collection.d.ts} +5 -4
  93. package/esm/workflow/triggers/{model.js → collection.js} +23 -31
  94. package/esm/workflow/triggers/collection.js.map +1 -0
  95. package/esm/workflow/triggers/index.js +11 -8
  96. package/esm/workflow/triggers/index.js.map +1 -1
  97. package/lib/block-provider/hooks/index.js +9 -1
  98. package/lib/block-provider/hooks/index.js.map +1 -1
  99. package/lib/collection-manager/hooks/useCollection.d.ts +1 -0
  100. package/lib/collection-manager/types.d.ts +1 -0
  101. package/lib/collection-manager/types.js.map +1 -1
  102. package/lib/locale/en_US.d.ts +4 -0
  103. package/lib/locale/en_US.js +6 -1
  104. package/lib/locale/en_US.js.map +1 -1
  105. package/lib/locale/index.d.ts +29 -7
  106. package/lib/locale/zh_CN.d.ts +25 -7
  107. package/lib/locale/zh_CN.js +25 -7
  108. package/lib/locale/zh_CN.js.map +1 -1
  109. package/lib/schema-component/antd/action/Action.Designer.js +6 -6
  110. package/lib/schema-component/antd/action/Action.Designer.js.map +1 -1
  111. package/lib/schema-component/antd/action/Action.Drawer.js +59 -2
  112. package/lib/schema-component/antd/action/Action.Drawer.js.map +1 -1
  113. package/lib/schema-component/antd/action/Action.js +35 -18
  114. package/lib/schema-component/antd/action/Action.js.map +1 -1
  115. package/lib/schema-component/antd/action/context.d.ts +2 -0
  116. package/lib/schema-component/antd/action/context.js.map +1 -1
  117. package/lib/schema-component/antd/action/hooks.d.ts +2 -0
  118. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +1 -1
  119. package/lib/schema-component/antd/filter/Filter.Action.Designer.js.map +1 -1
  120. package/lib/schema-component/antd/filter/FilterGroup.js +12 -9
  121. package/lib/schema-component/antd/filter/FilterGroup.js.map +1 -1
  122. package/lib/schema-component/antd/filter/FilterItem.js +1 -1
  123. package/lib/schema-component/antd/filter/FilterItem.js.map +1 -1
  124. package/lib/schema-component/antd/form-v2/Form.js +29 -5
  125. package/lib/schema-component/antd/form-v2/Form.js.map +1 -1
  126. package/lib/schema-component/antd/grid/Grid.d.ts +2 -0
  127. package/lib/schema-component/antd/grid/Grid.js +13 -4
  128. package/lib/schema-component/antd/grid/Grid.js.map +1 -1
  129. package/lib/schema-component/antd/menu/Menu.Designer.js +35 -23
  130. package/lib/schema-component/antd/menu/Menu.Designer.js.map +1 -1
  131. package/lib/schema-component/antd/menu/Menu.js +2 -2
  132. package/lib/schema-component/antd/menu/Menu.js.map +1 -1
  133. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  134. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js.map +1 -1
  135. package/lib/schema-component/antd/table/Table.Void.Designer.js +1 -1
  136. package/lib/schema-component/antd/table/Table.Void.Designer.js.map +1 -1
  137. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  138. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js.map +1 -1
  139. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -2
  140. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js.map +1 -1
  141. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -1
  142. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js.map +1 -1
  143. package/lib/schema-component/antd/tabs/Tabs.Designer.js +13 -2
  144. package/lib/schema-component/antd/tabs/Tabs.Designer.js.map +1 -1
  145. package/lib/schema-component/common/dnd-context/index.js +2 -1
  146. package/lib/schema-component/common/dnd-context/index.js.map +1 -1
  147. package/lib/schema-initializer/buttons/BlockInitializers.js +1 -1
  148. package/lib/schema-initializer/buttons/BlockInitializers.js.map +1 -1
  149. package/lib/schema-initializer/buttons/CreateFormBlockInitializers.js +2 -1
  150. package/lib/schema-initializer/buttons/CreateFormBlockInitializers.js.map +1 -1
  151. package/lib/schema-initializer/buttons/FormItemInitializers.js +3 -13
  152. package/lib/schema-initializer/buttons/FormItemInitializers.js.map +1 -1
  153. package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +3 -13
  154. package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js.map +1 -1
  155. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +2 -1
  156. package/lib/schema-initializer/buttons/RecordBlockInitializers.js.map +1 -1
  157. package/lib/schema-settings/GeneralSchemaDesigner.js +15 -4
  158. package/lib/schema-settings/GeneralSchemaDesigner.js.map +1 -1
  159. package/lib/schema-templates/schemas/uiSchemaTemplates.js +67 -10
  160. package/lib/schema-templates/schemas/uiSchemaTemplates.js.map +1 -1
  161. package/lib/workflow/WorkflowCanvas.js +2 -2
  162. package/lib/workflow/WorkflowCanvas.js.map +1 -1
  163. package/lib/workflow/WorkflowLink.js +1 -1
  164. package/lib/workflow/WorkflowLink.js.map +1 -1
  165. package/lib/workflow/calculators.js +7 -5
  166. package/lib/workflow/calculators.js.map +1 -1
  167. package/lib/workflow/nodes/condition.d.ts +1 -1
  168. package/lib/workflow/nodes/condition.js +13 -10
  169. package/lib/workflow/nodes/condition.js.map +1 -1
  170. package/lib/workflow/nodes/create.d.ts +1 -0
  171. package/lib/workflow/nodes/index.js +3 -3
  172. package/lib/workflow/nodes/index.js.map +1 -1
  173. package/lib/workflow/nodes/parallel.js +8 -5
  174. package/lib/workflow/nodes/parallel.js.map +1 -1
  175. package/lib/workflow/nodes/query.js +1 -1
  176. package/lib/workflow/nodes/query.js.map +1 -1
  177. package/lib/workflow/nodes/update.d.ts +2 -1
  178. package/lib/workflow/nodes/update.js +12 -1
  179. package/lib/workflow/nodes/update.js.map +1 -1
  180. package/lib/workflow/schemas/collection.d.ts +1 -0
  181. package/lib/workflow/schemas/collection.js +3 -2
  182. package/lib/workflow/schemas/collection.js.map +1 -1
  183. package/lib/workflow/schemas/workflows.js +3 -2
  184. package/lib/workflow/schemas/workflows.js.map +1 -1
  185. package/lib/workflow/style.d.ts +1 -0
  186. package/lib/workflow/style.js +6 -5
  187. package/lib/workflow/style.js.map +1 -1
  188. package/lib/workflow/triggers/{model.d.ts → collection.d.ts} +5 -4
  189. package/lib/workflow/triggers/{model.js → collection.js} +22 -30
  190. package/lib/workflow/triggers/collection.js.map +1 -0
  191. package/lib/workflow/triggers/index.js +10 -7
  192. package/lib/workflow/triggers/index.js.map +1 -1
  193. package/package.json +3 -3
  194. package/src/block-provider/hooks/index.ts +10 -2
  195. package/src/collection-manager/types.ts +1 -0
  196. package/src/locale/en_US.ts +8 -1
  197. package/src/locale/zh_CN.ts +27 -7
  198. package/src/schema-component/antd/action/Action.Designer.tsx +2 -2
  199. package/src/schema-component/antd/action/Action.Drawer.tsx +20 -3
  200. package/src/schema-component/antd/action/Action.tsx +19 -5
  201. package/src/schema-component/antd/action/context.tsx +2 -0
  202. package/src/schema-component/antd/filter/Filter.Action.Designer.tsx +1 -1
  203. package/src/schema-component/antd/filter/FilterGroup.tsx +14 -9
  204. package/src/schema-component/antd/filter/FilterItem.tsx +1 -1
  205. package/src/schema-component/antd/form-v2/Form.tsx +29 -3
  206. package/src/schema-component/antd/grid/Grid.tsx +31 -20
  207. package/src/schema-component/antd/menu/Menu.Designer.tsx +36 -26
  208. package/src/schema-component/antd/menu/Menu.tsx +12 -2
  209. package/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx +3 -1
  210. package/src/schema-component/antd/table/Table.Void.Designer.tsx +1 -1
  211. package/src/schema-component/antd/table-v2/Table.Column.Designer.tsx +1 -1
  212. package/src/schema-component/antd/table-v2/TableBlockDesigner.tsx +2 -2
  213. package/src/schema-component/antd/table-v2/TableSelectorDesigner.tsx +1 -1
  214. package/src/schema-component/antd/tabs/Tabs.Designer.tsx +1 -1
  215. package/src/schema-component/common/dnd-context/index.tsx +2 -1
  216. package/src/schema-initializer/buttons/BlockInitializers.tsx +1 -1
  217. package/src/schema-initializer/buttons/CreateFormBlockInitializers.tsx +4 -1
  218. package/src/schema-initializer/buttons/FormItemInitializers.tsx +5 -3
  219. package/src/schema-initializer/buttons/ReadPrettyFormItemInitializers.tsx +5 -3
  220. package/src/schema-initializer/buttons/RecordBlockInitializers.tsx +4 -1
  221. package/src/schema-settings/GeneralSchemaDesigner.tsx +20 -5
  222. package/src/schema-templates/schemas/uiSchemaTemplates.ts +23 -10
  223. package/src/workflow/WorkflowCanvas.tsx +2 -3
  224. package/src/workflow/WorkflowLink.tsx +1 -1
  225. package/src/workflow/calculators.tsx +10 -8
  226. package/src/workflow/nodes/condition.tsx +21 -38
  227. package/src/workflow/nodes/index.tsx +6 -4
  228. package/src/workflow/nodes/parallel.tsx +10 -7
  229. package/src/workflow/nodes/query.tsx +1 -1
  230. package/src/workflow/nodes/update.tsx +4 -1
  231. package/src/workflow/schemas/collection.ts +3 -3
  232. package/src/workflow/schemas/workflows.ts +3 -2
  233. package/src/workflow/style.tsx +4 -0
  234. package/src/workflow/triggers/{model.tsx → collection.tsx} +25 -25
  235. package/src/workflow/triggers/index.tsx +13 -6
  236. package/esm/workflow/triggers/model.js.map +0 -1
  237. package/lib/workflow/triggers/model.js.map +0 -1
@@ -4,7 +4,8 @@ import { SchemaInitializer } from '../..';
4
4
  import { gridRowColWrap } from '../utils';
5
5
  export var CreateFormBlockInitializers = function (props) {
6
6
  var t = useTranslation().t;
7
- return (_jsx(SchemaInitializer.Button, { wrap: gridRowColWrap, title: t('Add block'), icon: 'PlusOutlined', items: [
7
+ var insertPosition = props.insertPosition, component = props.component;
8
+ return (_jsx(SchemaInitializer.Button, { wrap: gridRowColWrap, title: component ? null : t('Add block'), icon: 'PlusOutlined', insertPosition: insertPosition, component: component, items: [
8
9
  {
9
10
  type: 'itemGroup',
10
11
  title: '{{t("Data blocks")}}',
@@ -1 +1 @@
1
- {"version":3,"file":"CreateFormBlockInitializers.js","sourceRoot":"","sources":["../../../src/schema-initializer/buttons/CreateFormBlockInitializers.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,CAAC,IAAM,2BAA2B,GAAG,UAAC,KAAU;IAC5C,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IAC/B,OAAO,CACL,KAAC,iBAAiB,CAAC,MAAM,IACvB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,EACrB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,sBAAsB;gBAC7B,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,eAAe;wBACtB,SAAS,EAAE,4BAA4B;qBACxC;iBACF;aACF;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,gBAAgB;gBACvB,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,mBAAmB;wBAC1B,SAAS,EAAE,0BAA0B;qBACtC;iBACF;aACF;SACF,WACD,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SchemaInitializer } from '../..';\nimport { gridRowColWrap } from '../utils';\n\nexport const CreateFormBlockInitializers = (props: any) => {\n const { t } = useTranslation();\n return (\n <SchemaInitializer.Button\n wrap={gridRowColWrap}\n title={t('Add block')}\n icon={'PlusOutlined'}\n items={[\n {\n type: 'itemGroup',\n title: '{{t(\"Data blocks\")}}',\n children: [\n {\n type: 'item',\n title: '{{t(\"Form\")}}',\n component: 'CreateFormBlockInitializer',\n },\n ],\n },\n {\n type: 'itemGroup',\n title: '{{t(\"Media\")}}',\n children: [\n {\n type: 'item',\n title: '{{t(\"Markdown\")}}',\n component: 'MarkdownBlockInitializer',\n },\n ],\n },\n ]}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"CreateFormBlockInitializers.js","sourceRoot":"","sources":["../../../src/schema-initializer/buttons/CreateFormBlockInitializers.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,CAAC,IAAM,2BAA2B,GAAG,UAAC,KAAU;IAC5C,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IACvB,IAAA,cAAc,GAAgB,KAAK,eAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IAC5C,OAAO,CACL,KAAC,iBAAiB,CAAC,MAAM,IACvB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EACxC,IAAI,EAAE,cAAc,EACpB,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,sBAAsB;gBAC7B,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,eAAe;wBACtB,SAAS,EAAE,4BAA4B;qBACxC;iBACF;aACF;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,gBAAgB;gBACvB,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,mBAAmB;wBAC1B,SAAS,EAAE,0BAA0B;qBACtC;iBACF;aACF;SACF,WACD,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SchemaInitializer } from '../..';\nimport { gridRowColWrap } from '../utils';\n\nexport const CreateFormBlockInitializers = (props: any) => {\n const { t } = useTranslation();\n const { insertPosition, component } = props;\n return (\n <SchemaInitializer.Button\n wrap={gridRowColWrap}\n title={component ? null : t('Add block')}\n icon={'PlusOutlined'}\n insertPosition={insertPosition}\n component={component}\n items={[\n {\n type: 'itemGroup',\n title: '{{t(\"Data blocks\")}}',\n children: [\n {\n type: 'item',\n title: '{{t(\"Form\")}}',\n component: 'CreateFormBlockInitializer',\n },\n ],\n },\n {\n type: 'itemGroup',\n title: '{{t(\"Media\")}}',\n children: [\n {\n type: 'item',\n title: '{{t(\"Markdown\")}}',\n component: 'MarkdownBlockInitializer',\n },\n ],\n },\n ]}\n />\n );\n};\n"]}
@@ -1,14 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx } from "react/jsx-runtime";
13
2
  import { useTranslation } from 'react-i18next';
14
3
  import { SchemaInitializer } from '../SchemaInitializer';
@@ -16,7 +5,8 @@ import { gridRowColWrap, useFormItemInitializerFields } from '../utils';
16
5
  // 表单里配置字段
17
6
  export var FormItemInitializers = function (props) {
18
7
  var t = useTranslation().t;
19
- return (_jsx(SchemaInitializer.Button, __assign({ wrap: gridRowColWrap, icon: 'SettingOutlined', items: [
8
+ var insertPosition = props.insertPosition, component = props.component;
9
+ return (_jsx(SchemaInitializer.Button, { wrap: gridRowColWrap, icon: 'SettingOutlined', items: [
20
10
  {
21
11
  type: 'itemGroup',
22
12
  title: t('Display fields'),
@@ -40,6 +30,6 @@ export var FormItemInitializers = function (props) {
40
30
  },
41
31
  },
42
32
  },
43
- ] }, { children: t('Configure fields') }), void 0));
33
+ ], insertPosition: insertPosition, component: component, title: component ? null : t('Configure fields') }, void 0));
44
34
  };
45
35
  //# sourceMappingURL=FormItemInitializers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormItemInitializers.js","sourceRoot":"","sources":["../../../src/schema-initializer/buttons/FormItemInitializers.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExE,UAAU;AACV,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,KAAU;IACrC,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IAC/B,OAAO,CACL,KAAC,iBAAiB,CAAC,MAAM,aACvB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC;gBAC1B,QAAQ,EAAE,4BAA4B,EAAE;aACzC;YACD;gBACE,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC;gBACpB,SAAS,EAAE,kBAAkB;gBAC7B,MAAM,EAAE;oBACN,IAAI,EAAE,MAAM;oBACZ,YAAY,EAAE,KAAK;oBACnB,aAAa,EAAE,UAAU;oBACzB,YAAY,EAAE,wBAAwB;oBACtC,aAAa,EAAE,eAAe;oBAC9B,mBAAmB,EAAE;wBACnB,OAAO,EAAE,CAAC,CAAC,oDAAoD,CAAC;qBACjE;iBACF;aACF;SACF,gBAEA,CAAC,CAAC,kBAAkB,CAAC,YACG,CAC5B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SchemaInitializer } from '../SchemaInitializer';\nimport { gridRowColWrap, useFormItemInitializerFields } from '../utils';\n\n// 表单里配置字段\nexport const FormItemInitializers = (props: any) => {\n const { t } = useTranslation();\n return (\n <SchemaInitializer.Button\n wrap={gridRowColWrap}\n icon={'SettingOutlined'}\n items={[\n {\n type: 'itemGroup',\n title: t('Display fields'),\n children: useFormItemInitializerFields(),\n },\n {\n type: 'divider',\n },\n {\n type: 'item',\n title: t('Add text'),\n component: 'BlockInitializer',\n schema: {\n type: 'void',\n 'x-editable': false,\n 'x-decorator': 'FormItem',\n 'x-designer': 'Markdown.Void.Designer',\n 'x-component': 'Markdown.Void',\n 'x-component-props': {\n content: t('This is a demo text, **supports Markdown syntax**.'),\n },\n },\n },\n ]}\n >\n {t('Configure fields')}\n </SchemaInitializer.Button>\n );\n};\n"]}
1
+ {"version":3,"file":"FormItemInitializers.js","sourceRoot":"","sources":["../../../src/schema-initializer/buttons/FormItemInitializers.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExE,UAAU;AACV,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,KAAU;IACrC,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IACvB,IAAA,cAAc,GAAgB,KAAK,eAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IAC5C,OAAO,CACL,KAAC,iBAAiB,CAAC,MAAM,IACvB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC;gBAC1B,QAAQ,EAAE,4BAA4B,EAAE;aACzC;YACD;gBACE,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC;gBACpB,SAAS,EAAE,kBAAkB;gBAC7B,MAAM,EAAE;oBACN,IAAI,EAAE,MAAM;oBACZ,YAAY,EAAE,KAAK;oBACnB,aAAa,EAAE,UAAU;oBACzB,YAAY,EAAE,wBAAwB;oBACtC,aAAa,EAAE,eAAe;oBAC9B,mBAAmB,EAAE;wBACnB,OAAO,EAAE,CAAC,CAAC,oDAAoD,CAAC;qBACjE;iBACF;aACF;SACF,EACD,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAC/C,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SchemaInitializer } from '../SchemaInitializer';\nimport { gridRowColWrap, useFormItemInitializerFields } from '../utils';\n\n// 表单里配置字段\nexport const FormItemInitializers = (props: any) => {\n const { t } = useTranslation();\n const { insertPosition, component } = props;\n return (\n <SchemaInitializer.Button\n wrap={gridRowColWrap}\n icon={'SettingOutlined'}\n items={[\n {\n type: 'itemGroup',\n title: t('Display fields'),\n children: useFormItemInitializerFields(),\n },\n {\n type: 'divider',\n },\n {\n type: 'item',\n title: t('Add text'),\n component: 'BlockInitializer',\n schema: {\n type: 'void',\n 'x-editable': false,\n 'x-decorator': 'FormItem',\n 'x-designer': 'Markdown.Void.Designer',\n 'x-component': 'Markdown.Void',\n 'x-component-props': {\n content: t('This is a demo text, **supports Markdown syntax**.'),\n },\n },\n },\n ]}\n insertPosition={insertPosition}\n component={component}\n title={component ? null : t('Configure fields')}\n />\n );\n};\n"]}
@@ -1,21 +1,11 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx } from "react/jsx-runtime";
13
2
  import { useTranslation } from 'react-i18next';
14
3
  import { SchemaInitializer } from '../SchemaInitializer';
15
4
  import { gridRowColWrap, useFormItemInitializerFields } from '../utils';
16
5
  export var ReadPrettyFormItemInitializers = function (props) {
17
6
  var t = useTranslation().t;
18
- return (_jsx(SchemaInitializer.Button, __assign({ wrap: gridRowColWrap, icon: 'SettingOutlined', items: [
7
+ var insertPosition = props.insertPosition, component = props.component;
8
+ return (_jsx(SchemaInitializer.Button, { wrap: gridRowColWrap, icon: 'SettingOutlined', items: [
19
9
  {
20
10
  type: 'itemGroup',
21
11
  title: t('Display fields'),
@@ -39,6 +29,6 @@ export var ReadPrettyFormItemInitializers = function (props) {
39
29
  },
40
30
  },
41
31
  },
42
- ] }, { children: t('Configure fields') }), void 0));
32
+ ], insertPosition: insertPosition, component: component, title: component ? null : t('Configure fields') }, void 0));
43
33
  };
44
34
  //# sourceMappingURL=ReadPrettyFormItemInitializers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReadPrettyFormItemInitializers.js","sourceRoot":"","sources":["../../../src/schema-initializer/buttons/ReadPrettyFormItemInitializers.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExE,MAAM,CAAC,IAAM,8BAA8B,GAAG,UAAC,KAAU;IAC/C,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IAC/B,OAAO,CACL,KAAC,iBAAiB,CAAC,MAAM,aACvB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC;gBAC1B,QAAQ,EAAE,4BAA4B,EAAE;aACzC;YACD;gBACE,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC;gBACpB,SAAS,EAAE,kBAAkB;gBAC7B,MAAM,EAAE;oBACN,IAAI,EAAE,MAAM;oBACZ,YAAY,EAAE,KAAK;oBACnB,aAAa,EAAE,UAAU;oBACzB,YAAY,EAAE,wBAAwB;oBACtC,aAAa,EAAE,eAAe;oBAC9B,mBAAmB,EAAE;wBACnB,OAAO,EAAE,CAAC,CAAC,oDAAoD,CAAC;qBACjE;iBACF;aACF;SACF,gBAEA,CAAC,CAAC,kBAAkB,CAAC,YACG,CAC5B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SchemaInitializer } from '../SchemaInitializer';\nimport { gridRowColWrap, useFormItemInitializerFields } from '../utils';\n\nexport const ReadPrettyFormItemInitializers = (props: any) => {\n const { t } = useTranslation();\n return (\n <SchemaInitializer.Button\n wrap={gridRowColWrap}\n icon={'SettingOutlined'}\n items={[\n {\n type: 'itemGroup',\n title: t('Display fields'),\n children: useFormItemInitializerFields(),\n },\n {\n type: 'divider',\n },\n {\n type: 'item',\n title: t('Add text'),\n component: 'BlockInitializer',\n schema: {\n type: 'void',\n 'x-editable': false,\n 'x-decorator': 'FormItem',\n 'x-designer': 'Markdown.Void.Designer',\n 'x-component': 'Markdown.Void',\n 'x-component-props': {\n content: t('This is a demo text, **supports Markdown syntax**.'),\n },\n },\n },\n ]}\n >\n {t('Configure fields')}\n </SchemaInitializer.Button>\n );\n};\n"]}
1
+ {"version":3,"file":"ReadPrettyFormItemInitializers.js","sourceRoot":"","sources":["../../../src/schema-initializer/buttons/ReadPrettyFormItemInitializers.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExE,MAAM,CAAC,IAAM,8BAA8B,GAAG,UAAC,KAAU;IAC/C,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IACvB,IAAA,cAAc,GAAgB,KAAK,eAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IAC5C,OAAO,CACL,KAAC,iBAAiB,CAAC,MAAM,IACvB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC;gBAC1B,QAAQ,EAAE,4BAA4B,EAAE;aACzC;YACD;gBACE,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC;gBACpB,SAAS,EAAE,kBAAkB;gBAC7B,MAAM,EAAE;oBACN,IAAI,EAAE,MAAM;oBACZ,YAAY,EAAE,KAAK;oBACnB,aAAa,EAAE,UAAU;oBACzB,YAAY,EAAE,wBAAwB;oBACtC,aAAa,EAAE,eAAe;oBAC9B,mBAAmB,EAAE;wBACnB,OAAO,EAAE,CAAC,CAAC,oDAAoD,CAAC;qBACjE;iBACF;aACF;SACF,EACD,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAC/C,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SchemaInitializer } from '../SchemaInitializer';\nimport { gridRowColWrap, useFormItemInitializerFields } from '../utils';\n\nexport const ReadPrettyFormItemInitializers = (props: any) => {\n const { t } = useTranslation();\n const { insertPosition, component } = props;\n return (\n <SchemaInitializer.Button\n wrap={gridRowColWrap}\n icon={'SettingOutlined'}\n items={[\n {\n type: 'itemGroup',\n title: t('Display fields'),\n children: useFormItemInitializerFields(),\n },\n {\n type: 'divider',\n },\n {\n type: 'item',\n title: t('Add text'),\n component: 'BlockInitializer',\n schema: {\n type: 'void',\n 'x-editable': false,\n 'x-decorator': 'FormItem',\n 'x-designer': 'Markdown.Void.Designer',\n 'x-component': 'Markdown.Void',\n 'x-component-props': {\n content: t('This is a demo text, **supports Markdown syntax**.'),\n },\n },\n },\n ]}\n insertPosition={insertPosition}\n component={component}\n title={component ? null : t('Configure fields')}\n />\n );\n};\n"]}
@@ -19,7 +19,8 @@ var useRelationFields = function () {
19
19
  };
20
20
  export var RecordBlockInitializers = function (props) {
21
21
  var t = useTranslation().t;
22
- return (_jsx(SchemaInitializer.Button, { wrap: gridRowColWrap, title: t('Add block'), icon: 'PlusOutlined', items: [
22
+ var insertPosition = props.insertPosition, component = props.component;
23
+ return (_jsx(SchemaInitializer.Button, { wrap: gridRowColWrap, insertPosition: insertPosition, component: component, title: component ? null : t('Add block'), icon: 'PlusOutlined', items: [
23
24
  {
24
25
  type: 'itemGroup',
25
26
  title: '{{t("Current record blocks")}}',
@@ -1 +1 @@
1
- {"version":3,"file":"RecordBlockInitializers.js","sourceRoot":"","sources":["../../../src/schema-initializer/buttons/RecordBlockInitializers.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,IAAM,iBAAiB,GAAG;IAChB,IAAA,MAAM,GAAK,aAAa,EAAE,OAApB,CAAqB;IACnC,OAAO,MAAM;SACV,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,EAAhD,CAAgD,CAAC;SACnE,GAAG,CAAC,UAAC,KAAK;;QACT,OAAO;YACL,GAAG,EAAE,KAAK,CAAC,IAAI;YACf,IAAI,EAAE,MAAM;YACZ,KAAK,OAAA;YACL,KAAK,EAAE,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,0CAAE,KAAK,KAAI,KAAK,CAAC,IAAI;YAC3C,SAAS,EAAE,mCAAmC;SAC/C,CAAC;IACJ,CAAC,CAAQ,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,uBAAuB,GAAG,UAAC,KAAU;IACxC,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IAC/B,OAAO,CACL,KAAC,iBAAiB,CAAC,MAAM,IACvB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,EACrB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,gCAAgC;gBACvC,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,SAAS;wBACd,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,kBAAkB;wBACzB,SAAS,EAAE,sCAAsC;qBAClD;oBACD;wBACE,GAAG,EAAE,MAAM;wBACX,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,eAAe;wBACtB,SAAS,EAAE,4BAA4B;qBACxC;iBACF;aACF;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,8BAA8B;gBACrC,QAAQ,EAAE,iBAAiB,EAAE;aAC9B;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,gBAAgB;gBACvB,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,UAAU;wBACf,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,mBAAmB;wBAC1B,SAAS,EAAE,0BAA0B;qBACtC;iBACF;aACF;SACF,WACD,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SchemaInitializer, useCollection } from '../..';\nimport { gridRowColWrap } from '../utils';\n\nconst useRelationFields = () => {\n const { fields } = useCollection();\n return fields\n .filter((field) => ['linkTo', 'subTable'].includes(field.interface))\n .map((field) => {\n return {\n key: field.name,\n type: 'item',\n field,\n title: field?.uiSchema?.title || field.name,\n component: 'RecordAssociationBlockInitializer',\n };\n }) as any;\n};\n\nexport const RecordBlockInitializers = (props: any) => {\n const { t } = useTranslation();\n return (\n <SchemaInitializer.Button\n wrap={gridRowColWrap}\n title={t('Add block')}\n icon={'PlusOutlined'}\n items={[\n {\n type: 'itemGroup',\n title: '{{t(\"Current record blocks\")}}',\n children: [\n {\n key: 'details',\n type: 'item',\n title: '{{t(\"Details\")}}',\n component: 'RecordReadPrettyFormBlockInitializer',\n },\n {\n key: 'form',\n type: 'item',\n title: '{{t(\"Form\")}}',\n component: 'RecordFormBlockInitializer',\n },\n ],\n },\n {\n type: 'itemGroup',\n title: '{{t(\"Relationship blocks\")}}',\n children: useRelationFields(),\n },\n {\n type: 'itemGroup',\n title: '{{t(\"Media\")}}',\n children: [\n {\n key: 'markdown',\n type: 'item',\n title: '{{t(\"Markdown\")}}',\n component: 'MarkdownBlockInitializer',\n },\n ],\n },\n ]}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"RecordBlockInitializers.js","sourceRoot":"","sources":["../../../src/schema-initializer/buttons/RecordBlockInitializers.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,IAAM,iBAAiB,GAAG;IAChB,IAAA,MAAM,GAAK,aAAa,EAAE,OAApB,CAAqB;IACnC,OAAO,MAAM;SACV,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,EAAhD,CAAgD,CAAC;SACnE,GAAG,CAAC,UAAC,KAAK;;QACT,OAAO;YACL,GAAG,EAAE,KAAK,CAAC,IAAI;YACf,IAAI,EAAE,MAAM;YACZ,KAAK,OAAA;YACL,KAAK,EAAE,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK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from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SchemaInitializer, useCollection } from '../..';\nimport { gridRowColWrap } from '../utils';\n\nconst useRelationFields = () => {\n const { fields } = useCollection();\n return fields\n .filter((field) => ['linkTo', 'subTable'].includes(field.interface))\n .map((field) => {\n return {\n key: field.name,\n type: 'item',\n field,\n title: field?.uiSchema?.title || field.name,\n component: 'RecordAssociationBlockInitializer',\n };\n }) as any;\n};\n\nexport const RecordBlockInitializers = (props: any) => {\n const { t } = useTranslation();\n const { insertPosition, component } = props;\n return (\n <SchemaInitializer.Button\n wrap={gridRowColWrap}\n insertPosition={insertPosition}\n component={component}\n title={component ? null : t('Add block')}\n icon={'PlusOutlined'}\n items={[\n {\n type: 'itemGroup',\n title: '{{t(\"Current record blocks\")}}',\n children: [\n {\n key: 'details',\n type: 'item',\n title: '{{t(\"Details\")}}',\n component: 'RecordReadPrettyFormBlockInitializer',\n },\n {\n key: 'form',\n type: 'item',\n title: '{{t(\"Form\")}}',\n component: 'RecordFormBlockInitializer',\n },\n ],\n },\n {\n type: 'itemGroup',\n title: '{{t(\"Relationship blocks\")}}',\n children: useRelationFields(),\n },\n {\n type: 'itemGroup',\n title: '{{t(\"Media\")}}',\n children: [\n {\n key: 'markdown',\n type: 'item',\n title: '{{t(\"Markdown\")}}',\n component: 'MarkdownBlockInitializer',\n },\n ],\n },\n ]}\n />\n );\n};\n"]}
@@ -14,18 +14,20 @@ var __assign = (this && this.__assign) || function () {
14
14
  return __assign.apply(this, arguments);
15
15
  };
16
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- import { DragOutlined, MenuOutlined } from '@ant-design/icons';
17
+ import { DragOutlined, MenuOutlined, PlusOutlined } from '@ant-design/icons';
18
18
  import { css } from '@emotion/css';
19
19
  import { useField, useFieldSchema } from '@formily/react';
20
20
  import { Space } from 'antd';
21
21
  import classNames from 'classnames';
22
22
  import { useTranslation } from 'react-i18next';
23
- import { DragHandler, useCompile, useDesignable } from '../schema-component';
23
+ import { DragHandler, useCompile, useDesignable, useGridContext, useGridRowContext } from '../schema-component';
24
+ import { gridRowColWrap } from '../schema-initializer/utils';
24
25
  import { SchemaSettings } from './SchemaSettings';
25
26
  var titleCss = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n pointer-events: none;\n position: absolute;\n font-size: 12px;\n /* background: #f18b62;\n color: #fff; */\n padding: 0;\n line-height: 16px;\n height: 16px;\n border-bottom-right-radius: 2px;\n border-radius: 2px;\n top: 2px;\n left: 2px;\n .title-tag {\n padding: 0 3px;\n border-radius: 2px;\n background: #f18b62;\n color: #fff;\n display: block;\n }\n"], ["\n pointer-events: none;\n position: absolute;\n font-size: 12px;\n /* background: #f18b62;\n color: #fff; */\n padding: 0;\n line-height: 16px;\n height: 16px;\n border-bottom-right-radius: 2px;\n border-radius: 2px;\n top: 2px;\n left: 2px;\n .title-tag {\n padding: 0 3px;\n border-radius: 2px;\n background: #f18b62;\n color: #fff;\n display: block;\n }\n"])));
26
27
  export var GeneralSchemaDesigner = function (props) {
27
- var title = props.title, template = props.template, _a = props.draggable, draggable = _a === void 0 ? true : _a;
28
- var _b = useDesignable(), dn = _b.dn, designable = _b.designable;
28
+ var _a, _b;
29
+ var disableInitializer = props.disableInitializer, title = props.title, template = props.template, _c = props.draggable, draggable = _c === void 0 ? true : _c;
30
+ var _d = useDesignable(), dn = _d.dn, designable = _d.designable;
29
31
  var field = useField();
30
32
  var t = useTranslation().t;
31
33
  var fieldSchema = useFieldSchema();
@@ -38,8 +40,17 @@ export var GeneralSchemaDesigner = function (props) {
38
40
  if (!designable) {
39
41
  return null;
40
42
  }
41
- var templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template === null || template === void 0 ? void 0 : template.componentName) ? (template === null || template === void 0 ? void 0 : template.name) + " " + t('(Fields only)') : template === null || template === void 0 ? void 0 : template.name;
42
- return (_jsxs("div", __assign({ className: 'general-schema-designer' }, { children: [title && (_jsx("div", __assign({ className: classNames('general-schema-designer-title', titleCss) }, { children: _jsxs(Space, __assign({ size: 2 }, { children: [_jsx("span", __assign({ className: 'title-tag' }, { children: compile(title) }), void 0), template && _jsxs("span", __assign({ className: 'title-tag' }, { children: [t('Reference template'), ": ", templateName || t('Untitled')] }), void 0)] }), void 0) }), void 0)), _jsx("div", __assign({ className: 'general-schema-designer-icons' }, { children: _jsxs(Space, __assign({ size: 2, align: 'center' }, { children: [draggable && (_jsx(DragHandler, { children: _jsx(DragOutlined, {}, void 0) }, void 0)), _jsx(SchemaSettings, __assign({ title: _jsx(MenuOutlined, { style: { cursor: 'pointer', fontSize: 12 } }, void 0) }, schemaSettingsProps, { children: props.children }), void 0)] }), void 0) }), void 0)] }), void 0));
43
+ var rowCtx = useGridRowContext();
44
+ var ctx = useGridContext();
45
+ var templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template === null || template === void 0 ? void 0 : template.componentName)
46
+ ? (template === null || template === void 0 ? void 0 : template.name) + " " + t('(Fields only)')
47
+ : template === null || template === void 0 ? void 0 : template.name;
48
+ return (_jsxs("div", __assign({ className: 'general-schema-designer' }, { children: [title && (_jsx("div", __assign({ className: classNames('general-schema-designer-title', titleCss) }, { children: _jsxs(Space, __assign({ size: 2 }, { children: [_jsx("span", __assign({ className: 'title-tag' }, { children: compile(title) }), void 0), template && (_jsxs("span", __assign({ className: 'title-tag' }, { children: [t('Reference template'), ": ", templateName || t('Untitled')] }), void 0))] }), void 0) }), void 0)), _jsx("div", __assign({ className: 'general-schema-designer-icons' }, { children: _jsxs(Space, __assign({ size: 2, align: 'center' }, { children: [draggable && (_jsx(DragHandler, { children: _jsx(DragOutlined, {}, void 0) }, void 0)), !disableInitializer &&
49
+ ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.renderSchemaInitializer) === null || _a === void 0 ? void 0 : _a.call(ctx, {
50
+ insertPosition: 'afterEnd',
51
+ wrap: ((_b = rowCtx === null || rowCtx === void 0 ? void 0 : rowCtx.cols) === null || _b === void 0 ? void 0 : _b.length) > 1 ? undefined : gridRowColWrap,
52
+ component: _jsx(PlusOutlined, { style: { cursor: 'pointer', fontSize: 12 } }, void 0),
53
+ })), _jsx(SchemaSettings, __assign({ title: _jsx(MenuOutlined, { style: { cursor: 'pointer', fontSize: 12 } }, void 0) }, schemaSettingsProps, { children: props.children }), void 0)] }), void 0) }), void 0)] }), void 0));
43
54
  };
44
55
  var templateObject_1;
45
56
  //# sourceMappingURL=GeneralSchemaDesigner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GeneralSchemaDesigner.js","sourceRoot":"","sources":["../../src/schema-settings/GeneralSchemaDesigner.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,IAAM,QAAQ,GAAG,GAAG,ycAAA,sYAoBnB,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAC,KAAU;IACtC,IAAA,KAAK,GAAiC,KAAK,MAAtC,EAAE,QAAQ,GAAuB,KAAK,SAA5B,EAAE,KAAqB,KAAK,UAAV,EAAhB,SAAS,mBAAG,IAAI,KAAA,CAAW;IAC9C,IAAA,KAAqB,aAAa,EAAE,EAAlC,EAAE,QAAA,EAAE,UAAU,gBAAoB,CAAC;IAC3C,IAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACjB,IAAA,CAAC,GAAK,c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E,EAAE,WAAI,IAAM,mBAAmB,cACzG,KAAK,CAAC,QAAQ,YACA,aACX,YACJ,aACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { DragOutlined, MenuOutlined } from '@ant-design/icons';\nimport { css } from '@emotion/css';\nimport { useField, useFieldSchema } from '@formily/react';\nimport { Space } from 'antd';\nimport classNames from 'classnames';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { DragHandler, useCompile, useDesignable } from '../schema-component';\nimport { SchemaSettings } from './SchemaSettings';\n\nconst titleCss = css`\n pointer-events: none;\n position: absolute;\n font-size: 12px;\n /* background: #f18b62;\n color: #fff; */\n padding: 0;\n line-height: 16px;\n height: 16px;\n border-bottom-right-radius: 2px;\n border-radius: 2px;\n top: 2px;\n left: 2px;\n .title-tag {\n padding: 0 3px;\n border-radius: 2px;\n background: #f18b62;\n color: #fff;\n display: block;\n }\n`;\n\nexport const GeneralSchemaDesigner = (props: any) => {\n const { title, template, draggable = true } = props;\n const { dn, designable } = useDesignable();\n const field = useField();\n const { t } = useTranslation();\n const fieldSchema = useFieldSchema();\n const compile = useCompile();\n const schemaSettingsProps = {\n dn,\n field,\n fieldSchema,\n };\n if (!designable) {\n return null;\n }\n const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName) ? `${template?.name} ${t('(Fields only)')}` : template?.name;\n return (\n <div className={'general-schema-designer'}>\n {title && (\n <div className={classNames('general-schema-designer-title', titleCss)}>\n <Space size={2}>\n <span className={'title-tag'}>{compile(title)}</span>\n {template && <span className={'title-tag'}>{t('Reference template')}: {templateName || t('Untitled')}</span>}\n </Space>\n </div>\n )}\n <div className={'general-schema-designer-icons'}>\n <Space size={2} align={'center'}>\n {draggable && (\n <DragHandler>\n <DragOutlined />\n </DragHandler>\n )}\n <SchemaSettings title={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />} {...schemaSettingsProps}>\n {props.children}\n </SchemaSettings>\n </Space>\n </div>\n </div>\n );\n};\n"]}
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M,uBAAN,MAAM,CAAE,IAAI,0CAAE,MAAM,IAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc;gCAC3D,SAAS,EAAE,KAAC,YAAY,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAI;6BACxE,CAAC,CAAA,EACJ,KAAC,cAAc,aAAC,KAAK,EAAE,KAAC,YAAY,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAI,IAAM,mBAAmB,cACzG,KAAK,CAAC,QAAQ,YACA,aACX,YACJ,aACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { DragOutlined, MenuOutlined, PlusOutlined } from '@ant-design/icons';\nimport { css } from '@emotion/css';\nimport { useField, useFieldSchema } from '@formily/react';\nimport { Space } from 'antd';\nimport classNames from 'classnames';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { DragHandler, useCompile, useDesignable, useGridContext, useGridRowContext } from '../schema-component';\nimport { gridRowColWrap } from '../schema-initializer/utils';\nimport { SchemaSettings } from './SchemaSettings';\n\nconst titleCss = css`\n pointer-events: none;\n position: absolute;\n font-size: 12px;\n /* background: #f18b62;\n color: #fff; */\n padding: 0;\n line-height: 16px;\n height: 16px;\n border-bottom-right-radius: 2px;\n border-radius: 2px;\n top: 2px;\n left: 2px;\n .title-tag {\n padding: 0 3px;\n border-radius: 2px;\n background: #f18b62;\n color: #fff;\n display: block;\n }\n`;\n\nexport const GeneralSchemaDesigner = (props: any) => {\n const { disableInitializer, title, template, draggable = true } = props;\n const { dn, designable } = useDesignable();\n const field = useField();\n const { t } = useTranslation();\n const fieldSchema = useFieldSchema();\n const compile = useCompile();\n const schemaSettingsProps = {\n dn,\n field,\n fieldSchema,\n };\n if (!designable) {\n return null;\n }\n const rowCtx = useGridRowContext();\n const ctx = useGridContext();\n const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName)\n ? `${template?.name} ${t('(Fields only)')}`\n : template?.name;\n return (\n <div className={'general-schema-designer'}>\n {title && (\n <div className={classNames('general-schema-designer-title', titleCss)}>\n <Space size={2}>\n <span className={'title-tag'}>{compile(title)}</span>\n {template && (\n <span className={'title-tag'}>\n {t('Reference template')}: {templateName || t('Untitled')}\n </span>\n )}\n </Space>\n </div>\n )}\n <div className={'general-schema-designer-icons'}>\n <Space size={2} align={'center'}>\n {draggable && (\n <DragHandler>\n <DragOutlined />\n </DragHandler>\n )}\n {!disableInitializer &&\n ctx?.renderSchemaInitializer?.({\n insertPosition: 'afterEnd',\n wrap: rowCtx?.cols?.length > 1 ? undefined : gridRowColWrap,\n component: <PlusOutlined style={{ cursor: 'pointer', fontSize: 12 }} />,\n })}\n <SchemaSettings title={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />} {...schemaSettingsProps}>\n {props.children}\n </SchemaSettings>\n </Space>\n </div>\n </div>\n );\n};\n"]}
@@ -1,5 +1,62 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
1
37
  var _a, _b, _c;
2
38
  import { uid } from '@formily/shared';
39
+ import { useUpdateActionProps } from '../../block-provider/hooks';
40
+ import { useSchemaTemplateManager } from '../SchemaTemplateManagerProvider';
41
+ var useUpdateSchemaTemplateActionProps = function () {
42
+ var props = useUpdateActionProps();
43
+ var refresh = useSchemaTemplateManager().refresh;
44
+ return {
45
+ onClick: function () {
46
+ return __awaiter(this, void 0, void 0, function () {
47
+ return __generator(this, function (_a) {
48
+ switch (_a.label) {
49
+ case 0: return [4 /*yield*/, props.onClick()];
50
+ case 1:
51
+ _a.sent();
52
+ refresh();
53
+ return [2 /*return*/];
54
+ }
55
+ });
56
+ });
57
+ }
58
+ };
59
+ };
3
60
  export var uiSchemaTemplatesSchema = {
4
61
  type: 'object',
5
62
  properties: (_a = {},
@@ -70,14 +127,14 @@ export var uiSchemaTemplatesSchema = {
70
127
  split: '|',
71
128
  },
72
129
  properties: {
73
- view: {
74
- title: '{{ t("View") }}',
75
- 'x-action': 'view',
76
- 'x-component': 'RecordLink',
77
- 'x-component-props': {
78
- to: '/admin/plugins/block-templates/${record.key}',
79
- },
80
- },
130
+ // view: {
131
+ // title: '{{ t("View") }}',
132
+ // 'x-action': 'view',
133
+ // 'x-component': 'RecordLink',
134
+ // 'x-component-props': {
135
+ // to: '/admin/plugins/block-templates/${record.key}',
136
+ // },
137
+ // },
81
138
  edit: {
82
139
  type: 'void',
83
140
  title: '{{ t("Edit") }}',
@@ -132,13 +189,13 @@ export var uiSchemaTemplatesSchema = {
132
189
  },
133
190
  properties: {
134
191
  submit: {
135
- title: 'Submit',
192
+ title: '{{t("Submit")}}',
136
193
  'x-action': 'submit',
137
194
  'x-component': 'Action',
138
195
  'x-component-props': {
139
196
  type: 'primary',
140
197
  htmlType: 'submit',
141
- useProps: '{{ useUpdateActionProps }}',
198
+ useProps: useUpdateSchemaTemplateActionProps,
142
199
  },
143
200
  type: 'void',
144
201
  },
@@ -1 +1 @@
1
- {"version":3,"file":"uiSchemaTemplates.js","sourceRoot":"","sources":["../../../src/schema-templates/schemas/uiSchemaTemplates.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,CAAC,IAAM,uBAAuB,GAAY;IAC9C,IAAI,EAAE,QAAQ;IACd,UAAU;QACR,GAAC,GAAG,EAAE,IAAG;YACP,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,oBAAoB;YACnC,mBAAmB,EAAE;gBACnB,UAAU,EAAE,mBAAmB;gBAC/B,QAAQ,EAAE,mBAAmB;gBAC7B,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE;oBACN,QAAQ,EAAE,EAAE;oBACZ,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,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;SACF;WACF;CACF,CAAC","sourcesContent":["import { ISchema } from '@formily/react';\nimport { uid } from '@formily/shared';\n\nexport const uiSchemaTemplatesSchema: ISchema = {\n type: 'object',\n properties: {\n [uid()]: {\n type: 'void',\n 'x-decorator': 'TableBlockProvider',\n 'x-decorator-props': {\n collection: 'uiSchemaTemplates',\n resource: 'uiSchemaTemplates',\n action: 'list',\n params: {\n pageSize: 20,\n appends: ['collection'],\n sort: ['-createdAt'],\n },\n rowKey: 'key',\n showIndex: true,\n dragSort: false,\n },\n 'x-component': 'CardItem',\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 destroy: {\n title: '{{ t(\"Delete\") }}',\n 'x-action': 'destroy',\n 'x-component': 'Action',\n 'x-designer': 'Action.Designer',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useProps: '{{ useBulkDestroyActionProps }}',\n },\n },\n },\n },\n [uid()]: {\n type: 'array',\n 'x-component': 'TableV2',\n 'x-component-props': {\n rowSelection: {\n type: 'checkbox',\n },\n useProps: '{{ useTableBlockProps }}',\n },\n properties: {\n actions: {\n type: 'void',\n title: '{{ t(\"Actions\") }}',\n 'x-component': 'TableV2.Column',\n properties: {\n actions: {\n type: 'void',\n 'x-decorator': 'DndContext',\n 'x-component': 'Space',\n 'x-component-props': {\n split: '|',\n },\n properties: {\n view: {\n title: '{{ t(\"View\") }}',\n 'x-action': 'view',\n 'x-component': 'RecordLink',\n 'x-component-props': {\n to: '/admin/plugins/block-templates/${record.key}',\n },\n },\n edit: {\n type: 'void',\n title: '{{ t(\"Edit\") }}',\n 'x-action': 'update',\n 'x-component': 'Action.Link',\n 'x-component-props': {\n openMode: 'drawer',\n icon: 'EditOutlined',\n },\n properties: {\n drawer: {\n type: 'void',\n title: '{{ t(\"Edit record\") }}',\n 'x-component': 'Action.Container',\n 'x-component-props': {\n className: 'nb-action-popup',\n },\n properties: {\n form: {\n type: 'void',\n 'x-decorator': 'FormBlockProvider',\n 'x-decorator-props': {\n resource: 'uiSchemaTemplates',\n collection: 'uiSchemaTemplates',\n action: 'get',\n useParams: '{{ useParamsFromRecord }}',\n },\n 'x-component': 'CardItem',\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'FormV2',\n 'x-component-props': {\n useProps: '{{ useFormBlockProps }}',\n },\n properties: {\n name: {\n type: 'string',\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n 'x-collection-field': 'uiSchemaTemplates.name',\n required: true,\n },\n actions: {\n type: 'void',\n 'x-component': 'ActionBar',\n 'x-component-props': {\n layout: 'one-column',\n style: {\n marginTop: 24,\n },\n },\n properties: {\n submit: {\n title: 'Submit',\n 'x-action': 'submit',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n htmlType: 'submit',\n useProps: '{{ useUpdateActionProps }}',\n },\n type: 'void',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n destroy: {\n title: '{{ t(\"Delete\") }}',\n 'x-action': 'destroy',\n 'x-component': 'Action.Link',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useProps: '{{ useDestroyActionProps }}',\n },\n },\n },\n },\n },\n },\n column1: {\n type: 'void',\n 'x-decorator': 'TableV2.Column.Decorator',\n 'x-component': 'TableV2.Column',\n properties: {\n name: {\n type: 'string',\n 'x-collection-field': 'uiSchemaTemplates.name',\n 'x-component': 'CollectionField',\n 'x-read-pretty': true,\n 'x-component-props': {\n ellipsis: true,\n },\n },\n },\n },\n column2: {\n type: 'void',\n title: '{{t(\"Collection display name\")}}',\n 'x-decorator': 'TableV2.Column.Decorator',\n 'x-component': 'TableV2.Column',\n properties: {\n 'collection.title': {\n type: 'string',\n 'x-collection-field': 'uiSchemaTemplates.collection',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n 'x-component-props': {\n ellipsis: true,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n"]}
1
+ {"version":3,"file":"uiSchemaTemplates.js","sourceRoot":"","sources":["../../../src/schema-templates/schemas/uiSchemaTemplates.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,IAAM,kCAAkC,GAAG;IACzC,IAAM,KAAK,GAAG,oBAAoB,EAAE,CAAC;IAC7B,IAAA,OAAO,GAAK,wBAAwB,EAAE,QAA/B,CAAgC;IAC/C,OAAO;QACC,OAAO;;;;gCACX,qBAAM,KAAK,CAAC,OAAO,EAAE,EAAA;;4BAArB,SAAqB,CAAC;4BACtB,OAAO,EAAE,CAAC;;;;;SACX;KACF,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,uBAAuB,GAAY;IAC9C,IAAI,EAAE,QAAQ;IACd,UAAU;QACR,GAAC,GAAG,EAAE,IAAG;YACP,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,oBAAoB;YACnC,mBAAmB,EAAE;gBACnB,UAAU,EAAE,mBAAmB;gBAC/B,QAAQ,EAAE,mBAAmB;gBAC7B,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE;oBACN,QAAQ,EAAE,EAAE;oBACZ,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;gBACD,MAAM,EAAE,KAAK;gBACb,SAAS,EAAE,IAAI;gBACf,QAAQ,EAAE,KAAK;aAChB;YACD,aAAa,EAAE,UAAU;YACzB,UAAU;oBACR,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,aAAa,EA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6CACF;yCACF;wCACD,OAAO,EAAE;4CACP,KAAK,EAAE,mBAAmB;4CAC1B,UAAU,EAAE,SAAS;4CACrB,aAAa,EAAE,aAAa;4CAC5B,mBAAmB,EAAE;gDACnB,IAAI,EAAE,gBAAgB;gDACtB,OAAO,EAAE;oDACP,KAAK,EAAE,wBAAwB;oDAC/B,OAAO,EAAE,8CAA8C;iDACxD;gDACD,QAAQ,EAAE,6BAA6B;6CACxC;yCACF;qCACF;iCACF;6BACF;yBACF;wBACD,OAAO,EAAE;4BACP,IAAI,EAAE,MAAM;4BACZ,aAAa,EAAE,0BAA0B;4BACzC,aAAa,EAAE,gBAAgB;4BAC/B,UAAU,EAAE;gCACV,IAAI,EAAE;oCACJ,IAAI,EAAE,QAAQ;oCACd,oBAAoB,EAAE,wBAAwB;oCAC9C,aAAa,EAAE,iBAAiB;oCAChC,eAAe,EAAE,IAAI;oCACrB,mBAAmB,EAAE;wCACnB,QAAQ,EAAE,IAAI;qCACf;iCACF;6BACF;yBACF;wBACD,OAAO,EAAE;4BACP,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,kCAAkC;4BACzC,aAAa,EAAE,0BAA0B;4BACzC,aAAa,EAAE,gBAAgB;4BAC/B,UAAU,EAAE;gCACV,kBAAkB,EAAE;oCAClB,IAAI,EAAE,QAAQ;oCACd,oBAAoB,EAAE,8BAA8B;oCACpD,aAAa,EAAE,OAAO;oCACtB,eAAe,EAAE,IAAI;oCACrB,mBAAmB,EAAE;wCACnB,QAAQ,EAAE,IAAI;qCACf;iCACF;6BACF;yBACF;qBACF;iBACF;mBACF;SACF;WACF;CACF,CAAC","sourcesContent":["import { ISchema } from '@formily/react';\nimport { uid } from '@formily/shared';\nimport { useUpdateActionProps } from '../../block-provider/hooks';\nimport { useSchemaTemplateManager } from '../SchemaTemplateManagerProvider';\n\nconst useUpdateSchemaTemplateActionProps = () => {\n const props = useUpdateActionProps();\n const { refresh } = useSchemaTemplateManager();\n return {\n async onClick() {\n await props.onClick();\n refresh();\n }\n }\n}\n\nexport const uiSchemaTemplatesSchema: ISchema = {\n type: 'object',\n properties: {\n [uid()]: {\n type: 'void',\n 'x-decorator': 'TableBlockProvider',\n 'x-decorator-props': {\n collection: 'uiSchemaTemplates',\n resource: 'uiSchemaTemplates',\n action: 'list',\n params: {\n pageSize: 20,\n appends: ['collection'],\n sort: ['-createdAt'],\n },\n rowKey: 'key',\n showIndex: true,\n dragSort: false,\n },\n 'x-component': 'CardItem',\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 destroy: {\n title: '{{ t(\"Delete\") }}',\n 'x-action': 'destroy',\n 'x-component': 'Action',\n 'x-designer': 'Action.Designer',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useProps: '{{ useBulkDestroyActionProps }}',\n },\n },\n },\n },\n [uid()]: {\n type: 'array',\n 'x-component': 'TableV2',\n 'x-component-props': {\n rowSelection: {\n type: 'checkbox',\n },\n useProps: '{{ useTableBlockProps }}',\n },\n properties: {\n actions: {\n type: 'void',\n title: '{{ t(\"Actions\") }}',\n 'x-component': 'TableV2.Column',\n properties: {\n actions: {\n type: 'void',\n 'x-decorator': 'DndContext',\n 'x-component': 'Space',\n 'x-component-props': {\n split: '|',\n },\n properties: {\n // view: {\n // title: '{{ t(\"View\") }}',\n // 'x-action': 'view',\n // 'x-component': 'RecordLink',\n // 'x-component-props': {\n // to: '/admin/plugins/block-templates/${record.key}',\n // },\n // },\n edit: {\n type: 'void',\n title: '{{ t(\"Edit\") }}',\n 'x-action': 'update',\n 'x-component': 'Action.Link',\n 'x-component-props': {\n openMode: 'drawer',\n icon: 'EditOutlined',\n },\n properties: {\n drawer: {\n type: 'void',\n title: '{{ t(\"Edit record\") }}',\n 'x-component': 'Action.Container',\n 'x-component-props': {\n className: 'nb-action-popup',\n },\n properties: {\n form: {\n type: 'void',\n 'x-decorator': 'FormBlockProvider',\n 'x-decorator-props': {\n resource: 'uiSchemaTemplates',\n collection: 'uiSchemaTemplates',\n action: 'get',\n useParams: '{{ useParamsFromRecord }}',\n },\n 'x-component': 'CardItem',\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'FormV2',\n 'x-component-props': {\n useProps: '{{ useFormBlockProps }}',\n },\n properties: {\n name: {\n type: 'string',\n 'x-component': 'CollectionField',\n 'x-decorator': 'FormItem',\n 'x-collection-field': 'uiSchemaTemplates.name',\n required: true,\n },\n actions: {\n type: 'void',\n 'x-component': 'ActionBar',\n 'x-component-props': {\n layout: 'one-column',\n style: {\n marginTop: 24,\n },\n },\n properties: {\n submit: {\n title: '{{t(\"Submit\")}}',\n 'x-action': 'submit',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n htmlType: 'submit',\n useProps: useUpdateSchemaTemplateActionProps,\n },\n type: 'void',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n destroy: {\n title: '{{ t(\"Delete\") }}',\n 'x-action': 'destroy',\n 'x-component': 'Action.Link',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: \"{{t('Delete record')}}\",\n content: \"{{t('Are you sure you want to delete it?')}}\",\n },\n useProps: '{{ useDestroyActionProps }}',\n },\n },\n },\n },\n },\n },\n column1: {\n type: 'void',\n 'x-decorator': 'TableV2.Column.Decorator',\n 'x-component': 'TableV2.Column',\n properties: {\n name: {\n type: 'string',\n 'x-collection-field': 'uiSchemaTemplates.name',\n 'x-component': 'CollectionField',\n 'x-read-pretty': true,\n 'x-component-props': {\n ellipsis: true,\n },\n },\n },\n },\n column2: {\n type: 'void',\n title: '{{t(\"Collection display name\")}}',\n 'x-decorator': 'TableV2.Column.Decorator',\n 'x-component': 'TableV2.Column',\n properties: {\n 'collection.title': {\n type: 'string',\n 'x-collection-field': 'uiSchemaTemplates.collection',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n 'x-component-props': {\n ellipsis: true,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n"]}
@@ -88,10 +88,10 @@ import React, { useContext } from 'react';
88
88
  import { Dropdown, Menu, Button } from 'antd';
89
89
  import { PlusOutlined } from '@ant-design/icons';
90
90
  import { cx } from '@emotion/css';
91
- import { addButtonClass, branchBlockClass, branchClass, nodeCardClass } from './style';
91
+ import { useTranslation } from 'react-i18next';
92
92
  import { useCollection, useCompile, useResourceActionContext } from '..';
93
93
  import { instructions, Node } from './nodes';
94
- import { useTranslation } from 'react-i18next';
94
+ import { addButtonClass, branchBlockClass, branchClass, nodeCardClass } from './style';
95
95
  function makeNodes(nodes) {
96
96
  var e_1, _a;
97
97
  var nodesMap = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowCanvas.js","sourceRoot":"","sources":["../../src/workflow/WorkflowCanvas.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAkB,aAAa,EAAmC,MAAM,SAAS,CAAC;AAExI,OAAO,EACL,aAAa,EACb,UAAU,EACV,wBAAwB,EACzB,MAAM,IAAI,CAAC;AACZ,OAAO,EAAe,YAAY,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C,SAAS,SAAS,CAAC,KAAK;;IACtB,IAAM,QAAQ,GAAG,IAAI,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AAC,KAXiB,KAAK,CAAC,KAAK,CAYf,CAClB,EAdoB,CAcpB,CAAC,YACG,gBAEP,KAAC,MAAM,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAC,YAAY,aAAG,WAAI,YACxC,YACP,CACP,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import React, { useContext } from 'react';\nimport { Dropdown, Menu, Button } from 'antd';\nimport { PlusOutlined } from '@ant-design/icons';\nimport { cx } from '@emotion/css';\nimport { addButtonClass, branchBlockClass, branchClass, nodeBlockClass, nodeCardClass, nodeHeaderClass, nodeTitleClass } from './style';\n\nimport {\n useCollection,\n useCompile,\n useResourceActionContext\n} from '..';\nimport { Instruction, instructions, Node } from './nodes';\nimport { t } from 'i18next';\nimport { useTranslation } from 'react-i18next';\n\n\n\n\nfunction makeNodes(nodes): void {\n const nodesMap = new Map();\n nodes.forEach(item => nodesMap.set(item.id, item));\n for (let node of nodesMap.values()) {\n if (node.upstreamId) {\n node.upstream = nodesMap.get(node.upstreamId);\n }\n\n if (node.downstreamId) {\n node.downstream = nodesMap.get(node.downstreamId);\n }\n }\n}\n\nconst FlowContext = React.createContext(null);\n\nexport function useFlowContext() {\n return useContext(FlowContext);\n}\n\nexport function WorkflowCanvas() {\n const { t } = useTranslation();\n const { data, refresh, loading } = useResourceActionContext();\n\n if (!data?.data && !loading) {\n return <div>{t('Load failed')}</div>;\n }\n\n const { nodes = [], ...workflow } = data?.data ?? {};\n\n makeNodes(nodes);\n\n const entry = nodes.find(item => !item.upstream);\n\n return (\n <FlowContext.Provider value={{\n workflow,\n nodes,\n onNodeAdded: refresh,\n onNodeRemoved: refresh\n }}>\n <div className={branchBlockClass}>\n <Branch entry={entry} />\n </div>\n <div className={cx(nodeCardClass)}>{t('End')}</div>\n </FlowContext.Provider>\n );\n}\n\nexport function Branch({\n from = null,\n entry = null,\n branchIndex = null,\n controller = null\n}) {\n const list = [];\n for (let node = entry; node; node = node.downstream) {\n list.push(node);\n }\n\n return (\n <div className={cx(branchClass)}>\n <div className=\"workflow-branch-lines\" />\n {controller}\n <AddButton upstream={from} branchIndex={branchIndex} />\n <div className=\"workflow-node-list\">\n {list.map(item => <Node data={item} key={item.id} />)}\n </div>\n </div>\n );\n}\n\n// TODO(bug): useless observable\n// const instructionsList = observable(Array.from(instructions.getValues()));\n\ninterface AddButtonProps {\n upstream;\n branchIndex?: number;\n};\n\nexport function AddButton({ upstream, branchIndex = null }: AddButtonProps) {\n const compile = useCompile();\n const { resource } = useCollection();\n const { data } = useResourceActionContext();\n const { onNodeAdded } = useFlowContext();\n\n async function onCreate({ keyPath }) {\n const type = keyPath.pop();\n const config = {};\n const [optionKey] = keyPath;\n if (optionKey) {\n const { value } = instructions.get(type).options.find(item => item.key === optionKey);\n Object.assign(config, value);\n }\n\n const { data: { data: node } } = await resource.create({\n values: {\n type,\n workflowId: data.data.id,\n upstreamId: upstream?.id ?? null,\n branchIndex,\n config\n }\n });\n\n onNodeAdded(node);\n }\n\n const groups = [\n { value: 'control', name: '{{t(\"Control\")}}' },\n { value: 'collection', name: '{{t(\"Collection operations\")}}' },\n ];\n const instructionList = (Array.from(instructions.getValues()) as Instruction[]);\n\n return (\n <div className={cx(addButtonClass)}>\n <Dropdown trigger={['click']} overlay={\n <Menu onClick={ev => onCreate(ev)}>\n {groups.map(group => (\n <Menu.ItemGroup key={group.value} title={compile(group.name)}>\n {instructionList.filter(item => item.group === group.value).map(item => item.options\n ? (\n <Menu.SubMenu key={item.type} title={compile(item.title)}>\n {item.options.map(option => (\n <Menu.Item key={option.key}>{compile(option.label)}</Menu.Item>\n ))}\n </Menu.SubMenu>\n )\n : (\n <Menu.Item key={item.type}>{compile(item.title)}</Menu.Item>\n ))}\n </Menu.ItemGroup>\n ))}\n </Menu>\n }>\n <Button shape=\"circle\" icon={<PlusOutlined />} />\n </Dropdown>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"WorkflowCanvas.js","sourceRoot":"","sources":["../../src/workflow/WorkflowCanvas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AC,KAAK,CAAC,IAAI,CAAC,gBACzD,eAAe,CAAC,MAAM,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAA1B,CAA0B,CAAC,CAAC,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,OAAO;wBACpF,CAAC,CAAC,CACA,KAAC,IAAI,CAAC,OAAO,aAAiB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,gBACrD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAA,MAAM,IAAI,OAAA,CAC1B,KAAC,IAAI,CAAC,IAAI,cAAmB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAlC,MAAM,CAAC,GAAG,CAAqC,CAChE,EAF2B,CAE3B,CAAC,KAHe,IAAI,CAAC,IAAI,CAIb,CAChB;wBACD,CAAC,CAAC,CACA,KAAC,IAAI,CAAC,IAAI,cAAkB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAA/B,IAAI,CAAC,IAAI,CAAmC,CAC7D,EAVuE,CAUvE,CAAC,KAXiB,KAAK,CAAC,KAAK,CAYf,CAClB,EAdoB,CAcpB,CAAC,YACG,gBAEP,KAAC,MAAM,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAC,YAAY,aAAG,WAAI,YACxC,YACP,CACP,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import React, { useContext } from 'react';\nimport { Dropdown, Menu, Button } from 'antd';\nimport { PlusOutlined } from '@ant-design/icons';\nimport { cx } from '@emotion/css';\nimport { useTranslation } from 'react-i18next';\n\nimport {\n useCollection,\n useCompile,\n useResourceActionContext\n} from '..';\nimport { Instruction, instructions, Node } from './nodes';\nimport { addButtonClass, branchBlockClass, branchClass, nodeBlockClass, nodeCardClass, nodeHeaderClass, nodeTitleClass } from './style';\n\n\n\n\nfunction makeNodes(nodes): void {\n const nodesMap = new Map();\n nodes.forEach(item => nodesMap.set(item.id, item));\n for (let node of nodesMap.values()) {\n if (node.upstreamId) {\n node.upstream = nodesMap.get(node.upstreamId);\n }\n\n if (node.downstreamId) {\n node.downstream = nodesMap.get(node.downstreamId);\n }\n }\n}\n\nconst FlowContext = React.createContext(null);\n\nexport function useFlowContext() {\n return useContext(FlowContext);\n}\n\nexport function WorkflowCanvas() {\n const { t } = useTranslation();\n const { data, refresh, loading } = useResourceActionContext();\n\n if (!data?.data && !loading) {\n return <div>{t('Load failed')}</div>;\n }\n\n const { nodes = [], ...workflow } = data?.data ?? {};\n\n makeNodes(nodes);\n\n const entry = nodes.find(item => !item.upstream);\n\n return (\n <FlowContext.Provider value={{\n workflow,\n nodes,\n onNodeAdded: refresh,\n onNodeRemoved: refresh\n }}>\n <div className={branchBlockClass}>\n <Branch entry={entry} />\n </div>\n <div className={cx(nodeCardClass)}>{t('End')}</div>\n </FlowContext.Provider>\n );\n}\n\nexport function Branch({\n from = null,\n entry = null,\n branchIndex = null,\n controller = null\n}) {\n const list = [];\n for (let node = entry; node; node = node.downstream) {\n list.push(node);\n }\n\n return (\n <div className={cx(branchClass)}>\n <div className=\"workflow-branch-lines\" />\n {controller}\n <AddButton upstream={from} branchIndex={branchIndex} />\n <div className=\"workflow-node-list\">\n {list.map(item => <Node data={item} key={item.id} />)}\n </div>\n </div>\n );\n}\n\n// TODO(bug): useless observable\n// const instructionsList = observable(Array.from(instructions.getValues()));\n\ninterface AddButtonProps {\n upstream;\n branchIndex?: number;\n};\n\nexport function AddButton({ upstream, branchIndex = null }: AddButtonProps) {\n const compile = useCompile();\n const { resource } = useCollection();\n const { data } = useResourceActionContext();\n const { onNodeAdded } = useFlowContext();\n\n async function onCreate({ keyPath }) {\n const type = keyPath.pop();\n const config = {};\n const [optionKey] = keyPath;\n if (optionKey) {\n const { value } = instructions.get(type).options.find(item => item.key === optionKey);\n Object.assign(config, value);\n }\n\n const { data: { data: node } } = await resource.create({\n values: {\n type,\n workflowId: data.data.id,\n upstreamId: upstream?.id ?? null,\n branchIndex,\n config\n }\n });\n\n onNodeAdded(node);\n }\n\n const groups = [\n { value: 'control', name: '{{t(\"Control\")}}' },\n { value: 'collection', name: '{{t(\"Collection operations\")}}' },\n ];\n const instructionList = (Array.from(instructions.getValues()) as Instruction[]);\n\n return (\n <div className={cx(addButtonClass)}>\n <Dropdown trigger={['click']} overlay={\n <Menu onClick={ev => onCreate(ev)}>\n {groups.map(group => (\n <Menu.ItemGroup key={group.value} title={compile(group.name)}>\n {instructionList.filter(item => item.group === group.value).map(item => item.options\n ? (\n <Menu.SubMenu key={item.type} title={compile(item.title)}>\n {item.options.map(option => (\n <Menu.Item key={option.key}>{compile(option.label)}</Menu.Item>\n ))}\n </Menu.SubMenu>\n )\n : (\n <Menu.Item key={item.type}>{compile(item.title)}</Menu.Item>\n ))}\n </Menu.ItemGroup>\n ))}\n </Menu>\n }>\n <Button shape=\"circle\" icon={<PlusOutlined />} />\n </Dropdown>\n </div>\n );\n};\n"]}
@@ -17,6 +17,6 @@ export var WorkflowLink = function () {
17
17
  var t = useTranslation().t;
18
18
  var id = useRecord().id;
19
19
  var setVisible = useActionContext().setVisible;
20
- return (_jsx(Link, __assign({ to: "/admin/plugins/workflows/" + id, onClick: function () { return setVisible(false); } }, { children: t('Configure workflow') }), void 0));
20
+ return (_jsx(Link, __assign({ to: "/admin/plugins/workflows/" + id, onClick: function () { return setVisible(false); } }, { children: t('Configure') }), void 0));
21
21
  };
22
22
  //# sourceMappingURL=WorkflowLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowLink.js","sourceRoot":"","sources":["../../src/workflow/WorkflowLink.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAGjD,MAAM,CAAC,IAAM,YAAY,GAAG;IAClB,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IACvB,IAAA,EAAE,GAAK,SAAS,EAAE,GAAhB,CAAiB;IACnB,IAAA,UAAU,GAAK,gBAAgB,EAAE,WAAvB,CAAwB;IAC1C,OAAO,CACL,KAAC,IAAI,aAAC,EAAE,EAAE,8BAA4B,EAAI,EAAE,OAAO,EAAE,cAAM,OAAA,UAAU,CAAC,KAAK,CAAC,EAAjB,CAAiB,gBAAG,CAAC,CAAC,oBAAoB,CAAC,YAAQ,CAC/G,CAAC;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Link } from 'react-router-dom';\nimport { useActionContext, useRecord } from '..';\n\n\nexport const WorkflowLink = () => {\n const { t } = useTranslation();\n const { id } = useRecord();\n const { setVisible } = useActionContext();\n return (\n <Link to={`/admin/plugins/workflows/${id}`} onClick={() => setVisible(false)}>{t('Configure workflow')}</Link>\n );\n}\n"]}
1
+ {"version":3,"file":"WorkflowLink.js","sourceRoot":"","sources":["../../src/workflow/WorkflowLink.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAGjD,MAAM,CAAC,IAAM,YAAY,GAAG;IAClB,IAAA,CAAC,GAAK,cAAc,EAAE,EAArB,CAAsB;IACvB,IAAA,EAAE,GAAK,SAAS,EAAE,GAAhB,CAAiB;IACnB,IAAA,UAAU,GAAK,gBAAgB,EAAE,WAAvB,CAAwB;IAC1C,OAAO,CACL,KAAC,IAAI,aAAC,EAAE,EAAE,8BAA4B,EAAI,EAAE,OAAO,EAAE,cAAM,OAAA,UAAU,CAAC,KAAK,CAAC,EAAjB,CAAiB,gBAAG,CAAC,CAAC,WAAW,CAAC,YAAQ,CACtG,CAAC;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Link } from 'react-router-dom';\nimport { useActionContext, useRecord } from '..';\n\n\nexport const WorkflowLink = () => {\n const { t } = useTranslation();\n const { id } = useRecord();\n const { setVisible } = useActionContext();\n return (\n <Link to={`/admin/plugins/workflows/${id}`} onClick={() => setVisible(false)}>{t('Configure')}</Link>\n );\n}\n"]}
@@ -144,7 +144,8 @@ var ConstantTypes = {
144
144
  value: 'boolean',
145
145
  component: function (_a) {
146
146
  var onChange = _a.onChange, type = _a.type, options = _a.options, value = _a.value;
147
- return (_jsxs(Select, __assign({ value: value, onChange: function (v) { return onChange({ value: v, type: type, options: options }); } }, { children: [_jsx(Select.Option, __assign({ value: true }, { children: "\u771F" }), void 0), _jsx(Select.Option, __assign({ value: false }, { children: "\u5047" }), void 0)] }), void 0));
147
+ var t = useTranslation().t;
148
+ return (_jsxs(Select, __assign({ value: value, onChange: function (v) { return onChange({ value: v, type: type, options: options }); } }, { children: [_jsx(Select.Option, __assign({ value: true }, { children: t('True') }), void 0), _jsx(Select.Option, __assign({ value: false }, { children: t('False') }), void 0)] }), void 0));
148
149
  },
149
150
  default: false
150
151
  },
@@ -287,12 +288,13 @@ export function Operand(_a) {
287
288
  var type = operand.type;
288
289
  var _c = Types[type] || {}, component = _c.component, appendTypeValue = _c.appendTypeValue;
289
290
  var VariableComponent = typeof component === 'function' ? component(operand) : NullRender;
291
+ console.log(Types);
290
292
  return (_jsxs("div", __assign({ className: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\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 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 "]))) }, { children: [_jsx(Cascader, { allowClear: false, value: __spreadArray([type], __read((appendTypeValue ? appendTypeValue(operand) : [])), false), options: Object.values(Types).map(function (item) {
291
293
  var options = typeof item.options === 'function' ? item.options() : item.options;
292
294
  return {
293
295
  label: compile(item.title),
294
296
  value: item.value,
295
- children: options,
297
+ children: compile(options),
296
298
  disabled: options && !options.length,
297
299
  isLeaf: !options
298
300
  };
@@ -310,9 +312,9 @@ export function Operand(_a) {
310
312
  }
311
313
  export function Calculation(_a) {
312
314
  var calculator = _a.calculator, _b = _a.operands, operands = _b === void 0 ? [] : _b, onChange = _a.onChange;
313
- var t = useTranslation().t;
315
+ var compile = useCompile();
314
316
  return (_jsx(VariableTypesContext.Provider, __assign({ value: VariableTypes }, { children: _jsxs("div", __assign({ className: css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select{\n width: auto;\n min-width: 6em;\n }\n "], ["\n display: flex;\n gap: .5em;\n align-items: center;\n\n .ant-select{\n width: auto;\n min-width: 6em;\n }\n "]))) }, { children: [_jsx(Operand, { value: operands[0], onChange: (function (v) { return onChange({ calculator: calculator, operands: [v, operands[1]] }); }) }, void 0), operands[0]
315
- ? (_jsxs(_Fragment, { children: [_jsx(Select, __assign({ value: calculator, onChange: function (v) { return onChange({ operands: operands, calculator: v }); } }, { children: calculators.map(function (group) { return (_jsx(Select.OptGroup, __assign({ label: t(group.title) }, { children: group.children.map(function (item) { return (_jsx(Select.Option, __assign({ value: t(item.value) }, { children: item.name }), item.value)); }) }), group.value)); }) }), void 0), _jsx(Operand, { value: operands[1], onChange: (function (v) { return onChange({ calculator: calculator, operands: [operands[0], v] }); }) }, void 0)] }, void 0))
317
+ ? (_jsxs(_Fragment, { children: [_jsx(Select, __assign({ value: calculator, onChange: function (v) { return onChange({ operands: operands, calculator: v }); } }, { children: calculators.map(function (group) { return (_jsx(Select.OptGroup, __assign({ label: compile(group.title) }, { children: group.children.map(function (item) { return (_jsx(Select.Option, __assign({ value: item.value }, { children: compile(item.name) }), item.value)); }) }), group.value)); }) }), void 0), _jsx(Operand, { value: operands[1], onChange: (function (v) { return onChange({ calculator: calculator, operands: [operands[0], v] }); }) }, void 0)] }, void 0))
316
318
  : null] }), void 0) }), void 0));
317
319
  }
318
320
  export function VariableComponent(_a) {
@@ -386,7 +388,7 @@ export var CollectionFieldset = observer(function (_a) {
386
388
  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));
387
389
  }) }), void 0) }, { children: _jsx(Button, __assign({ icon: _jsx(PlusOutlined, {}, void 0) }, { children: t('Add field') }), void 0) }), void 0))
388
390
  : null] }, void 0))
389
- : _jsx("p", { children: t('Select collection') }, void 0) }), void 0));
391
+ : _jsx("p", { children: t('Please select collection first') }, void 0) }), void 0));
390
392
  });
391
393
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
392
394
  //# sourceMappingURL=calculators.js.map