@nocobase/client 0.9.0-alpha.2 → 0.9.1-alpha.1

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 (291) hide show
  1. package/es/acl/ACLProvider.js +4 -7
  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 +3 -1
  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.js +3 -1
  33. package/es/collection-manager/context.d.ts +4 -0
  34. package/es/collection-manager/context.js +5 -1
  35. package/es/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  36. package/es/collection-manager/hooks/useCollectionManager.js +51 -6
  37. package/es/collection-manager/interfaces/m2m.js +2 -2
  38. package/es/collection-manager/interfaces/properties/index.d.ts +0 -56
  39. package/es/collection-manager/interfaces/properties/index.js +1 -2
  40. package/es/collection-manager/templates/calendar.js +1 -1
  41. package/es/collection-manager/templates/general.js +1 -1
  42. package/es/collection-manager/templates/properties/index.d.ts +12 -1
  43. package/es/collection-manager/templates/properties/index.js +11 -0
  44. package/es/i18n/i18n.js +3 -1
  45. package/es/locale/en_US.d.ts +23 -0
  46. package/es/locale/en_US.js +23 -0
  47. package/es/locale/ja_JP.d.ts +23 -0
  48. package/es/locale/ja_JP.js +24 -1
  49. package/es/locale/ru_RU.d.ts +1 -0
  50. package/es/locale/ru_RU.js +1 -0
  51. package/es/locale/zh_CN.d.ts +43 -4
  52. package/es/locale/zh_CN.js +44 -5
  53. package/es/route-switch/antd/admin-layout/index.js +13 -33
  54. package/es/schema-component/antd/action/Action.Designer.js +22 -15
  55. package/es/schema-component/antd/action/Action.js +25 -3
  56. package/es/schema-component/antd/action/utils.d.ts +1 -0
  57. package/es/schema-component/antd/action/utils.js +49 -0
  58. package/es/schema-component/antd/association-filter/AssociationFilter.js +4 -4
  59. package/es/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  60. package/es/schema-component/antd/association-select/useServiceOptions.js +47 -6
  61. package/es/schema-component/antd/calendar/Calendar.Designer.js +17 -36
  62. package/es/schema-component/antd/checkbox/Checkbox.js +9 -8
  63. package/es/schema-component/antd/date-picker/util.d.ts +1 -1
  64. package/es/schema-component/antd/date-picker/util.js +1 -1
  65. package/es/schema-component/antd/filter/DynamicComponent.js +3 -1
  66. package/es/schema-component/antd/filter/Filter.js +2 -1
  67. package/es/schema-component/antd/filter/FilterGroup.js +7 -4
  68. package/es/schema-component/antd/filter/FilterItem.js +3 -2
  69. package/es/schema-component/antd/filter/context.d.ts +1 -0
  70. package/es/schema-component/antd/filter/useValues.js +14 -11
  71. package/es/schema-component/antd/form/Form.js +11 -5
  72. package/es/schema-component/antd/form-item/FormItem.js +17 -8
  73. package/es/schema-component/antd/form-v2/Form.Designer.js +2 -0
  74. package/es/schema-component/antd/form-v2/Form.js +90 -7
  75. package/es/schema-component/antd/form-v2/utils.d.ts +5 -0
  76. package/es/schema-component/antd/form-v2/utils.js +161 -0
  77. package/es/schema-component/antd/grid/Grid.js +10 -5
  78. package/es/schema-component/antd/icon-picker/IconPicker.js +1 -0
  79. package/es/schema-component/antd/index.d.ts +1 -0
  80. package/es/schema-component/antd/index.js +1 -0
  81. package/es/schema-component/antd/input/Input.d.ts +2 -1
  82. package/es/schema-component/antd/input/Json.d.ts +5 -3
  83. package/es/schema-component/antd/input/Json.js +3 -2
  84. package/es/schema-component/antd/input-number/InputNumber.js +3 -1
  85. package/es/schema-component/antd/page/FixedBlock.js +3 -1
  86. package/es/schema-component/antd/page/Page.js +11 -5
  87. package/es/schema-component/antd/page/PageTabDesigner.js +3 -3
  88. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  89. package/es/schema-component/antd/record-picker/RecordPicker.js +1 -2
  90. package/es/schema-component/antd/record-picker/util.js +7 -0
  91. package/es/schema-component/antd/remote-select/RemoteSelect.js +76 -36
  92. package/es/schema-component/antd/rich-text/RichText.js +4 -2
  93. package/es/schema-component/antd/select/Select.js +14 -4
  94. package/es/schema-component/antd/table/Table.Array.js +10 -3
  95. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  96. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  97. package/es/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  98. package/es/schema-component/antd/time-picker/TimePicker.js +1 -1
  99. package/es/schema-component/antd/variable/Input.d.ts +2 -0
  100. package/es/schema-component/antd/variable/Input.js +244 -0
  101. package/es/schema-component/antd/variable/JSONInput.d.ts +2 -0
  102. package/es/schema-component/antd/variable/JSONInput.js +82 -0
  103. package/es/schema-component/antd/variable/TextArea.d.ts +2 -0
  104. package/es/schema-component/antd/variable/TextArea.js +322 -0
  105. package/es/schema-component/antd/variable/Variable.d.ts +8 -0
  106. package/es/schema-component/antd/variable/Variable.js +11 -0
  107. package/es/schema-component/antd/variable/index.d.ts +1 -0
  108. package/es/schema-component/antd/variable/index.js +1 -0
  109. package/es/schema-component/common/sortable-item/SortableItem.js +36 -6
  110. package/es/schema-component/common/utils/logic.js +523 -0
  111. package/es/schema-component/common/utils/uitls.d.ts +1 -0
  112. package/es/schema-component/common/utils/uitls.js +89 -0
  113. package/es/schema-initializer/SchemaInitializer.js +0 -1
  114. package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  115. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
  116. package/es/schema-initializer/index.d.ts +2 -1
  117. package/es/schema-initializer/index.js +2 -1
  118. package/es/schema-initializer/items/CalendarBlockInitializer.js +24 -41
  119. package/es/schema-initializer/utils.js +22 -7
  120. package/es/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  121. package/es/schema-settings/LinkageRules/DynamicComponent.js +113 -0
  122. package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  123. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +15 -0
  124. package/es/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  125. package/es/schema-settings/LinkageRules/LinkageRuleAction.js +162 -0
  126. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  127. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.js +71 -0
  128. package/es/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  129. package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +82 -0
  130. package/es/schema-settings/LinkageRules/Variables.d.ts +7 -0
  131. package/es/schema-settings/LinkageRules/Variables.js +115 -0
  132. package/es/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  133. package/es/schema-settings/LinkageRules/action-hooks.js +115 -0
  134. package/es/schema-settings/LinkageRules/context.d.ts +13 -0
  135. package/es/schema-settings/LinkageRules/context.js +4 -0
  136. package/es/schema-settings/LinkageRules/index.d.ts +2 -0
  137. package/es/schema-settings/LinkageRules/index.js +132 -0
  138. package/es/schema-settings/LinkageRules/type.d.ts +13 -0
  139. package/es/schema-settings/LinkageRules/type.js +15 -0
  140. package/es/schema-settings/LinkageRules/useValues.d.ts +1 -0
  141. package/es/schema-settings/LinkageRules/useValues.js +84 -0
  142. package/es/schema-settings/SchemaSettings.d.ts +4 -1
  143. package/es/schema-settings/SchemaSettings.js +153 -26
  144. package/es/schema-templates/BlockTemplate.js +9 -1
  145. package/es/system-settings/SystemSettingsShortcut.js +1 -1
  146. package/lib/acl/ACLProvider.js +4 -7
  147. package/lib/api-client/APIClient.js +6 -0
  148. package/lib/block-provider/BlockProvider.js +9 -6
  149. package/lib/block-provider/FormBlockProvider.js +3 -1
  150. package/lib/block-provider/KanbanBlockProvider.js +1 -1
  151. package/lib/block-provider/SharedFilterProvider.js +9 -3
  152. package/lib/block-provider/TableBlockProvider.js +1 -1
  153. package/lib/block-provider/TableSelectorProvider.js +2 -2
  154. package/lib/block-provider/hooks/index.js +23 -7
  155. package/lib/collection-manager/CollectionManagerProvider.d.ts +1 -0
  156. package/lib/collection-manager/CollectionManagerProvider.js +81 -16
  157. package/lib/collection-manager/CollectionManagerShortcut.js +36 -23
  158. package/lib/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
  159. package/lib/collection-manager/Configuration/AddCategoryAction.js +145 -0
  160. package/lib/collection-manager/Configuration/AddCollectionAction.js +8 -3
  161. package/lib/collection-manager/Configuration/AddFieldAction.js +1 -0
  162. package/lib/collection-manager/Configuration/ConfigurationTable.js +34 -4
  163. package/lib/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
  164. package/lib/collection-manager/Configuration/ConfigurationTabs.js +407 -0
  165. package/lib/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
  166. package/lib/collection-manager/Configuration/EditCategoryAction.js +178 -0
  167. package/lib/collection-manager/Configuration/EditCollectionAction.js +6 -2
  168. package/lib/collection-manager/Configuration/OverridingCollectionField.js +17 -8
  169. package/lib/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
  170. package/lib/collection-manager/Configuration/components/CollectionCategory.js +27 -0
  171. package/lib/collection-manager/Configuration/index.d.ts +3 -0
  172. package/lib/collection-manager/Configuration/index.js +39 -0
  173. package/lib/collection-manager/Configuration/schemas/collections.d.ts +3 -0
  174. package/lib/collection-manager/Configuration/schemas/collections.js +316 -178
  175. package/lib/collection-manager/Configuration/templates.d.ts +1 -0
  176. package/lib/collection-manager/Configuration/templates.js +2 -0
  177. package/lib/collection-manager/action-hooks.js +3 -1
  178. package/lib/collection-manager/context.d.ts +4 -0
  179. package/lib/collection-manager/context.js +7 -2
  180. package/lib/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  181. package/lib/collection-manager/hooks/useCollectionManager.js +52 -6
  182. package/lib/collection-manager/interfaces/m2m.js +2 -2
  183. package/lib/collection-manager/interfaces/properties/index.d.ts +0 -56
  184. package/lib/collection-manager/interfaces/properties/index.js +1 -2
  185. package/lib/collection-manager/templates/calendar.js +1 -1
  186. package/lib/collection-manager/templates/general.js +1 -1
  187. package/lib/collection-manager/templates/properties/index.d.ts +12 -1
  188. package/lib/collection-manager/templates/properties/index.js +11 -0
  189. package/lib/i18n/i18n.js +3 -1
  190. package/lib/locale/en_US.d.ts +23 -0
  191. package/lib/locale/en_US.js +23 -0
  192. package/lib/locale/ja_JP.d.ts +23 -0
  193. package/lib/locale/ja_JP.js +24 -1
  194. package/lib/locale/ru_RU.d.ts +1 -0
  195. package/lib/locale/ru_RU.js +1 -0
  196. package/lib/locale/zh_CN.d.ts +43 -4
  197. package/lib/locale/zh_CN.js +44 -5
  198. package/lib/route-switch/antd/admin-layout/index.js +13 -33
  199. package/lib/schema-component/antd/action/Action.Designer.js +24 -14
  200. package/lib/schema-component/antd/action/Action.js +27 -2
  201. package/lib/schema-component/antd/action/utils.d.ts +1 -0
  202. package/lib/schema-component/antd/action/utils.js +58 -2
  203. package/lib/schema-component/antd/association-filter/AssociationFilter.js +3 -3
  204. package/lib/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  205. package/lib/schema-component/antd/association-select/useServiceOptions.js +47 -4
  206. package/lib/schema-component/antd/calendar/Calendar.Designer.js +15 -33
  207. package/lib/schema-component/antd/checkbox/Checkbox.js +8 -7
  208. package/lib/schema-component/antd/date-picker/util.d.ts +1 -1
  209. package/lib/schema-component/antd/date-picker/util.js +1 -1
  210. package/lib/schema-component/antd/filter/DynamicComponent.js +3 -1
  211. package/lib/schema-component/antd/filter/Filter.js +2 -1
  212. package/lib/schema-component/antd/filter/FilterGroup.js +7 -4
  213. package/lib/schema-component/antd/filter/FilterItem.js +3 -2
  214. package/lib/schema-component/antd/filter/context.d.ts +1 -0
  215. package/lib/schema-component/antd/filter/useValues.js +15 -11
  216. package/lib/schema-component/antd/form/Form.js +9 -3
  217. package/lib/schema-component/antd/form-item/FormItem.js +21 -7
  218. package/lib/schema-component/antd/form-v2/Form.Designer.js +2 -0
  219. package/lib/schema-component/antd/form-v2/Form.js +89 -5
  220. package/lib/schema-component/antd/form-v2/utils.d.ts +5 -0
  221. package/lib/schema-component/antd/form-v2/utils.js +181 -0
  222. package/lib/schema-component/antd/grid/Grid.js +10 -5
  223. package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -0
  224. package/lib/schema-component/antd/index.d.ts +1 -0
  225. package/lib/schema-component/antd/index.js +13 -0
  226. package/lib/schema-component/antd/input/Input.d.ts +2 -1
  227. package/lib/schema-component/antd/input/Json.d.ts +5 -3
  228. package/lib/schema-component/antd/input/Json.js +6 -3
  229. package/lib/schema-component/antd/input-number/InputNumber.js +2 -0
  230. package/lib/schema-component/antd/page/FixedBlock.js +3 -1
  231. package/lib/schema-component/antd/page/Page.js +14 -5
  232. package/lib/schema-component/antd/page/PageTabDesigner.js +1 -1
  233. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  234. package/lib/schema-component/antd/record-picker/RecordPicker.js +1 -2
  235. package/lib/schema-component/antd/record-picker/util.js +7 -0
  236. package/lib/schema-component/antd/remote-select/RemoteSelect.js +76 -37
  237. package/lib/schema-component/antd/rich-text/RichText.js +4 -2
  238. package/lib/schema-component/antd/select/Select.js +14 -4
  239. package/lib/schema-component/antd/table/Table.Array.js +8 -1
  240. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  241. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  242. package/lib/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  243. package/lib/schema-component/antd/time-picker/TimePicker.js +1 -1
  244. package/lib/schema-component/antd/variable/Input.d.ts +2 -0
  245. package/lib/schema-component/antd/variable/Input.js +262 -0
  246. package/lib/schema-component/antd/variable/JSONInput.d.ts +2 -0
  247. package/lib/schema-component/antd/variable/JSONInput.js +100 -0
  248. package/lib/schema-component/antd/variable/TextArea.d.ts +2 -0
  249. package/lib/schema-component/antd/variable/TextArea.js +341 -0
  250. package/lib/schema-component/antd/variable/Variable.d.ts +8 -0
  251. package/lib/schema-component/antd/variable/Variable.js +25 -0
  252. package/lib/schema-component/antd/variable/index.d.ts +1 -0
  253. package/lib/schema-component/antd/variable/index.js +18 -0
  254. package/lib/schema-component/common/sortable-item/SortableItem.js +36 -6
  255. package/lib/schema-component/common/utils/logic.js +525 -0
  256. package/lib/schema-component/common/utils/uitls.d.ts +1 -0
  257. package/lib/schema-component/common/utils/uitls.js +103 -0
  258. package/lib/schema-initializer/SchemaInitializer.js +0 -1
  259. package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  260. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
  261. package/lib/schema-initializer/index.d.ts +2 -1
  262. package/lib/schema-initializer/index.js +51 -2
  263. package/lib/schema-initializer/items/CalendarBlockInitializer.js +16 -33
  264. package/lib/schema-initializer/utils.js +22 -6
  265. package/lib/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  266. package/lib/schema-settings/LinkageRules/DynamicComponent.js +139 -0
  267. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  268. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +27 -0
  269. package/lib/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  270. package/lib/schema-settings/LinkageRules/LinkageRuleAction.js +190 -0
  271. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  272. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.js +90 -0
  273. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  274. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +104 -0
  275. package/lib/schema-settings/LinkageRules/Variables.d.ts +7 -0
  276. package/lib/schema-settings/LinkageRules/Variables.js +124 -0
  277. package/lib/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  278. package/lib/schema-settings/LinkageRules/action-hooks.js +127 -0
  279. package/lib/schema-settings/LinkageRules/context.d.ts +13 -0
  280. package/lib/schema-settings/LinkageRules/context.js +15 -0
  281. package/lib/schema-settings/LinkageRules/index.d.ts +2 -0
  282. package/lib/schema-settings/LinkageRules/index.js +149 -0
  283. package/lib/schema-settings/LinkageRules/type.d.ts +13 -0
  284. package/lib/schema-settings/LinkageRules/type.js +22 -0
  285. package/lib/schema-settings/LinkageRules/useValues.d.ts +1 -0
  286. package/lib/schema-settings/LinkageRules/useValues.js +95 -0
  287. package/lib/schema-settings/SchemaSettings.d.ts +4 -1
  288. package/lib/schema-settings/SchemaSettings.js +176 -48
  289. package/lib/schema-templates/BlockTemplate.js +9 -1
  290. package/lib/system-settings/SystemSettingsShortcut.js +1 -1
  291. package/package.json +4 -4
@@ -1,7 +1,3 @@
1
- function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
2
-
3
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
-
5
1
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
2
 
7
3
  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; }
@@ -364,10 +360,11 @@ export var useACLFieldWhitelist = function useACLFieldWhitelist() {
364
360
  }
365
361
 
366
362
  var _fieldSchema$xCollec = fieldSchema['x-collection-field'].split('.'),
367
- _fieldSchema$xCollec2 = _toArray(_fieldSchema$xCollec),
368
- keys = _fieldSchema$xCollec2.slice(1);
363
+ _fieldSchema$xCollec2 = _slicedToArray(_fieldSchema$xCollec, 2),
364
+ key1 = _fieldSchema$xCollec2[0],
365
+ key2 = _fieldSchema$xCollec2[1];
369
366
 
370
- return whitelist === null || whitelist === void 0 ? void 0 : whitelist.includes(keys.join('.'));
367
+ return whitelist === null || whitelist === void 0 ? void 0 : whitelist.includes(key2 || key1);
371
368
  }
372
369
  };
373
370
  };
@@ -76,6 +76,12 @@ export var APIClient = /*#__PURE__*/function (_APIClientSDK) {
76
76
  value: function interceptors() {
77
77
  this.axios.interceptors.request.use(function (config) {
78
78
  config.headers['X-With-ACL-Meta'] = true;
79
+ var match = location.pathname.match(/^\/apps\/([^/]*)\//);
80
+
81
+ if (match) {
82
+ config.headers['X-App'] = match[1];
83
+ }
84
+
79
85
  return config;
80
86
  });
81
87
 
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["title", "to"];
2
2
 
3
- var _templateObject, _templateObject2;
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
4
 
5
5
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
6
 
@@ -31,7 +31,7 @@ import { useRecordIndex } from '../record-provider';
31
31
  import { SharedFilterProvider } from './SharedFilterProvider';
32
32
  export var BlockResourceContext = /*#__PURE__*/createContext(null);
33
33
  export var BlockAssociationContext = /*#__PURE__*/createContext(null);
34
- export var BlockRequestContext = /*#__PURE__*/createContext(null);
34
+ export var BlockRequestContext = /*#__PURE__*/createContext({});
35
35
  export var useBlockResource = function useBlockResource() {
36
36
  return useContext(BlockResourceContext);
37
37
  };
@@ -108,7 +108,7 @@ export var useResourceAction = function useResourceAction(props) {
108
108
  fields = _useCollection.fields;
109
109
 
110
110
  var appends = fields === null || fields === void 0 ? void 0 : fields.filter(function (field) {
111
- return field.target && field.interface !== 'snapshot';
111
+ return field.target;
112
112
  }).map(function (field) {
113
113
  return field.name;
114
114
  });
@@ -222,10 +222,11 @@ export var RenderChildrenWithAssociationFilter = function RenderChildrenWithAsso
222
222
 
223
223
  if (associationFilterSchema) {
224
224
  return /*#__PURE__*/React.createElement(Component, _objectSpread({}, field.componentProps), /*#__PURE__*/React.createElement(Row, {
225
+ className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n "]))),
225
226
  gutter: 16,
226
227
  wrap: false
227
228
  }, /*#__PURE__*/React.createElement(Col, {
228
- className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 200px;\n flex: 0 0 auto;\n "])))
229
+ className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 200px;\n flex: 0 0 auto;\n "])))
229
230
  }, /*#__PURE__*/React.createElement(RecursionField, {
230
231
  schema: fieldSchema,
231
232
  onlyRenderProperties: true,
@@ -233,14 +234,16 @@ export var RenderChildrenWithAssociationFilter = function RenderChildrenWithAsso
233
234
  return s['x-component'] === 'AssociationFilter';
234
235
  }
235
236
  })), /*#__PURE__*/React.createElement(Col, {
236
- className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n min-width: 0;\n "])))
237
+ className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n min-width: 0;\n "])))
238
+ }, /*#__PURE__*/React.createElement("div", {
239
+ className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n "])))
237
240
  }, /*#__PURE__*/React.createElement(RecursionField, {
238
241
  schema: fieldSchema,
239
242
  onlyRenderProperties: true,
240
243
  filterProperties: function filterProperties(s) {
241
244
  return s['x-component'] !== 'AssociationFilter';
242
245
  }
243
- }))));
246
+ })))));
244
247
  }
245
248
 
246
249
  return props.children;
@@ -71,7 +71,9 @@ export var FormBlockProvider = function FormBlockProvider(props) {
71
71
  designable = _useDesignable.designable;
72
72
 
73
73
  var flag = !designable && __tableName && !inheritCollections.includes(props.collection) && __tableName !== props.collection;
74
- return !flag && /*#__PURE__*/React.createElement(BlockProvider, _objectSpread({}, props), /*#__PURE__*/React.createElement(InternalFormBlockProvider, _objectSpread({}, props)));
74
+ return !flag && /*#__PURE__*/React.createElement(BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
75
+ block: 'form'
76
+ }), /*#__PURE__*/React.createElement(InternalFormBlockProvider, _objectSpread({}, props)));
75
77
  };
76
78
  export var useFormBlockContext = function useFormBlockContext() {
77
79
  return useContext(FormBlockContext);
@@ -124,7 +124,7 @@ var useAssociationNames = function useAssociationNames(collection) {
124
124
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
125
125
  var collectionField = _step.value;
126
126
 
127
- if (collectionField.target && collectionField.interface !== 'snapshot') {
127
+ if (collectionField.target) {
128
128
  associationFields.add(collectionField.name);
129
129
  var fields = getCollectionFields(collectionField.target);
130
130
 
@@ -12,6 +12,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  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; }
14
14
 
15
+ 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); }
16
+
15
17
  import React, { createContext, useState } from 'react';
16
18
  export var SHARED_FILTER_CONDITION;
17
19
 
@@ -22,7 +24,13 @@ export var SHARED_FILTER_CONDITION;
22
24
 
23
25
  export var mergeFilter = function mergeFilter(filters) {
24
26
  var op = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$and';
25
- var items = filters.filter(Boolean);
27
+ var items = filters.filter(function (f) {
28
+ if (f && _typeof(f) === 'object' && !Array.isArray(f)) {
29
+ return Object.values(f).filter(function (v) {
30
+ return v !== undefined;
31
+ }).length;
32
+ }
33
+ });
26
34
 
27
35
  if (items.length === 0) {
28
36
  return {};
@@ -73,7 +73,7 @@ export var useAssociationNames = function useAssociationNames(collection) {
73
73
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
74
74
  var collectionField = _step.value;
75
75
 
76
- if (collectionField.target && collectionField.interface !== 'snapshot') {
76
+ if (collectionField.target) {
77
77
  associationFields.add(collectionField.name);
78
78
  var fields = getCollectionFields(collectionField.target);
79
79
 
@@ -65,7 +65,7 @@ var useAssociationNames2 = function useAssociationNames2(collection) {
65
65
  getCollectionFields = _useCollectionManager.getCollectionFields;
66
66
 
67
67
  var names = (_getCollectionFields = getCollectionFields(collection)) === null || _getCollectionFields === void 0 ? void 0 : _getCollectionFields.filter(function (field) {
68
- return field.target && field.interface !== 'snapshot';
68
+ return field.target;
69
69
  }).map(function (field) {
70
70
  return field.name;
71
71
  });
@@ -90,7 +90,7 @@ var useAssociationNames = function useAssociationNames(collection) {
90
90
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
91
91
  var collectionField = _step.value;
92
92
 
93
- if (collectionField.target && collectionField.interface !== 'snapshot') {
93
+ if (collectionField.target) {
94
94
  associationFields.add(collectionField.name);
95
95
  var fields = getCollectionFields(collectionField.target);
96
96
 
@@ -1,13 +1,13 @@
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
+
1
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
6
 
3
7
  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; }
4
8
 
5
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; }
6
10
 
7
- 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); } }
8
-
9
- 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); }); }; }
10
-
11
11
  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); }
12
12
 
13
13
  import { useField, useFieldSchema, useForm } from '@formily/react';
@@ -15,6 +15,7 @@ import { message, Modal } from 'antd';
15
15
  import parse from 'json-templates';
16
16
  import { cloneDeep } from 'lodash';
17
17
  import get from 'lodash/get';
18
+ import omit from 'lodash/omit';
18
19
  import { useTranslation } from 'react-i18next';
19
20
  import { useHistory } from 'react-router-dom';
20
21
  import { useReactToPrint } from 'react-to-print';
@@ -89,6 +90,20 @@ var filterValue = function filterValue(value) {
89
90
  };
90
91
 
91
92
  function getFormValues(filterByTk, field, form, fieldNames, getField, resource) {
93
+ if (filterByTk) {
94
+ var _field$data;
95
+
96
+ var actionFields = field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.activeFields;
97
+
98
+ if (actionFields) {
99
+ var keys = Object.keys(form.values).filter(function (key) {
100
+ var f = getField(key);
101
+ return !actionFields.has(key) && ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(f === null || f === void 0 ? void 0 : f.type);
102
+ });
103
+ return omit(_objectSpread({}, form.values), keys);
104
+ }
105
+ }
106
+
92
107
  return form.values;
93
108
  var values = {};
94
109
 
@@ -1166,13 +1181,13 @@ export var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
1166
1181
  return {
1167
1182
  onClick: function onClick() {
1168
1183
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17() {
1169
- var _field$data, _field$data$selectedR, _field$data2, _service$refresh5;
1184
+ var _field$data2, _field$data2$selected, _field$data3, _service$refresh5;
1170
1185
 
1171
1186
  return regeneratorRuntime.wrap(function _callee17$(_context17) {
1172
1187
  while (1) {
1173
1188
  switch (_context17.prev = _context17.next) {
1174
1189
  case 0:
1175
- if (field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : (_field$data$selectedR = _field$data.selectedRowKeys) === null || _field$data$selectedR === void 0 ? void 0 : _field$data$selectedR.length) {
1190
+ if (field === null || field === void 0 ? void 0 : (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : (_field$data2$selected = _field$data2.selectedRowKeys) === null || _field$data2$selected === void 0 ? void 0 : _field$data2$selected.length) {
1176
1191
  _context17.next = 2;
1177
1192
  break;
1178
1193
  }
@@ -1182,7 +1197,7 @@ export var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
1182
1197
  case 2:
1183
1198
  _context17.next = 4;
1184
1199
  return resource.destroy({
1185
- filterByTk: (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : _field$data2.selectedRowKeys
1200
+ filterByTk: (_field$data3 = field.data) === null || _field$data3 === void 0 ? void 0 : _field$data3.selectedRowKeys
1186
1201
  });
1187
1202
 
1188
1203
  case 4:
@@ -2,3 +2,4 @@ import React from 'react';
2
2
  import { CollectionManagerOptions } from './types';
3
3
  export declare const CollectionManagerProvider: React.FC<CollectionManagerOptions>;
4
4
  export declare const RemoteCollectionManagerProvider: (props: any) => JSX.Element;
5
+ export declare const CollectionCategroriesProvider: (props: any) => JSX.Element;
@@ -6,13 +6,21 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
6
6
 
7
7
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
8
 
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
+
15
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
+
9
17
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
18
 
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
19
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
20
 
13
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
21
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
22
 
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
24
 
17
25
  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; }
18
26
 
@@ -21,14 +29,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
21
29
  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; }
22
30
 
23
31
  import { Spin } from 'antd';
24
- import React, { useContext, useState } from 'react';
25
32
  import { keyBy } from 'lodash';
33
+ import React, { useContext, useState } from 'react';
26
34
  import { useAPIClient, useRequest } from '../api-client';
27
- import { CollectionManagerSchemaComponentProvider } from './CollectionManagerSchemaComponentProvider';
28
- import { CollectionManagerContext } from './context';
29
35
  import { templateOptions } from '../collection-manager/Configuration/templates';
30
- import * as defaultInterfaces from './interfaces';
31
36
  import { useCollectionHistory } from './CollectionHistoryProvider';
37
+ import { CollectionManagerSchemaComponentProvider } from './CollectionManagerSchemaComponentProvider';
38
+ import { CollectionCategroriesContext, CollectionManagerContext } from './context';
39
+ import * as defaultInterfaces from './interfaces';
32
40
  export var CollectionManagerProvider = function CollectionManagerProvider(props) {
33
41
  var service = props.service,
34
42
  interfaces = props.interfaces,
@@ -45,7 +53,7 @@ export var CollectionManagerProvider = function CollectionManagerProvider(props)
45
53
  service: service,
46
54
  interfaces: _objectSpread(_objectSpread(_objectSpread({}, defaultInterfaces), ctx.interfaces), interfaces),
47
55
  templates: _objectSpread(_objectSpread({}, defaultTemplates), templates),
48
- collections: collections,
56
+ collections: [].concat(_toConsumableArray(ctx.collections), _toConsumableArray(collections)),
49
57
  refreshCM: refreshCM
50
58
  })
51
59
  }, /*#__PURE__*/React.createElement(CollectionManagerSchemaComponentProvider, null, props.children));
@@ -68,7 +76,7 @@ export var RemoteCollectionManagerProvider = function RemoteCollectionManagerPro
68
76
  action: 'list',
69
77
  params: {
70
78
  paginate: false,
71
- appends: ['fields', 'fields.uiSchema'],
79
+ appends: ['fields', 'fields.uiSchema', 'category'],
72
80
  filter: {// inherit: false,
73
81
  },
74
82
  sort: ['sort']
@@ -130,4 +138,58 @@ export var RemoteCollectionManagerProvider = function RemoteCollectionManagerPro
130
138
  collections: service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.data,
131
139
  refreshCM: refreshCM
132
140
  }, props));
141
+ };
142
+ export var CollectionCategroriesProvider = function CollectionCategroriesProvider(props) {
143
+ var _result$data;
144
+
145
+ var api = useAPIClient();
146
+ var options = {
147
+ url: 'collectionCategories:list',
148
+ params: {
149
+ paginate: false,
150
+ sort: ['sort']
151
+ }
152
+ };
153
+ var result = useRequest(options);
154
+
155
+ if (result.loading) {
156
+ return /*#__PURE__*/React.createElement(Spin, null);
157
+ }
158
+
159
+ return /*#__PURE__*/React.createElement(CollectionCategroriesContext.Provider, {
160
+ value: _objectSpread(_objectSpread({}, result), {}, {
161
+ data: result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.data,
162
+ refresh: function () {
163
+ var _refresh = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
164
+ var _yield$api$request2, data;
165
+
166
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
167
+ while (1) {
168
+ switch (_context2.prev = _context2.next) {
169
+ case 0:
170
+ _context2.next = 2;
171
+ return api.request(options);
172
+
173
+ case 2:
174
+ _yield$api$request2 = _context2.sent;
175
+ data = _yield$api$request2.data;
176
+ result.mutate(data);
177
+ return _context2.abrupt("return", (data === null || data === void 0 ? void 0 : data.data) || []);
178
+
179
+ case 6:
180
+ case "end":
181
+ return _context2.stop();
182
+ }
183
+ }
184
+ }, _callee2);
185
+ }));
186
+
187
+ function refresh() {
188
+ return _refresh.apply(this, arguments);
189
+ }
190
+
191
+ return refresh;
192
+ }()
193
+ })
194
+ }, props.children);
133
195
  };
@@ -14,13 +14,13 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
14
14
 
15
15
  import { DatabaseOutlined } from '@ant-design/icons';
16
16
  import { uid } from '@formily/shared';
17
- import { Card } from 'antd';
18
17
  import React, { useState } from 'react';
19
18
  import { useTranslation } from 'react-i18next';
20
19
  import { useHistory } from 'react-router-dom';
21
20
  import { PluginManager } from '../plugin-manager';
22
21
  import { ActionContext, SchemaComponent } from '../schema-component';
23
- import { AddCollectionField, AddFieldAction, ConfigurationTable, EditFieldAction, EditCollectionField, OverridingFieldAction, OverridingCollectionField, ViewCollectionField, ViewFieldAction, AddCollection, AddCollectionAction, EditCollection, EditCollectionAction } from './Configuration';
22
+ import { AddCollectionField, AddFieldAction, ConfigurationTable, EditFieldAction, EditCollectionField, OverridingFieldAction, OverridingCollectionField, ViewCollectionField, ViewFieldAction, AddCollection, AddCollectionAction, AddCategoryAction, AddCategory, EditCollection, EditCollectionAction, ConfigurationTabs, EditCategory, EditCategoryAction } from './Configuration';
23
+ import { CollectionCategroriesProvider } from './CollectionManagerProvider';
24
24
  var schema = {
25
25
  type: 'object',
26
26
  properties: _defineProperty({}, uid(), {
@@ -37,30 +37,40 @@ var schema = {
37
37
  var schema2 = {
38
38
  type: 'object',
39
39
  properties: _defineProperty({}, uid(), {
40
+ 'x-decorator': 'CollectionCategroriesProvider',
40
41
  'x-component': 'ConfigurationTable'
41
42
  })
42
43
  };
43
44
  export var CollectionManagerPane = function CollectionManagerPane() {
44
- return /*#__PURE__*/React.createElement(Card, {
45
- bordered: false
46
- }, /*#__PURE__*/React.createElement(SchemaComponent, {
47
- schema: schema2,
48
- components: {
49
- ConfigurationTable: ConfigurationTable,
50
- AddFieldAction: AddFieldAction,
51
- AddCollectionField: AddCollectionField,
52
- AddCollection: AddCollection,
53
- AddCollectionAction: AddCollectionAction,
54
- EditCollection: EditCollection,
55
- EditCollectionAction: EditCollectionAction,
56
- EditFieldAction: EditFieldAction,
57
- EditCollectionField: EditCollectionField,
58
- OverridingCollectionField: OverridingCollectionField,
59
- OverridingFieldAction: OverridingFieldAction,
60
- ViewCollectionField: ViewCollectionField,
61
- ViewFieldAction: ViewFieldAction
62
- }
63
- }));
45
+ return (
46
+ /*#__PURE__*/
47
+ // <Card bordered={false}>
48
+ React.createElement(SchemaComponent, {
49
+ schema: schema2,
50
+ components: {
51
+ CollectionCategroriesProvider: CollectionCategroriesProvider,
52
+ ConfigurationTable: ConfigurationTable,
53
+ ConfigurationTabs: ConfigurationTabs,
54
+ AddFieldAction: AddFieldAction,
55
+ AddCollectionField: AddCollectionField,
56
+ AddCollection: AddCollection,
57
+ AddCollectionAction: AddCollectionAction,
58
+ AddCategoryAction: AddCategoryAction,
59
+ AddCategory: AddCategory,
60
+ EditCollection: EditCollection,
61
+ EditCollectionAction: EditCollectionAction,
62
+ EditFieldAction: EditFieldAction,
63
+ EditCollectionField: EditCollectionField,
64
+ OverridingCollectionField: OverridingCollectionField,
65
+ OverridingFieldAction: OverridingFieldAction,
66
+ ViewCollectionField: ViewCollectionField,
67
+ ViewFieldAction: ViewFieldAction,
68
+ EditCategory: EditCategory,
69
+ EditCategoryAction: EditCategoryAction
70
+ }
71
+ }) // </Card>
72
+
73
+ );
64
74
  };
65
75
  export var CollectionManagerShortcut = function CollectionManagerShortcut() {
66
76
  var _useTranslation = useTranslation(),
@@ -99,12 +109,15 @@ export var CollectionManagerShortcut2 = function CollectionManagerShortcut2() {
99
109
  schema: schema,
100
110
  components: {
101
111
  ConfigurationTable: ConfigurationTable,
112
+ ConfigurationTabs: ConfigurationTabs,
102
113
  AddFieldAction: AddFieldAction,
103
114
  EditFieldAction: EditFieldAction,
104
115
  OverridingFieldAction: OverridingFieldAction,
105
116
  ViewFieldAction: ViewFieldAction,
106
117
  AddCollectionAction: AddCollectionAction,
107
- EditCollectionAction: EditCollectionAction
118
+ EditCollectionAction: EditCollectionAction,
119
+ AddCategoryAction: AddCategoryAction,
120
+ EditCategoryAction: EditCategoryAction
108
121
  }
109
122
  }));
110
123
  };
@@ -0,0 +1,2 @@
1
+ export declare const AddCategory: (props: any) => JSX.Element;
2
+ export declare const AddCategoryAction: (props: any) => JSX.Element;
@@ -0,0 +1,117 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ 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; }
14
+
15
+ 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; }
16
+
17
+ 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; }
18
+
19
+ 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); } }
20
+
21
+ 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); }); }; }
22
+
23
+ import { PlusOutlined } from '@ant-design/icons';
24
+ import { useForm } from '@formily/react';
25
+ import { cloneDeep } from 'lodash';
26
+ import React, { useContext, useState } from 'react';
27
+ import { useTranslation } from 'react-i18next';
28
+ import { useAPIClient } from '../../api-client';
29
+ import { ActionContext, SchemaComponent, useActionContext } from '../../schema-component';
30
+ import { useCancelAction } from '../action-hooks';
31
+ import { CollectionCategroriesContext } from '../context';
32
+ import * as components from './components';
33
+ import { collectionCategorySchema } from './schemas/collections';
34
+
35
+ var useCreateCategry = function useCreateCategry() {
36
+ var form = useForm();
37
+ var ctx = useActionContext();
38
+
39
+ var _useContext = useContext(CollectionCategroriesContext),
40
+ refresh = _useContext.refresh;
41
+
42
+ var api = useAPIClient();
43
+ return {
44
+ run: function run() {
45
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
46
+ var values;
47
+ return regeneratorRuntime.wrap(function _callee$(_context) {
48
+ while (1) {
49
+ switch (_context.prev = _context.next) {
50
+ case 0:
51
+ _context.next = 2;
52
+ return form.submit();
53
+
54
+ case 2:
55
+ values = cloneDeep(form.values);
56
+ _context.next = 5;
57
+ return api.resource('collectionCategories').create({
58
+ values: _objectSpread({}, values)
59
+ });
60
+
61
+ case 5:
62
+ ctx.setVisible(false);
63
+ _context.next = 8;
64
+ return form.reset();
65
+
66
+ case 8:
67
+ _context.next = 10;
68
+ return refresh();
69
+
70
+ case 10:
71
+ case "end":
72
+ return _context.stop();
73
+ }
74
+ }
75
+ }, _callee);
76
+ }))();
77
+ }
78
+ };
79
+ };
80
+
81
+ export var AddCategory = function AddCategory(props) {
82
+ return /*#__PURE__*/React.createElement(AddCategoryAction, _objectSpread({}, props));
83
+ };
84
+ export var AddCategoryAction = function AddCategoryAction(props) {
85
+ var scope = props.scope,
86
+ getContainer = props.getContainer,
87
+ children = props.children;
88
+
89
+ var _useState = useState(false),
90
+ _useState2 = _slicedToArray(_useState, 2),
91
+ visible = _useState2[0],
92
+ setVisible = _useState2[1];
93
+
94
+ var _useTranslation = useTranslation(),
95
+ t = _useTranslation.t;
96
+
97
+ return /*#__PURE__*/React.createElement(ActionContext.Provider, {
98
+ value: {
99
+ visible: visible,
100
+ setVisible: setVisible
101
+ }
102
+ }, /*#__PURE__*/React.createElement("div", {
103
+ onClick: function onClick() {
104
+ return setVisible(true);
105
+ },
106
+ title: t('Add category')
107
+ }, children || /*#__PURE__*/React.createElement(PlusOutlined, null)), /*#__PURE__*/React.createElement(SchemaComponent, {
108
+ schema: collectionCategorySchema,
109
+ components: _objectSpread({}, components),
110
+ scope: _objectSpread({
111
+ getContainer: getContainer,
112
+ useCancelAction: useCancelAction,
113
+ createOnly: true,
114
+ useCreateCategry: useCreateCategry
115
+ }, scope)
116
+ }));
117
+ };
@@ -45,7 +45,7 @@ import { useResourceActionContext, useResourceContext } from '../ResourceActionP
45
45
  import * as components from './components';
46
46
  import { templateOptions } from './templates';
47
47
 
48
- var getSchema = function getSchema(schema, record, compile) {
48
+ var getSchema = function getSchema(schema, category, compile) {
49
49
  if (!schema) {
50
50
  return;
51
51
  }
@@ -60,7 +60,8 @@ var getSchema = function getSchema(schema, record, compile) {
60
60
 
61
61
  var initialValue = _objectSpread({
62
62
  name: "t_".concat(uid()),
63
- template: schema.name
63
+ template: schema.name,
64
+ category: category
64
65
  }, cloneDeep(schema.default));
65
66
 
66
67
  if (initialValue.reverseField) {
@@ -342,6 +343,10 @@ export var AddCollectionAction = function AddCollectionAction(props) {
342
343
  key: option.name
343
344
  };
344
345
  });
346
+
347
+ var _useResourceActionCon2 = useResourceActionContext(),
348
+ category = _useResourceActionCon2.state.category;
349
+
345
350
  return /*#__PURE__*/React.createElement(RecordProvider, {
346
351
  record: record
347
352
  }, /*#__PURE__*/React.createElement(ActionContext.Provider, {
@@ -359,7 +364,7 @@ export var AddCollectionAction = function AddCollectionAction(props) {
359
364
  overflow: 'auto'
360
365
  },
361
366
  onClick: function onClick(info) {
362
- var schema = getSchema(getTemplate(info.key), record, compile);
367
+ var schema = getSchema(getTemplate(info.key), category, compile);
363
368
  setSchema(schema);
364
369
  setVisible(true);
365
370
  },
@@ -334,6 +334,7 @@ export var AddFieldAction = function AddFieldAction(props) {
334
334
  useCancelAction: useCancelAction,
335
335
  createOnly: true,
336
336
  isOverride: false,
337
+ override: false,
337
338
  useCreateCollectionField: useCreateCollectionField,
338
339
  record: record,
339
340
  showReverseFieldConfig: true,