@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
@@ -1,2 +1,3 @@
1
1
  export * from './assigned-field';
2
2
  export * from './BulkEditField';
3
+ export * from './CreateRecordAction';
@@ -28,4 +28,17 @@ Object.keys(_BulkEditField).forEach(function (key) {
28
28
  return _BulkEditField[key];
29
29
  }
30
30
  });
31
+ });
32
+
33
+ var _CreateRecordAction = require("./CreateRecordAction");
34
+
35
+ Object.keys(_CreateRecordAction).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _CreateRecordAction[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _CreateRecordAction[key];
42
+ }
43
+ });
31
44
  });
@@ -2,4 +2,5 @@ export * from './SchemaInitializer';
2
2
  export * from './SchemaInitializerProvider';
3
3
  export * from './types';
4
4
  export * from './items';
5
- export { gridRowColWrap, useRecordCollectionDataSourceItems } from './utils';
5
+ export { gridRowColWrap, useRecordCollectionDataSourceItems, createTableBlockSchema, useAssociatedTableColumnInitializerFields, useInheritsTableColumnInitializerFields, useTableColumnInitializerFields, itemsMerge, } from './utils';
6
+ export * from './buttons';
@@ -5,20 +5,55 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  gridRowColWrap: true,
8
- useRecordCollectionDataSourceItems: true
8
+ useRecordCollectionDataSourceItems: true,
9
+ createTableBlockSchema: true,
10
+ useAssociatedTableColumnInitializerFields: true,
11
+ useInheritsTableColumnInitializerFields: true,
12
+ useTableColumnInitializerFields: true,
13
+ itemsMerge: true
9
14
  };
15
+ Object.defineProperty(exports, "createTableBlockSchema", {
16
+ enumerable: true,
17
+ get: function get() {
18
+ return _utils.createTableBlockSchema;
19
+ }
20
+ });
10
21
  Object.defineProperty(exports, "gridRowColWrap", {
11
22
  enumerable: true,
12
23
  get: function get() {
13
24
  return _utils.gridRowColWrap;
14
25
  }
15
26
  });
27
+ Object.defineProperty(exports, "itemsMerge", {
28
+ enumerable: true,
29
+ get: function get() {
30
+ return _utils.itemsMerge;
31
+ }
32
+ });
33
+ Object.defineProperty(exports, "useAssociatedTableColumnInitializerFields", {
34
+ enumerable: true,
35
+ get: function get() {
36
+ return _utils.useAssociatedTableColumnInitializerFields;
37
+ }
38
+ });
39
+ Object.defineProperty(exports, "useInheritsTableColumnInitializerFields", {
40
+ enumerable: true,
41
+ get: function get() {
42
+ return _utils.useInheritsTableColumnInitializerFields;
43
+ }
44
+ });
16
45
  Object.defineProperty(exports, "useRecordCollectionDataSourceItems", {
17
46
  enumerable: true,
18
47
  get: function get() {
19
48
  return _utils.useRecordCollectionDataSourceItems;
20
49
  }
21
50
  });
51
+ Object.defineProperty(exports, "useTableColumnInitializerFields", {
52
+ enumerable: true,
53
+ get: function get() {
54
+ return _utils.useTableColumnInitializerFields;
55
+ }
56
+ });
22
57
 
23
58
  var _SchemaInitializer = require("./SchemaInitializer");
24
59
 
@@ -76,4 +111,18 @@ Object.keys(_items).forEach(function (key) {
76
111
  });
77
112
  });
78
113
 
79
- var _utils = require("./utils");
114
+ var _utils = require("./utils");
115
+
116
+ var _buttons = require("./buttons");
117
+
118
+ Object.keys(_buttons).forEach(function (key) {
119
+ if (key === "default" || key === "__esModule") return;
120
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
121
+ if (key in exports && exports[key] === _buttons[key]) return;
122
+ Object.defineProperty(exports, key, {
123
+ enumerable: true,
124
+ get: function get() {
125
+ return _buttons[key];
126
+ }
127
+ });
128
+ });
@@ -46,44 +46,27 @@ var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
46
46
  t = _useTranslation.t;
47
47
 
48
48
  var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
49
- getCollectionFields = _useCollectionManager.getCollectionFields;
49
+ getCollectionField = _useCollectionManager.getCollectionField,
50
+ getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
50
51
 
52
+ _collectionManager.useCollectionManager;
51
53
  var options = (0, _react.useContext)(_react2.SchemaOptionsContext);
52
54
  return /*#__PURE__*/_react.default.createElement(_DataBlockInitializer.DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
53
55
  componentType: 'Calendar',
54
56
  icon: /*#__PURE__*/_react.default.createElement(_icons.FormOutlined, null),
55
57
  onCreateBlockSchema: function () {
56
58
  var _onCreateBlockSchema = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
57
- var _collectionFields$fil, _collectionFields$fil2;
58
-
59
- var item, collectionFields, stringFields, dateFields, values;
59
+ var item, stringFieldsOptions, dateFieldsOptions, values;
60
60
  return regeneratorRuntime.wrap(function _callee$(_context) {
61
61
  while (1) {
62
62
  switch (_context.prev = _context.next) {
63
63
  case 0:
64
64
  item = _ref.item;
65
- collectionFields = getCollectionFields(item.name);
66
- stringFields = collectionFields === null || collectionFields === void 0 ? void 0 : (_collectionFields$fil = collectionFields.filter(function (field) {
67
- return field.type === 'string';
68
- })) === null || _collectionFields$fil === void 0 ? void 0 : _collectionFields$fil.map(function (field) {
69
- var _field$uiSchema;
70
-
71
- return {
72
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title,
73
- value: field.name
74
- };
75
- });
76
- dateFields = collectionFields === null || collectionFields === void 0 ? void 0 : (_collectionFields$fil2 = collectionFields.filter(function (field) {
77
- return field.type === 'date';
78
- })) === null || _collectionFields$fil2 === void 0 ? void 0 : _collectionFields$fil2.map(function (field) {
79
- var _field$uiSchema2;
80
-
81
- return {
82
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title,
83
- value: field.name
84
- };
65
+ stringFieldsOptions = getCollectionFieldsOptions(item.name, 'string');
66
+ dateFieldsOptions = getCollectionFieldsOptions(item.name, 'date', {
67
+ association: ['o2o', 'obo', 'oho', 'm2o']
85
68
  });
86
- _context.next = 6;
69
+ _context.next = 5;
87
70
  return (0, _antd.FormDialog)(t('Create calendar block'), function () {
88
71
  return /*#__PURE__*/_react.default.createElement(_schemaComponent.SchemaComponentOptions, {
89
72
  scope: options.scope,
@@ -95,23 +78,23 @@ var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
95
78
  properties: {
96
79
  title: {
97
80
  title: t('Title field'),
98
- enum: stringFields,
81
+ enum: stringFieldsOptions,
99
82
  required: true,
100
83
  'x-component': 'Select',
101
84
  'x-decorator': 'FormItem'
102
85
  },
103
86
  start: {
104
87
  title: t('Start date field'),
105
- enum: dateFields,
88
+ enum: dateFieldsOptions,
106
89
  required: true,
107
- default: 'createdAt',
108
- 'x-component': 'Select',
90
+ default: getCollectionField("".concat(item.name, ".createdAt")) ? 'createdAt' : null,
91
+ 'x-component': 'Cascader',
109
92
  'x-decorator': 'FormItem'
110
93
  },
111
94
  end: {
112
95
  title: t('End date field'),
113
- enum: dateFields,
114
- 'x-component': 'Select',
96
+ enum: dateFieldsOptions,
97
+ 'x-component': 'Cascader',
115
98
  'x-decorator': 'FormItem'
116
99
  }
117
100
  }
@@ -121,14 +104,14 @@ var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
121
104
  initialValues: {}
122
105
  });
123
106
 
124
- case 6:
107
+ case 5:
125
108
  values = _context.sent;
126
109
  insert((0, _utils.createCalendarBlockSchema)({
127
110
  collection: item.name,
128
111
  fieldNames: _objectSpread({}, values)
129
112
  }));
130
113
 
131
- case 8:
114
+ case 7:
132
115
  case "end":
133
116
  return _context.stop();
134
117
  }
@@ -20,14 +20,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
20
20
  var CreateActionInitializer = function CreateActionInitializer(props) {
21
21
  var schema = {
22
22
  type: 'void',
23
- title: '{{ t("Add new") }}',
24
23
  'x-action': 'create',
24
+ title: "{{t('Add new')}}",
25
25
  'x-designer': 'Action.Designer',
26
26
  'x-component': 'Action',
27
+ 'x-decorator': 'ACLActionProvider',
27
28
  'x-component-props': {
28
- icon: 'PlusOutlined',
29
29
  openMode: 'drawer',
30
- type: 'primary'
30
+ component: 'CreateRecordAction'
31
31
  },
32
32
  properties: {
33
33
  drawer: {
@@ -19,7 +19,7 @@ var _SchemaInitializer = require("../SchemaInitializer");
19
19
 
20
20
  var _utils = require("../utils");
21
21
 
22
- var _excluded = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert"];
22
+ var _excluded = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert", "targetCollection"];
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
@@ -42,14 +42,14 @@ var RecordFormBlockInitializer = function RecordFormBlockInitializer(props) {
42
42
  componentType = props.componentType,
43
43
  createBlockSchema = props.createBlockSchema,
44
44
  insert = props.insert,
45
+ targetCollection = props.targetCollection,
45
46
  others = _objectWithoutProperties(props, _excluded);
46
47
 
47
48
  var _useSchemaTemplateMan = (0, _schemaTemplates.useSchemaTemplateManager)(),
48
49
  getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
49
50
 
50
- var collection = (0, _collectionManager.useCollection)();
51
+ var collection = targetCollection || (0, _collectionManager.useCollection)();
51
52
  var association = (0, _blockProvider.useBlockAssociationContext)();
52
- console.log('RecordFormBlockInitializer', collection, association);
53
53
  return /*#__PURE__*/_react.default.createElement(_SchemaInitializer.SchemaInitializer.Item, _objectSpread(_objectSpread({
54
54
  icon: /*#__PURE__*/_react.default.createElement(_icons.FormOutlined, null)
55
55
  }, others), {}, {
@@ -1,3 +1,7 @@
1
+ export * from '../../schema-component/antd/association-filter/ActionBarAssociationFilterAction';
2
+ export * from '../../schema-component/antd/association-filter/AssociationFilter';
3
+ export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDelete';
4
+ export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDisplayField';
1
5
  export * from './ActionInitializer';
2
6
  export * from './BlockInitializer';
3
7
  export * from './BulkDestroyActionInitializer';
@@ -37,7 +41,3 @@ export * from './TableSelectorInitializer';
37
41
  export * from './UpdateActionInitializer';
38
42
  export * from './UpdateSubmitActionInitializer';
39
43
  export * from './ViewActionInitializer';
40
- export * from '../../schema-component/antd/association-filter/AssociationFilter';
41
- export * from '../../schema-component/antd/association-filter/ActionBarAssociationFilterAction';
42
- export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDisplayField';
43
- export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDelete';
@@ -4,6 +4,58 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _ActionBarAssociationFilterAction = require("../../schema-component/antd/association-filter/ActionBarAssociationFilterAction");
8
+
9
+ Object.keys(_ActionBarAssociationFilterAction).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _ActionBarAssociationFilterAction[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _ActionBarAssociationFilterAction[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _AssociationFilter = require("../../schema-component/antd/association-filter/AssociationFilter");
21
+
22
+ Object.keys(_AssociationFilter).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _AssociationFilter[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _AssociationFilter[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _AssociationFilterDesignerDelete = require("../../schema-component/antd/association-filter/AssociationFilterDesignerDelete");
34
+
35
+ Object.keys(_AssociationFilterDesignerDelete).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _AssociationFilterDesignerDelete[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _AssociationFilterDesignerDelete[key];
42
+ }
43
+ });
44
+ });
45
+
46
+ var _AssociationFilterDesignerDisplayField = require("../../schema-component/antd/association-filter/AssociationFilterDesignerDisplayField");
47
+
48
+ Object.keys(_AssociationFilterDesignerDisplayField).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _AssociationFilterDesignerDisplayField[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function get() {
54
+ return _AssociationFilterDesignerDisplayField[key];
55
+ }
56
+ });
57
+ });
58
+
7
59
  var _ActionInitializer = require("./ActionInitializer");
8
60
 
9
61
  Object.keys(_ActionInitializer).forEach(function (key) {
@@ -509,56 +561,4 @@ Object.keys(_ViewActionInitializer).forEach(function (key) {
509
561
  return _ViewActionInitializer[key];
510
562
  }
511
563
  });
512
- });
513
-
514
- var _AssociationFilter = require("../../schema-component/antd/association-filter/AssociationFilter");
515
-
516
- Object.keys(_AssociationFilter).forEach(function (key) {
517
- if (key === "default" || key === "__esModule") return;
518
- if (key in exports && exports[key] === _AssociationFilter[key]) return;
519
- Object.defineProperty(exports, key, {
520
- enumerable: true,
521
- get: function get() {
522
- return _AssociationFilter[key];
523
- }
524
- });
525
- });
526
-
527
- var _ActionBarAssociationFilterAction = require("../../schema-component/antd/association-filter/ActionBarAssociationFilterAction");
528
-
529
- Object.keys(_ActionBarAssociationFilterAction).forEach(function (key) {
530
- if (key === "default" || key === "__esModule") return;
531
- if (key in exports && exports[key] === _ActionBarAssociationFilterAction[key]) return;
532
- Object.defineProperty(exports, key, {
533
- enumerable: true,
534
- get: function get() {
535
- return _ActionBarAssociationFilterAction[key];
536
- }
537
- });
538
- });
539
-
540
- var _AssociationFilterDesignerDisplayField = require("../../schema-component/antd/association-filter/AssociationFilterDesignerDisplayField");
541
-
542
- Object.keys(_AssociationFilterDesignerDisplayField).forEach(function (key) {
543
- if (key === "default" || key === "__esModule") return;
544
- if (key in exports && exports[key] === _AssociationFilterDesignerDisplayField[key]) return;
545
- Object.defineProperty(exports, key, {
546
- enumerable: true,
547
- get: function get() {
548
- return _AssociationFilterDesignerDisplayField[key];
549
- }
550
- });
551
- });
552
-
553
- var _AssociationFilterDesignerDelete = require("../../schema-component/antd/association-filter/AssociationFilterDesignerDelete");
554
-
555
- Object.keys(_AssociationFilterDesignerDelete).forEach(function (key) {
556
- if (key === "default" || key === "__esModule") return;
557
- if (key in exports && exports[key] === _AssociationFilterDesignerDelete[key]) return;
558
- Object.defineProperty(exports, key, {
559
- enumerable: true,
560
- get: function get() {
561
- return _AssociationFilterDesignerDelete[key];
562
- }
563
- });
564
564
  });
@@ -15,6 +15,8 @@ var _react2 = _interopRequireWildcard(require("react"));
15
15
 
16
16
  var _reactI18next = require("react-i18next");
17
17
 
18
+ var _ = require("../");
19
+
18
20
  var _collectionManager = require("../collection-manager");
19
21
 
20
22
  var _schemaComponent = require("../schema-component");
@@ -26,7 +28,7 @@ var _SelectCollection = require("./SelectCollection");
26
28
  var _excluded = ["formItemInitializers", "actionInitializers", "collection", "association", "resource", "template"],
27
29
  _excluded2 = ["formItemInitializers", "actionInitializers", "collection", "resource", "association", "action", "template"],
28
30
  _excluded3 = ["formItemInitializers", "actionInitializers", "collection", "association", "resource", "template"],
29
- _excluded4 = ["collection", "resource", "rowKey"],
31
+ _excluded4 = ["collection", "resource", "rowKey", "tableActionInitializers", "tableColumnInitializers", "tableActionColumnInitializers", "tableBlockProvider", "disableTemplate"],
30
32
  _excluded5 = ["collection", "resource", "rowKey"],
31
33
  _excluded6 = ["collection", "resource", "fieldNames"],
32
34
  _excluded7 = ["collection", "resource", "groupField"];
@@ -669,10 +671,18 @@ var useCurrentSchema = function useCurrentSchema(action, key) {
669
671
  _remove = _useDesignable.remove;
670
672
 
671
673
  var schema = find(fieldSchema, key, action);
674
+ var ctx = (0, _react2.useContext)(_.BlockRequestContext);
675
+ var exists = !!schema;
672
676
  return {
673
677
  schema: schema,
674
678
  exists: !!schema,
675
679
  remove: function remove() {
680
+ if (ctx.field) {
681
+ ctx.field.data = ctx.field.data || {};
682
+ ctx.field.data.activeFields = ctx.field.data.activeFields || new Set();
683
+ ctx.field.data.activeFields.delete(schema.name);
684
+ }
685
+
676
686
  schema && rm(schema, _remove);
677
687
  }
678
688
  };
@@ -1059,11 +1069,16 @@ var createTableBlockSchema = function createTableBlockSchema(options) {
1059
1069
  var collection = options.collection,
1060
1070
  resource = options.resource,
1061
1071
  rowKey = options.rowKey,
1072
+ tableActionInitializers = options.tableActionInitializers,
1073
+ tableColumnInitializers = options.tableColumnInitializers,
1074
+ tableActionColumnInitializers = options.tableActionColumnInitializers,
1075
+ tableBlockProvider = options.tableBlockProvider,
1076
+ disableTemplate = options.disableTemplate,
1062
1077
  others = _objectWithoutProperties(options, _excluded4);
1063
1078
 
1064
1079
  var schema = {
1065
1080
  type: 'void',
1066
- 'x-decorator': 'TableBlockProvider',
1081
+ 'x-decorator': tableBlockProvider !== null && tableBlockProvider !== void 0 ? tableBlockProvider : 'TableBlockProvider',
1067
1082
  'x-acl-action': "".concat(resource || collection, ":list"),
1068
1083
  'x-decorator-props': _objectSpread({
1069
1084
  collection: collection,
@@ -1074,14 +1089,15 @@ var createTableBlockSchema = function createTableBlockSchema(options) {
1074
1089
  },
1075
1090
  rowKey: rowKey,
1076
1091
  showIndex: true,
1077
- dragSort: false
1092
+ dragSort: false,
1093
+ disableTemplate: disableTemplate !== null && disableTemplate !== void 0 ? disableTemplate : false
1078
1094
  }, others),
1079
1095
  'x-designer': 'TableBlockDesigner',
1080
1096
  'x-component': 'CardItem',
1081
1097
  properties: _defineProperty({
1082
1098
  actions: {
1083
1099
  type: 'void',
1084
- 'x-initializer': 'TableActionInitializers',
1100
+ 'x-initializer': tableActionInitializers !== null && tableActionInitializers !== void 0 ? tableActionInitializers : 'TableActionInitializers',
1085
1101
  'x-component': 'ActionBar',
1086
1102
  'x-component-props': {
1087
1103
  style: {
@@ -1092,7 +1108,7 @@ var createTableBlockSchema = function createTableBlockSchema(options) {
1092
1108
  }
1093
1109
  }, (0, _shared.uid)(), {
1094
1110
  type: 'array',
1095
- 'x-initializer': 'TableColumnInitializers',
1111
+ 'x-initializer': tableColumnInitializers !== null && tableColumnInitializers !== void 0 ? tableColumnInitializers : 'TableColumnInitializers',
1096
1112
  'x-component': 'TableV2',
1097
1113
  'x-component-props': {
1098
1114
  rowKey: 'id',
@@ -1109,7 +1125,7 @@ var createTableBlockSchema = function createTableBlockSchema(options) {
1109
1125
  'x-decorator': 'TableV2.Column.ActionBar',
1110
1126
  'x-component': 'TableV2.Column',
1111
1127
  'x-designer': 'TableV2.ActionColumnDesigner',
1112
- 'x-initializer': 'TableActionColumnInitializers',
1128
+ 'x-initializer': tableActionColumnInitializers !== null && tableActionColumnInitializers !== void 0 ? tableActionColumnInitializers : 'TableActionColumnInitializers',
1113
1129
  properties: {
1114
1130
  actions: {
1115
1131
  type: 'void',
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const EnableChildCollections: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EnableChildCollections = void 0;
7
+
8
+ var _react = require("@formily/react");
9
+
10
+ var _react2 = _interopRequireDefault(require("react"));
11
+
12
+ var _reactive = require("@formily/reactive");
13
+
14
+ var _schemaComponent = require("../../schema-component");
15
+
16
+ var _collectionManager = require("../../collection-manager");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
21
+
22
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
23
+
24
+ var EnableChildCollections = (0, _react.observer)(function (props) {
25
+ var useProps = props.useProps;
26
+
27
+ var _useProps = useProps(),
28
+ defaultValues = _useProps.defaultValues,
29
+ collectionName = _useProps.collectionName;
30
+
31
+ var form = (0, _react.useForm)();
32
+ var compile = (0, _schemaComponent.useCompile)();
33
+
34
+ var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
35
+ getChildrenCollections = _useCollectionManager.getChildrenCollections;
36
+
37
+ var childrenCollections = getChildrenCollections(collectionName);
38
+
39
+ var useAsyncDataSource = function useAsyncDataSource(service) {
40
+ return function (field, options) {
41
+ field.loading = true;
42
+ service(field, options).then(_reactive.action.bound(function (data) {
43
+ field.dataSource = data;
44
+ field.loading = false;
45
+
46
+ if (field.initialValue) {
47
+ field.disabled = true;
48
+ }
49
+ }));
50
+ };
51
+ };
52
+
53
+ var loadData = /*#__PURE__*/function () {
54
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(field) {
55
+ var _form$values, _childrenCollections$;
56
+
57
+ var _form$values$enableCh, childCollections;
58
+
59
+ return regeneratorRuntime.wrap(function _callee$(_context) {
60
+ while (1) {
61
+ switch (_context.prev = _context.next) {
62
+ case 0:
63
+ _form$values$enableCh = (_form$values = form.values) === null || _form$values === void 0 ? void 0 : _form$values.enableChildren, childCollections = _form$values$enableCh.childrenCollections;
64
+ return _context.abrupt("return", (_childrenCollections$ = childrenCollections.filter(function (v) {
65
+ return !childCollections.find(function (k) {
66
+ return k.collection === v.name;
67
+ }) || field.initialValue || v.name === field.value;
68
+ })) === null || _childrenCollections$ === void 0 ? void 0 : _childrenCollections$.map(function (collection) {
69
+ return {
70
+ label: compile(collection.title),
71
+ value: collection.name
72
+ };
73
+ }));
74
+
75
+ case 2:
76
+ case "end":
77
+ return _context.stop();
78
+ }
79
+ }
80
+ }, _callee);
81
+ }));
82
+
83
+ return function loadData(_x) {
84
+ return _ref.apply(this, arguments);
85
+ };
86
+ }();
87
+
88
+ return /*#__PURE__*/_react2.default.createElement(_schemaComponent.SchemaComponent, {
89
+ schema: {
90
+ type: 'object',
91
+ properties: {
92
+ childrenCollections: {
93
+ type: 'array',
94
+ default: defaultValues,
95
+ 'x-component': 'ArrayItems',
96
+ 'x-decorator': 'FormItem',
97
+ items: {
98
+ type: 'object',
99
+ properties: {
100
+ space: {
101
+ type: 'void',
102
+ 'x-component': 'Space',
103
+ properties: {
104
+ sort: {
105
+ type: 'void',
106
+ 'x-decorator': 'FormItem',
107
+ 'x-component': 'ArrayItems.SortHandle'
108
+ },
109
+ collection: {
110
+ type: 'string',
111
+ 'x-decorator': 'FormItem',
112
+ required: true,
113
+ 'x-component': 'Select',
114
+ 'x-component-props': {
115
+ style: {
116
+ width: 260
117
+ }
118
+ },
119
+ 'x-reactions': ['{{useAsyncDataSource(loadData)}}']
120
+ },
121
+ title: {
122
+ type: 'string',
123
+ 'x-decorator': 'FormItem',
124
+ 'x-component': 'Input',
125
+ 'x-component-props': {
126
+ style: {
127
+ width: 235
128
+ }
129
+ }
130
+ },
131
+ remove: {
132
+ type: 'void',
133
+ 'x-decorator': 'FormItem',
134
+ 'x-component': 'ArrayItems.Remove'
135
+ }
136
+ }
137
+ }
138
+ }
139
+ },
140
+ properties: {
141
+ add: {
142
+ type: 'void',
143
+ title: '{{ t("Add collection") }}',
144
+ 'x-component': 'ArrayItems.Addition'
145
+ }
146
+ }
147
+ }
148
+ }
149
+ },
150
+ scope: {
151
+ useAsyncDataSource: useAsyncDataSource,
152
+ loadData: loadData
153
+ }
154
+ });
155
+ });
156
+ exports.EnableChildCollections = EnableChildCollections;
@@ -0,0 +1 @@
1
+ export declare const DynamicComponent: (props: any) => JSX.Element;