@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
@@ -34,6 +34,30 @@ export default {
34
34
  "UI editor": "界面配置",
35
35
  "Collection": "数据表",
36
36
  "Collections & Fields": "数据表配置",
37
+ "All collections": "全部数据表",
38
+ "Add category": "添加分类",
39
+ "Delete category": "删除分类",
40
+ "Edit category": "编辑分类",
41
+ "Collection category": "数据表类别",
42
+ "Visible": "显示",
43
+ "Read only": "只读(禁止编辑)",
44
+ "Easy reading": "只读(阅读模式)",
45
+ "Hidden": "隐藏",
46
+ "Hidden(reserved value)": "隐藏(保留值)",
47
+ "Not required": "非必填",
48
+ "Value": "字段值",
49
+ "Disabled": "禁用",
50
+ "Enabled": "启用",
51
+ "Linkage rule": "联动规则",
52
+ "Linkage rules": "联动规则",
53
+ "Condition": "条件",
54
+ "Properties": "属性",
55
+ "Add linkage rule": "添加联动规则",
56
+ "Add property": "添加属性",
57
+ "Expression": "表达式",
58
+ "Sort": "排序",
59
+ "Categories": "数据表类别",
60
+ "Category name": "分类名称",
37
61
  "Roles & Permissions": "角色和权限",
38
62
  "Edit profile": "个人资料",
39
63
  "Change password": "修改密码",
@@ -127,6 +151,7 @@ export default {
127
151
  "General collection": "普通数据表",
128
152
  "Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.": "随机生成,可修改。支持英文、数字和下划线,必须以英文字母开头。",
129
153
  "Storage type": "存储类型",
154
+ "Types will be used in database": "数据库使用的类型",
130
155
  "Edit": "编辑",
131
156
  "Edit collection": "编辑数据表",
132
157
  "Configure fields": "配置字段",
@@ -146,15 +171,22 @@ export default {
146
171
  "Long text": "多行文本",
147
172
  "Phone": "手机号码",
148
173
  "Email": "电子邮箱",
174
+ 'Null': '空值',
175
+ "Boolean": "逻辑值",
149
176
  "Number": "数字",
150
177
  "Integer": "整数",
151
178
  "Percent": "百分比",
179
+ "String": "字符串",
152
180
  "Password": "密码",
153
181
  "Advanced type": "高级类型",
154
182
  "Formula": "公式",
155
183
  "Formula description": "基于同一条记录中的其他字段计算出一个值。",
184
+ "Syntax references": "语法参考",
185
+ "Math.js comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types": "Math.js 包含大量内置函数和常量,并提供了集成的解决方案来处理不同的数据类型。",
186
+ "Formula.js supports most Microsoft Excel formula functions.": "Formula.js 支持大部分 Mircrosoft Excel 公式。",
156
187
  "Choices": "选择类型",
157
188
  "Checkbox": "勾选",
189
+ "Display <icon></icon> when unchecked": "未勾选时显示 <icon></icon>",
158
190
  "Single select": "下拉菜单(单选)",
159
191
  "Multiple select": "下拉菜单(多选)",
160
192
  "Radio group": "单选框",
@@ -435,10 +467,6 @@ export default {
435
467
  '≤': '≤',
436
468
  'Role UID': '角色标识',
437
469
  'Precision': '精确度',
438
- 'Formula mode': '计算方式',
439
- 'Expression': '表达式',
440
- 'Input +, -, *, /, ( ) to calculate, input @ to open field variables.': '英文输入+、-、*、/、( ) 进行运算,输入@打开可用字段变量。',
441
- 'Formula error.': '公式验证错误。',
442
470
  'Accept': '文件格式',
443
471
  'Rich Text': '富文本',
444
472
  'Junction collection': '中间表',
@@ -593,5 +621,16 @@ export default {
593
621
  'Please fill in the iframe URL': '请填写嵌入的地址',
594
622
  'Fix block': '固定区块',
595
623
  'Plugin name': '插件',
596
- 'Plugin tab name': '插件标签页'
624
+ 'Plugin tab name': '插件标签页',
625
+ 'Enable page header': '启用页眉',
626
+ 'Display page title': '显示页面标题',
627
+ 'Edit page title': '编辑页面标题',
628
+ 'Enable page tabs': '启用页面选项卡',
629
+ 'Column width': '列宽',
630
+ 'Sortable': '可排序的',
631
+ 'Constant': '常量',
632
+ 'Use variable': '使用变量',
633
+ 'True': '真',
634
+ 'False': '假',
635
+ 'Prettify': '格式化'
597
636
  };
@@ -1,4 +1,4 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
2
2
 
3
3
  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; }
4
4
 
@@ -21,12 +21,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
 
23
23
  import { css } from '@emotion/css';
24
+ import { useMutationObserver } from 'ahooks';
24
25
  import { Layout, Spin } from 'antd';
25
26
  import React, { createContext, useContext, useMemo, useRef, useState } from 'react';
26
27
  import { useHistory, useRouteMatch } from 'react-router-dom';
27
- import { ACLRolesCheckProvider, CurrentUser, CurrentUserProvider, CurrentAppInfoProvider, findByUid, findMenuItem, RemoteCollectionManagerProvider, RemotePluginManagerToolbar, RemoteSchemaTemplateManagerProvider, SchemaComponent, useACLRoleContext, useDocumentTitle, useRequest, useRoute, useSystemSettings } from '../../../';
28
+ import { ACLRolesCheckProvider, CurrentAppInfoProvider, CurrentUser, CurrentUserProvider, findByUid, findMenuItem, RemoteCollectionManagerProvider, RemotePluginManagerToolbar, RemoteSchemaTemplateManagerProvider, SchemaComponent, useACLRoleContext, useDocumentTitle, useRequest, useRoute, useSystemSettings } from '../../../';
28
29
  import { useCollectionManager } from '../../../collection-manager';
29
- import { useMutationObserver } from 'ahooks';
30
30
 
31
31
  var filterByACL = function filterByACL(schema, options) {
32
32
  var allowAll = options.allowAll,
@@ -183,56 +183,36 @@ export var InternalAdminLayout = function InternalAdminLayout(props) {
183
183
  return /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Layout.Header, {
184
184
  className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-menu.ant-menu-dark .ant-menu-item-selected,\n .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected {\n background-color: rgba(255, 255, 255, 0.1);\n }\n .ant-menu-dark.ant-menu-horizontal > .ant-menu-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n }\n\n position: fixed;\n width: 100%;\n height: 46px;\n line-height: 46px;\n padding: 0;\n z-index: 100;\n "])))
185
185
  }, /*#__PURE__*/React.createElement("div", {
186
- className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n height: 100%;\n "])))
186
+ className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n "])))
187
187
  }, /*#__PURE__*/React.createElement("div", {
188
- style: {
189
- position: 'relative',
190
- zIndex: 1,
191
- display: 'flex',
192
- height: '100%',
193
- width: 'calc(100vw - 300px)'
194
- }
188
+ className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n flex: 1 1 auto;\n display: flex;\n height: 100%;\n "])))
195
189
  }, /*#__PURE__*/React.createElement("div", {
196
- style: {
197
- width: 200,
198
- display: 'inline-flex',
199
- color: '#fff',
200
- padding: '0',
201
- alignItems: 'center'
202
- }
190
+ className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 200px;\n display: inline-flex;\n flex-shrink: 0;\n color: #fff;\n padding: 0;\n align-items: center;\n "])))
203
191
  }, /*#__PURE__*/React.createElement("img", {
204
- className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0 16px;\n object-fit: contain;\n width: 100%;\n height: 100%;\n "]))),
192
+ className: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: 0 16px;\n object-fit: contain;\n width: 100%;\n height: 100%;\n "]))),
205
193
  src: result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : (_result$data$data = _result$data.data) === null || _result$data$data === void 0 ? void 0 : (_result$data$data$log = _result$data$data.logo) === null || _result$data$data$log === void 0 ? void 0 : _result$data$data$log.url
206
194
  })), /*#__PURE__*/React.createElement("div", {
207
- style: {
208
- width: 'calc(100% - 590px)'
209
- }
195
+ className: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n width: 0;\n "])))
210
196
  }, /*#__PURE__*/React.createElement(MenuEditor, {
211
197
  sideMenuRef: sideMenuRef
212
198
  }))), /*#__PURE__*/React.createElement("div", {
213
- style: {
214
- position: 'absolute',
215
- height: '100%',
216
- zIndex: 10,
217
- top: 0,
218
- right: 0
219
- }
199
+ className: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n flex-shrink: 0;\n height: 100%;\n z-index: 10;\n "])))
220
200
  }, /*#__PURE__*/React.createElement(RemotePluginManagerToolbar, null), /*#__PURE__*/React.createElement(CurrentUser, null)))), /*#__PURE__*/React.createElement("div", {
221
201
  style: {
222
202
  '--side-menu-width': "".concat(sideMenuWidth, "px")
223
203
  },
224
- className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: var(--side-menu-width);\n overflow: hidden;\n flex: 0 0 var(--side-menu-width);\n max-width: var(--side-menu-width);\n min-width: var(--side-menu-width);\n pointer-events: none;\n transition: background-color 0.3s ease 0s, min-width 0.3s ease 0s,\n max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;\n "])))
204
+ className: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: var(--side-menu-width);\n overflow: hidden;\n flex: 0 0 var(--side-menu-width);\n max-width: var(--side-menu-width);\n min-width: var(--side-menu-width);\n pointer-events: none;\n /* transition: background-color 0.3s ease 0s, min-width 0.3s ease 0s,\n max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s; */\n "])))
225
205
  }), /*#__PURE__*/React.createElement(Layout.Sider, {
226
- className: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n height: 100%;\n position: fixed;\n padding-top: 46px;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 100;\n "]))),
206
+ className: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n height: 100%;\n position: fixed;\n padding-top: 46px;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 100;\n "]))),
227
207
  style: {
228
208
  display: 'none'
229
209
  },
230
210
  theme: 'light',
231
211
  ref: sideMenuRef
232
212
  }), /*#__PURE__*/React.createElement(Layout.Content, {
233
- className: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n overflow-y: auto;\n height: 100vh;\n max-height: 100vh;\n > div {\n position: relative;\n // z-index: 1;\n }\n .ant-layout-footer {\n position: absolute;\n bottom: 0;\n text-align: center;\n width: 100%;\n z-index: 0;\n padding: 0px 50px;\n }\n "])))
213
+ className: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n overflow-y: auto;\n height: 100vh;\n max-height: 100vh;\n > div {\n position: relative;\n // z-index: 1;\n }\n .ant-layout-footer {\n position: absolute;\n bottom: 0;\n text-align: center;\n width: 100%;\n z-index: 0;\n padding: 0px 50px;\n }\n "])))
234
214
  }, /*#__PURE__*/React.createElement("header", {
235
- className: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: 46px;\n line-height: 46px;\n background: transparent;\n pointer-events: none;\n "])))
215
+ className: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n height: 46px;\n line-height: 46px;\n background: transparent;\n pointer-events: none;\n "])))
236
216
  }), service.contentLoading ? /*#__PURE__*/React.createElement(Spin, null) : props.children));
237
217
  };
238
218
  export var AdminLayout = function AdminLayout(props) {
@@ -27,8 +27,11 @@ import { isValid, uid } from '@formily/shared';
27
27
  import { Menu, Select } from 'antd';
28
28
  import React, { useEffect, useState } from 'react';
29
29
  import { useTranslation } from 'react-i18next';
30
- import { useActionContext, useCompile, useDesignable } from '../..';
30
+ import { useDesignable } from '../..';
31
31
  import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
32
+ import { useCollection, useCollectionManager } from '../../../collection-manager';
33
+ import { useRecord } from '../../../record-provider';
34
+ import { useFormBlockContext } from '../../../block-provider/FormBlockProvider';
32
35
  import { requestSettingsSchema } from './utils';
33
36
 
34
37
  var MenuGroup = function MenuGroup(props) {
@@ -56,7 +59,7 @@ var MenuGroup = function MenuGroup(props) {
56
59
  };
57
60
 
58
61
  export var ActionDesigner = function ActionDesigner(props) {
59
- var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _fieldSchema$xCompon6, _fieldSchema$xCompon7, _fieldSchema$xCompon8, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7, _fieldSchema$xAction8, _fieldSchema$xAction9, _fieldSchema$xAction10;
62
+ var _fieldSchema$xAction, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _fieldSchema$xCompon6, _fieldSchema$xCompon7, _fieldSchema$xCompon8, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7, _fieldSchema$xAction8, _fieldSchema$xAction9, _fieldSchema$xAction10, _fieldSchema$xAction11;
60
63
 
61
64
  var modalTip = props.modalTip,
62
65
  restProps = _objectWithoutProperties(props, _excluded);
@@ -64,23 +67,29 @@ export var ActionDesigner = function ActionDesigner(props) {
64
67
  var field = useField();
65
68
  var fieldSchema = useFieldSchema();
66
69
 
70
+ var _useCollection = useCollection(),
71
+ name = _useCollection.name;
72
+
73
+ var _useCollectionManager = useCollectionManager(),
74
+ getChildrenCollections = _useCollectionManager.getChildrenCollections;
75
+
67
76
  var _useDesignable = useDesignable(),
68
77
  dn = _useDesignable.dn;
69
78
 
70
79
  var _useTranslation2 = useTranslation(),
71
80
  t = _useTranslation2.t;
72
81
 
73
- var compile = useCompile();
74
82
  var isPopupAction = ['create', 'update', 'view', 'customize:popup'].includes(fieldSchema['x-action'] || '');
75
83
  var isUpdateModePopupAction = ['customize:bulkUpdate', 'customize:bulkEdit'].includes(fieldSchema['x-action']);
76
- var context = useActionContext();
77
84
 
78
85
  var _useState = useState(),
79
86
  _useState2 = _slicedToArray(_useState, 2),
80
87
  initialSchema = _useState2[0],
81
88
  setInitialSchema = _useState2[1];
82
89
 
83
- var actionType = fieldSchema['x-action'] || '';
90
+ var actionType = (_fieldSchema$xAction = fieldSchema['x-action']) !== null && _fieldSchema$xAction !== void 0 ? _fieldSchema$xAction : '';
91
+ var isLinkageAction = Object.keys(useFormBlockContext()).length > 0 && Object.keys(useRecord()).length > 0;
92
+ var isChildCollectionAction = getChildrenCollections(name).length > 0 && fieldSchema['x-action'] === 'create';
84
93
  useEffect(function () {
85
94
  var schemaUid = uid();
86
95
  var schema = {
@@ -160,6 +169,8 @@ export var ActionDesigner = function ActionDesigner(props) {
160
169
  dn.refresh();
161
170
  }
162
171
  }
172
+ }), isLinkageAction && /*#__PURE__*/React.createElement(SchemaSettings.LinkageRules, {
173
+ collectionName: name
163
174
  }), isPopupAction && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
164
175
  title: t('Open mode'),
165
176
  options: [{
@@ -226,7 +237,7 @@ export var ActionDesigner = function ActionDesigner(props) {
226
237
  label: t('All'),
227
238
  value: 'all'
228
239
  }],
229
- value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction === void 0 ? void 0 : _fieldSchema$xAction['updateMode'],
240
+ value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction2 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction2 === void 0 ? void 0 : _fieldSchema$xAction2['updateMode'],
230
241
  onChange: function onChange(value) {
231
242
  fieldSchema['x-action-settings']['updateMode'] = value;
232
243
  dn.emit('patch', {
@@ -237,12 +248,12 @@ export var ActionDesigner = function ActionDesigner(props) {
237
248
  });
238
249
  dn.refresh();
239
250
  }
240
- }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction2 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction2 === void 0 ? void 0 : _fieldSchema$xAction2.assignedValues) && /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
251
+ }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction3 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction3 === void 0 ? void 0 : _fieldSchema$xAction3.assignedValues) && /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
241
252
  title: t('Assign field values'),
242
253
  initialSchema: initialSchema,
243
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction3 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction3 === void 0 ? void 0 : _fieldSchema$xAction3.assignedValues,
254
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction4 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction4 === void 0 ? void 0 : _fieldSchema$xAction4.assignedValues,
244
255
  modalTip: tips[actionType],
245
- uid: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction4 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction4 === void 0 ? void 0 : _fieldSchema$xAction4.schemaUid,
256
+ uid: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.schemaUid,
246
257
  onSubmit: function onSubmit(assignedValues) {
247
258
  var _schema2;
248
259
 
@@ -252,10 +263,10 @@ export var ActionDesigner = function ActionDesigner(props) {
252
263
  });
253
264
  dn.refresh();
254
265
  }
255
- }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.requestSettings) && /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
266
+ }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction6 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction6 === void 0 ? void 0 : _fieldSchema$xAction6.requestSettings) && /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
256
267
  title: t('Request settings'),
257
268
  schema: requestSettingsSchema,
258
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction6 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction6 === void 0 ? void 0 : _fieldSchema$xAction6.requestSettings,
269
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction7 === void 0 ? void 0 : _fieldSchema$xAction7.requestSettings,
259
270
  onSubmit: function onSubmit(requestSettings) {
260
271
  var _schema3;
261
272
 
@@ -265,9 +276,9 @@ export var ActionDesigner = function ActionDesigner(props) {
265
276
  });
266
277
  dn.refresh();
267
278
  }
268
- }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction7 === void 0 ? void 0 : _fieldSchema$xAction7.skipValidator) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
279
+ }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction8 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction8 === void 0 ? void 0 : _fieldSchema$xAction8.skipValidator) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
269
280
  title: t('Skip required validation'),
270
- checked: !!(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction8 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction8 === void 0 ? void 0 : _fieldSchema$xAction8.skipValidator),
281
+ checked: !!(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction9 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction9 === void 0 ? void 0 : _fieldSchema$xAction9.skipValidator),
271
282
  onChange: function onChange(value) {
272
283
  var _schema4;
273
284
 
@@ -276,7 +287,7 @@ export var ActionDesigner = function ActionDesigner(props) {
276
287
  schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-action-settings', _objectSpread({}, fieldSchema['x-action-settings'])), _schema4)
277
288
  });
278
289
  }
279
- }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction9 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction9 === void 0 ? void 0 : _fieldSchema$xAction9['onSuccess']) && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
290
+ }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction10 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction10 === void 0 ? void 0 : _fieldSchema$xAction10['onSuccess']) && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
280
291
  title: {
281
292
  'customize:save': t('After successful save'),
282
293
  'customize:update': t('After successful update'),
@@ -284,7 +295,7 @@ export var ActionDesigner = function ActionDesigner(props) {
284
295
  'customize:form:request': t('After successful request'),
285
296
  'customize:bulkUpdate': t('After successful bulk update')
286
297
  }[actionType],
287
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction10 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction10 === void 0 ? void 0 : _fieldSchema$xAction10['onSuccess'],
298
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction11 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction11 === void 0 ? void 0 : _fieldSchema$xAction11['onSuccess'],
288
299
  schema: {
289
300
  type: 'object',
290
301
  title: {
@@ -353,6 +364,8 @@ export var ActionDesigner = function ActionDesigner(props) {
353
364
  schema: (_schema5 = {}, _defineProperty(_schema5, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema5, 'x-action-settings', fieldSchema['x-action-settings']), _schema5)
354
365
  });
355
366
  }
367
+ }), isChildCollectionAction && /*#__PURE__*/React.createElement(SchemaSettings.EnableChildCollections, {
368
+ collectionName: name
356
369
  }), /*#__PURE__*/React.createElement(SchemaSettings.Divider, null), /*#__PURE__*/React.createElement(SchemaSettings.Remove, {
357
370
  removeParentsIfNoChildren: true,
358
371
  breakRemoveOn: function breakRemoveOn(s) {
@@ -1,4 +1,4 @@
1
- var _excluded = ["popover", "confirm", "containerRefKey", "component", "useAction", "className", "icon", "title"];
1
+ var _excluded = ["popover", "confirm", "openMode", "containerRefKey", "component", "useAction", "className", "icon", "title"];
2
2
 
3
3
  var _templateObject, _templateObject2;
4
4
 
@@ -30,12 +30,13 @@ import { css } from '@emotion/css';
30
30
  import { observer, RecursionField, useField, useFieldSchema, useForm } from '@formily/react';
31
31
  import { Button, Modal, Popover } from 'antd';
32
32
  import classnames from 'classnames';
33
- import React, { useState } from 'react';
33
+ import React, { useState, useEffect } from 'react';
34
34
  import { useActionContext } from '../..';
35
35
  import { Icon } from '../../../icon';
36
36
  import { SortableItem } from '../../common';
37
- import { useCompile, useDesigner } from '../../hooks';
37
+ import { useCompile, useComponent, useDesigner } from '../../hooks';
38
38
  import { useProps } from '../../hooks/useProps';
39
+ import { useRecord } from '../../../record-provider';
39
40
  import ActionContainer from './Action.Container';
40
41
  import { ActionDesigner } from './Action.Designer';
41
42
  import { ActionDrawer } from './Action.Drawer';
@@ -44,12 +45,15 @@ import { ActionModal } from './Action.Modal';
44
45
  import { ActionPage } from './Action.Page';
45
46
  import { ActionContext } from './context';
46
47
  import { useA } from './hooks';
48
+ import { useDesignable } from '../../';
49
+ import { linkageAction } from './utils';
47
50
  export var actionDesignerCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.nb-action-link {\n > .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: rgba(241, 139, 98, 0.06);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n"])));
48
51
  export var Action = observer(function (props) {
49
52
  var _fieldSchema$xCompon, _fieldSchema$xCompon2;
50
53
 
51
54
  var popover = props.popover,
52
55
  confirm = props.confirm,
56
+ om = props.openMode,
53
57
  containerRefKey = props.containerRefKey,
54
58
  component = props.component,
55
59
  _props$useAction = props.useAction,
@@ -81,13 +85,29 @@ export var Action = observer(function (props) {
81
85
  var fieldSchema = useFieldSchema();
82
86
  var compile = useCompile();
83
87
  var form = useForm();
88
+ var values = useRecord();
84
89
  var designerProps = fieldSchema['x-designer-props'];
85
90
  var openMode = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon['openMode'];
86
91
  var disabled = form.disabled || field.disabled;
87
92
  var openSize = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2['openSize'];
93
+ var linkageRules = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-linkage-rules']) || [];
94
+
95
+ var _useDesignable = useDesignable(),
96
+ designable = _useDesignable.designable;
97
+
98
+ var tarComponent = useComponent(component) || component;
99
+ useEffect(function () {
100
+ linkageRules.map(function (v) {
101
+ var _v$actions;
102
+
103
+ return (_v$actions = v.actions) === null || _v$actions === void 0 ? void 0 : _v$actions.map(function (h) {
104
+ linkageAction(h.operator, field, v.condition, values, designable);
105
+ });
106
+ });
107
+ }, [linkageRules]);
88
108
 
89
109
  var renderButton = function renderButton() {
90
- var _field$data;
110
+ var _field$data, _field$data2;
91
111
 
92
112
  return /*#__PURE__*/React.createElement(SortableItem, _objectSpread(_objectSpread({}, others), {}, {
93
113
  loading: field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.loading,
@@ -95,6 +115,9 @@ export var Action = observer(function (props) {
95
115
  type: icon
96
116
  }),
97
117
  disabled: disabled,
118
+ style: {
119
+ border: (field === null || field === void 0 ? void 0 : (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : _field$data2.hidden) && '1px dashed #ede9e9'
120
+ },
98
121
  onClick: function onClick(e) {
99
122
  if (!disabled) {
100
123
  e.preventDefault();
@@ -115,7 +138,7 @@ export var Action = observer(function (props) {
115
138
  }
116
139
  }
117
140
  },
118
- component: component || Button,
141
+ component: tarComponent || Button,
119
142
  className: classnames(className, actionDesignerCss)
120
143
  }), title || compile(fieldSchema.title), /*#__PURE__*/React.createElement(Designer, _objectSpread({}, designerProps)));
121
144
  };
@@ -1,2 +1,3 @@
1
1
  import type { ISchema } from '@formily/react';
2
2
  export declare const requestSettingsSchema: ISchema;
3
+ export declare const linkageAction: (operator: any, field: any, condition: any, values: any, designable: any) => any;
@@ -1,3 +1,6 @@
1
+ import { last } from 'lodash';
2
+ import { conditionAnalyse } from '../../common/utils/uitls';
3
+ import { ActionType } from '../../../schema-settings/LinkageRules/type';
1
4
  var validateJSON = {
2
5
  validator: "{{(value, rule)=> {\n if (!value) {\n return '';\n }\n try {\n const val = JSON.parse(value);\n if(!isNaN(val)) {\n return false;\n }\n return true;\n } catch(error) {\n console.error(error);\n return false;\n }\n }}}",
3
6
  message: '{{t("Invalid JSON format")}}'
@@ -57,4 +60,50 @@ export var requestSettingsSchema = {
57
60
  'x-validator': validateJSON
58
61
  }
59
62
  }
63
+ };
64
+ export var linkageAction = function linkageAction(operator, field, condition, values, designable) {
65
+ var displayResult = [field.display];
66
+ var disableResult = [field.disabled];
67
+
68
+ switch (operator) {
69
+ case ActionType.Visible:
70
+ if (conditionAnalyse(condition, values)) {
71
+ displayResult.push(operator);
72
+ }
73
+
74
+ field.display = last(displayResult);
75
+ break;
76
+
77
+ case ActionType.Hidden:
78
+ if (conditionAnalyse(condition, values)) {
79
+ if (!designable) {
80
+ displayResult.push(operator);
81
+ } else {
82
+ field.data = field.data || {};
83
+ field.data.hidden = true;
84
+ }
85
+ }
86
+
87
+ field.display = last(displayResult);
88
+ break;
89
+
90
+ case ActionType.Disabled:
91
+ if (conditionAnalyse(condition, values)) {
92
+ disableResult.push(true);
93
+ }
94
+
95
+ field.disabled = last(disableResult);
96
+ break;
97
+
98
+ case ActionType.Active:
99
+ if (conditionAnalyse(condition, values)) {
100
+ disableResult.push(false);
101
+ }
102
+
103
+ field.disabled = last(disableResult);
104
+ break;
105
+
106
+ default:
107
+ return null;
108
+ }
60
109
  };
@@ -8,7 +8,7 @@ import cls from 'classnames';
8
8
  import React from 'react';
9
9
  import { useCollection } from '../../../collection-manager';
10
10
  import { useSchemaInitializer } from '../../../schema-initializer';
11
- import { SortableItem } from '../../common';
11
+ import { DndContext, SortableItem } from '../../common';
12
12
  import { useDesigner } from '../../hooks';
13
13
  import { AssociationFilterInitializer } from './AssociationFilter.Initializer';
14
14
  import { AssociationFilterItem } from './AssociationFilter.Item';
@@ -21,9 +21,9 @@ export var AssociationFilter = function AssociationFilter(props) {
21
21
  exists = _useSchemaInitializer.exists,
22
22
  render = _useSchemaInitializer.render;
23
23
 
24
- return /*#__PURE__*/React.createElement(SortableItem, {
25
- className: cls('nb-block-item', props.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.nb-form-item:hover {\n > .general-schema-designer {\n background: rgba(241, 139, 98, 0.06) !important;\n border: 0 !important;\n top: -5px !important;\n bottom: -5px !important;\n left: -5px !important;\n right: -5px !important;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n border: 2px solid rgba(241, 139, 98, 0.3);\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n "]))))
26
- }, /*#__PURE__*/React.createElement(Designer, null), props.children, render());
24
+ return /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(SortableItem, {
25
+ className: cls('nb-block-item', props.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.nb-form-item:hover {\n > .general-schema-designer {\n background: rgba(241, 139, 98, 0.06) !important;\n border: 0 !important;\n top: -5px !important;\n bottom: -5px !important;\n left: -5px !important;\n right: -5px !important;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n border: 2px solid rgba(241, 139, 98, 0.3);\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n "]))))
26
+ }, /*#__PURE__*/React.createElement(Designer, null), props.children, render()));
27
27
  };
28
28
  AssociationFilter.Initializer = AssociationFilterInitializer;
29
29
  AssociationFilter.Item = AssociationFilterItem;
@@ -4,9 +4,9 @@ export declare type AssociationSelectProps<P = any> = RemoteSelectProps<P> & {
4
4
  action?: string;
5
5
  multiple?: boolean;
6
6
  };
7
- interface RemoteSelectInterface {
7
+ interface AssociationSelectInterface {
8
8
  (props: any): React.ReactElement;
9
9
  Designer: React.FC;
10
10
  }
11
- export declare const AssociationSelect: RemoteSelectInterface;
11
+ export declare const AssociationSelect: AssociationSelectInterface;
12
12
  export default AssociationSelect;
@@ -4,25 +4,66 @@ 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
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
+
7
9
  import { useFieldSchema } from '@formily/react';
8
- import { useMemo } from 'react';
9
- import { useCollection } from '../../../collection-manager';
10
+ import { useCallback, useMemo } from 'react';
11
+ import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
12
+ import { useCollection, useCollectionManager } from '../../../collection-manager';
13
+ import { useRecord } from '../../../record-provider';
10
14
  export default function useServiceOptions(props) {
11
15
  var _props$action = props.action,
12
16
  action = _props$action === void 0 ? 'list' : _props$action,
13
- service = props.service;
17
+ service = props.service,
18
+ fieldNames = props.fieldNames;
19
+ var params = (service === null || service === void 0 ? void 0 : service.params) || {};
14
20
  var fieldSchema = useFieldSchema();
15
21
 
16
22
  var _useCollection = useCollection(),
17
23
  getField = _useCollection.getField;
18
24
 
25
+ var _useCollectionManager = useCollectionManager(),
26
+ getCollectionFields = _useCollectionManager.getCollectionFields;
27
+
28
+ var record = useRecord();
29
+ var normalizeValues = useCallback(function (obj) {
30
+ if (obj && _typeof(obj) === 'object') {
31
+ return obj[fieldNames.value];
32
+ }
33
+
34
+ return obj;
35
+ }, [fieldNames.value]);
36
+ var value = useMemo(function () {
37
+ if (props.value === undefined || props.value === null) {
38
+ return;
39
+ }
40
+
41
+ if (Array.isArray(props.value)) {
42
+ return props.value.map(normalizeValues);
43
+ } else {
44
+ return [normalizeValues(props.value)];
45
+ }
46
+ }, [props.value, normalizeValues]);
19
47
  var collectionField = useMemo(function () {
20
48
  return getField(fieldSchema.name);
21
49
  }, [fieldSchema.name]);
50
+ var sourceValue = record === null || record === void 0 ? void 0 : record[collectionField === null || collectionField === void 0 ? void 0 : collectionField.sourceKey];
51
+ var filter = useMemo(function () {
52
+ var isOToAny = ['oho', 'o2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
53
+ return mergeFilter([mergeFilter([isOToAny ? _defineProperty({}, collectionField.foreignKey, {
54
+ $is: null
55
+ }) : null, params === null || params === void 0 ? void 0 : params.filter]), isOToAny && sourceValue !== undefined && sourceValue !== null ? _defineProperty({}, collectionField.foreignKey, {
56
+ $eq: sourceValue
57
+ }) : null, (params === null || params === void 0 ? void 0 : params.filter) && value ? _defineProperty({}, fieldNames.value, _defineProperty({}, '$in', value)) : null], '$or');
58
+ }, [params === null || params === void 0 ? void 0 : params.filter, getCollectionFields, collectionField, sourceValue, value, fieldNames.value]);
22
59
  return useMemo(function () {
23
- return _objectSpread({
60
+ return _objectSpread(_objectSpread({
24
61
  resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target,
25
62
  action: action
26
- }, service);
27
- }, [collectionField === null || collectionField === void 0 ? void 0 : collectionField.target, action, service]);
63
+ }, service), {}, {
64
+ params: _objectSpread(_objectSpread({}, service === null || service === void 0 ? void 0 : service.params), {}, {
65
+ filter: filter
66
+ })
67
+ });
68
+ }, [collectionField === null || collectionField === void 0 ? void 0 : collectionField.target, action, filter, service]);
28
69
  }