@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
@@ -3,10 +3,13 @@ var _templateObject;
3
3
  var _excluded = ["children", "fieldSchema"],
4
4
  _excluded2 = ["title", "dn"],
5
5
  _excluded3 = ["title", "options", "value", "onChange"],
6
- _excluded4 = ["title", "onChange"],
7
- _excluded5 = ["schema"],
8
- _excluded6 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
9
- _excluded7 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "asyncGetInitialValues", "initialValues"];
6
+ _excluded4 = ["title", "options", "value", "onChange"],
7
+ _excluded5 = ["title", "onChange"],
8
+ _excluded6 = ["schema"],
9
+ _excluded7 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
10
+ _excluded8 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "asyncGetInitialValues", "initialValues", "width"];
11
+
12
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
10
13
 
11
14
  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); } }
12
15
 
@@ -37,19 +40,23 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
37
40
  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; }
38
41
 
39
42
  import { css } from '@emotion/css';
40
- import { FormDialog, FormItem, FormLayout, Input } from '@formily/antd';
43
+ import { FormDialog, FormItem, FormLayout, Input, ArrayCollapse, ArrayItems } from '@formily/antd';
41
44
  import { createForm } from '@formily/core';
42
45
  import { SchemaOptionsContext, useField, useFieldSchema, useForm } from '@formily/react';
46
+ import _ from 'lodash';
43
47
  import { uid } from '@formily/shared';
44
- import { Alert, Button, Dropdown, Menu, Modal, Select, Space, Switch } from 'antd';
48
+ import { Alert, Button, Cascader, Dropdown, Menu, Modal, Select, Space, Switch } from 'antd';
45
49
  import classNames from 'classnames';
46
50
  import { cloneDeep } from 'lodash';
47
51
  import React, { createContext, useContext, useMemo, useState } from 'react';
48
52
  import { createPortal } from 'react-dom';
49
53
  import { useTranslation } from 'react-i18next';
50
- import { ActionContext, CollectionManagerContext, createDesignable, FormProvider, RemoteSchemaComponent, SchemaComponent, SchemaComponentOptions, useActionContext, useAPIClient, useCollection, useCompile, useDesignable } from '..';
54
+ import { ActionContext, CollectionManagerContext, createDesignable, FormProvider, RemoteSchemaComponent, SchemaComponent, SchemaComponentOptions, useActionContext, useAPIClient, useCollection, useCollectionManager, useCompile, useDesignable, useCollectionFilterOptions } from '..';
51
55
  import { useSchemaTemplateManager } from '../schema-templates';
52
56
  import { useBlockTemplateContext } from '../schema-templates/BlockTemplate';
57
+ import { FormLinkageRules } from './LinkageRules';
58
+ import { useLinkageCollectionFieldOptions } from './LinkageRules/action-hooks';
59
+ import { EnableChildCollections } from './EnableChildCollections';
53
60
  var SchemaSettingsContext = /*#__PURE__*/createContext(null);
54
61
  export var useSchemaSettings = function useSchemaSettings() {
55
62
  return useContext(SchemaSettingsContext);
@@ -112,12 +119,16 @@ SchemaSettings.Template = function (props) {
112
119
  var _useTranslation = useTranslation(),
113
120
  t = _useTranslation.t;
114
121
 
122
+ var _useCollectionManager = useCollectionManager(),
123
+ getCollection = _useCollectionManager.getCollection;
124
+
115
125
  var _useSchemaSettings = useSchemaSettings(),
116
126
  dn = _useSchemaSettings.dn,
117
127
  setVisible = _useSchemaSettings.setVisible,
118
128
  template = _useSchemaSettings.template,
119
129
  fieldSchema = _useSchemaSettings.fieldSchema;
120
130
 
131
+ var compile = useCompile();
121
132
  var api = useAPIClient();
122
133
 
123
134
  var _useBlockTemplateCont = useBlockTemplateContext(),
@@ -188,14 +199,15 @@ SchemaSettings.Template = function (props) {
188
199
  return /*#__PURE__*/React.createElement(SchemaSettings.Item, {
189
200
  onClick: function () {
190
201
  var _onClick2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
191
- var values, sdn, _yield$saveAsTemplate, key;
202
+ var _getCollection, title, values, sdn, _yield$saveAsTemplate, key;
192
203
 
193
204
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
194
205
  while (1) {
195
206
  switch (_context3.prev = _context3.next) {
196
207
  case 0:
197
208
  setVisible(false);
198
- _context3.next = 3;
209
+ _getCollection = getCollection(collectionName), title = _getCollection.title;
210
+ _context3.next = 4;
199
211
  return FormDialog(t('Save as template'), function () {
200
212
  return /*#__PURE__*/React.createElement(FormLayout, {
201
213
  layout: 'vertical'
@@ -210,6 +222,7 @@ SchemaSettings.Template = function (props) {
210
222
  name: {
211
223
  title: t('Template name'),
212
224
  required: true,
225
+ default: "".concat(compile(title), "_").concat(t(componentName)),
213
226
  'x-decorator': 'FormItem',
214
227
  'x-component': 'Input'
215
228
  }
@@ -218,7 +231,7 @@ SchemaSettings.Template = function (props) {
218
231
  }));
219
232
  }).open({});
220
233
 
221
- case 3:
234
+ case 4:
222
235
  values = _context3.sent;
223
236
  sdn = createDesignable({
224
237
  t: t,
@@ -227,7 +240,7 @@ SchemaSettings.Template = function (props) {
227
240
  current: fieldSchema.parent
228
241
  });
229
242
  sdn.loadAPIClientEvents();
230
- _context3.next = 8;
243
+ _context3.next = 9;
231
244
  return saveAsTemplate({
232
245
  collectionName: collectionName,
233
246
  resourceName: resourceName,
@@ -236,7 +249,7 @@ SchemaSettings.Template = function (props) {
236
249
  uid: fieldSchema['x-uid']
237
250
  });
238
251
 
239
- case 8:
252
+ case 9:
240
253
  _yield$saveAsTemplate = _context3.sent;
241
254
  key = _yield$saveAsTemplate.key;
242
255
  sdn.removeWithoutEmit(fieldSchema);
@@ -248,7 +261,7 @@ SchemaSettings.Template = function (props) {
248
261
  }
249
262
  });
250
263
 
251
- case 12:
264
+ case 13:
252
265
  case "end":
253
266
  return _context3.stop();
254
267
  }
@@ -269,7 +282,7 @@ var findGridSchema = function findGridSchema(fieldSchema) {
269
282
  return fieldSchema.reduceProperties(function (buf, s) {
270
283
  if (s['x-component'] === 'FormV2') {
271
284
  var f = s.reduceProperties(function (buf, s) {
272
- if (s['x-component'] === 'Grid') {
285
+ if (s['x-component'] === 'Grid' || s['x-component'] === 'BlockTemplate') {
273
286
  return s;
274
287
  }
275
288
 
@@ -315,6 +328,11 @@ SchemaSettings.FormItemTemplate = function (props) {
315
328
  var _useTranslation2 = useTranslation(),
316
329
  t = _useTranslation2.t;
317
330
 
331
+ var compile = useCompile();
332
+
333
+ var _useCollectionManager2 = useCollectionManager(),
334
+ getCollection = _useCollectionManager2.getCollection;
335
+
318
336
  var _useSchemaSettings2 = useSchemaSettings(),
319
337
  dn = _useSchemaSettings2.dn,
320
338
  setVisible = _useSchemaSettings2.setVisible,
@@ -409,16 +427,21 @@ SchemaSettings.FormItemTemplate = function (props) {
409
427
  return /*#__PURE__*/React.createElement(SchemaSettings.Item, {
410
428
  onClick: function () {
411
429
  var _onClick4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
412
- var gridSchema, values, sdn, _yield$saveAsTemplate2, key;
430
+ var _getCollection2, title, gridSchema, values, sdn, _yield$saveAsTemplate2, key;
413
431
 
414
432
  return regeneratorRuntime.wrap(function _callee6$(_context6) {
415
433
  while (1) {
416
434
  switch (_context6.prev = _context6.next) {
417
435
  case 0:
418
436
  setVisible(false);
437
+ _getCollection2 = getCollection(collectionName), title = _getCollection2.title;
419
438
  gridSchema = findGridSchema(fieldSchema);
420
- _context6.next = 4;
439
+ _context6.next = 5;
421
440
  return FormDialog(t('Save as template'), function () {
441
+ var componentTitle = {
442
+ FormItem: t('Form'),
443
+ ReadPrettyFormItem: t('Details')
444
+ };
422
445
  return /*#__PURE__*/React.createElement(FormLayout, {
423
446
  layout: 'vertical'
424
447
  }, /*#__PURE__*/React.createElement(SchemaComponent, {
@@ -432,6 +455,7 @@ SchemaSettings.FormItemTemplate = function (props) {
432
455
  name: {
433
456
  title: t('Template name'),
434
457
  required: true,
458
+ default: "".concat(compile(title), "_").concat(componentTitle[componentName] || componentName),
435
459
  'x-decorator': 'FormItem',
436
460
  'x-component': 'Input'
437
461
  }
@@ -440,7 +464,7 @@ SchemaSettings.FormItemTemplate = function (props) {
440
464
  }));
441
465
  }).open({});
442
466
 
443
- case 4:
467
+ case 5:
444
468
  values = _context6.sent;
445
469
  sdn = createDesignable({
446
470
  t: t,
@@ -449,7 +473,7 @@ SchemaSettings.FormItemTemplate = function (props) {
449
473
  current: gridSchema.parent
450
474
  });
451
475
  sdn.loadAPIClientEvents();
452
- _context6.next = 9;
476
+ _context6.next = 10;
453
477
  return saveAsTemplate({
454
478
  collectionName: collectionName,
455
479
  resourceName: resourceName,
@@ -458,7 +482,7 @@ SchemaSettings.FormItemTemplate = function (props) {
458
482
  uid: gridSchema['x-uid']
459
483
  });
460
484
 
461
- case 9:
485
+ case 10:
462
486
  _yield$saveAsTemplate2 = _context6.sent;
463
487
  key = _yield$saveAsTemplate2.key;
464
488
  sdn.removeWithoutEmit(gridSchema);
@@ -470,7 +494,7 @@ SchemaSettings.FormItemTemplate = function (props) {
470
494
  }
471
495
  });
472
496
  fieldSchema['x-template-key'] = key;
473
- _context6.next = 16;
497
+ _context6.next = 17;
474
498
  return api.request({
475
499
  url: "uiSchemas:patch",
476
500
  method: 'post',
@@ -480,7 +504,7 @@ SchemaSettings.FormItemTemplate = function (props) {
480
504
  }
481
505
  });
482
506
 
483
- case 16:
507
+ case 17:
484
508
  case "end":
485
509
  return _context6.stop();
486
510
  }
@@ -603,11 +627,36 @@ SchemaSettings.SelectItem = function (props) {
603
627
  })));
604
628
  };
605
629
 
606
- SchemaSettings.SwitchItem = function (props) {
630
+ SchemaSettings.CascaderItem = function (props) {
607
631
  var title = props.title,
632
+ options = props.options,
633
+ value = props.value,
608
634
  onChange = props.onChange,
609
635
  others = _objectWithoutProperties(props, _excluded4);
610
636
 
637
+ return /*#__PURE__*/React.createElement(SchemaSettings.Item, _objectSpread({}, others), /*#__PURE__*/React.createElement("div", {
638
+ style: {
639
+ alignItems: 'center',
640
+ display: 'flex',
641
+ justifyContent: 'space-between'
642
+ }
643
+ }, title, /*#__PURE__*/React.createElement(Cascader, {
644
+ bordered: false,
645
+ defaultValue: value,
646
+ onChange: onChange,
647
+ options: options,
648
+ style: {
649
+ textAlign: 'right',
650
+ minWidth: 100
651
+ }
652
+ })));
653
+ };
654
+
655
+ SchemaSettings.SwitchItem = function (props) {
656
+ var title = props.title,
657
+ onChange = props.onChange,
658
+ others = _objectWithoutProperties(props, _excluded5);
659
+
611
660
  var _useState3 = useState(!!props.checked),
612
661
  _useState4 = _slicedToArray(_useState3, 2),
613
662
  checked = _useState4[0],
@@ -635,7 +684,7 @@ SchemaSettings.SwitchItem = function (props) {
635
684
 
636
685
  SchemaSettings.PopupItem = function (props) {
637
686
  var schema = props.schema,
638
- others = _objectWithoutProperties(props, _excluded5);
687
+ others = _objectWithoutProperties(props, _excluded6);
639
688
 
640
689
  var _useState5 = useState(false),
641
690
  _useState6 = _slicedToArray(_useState5, 2),
@@ -670,7 +719,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
670
719
  schema = props.schema,
671
720
  modalTip = props.modalTip,
672
721
  components = props.components,
673
- others = _objectWithoutProperties(props, _excluded6);
722
+ others = _objectWithoutProperties(props, _excluded7);
674
723
 
675
724
  var _useState7 = useState(false),
676
725
  _useState8 = _slicedToArray(_useState7, 2),
@@ -821,7 +870,8 @@ SchemaSettings.ModalItem = function (props) {
821
870
  onSubmit = props.onSubmit,
822
871
  asyncGetInitialValues = props.asyncGetInitialValues,
823
872
  initialValues = props.initialValues,
824
- others = _objectWithoutProperties(props, _excluded7);
873
+ width = props.width,
874
+ others = _objectWithoutProperties(props, _excluded8);
825
875
 
826
876
  var options = useContext(SchemaOptionsContext);
827
877
  var cm = useContext(CollectionManagerContext);
@@ -856,7 +906,10 @@ SchemaSettings.ModalItem = function (props) {
856
906
 
857
907
  case 7:
858
908
  values = _context9.t0;
859
- FormDialog(schema.title || title, function () {
909
+ FormDialog({
910
+ title: schema.title || title,
911
+ width: width
912
+ }, function () {
860
913
  return /*#__PURE__*/React.createElement(CollectionManagerContext.Provider, {
861
914
  value: cm
862
915
  }, /*#__PURE__*/React.createElement(SchemaComponentOptions, {
@@ -934,4 +987,144 @@ SchemaSettings.BlockTitleItem = function () {
934
987
  dn.refresh();
935
988
  }
936
989
  });
990
+ };
991
+
992
+ SchemaSettings.LinkageRules = function (props) {
993
+ var collectionName = props.collectionName;
994
+ var fieldSchema = useFieldSchema();
995
+
996
+ var _useDesignable2 = useDesignable(),
997
+ dn = _useDesignable2.dn;
998
+
999
+ var _useTranslation6 = useTranslation(),
1000
+ t = _useTranslation6.t;
1001
+
1002
+ var _useSchemaTemplateMan4 = useSchemaTemplateManager(),
1003
+ getTemplateById = _useSchemaTemplateMan4.getTemplateById;
1004
+
1005
+ var type = fieldSchema['x-component'] === 'Action' ? 'button' : 'field';
1006
+ var gridSchema = findGridSchema(fieldSchema) || fieldSchema;
1007
+ return /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
1008
+ title: t('Linkage rules'),
1009
+ components: {
1010
+ ArrayCollapse: ArrayCollapse,
1011
+ FormLayout: FormLayout
1012
+ },
1013
+ width: 750,
1014
+ schema: {
1015
+ type: 'object',
1016
+ title: t('Linkage rules'),
1017
+ properties: {
1018
+ fieldReaction: {
1019
+ 'x-component': FormLinkageRules,
1020
+ 'x-component-props': {
1021
+ useProps: function useProps() {
1022
+ var options = useCollectionFilterOptions(collectionName);
1023
+ return {
1024
+ options: options,
1025
+ defaultValues: (gridSchema === null || gridSchema === void 0 ? void 0 : gridSchema['x-linkage-rules']) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-linkage-rules']),
1026
+ type: type,
1027
+ linkageOptions: useLinkageCollectionFieldOptions(collectionName),
1028
+ collectionName: collectionName
1029
+ };
1030
+ }
1031
+ }
1032
+ }
1033
+ }
1034
+ },
1035
+ onSubmit: function onSubmit(v) {
1036
+ var rules = [];
1037
+
1038
+ var _iterator = _createForOfIteratorHelper(v.fieldReaction.rules),
1039
+ _step;
1040
+
1041
+ try {
1042
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1043
+ var rule = _step.value;
1044
+ rules.push(_.pickBy(rule, _.identity));
1045
+ }
1046
+ } catch (err) {
1047
+ _iterator.e(err);
1048
+ } finally {
1049
+ _iterator.f();
1050
+ }
1051
+
1052
+ var templateId = gridSchema['x-component'] === 'BlockTemplate' && gridSchema['x-component-props'].templateId;
1053
+ var uid = templateId && getTemplateById(templateId).uid || gridSchema['x-uid'];
1054
+
1055
+ var schema = _defineProperty({}, 'x-uid', uid);
1056
+
1057
+ gridSchema['x-linkage-rules'] = rules;
1058
+ schema['x-linkage-rules'] = rules;
1059
+ dn.emit('patch', {
1060
+ schema: schema
1061
+ });
1062
+ dn.refresh();
1063
+ }
1064
+ });
1065
+ };
1066
+
1067
+ SchemaSettings.EnableChildCollections = function (props) {
1068
+ var collectionName = props.collectionName;
1069
+ var fieldSchema = useFieldSchema();
1070
+
1071
+ var _useDesignable3 = useDesignable(),
1072
+ dn = _useDesignable3.dn;
1073
+
1074
+ var _useTranslation7 = useTranslation(),
1075
+ t = _useTranslation7.t;
1076
+
1077
+ return /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
1078
+ title: t('Enable child collections'),
1079
+ components: {
1080
+ ArrayItems: ArrayItems,
1081
+ FormLayout: FormLayout
1082
+ },
1083
+ width: 600,
1084
+ schema: {
1085
+ type: 'object',
1086
+ title: t('Enable child collections'),
1087
+ properties: {
1088
+ enableChildren: {
1089
+ 'x-component': EnableChildCollections,
1090
+ 'x-component-props': {
1091
+ useProps: function useProps() {
1092
+ return {
1093
+ defaultValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-enable-children'],
1094
+ collectionName: collectionName
1095
+ };
1096
+ }
1097
+ }
1098
+ }
1099
+ }
1100
+ },
1101
+ onSubmit: function onSubmit(v) {
1102
+ var enableChildren = [];
1103
+
1104
+ var _iterator2 = _createForOfIteratorHelper(v.enableChildren.childrenCollections),
1105
+ _step2;
1106
+
1107
+ try {
1108
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1109
+ var item = _step2.value;
1110
+ enableChildren.push(_.pickBy(item, _.identity));
1111
+ }
1112
+ } catch (err) {
1113
+ _iterator2.e(err);
1114
+ } finally {
1115
+ _iterator2.f();
1116
+ }
1117
+
1118
+ var uid = fieldSchema['x-uid'];
1119
+
1120
+ var schema = _defineProperty({}, 'x-uid', uid);
1121
+
1122
+ fieldSchema['x-enable-children'] = enableChildren;
1123
+ schema['x-enable-children'] = enableChildren;
1124
+ dn.emit('patch', {
1125
+ schema: schema
1126
+ });
1127
+ dn.refresh();
1128
+ }
1129
+ });
937
1130
  };
@@ -25,6 +25,13 @@ export var BlockTemplate = observer(function (props) {
25
25
  var template = useMemo(function () {
26
26
  return getTemplateById(templateId);
27
27
  }, [templateId]);
28
+
29
+ var onSuccess = function onSuccess(data) {
30
+ var _data$data;
31
+
32
+ fieldSchema['x-linkage-rules'] = (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data['x-linkage-rules']) || [];
33
+ };
34
+
28
35
  return template ? /*#__PURE__*/React.createElement(BlockTemplateContext.Provider, {
29
36
  value: {
30
37
  dn: dn,
@@ -34,6 +41,7 @@ export var BlockTemplate = observer(function (props) {
34
41
  }
35
42
  }, /*#__PURE__*/React.createElement(RemoteSchemaComponent, {
36
43
  noForm: true,
37
- uid: template === null || template === void 0 ? void 0 : template.uid
44
+ uid: template === null || template === void 0 ? void 0 : template.uid,
45
+ onSuccess: onSuccess
38
46
  })) : null;
39
47
  });
@@ -308,7 +308,7 @@ var schema2 = {
308
308
  },
309
309
  properties: {
310
310
  submit: {
311
- title: 'Submit',
311
+ title: '{{t("Submit")}}',
312
312
  'x-component': 'Action',
313
313
  'x-component-props': {
314
314
  type: 'primary',
@@ -33,10 +33,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
33
33
 
34
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
35
 
36
- function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
37
-
38
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
39
-
40
36
  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; }
41
37
 
42
38
  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; }
@@ -362,6 +358,8 @@ var useRecordPkValue = function useRecordPkValue() {
362
358
  exports.useRecordPkValue = useRecordPkValue;
363
359
 
364
360
  var ACLActionProvider = function ACLActionProvider(props) {
361
+ var _actionPath;
362
+
365
363
  var recordPkValue = useRecordPkValue();
366
364
  var resource = useResourceName();
367
365
 
@@ -375,7 +373,7 @@ var ACLActionProvider = function ACLActionProvider(props) {
375
373
  actionPath = "".concat(resource, ":").concat(schema['x-action']);
376
374
  }
377
375
 
378
- if (!actionPath.includes(':')) {
376
+ if (!((_actionPath = actionPath) === null || _actionPath === void 0 ? void 0 : _actionPath.includes(':'))) {
379
377
  actionPath = "".concat(resource, ":").concat(actionPath);
380
378
  }
381
379
 
@@ -418,10 +416,11 @@ var useACLFieldWhitelist = function useACLFieldWhitelist() {
418
416
  }
419
417
 
420
418
  var _fieldSchema$xCollec = fieldSchema['x-collection-field'].split('.'),
421
- _fieldSchema$xCollec2 = _toArray(_fieldSchema$xCollec),
422
- keys = _fieldSchema$xCollec2.slice(1);
419
+ _fieldSchema$xCollec2 = _slicedToArray(_fieldSchema$xCollec, 2),
420
+ key1 = _fieldSchema$xCollec2[0],
421
+ key2 = _fieldSchema$xCollec2[1];
423
422
 
424
- return whitelist === null || whitelist === void 0 ? void 0 : whitelist.includes(keys.join('.'));
423
+ return whitelist === null || whitelist === void 0 ? void 0 : whitelist.includes(key2 || key1);
425
424
  }
426
425
  };
427
426
  };
@@ -87,6 +87,12 @@ var APIClient = /*#__PURE__*/function (_APIClientSDK) {
87
87
  value: function interceptors() {
88
88
  this.axios.interceptors.request.use(function (config) {
89
89
  config.headers['X-With-ACL-Meta'] = true;
90
+ var match = location.pathname.match(/^\/apps\/([^/]*)\//);
91
+
92
+ if (match) {
93
+ config.headers['X-App'] = match[1];
94
+ }
95
+
90
96
  return config;
91
97
  });
92
98
 
@@ -31,7 +31,7 @@ var _SharedFilterProvider = require("./SharedFilterProvider");
31
31
 
32
32
  var _excluded = ["title", "to"];
33
33
 
34
- var _templateObject, _templateObject2;
34
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
35
35
 
36
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
37
 
@@ -59,7 +59,7 @@ var BlockResourceContext = /*#__PURE__*/(0, _react2.createContext)(null);
59
59
  exports.BlockResourceContext = BlockResourceContext;
60
60
  var BlockAssociationContext = /*#__PURE__*/(0, _react2.createContext)(null);
61
61
  exports.BlockAssociationContext = BlockAssociationContext;
62
- var BlockRequestContext = /*#__PURE__*/(0, _react2.createContext)(null);
62
+ var BlockRequestContext = /*#__PURE__*/(0, _react2.createContext)({});
63
63
  exports.BlockRequestContext = BlockRequestContext;
64
64
 
65
65
  var useBlockResource = function useBlockResource() {
@@ -140,7 +140,7 @@ var useResourceAction = function useResourceAction(props) {
140
140
  fields = _useCollection.fields;
141
141
 
142
142
  var appends = fields === null || fields === void 0 ? void 0 : fields.filter(function (field) {
143
- return field.target && field.interface !== 'snapshot';
143
+ return field.target;
144
144
  }).map(function (field) {
145
145
  return field.name;
146
146
  });
@@ -264,10 +264,11 @@ var RenderChildrenWithAssociationFilter = function RenderChildrenWithAssociation
264
264
 
265
265
  if (associationFilterSchema) {
266
266
  return /*#__PURE__*/_react2.default.createElement(Component, _objectSpread({}, field.componentProps), /*#__PURE__*/_react2.default.createElement(_antd.Row, {
267
+ className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n "]))),
267
268
  gutter: 16,
268
269
  wrap: false
269
270
  }, /*#__PURE__*/_react2.default.createElement(_antd.Col, {
270
- className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 200px;\n flex: 0 0 auto;\n "])))
271
+ className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 200px;\n flex: 0 0 auto;\n "])))
271
272
  }, /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
272
273
  schema: fieldSchema,
273
274
  onlyRenderProperties: true,
@@ -275,14 +276,16 @@ var RenderChildrenWithAssociationFilter = function RenderChildrenWithAssociation
275
276
  return s['x-component'] === 'AssociationFilter';
276
277
  }
277
278
  })), /*#__PURE__*/_react2.default.createElement(_antd.Col, {
278
- className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n min-width: 0;\n "])))
279
+ className: (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n min-width: 0;\n "])))
280
+ }, /*#__PURE__*/_react2.default.createElement("div", {
281
+ className: (0, _css.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n "])))
279
282
  }, /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
280
283
  schema: fieldSchema,
281
284
  onlyRenderProperties: true,
282
285
  filterProperties: function filterProperties(s) {
283
286
  return s['x-component'] !== 'AssociationFilter';
284
287
  }
285
- }))));
288
+ })))));
286
289
  }
287
290
 
288
291
  return props.children;
@@ -85,18 +85,27 @@ var InternalFormBlockProvider = function InternalFormBlockProvider(props) {
85
85
 
86
86
  var FormBlockProvider = function FormBlockProvider(props) {
87
87
  var record = (0, _recordProvider.useRecord)();
88
- var __tableName = record.__tableName;
89
-
90
- var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
91
- getInheritCollections = _useCollectionManager.getInheritCollections;
92
-
93
- var inheritCollections = getInheritCollections(__tableName);
88
+ var collection = props.collection;
89
+ var __collection = record.__collection;
90
+ var currentCollection = (0, _collectionManager.useCollection)();
94
91
 
95
92
  var _useDesignable = (0, _schemaComponent.useDesignable)(),
96
93
  designable = _useDesignable.designable;
97
94
 
98
- var flag = !designable && __tableName && !inheritCollections.includes(props.collection) && __tableName !== props.collection;
99
- return !flag && /*#__PURE__*/_react2.default.createElement(_BlockProvider.BlockProvider, _objectSpread({}, props), /*#__PURE__*/_react2.default.createElement(InternalFormBlockProvider, _objectSpread({}, props)));
95
+ var detailFlag = false;
96
+
97
+ if (Object.keys(record).length > 0) {
98
+ detailFlag = true;
99
+
100
+ if (!designable && __collection) {
101
+ detailFlag = __collection === collection;
102
+ }
103
+ }
104
+
105
+ var createFlag = currentCollection.name === collection && !Object.keys(record).length || !currentCollection.name;
106
+ return (detailFlag || createFlag) && /*#__PURE__*/_react2.default.createElement(_BlockProvider.BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
107
+ block: 'form'
108
+ }), /*#__PURE__*/_react2.default.createElement(InternalFormBlockProvider, _objectSpread({}, props)));
100
109
  };
101
110
 
102
111
  exports.FormBlockProvider = FormBlockProvider;
@@ -149,7 +149,7 @@ var useAssociationNames = function useAssociationNames(collection) {
149
149
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
150
150
  var collectionField = _step.value;
151
151
 
152
- if (collectionField.target && collectionField.interface !== 'snapshot') {
152
+ if (collectionField.target) {
153
153
  associationFields.add(collectionField.name);
154
154
  var fields = getCollectionFields(collectionField.target);
155
155
 
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- 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); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -27,6 +25,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
25
 
28
26
  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; }
29
27
 
28
+ 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); }
29
+
30
30
  var SHARED_FILTER_CONDITION;
31
31
  exports.SHARED_FILTER_CONDITION = SHARED_FILTER_CONDITION;
32
32
 
@@ -37,7 +37,13 @@ exports.SHARED_FILTER_CONDITION = SHARED_FILTER_CONDITION;
37
37
 
38
38
  var mergeFilter = function mergeFilter(filters) {
39
39
  var op = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$and';
40
- var items = filters.filter(Boolean);
40
+ var items = filters.filter(function (f) {
41
+ if (f && _typeof(f) === 'object' && !Array.isArray(f)) {
42
+ return Object.values(f).filter(function (v) {
43
+ return v !== undefined;
44
+ }).length;
45
+ }
46
+ });
41
47
 
42
48
  if (items.length === 0) {
43
49
  return {};