@nocobase/client 0.7.6-alpha.2 → 0.8.0-alpha.4

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 (235) hide show
  1. package/es/acl/ACLShortcut.d.ts +2 -0
  2. package/es/acl/ACLShortcut.js +31 -2
  3. package/es/api-client/APIClient.d.ts +1 -0
  4. package/es/api-client/APIClient.js +6 -1
  5. package/es/application/Application.d.ts +3 -1
  6. package/es/application/Application.js +131 -39
  7. package/es/block-provider/BlockProvider.js +12 -1
  8. package/es/block-provider/CalendarBlockProvider.d.ts +1 -0
  9. package/es/block-provider/CalendarBlockProvider.js +6 -3
  10. package/es/block-provider/TableSelectorProvider.js +21 -6
  11. package/es/block-provider/hooks/index.d.ts +6 -0
  12. package/es/block-provider/hooks/index.js +485 -115
  13. package/es/collection-manager/CollectionManagerProvider.js +26 -45
  14. package/es/collection-manager/CollectionManagerShortcut.d.ts +2 -0
  15. package/es/collection-manager/CollectionManagerShortcut.js +38 -3
  16. package/es/collection-manager/Configuration/AddFieldAction.d.ts +5 -1
  17. package/es/collection-manager/Configuration/AddFieldAction.js +44 -13
  18. package/es/collection-manager/Configuration/EditFieldAction.d.ts +1 -0
  19. package/es/collection-manager/Configuration/EditFieldAction.js +24 -11
  20. package/es/collection-manager/Configuration/index.d.ts +2 -0
  21. package/es/collection-manager/Configuration/index.js +2 -0
  22. package/es/collection-manager/Configuration/schemas/collectionFields.js +2 -2
  23. package/es/collection-manager/index.d.ts +1 -0
  24. package/es/collection-manager/index.js +2 -1
  25. package/es/collection-manager/interfaces/index.d.ts +1 -0
  26. package/es/collection-manager/interfaces/index.js +1 -0
  27. package/es/collection-manager/interfaces/json.d.ts +2 -0
  28. package/es/collection-manager/interfaces/json.js +48 -0
  29. package/es/collection-manager/interfaces/m2o.js +3 -3
  30. package/es/collection-manager/interfaces/o2m.js +5 -6
  31. package/es/collection-manager/interfaces/o2o.js +5 -5
  32. package/es/collection-manager/interfaces/properties/index.d.ts +14 -0
  33. package/es/collection-manager/interfaces/properties/index.js +23 -0
  34. package/es/collection-manager/interfaces/sequence.js +13 -9
  35. package/es/index.d.ts +1 -0
  36. package/es/index.js +1 -0
  37. package/es/locale/en_US.d.ts +14 -1
  38. package/es/locale/en_US.js +15 -2
  39. package/es/locale/ja_JP.d.ts +2 -1
  40. package/es/locale/ja_JP.js +2 -1
  41. package/es/locale/ru_RU.d.ts +2 -1
  42. package/es/locale/ru_RU.js +2 -1
  43. package/es/locale/tr_TR.d.ts +1 -1
  44. package/es/locale/tr_TR.js +1 -1
  45. package/es/locale/zh_CN.d.ts +40 -1
  46. package/es/locale/zh_CN.js +41 -2
  47. package/es/plugin-manager/PluginManager.js +35 -23
  48. package/es/pm/PluginManagerLink.d.ts +2 -0
  49. package/es/pm/PluginManagerLink.js +111 -0
  50. package/es/pm/index.d.ts +4 -0
  51. package/es/pm/index.js +422 -0
  52. package/es/route-switch/antd/admin-layout/index.js +1 -1
  53. package/es/schema-component/antd/action/Action.Designer.js +35 -12
  54. package/es/schema-component/antd/action/Action.Modal.js +4 -2
  55. package/es/schema-component/antd/action/Action.js +3 -3
  56. package/es/schema-component/antd/action/context.d.ts +2 -0
  57. package/es/schema-component/antd/action/hooks.d.ts +1 -0
  58. package/es/schema-component/antd/calendar/Calendar.Designer.js +19 -6
  59. package/es/schema-component/antd/calendar/Calendar.js +23 -2
  60. package/es/schema-component/antd/calendar/Title.js +18 -3
  61. package/es/schema-component/antd/calendar/components/Header.d.ts +10 -0
  62. package/es/schema-component/antd/calendar/components/Header.js +43 -0
  63. package/es/schema-component/antd/calendar/style.less +53 -9
  64. package/es/schema-component/antd/calendar/types.d.ts +6 -0
  65. package/es/schema-component/antd/calendar/utils.d.ts +2 -0
  66. package/es/schema-component/antd/calendar/utils.js +7 -0
  67. package/es/schema-component/antd/checkbox/Checkbox.js +13 -4
  68. package/es/schema-component/antd/formula-input/FormulaInput.js +28 -37
  69. package/es/schema-component/antd/input/Input.d.ts +1 -0
  70. package/es/schema-component/antd/input/Input.js +2 -0
  71. package/es/schema-component/antd/input/Json.d.ts +6 -0
  72. package/es/schema-component/antd/input/Json.js +41 -0
  73. package/es/schema-component/antd/input/ReadPretty.d.ts +3 -0
  74. package/es/schema-component/antd/input/ReadPretty.js +15 -0
  75. package/es/schema-component/antd/input/index.d.ts +1 -0
  76. package/es/schema-component/antd/input/index.js +2 -1
  77. package/es/schema-component/antd/markdown/Markdown.Void.js +5 -2
  78. package/es/schema-component/antd/radio/Radio.js +2 -1
  79. package/es/schema-component/antd/select/ReadPretty.js +2 -1
  80. package/es/schema-component/antd/table-v2/TableSelectorDesigner.js +16 -2
  81. package/es/schema-component/antd/upload/Upload.js +2 -1
  82. package/es/schema-component/antd/upload/shared.js +5 -6
  83. package/es/schema-component/antd/upload/type.d.ts +2 -0
  84. package/es/schema-initializer/buttons/BulkEditFormItemInitializers.d.ts +1 -0
  85. package/es/schema-initializer/buttons/BulkEditFormItemInitializers.js +50 -0
  86. package/es/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.d.ts +1 -0
  87. package/es/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.js +35 -0
  88. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +132 -0
  89. package/es/schema-initializer/buttons/FormActionInitializers.js +118 -0
  90. package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
  91. package/es/schema-initializer/buttons/TabPaneInitializers.js +13 -0
  92. package/es/schema-initializer/buttons/TableActionInitializers.d.ts +56 -2
  93. package/es/schema-initializer/buttons/TableActionInitializers.js +45 -0
  94. package/es/schema-initializer/buttons/index.d.ts +2 -0
  95. package/es/schema-initializer/buttons/index.js +2 -0
  96. package/es/schema-initializer/components/BulkEditField.d.ts +7 -0
  97. package/es/schema-initializer/components/BulkEditField.js +187 -0
  98. package/es/schema-initializer/components/index.d.ts +1 -0
  99. package/es/schema-initializer/components/index.js +2 -1
  100. package/es/schema-initializer/items/BlockInitializer.js +8 -8
  101. package/es/schema-initializer/items/BulkEditSubmitActionInitializer.d.ts +1 -0
  102. package/es/schema-initializer/items/BulkEditSubmitActionInitializer.js +24 -0
  103. package/es/schema-initializer/items/CreateFormBulkEditBlockInitializer.d.ts +1 -0
  104. package/es/schema-initializer/items/CreateFormBulkEditBlockInitializer.js +103 -0
  105. package/es/schema-initializer/items/CustomizeBulkEditActionInitializer.d.ts +1 -0
  106. package/es/schema-initializer/items/CustomizeBulkEditActionInitializer.js +61 -0
  107. package/es/schema-initializer/items/index.d.ts +3 -0
  108. package/es/schema-initializer/items/index.js +3 -0
  109. package/es/schema-initializer/utils.d.ts +1 -0
  110. package/es/schema-initializer/utils.js +67 -12
  111. package/es/schema-settings/SchemaSettings.d.ts +6 -0
  112. package/es/schema-settings/SchemaSettings.js +4 -1
  113. package/es/schema-templates/BlockTemplatePage.d.ts +1 -0
  114. package/es/schema-templates/BlockTemplatePage.js +7 -0
  115. package/es/schema-templates/SchemaTemplateShortcut.js +1 -1
  116. package/es/system-settings/SystemSettingsShortcut.d.ts +2 -0
  117. package/es/system-settings/SystemSettingsShortcut.js +134 -5
  118. package/lib/acl/ACLShortcut.d.ts +2 -0
  119. package/lib/acl/ACLShortcut.js +41 -4
  120. package/lib/api-client/APIClient.d.ts +1 -0
  121. package/lib/api-client/APIClient.js +6 -1
  122. package/lib/application/Application.d.ts +3 -1
  123. package/lib/application/Application.js +139 -39
  124. package/lib/block-provider/BlockProvider.js +11 -0
  125. package/lib/block-provider/CalendarBlockProvider.d.ts +1 -0
  126. package/lib/block-provider/CalendarBlockProvider.js +6 -3
  127. package/lib/block-provider/TableSelectorProvider.js +21 -6
  128. package/lib/block-provider/hooks/index.d.ts +6 -0
  129. package/lib/block-provider/hooks/index.js +496 -115
  130. package/lib/collection-manager/CollectionManagerProvider.js +28 -47
  131. package/lib/collection-manager/CollectionManagerShortcut.d.ts +2 -0
  132. package/lib/collection-manager/CollectionManagerShortcut.js +47 -4
  133. package/lib/collection-manager/Configuration/AddFieldAction.d.ts +5 -1
  134. package/lib/collection-manager/Configuration/AddFieldAction.js +48 -12
  135. package/lib/collection-manager/Configuration/EditFieldAction.d.ts +1 -0
  136. package/lib/collection-manager/Configuration/EditFieldAction.js +26 -10
  137. package/lib/collection-manager/Configuration/index.d.ts +2 -0
  138. package/lib/collection-manager/Configuration/index.js +26 -0
  139. package/lib/collection-manager/Configuration/schemas/collectionFields.js +2 -2
  140. package/lib/collection-manager/index.d.ts +1 -0
  141. package/lib/collection-manager/index.js +14 -0
  142. package/lib/collection-manager/interfaces/index.d.ts +1 -0
  143. package/lib/collection-manager/interfaces/index.js +13 -0
  144. package/lib/collection-manager/interfaces/json.d.ts +2 -0
  145. package/lib/collection-manager/interfaces/json.js +58 -0
  146. package/lib/collection-manager/interfaces/m2o.js +2 -2
  147. package/lib/collection-manager/interfaces/o2m.js +4 -5
  148. package/lib/collection-manager/interfaces/o2o.js +4 -4
  149. package/lib/collection-manager/interfaces/properties/index.d.ts +14 -0
  150. package/lib/collection-manager/interfaces/properties/index.js +25 -1
  151. package/lib/collection-manager/interfaces/sequence.js +13 -9
  152. package/lib/index.d.ts +1 -0
  153. package/lib/index.js +13 -0
  154. package/lib/locale/en_US.d.ts +14 -1
  155. package/lib/locale/en_US.js +15 -2
  156. package/lib/locale/ja_JP.d.ts +2 -1
  157. package/lib/locale/ja_JP.js +2 -1
  158. package/lib/locale/ru_RU.d.ts +2 -1
  159. package/lib/locale/ru_RU.js +2 -1
  160. package/lib/locale/tr_TR.d.ts +1 -1
  161. package/lib/locale/tr_TR.js +1 -1
  162. package/lib/locale/zh_CN.d.ts +40 -1
  163. package/lib/locale/zh_CN.js +41 -2
  164. package/lib/plugin-manager/PluginManager.js +33 -21
  165. package/lib/pm/PluginManagerLink.d.ts +2 -0
  166. package/lib/pm/PluginManagerLink.js +138 -0
  167. package/lib/pm/index.d.ts +4 -0
  168. package/lib/pm/index.js +474 -0
  169. package/lib/route-switch/antd/admin-layout/index.js +1 -1
  170. package/lib/schema-component/antd/action/Action.Designer.js +35 -12
  171. package/lib/schema-component/antd/action/Action.Modal.js +4 -2
  172. package/lib/schema-component/antd/action/Action.js +3 -3
  173. package/lib/schema-component/antd/action/context.d.ts +2 -0
  174. package/lib/schema-component/antd/action/hooks.d.ts +1 -0
  175. package/lib/schema-component/antd/calendar/Calendar.Designer.js +19 -6
  176. package/lib/schema-component/antd/calendar/Calendar.js +24 -2
  177. package/lib/schema-component/antd/calendar/Title.js +18 -2
  178. package/lib/schema-component/antd/calendar/components/Header.d.ts +10 -0
  179. package/lib/schema-component/antd/calendar/components/Header.js +57 -0
  180. package/lib/schema-component/antd/calendar/style.less +53 -9
  181. package/lib/schema-component/antd/calendar/types.d.ts +6 -0
  182. package/lib/schema-component/antd/calendar/utils.d.ts +2 -0
  183. package/lib/schema-component/antd/calendar/utils.js +18 -2
  184. package/lib/schema-component/antd/checkbox/Checkbox.js +13 -4
  185. package/lib/schema-component/antd/formula-input/FormulaInput.js +28 -37
  186. package/lib/schema-component/antd/input/Input.d.ts +1 -0
  187. package/lib/schema-component/antd/input/Input.js +3 -0
  188. package/lib/schema-component/antd/input/Json.d.ts +6 -0
  189. package/lib/schema-component/antd/input/Json.js +53 -0
  190. package/lib/schema-component/antd/input/ReadPretty.d.ts +3 -0
  191. package/lib/schema-component/antd/input/ReadPretty.js +16 -0
  192. package/lib/schema-component/antd/input/index.d.ts +1 -0
  193. package/lib/schema-component/antd/input/index.js +13 -0
  194. package/lib/schema-component/antd/markdown/Markdown.Void.js +8 -2
  195. package/lib/schema-component/antd/radio/Radio.js +2 -1
  196. package/lib/schema-component/antd/select/ReadPretty.js +2 -1
  197. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +17 -2
  198. package/lib/schema-component/antd/upload/Upload.js +2 -1
  199. package/lib/schema-component/antd/upload/shared.js +4 -5
  200. package/lib/schema-component/antd/upload/type.d.ts +2 -0
  201. package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.d.ts +1 -0
  202. package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.js +66 -0
  203. package/lib/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.d.ts +1 -0
  204. package/lib/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.js +50 -0
  205. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +132 -0
  206. package/lib/schema-initializer/buttons/FormActionInitializers.js +121 -2
  207. package/lib/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
  208. package/lib/schema-initializer/buttons/TabPaneInitializers.js +18 -2
  209. package/lib/schema-initializer/buttons/TableActionInitializers.d.ts +56 -2
  210. package/lib/schema-initializer/buttons/TableActionInitializers.js +45 -0
  211. package/lib/schema-initializer/buttons/index.d.ts +2 -0
  212. package/lib/schema-initializer/buttons/index.js +26 -0
  213. package/lib/schema-initializer/components/BulkEditField.d.ts +7 -0
  214. package/lib/schema-initializer/components/BulkEditField.js +210 -0
  215. package/lib/schema-initializer/components/index.d.ts +1 -0
  216. package/lib/schema-initializer/components/index.js +13 -0
  217. package/lib/schema-initializer/items/BlockInitializer.js +8 -7
  218. package/lib/schema-initializer/items/BulkEditSubmitActionInitializer.d.ts +1 -0
  219. package/lib/schema-initializer/items/BulkEditSubmitActionInitializer.js +37 -0
  220. package/lib/schema-initializer/items/CreateFormBulkEditBlockInitializer.d.ts +1 -0
  221. package/lib/schema-initializer/items/CreateFormBulkEditBlockInitializer.js +121 -0
  222. package/lib/schema-initializer/items/CustomizeBulkEditActionInitializer.d.ts +1 -0
  223. package/lib/schema-initializer/items/CustomizeBulkEditActionInitializer.js +74 -0
  224. package/lib/schema-initializer/items/index.d.ts +3 -0
  225. package/lib/schema-initializer/items/index.js +39 -0
  226. package/lib/schema-initializer/utils.d.ts +1 -0
  227. package/lib/schema-initializer/utils.js +71 -13
  228. package/lib/schema-settings/SchemaSettings.d.ts +6 -0
  229. package/lib/schema-settings/SchemaSettings.js +3 -0
  230. package/lib/schema-templates/BlockTemplatePage.d.ts +1 -0
  231. package/lib/schema-templates/BlockTemplatePage.js +12 -2
  232. package/lib/schema-templates/SchemaTemplateShortcut.js +1 -1
  233. package/lib/system-settings/SystemSettingsShortcut.d.ts +2 -0
  234. package/lib/system-settings/SystemSettingsShortcut.js +145 -7
  235. package/package.json +5 -4
@@ -49,5 +49,50 @@ export var TableActionInitializers = {
49
49
  }
50
50
  }
51
51
  }]
52
+ }, {
53
+ type: 'divider'
54
+ }, {
55
+ type: 'subMenu',
56
+ title: '{{t("Customize")}}',
57
+ children: [{
58
+ type: 'item',
59
+ title: '{{t("Bulk update")}}',
60
+ component: 'CustomizeActionInitializer',
61
+ schema: {
62
+ type: 'void',
63
+ title: '{{ t("Bulk update") }}',
64
+ 'x-component': 'Action',
65
+ 'x-align': 'right',
66
+ 'x-decorator': 'ACLActionProvider',
67
+ 'x-acl-action-props': {
68
+ skipScopeCheck: true
69
+ },
70
+ 'x-action': 'customize:bulkUpdate',
71
+ 'x-designer': 'Action.Designer',
72
+ 'x-action-settings': {
73
+ assignedValues: {},
74
+ updateMode: 'selected',
75
+ onSuccess: {
76
+ manualClose: true,
77
+ redirecting: false,
78
+ successMessage: '{{t("Updated successfully")}}'
79
+ }
80
+ },
81
+ 'x-component-props': {
82
+ useProps: '{{ useCustomizeBulkUpdateActionProps }}'
83
+ }
84
+ }
85
+ }, {
86
+ type: 'item',
87
+ title: '{{t("Bulk edit")}}',
88
+ component: 'CustomizeBulkEditActionInitializer',
89
+ schema: {
90
+ 'x-align': 'right',
91
+ 'x-decorator': 'ACLActionProvider',
92
+ 'x-acl-action-props': {
93
+ skipScopeCheck: true
94
+ }
95
+ }
96
+ }]
52
97
  }]
53
98
  };
@@ -1,6 +1,8 @@
1
1
  export * from './BlockInitializers';
2
+ export * from './BulkEditFormItemInitializers';
2
3
  export * from './CalendarActionInitializers';
3
4
  export * from './CreateFormBlockInitializers';
5
+ export * from './CreateFormBulkEditBlockInitializers';
4
6
  export * from './CustomFormItemInitializers';
5
7
  export * from './DetailsActionInitializers';
6
8
  export * from './FormActionInitializers';
@@ -1,6 +1,8 @@
1
1
  export * from './BlockInitializers';
2
+ export * from './BulkEditFormItemInitializers';
2
3
  export * from './CalendarActionInitializers';
3
4
  export * from './CreateFormBlockInitializers';
5
+ export * from './CreateFormBulkEditBlockInitializers';
4
6
  export * from './CustomFormItemInitializers';
5
7
  export * from './DetailsActionInitializers';
6
8
  export * from './FormActionInitializers';
@@ -0,0 +1,7 @@
1
+ export declare enum BulkEditFormItemValueType {
2
+ RemainsTheSame = 1,
3
+ ChangedTo = 2,
4
+ Clear = 3,
5
+ AddAttach = 4
6
+ }
7
+ export declare const BulkEditField: (props: any) => JSX.Element;
@@ -0,0 +1,187 @@
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
+ import { connect, useField, useFieldSchema } from '@formily/react';
20
+ import { merge, uid } from '@formily/shared';
21
+ import { Checkbox, Select, Space } from 'antd';
22
+ import React, { useEffect, useState } from 'react';
23
+ import { useTranslation } from 'react-i18next';
24
+ import { useFormBlockContext } from '../../block-provider';
25
+ import { CollectionFieldProvider, useCollection, useCollectionField } from '../../collection-manager';
26
+ import { useCompile, useComponent } from '../../schema-component';
27
+
28
+ var InternalField = function InternalField(props) {
29
+ var field = useField();
30
+ var fieldSchema = useFieldSchema();
31
+
32
+ var _useCollectionField = useCollectionField(),
33
+ name = _useCollectionField.name,
34
+ interfaceType = _useCollectionField.interface,
35
+ uiSchema = _useCollectionField.uiSchema;
36
+
37
+ var component = useComponent(uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['x-component']);
38
+ var compile = useCompile();
39
+
40
+ var setFieldProps = function setFieldProps(key, value) {
41
+ field[key] = typeof field[key] === 'undefined' ? value : field[key];
42
+ };
43
+
44
+ var setRequired = function setRequired() {
45
+ if (typeof fieldSchema['required'] === 'undefined') {
46
+ field.required = !!uiSchema['required'];
47
+ }
48
+ };
49
+
50
+ var ctx = useFormBlockContext();
51
+ useEffect(function () {
52
+ if (ctx === null || ctx === void 0 ? void 0 : ctx.field) {
53
+ ctx.field.added = ctx.field.added || new Set();
54
+ ctx.field.added.add(fieldSchema.name);
55
+ }
56
+ });
57
+ useEffect(function () {
58
+ if (!uiSchema) {
59
+ return;
60
+ }
61
+
62
+ setFieldProps('content', uiSchema['x-content']);
63
+ setFieldProps('description', uiSchema.description);
64
+ setFieldProps('initialValue', uiSchema.default); // if (!field.validator && uiSchema['x-validator']) {
65
+ // field.validator = uiSchema['x-validator'];
66
+ // }
67
+
68
+ if (fieldSchema['x-disabled'] === true) {
69
+ field.disabled = true;
70
+ }
71
+
72
+ if (fieldSchema['x-read-pretty'] === true) {
73
+ field.readPretty = true;
74
+ }
75
+
76
+ setRequired(); // @ts-ignore
77
+
78
+ field.dataSource = uiSchema.enum;
79
+ var originalProps = compile(uiSchema['x-component-props']) || {};
80
+ var componentProps = merge(originalProps, field.componentProps || {});
81
+ field.componentProps = componentProps; // field.component = [component, componentProps];
82
+ }, [JSON.stringify(uiSchema)]);
83
+
84
+ if (!uiSchema) {
85
+ return null;
86
+ }
87
+
88
+ return /*#__PURE__*/React.createElement(component, props, props.children);
89
+ };
90
+
91
+ var CollectionField = connect(function (props) {
92
+ var fieldSchema = useFieldSchema();
93
+ return /*#__PURE__*/React.createElement(CollectionFieldProvider, {
94
+ name: fieldSchema.name
95
+ }, /*#__PURE__*/React.createElement(InternalField, _objectSpread({}, props)));
96
+ });
97
+ export var BulkEditFormItemValueType;
98
+
99
+ (function (BulkEditFormItemValueType) {
100
+ BulkEditFormItemValueType[BulkEditFormItemValueType["RemainsTheSame"] = 1] = "RemainsTheSame";
101
+ BulkEditFormItemValueType[BulkEditFormItemValueType["ChangedTo"] = 2] = "ChangedTo";
102
+ BulkEditFormItemValueType[BulkEditFormItemValueType["Clear"] = 3] = "Clear";
103
+ BulkEditFormItemValueType[BulkEditFormItemValueType["AddAttach"] = 4] = "AddAttach";
104
+ })(BulkEditFormItemValueType || (BulkEditFormItemValueType = {}));
105
+
106
+ export var BulkEditField = function BulkEditField(props) {
107
+ var _useTranslation = useTranslation(),
108
+ t = _useTranslation.t;
109
+
110
+ var fieldSchema = useFieldSchema();
111
+ var field = useField();
112
+
113
+ var _useState = useState(BulkEditFormItemValueType.RemainsTheSame),
114
+ _useState2 = _slicedToArray(_useState, 2),
115
+ type = _useState2[0],
116
+ setType = _useState2[1];
117
+
118
+ var _useState3 = useState(null),
119
+ _useState4 = _slicedToArray(_useState3, 2),
120
+ value = _useState4[0],
121
+ setValue = _useState4[1];
122
+
123
+ var _useCollection = useCollection(),
124
+ getField = _useCollection.getField;
125
+
126
+ var collectionField = getField(fieldSchema.name);
127
+ useEffect(function () {
128
+ field.value = _defineProperty({}, type, value);
129
+ }, [type, value]);
130
+
131
+ var typeChangeHandler = function typeChangeHandler(val) {
132
+ setType(val);
133
+ };
134
+
135
+ var valueChangeHandler = function valueChangeHandler(val) {
136
+ var _ref, _val$target$value, _val$target, _val$target2;
137
+
138
+ setValue((_ref = (_val$target$value = val === null || val === void 0 ? void 0 : (_val$target = val.target) === null || _val$target === void 0 ? void 0 : _val$target.value) !== null && _val$target$value !== void 0 ? _val$target$value : val === null || val === void 0 ? void 0 : (_val$target2 = val.target) === null || _val$target2 === void 0 ? void 0 : _val$target2.checked) !== null && _ref !== void 0 ? _ref : val);
139
+ };
140
+
141
+ var collectionSchema = {
142
+ type: 'void',
143
+ properties: _defineProperty({}, uid(), {
144
+ type: 'string',
145
+ 'x-component': 'BulkEditCollectionField',
146
+ 'x-collection-field': fieldSchema['x-collection-field'],
147
+ 'x-component-props': _objectSpread(_objectSpread({}, props), {}, {
148
+ value: value,
149
+ onChange: valueChangeHandler,
150
+ style: {
151
+ minWidth: 150
152
+ }
153
+ }),
154
+ 'x-decorator': 'FormItem'
155
+ })
156
+ };
157
+ return /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Select, {
158
+ defaultValue: type,
159
+ value: type,
160
+ style: {
161
+ width: 150
162
+ },
163
+ onChange: typeChangeHandler
164
+ }, /*#__PURE__*/React.createElement(Select.Option, {
165
+ value: BulkEditFormItemValueType.RemainsTheSame
166
+ }, t('Remains the same')), /*#__PURE__*/React.createElement(Select.Option, {
167
+ value: BulkEditFormItemValueType.ChangedTo
168
+ }, t('Changed to')), /*#__PURE__*/React.createElement(Select.Option, {
169
+ value: BulkEditFormItemValueType.Clear
170
+ }, t('Clear')), ['subTable', 'linkTo', 'm2m', 'o2m', 'o2o', 'oho', 'obo', 'm2o'].includes(collectionField.interface) && /*#__PURE__*/React.createElement(Select.Option, {
171
+ value: BulkEditFormItemValueType.AddAttach
172
+ }, t('Add attach'))), [BulkEditFormItemValueType.ChangedTo, BulkEditFormItemValueType.AddAttach].includes(type) && collectionField.interface !== 'checkbox' && /*#__PURE__*/React.createElement(CollectionField, _objectSpread(_objectSpread({}, props), {}, {
173
+ value: value,
174
+ onChange: valueChangeHandler,
175
+ style: {
176
+ minWidth: 150
177
+ }
178
+ })) // <SchemaComponent
179
+ // schema={collectionSchema}
180
+ // components={{ BulkEditCollectionField: CollectionField }}
181
+ // onlyRenderProperties
182
+ // />
183
+ , [BulkEditFormItemValueType.ChangedTo, BulkEditFormItemValueType.AddAttach].includes(type) && collectionField.interface === 'checkbox' && /*#__PURE__*/React.createElement(Checkbox, {
184
+ checked: value,
185
+ onChange: valueChangeHandler
186
+ }));
187
+ };
@@ -1 +1,2 @@
1
1
  export * from './assigned-field';
2
+ export * from './BulkEditField';
@@ -1 +1,2 @@
1
- export * from './assigned-field';
1
+ export * from './assigned-field';
2
+ export * from './BulkEditField';
@@ -1,18 +1,18 @@
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; }
2
-
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; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
1
+ import { merge } from '@formily/shared';
7
2
  import React from 'react';
8
- import { SchemaInitializer } from ".."; // Block
3
+ import { SchemaInitializer } from '..'; // Block
9
4
 
10
5
  export var BlockInitializer = function BlockInitializer(props) {
11
6
  var item = props.item,
7
+ schema = props.schema,
12
8
  insert = props.insert;
13
9
  return /*#__PURE__*/React.createElement(SchemaInitializer.Item, {
14
10
  onClick: function onClick() {
15
- insert(_objectSpread({}, item.schema));
11
+ var _item$schemaInitializ;
12
+
13
+ var s = merge(schema || {}, item.schema || {});
14
+ item === null || item === void 0 ? void 0 : (_item$schemaInitializ = item.schemaInitialize) === null || _item$schemaInitializ === void 0 ? void 0 : _item$schemaInitializ.call(item, s);
15
+ insert(s);
16
16
  }
17
17
  });
18
18
  };
@@ -0,0 +1 @@
1
+ export declare const BulkEditSubmitActionInitializer: (props: any) => JSX.Element;
@@ -0,0 +1,24 @@
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; }
2
+
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; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
+ import React from 'react';
8
+ import { ActionInitializer } from './ActionInitializer';
9
+ export var BulkEditSubmitActionInitializer = function BulkEditSubmitActionInitializer(props) {
10
+ var schema = {
11
+ title: '{{ t("Submit") }}',
12
+ 'x-action': 'submit',
13
+ 'x-component': 'Action',
14
+ 'x-designer': 'Action.Designer',
15
+ 'x-component-props': {
16
+ type: 'primary',
17
+ htmlType: 'submit',
18
+ useProps: '{{ useCustomizeBulkEditActionProps }}'
19
+ }
20
+ };
21
+ return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
22
+ schema: schema
23
+ }));
24
+ };
@@ -0,0 +1 @@
1
+ export declare const CreateFormBulkEditBlockInitializer: (props: any) => JSX.Element;
@@ -0,0 +1,103 @@
1
+ var _excluded = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert"];
2
+
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+
5
+ 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); }); }; }
6
+
7
+ 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; }
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+
13
+ 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; }
14
+
15
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
+
17
+ import { FormOutlined } from '@ant-design/icons';
18
+ import React from 'react';
19
+ import { useBlockAssociationContext } from '../../block-provider';
20
+ import { useCollection } from '../../collection-manager';
21
+ import { useSchemaTemplateManager } from '../../schema-templates';
22
+ import { SchemaInitializer } from '../SchemaInitializer';
23
+ import { createFormBlockSchema, useRecordCollectionDataSourceItems } from '../utils';
24
+ export var CreateFormBulkEditBlockInitializer = function CreateFormBulkEditBlockInitializer(props) {
25
+ var onCreateBlockSchema = props.onCreateBlockSchema,
26
+ componentType = props.componentType,
27
+ createBlockSchema = props.createBlockSchema,
28
+ insert = props.insert,
29
+ others = _objectWithoutProperties(props, _excluded);
30
+
31
+ var _useSchemaTemplateMan = useSchemaTemplateManager(),
32
+ getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
33
+
34
+ var association = useBlockAssociationContext();
35
+ var collection = useCollection();
36
+ return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
37
+ icon: /*#__PURE__*/React.createElement(FormOutlined, null)
38
+ }, others), {}, {
39
+ onClick: function () {
40
+ var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
41
+ var item, s, blockSchema;
42
+ return regeneratorRuntime.wrap(function _callee$(_context) {
43
+ while (1) {
44
+ switch (_context.prev = _context.next) {
45
+ case 0:
46
+ item = _ref.item;
47
+
48
+ if (!item.template) {
49
+ _context.next = 8;
50
+ break;
51
+ }
52
+
53
+ _context.next = 4;
54
+ return getTemplateSchemaByMode(item);
55
+
56
+ case 4:
57
+ s = _context.sent;
58
+
59
+ if (item.template.componentName === 'FormItem') {
60
+ blockSchema = createFormBlockSchema({
61
+ actionInitializers: 'CreateFormActionInitializers',
62
+ association: association,
63
+ collection: collection.name,
64
+ template: s
65
+ });
66
+
67
+ if (item.mode === 'reference') {
68
+ blockSchema['x-template-key'] = item.template.key;
69
+ }
70
+
71
+ insert(blockSchema);
72
+ } else {
73
+ insert(s);
74
+ }
75
+
76
+ _context.next = 9;
77
+ break;
78
+
79
+ case 8:
80
+ insert(createFormBlockSchema({
81
+ formItemInitializers: 'BulkEditFormItemInitializers',
82
+ actionInitializers: 'BulkEditFormActionInitializers',
83
+ association: association,
84
+ collection: collection.name
85
+ }));
86
+
87
+ case 9:
88
+ case "end":
89
+ return _context.stop();
90
+ }
91
+ }
92
+ }, _callee);
93
+ }));
94
+
95
+ function onClick(_x) {
96
+ return _onClick.apply(this, arguments);
97
+ }
98
+
99
+ return onClick;
100
+ }(),
101
+ items: useRecordCollectionDataSourceItems('FormItem')
102
+ }));
103
+ };
@@ -0,0 +1 @@
1
+ export declare const CustomizeBulkEditActionInitializer: (props: any) => JSX.Element;
@@ -0,0 +1,61 @@
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; }
2
+
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; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
+ import React from 'react';
8
+ import { BlockInitializer } from './BlockInitializer';
9
+ export var CustomizeBulkEditActionInitializer = function CustomizeBulkEditActionInitializer(props) {
10
+ var schema = {
11
+ type: 'void',
12
+ title: '{{t("Bulk edit")}}',
13
+ 'x-designer': 'Action.Designer',
14
+ 'x-component': 'Action',
15
+ 'x-action': 'customize:bulkEdit',
16
+ 'x-action-settings': {
17
+ updateMode: 'selected'
18
+ },
19
+ 'x-component-props': {
20
+ openMode: 'drawer'
21
+ },
22
+ properties: {
23
+ drawer: {
24
+ type: 'void',
25
+ title: '{{t("Bulk edit")}}',
26
+ 'x-component': 'Action.Container',
27
+ 'x-component-props': {
28
+ className: 'nb-action-popup'
29
+ },
30
+ properties: {
31
+ tabs: {
32
+ type: 'void',
33
+ 'x-component': 'Tabs',
34
+ 'x-component-props': {},
35
+ 'x-initializer': 'TabPaneInitializersForBulkEditFormBlock',
36
+ properties: {
37
+ tab1: {
38
+ type: 'void',
39
+ title: '{{t("Bulk edit")}}',
40
+ 'x-component': 'Tabs.TabPane',
41
+ 'x-designer': 'Tabs.Designer',
42
+ 'x-component-props': {},
43
+ properties: {
44
+ grid: {
45
+ type: 'void',
46
+ 'x-component': 'Grid',
47
+ 'x-initializer': 'CreateFormBulkEditBlockInitializers',
48
+ properties: {}
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ };
58
+ return /*#__PURE__*/React.createElement(BlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
59
+ schema: schema
60
+ }));
61
+ };
@@ -1,12 +1,15 @@
1
1
  export * from './ActionInitializer';
2
2
  export * from './BlockInitializer';
3
3
  export * from './BulkDestroyActionInitializer';
4
+ export * from './BulkEditSubmitActionInitializer';
4
5
  export * from './CalendarBlockInitializer';
5
6
  export * from './CollectionFieldInitializer';
6
7
  export * from './CreateActionInitializer';
7
8
  export * from './CreateFormBlockInitializer';
9
+ export * from './CreateFormBulkEditBlockInitializer';
8
10
  export * from './CreateSubmitActionInitializer';
9
11
  export * from './CustomizeActionInitializer';
12
+ export * from './CustomizeBulkEditActionInitializer';
10
13
  export * from './DataBlockInitializer';
11
14
  export * from './DestroyActionInitializer';
12
15
  export * from './DetailsBlockInitializer';
@@ -1,12 +1,15 @@
1
1
  export * from './ActionInitializer';
2
2
  export * from './BlockInitializer';
3
3
  export * from './BulkDestroyActionInitializer';
4
+ export * from './BulkEditSubmitActionInitializer';
4
5
  export * from './CalendarBlockInitializer';
5
6
  export * from './CollectionFieldInitializer';
6
7
  export * from './CreateActionInitializer';
7
8
  export * from './CreateFormBlockInitializer';
9
+ export * from './CreateFormBulkEditBlockInitializer';
8
10
  export * from './CreateSubmitActionInitializer';
9
11
  export * from './CustomizeActionInitializer';
12
+ export * from './CustomizeBulkEditActionInitializer';
10
13
  export * from './DataBlockInitializer';
11
14
  export * from './DestroyActionInitializer';
12
15
  export * from './DetailsBlockInitializer';
@@ -78,6 +78,7 @@ export declare const useAssociatedTableColumnInitializerFields: () => SchemaInit
78
78
  export declare const useFormItemInitializerFields: (options?: any) => SchemaInitializerItemOptions[];
79
79
  export declare const useAssociatedFormItemInitializerFields: (options?: any) => SchemaInitializerItemOptions[];
80
80
  export declare const useCustomFormItemInitializerFields: (options?: any) => SchemaInitializerItemOptions[];
81
+ export declare const useCustomBulkEditFormItemInitializerFields: (options?: any) => SchemaInitializerItemOptions[];
81
82
  export declare const useCurrentSchema: (action: string, key: string, find?: (schema: Schema, key: string, action: string) => any, rm?: (schema: any, cb: any) => any) => {
82
83
  schema: any;
83
84
  exists: boolean;