@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
@@ -15,41 +15,50 @@ var _core = require("@formily/core");
15
15
 
16
16
  var _react = require("@formily/react");
17
17
 
18
+ var _lodash = _interopRequireWildcard(require("lodash"));
19
+
18
20
  var _shared = require("@formily/shared");
19
21
 
20
22
  var _antd2 = require("antd");
21
23
 
22
24
  var _classnames = _interopRequireDefault(require("classnames"));
23
25
 
24
- var _lodash = require("lodash");
25
-
26
26
  var _react2 = _interopRequireWildcard(require("react"));
27
27
 
28
28
  var _reactDom = require("react-dom");
29
29
 
30
30
  var _reactI18next = require("react-i18next");
31
31
 
32
- var _ = require("..");
32
+ var _2 = require("..");
33
33
 
34
34
  var _schemaTemplates = require("../schema-templates");
35
35
 
36
36
  var _BlockTemplate = require("../schema-templates/BlockTemplate");
37
37
 
38
+ var _LinkageRules = require("./LinkageRules");
39
+
40
+ var _actionHooks = require("./LinkageRules/action-hooks");
41
+
42
+ var _EnableChildCollections = require("./EnableChildCollections");
43
+
38
44
  var _templateObject;
39
45
 
40
46
  var _excluded = ["children", "fieldSchema"],
41
47
  _excluded2 = ["title", "dn"],
42
48
  _excluded3 = ["title", "options", "value", "onChange"],
43
- _excluded4 = ["title", "onChange"],
44
- _excluded5 = ["schema"],
45
- _excluded6 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
46
- _excluded7 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "asyncGetInitialValues", "initialValues"];
49
+ _excluded4 = ["title", "options", "value", "onChange"],
50
+ _excluded5 = ["title", "onChange"],
51
+ _excluded6 = ["schema"],
52
+ _excluded7 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
53
+ _excluded8 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "asyncGetInitialValues", "initialValues", "width"];
54
+
55
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
56
 
48
57
  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); }
49
58
 
50
59
  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; }
51
60
 
52
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
53
62
 
54
63
  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); } }
55
64
 
@@ -95,7 +104,7 @@ var SchemaSettingsProvider = function SchemaSettingsProvider(props) {
95
104
  var _useSchemaTemplateMan = (0, _schemaTemplates.useSchemaTemplateManager)(),
96
105
  getTemplateBySchema = _useSchemaTemplateMan.getTemplateBySchema;
97
106
 
98
- var _useCollection = (0, _.useCollection)(),
107
+ var _useCollection = (0, _2.useCollection)(),
99
108
  name = _useCollection.name;
100
109
 
101
110
  var template = getTemplateBySchema(fieldSchema);
@@ -150,13 +159,17 @@ SchemaSettings.Template = function (props) {
150
159
  var _useTranslation = (0, _reactI18next.useTranslation)(),
151
160
  t = _useTranslation.t;
152
161
 
162
+ var _useCollectionManager = (0, _2.useCollectionManager)(),
163
+ getCollection = _useCollectionManager.getCollection;
164
+
153
165
  var _useSchemaSettings = useSchemaSettings(),
154
166
  dn = _useSchemaSettings.dn,
155
167
  setVisible = _useSchemaSettings.setVisible,
156
168
  template = _useSchemaSettings.template,
157
169
  fieldSchema = _useSchemaSettings.fieldSchema;
158
170
 
159
- var api = (0, _.useAPIClient)();
171
+ var compile = (0, _2.useCompile)();
172
+ var api = (0, _2.useAPIClient)();
160
173
 
161
174
  var _useBlockTemplateCont = (0, _BlockTemplate.useBlockTemplateContext)(),
162
175
  tdn = _useBlockTemplateCont.dn;
@@ -226,18 +239,19 @@ SchemaSettings.Template = function (props) {
226
239
  return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, {
227
240
  onClick: function () {
228
241
  var _onClick2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
229
- var values, sdn, _yield$saveAsTemplate, key;
242
+ var _getCollection, title, values, sdn, _yield$saveAsTemplate, key;
230
243
 
231
244
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
232
245
  while (1) {
233
246
  switch (_context3.prev = _context3.next) {
234
247
  case 0:
235
248
  setVisible(false);
236
- _context3.next = 3;
249
+ _getCollection = getCollection(collectionName), title = _getCollection.title;
250
+ _context3.next = 4;
237
251
  return (0, _antd.FormDialog)(t('Save as template'), function () {
238
252
  return /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
239
253
  layout: 'vertical'
240
- }, /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
254
+ }, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
241
255
  components: {
242
256
  Input: _antd.Input,
243
257
  FormItem: _antd.FormItem
@@ -248,6 +262,7 @@ SchemaSettings.Template = function (props) {
248
262
  name: {
249
263
  title: t('Template name'),
250
264
  required: true,
265
+ default: "".concat(compile(title), "_").concat(t(componentName)),
251
266
  'x-decorator': 'FormItem',
252
267
  'x-component': 'Input'
253
268
  }
@@ -256,16 +271,16 @@ SchemaSettings.Template = function (props) {
256
271
  }));
257
272
  }).open({});
258
273
 
259
- case 3:
274
+ case 4:
260
275
  values = _context3.sent;
261
- sdn = (0, _.createDesignable)({
276
+ sdn = (0, _2.createDesignable)({
262
277
  t: t,
263
278
  api: api,
264
279
  refresh: dn.refresh.bind(dn),
265
280
  current: fieldSchema.parent
266
281
  });
267
282
  sdn.loadAPIClientEvents();
268
- _context3.next = 8;
283
+ _context3.next = 9;
269
284
  return saveAsTemplate({
270
285
  collectionName: collectionName,
271
286
  resourceName: resourceName,
@@ -274,7 +289,7 @@ SchemaSettings.Template = function (props) {
274
289
  uid: fieldSchema['x-uid']
275
290
  });
276
291
 
277
- case 8:
292
+ case 9:
278
293
  _yield$saveAsTemplate = _context3.sent;
279
294
  key = _yield$saveAsTemplate.key;
280
295
  sdn.removeWithoutEmit(fieldSchema);
@@ -286,7 +301,7 @@ SchemaSettings.Template = function (props) {
286
301
  }
287
302
  });
288
303
 
289
- case 12:
304
+ case 13:
290
305
  case "end":
291
306
  return _context3.stop();
292
307
  }
@@ -307,7 +322,7 @@ var findGridSchema = function findGridSchema(fieldSchema) {
307
322
  return fieldSchema.reduceProperties(function (buf, s) {
308
323
  if (s['x-component'] === 'FormV2') {
309
324
  var f = s.reduceProperties(function (buf, s) {
310
- if (s['x-component'] === 'Grid') {
325
+ if (s['x-component'] === 'Grid' || s['x-component'] === 'BlockTemplate') {
311
326
  return s;
312
327
  }
313
328
 
@@ -353,13 +368,18 @@ SchemaSettings.FormItemTemplate = function (props) {
353
368
  var _useTranslation2 = (0, _reactI18next.useTranslation)(),
354
369
  t = _useTranslation2.t;
355
370
 
371
+ var compile = (0, _2.useCompile)();
372
+
373
+ var _useCollectionManager2 = (0, _2.useCollectionManager)(),
374
+ getCollection = _useCollectionManager2.getCollection;
375
+
356
376
  var _useSchemaSettings2 = useSchemaSettings(),
357
377
  dn = _useSchemaSettings2.dn,
358
378
  setVisible = _useSchemaSettings2.setVisible,
359
379
  template = _useSchemaSettings2.template,
360
380
  fieldSchema = _useSchemaSettings2.fieldSchema;
361
381
 
362
- var api = (0, _.useAPIClient)();
382
+ var api = (0, _2.useAPIClient)();
363
383
 
364
384
  var _useSchemaTemplateMan3 = (0, _schemaTemplates.useSchemaTemplateManager)(),
365
385
  saveAsTemplate = _useSchemaTemplateMan3.saveAsTemplate,
@@ -384,7 +404,7 @@ SchemaSettings.FormItemTemplate = function (props) {
384
404
  case 2:
385
405
  schema = _context5.sent;
386
406
  templateSchema = findBlockTemplateSchema(fieldSchema);
387
- sdn = (0, _.createDesignable)({
407
+ sdn = (0, _2.createDesignable)({
388
408
  t: t,
389
409
  api: api,
390
410
  refresh: dn.refresh.bind(dn),
@@ -447,19 +467,24 @@ SchemaSettings.FormItemTemplate = function (props) {
447
467
  return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, {
448
468
  onClick: function () {
449
469
  var _onClick4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
450
- var gridSchema, values, sdn, _yield$saveAsTemplate2, key;
470
+ var _getCollection2, title, gridSchema, values, sdn, _yield$saveAsTemplate2, key;
451
471
 
452
472
  return regeneratorRuntime.wrap(function _callee6$(_context6) {
453
473
  while (1) {
454
474
  switch (_context6.prev = _context6.next) {
455
475
  case 0:
456
476
  setVisible(false);
477
+ _getCollection2 = getCollection(collectionName), title = _getCollection2.title;
457
478
  gridSchema = findGridSchema(fieldSchema);
458
- _context6.next = 4;
479
+ _context6.next = 5;
459
480
  return (0, _antd.FormDialog)(t('Save as template'), function () {
481
+ var componentTitle = {
482
+ FormItem: t('Form'),
483
+ ReadPrettyFormItem: t('Details')
484
+ };
460
485
  return /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
461
486
  layout: 'vertical'
462
- }, /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
487
+ }, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
463
488
  components: {
464
489
  Input: _antd.Input,
465
490
  FormItem: _antd.FormItem
@@ -470,6 +495,7 @@ SchemaSettings.FormItemTemplate = function (props) {
470
495
  name: {
471
496
  title: t('Template name'),
472
497
  required: true,
498
+ default: "".concat(compile(title), "_").concat(componentTitle[componentName] || componentName),
473
499
  'x-decorator': 'FormItem',
474
500
  'x-component': 'Input'
475
501
  }
@@ -478,16 +504,16 @@ SchemaSettings.FormItemTemplate = function (props) {
478
504
  }));
479
505
  }).open({});
480
506
 
481
- case 4:
507
+ case 5:
482
508
  values = _context6.sent;
483
- sdn = (0, _.createDesignable)({
509
+ sdn = (0, _2.createDesignable)({
484
510
  t: t,
485
511
  api: api,
486
512
  refresh: dn.refresh.bind(dn),
487
513
  current: gridSchema.parent
488
514
  });
489
515
  sdn.loadAPIClientEvents();
490
- _context6.next = 9;
516
+ _context6.next = 10;
491
517
  return saveAsTemplate({
492
518
  collectionName: collectionName,
493
519
  resourceName: resourceName,
@@ -496,7 +522,7 @@ SchemaSettings.FormItemTemplate = function (props) {
496
522
  uid: gridSchema['x-uid']
497
523
  });
498
524
 
499
- case 9:
525
+ case 10:
500
526
  _yield$saveAsTemplate2 = _context6.sent;
501
527
  key = _yield$saveAsTemplate2.key;
502
528
  sdn.removeWithoutEmit(gridSchema);
@@ -508,7 +534,7 @@ SchemaSettings.FormItemTemplate = function (props) {
508
534
  }
509
535
  });
510
536
  fieldSchema['x-template-key'] = key;
511
- _context6.next = 16;
537
+ _context6.next = 17;
512
538
  return api.request({
513
539
  url: "uiSchemas:patch",
514
540
  method: 'post',
@@ -518,7 +544,7 @@ SchemaSettings.FormItemTemplate = function (props) {
518
544
  }
519
545
  });
520
546
 
521
- case 16:
547
+ case 17:
522
548
  case "end":
523
549
  return _context6.stop();
524
550
  }
@@ -641,11 +667,36 @@ SchemaSettings.SelectItem = function (props) {
641
667
  })));
642
668
  };
643
669
 
644
- SchemaSettings.SwitchItem = function (props) {
670
+ SchemaSettings.CascaderItem = function (props) {
645
671
  var title = props.title,
672
+ options = props.options,
673
+ value = props.value,
646
674
  onChange = props.onChange,
647
675
  others = _objectWithoutProperties(props, _excluded4);
648
676
 
677
+ return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, _objectSpread({}, others), /*#__PURE__*/_react2.default.createElement("div", {
678
+ style: {
679
+ alignItems: 'center',
680
+ display: 'flex',
681
+ justifyContent: 'space-between'
682
+ }
683
+ }, title, /*#__PURE__*/_react2.default.createElement(_antd2.Cascader, {
684
+ bordered: false,
685
+ defaultValue: value,
686
+ onChange: onChange,
687
+ options: options,
688
+ style: {
689
+ textAlign: 'right',
690
+ minWidth: 100
691
+ }
692
+ })));
693
+ };
694
+
695
+ SchemaSettings.SwitchItem = function (props) {
696
+ var title = props.title,
697
+ onChange = props.onChange,
698
+ others = _objectWithoutProperties(props, _excluded5);
699
+
649
700
  var _useState3 = (0, _react2.useState)(!!props.checked),
650
701
  _useState4 = _slicedToArray(_useState3, 2),
651
702
  checked = _useState4[0],
@@ -673,7 +724,7 @@ SchemaSettings.SwitchItem = function (props) {
673
724
 
674
725
  SchemaSettings.PopupItem = function (props) {
675
726
  var schema = props.schema,
676
- others = _objectWithoutProperties(props, _excluded5);
727
+ others = _objectWithoutProperties(props, _excluded6);
677
728
 
678
729
  var _useState5 = (0, _react2.useState)(false),
679
730
  _useState6 = _slicedToArray(_useState5, 2),
@@ -681,8 +732,8 @@ SchemaSettings.PopupItem = function (props) {
681
732
  setVisible = _useState6[1];
682
733
 
683
734
  var ctx = (0, _react2.useContext)(SchemaSettingsContext);
684
- var actx = (0, _.useActionContext)();
685
- return /*#__PURE__*/_react2.default.createElement(_.ActionContext.Provider, {
735
+ var actx = (0, _2.useActionContext)();
736
+ return /*#__PURE__*/_react2.default.createElement(_2.ActionContext.Provider, {
686
737
  value: {
687
738
  visible: visible,
688
739
  setVisible: setVisible
@@ -693,7 +744,7 @@ SchemaSettings.PopupItem = function (props) {
693
744
  ctx.setVisible(false);
694
745
  setVisible(true);
695
746
  }
696
- }), props.children || props.title), /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
747
+ }), props.children || props.title), /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
697
748
  schema: _objectSpread({
698
749
  name: (0, _shared.uid)()
699
750
  }, schema)
@@ -708,7 +759,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
708
759
  schema = props.schema,
709
760
  modalTip = props.modalTip,
710
761
  components = props.components,
711
- others = _objectWithoutProperties(props, _excluded6);
762
+ others = _objectWithoutProperties(props, _excluded7);
712
763
 
713
764
  var _useState7 = (0, _react2.useState)(false),
714
765
  _useState8 = _slicedToArray(_useState7, 2),
@@ -729,8 +780,8 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
729
780
  var _useSchemaSettings4 = useSchemaSettings(),
730
781
  dn = _useSchemaSettings4.dn;
731
782
 
732
- var compile = (0, _.useCompile)();
733
- var api = (0, _.useAPIClient)();
783
+ var compile = (0, _2.useCompile)();
784
+ var api = (0, _2.useAPIClient)();
734
785
  var form = (0, _react2.useMemo)(function () {
735
786
  return (0, _core.createForm)({
736
787
  initialValues: (0, _lodash.cloneDeep)(initialValues),
@@ -833,17 +884,17 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
833
884
  type: "primary",
834
885
  onClick: submitHandler
835
886
  }, t('Submit')))
836
- }), /*#__PURE__*/_react2.default.createElement(_.FormProvider, {
887
+ }), /*#__PURE__*/_react2.default.createElement(_2.FormProvider, {
837
888
  form: form
838
889
  }, /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
839
890
  layout: 'vertical'
840
891
  }, modalTip && /*#__PURE__*/_react2.default.createElement(_antd2.Alert, {
841
892
  message: modalTip
842
- }), modalTip && /*#__PURE__*/_react2.default.createElement("br", null), visible && schemaUid && /*#__PURE__*/_react2.default.createElement(_.RemoteSchemaComponent, {
893
+ }), modalTip && /*#__PURE__*/_react2.default.createElement("br", null), visible && schemaUid && /*#__PURE__*/_react2.default.createElement(_2.RemoteSchemaComponent, {
843
894
  noForm: true,
844
895
  components: components,
845
896
  uid: schemaUid
846
- }), visible && schema && /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
897
+ }), visible && schema && /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
847
898
  components: components,
848
899
  schema: schema
849
900
  }))))), document.body));
@@ -859,10 +910,11 @@ SchemaSettings.ModalItem = function (props) {
859
910
  onSubmit = props.onSubmit,
860
911
  asyncGetInitialValues = props.asyncGetInitialValues,
861
912
  initialValues = props.initialValues,
862
- others = _objectWithoutProperties(props, _excluded7);
913
+ width = props.width,
914
+ others = _objectWithoutProperties(props, _excluded8);
863
915
 
864
916
  var options = (0, _react2.useContext)(_react.SchemaOptionsContext);
865
- var cm = (0, _react2.useContext)(_.CollectionManagerContext);
917
+ var cm = (0, _react2.useContext)(_2.CollectionManagerContext);
866
918
 
867
919
  if (hidden) {
868
920
  return null;
@@ -894,15 +946,18 @@ SchemaSettings.ModalItem = function (props) {
894
946
 
895
947
  case 7:
896
948
  values = _context9.t0;
897
- (0, _antd.FormDialog)(schema.title || title, function () {
898
- return /*#__PURE__*/_react2.default.createElement(_.CollectionManagerContext.Provider, {
949
+ (0, _antd.FormDialog)({
950
+ title: schema.title || title,
951
+ width: width
952
+ }, function () {
953
+ return /*#__PURE__*/_react2.default.createElement(_2.CollectionManagerContext.Provider, {
899
954
  value: cm
900
- }, /*#__PURE__*/_react2.default.createElement(_.SchemaComponentOptions, {
955
+ }, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponentOptions, {
901
956
  scope: options.scope,
902
957
  components: options.components
903
958
  }, /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
904
959
  layout: 'vertical'
905
- }, /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
960
+ }, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
906
961
  components: components,
907
962
  scope: scope,
908
963
  schema: schema
@@ -937,7 +992,7 @@ SchemaSettings.BlockTitleItem = function () {
937
992
  var field = (0, _react.useField)();
938
993
  var fieldSchema = (0, _react.useFieldSchema)();
939
994
 
940
- var _useDesignable = (0, _.useDesignable)(),
995
+ var _useDesignable = (0, _2.useDesignable)(),
941
996
  dn = _useDesignable.dn;
942
997
 
943
998
  var _useTranslation5 = (0, _reactI18next.useTranslation)(),
@@ -972,4 +1027,144 @@ SchemaSettings.BlockTitleItem = function () {
972
1027
  dn.refresh();
973
1028
  }
974
1029
  });
1030
+ };
1031
+
1032
+ SchemaSettings.LinkageRules = function (props) {
1033
+ var collectionName = props.collectionName;
1034
+ var fieldSchema = (0, _react.useFieldSchema)();
1035
+
1036
+ var _useDesignable2 = (0, _2.useDesignable)(),
1037
+ dn = _useDesignable2.dn;
1038
+
1039
+ var _useTranslation6 = (0, _reactI18next.useTranslation)(),
1040
+ t = _useTranslation6.t;
1041
+
1042
+ var _useSchemaTemplateMan4 = (0, _schemaTemplates.useSchemaTemplateManager)(),
1043
+ getTemplateById = _useSchemaTemplateMan4.getTemplateById;
1044
+
1045
+ var type = fieldSchema['x-component'] === 'Action' ? 'button' : 'field';
1046
+ var gridSchema = findGridSchema(fieldSchema) || fieldSchema;
1047
+ return /*#__PURE__*/_react2.default.createElement(SchemaSettings.ModalItem, {
1048
+ title: t('Linkage rules'),
1049
+ components: {
1050
+ ArrayCollapse: _antd.ArrayCollapse,
1051
+ FormLayout: _antd.FormLayout
1052
+ },
1053
+ width: 750,
1054
+ schema: {
1055
+ type: 'object',
1056
+ title: t('Linkage rules'),
1057
+ properties: {
1058
+ fieldReaction: {
1059
+ 'x-component': _LinkageRules.FormLinkageRules,
1060
+ 'x-component-props': {
1061
+ useProps: function useProps() {
1062
+ var options = (0, _2.useCollectionFilterOptions)(collectionName);
1063
+ return {
1064
+ options: options,
1065
+ defaultValues: (gridSchema === null || gridSchema === void 0 ? void 0 : gridSchema['x-linkage-rules']) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-linkage-rules']),
1066
+ type: type,
1067
+ linkageOptions: (0, _actionHooks.useLinkageCollectionFieldOptions)(collectionName),
1068
+ collectionName: collectionName
1069
+ };
1070
+ }
1071
+ }
1072
+ }
1073
+ }
1074
+ },
1075
+ onSubmit: function onSubmit(v) {
1076
+ var rules = [];
1077
+
1078
+ var _iterator = _createForOfIteratorHelper(v.fieldReaction.rules),
1079
+ _step;
1080
+
1081
+ try {
1082
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1083
+ var rule = _step.value;
1084
+ rules.push(_lodash.default.pickBy(rule, _lodash.default.identity));
1085
+ }
1086
+ } catch (err) {
1087
+ _iterator.e(err);
1088
+ } finally {
1089
+ _iterator.f();
1090
+ }
1091
+
1092
+ var templateId = gridSchema['x-component'] === 'BlockTemplate' && gridSchema['x-component-props'].templateId;
1093
+ var uid = templateId && getTemplateById(templateId).uid || gridSchema['x-uid'];
1094
+
1095
+ var schema = _defineProperty({}, 'x-uid', uid);
1096
+
1097
+ gridSchema['x-linkage-rules'] = rules;
1098
+ schema['x-linkage-rules'] = rules;
1099
+ dn.emit('patch', {
1100
+ schema: schema
1101
+ });
1102
+ dn.refresh();
1103
+ }
1104
+ });
1105
+ };
1106
+
1107
+ SchemaSettings.EnableChildCollections = function (props) {
1108
+ var collectionName = props.collectionName;
1109
+ var fieldSchema = (0, _react.useFieldSchema)();
1110
+
1111
+ var _useDesignable3 = (0, _2.useDesignable)(),
1112
+ dn = _useDesignable3.dn;
1113
+
1114
+ var _useTranslation7 = (0, _reactI18next.useTranslation)(),
1115
+ t = _useTranslation7.t;
1116
+
1117
+ return /*#__PURE__*/_react2.default.createElement(SchemaSettings.ModalItem, {
1118
+ title: t('Enable child collections'),
1119
+ components: {
1120
+ ArrayItems: _antd.ArrayItems,
1121
+ FormLayout: _antd.FormLayout
1122
+ },
1123
+ width: 600,
1124
+ schema: {
1125
+ type: 'object',
1126
+ title: t('Enable child collections'),
1127
+ properties: {
1128
+ enableChildren: {
1129
+ 'x-component': _EnableChildCollections.EnableChildCollections,
1130
+ 'x-component-props': {
1131
+ useProps: function useProps() {
1132
+ return {
1133
+ defaultValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-enable-children'],
1134
+ collectionName: collectionName
1135
+ };
1136
+ }
1137
+ }
1138
+ }
1139
+ }
1140
+ },
1141
+ onSubmit: function onSubmit(v) {
1142
+ var enableChildren = [];
1143
+
1144
+ var _iterator2 = _createForOfIteratorHelper(v.enableChildren.childrenCollections),
1145
+ _step2;
1146
+
1147
+ try {
1148
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1149
+ var item = _step2.value;
1150
+ enableChildren.push(_lodash.default.pickBy(item, _lodash.default.identity));
1151
+ }
1152
+ } catch (err) {
1153
+ _iterator2.e(err);
1154
+ } finally {
1155
+ _iterator2.f();
1156
+ }
1157
+
1158
+ var uid = fieldSchema['x-uid'];
1159
+
1160
+ var schema = _defineProperty({}, 'x-uid', uid);
1161
+
1162
+ fieldSchema['x-enable-children'] = enableChildren;
1163
+ schema['x-enable-children'] = enableChildren;
1164
+ dn.emit('patch', {
1165
+ schema: schema
1166
+ });
1167
+ dn.refresh();
1168
+ }
1169
+ });
975
1170
  };
@@ -46,6 +46,13 @@ var BlockTemplate = (0, _react.observer)(function (props) {
46
46
  var template = (0, _react2.useMemo)(function () {
47
47
  return getTemplateById(templateId);
48
48
  }, [templateId]);
49
+
50
+ var onSuccess = function onSuccess(data) {
51
+ var _data$data;
52
+
53
+ fieldSchema['x-linkage-rules'] = (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data['x-linkage-rules']) || [];
54
+ };
55
+
49
56
  return template ? /*#__PURE__*/_react2.default.createElement(BlockTemplateContext.Provider, {
50
57
  value: {
51
58
  dn: dn,
@@ -55,7 +62,8 @@ var BlockTemplate = (0, _react.observer)(function (props) {
55
62
  }
56
63
  }, /*#__PURE__*/_react2.default.createElement(_.RemoteSchemaComponent, {
57
64
  noForm: true,
58
- uid: template === null || template === void 0 ? void 0 : template.uid
65
+ uid: template === null || template === void 0 ? void 0 : template.uid,
66
+ onSuccess: onSuccess
59
67
  })) : null;
60
68
  });
61
69
  exports.BlockTemplate = BlockTemplate;
@@ -336,7 +336,7 @@ var schema2 = {
336
336
  },
337
337
  properties: {
338
338
  submit: {
339
- title: 'Submit',
339
+ title: '{{t("Submit")}}',
340
340
  'x-component': 'Action',
341
341
  'x-component-props': {
342
342
  type: 'primary',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.9.0-alpha.2",
3
+ "version": "0.9.1-alpha.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib",
6
6
  "module": "es/index.js",
@@ -13,8 +13,8 @@
13
13
  "@formily/antd": "2.0.20",
14
14
  "@formily/core": "2.0.20",
15
15
  "@formily/react": "2.0.20",
16
- "@nocobase/sdk": "0.9.0-alpha.2",
17
- "@nocobase/utils": "0.9.0-alpha.2",
16
+ "@nocobase/sdk": "0.9.1-alpha.2",
17
+ "@nocobase/utils": "0.9.1-alpha.2",
18
18
  "ahooks": "^3.7.2",
19
19
  "antd": "4.22.8",
20
20
  "axios": "^0.26.1",
@@ -55,5 +55,5 @@
55
55
  "@types/marked": "^4.0.1",
56
56
  "axios-mock-adapter": "^1.20.0"
57
57
  },
58
- "gitHead": "b8f76ad38e60e677c5bb4aab0a4cdb28d98a0f49"
58
+ "gitHead": "d588a68eca4feed4642a4cb317301011266fe5c9"
59
59
  }