@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
@@ -8,15 +8,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
8
8
 
9
9
  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; }
10
10
 
11
- import React, { useContext } from "react";
12
- import { FormDialog, FormLayout } from "@formily/antd";
11
+ import React, { useContext } from 'react';
12
+ import { FormDialog, FormLayout } from '@formily/antd';
13
13
  import { FormOutlined } from '@ant-design/icons';
14
- import { SchemaOptionsContext } from "@formily/react";
15
- import { useTranslation } from "react-i18next";
16
- import { useCollectionManager } from "../../collection-manager";
17
- import { SchemaComponent, SchemaComponentOptions } from "../../schema-component";
18
- import { createCalendarBlockSchema } from "../utils";
19
- import { DataBlockInitializer } from "./DataBlockInitializer";
14
+ import { SchemaOptionsContext } from '@formily/react';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { useCollectionManager } from '../../collection-manager';
17
+ import { SchemaComponent, SchemaComponentOptions } from '../../schema-component';
18
+ import { createCalendarBlockSchema } from '../utils';
19
+ import { DataBlockInitializer } from './DataBlockInitializer';
20
20
  export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
21
21
  var insert = props.insert;
22
22
 
@@ -24,44 +24,27 @@ export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
24
24
  t = _useTranslation.t;
25
25
 
26
26
  var _useCollectionManager = useCollectionManager(),
27
- getCollectionFields = _useCollectionManager.getCollectionFields;
27
+ getCollectionField = _useCollectionManager.getCollectionField,
28
+ getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
28
29
 
30
+ useCollectionManager;
29
31
  var options = useContext(SchemaOptionsContext);
30
32
  return /*#__PURE__*/React.createElement(DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
31
33
  componentType: 'Calendar',
32
34
  icon: /*#__PURE__*/React.createElement(FormOutlined, null),
33
35
  onCreateBlockSchema: function () {
34
36
  var _onCreateBlockSchema = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
35
- var _collectionFields$fil, _collectionFields$fil2;
36
-
37
- var item, collectionFields, stringFields, dateFields, values;
37
+ var item, stringFieldsOptions, dateFieldsOptions, values;
38
38
  return regeneratorRuntime.wrap(function _callee$(_context) {
39
39
  while (1) {
40
40
  switch (_context.prev = _context.next) {
41
41
  case 0:
42
42
  item = _ref.item;
43
- collectionFields = getCollectionFields(item.name);
44
- stringFields = collectionFields === null || collectionFields === void 0 ? void 0 : (_collectionFields$fil = collectionFields.filter(function (field) {
45
- return field.type === 'string';
46
- })) === null || _collectionFields$fil === void 0 ? void 0 : _collectionFields$fil.map(function (field) {
47
- var _field$uiSchema;
48
-
49
- return {
50
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title,
51
- value: field.name
52
- };
53
- });
54
- dateFields = collectionFields === null || collectionFields === void 0 ? void 0 : (_collectionFields$fil2 = collectionFields.filter(function (field) {
55
- return field.type === 'date';
56
- })) === null || _collectionFields$fil2 === void 0 ? void 0 : _collectionFields$fil2.map(function (field) {
57
- var _field$uiSchema2;
58
-
59
- return {
60
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title,
61
- value: field.name
62
- };
43
+ stringFieldsOptions = getCollectionFieldsOptions(item.name, 'string');
44
+ dateFieldsOptions = getCollectionFieldsOptions(item.name, 'date', {
45
+ association: ['o2o', 'obo', 'oho', 'm2o']
63
46
  });
64
- _context.next = 6;
47
+ _context.next = 5;
65
48
  return FormDialog(t('Create calendar block'), function () {
66
49
  return /*#__PURE__*/React.createElement(SchemaComponentOptions, {
67
50
  scope: options.scope,
@@ -73,23 +56,23 @@ export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
73
56
  properties: {
74
57
  title: {
75
58
  title: t('Title field'),
76
- enum: stringFields,
59
+ enum: stringFieldsOptions,
77
60
  required: true,
78
61
  'x-component': 'Select',
79
62
  'x-decorator': 'FormItem'
80
63
  },
81
64
  start: {
82
65
  title: t('Start date field'),
83
- enum: dateFields,
66
+ enum: dateFieldsOptions,
84
67
  required: true,
85
- default: 'createdAt',
86
- 'x-component': 'Select',
68
+ default: getCollectionField("".concat(item.name, ".createdAt")) ? 'createdAt' : null,
69
+ 'x-component': 'Cascader',
87
70
  'x-decorator': 'FormItem'
88
71
  },
89
72
  end: {
90
73
  title: t('End date field'),
91
- enum: dateFields,
92
- 'x-component': 'Select',
74
+ enum: dateFieldsOptions,
75
+ 'x-component': 'Cascader',
93
76
  'x-decorator': 'FormItem'
94
77
  }
95
78
  }
@@ -99,14 +82,14 @@ export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
99
82
  initialValues: {}
100
83
  });
101
84
 
102
- case 6:
85
+ case 5:
103
86
  values = _context.sent;
104
87
  insert(createCalendarBlockSchema({
105
88
  collection: item.name,
106
89
  fieldNames: _objectSpread({}, values)
107
90
  }));
108
91
 
109
- case 8:
92
+ case 7:
110
93
  case "end":
111
94
  return _context.stop();
112
95
  }
@@ -9,14 +9,14 @@ import { ActionInitializer } from './ActionInitializer';
9
9
  export var CreateActionInitializer = function CreateActionInitializer(props) {
10
10
  var schema = {
11
11
  type: 'void',
12
- title: '{{ t("Add new") }}',
13
12
  'x-action': 'create',
13
+ title: "{{t('Add new')}}",
14
14
  'x-designer': 'Action.Designer',
15
15
  'x-component': 'Action',
16
+ 'x-decorator': 'ACLActionProvider',
16
17
  'x-component-props': {
17
- icon: 'PlusOutlined',
18
18
  openMode: 'drawer',
19
- type: 'primary'
19
+ component: 'CreateRecordAction'
20
20
  },
21
21
  properties: {
22
22
  drawer: {
@@ -1,4 +1,4 @@
1
- var _excluded = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert"];
1
+ var _excluded = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert", "targetCollection"];
2
2
 
3
3
  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); } }
4
4
 
@@ -14,26 +14,26 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
14
14
 
15
15
  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; }
16
16
 
17
- import React from "react";
17
+ import React from 'react';
18
18
  import { FormOutlined } from '@ant-design/icons';
19
- import { useBlockAssociationContext } from "../../block-provider";
20
- import { useCollection } from "../../collection-manager";
21
- import { useSchemaTemplateManager } from "../../schema-templates";
22
- import { SchemaInitializer } from "../SchemaInitializer";
23
- import { createFormBlockSchema, useRecordCollectionDataSourceItems } from "../utils";
19
+ import { useBlockAssociationContext } from '../../block-provider';
20
+ import { useCollection } from '../../collection-manager';
21
+ import { useSchemaTemplateManager } from '../../schema-templates';
22
+ import { SchemaInitializer } from '../SchemaInitializer';
23
+ import { createFormBlockSchema, useRecordCollectionDataSourceItems } from '../utils';
24
24
  export var RecordFormBlockInitializer = function RecordFormBlockInitializer(props) {
25
25
  var onCreateBlockSchema = props.onCreateBlockSchema,
26
26
  componentType = props.componentType,
27
27
  createBlockSchema = props.createBlockSchema,
28
28
  insert = props.insert,
29
+ targetCollection = props.targetCollection,
29
30
  others = _objectWithoutProperties(props, _excluded);
30
31
 
31
32
  var _useSchemaTemplateMan = useSchemaTemplateManager(),
32
33
  getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
33
34
 
34
- var collection = useCollection();
35
+ var collection = targetCollection || useCollection();
35
36
  var association = useBlockAssociationContext();
36
- console.log('RecordFormBlockInitializer', collection, association);
37
37
  return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
38
38
  icon: /*#__PURE__*/React.createElement(FormOutlined, null)
39
39
  }, others), {}, {
@@ -1,3 +1,7 @@
1
+ export * from '../../schema-component/antd/association-filter/ActionBarAssociationFilterAction';
2
+ export * from '../../schema-component/antd/association-filter/AssociationFilter';
3
+ export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDelete';
4
+ export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDisplayField';
1
5
  export * from './ActionInitializer';
2
6
  export * from './BlockInitializer';
3
7
  export * from './BulkDestroyActionInitializer';
@@ -37,7 +41,3 @@ export * from './TableSelectorInitializer';
37
41
  export * from './UpdateActionInitializer';
38
42
  export * from './UpdateSubmitActionInitializer';
39
43
  export * from './ViewActionInitializer';
40
- export * from '../../schema-component/antd/association-filter/AssociationFilter';
41
- export * from '../../schema-component/antd/association-filter/ActionBarAssociationFilterAction';
42
- export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDisplayField';
43
- export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDelete';
@@ -1,3 +1,8 @@
1
+ export * from '../../schema-component/antd/association-filter/ActionBarAssociationFilterAction'; // association filter
2
+
3
+ export * from '../../schema-component/antd/association-filter/AssociationFilter';
4
+ export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDelete';
5
+ export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDisplayField';
1
6
  export * from './ActionInitializer';
2
7
  export * from './BlockInitializer';
3
8
  export * from './BulkDestroyActionInitializer';
@@ -36,9 +41,4 @@ export * from './TableCollectionFieldInitializer';
36
41
  export * from './TableSelectorInitializer';
37
42
  export * from './UpdateActionInitializer';
38
43
  export * from './UpdateSubmitActionInitializer';
39
- export * from './ViewActionInitializer'; // association filter
40
-
41
- export * from '../../schema-component/antd/association-filter/AssociationFilter';
42
- export * from '../../schema-component/antd/association-filter/ActionBarAssociationFilterAction';
43
- export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDisplayField';
44
- export * from '../../schema-component/antd/association-filter/AssociationFilterDesignerDelete';
44
+ export * from './ViewActionInitializer';
@@ -1,7 +1,7 @@
1
1
  var _excluded = ["formItemInitializers", "actionInitializers", "collection", "association", "resource", "template"],
2
2
  _excluded2 = ["formItemInitializers", "actionInitializers", "collection", "resource", "association", "action", "template"],
3
3
  _excluded3 = ["formItemInitializers", "actionInitializers", "collection", "association", "resource", "template"],
4
- _excluded4 = ["collection", "resource", "rowKey"],
4
+ _excluded4 = ["collection", "resource", "rowKey", "tableActionInitializers", "tableColumnInitializers", "tableActionColumnInitializers", "tableBlockProvider", "disableTemplate"],
5
5
  _excluded5 = ["collection", "resource", "rowKey"],
6
6
  _excluded6 = ["collection", "resource", "fieldNames"],
7
7
  _excluded7 = ["collection", "resource", "groupField"];
@@ -30,8 +30,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
30
30
 
31
31
  import { Schema, useFieldSchema, useForm } from '@formily/react';
32
32
  import { uid } from '@formily/shared';
33
- import React, { useState } from 'react';
33
+ import React, { useContext, useState } from 'react';
34
34
  import { useTranslation } from 'react-i18next';
35
+ import { BlockRequestContext } from '../';
35
36
  import { useCollection, useCollectionManager } from '../collection-manager';
36
37
  import { useActionContext, useDesignable } from '../schema-component';
37
38
  import { useSchemaTemplateManager } from '../schema-templates';
@@ -607,10 +608,18 @@ export var useCurrentSchema = function useCurrentSchema(action, key) {
607
608
  _remove = _useDesignable.remove;
608
609
 
609
610
  var schema = find(fieldSchema, key, action);
611
+ var ctx = useContext(BlockRequestContext);
612
+ var exists = !!schema;
610
613
  return {
611
614
  schema: schema,
612
615
  exists: !!schema,
613
616
  remove: function remove() {
617
+ if (ctx.field) {
618
+ ctx.field.data = ctx.field.data || {};
619
+ ctx.field.data.activeFields = ctx.field.data.activeFields || new Set();
620
+ ctx.field.data.activeFields.delete(schema.name);
621
+ }
622
+
614
623
  schema && rm(schema, _remove);
615
624
  }
616
625
  };
@@ -979,11 +988,16 @@ export var createTableBlockSchema = function createTableBlockSchema(options) {
979
988
  var collection = options.collection,
980
989
  resource = options.resource,
981
990
  rowKey = options.rowKey,
991
+ tableActionInitializers = options.tableActionInitializers,
992
+ tableColumnInitializers = options.tableColumnInitializers,
993
+ tableActionColumnInitializers = options.tableActionColumnInitializers,
994
+ tableBlockProvider = options.tableBlockProvider,
995
+ disableTemplate = options.disableTemplate,
982
996
  others = _objectWithoutProperties(options, _excluded4);
983
997
 
984
998
  var schema = {
985
999
  type: 'void',
986
- 'x-decorator': 'TableBlockProvider',
1000
+ 'x-decorator': tableBlockProvider !== null && tableBlockProvider !== void 0 ? tableBlockProvider : 'TableBlockProvider',
987
1001
  'x-acl-action': "".concat(resource || collection, ":list"),
988
1002
  'x-decorator-props': _objectSpread({
989
1003
  collection: collection,
@@ -994,14 +1008,15 @@ export var createTableBlockSchema = function createTableBlockSchema(options) {
994
1008
  },
995
1009
  rowKey: rowKey,
996
1010
  showIndex: true,
997
- dragSort: false
1011
+ dragSort: false,
1012
+ disableTemplate: disableTemplate !== null && disableTemplate !== void 0 ? disableTemplate : false
998
1013
  }, others),
999
1014
  'x-designer': 'TableBlockDesigner',
1000
1015
  'x-component': 'CardItem',
1001
1016
  properties: _defineProperty({
1002
1017
  actions: {
1003
1018
  type: 'void',
1004
- 'x-initializer': 'TableActionInitializers',
1019
+ 'x-initializer': tableActionInitializers !== null && tableActionInitializers !== void 0 ? tableActionInitializers : 'TableActionInitializers',
1005
1020
  'x-component': 'ActionBar',
1006
1021
  'x-component-props': {
1007
1022
  style: {
@@ -1012,7 +1027,7 @@ export var createTableBlockSchema = function createTableBlockSchema(options) {
1012
1027
  }
1013
1028
  }, uid(), {
1014
1029
  type: 'array',
1015
- 'x-initializer': 'TableColumnInitializers',
1030
+ 'x-initializer': tableColumnInitializers !== null && tableColumnInitializers !== void 0 ? tableColumnInitializers : 'TableColumnInitializers',
1016
1031
  'x-component': 'TableV2',
1017
1032
  'x-component-props': {
1018
1033
  rowKey: 'id',
@@ -1029,7 +1044,7 @@ export var createTableBlockSchema = function createTableBlockSchema(options) {
1029
1044
  'x-decorator': 'TableV2.Column.ActionBar',
1030
1045
  'x-component': 'TableV2.Column',
1031
1046
  'x-designer': 'TableV2.ActionColumnDesigner',
1032
- 'x-initializer': 'TableActionColumnInitializers',
1047
+ 'x-initializer': tableActionColumnInitializers !== null && tableActionColumnInitializers !== void 0 ? tableActionColumnInitializers : 'TableActionColumnInitializers',
1033
1048
  properties: {
1034
1049
  actions: {
1035
1050
  type: 'void',
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const EnableChildCollections: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
@@ -0,0 +1,141 @@
1
+ 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); } }
2
+
3
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
+
5
+ import { observer, useForm } from '@formily/react';
6
+ import React from 'react';
7
+ import { action } from '@formily/reactive';
8
+ import { SchemaComponent, useCompile } from '../../schema-component';
9
+ import { useCollectionManager } from '../../collection-manager';
10
+ export var EnableChildCollections = observer(function (props) {
11
+ var useProps = props.useProps;
12
+
13
+ var _useProps = useProps(),
14
+ defaultValues = _useProps.defaultValues,
15
+ collectionName = _useProps.collectionName;
16
+
17
+ var form = useForm();
18
+ var compile = useCompile();
19
+
20
+ var _useCollectionManager = useCollectionManager(),
21
+ getChildrenCollections = _useCollectionManager.getChildrenCollections;
22
+
23
+ var childrenCollections = getChildrenCollections(collectionName);
24
+
25
+ var useAsyncDataSource = function useAsyncDataSource(service) {
26
+ return function (field, options) {
27
+ field.loading = true;
28
+ service(field, options).then(action.bound(function (data) {
29
+ field.dataSource = data;
30
+ field.loading = false;
31
+
32
+ if (field.initialValue) {
33
+ field.disabled = true;
34
+ }
35
+ }));
36
+ };
37
+ };
38
+
39
+ var loadData = /*#__PURE__*/function () {
40
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(field) {
41
+ var _form$values, _childrenCollections$;
42
+
43
+ var _form$values$enableCh, childCollections;
44
+
45
+ return regeneratorRuntime.wrap(function _callee$(_context) {
46
+ while (1) {
47
+ switch (_context.prev = _context.next) {
48
+ case 0:
49
+ _form$values$enableCh = (_form$values = form.values) === null || _form$values === void 0 ? void 0 : _form$values.enableChildren, childCollections = _form$values$enableCh.childrenCollections;
50
+ return _context.abrupt("return", (_childrenCollections$ = childrenCollections.filter(function (v) {
51
+ return !childCollections.find(function (k) {
52
+ return k.collection === v.name;
53
+ }) || field.initialValue || v.name === field.value;
54
+ })) === null || _childrenCollections$ === void 0 ? void 0 : _childrenCollections$.map(function (collection) {
55
+ return {
56
+ label: compile(collection.title),
57
+ value: collection.name
58
+ };
59
+ }));
60
+
61
+ case 2:
62
+ case "end":
63
+ return _context.stop();
64
+ }
65
+ }
66
+ }, _callee);
67
+ }));
68
+
69
+ return function loadData(_x) {
70
+ return _ref.apply(this, arguments);
71
+ };
72
+ }();
73
+
74
+ return /*#__PURE__*/React.createElement(SchemaComponent, {
75
+ schema: {
76
+ type: 'object',
77
+ properties: {
78
+ childrenCollections: {
79
+ type: 'array',
80
+ default: defaultValues,
81
+ 'x-component': 'ArrayItems',
82
+ 'x-decorator': 'FormItem',
83
+ items: {
84
+ type: 'object',
85
+ properties: {
86
+ space: {
87
+ type: 'void',
88
+ 'x-component': 'Space',
89
+ properties: {
90
+ sort: {
91
+ type: 'void',
92
+ 'x-decorator': 'FormItem',
93
+ 'x-component': 'ArrayItems.SortHandle'
94
+ },
95
+ collection: {
96
+ type: 'string',
97
+ 'x-decorator': 'FormItem',
98
+ required: true,
99
+ 'x-component': 'Select',
100
+ 'x-component-props': {
101
+ style: {
102
+ width: 260
103
+ }
104
+ },
105
+ 'x-reactions': ['{{useAsyncDataSource(loadData)}}']
106
+ },
107
+ title: {
108
+ type: 'string',
109
+ 'x-decorator': 'FormItem',
110
+ 'x-component': 'Input',
111
+ 'x-component-props': {
112
+ style: {
113
+ width: 235
114
+ }
115
+ }
116
+ },
117
+ remove: {
118
+ type: 'void',
119
+ 'x-decorator': 'FormItem',
120
+ 'x-component': 'ArrayItems.Remove'
121
+ }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ properties: {
127
+ add: {
128
+ type: 'void',
129
+ title: '{{ t("Add collection") }}',
130
+ 'x-component': 'ArrayItems.Addition'
131
+ }
132
+ }
133
+ }
134
+ }
135
+ },
136
+ scope: {
137
+ useAsyncDataSource: useAsyncDataSource,
138
+ loadData: loadData
139
+ }
140
+ });
141
+ });
@@ -0,0 +1 @@
1
+ export declare const DynamicComponent: (props: any) => JSX.Element;
@@ -0,0 +1,113 @@
1
+ var _templateObject;
2
+
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
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+
7
+ 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; }
8
+
9
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
10
+
11
+ import { css } from '@emotion/css';
12
+ import { createForm, onFieldValueChange } from '@formily/core';
13
+ import { connect, FieldContext, FormContext } from '@formily/react';
14
+ import { merge } from '@formily/shared';
15
+ import { Cascader } from 'antd';
16
+ import React, { useContext, useMemo } from 'react';
17
+ import { SchemaComponent } from '../../schema-component/core';
18
+ import { useCompile, useComponent } from '../../schema-component/hooks';
19
+ import { FilterContext } from './context';
20
+ import { useFilterOptions } from '../../schema-component/antd/filter/useFilterActionProps';
21
+ var VariableCascader = connect(function (props) {
22
+ var fields = useFilterOptions('users');
23
+ var compile = useCompile();
24
+ var value = props.value,
25
+ _onChange = props.onChange;
26
+ return /*#__PURE__*/React.createElement(Cascader, {
27
+ className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 160px;\n "]))),
28
+ value: value ? value.split('.') : [],
29
+ fieldNames: {
30
+ label: 'title',
31
+ value: 'name',
32
+ children: 'children'
33
+ },
34
+ onChange: function onChange(value) {
35
+ _onChange(value ? value.join('.') : null);
36
+ },
37
+ options: compile([{
38
+ title: '{{t("Current user")}}',
39
+ name: 'currentUser',
40
+ children: fields.filter(function (field) {
41
+ if (!field.target) {
42
+ return true;
43
+ }
44
+
45
+ return field.type === 'belongsTo';
46
+ }).map(function (field) {
47
+ if (field.children) {
48
+ field.children = field.children.filter(function (child) {
49
+ return !child.target;
50
+ });
51
+ }
52
+
53
+ return field;
54
+ })
55
+ }])
56
+ });
57
+ });
58
+ export var DynamicComponent = function DynamicComponent(props) {
59
+ var _ref = useContext(FilterContext) || {},
60
+ dynamicComponent = _ref.dynamicComponent,
61
+ disabled = _ref.disabled;
62
+
63
+ var component = useComponent(dynamicComponent);
64
+ var form = useMemo(function () {
65
+ return createForm({
66
+ values: {
67
+ value: props.value
68
+ },
69
+ disabled: disabled,
70
+ effects: function effects() {
71
+ onFieldValueChange('value', function (field) {
72
+ var _props$onChange;
73
+
74
+ props === null || props === void 0 ? void 0 : (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, field.value);
75
+ });
76
+ }
77
+ });
78
+ }, [JSON.stringify(props.schema), JSON.stringify(props.value)]);
79
+
80
+ var renderSchemaComponent = function renderSchemaComponent() {
81
+ var _props$schema;
82
+
83
+ return /*#__PURE__*/React.createElement(FieldContext.Provider, {
84
+ value: null
85
+ }, /*#__PURE__*/React.createElement(SchemaComponent, {
86
+ schema: _objectSpread(_objectSpread({
87
+ 'x-component': 'Input'
88
+ }, props.schema), {}, {
89
+ 'x-component-props': merge((props === null || props === void 0 ? void 0 : (_props$schema = props.schema) === null || _props$schema === void 0 ? void 0 : _props$schema['x-component-props']) || {}, {
90
+ style: {
91
+ minWidth: 150,
92
+ width: '100%'
93
+ }
94
+ }),
95
+ name: 'value',
96
+ 'x-read-pretty': false,
97
+ 'x-validator': undefined,
98
+ 'x-decorator': undefined
99
+ }),
100
+ components: {
101
+ VariableCascader: VariableCascader
102
+ }
103
+ }));
104
+ };
105
+
106
+ return /*#__PURE__*/React.createElement(FormContext.Provider, {
107
+ value: form
108
+ }, component ? /*#__PURE__*/React.createElement(component, {
109
+ value: props.value,
110
+ onChange: props === null || props === void 0 ? void 0 : props.onChange,
111
+ renderSchemaComponent: renderSchemaComponent
112
+ }) : renderSchemaComponent());
113
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function FilterDynamicComponent(props: any): JSX.Element;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Variable } from '../../schema-component';
3
+ import { useVariableOptions } from './Variables';
4
+ export function FilterDynamicComponent(props) {
5
+ var value = props.value,
6
+ onChange = props.onChange,
7
+ renderSchemaComponent = props.renderSchemaComponent,
8
+ collectionName = props.collectionName;
9
+ var scope = useVariableOptions(collectionName);
10
+ return /*#__PURE__*/React.createElement(Variable.Input, {
11
+ value: value,
12
+ onChange: onChange,
13
+ scope: scope
14
+ }, renderSchemaComponent());
15
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const FormFieldLinkageRuleAction: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
3
+ export declare const FormButtonLinkageRuleAction: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;