@nocobase/client 0.9.0-alpha.2 → 0.9.1-alpha.2

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 (327) hide show
  1. package/es/acl/ACLProvider.js +7 -8
  2. package/es/api-client/APIClient.js +6 -0
  3. package/es/block-provider/BlockProvider.js +9 -6
  4. package/es/block-provider/FormBlockProvider.js +18 -9
  5. package/es/block-provider/KanbanBlockProvider.js +1 -1
  6. package/es/block-provider/SharedFilterProvider.js +9 -1
  7. package/es/block-provider/TableBlockProvider.js +1 -1
  8. package/es/block-provider/TableSelectorProvider.js +2 -2
  9. package/es/block-provider/hooks/index.js +22 -7
  10. package/es/collection-manager/CollectionManagerProvider.d.ts +1 -0
  11. package/es/collection-manager/CollectionManagerProvider.js +71 -9
  12. package/es/collection-manager/CollectionManagerShortcut.js +36 -23
  13. package/es/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
  14. package/es/collection-manager/Configuration/AddCategoryAction.js +117 -0
  15. package/es/collection-manager/Configuration/AddCollectionAction.js +8 -3
  16. package/es/collection-manager/Configuration/AddFieldAction.js +1 -0
  17. package/es/collection-manager/Configuration/ConfigurationTable.js +33 -4
  18. package/es/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
  19. package/es/collection-manager/Configuration/ConfigurationTabs.js +381 -0
  20. package/es/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
  21. package/es/collection-manager/Configuration/EditCategoryAction.js +150 -0
  22. package/es/collection-manager/Configuration/EditCollectionAction.js +6 -2
  23. package/es/collection-manager/Configuration/OverridingCollectionField.js +17 -8
  24. package/es/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
  25. package/es/collection-manager/Configuration/components/CollectionCategory.js +13 -0
  26. package/es/collection-manager/Configuration/index.d.ts +3 -0
  27. package/es/collection-manager/Configuration/index.js +3 -0
  28. package/es/collection-manager/Configuration/schemas/collections.d.ts +3 -0
  29. package/es/collection-manager/Configuration/schemas/collections.js +309 -176
  30. package/es/collection-manager/Configuration/templates.d.ts +1 -0
  31. package/es/collection-manager/Configuration/templates.js +1 -1
  32. package/es/collection-manager/action-hooks.d.ts +4 -0
  33. package/es/collection-manager/action-hooks.js +26 -12
  34. package/es/collection-manager/context.d.ts +4 -0
  35. package/es/collection-manager/context.js +5 -1
  36. package/es/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  37. package/es/collection-manager/hooks/useCollectionManager.js +52 -7
  38. package/es/collection-manager/interfaces/m2m.js +2 -2
  39. package/es/collection-manager/interfaces/properties/index.d.ts +0 -56
  40. package/es/collection-manager/interfaces/properties/index.js +1 -2
  41. package/es/collection-manager/templates/calendar.js +1 -1
  42. package/es/collection-manager/templates/general.js +1 -1
  43. package/es/collection-manager/templates/properties/index.d.ts +12 -1
  44. package/es/collection-manager/templates/properties/index.js +11 -0
  45. package/es/i18n/i18n.js +3 -1
  46. package/es/locale/en_US.d.ts +23 -0
  47. package/es/locale/en_US.js +23 -0
  48. package/es/locale/ja_JP.d.ts +23 -0
  49. package/es/locale/ja_JP.js +24 -1
  50. package/es/locale/ru_RU.d.ts +1 -0
  51. package/es/locale/ru_RU.js +1 -0
  52. package/es/locale/zh_CN.d.ts +43 -4
  53. package/es/locale/zh_CN.js +44 -5
  54. package/es/route-switch/antd/admin-layout/index.js +13 -33
  55. package/es/schema-component/antd/action/Action.Designer.js +28 -15
  56. package/es/schema-component/antd/action/Action.js +28 -5
  57. package/es/schema-component/antd/action/utils.d.ts +1 -0
  58. package/es/schema-component/antd/action/utils.js +49 -0
  59. package/es/schema-component/antd/association-filter/AssociationFilter.js +4 -4
  60. package/es/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  61. package/es/schema-component/antd/association-select/useServiceOptions.js +47 -6
  62. package/es/schema-component/antd/calendar/Calendar.Designer.js +17 -36
  63. package/es/schema-component/antd/checkbox/Checkbox.js +9 -8
  64. package/es/schema-component/antd/date-picker/util.d.ts +1 -1
  65. package/es/schema-component/antd/date-picker/util.js +1 -1
  66. package/es/schema-component/antd/filter/DynamicComponent.js +3 -1
  67. package/es/schema-component/antd/filter/Filter.js +2 -1
  68. package/es/schema-component/antd/filter/FilterGroup.js +7 -4
  69. package/es/schema-component/antd/filter/FilterItem.js +3 -2
  70. package/es/schema-component/antd/filter/context.d.ts +1 -0
  71. package/es/schema-component/antd/filter/useValues.js +14 -11
  72. package/es/schema-component/antd/form/Form.js +11 -5
  73. package/es/schema-component/antd/form-item/FormItem.js +17 -8
  74. package/es/schema-component/antd/form-v2/Form.Designer.js +2 -0
  75. package/es/schema-component/antd/form-v2/Form.js +94 -7
  76. package/es/schema-component/antd/form-v2/utils.d.ts +5 -0
  77. package/es/schema-component/antd/form-v2/utils.js +161 -0
  78. package/es/schema-component/antd/g2plot/G2Plot.js +3 -1
  79. package/es/schema-component/antd/grid/Grid.js +10 -5
  80. package/es/schema-component/antd/icon-picker/IconPicker.js +1 -0
  81. package/es/schema-component/antd/index.d.ts +1 -0
  82. package/es/schema-component/antd/index.js +1 -0
  83. package/es/schema-component/antd/input/Input.d.ts +2 -1
  84. package/es/schema-component/antd/input/Json.d.ts +5 -3
  85. package/es/schema-component/antd/input/Json.js +3 -2
  86. package/es/schema-component/antd/input/ReadPretty.js +1 -1
  87. package/es/schema-component/antd/input-number/InputNumber.js +3 -1
  88. package/es/schema-component/antd/page/FixedBlock.js +3 -1
  89. package/es/schema-component/antd/page/Page.js +11 -5
  90. package/es/schema-component/antd/page/PageTabDesigner.js +3 -3
  91. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  92. package/es/schema-component/antd/record-picker/RecordPicker.js +1 -2
  93. package/es/schema-component/antd/record-picker/util.js +7 -0
  94. package/es/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
  95. package/es/schema-component/antd/remote-select/RemoteSelect.js +78 -36
  96. package/es/schema-component/antd/rich-text/RichText.js +4 -2
  97. package/es/schema-component/antd/select/Select.js +14 -4
  98. package/es/schema-component/antd/table/Table.Array.js +10 -3
  99. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  100. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  101. package/es/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  102. package/es/schema-component/antd/tabs/Tabs.js +1 -0
  103. package/es/schema-component/antd/time-picker/TimePicker.js +1 -1
  104. package/es/schema-component/antd/variable/Input.d.ts +2 -0
  105. package/es/schema-component/antd/variable/Input.js +244 -0
  106. package/es/schema-component/antd/variable/JSONInput.d.ts +2 -0
  107. package/es/schema-component/antd/variable/JSONInput.js +82 -0
  108. package/es/schema-component/antd/variable/TextArea.d.ts +2 -0
  109. package/es/schema-component/antd/variable/TextArea.js +322 -0
  110. package/es/schema-component/antd/variable/Variable.d.ts +8 -0
  111. package/es/schema-component/antd/variable/Variable.js +11 -0
  112. package/es/schema-component/antd/variable/index.d.ts +1 -0
  113. package/es/schema-component/antd/variable/index.js +1 -0
  114. package/es/schema-component/common/sortable-item/SortableItem.js +36 -6
  115. package/es/schema-component/common/utils/logic.js +523 -0
  116. package/es/schema-component/common/utils/uitls.d.ts +1 -0
  117. package/es/schema-component/common/utils/uitls.js +89 -0
  118. package/es/schema-initializer/SchemaInitializer.js +9 -4
  119. package/es/schema-initializer/buttons/BlockInitializers.d.ts +2 -184
  120. package/es/schema-initializer/buttons/BlockInitializers.js +1 -102
  121. package/es/schema-initializer/buttons/RecordBlockInitializers.js +72 -16
  122. package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  123. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
  124. package/es/schema-initializer/components/CreateRecordAction.d.ts +3 -0
  125. package/es/schema-initializer/components/CreateRecordAction.js +174 -0
  126. package/es/schema-initializer/components/index.d.ts +1 -0
  127. package/es/schema-initializer/components/index.js +2 -1
  128. package/es/schema-initializer/index.d.ts +2 -1
  129. package/es/schema-initializer/index.js +2 -1
  130. package/es/schema-initializer/items/CalendarBlockInitializer.js +24 -41
  131. package/es/schema-initializer/items/CreateActionInitializer.js +3 -3
  132. package/es/schema-initializer/items/RecordFormBlockInitializer.js +9 -9
  133. package/es/schema-initializer/items/index.d.ts +4 -4
  134. package/es/schema-initializer/items/index.js +6 -6
  135. package/es/schema-initializer/utils.js +22 -7
  136. package/es/schema-settings/EnableChildCollections/index.d.ts +2 -0
  137. package/es/schema-settings/EnableChildCollections/index.js +141 -0
  138. package/es/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  139. package/es/schema-settings/LinkageRules/DynamicComponent.js +113 -0
  140. package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  141. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +15 -0
  142. package/es/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  143. package/es/schema-settings/LinkageRules/LinkageRuleAction.js +162 -0
  144. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  145. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.js +71 -0
  146. package/es/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  147. package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +82 -0
  148. package/es/schema-settings/LinkageRules/Variables.d.ts +7 -0
  149. package/es/schema-settings/LinkageRules/Variables.js +115 -0
  150. package/es/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  151. package/es/schema-settings/LinkageRules/action-hooks.js +115 -0
  152. package/es/schema-settings/LinkageRules/context.d.ts +13 -0
  153. package/es/schema-settings/LinkageRules/context.js +4 -0
  154. package/es/schema-settings/LinkageRules/index.d.ts +2 -0
  155. package/es/schema-settings/LinkageRules/index.js +132 -0
  156. package/es/schema-settings/LinkageRules/type.d.ts +13 -0
  157. package/es/schema-settings/LinkageRules/type.js +15 -0
  158. package/es/schema-settings/LinkageRules/useValues.d.ts +1 -0
  159. package/es/schema-settings/LinkageRules/useValues.js +84 -0
  160. package/es/schema-settings/SchemaSettings.d.ts +4 -1
  161. package/es/schema-settings/SchemaSettings.js +219 -26
  162. package/es/schema-templates/BlockTemplate.js +9 -1
  163. package/es/system-settings/SystemSettingsShortcut.js +1 -1
  164. package/lib/acl/ACLProvider.js +7 -8
  165. package/lib/api-client/APIClient.js +6 -0
  166. package/lib/block-provider/BlockProvider.js +9 -6
  167. package/lib/block-provider/FormBlockProvider.js +17 -8
  168. package/lib/block-provider/KanbanBlockProvider.js +1 -1
  169. package/lib/block-provider/SharedFilterProvider.js +9 -3
  170. package/lib/block-provider/TableBlockProvider.js +1 -1
  171. package/lib/block-provider/TableSelectorProvider.js +2 -2
  172. package/lib/block-provider/hooks/index.js +23 -7
  173. package/lib/collection-manager/CollectionManagerProvider.d.ts +1 -0
  174. package/lib/collection-manager/CollectionManagerProvider.js +81 -16
  175. package/lib/collection-manager/CollectionManagerShortcut.js +36 -23
  176. package/lib/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
  177. package/lib/collection-manager/Configuration/AddCategoryAction.js +145 -0
  178. package/lib/collection-manager/Configuration/AddCollectionAction.js +8 -3
  179. package/lib/collection-manager/Configuration/AddFieldAction.js +1 -0
  180. package/lib/collection-manager/Configuration/ConfigurationTable.js +34 -4
  181. package/lib/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
  182. package/lib/collection-manager/Configuration/ConfigurationTabs.js +407 -0
  183. package/lib/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
  184. package/lib/collection-manager/Configuration/EditCategoryAction.js +178 -0
  185. package/lib/collection-manager/Configuration/EditCollectionAction.js +6 -2
  186. package/lib/collection-manager/Configuration/OverridingCollectionField.js +17 -8
  187. package/lib/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
  188. package/lib/collection-manager/Configuration/components/CollectionCategory.js +27 -0
  189. package/lib/collection-manager/Configuration/index.d.ts +3 -0
  190. package/lib/collection-manager/Configuration/index.js +39 -0
  191. package/lib/collection-manager/Configuration/schemas/collections.d.ts +3 -0
  192. package/lib/collection-manager/Configuration/schemas/collections.js +316 -178
  193. package/lib/collection-manager/Configuration/templates.d.ts +1 -0
  194. package/lib/collection-manager/Configuration/templates.js +2 -0
  195. package/lib/collection-manager/action-hooks.d.ts +4 -0
  196. package/lib/collection-manager/action-hooks.js +30 -13
  197. package/lib/collection-manager/context.d.ts +4 -0
  198. package/lib/collection-manager/context.js +7 -2
  199. package/lib/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  200. package/lib/collection-manager/hooks/useCollectionManager.js +52 -6
  201. package/lib/collection-manager/interfaces/m2m.js +2 -2
  202. package/lib/collection-manager/interfaces/properties/index.d.ts +0 -56
  203. package/lib/collection-manager/interfaces/properties/index.js +1 -2
  204. package/lib/collection-manager/templates/calendar.js +1 -1
  205. package/lib/collection-manager/templates/general.js +1 -1
  206. package/lib/collection-manager/templates/properties/index.d.ts +12 -1
  207. package/lib/collection-manager/templates/properties/index.js +11 -0
  208. package/lib/i18n/i18n.js +3 -1
  209. package/lib/locale/en_US.d.ts +23 -0
  210. package/lib/locale/en_US.js +23 -0
  211. package/lib/locale/ja_JP.d.ts +23 -0
  212. package/lib/locale/ja_JP.js +24 -1
  213. package/lib/locale/ru_RU.d.ts +1 -0
  214. package/lib/locale/ru_RU.js +1 -0
  215. package/lib/locale/zh_CN.d.ts +43 -4
  216. package/lib/locale/zh_CN.js +44 -5
  217. package/lib/route-switch/antd/admin-layout/index.js +13 -33
  218. package/lib/schema-component/antd/action/Action.Designer.js +30 -14
  219. package/lib/schema-component/antd/action/Action.js +29 -3
  220. package/lib/schema-component/antd/action/utils.d.ts +1 -0
  221. package/lib/schema-component/antd/action/utils.js +58 -2
  222. package/lib/schema-component/antd/association-filter/AssociationFilter.js +3 -3
  223. package/lib/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  224. package/lib/schema-component/antd/association-select/useServiceOptions.js +47 -4
  225. package/lib/schema-component/antd/calendar/Calendar.Designer.js +15 -33
  226. package/lib/schema-component/antd/checkbox/Checkbox.js +8 -7
  227. package/lib/schema-component/antd/date-picker/util.d.ts +1 -1
  228. package/lib/schema-component/antd/date-picker/util.js +1 -1
  229. package/lib/schema-component/antd/filter/DynamicComponent.js +3 -1
  230. package/lib/schema-component/antd/filter/Filter.js +2 -1
  231. package/lib/schema-component/antd/filter/FilterGroup.js +7 -4
  232. package/lib/schema-component/antd/filter/FilterItem.js +3 -2
  233. package/lib/schema-component/antd/filter/context.d.ts +1 -0
  234. package/lib/schema-component/antd/filter/useValues.js +15 -11
  235. package/lib/schema-component/antd/form/Form.js +9 -3
  236. package/lib/schema-component/antd/form-item/FormItem.js +21 -7
  237. package/lib/schema-component/antd/form-v2/Form.Designer.js +2 -0
  238. package/lib/schema-component/antd/form-v2/Form.js +93 -5
  239. package/lib/schema-component/antd/form-v2/utils.d.ts +5 -0
  240. package/lib/schema-component/antd/form-v2/utils.js +181 -0
  241. package/lib/schema-component/antd/g2plot/G2Plot.js +3 -1
  242. package/lib/schema-component/antd/grid/Grid.js +10 -5
  243. package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -0
  244. package/lib/schema-component/antd/index.d.ts +1 -0
  245. package/lib/schema-component/antd/index.js +13 -0
  246. package/lib/schema-component/antd/input/Input.d.ts +2 -1
  247. package/lib/schema-component/antd/input/Json.d.ts +5 -3
  248. package/lib/schema-component/antd/input/Json.js +6 -3
  249. package/lib/schema-component/antd/input/ReadPretty.js +1 -1
  250. package/lib/schema-component/antd/input-number/InputNumber.js +2 -0
  251. package/lib/schema-component/antd/page/FixedBlock.js +3 -1
  252. package/lib/schema-component/antd/page/Page.js +14 -5
  253. package/lib/schema-component/antd/page/PageTabDesigner.js +1 -1
  254. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  255. package/lib/schema-component/antd/record-picker/RecordPicker.js +1 -2
  256. package/lib/schema-component/antd/record-picker/util.js +7 -0
  257. package/lib/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
  258. package/lib/schema-component/antd/remote-select/RemoteSelect.js +78 -37
  259. package/lib/schema-component/antd/rich-text/RichText.js +4 -2
  260. package/lib/schema-component/antd/select/Select.js +14 -4
  261. package/lib/schema-component/antd/table/Table.Array.js +8 -1
  262. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  263. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  264. package/lib/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  265. package/lib/schema-component/antd/tabs/Tabs.js +1 -0
  266. package/lib/schema-component/antd/time-picker/TimePicker.js +1 -1
  267. package/lib/schema-component/antd/variable/Input.d.ts +2 -0
  268. package/lib/schema-component/antd/variable/Input.js +262 -0
  269. package/lib/schema-component/antd/variable/JSONInput.d.ts +2 -0
  270. package/lib/schema-component/antd/variable/JSONInput.js +100 -0
  271. package/lib/schema-component/antd/variable/TextArea.d.ts +2 -0
  272. package/lib/schema-component/antd/variable/TextArea.js +341 -0
  273. package/lib/schema-component/antd/variable/Variable.d.ts +8 -0
  274. package/lib/schema-component/antd/variable/Variable.js +25 -0
  275. package/lib/schema-component/antd/variable/index.d.ts +1 -0
  276. package/lib/schema-component/antd/variable/index.js +18 -0
  277. package/lib/schema-component/common/sortable-item/SortableItem.js +36 -6
  278. package/lib/schema-component/common/utils/logic.js +525 -0
  279. package/lib/schema-component/common/utils/uitls.d.ts +1 -0
  280. package/lib/schema-component/common/utils/uitls.js +103 -0
  281. package/lib/schema-initializer/SchemaInitializer.js +9 -4
  282. package/lib/schema-initializer/buttons/BlockInitializers.d.ts +2 -184
  283. package/lib/schema-initializer/buttons/BlockInitializers.js +0 -108
  284. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +72 -16
  285. package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  286. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
  287. package/lib/schema-initializer/components/CreateRecordAction.d.ts +3 -0
  288. package/lib/schema-initializer/components/CreateRecordAction.js +199 -0
  289. package/lib/schema-initializer/components/index.d.ts +1 -0
  290. package/lib/schema-initializer/components/index.js +13 -0
  291. package/lib/schema-initializer/index.d.ts +2 -1
  292. package/lib/schema-initializer/index.js +51 -2
  293. package/lib/schema-initializer/items/CalendarBlockInitializer.js +16 -33
  294. package/lib/schema-initializer/items/CreateActionInitializer.js +3 -3
  295. package/lib/schema-initializer/items/RecordFormBlockInitializer.js +3 -3
  296. package/lib/schema-initializer/items/index.d.ts +4 -4
  297. package/lib/schema-initializer/items/index.js +52 -52
  298. package/lib/schema-initializer/utils.js +22 -6
  299. package/lib/schema-settings/EnableChildCollections/index.d.ts +2 -0
  300. package/lib/schema-settings/EnableChildCollections/index.js +156 -0
  301. package/lib/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  302. package/lib/schema-settings/LinkageRules/DynamicComponent.js +139 -0
  303. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  304. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +27 -0
  305. package/lib/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  306. package/lib/schema-settings/LinkageRules/LinkageRuleAction.js +190 -0
  307. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  308. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.js +90 -0
  309. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  310. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +104 -0
  311. package/lib/schema-settings/LinkageRules/Variables.d.ts +7 -0
  312. package/lib/schema-settings/LinkageRules/Variables.js +124 -0
  313. package/lib/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  314. package/lib/schema-settings/LinkageRules/action-hooks.js +127 -0
  315. package/lib/schema-settings/LinkageRules/context.d.ts +13 -0
  316. package/lib/schema-settings/LinkageRules/context.js +15 -0
  317. package/lib/schema-settings/LinkageRules/index.d.ts +2 -0
  318. package/lib/schema-settings/LinkageRules/index.js +149 -0
  319. package/lib/schema-settings/LinkageRules/type.d.ts +13 -0
  320. package/lib/schema-settings/LinkageRules/type.js +22 -0
  321. package/lib/schema-settings/LinkageRules/useValues.d.ts +1 -0
  322. package/lib/schema-settings/LinkageRules/useValues.js +95 -0
  323. package/lib/schema-settings/SchemaSettings.d.ts +4 -1
  324. package/lib/schema-settings/SchemaSettings.js +243 -48
  325. package/lib/schema-templates/BlockTemplate.js +9 -1
  326. package/lib/system-settings/SystemSettingsShortcut.js +1 -1
  327. package/package.json +4 -4
@@ -124,7 +124,7 @@ export declare const BlockInitializers: {
124
124
  };
125
125
  };
126
126
  };
127
- items: ({
127
+ items: {
128
128
  key: string;
129
129
  type: string;
130
130
  title: string;
@@ -134,187 +134,5 @@ export declare const BlockInitializers: {
134
134
  title: string;
135
135
  component: string;
136
136
  }[];
137
- } | {
138
- key: string;
139
- type: string;
140
- title: string;
141
- children: ({
142
- key: string;
143
- type: string;
144
- title: string;
145
- component: string;
146
- icon: string;
147
- schema: {
148
- type: string;
149
- 'x-designer': string;
150
- 'x-decorator': string;
151
- 'x-component': string;
152
- 'x-component-props': {
153
- plot: string;
154
- config: {
155
- data: {
156
- type: string;
157
- sales: number;
158
- }[];
159
- xField: string;
160
- yField: string;
161
- label: {
162
- position: string;
163
- style: {
164
- fill: string;
165
- opacity: number;
166
- };
167
- };
168
- xAxis: {
169
- label: {
170
- autoHide: boolean;
171
- autoRotate: boolean;
172
- };
173
- };
174
- meta: {
175
- type: {
176
- alias: string;
177
- };
178
- sales: {
179
- alias: string;
180
- };
181
- };
182
- };
183
- };
184
- };
185
- } | {
186
- key: string;
187
- type: string;
188
- title: string;
189
- component: string;
190
- icon: string;
191
- schema: {
192
- type: string;
193
- 'x-designer': string;
194
- 'x-decorator': string;
195
- 'x-component': string;
196
- 'x-component-props': {
197
- plot: string;
198
- config: {
199
- data: {
200
- year: string;
201
- value: number;
202
- }[];
203
- xField: string;
204
- yField: string;
205
- seriesField: string;
206
- legend: {
207
- position: string;
208
- };
209
- };
210
- };
211
- };
212
- } | {
213
- key: string;
214
- type: string;
215
- title: string;
216
- component: string;
217
- icon: string;
218
- schema: {
219
- type: string;
220
- 'x-designer': string;
221
- 'x-decorator': string;
222
- 'x-component': string;
223
- 'x-component-props': {
224
- plot: string;
225
- config: {
226
- data: {
227
- Date: string;
228
- scales: number;
229
- }[];
230
- padding: string;
231
- xField: string;
232
- yField: string;
233
- xAxis: {
234
- tickCount: number;
235
- };
236
- };
237
- };
238
- };
239
- } | {
240
- key: string;
241
- type: string;
242
- title: string;
243
- component: string;
244
- icon: string;
245
- schema: {
246
- type: string;
247
- 'x-designer': string;
248
- 'x-decorator': string;
249
- 'x-component': string;
250
- 'x-component-props': {
251
- plot: string;
252
- config: {
253
- appendPadding: number;
254
- data: {
255
- type: string;
256
- value: number;
257
- }[];
258
- angleField: string;
259
- colorField: string;
260
- radius: number;
261
- label: {
262
- type: string;
263
- offset: string;
264
- content: string;
265
- style: {
266
- fontSize: number;
267
- textAlign: string;
268
- };
269
- };
270
- interactions: {
271
- type: string;
272
- }[];
273
- };
274
- };
275
- };
276
- } | {
277
- key: string;
278
- type: string;
279
- title: string;
280
- component: string;
281
- icon: string;
282
- schema: {
283
- type: string;
284
- 'x-designer': string;
285
- 'x-decorator': string;
286
- 'x-component': string;
287
- 'x-component-props': {
288
- plot: string;
289
- config: {
290
- data: {
291
- timePeriod: string;
292
- value: number;
293
- }[];
294
- xField: string;
295
- yField: string;
296
- xAxis: {
297
- range: number[];
298
- };
299
- };
300
- };
301
- };
302
- } | {
303
- key: string;
304
- type: string;
305
- title: string;
306
- component: string;
307
- icon: string;
308
- schema: {
309
- type: string;
310
- 'x-designer': string;
311
- 'x-decorator': string;
312
- 'x-component': string;
313
- 'x-component-props': {
314
- plot?: undefined;
315
- config?: undefined;
316
- };
317
- };
318
- })[];
319
- })[];
137
+ }[];
320
138
  };
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -9,12 +7,6 @@ exports.BlockInitializers = void 0;
9
7
 
10
8
  var _utils = require("../utils");
11
9
 
12
- var chartConfig = _interopRequireWildcard(require("./chart-config"));
13
-
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
-
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
18
10
  // 页面里添加区块
19
11
  var BlockInitializers = {
20
12
  title: '{{t("Add block")}}',
@@ -50,106 +42,6 @@ var BlockInitializers = {
50
42
  title: '{{t("Kanban")}}',
51
43
  component: 'KanbanBlockInitializer'
52
44
  }]
53
- }, {
54
- key: 'g2plot',
55
- type: 'itemGroup',
56
- title: '{{t("Chart blocks")}}',
57
- children: [{
58
- key: 'column',
59
- type: 'item',
60
- title: '{{t("Column chart")}}',
61
- component: 'G2PlotInitializer',
62
- icon: 'BarChartOutlined',
63
- schema: {
64
- type: 'void',
65
- 'x-designer': 'G2Plot.Designer',
66
- 'x-decorator': 'CardItem',
67
- 'x-component': 'G2Plot',
68
- 'x-component-props': {
69
- plot: 'Column',
70
- config: chartConfig.column
71
- }
72
- }
73
- }, {
74
- key: 'bar',
75
- type: 'item',
76
- title: '{{t("Bar chart")}}',
77
- component: 'G2PlotInitializer',
78
- icon: 'BarChartOutlined',
79
- schema: {
80
- type: 'void',
81
- 'x-designer': 'G2Plot.Designer',
82
- 'x-decorator': 'CardItem',
83
- 'x-component': 'G2Plot',
84
- 'x-component-props': {
85
- plot: 'Bar',
86
- config: chartConfig.bar
87
- }
88
- }
89
- }, {
90
- key: 'line',
91
- type: 'item',
92
- title: '{{t("Line chart")}}',
93
- component: 'G2PlotInitializer',
94
- icon: 'LineChartOutlined',
95
- schema: {
96
- type: 'void',
97
- 'x-designer': 'G2Plot.Designer',
98
- 'x-decorator': 'CardItem',
99
- 'x-component': 'G2Plot',
100
- 'x-component-props': {
101
- plot: 'Line',
102
- config: chartConfig.line
103
- }
104
- }
105
- }, {
106
- key: 'pie',
107
- type: 'item',
108
- title: '{{t("Pie chart")}}',
109
- component: 'G2PlotInitializer',
110
- icon: 'PieChartOutlined',
111
- schema: {
112
- type: 'void',
113
- 'x-designer': 'G2Plot.Designer',
114
- 'x-decorator': 'CardItem',
115
- 'x-component': 'G2Plot',
116
- 'x-component-props': {
117
- plot: 'Pie',
118
- config: chartConfig.pie
119
- }
120
- }
121
- }, {
122
- key: 'area',
123
- type: 'item',
124
- title: '{{t("Area chart")}}',
125
- component: 'G2PlotInitializer',
126
- icon: 'AreaChartOutlined',
127
- schema: {
128
- type: 'void',
129
- 'x-designer': 'G2Plot.Designer',
130
- 'x-decorator': 'CardItem',
131
- 'x-component': 'G2Plot',
132
- 'x-component-props': {
133
- plot: 'Area',
134
- config: chartConfig.area
135
- }
136
- }
137
- }, {
138
- key: 'other',
139
- type: 'item',
140
- title: '{{t("Other chart")}}',
141
- component: 'G2PlotInitializer',
142
- icon: 'AreaChartOutlined',
143
- schema: {
144
- type: 'void',
145
- 'x-designer': 'G2Plot.Designer',
146
- 'x-decorator': 'CardItem',
147
- 'x-component': 'G2Plot',
148
- 'x-component-props': {// plot: 'Area',
149
- // config: {},
150
- }
151
- }
152
- }]
153
45
  }, {
154
46
  key: 'media',
155
47
  type: 'itemGroup',
@@ -17,6 +17,12 @@ var _utils = require("../utils");
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
+
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
+
24
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
+
20
26
  var recursiveParent = function recursiveParent(schema) {
21
27
  var _schema$xDecorator;
22
28
 
@@ -124,17 +130,21 @@ var useRelationFields = function useRelationFields() {
124
130
  return relationFields;
125
131
  };
126
132
 
127
- var useInheritFields = function useInheritFields(props) {
128
- var actionInitializers = props.actionInitializers;
129
- var collection = (0, _.useCollection)();
130
-
131
- var _useCollectionManager2 = (0, _.useCollectionManager)(),
132
- getChildrenCollections = _useCollectionManager2.getChildrenCollections;
133
-
134
- var childrenCollections = getChildrenCollections(collection.name);
135
- return childrenCollections.map(function (c) {
133
+ var useDetailCollections = function useDetailCollections(props) {
134
+ var actionInitializers = props.actionInitializers,
135
+ childrenCollections = props.childrenCollections,
136
+ collection = props.collection;
137
+ var detailCollections = [{
138
+ key: collection.name,
139
+ type: 'item',
140
+ title: (collection === null || collection === void 0 ? void 0 : collection.title) || collection.name,
141
+ component: 'RecordReadPrettyFormBlockInitializer',
142
+ icon: false,
143
+ targetCollection: collection,
144
+ actionInitializers: actionInitializers
145
+ }].concat(childrenCollections.map(function (c) {
136
146
  return {
137
- key: c.key,
147
+ key: c.name,
138
148
  type: 'item',
139
149
  title: (c === null || c === void 0 ? void 0 : c.title) || c.name,
140
150
  component: 'RecordReadPrettyFormBlockInitializer',
@@ -142,7 +152,34 @@ var useInheritFields = function useInheritFields(props) {
142
152
  targetCollection: c,
143
153
  actionInitializers: actionInitializers
144
154
  };
145
- });
155
+ }));
156
+ return detailCollections;
157
+ };
158
+
159
+ var useFormCollections = function useFormCollections(props) {
160
+ var actionInitializers = props.actionInitializers,
161
+ childrenCollections = props.childrenCollections,
162
+ collection = props.collection;
163
+ var formCollections = [{
164
+ key: collection.name,
165
+ type: 'item',
166
+ title: (collection === null || collection === void 0 ? void 0 : collection.title) || collection.name,
167
+ component: 'RecordFormBlockInitializer',
168
+ icon: false,
169
+ targetCollection: collection,
170
+ actionInitializers: actionInitializers
171
+ }].concat(childrenCollections.map(function (c) {
172
+ return {
173
+ key: c.name,
174
+ type: 'item',
175
+ title: (c === null || c === void 0 ? void 0 : c.title) || c.name,
176
+ component: 'RecordFormBlockInitializer',
177
+ icon: false,
178
+ targetCollection: c,
179
+ actionInitializers: actionInitializers
180
+ };
181
+ }));
182
+ return formCollections;
146
183
  };
147
184
 
148
185
  var RecordBlockInitializers = function RecordBlockInitializers(props) {
@@ -152,6 +189,13 @@ var RecordBlockInitializers = function RecordBlockInitializers(props) {
152
189
  var insertPosition = props.insertPosition,
153
190
  component = props.component,
154
191
  actionInitializers = props.actionInitializers;
192
+ var collection = (0, _.useCollection)();
193
+
194
+ var _useCollectionManager2 = (0, _.useCollectionManager)(),
195
+ getChildrenCollections = _useCollectionManager2.getChildrenCollections;
196
+
197
+ var childrenCollections = getChildrenCollections(collection.name);
198
+ var hasChildCollection = (childrenCollections === null || childrenCollections === void 0 ? void 0 : childrenCollections.length) > 0;
155
199
  return /*#__PURE__*/_react2.default.createElement(_.SchemaInitializer.Button, {
156
200
  wrap: _utils.gridRowColWrap,
157
201
  insertPosition: insertPosition,
@@ -161,7 +205,23 @@ var RecordBlockInitializers = function RecordBlockInitializers(props) {
161
205
  items: [{
162
206
  type: 'itemGroup',
163
207
  title: '{{t("Current record blocks")}}',
164
- children: [{
208
+ children: hasChildCollection ? [{
209
+ key: 'details',
210
+ type: 'subMenu',
211
+ title: '{{t("Details")}}',
212
+ children: useDetailCollections(_objectSpread(_objectSpread({}, props), {}, {
213
+ childrenCollections: childrenCollections,
214
+ collection: collection
215
+ }))
216
+ }, {
217
+ key: 'form',
218
+ type: 'subMenu',
219
+ title: '{{t("Form")}}',
220
+ children: useFormCollections(_objectSpread(_objectSpread({}, props), {}, {
221
+ childrenCollections: childrenCollections,
222
+ collection: collection
223
+ }))
224
+ }] : [{
165
225
  key: 'details',
166
226
  type: 'item',
167
227
  title: '{{t("Details")}}',
@@ -173,10 +233,6 @@ var RecordBlockInitializers = function RecordBlockInitializers(props) {
173
233
  title: '{{t("Form")}}',
174
234
  component: 'RecordFormBlockInitializer'
175
235
  }]
176
- }, {
177
- type: 'itemGroup',
178
- title: '{{t("Children collection blocks")}}',
179
- children: useInheritFields(props)
180
236
  }, {
181
237
  type: 'itemGroup',
182
238
  title: '{{t("Relationship blocks")}}',
@@ -1 +1,2 @@
1
+ export declare const Resizable: (props: any) => JSX.Element;
1
2
  export declare const TableActionColumnInitializers: (props: any) => JSX.Element;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TableActionColumnInitializers = void 0;
6
+ exports.TableActionColumnInitializers = exports.Resizable = void 0;
7
7
 
8
8
  var _icons = require("@ant-design/icons");
9
9
 
@@ -64,6 +64,8 @@ var Resizable = function Resizable(props) {
64
64
  });
65
65
  };
66
66
 
67
+ exports.Resizable = Resizable;
68
+
67
69
  var TableActionColumnInitializers = function TableActionColumnInitializers(props) {
68
70
  var fieldSchema = (0, _react.useFieldSchema)();
69
71
  var api = (0, _apiClient.useAPIClient)();
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const actionDesignerCss: string;
3
+ export declare const CreateRecordAction: React.MemoExoticComponent<React.FunctionComponent<unknown>>;
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.actionDesignerCss = exports.CreateRecordAction = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _icons = require("@ant-design/icons");
13
+
14
+ var _react2 = require("@formily/react");
15
+
16
+ var _antd = require("antd");
17
+
18
+ var _css = require("@emotion/css");
19
+
20
+ var _collectionManager = require("../../collection-manager");
21
+
22
+ var _schemaComponent = require("../../schema-component");
23
+
24
+ var _ACLProvider = require("../../acl/ACLProvider");
25
+
26
+ var _templateObject;
27
+
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
+
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
+
32
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
33
+
34
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
35
+
36
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
+
38
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
39
+
40
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
41
+
42
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
43
+
44
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
45
+
46
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
47
+
48
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49
+
50
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
51
+
52
+ var actionDesignerCss = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: rgba(241, 139, 98, 0.06);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n"])));
53
+ exports.actionDesignerCss = actionDesignerCss;
54
+
55
+ var actionAclCheck = function actionAclCheck(actionPath) {
56
+ var _actionPath;
57
+
58
+ var _useACLRolesCheck = (0, _ACLProvider.useACLRolesCheck)(),
59
+ data = _useACLRolesCheck.data,
60
+ inResources = _useACLRolesCheck.inResources,
61
+ getResourceActionParams = _useACLRolesCheck.getResourceActionParams,
62
+ getStrategyActionParams = _useACLRolesCheck.getStrategyActionParams;
63
+
64
+ var recordPkValue = (0, _ACLProvider.useRecordPkValue)();
65
+ var collection = (0, _collectionManager.useCollection)();
66
+ var resource = collection.resource;
67
+
68
+ var parseAction = function parseAction(actionPath) {
69
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
70
+
71
+ var _actionPath$split = actionPath.split(':'),
72
+ _actionPath$split2 = _slicedToArray(_actionPath$split, 1),
73
+ resourceName = _actionPath$split2[0];
74
+
75
+ if (data === null || data === void 0 ? void 0 : data.allowAll) {
76
+ return {};
77
+ }
78
+
79
+ if (inResources(resourceName)) {
80
+ return getResourceActionParams(actionPath);
81
+ }
82
+
83
+ return getStrategyActionParams(actionPath);
84
+ };
85
+
86
+ if (!actionPath && resource) {
87
+ actionPath = "".concat(resource, ":create}");
88
+ }
89
+
90
+ if (!((_actionPath = actionPath) === null || _actionPath === void 0 ? void 0 : _actionPath.includes(':'))) {
91
+ actionPath = "".concat(resource, ":").concat(actionPath);
92
+ }
93
+
94
+ if (!actionPath) {
95
+ return true;
96
+ }
97
+
98
+ var params = parseAction(actionPath, {
99
+ recordPkValue: recordPkValue
100
+ });
101
+
102
+ if (!params) {
103
+ return false;
104
+ }
105
+
106
+ return true;
107
+ };
108
+
109
+ var CreateRecordAction = (0, _react2.observer)(function (props) {
110
+ var _useState = (0, _react.useState)(false),
111
+ _useState2 = _slicedToArray(_useState, 2),
112
+ visible = _useState2[0],
113
+ setVisible = _useState2[1];
114
+
115
+ var collection = (0, _collectionManager.useCollection)();
116
+ var fieldSchema = (0, _react2.useFieldSchema)();
117
+ var enableChildren = fieldSchema['x-enable-children'] || [];
118
+ var field = (0, _react2.useField)();
119
+
120
+ var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
121
+ getChildrenCollections = _useCollectionManager.getChildrenCollections;
122
+
123
+ var totalChildCollections = getChildrenCollections(collection.name);
124
+ var inheritsCollections = enableChildren.map(function (k) {
125
+ var childCollection = totalChildCollections.find(function (j) {
126
+ return j.name === k.collection;
127
+ });
128
+ return _objectSpread(_objectSpread({}, childCollection), {}, {
129
+ title: k.title || childCollection.title
130
+ });
131
+ }).filter(function (v) {
132
+ return actionAclCheck("".concat(v.name, ":create"));
133
+ });
134
+
135
+ var _useState3 = (0, _react.useState)(collection.name),
136
+ _useState4 = _slicedToArray(_useState3, 2),
137
+ currentCollection = _useState4[0],
138
+ setCurrentCollection = _useState4[1];
139
+
140
+ var ctx = (0, _schemaComponent.useActionContext)();
141
+ var compile = (0, _schemaComponent.useCompile)();
142
+
143
+ var menu = /*#__PURE__*/_react.default.createElement(_antd.Menu, null, inheritsCollections.map(function (option) {
144
+ return /*#__PURE__*/_react.default.createElement(_antd.Menu.Item, {
145
+ key: option.name,
146
+ onClick: function onClick(info) {
147
+ setVisible(true);
148
+ setCurrentCollection(option.name);
149
+ }
150
+ }, compile(option.title));
151
+ }));
152
+
153
+ return /*#__PURE__*/_react.default.createElement("div", {
154
+ className: actionDesignerCss
155
+ }, /*#__PURE__*/_react.default.createElement(_schemaComponent.ActionContext.Provider, {
156
+ value: _objectSpread(_objectSpread({}, ctx), {}, {
157
+ visible: visible,
158
+ setVisible: setVisible
159
+ })
160
+ }, (inheritsCollections === null || inheritsCollections === void 0 ? void 0 : inheritsCollections.length) > 0 ? /*#__PURE__*/_react.default.createElement(_antd.Dropdown.Button, {
161
+ type: "primary",
162
+ icon: /*#__PURE__*/_react.default.createElement(_icons.DownOutlined, null),
163
+ buttonsRender: function buttonsRender(_ref) {
164
+ var _ref2 = _slicedToArray(_ref, 2),
165
+ leftButton = _ref2[0],
166
+ rightButton = _ref2[1];
167
+
168
+ return [leftButton, /*#__PURE__*/_react.default.cloneElement(rightButton, {
169
+ loading: false
170
+ })];
171
+ },
172
+ overlay: menu,
173
+ onClick: function onClick(info) {
174
+ setVisible(true);
175
+ setCurrentCollection(collection.name);
176
+ }
177
+ }, /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null), props.children) : /*#__PURE__*/_react.default.createElement(_antd.Button, {
178
+ type: 'primary',
179
+ icon: /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null),
180
+ onClick: function onClick(info) {
181
+ setVisible(true);
182
+ setCurrentCollection(collection.name);
183
+ }
184
+ }, props.children), /*#__PURE__*/_react.default.createElement(_collectionManager.CollectionProvider, {
185
+ name: currentCollection
186
+ }, /*#__PURE__*/_react.default.createElement(_react2.RecursionField, {
187
+ schema: fieldSchema,
188
+ basePath: field.address,
189
+ onlyRenderProperties: true
190
+ }))));
191
+ }); // export const CreateRecordAction = observer((props: any) => {
192
+ // return (
193
+ // <Action {...props} component={CreateAction}>
194
+ // {props.children}
195
+ // </Action>
196
+ // );
197
+ // });
198
+
199
+ exports.CreateRecordAction = CreateRecordAction;