@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
@@ -7,45 +7,24 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
7
7
  import { useField, useFieldSchema } from '@formily/react';
8
8
  import React from 'react';
9
9
  import { useTranslation } from 'react-i18next';
10
- import { useCompile, useDesignable } from '../..';
10
+ import { useDesignable } from '../..';
11
11
  import { useCalendarBlockContext } from '../../../block-provider';
12
- import { useCollection } from '../../../collection-manager';
12
+ import { useCollection, useCollectionManager } from '../../../collection-manager';
13
13
  import { useCollectionFilterOptions } from '../../../collection-manager/action-hooks';
14
14
  import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
15
15
  import { useSchemaTemplate } from '../../../schema-templates';
16
-
17
- var useOptions = function useOptions() {
18
- var _fields$filter;
19
-
20
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'string';
21
- var compile = useCompile();
22
-
23
- var _useCollection = useCollection(),
24
- fields = _useCollection.fields;
25
-
26
- var options = fields === null || fields === void 0 ? void 0 : (_fields$filter = fields.filter(function (field) {
27
- return field.type === type;
28
- })) === null || _fields$filter === void 0 ? void 0 : _fields$filter.map(function (field) {
29
- var _field$uiSchema;
30
-
31
- return {
32
- value: field.name,
33
- label: compile(field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title)
34
- };
35
- });
36
- return options;
37
- };
38
-
39
16
  export var CalendarDesigner = function CalendarDesigner() {
40
17
  var _fieldSchema$xDecora, _fieldSchema$xDecora$, _fieldSchema$xDecora2, _fieldSchema$xDecora3;
41
18
 
42
19
  var field = useField();
43
20
  var fieldSchema = useFieldSchema();
44
21
 
45
- var _useCollection2 = useCollection(),
46
- name = _useCollection2.name,
47
- title = _useCollection2.title,
48
- fields = _useCollection2.fields;
22
+ var _useCollection = useCollection(),
23
+ name = _useCollection.name,
24
+ title = _useCollection.title;
25
+
26
+ var _useCollectionManager = useCollectionManager(),
27
+ getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
49
28
 
50
29
  var dataSource = useCollectionFilterOptions(name);
51
30
 
@@ -55,8 +34,6 @@ export var CalendarDesigner = function CalendarDesigner() {
55
34
  var _useDesignable = useDesignable(),
56
35
  dn = _useDesignable.dn;
57
36
 
58
- var compile = useCompile();
59
-
60
37
  var _useTranslation = useTranslation(),
61
38
  t = _useTranslation.t;
62
39
 
@@ -70,7 +47,7 @@ export var CalendarDesigner = function CalendarDesigner() {
70
47
  }, /*#__PURE__*/React.createElement(SchemaSettings.BlockTitleItem, null), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
71
48
  title: t('Title field'),
72
49
  value: fieldNames.title,
73
- options: useOptions('string'),
50
+ options: getCollectionFieldsOptions(name, 'string'),
74
51
  onChange: function onChange(title) {
75
52
  var _schema;
76
53
 
@@ -99,10 +76,12 @@ export var CalendarDesigner = function CalendarDesigner() {
99
76
  });
100
77
  dn.refresh();
101
78
  }
102
- }), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
79
+ }), /*#__PURE__*/React.createElement(SchemaSettings.CascaderItem, {
103
80
  title: t('Start date field'),
104
81
  value: fieldNames.start,
105
- options: useOptions('date'),
82
+ options: getCollectionFieldsOptions(name, 'date', {
83
+ association: ['o2o', 'obo', 'oho', 'm2o']
84
+ }),
106
85
  onChange: function onChange(start) {
107
86
  var _schema3;
108
87
 
@@ -116,10 +95,12 @@ export var CalendarDesigner = function CalendarDesigner() {
116
95
  });
117
96
  dn.refresh();
118
97
  }
119
- }), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
98
+ }), /*#__PURE__*/React.createElement(SchemaSettings.CascaderItem, {
120
99
  title: t('End date field'),
121
100
  value: fieldNames.end,
122
- options: useOptions('date'),
101
+ options: getCollectionFieldsOptions(name, 'date', {
102
+ association: ['o2o', 'obo', 'oho', 'm2o']
103
+ }),
123
104
  onChange: function onChange(end) {
124
105
  var _schema4;
125
106
 
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import { CheckOutlined } from '@ant-design/icons';
7
+ import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
8
8
  import { connect, mapProps, mapReadPretty, useField } from '@formily/react';
9
9
  import { isValid } from '@formily/shared';
10
10
  import { Checkbox as AntdCheckbox, Tag } from 'antd';
@@ -21,17 +21,18 @@ export var Checkbox = connect(function (props) {
21
21
  }, mapProps({
22
22
  value: 'checked',
23
23
  onInput: 'onChange'
24
- }, function (props, field) {
25
- // console.log({ props, field });
26
- return _objectSpread({}, props);
27
24
  }), mapReadPretty(function (props) {
28
- if (!isValid(props.value)) {
29
- return null;
25
+ if (props.value) {
26
+ return /*#__PURE__*/React.createElement(CheckOutlined, {
27
+ style: {
28
+ color: '#52c41a'
29
+ }
30
+ });
30
31
  }
31
32
 
32
- return props.value ? /*#__PURE__*/React.createElement(CheckOutlined, {
33
+ return props.showUnchecked ? /*#__PURE__*/React.createElement(CloseOutlined, {
33
34
  style: {
34
- color: '#52c41a'
35
+ color: '#ff4d4f'
35
36
  }
36
37
  }) : null;
37
38
  }));
@@ -5,4 +5,4 @@ export interface Moment2strOptions {
5
5
  picker?: 'year' | 'month' | 'week' | 'quarter';
6
6
  }
7
7
  export declare const moment2str: (value?: moment.Moment | moment.Moment[], options?: Moment2strOptions) => string | string[] | moment.Moment | moment.Moment[];
8
- export declare const mapDateFormat: () => (props: any) => any;
8
+ export declare const mapDateFormat: () => (props: any, field: any) => any;
@@ -60,7 +60,7 @@ export var moment2str = function moment2str(value) {
60
60
  return toGmtByPicker(value, picker);
61
61
  };
62
62
  export var mapDateFormat = function mapDateFormat() {
63
- return function (props) {
63
+ return function (props, field) {
64
64
  var format = getDefaultFormat(props);
65
65
  var _onChange = props.onChange;
66
66
  return _objectSpread(_objectSpread({}, props), {}, {
@@ -57,7 +57,8 @@ var VariableCascader = connect(function (props) {
57
57
  });
58
58
  export var DynamicComponent = function DynamicComponent(props) {
59
59
  var _useContext = useContext(FilterContext),
60
- dynamicComponent = _useContext.dynamicComponent;
60
+ dynamicComponent = _useContext.dynamicComponent,
61
+ disabled = _useContext.disabled;
61
62
 
62
63
  var component = useComponent(dynamicComponent);
63
64
  var form = useMemo(function () {
@@ -65,6 +66,7 @@ export var DynamicComponent = function DynamicComponent(props) {
65
66
  values: {
66
67
  value: props.value
67
68
  },
69
+ disabled: disabled,
68
70
  effects: function effects() {
69
71
  onFieldValueChange('value', function (field) {
70
72
  var _props$onChange;
@@ -46,7 +46,8 @@ export var Filter = observer(function (props) {
46
46
  field: field,
47
47
  fieldSchema: fieldSchema,
48
48
  dynamicComponent: dynamicComponent,
49
- options: options || field.dataSource || []
49
+ options: options || field.dataSource || [],
50
+ disabled: props.disabled
50
51
  }
51
52
  }, /*#__PURE__*/React.createElement(FilterGroup, _objectSpread(_objectSpread({}, props), {}, {
52
53
  bordered: false
@@ -21,7 +21,8 @@ import { FilterLogicContext, RemoveConditionContext } from './context';
21
21
  import { FilterItems } from './FilterItems';
22
22
  export var FilterGroup = connect(function (props) {
23
23
  var _props$bordered = props.bordered,
24
- bordered = _props$bordered === void 0 ? true : _props$bordered;
24
+ bordered = _props$bordered === void 0 ? true : _props$bordered,
25
+ disabled = props.disabled;
25
26
  var field = useField();
26
27
  var remove = useContext(RemoveConditionContext);
27
28
 
@@ -36,6 +37,7 @@ export var FilterGroup = connect(function (props) {
36
37
  field.value = _defineProperty({}, value, _toConsumableArray(obj[logic] || []));
37
38
  };
38
39
 
40
+ var mergedDisabled = disabled || field.disabled;
39
41
  return /*#__PURE__*/React.createElement(FilterLogicContext.Provider, {
40
42
  value: logic
41
43
  }, /*#__PURE__*/React.createElement("div", {
@@ -48,7 +50,7 @@ export var FilterGroup = connect(function (props) {
48
50
  position: 'relative',
49
51
  marginBottom: 8
50
52
  }
51
- }, remove && /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
53
+ }, remove && !mergedDisabled && /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
52
54
  style: {
53
55
  position: 'absolute',
54
56
  right: 10,
@@ -76,8 +78,9 @@ export var FilterGroup = connect(function (props) {
76
78
  value: '$or'
77
79
  }, "Any")), ' conditions in the group')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ArrayField, {
78
80
  name: logic,
79
- component: [FilterItems]
80
- })), /*#__PURE__*/React.createElement(Space, {
81
+ component: [FilterItems],
82
+ disabled: mergedDisabled
83
+ })), !mergedDisabled && /*#__PURE__*/React.createElement(Space, {
81
84
  size: 16,
82
85
  style: {
83
86
  marginTop: 8,
@@ -1,4 +1,4 @@
1
- var _templateObject;
1
+ var _templateObject, _templateObject2;
2
2
 
3
3
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
4
4
 
@@ -49,6 +49,7 @@ export var FilterItem = observer(function (props) {
49
49
  },
50
50
  placeholder: t('Select Field')
51
51
  }), /*#__PURE__*/React.createElement(Select, {
52
+ className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 110px;\n "]))),
52
53
  value: operator === null || operator === void 0 ? void 0 : operator.value,
53
54
  options: compile(operators),
54
55
  onChange: function onChange(value) {
@@ -61,7 +62,7 @@ export var FilterItem = observer(function (props) {
61
62
  onChange: function onChange(value) {
62
63
  setValue(value);
63
64
  }
64
- }), /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
65
+ }), !props.disabled && /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
65
66
  onClick: function onClick() {
66
67
  return remove();
67
68
  },
@@ -6,6 +6,7 @@ export interface FilterContextProps {
6
6
  fieldSchema?: Schema;
7
7
  dynamicComponent?: any;
8
8
  options?: any[];
9
+ disabled?: boolean;
9
10
  }
10
11
  export declare const RemoveConditionContext: import("react").Context<any>;
11
12
  export declare const FilterContext: import("react").Context<FilterContextProps>;
@@ -19,6 +19,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
19
19
  import { useField } from '@formily/react';
20
20
  import { merge } from '@formily/shared';
21
21
  import flat from 'flat';
22
+ import cloneDeep from 'lodash/cloneDeep';
22
23
  import get from 'lodash/get';
23
24
  import { useContext, useEffect } from 'react';
24
25
  import { FilterContext, FilterLogicContext } from './context'; // import { useValues } from './useValues';
@@ -60,6 +61,7 @@ export var useValues = function useValues() {
60
61
  var value2data = function value2data() {
61
62
  var _operators$find;
62
63
 
64
+ field.data = field.data || {};
63
65
  var values = flat(field.value);
64
66
  var path = Object.keys(values).shift() || '';
65
67
 
@@ -69,8 +71,10 @@ export var useValues = function useValues() {
69
71
 
70
72
  var _path$split = path.split('.$'),
71
73
  _path$split2 = _slicedToArray(_path$split, 2),
72
- fieldPath = _path$split2[0],
73
- otherPath = _path$split2[1];
74
+ _path$split2$ = _path$split2[0],
75
+ fieldPath = _path$split2$ === void 0 ? '' : _path$split2$,
76
+ _path$split2$2 = _path$split2[1],
77
+ otherPath = _path$split2$2 === void 0 ? '' : _path$split2$2;
74
78
 
75
79
  var _otherPath$split = otherPath.split('.', 2),
76
80
  _otherPath$split2 = _slicedToArray(_otherPath$split, 1),
@@ -82,7 +86,6 @@ export var useValues = function useValues() {
82
86
  var operator = operators === null || operators === void 0 ? void 0 : (_operators$find = operators.find) === null || _operators$find === void 0 ? void 0 : _operators$find.call(operators, function (item) {
83
87
  return item.value === "$".concat(operatorValue);
84
88
  });
85
- field.data = field.data || {};
86
89
  field.data.dataIndex = dataIndex;
87
90
  field.data.operators = operators;
88
91
  field.data.operator = operator;
@@ -90,9 +93,7 @@ export var useValues = function useValues() {
90
93
  field.data.value = get(field.value, "".concat(fieldPath, ".$").concat(operatorValue));
91
94
  };
92
95
 
93
- useEffect(function () {
94
- value2data();
95
- }, [logic]);
96
+ useEffect(value2data, [logic]);
96
97
  return _objectSpread(_objectSpread({
97
98
  fields: options
98
99
  }, field.data), {}, {
@@ -104,11 +105,12 @@ export var useValues = function useValues() {
104
105
  field.data = field.data || {};
105
106
  field.data.operators = option === null || option === void 0 ? void 0 : option.operators;
106
107
  field.data.operator = operator;
107
- field.data.schema = merge(option === null || option === void 0 ? void 0 : option.schema, operator === null || operator === void 0 ? void 0 : operator.schema);
108
+ var s1 = cloneDeep(option === null || option === void 0 ? void 0 : option.schema);
109
+ var s2 = cloneDeep(operator === null || operator === void 0 ? void 0 : operator.schema);
110
+ field.data.schema = merge(s1, s2);
108
111
  field.data.dataIndex = dataIndex;
109
112
  field.data.value = null;
110
113
  data2value();
111
- console.log('setDataIndex', field.data);
112
114
  },
113
115
  setOperator: function setOperator(operatorValue) {
114
116
  var _field$data3, _field$data3$operator, _field$data3$operator2;
@@ -117,15 +119,16 @@ export var useValues = function useValues() {
117
119
  return item.value === operatorValue;
118
120
  });
119
121
  field.data.operator = operator;
120
- field.data.schema = merge(field.data.schema, operator.schema);
122
+ var option = findOption(field.data.dataIndex, options);
123
+ var s1 = cloneDeep(option === null || option === void 0 ? void 0 : option.schema);
124
+ var s2 = cloneDeep(operator === null || operator === void 0 ? void 0 : operator.schema);
125
+ field.data.schema = merge(s1, s2);
121
126
  field.data.value = operator.noValue ? operator.default || true : null;
122
127
  data2value();
123
- console.log('setOperator', field.data);
124
128
  },
125
129
  setValue: function setValue(value) {
126
130
  field.data.value = value;
127
131
  data2value();
128
- console.log('setValue', field.data);
129
132
  }
130
133
  });
131
134
  };
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["form", "children"],
2
- _excluded2 = ["form", "children"],
2
+ _excluded2 = ["form", "children", "disabled"],
3
3
  _excluded3 = ["request", "effects", "initialValue", "useValues"];
4
4
 
5
5
  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); } }
@@ -19,8 +19,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
19
19
  import { FormLayout } from '@formily/antd';
20
20
  import { createForm } from '@formily/core';
21
21
  import { FieldContext, FormContext, observer, RecursionField, useField, useFieldSchema } from '@formily/react';
22
- import { Spin } from 'antd';
23
- import React, { createContext, useContext, useMemo } from 'react';
22
+ import { ConfigProvider, Spin } from 'antd';
23
+ import React, { createContext, useContext, useEffect, useMemo } from 'react';
24
24
  import { useAttach, useComponent } from '../..';
25
25
  import { useRequest } from '../../../api-client';
26
26
  import { useCollection } from '../../../collection-manager';
@@ -58,6 +58,7 @@ var Def = function Def(props) {
58
58
  var FormDecorator = function FormDecorator(props) {
59
59
  var form = props.form,
60
60
  children = props.children,
61
+ disabled = props.disabled,
61
62
  others = _objectWithoutProperties(props, _excluded2);
62
63
 
63
64
  var field = useField();
@@ -67,7 +68,12 @@ var FormDecorator = function FormDecorator(props) {
67
68
  basePath: ''
68
69
  })));
69
70
  var Component = useComponent(fieldSchema['x-component'], Def);
70
- return /*#__PURE__*/React.createElement(FieldContext.Provider, {
71
+ useEffect(function () {
72
+ form.disabled = disabled || field.disabled;
73
+ }, [disabled, field.disabled]);
74
+ return /*#__PURE__*/React.createElement(ConfigProvider, {
75
+ componentDisabled: disabled
76
+ }, /*#__PURE__*/React.createElement(FieldContext.Provider, {
71
77
  value: undefined
72
78
  }, /*#__PURE__*/React.createElement(FormContext.Provider, {
73
79
  value: form
@@ -79,7 +85,7 @@ var FormDecorator = function FormDecorator(props) {
79
85
  basePath: f.address,
80
86
  schema: fieldSchema,
81
87
  onlyRenderProperties: true
82
- }))))));
88
+ })))))));
83
89
  };
84
90
 
85
91
  var useRequestProps = function useRequestProps(props) {
@@ -16,13 +16,13 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
16
16
 
17
17
  import { css } from '@emotion/css';
18
18
  import { ArrayCollapse, FormItem as Item, FormLayout } from '@formily/antd';
19
- import { useField, useFieldSchema } from '@formily/react';
19
+ import { observer, useField, useFieldSchema } from '@formily/react';
20
20
  import { uid } from '@formily/shared';
21
21
  import _ from 'lodash';
22
- import React from 'react';
22
+ import React, { useContext, useEffect } from 'react';
23
23
  import { useTranslation } from 'react-i18next';
24
24
  import { ACLCollectionFieldProvider } from '../../../acl/ACLProvider';
25
- import { useFilterByTk, useFormBlockContext } from '../../../block-provider';
25
+ import { BlockRequestContext, useFilterByTk, useFormBlockContext } from '../../../block-provider';
26
26
  import { useCollection, useCollectionManager } from '../../../collection-manager';
27
27
  import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
28
28
  import { useCompile, useDesignable, useFieldComponentOptions } from '../../hooks';
@@ -37,8 +37,17 @@ var divWrap = function divWrap(schema) {
37
37
  };
38
38
  };
39
39
 
40
- export var FormItem = function FormItem(props) {
40
+ export var FormItem = observer(function (props) {
41
41
  var field = useField();
42
+ var ctx = useContext(BlockRequestContext);
43
+ var schema = useFieldSchema();
44
+ useEffect(function () {
45
+ if ((ctx === null || ctx === void 0 ? void 0 : ctx.block) === 'form') {
46
+ ctx.field.data = ctx.field.data || {};
47
+ ctx.field.data.activeFields = ctx.field.data.activeFields || new Set();
48
+ ctx.field.data.activeFields.add(schema.name);
49
+ }
50
+ }, []);
42
51
  return /*#__PURE__*/React.createElement(ACLCollectionFieldProvider, null, /*#__PURE__*/React.createElement(BlockItem, {
43
52
  className: 'nb-form-item'
44
53
  }, /*#__PURE__*/React.createElement(Item, _objectSpread(_objectSpread({
@@ -50,10 +59,10 @@ export var FormItem = function FormItem(props) {
50
59
  }
51
60
  }) : field.description
52
61
  }))));
53
- };
62
+ });
54
63
 
55
64
  FormItem.Designer = function (props) {
56
- var _interfaceConfig$vali, _collectionField$uiSc, _collectionField$uiSc2, _fieldSchema$xDecora, _collectionField$uiSc4, _fieldSchema$xCompon, _field$componentProps, _field$componentProps2;
65
+ var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _collectionField$uiSc2, _fieldSchema$xDecora, _collectionField$uiSc4, _fieldSchema$xCompon, _field$componentProps, _field$componentProps2;
57
66
 
58
67
  var _useCollectionManager = useCollectionManager(),
59
68
  getCollectionFields = _useCollectionManager.getCollectionFields,
@@ -85,7 +94,7 @@ FormItem.Designer = function (props) {
85
94
  var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
86
95
  var validateSchema = interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$vali = interfaceConfig['validateSchema']) === null || _interfaceConfig$vali === void 0 ? void 0 : _interfaceConfig$vali.call(interfaceConfig, fieldSchema);
87
96
  var originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title;
88
- var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField.target) : [];
97
+ var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField.target) : (_getCollectionFields = getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection)) !== null && _getCollectionFields !== void 0 ? _getCollectionFields : [];
89
98
  var fieldComponentOptions = useFieldComponentOptions();
90
99
  var isSubFormAssocitionField = field.address.segments.includes('__form_grid');
91
100
  var initialValue = {
@@ -491,7 +500,7 @@ FormItem.Designer = function (props) {
491
500
  });
492
501
  dn.refresh();
493
502
  }
494
- }), (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) && fieldSchema['x-component'] === 'CollectionField' && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
503
+ }), options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
495
504
  key: "title-field",
496
505
  title: t('Title field'),
497
506
  options: options,
@@ -45,6 +45,8 @@ export var FormDesigner = function FormDesigner() {
45
45
  componentName: 'FormItem',
46
46
  collectionName: name,
47
47
  resourceName: defaultResource
48
+ }), /*#__PURE__*/React.createElement(SchemaSettings.LinkageRules, {
49
+ collectionName: name
48
50
  }), /*#__PURE__*/React.createElement(SchemaSettings.Divider, null), /*#__PURE__*/React.createElement(SchemaSettings.Remove, {
49
51
  removeParentsIfNoChildren: true,
50
52
  breakRemoveOn: {
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["form", "children"],
2
- _excluded2 = ["form", "children"],
3
- _excluded3 = ["form"];
2
+ _excluded2 = ["form", "children", "disabled"],
3
+ _excluded3 = ["form", "disabled"];
4
4
 
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
 
@@ -13,14 +13,15 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
13
13
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
14
14
 
15
15
  import { FormLayout } from '@formily/antd';
16
- import { createForm, onFormInputChange } from '@formily/core';
16
+ import { createForm, onFormInputChange, onFieldReact, onFieldInit, onFieldChange } from '@formily/core';
17
17
  import { FieldContext, FormContext, observer, RecursionField, useField, useFieldSchema } from '@formily/react';
18
18
  import { uid } from '@formily/shared';
19
- import { Spin } from 'antd';
19
+ import { ConfigProvider, Spin } from 'antd';
20
20
  import React, { useEffect, useMemo } from 'react';
21
21
  import { useActionContext } from '..';
22
22
  import { useAttach, useComponent } from '../..';
23
23
  import { useProps } from '../../hooks/useProps';
24
+ import { linkageMergeAction } from './utils';
24
25
 
25
26
  var FormComponent = function FormComponent(props) {
26
27
  var form = props.form,
@@ -53,6 +54,7 @@ var Def = function Def(props) {
53
54
  var FormDecorator = function FormDecorator(props) {
54
55
  var form = props.form,
55
56
  children = props.children,
57
+ disabled = props.disabled,
56
58
  others = _objectWithoutProperties(props, _excluded2);
57
59
 
58
60
  var field = useField();
@@ -77,13 +79,26 @@ var FormDecorator = function FormDecorator(props) {
77
79
  }))))));
78
80
  };
79
81
 
82
+ var getLinkageRules = function getLinkageRules(fieldSchema) {
83
+ var linkageRules = null;
84
+ fieldSchema.mapProperties(function (schema) {
85
+ if (schema['x-linkage-rules']) {
86
+ linkageRules = schema['x-linkage-rules'];
87
+ }
88
+ });
89
+ return linkageRules;
90
+ };
91
+
80
92
  var WithForm = function WithForm(props) {
93
+ var _fieldSchema$parent;
94
+
81
95
  var form = props.form;
82
96
  var fieldSchema = useFieldSchema();
83
97
 
84
98
  var _useActionContext = useActionContext(),
85
99
  setFormValueChanged = _useActionContext.setFormValueChanged;
86
100
 
101
+ var linkageRules = getLinkageRules(fieldSchema) || ((_fieldSchema$parent = fieldSchema.parent) === null || _fieldSchema$parent === void 0 ? void 0 : _fieldSchema$parent['x-linkage-rules']) || [];
87
102
  useEffect(function () {
88
103
  var id = uid();
89
104
  form.addEffects(id, function () {
@@ -91,10 +106,73 @@ var WithForm = function WithForm(props) {
91
106
  setFormValueChanged === null || setFormValueChanged === void 0 ? void 0 : setFormValueChanged(true);
92
107
  });
93
108
  });
109
+
110
+ if (props.disabled) {
111
+ form.disabled = props.disabled;
112
+ }
113
+
114
+ return function () {
115
+ form.removeEffects(id);
116
+ };
117
+ }, []);
118
+ useEffect(function () {
119
+ var id = uid();
120
+ form.addEffects(id, function () {
121
+ return linkageRules.map(function (v) {
122
+ var _v$actions;
123
+
124
+ return (_v$actions = v.actions) === null || _v$actions === void 0 ? void 0 : _v$actions.map(function (h) {
125
+ if (h.targetFields) {
126
+ var fields = h.targetFields.join(',');
127
+ onFieldInit("*(".concat(fields, ")"), function (field, form) {
128
+ field['initProperty'] = {
129
+ display: field.display,
130
+ required: field.required,
131
+ pattern: field.pattern,
132
+ value: field.value || field.initialValue
133
+ };
134
+ });
135
+ onFieldChange("*(".concat(fields, ")"), ['value', 'required', 'pattern', 'display'], function (field) {
136
+ field.linkageProperty = {};
137
+ });
138
+ }
139
+ });
140
+ });
141
+ });
94
142
  return function () {
95
143
  form.removeEffects(id);
96
144
  };
97
145
  }, []);
146
+ useEffect(function () {
147
+ var id = uid();
148
+ form.addEffects(id, function () {
149
+ var linkagefields = [];
150
+ return linkageRules.map(function (v, index) {
151
+ var _v$actions2;
152
+
153
+ return (_v$actions2 = v.actions) === null || _v$actions2 === void 0 ? void 0 : _v$actions2.map(function (h) {
154
+ if (h.targetFields) {
155
+ var fields = h.targetFields.join(',');
156
+ return onFieldReact("*(".concat(fields, ")"), function (field, form) {
157
+ linkagefields.push(field);
158
+ linkageMergeAction(h, field, v.condition, form === null || form === void 0 ? void 0 : form.values);
159
+
160
+ if (index === linkageRules.length - 1) {
161
+ setTimeout(function () {
162
+ return linkagefields.map(function (v) {
163
+ v.linkageProperty = {};
164
+ });
165
+ });
166
+ }
167
+ });
168
+ }
169
+ });
170
+ });
171
+ });
172
+ return function () {
173
+ form.removeEffects(id);
174
+ };
175
+ }, [linkageRules]);
98
176
  return fieldSchema['x-decorator'] === 'Form' ? /*#__PURE__*/React.createElement(FormDecorator, _objectSpread({}, props)) : /*#__PURE__*/React.createElement(FormComponent, _objectSpread({}, props));
99
177
  };
100
178
 
@@ -106,6 +184,7 @@ var WithoutForm = function WithoutForm(props) {
106
184
 
107
185
  var form = useMemo(function () {
108
186
  return createForm({
187
+ disabled: props.disabled,
109
188
  effects: function effects() {
110
189
  onFormInputChange(function (form) {
111
190
  setFormValueChanged === null || setFormValueChanged === void 0 ? void 0 : setFormValueChanged(true);
@@ -125,11 +204,19 @@ export var Form = observer(function (props) {
125
204
 
126
205
  var _useProps = useProps(props),
127
206
  form = _useProps.form,
207
+ disabled = _useProps.disabled,
128
208
  others = _objectWithoutProperties(_useProps, _excluded3);
129
209
 
130
- return /*#__PURE__*/React.createElement("form", null, /*#__PURE__*/React.createElement(Spin, {
210
+ var formDisabled = disabled || field.disabled;
211
+ return /*#__PURE__*/React.createElement(ConfigProvider, {
212
+ componentDisabled: formDisabled
213
+ }, /*#__PURE__*/React.createElement("form", null, /*#__PURE__*/React.createElement(Spin, {
131
214
  spinning: field.loading || false
132
- }, form ? /*#__PURE__*/React.createElement(WithForm, _objectSpread({
215
+ }, form ? /*#__PURE__*/React.createElement(WithForm, _objectSpread(_objectSpread({
133
216
  form: form
134
- }, others)) : /*#__PURE__*/React.createElement(WithoutForm, _objectSpread({}, others))));
217
+ }, others), {}, {
218
+ disabled: formDisabled
219
+ })) : /*#__PURE__*/React.createElement(WithoutForm, _objectSpread(_objectSpread({}, others), {}, {
220
+ disabled: formDisabled
221
+ })))));
135
222
  });
@@ -0,0 +1,5 @@
1
+ export declare function evaluate(expression: string, scope?: {}): any;
2
+ export declare const linkageMergeAction: ({ operator, value }: {
3
+ operator: any;
4
+ value: any;
5
+ }, field: any, condition: any, values: any) => any;