@nocobase/client 0.9.2-alpha.4 → 0.9.3-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 (211) hide show
  1. package/es/block-provider/DetailsBlockProvider.js +13 -1
  2. package/es/block-provider/FormBlockProvider.js +30 -13
  3. package/es/block-provider/hooks/index.d.ts +10 -0
  4. package/es/block-provider/hooks/index.js +498 -281
  5. package/es/collection-manager/Configuration/CollectionFields.js +1 -2
  6. package/es/collection-manager/Configuration/EditFieldAction.js +0 -1
  7. package/es/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  8. package/es/collection-manager/action-hooks.d.ts +1 -1
  9. package/es/collection-manager/action-hooks.js +18 -7
  10. package/es/collection-manager/interfaces/createdBy.js +1 -1
  11. package/es/collection-manager/interfaces/linkTo.js +3 -39
  12. package/es/collection-manager/interfaces/m2m.js +4 -38
  13. package/es/collection-manager/interfaces/m2o.js +4 -38
  14. package/es/collection-manager/interfaces/o2m.js +4 -68
  15. package/es/collection-manager/interfaces/o2o.js +25 -119
  16. package/es/collection-manager/interfaces/updatedBy.js +1 -1
  17. package/es/collection-manager/templates/tree.js +2 -2
  18. package/es/filter-provider/FilterProvider.js +3 -1
  19. package/es/locale/en_US.d.ts +3 -0
  20. package/es/locale/en_US.js +5 -2
  21. package/es/locale/ja_JP.d.ts +3 -0
  22. package/es/locale/ja_JP.js +3 -0
  23. package/es/locale/zh_CN.d.ts +4 -0
  24. package/es/locale/zh_CN.js +4 -0
  25. package/es/schema-component/antd/action/Action.Designer.js +4 -5
  26. package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  27. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +19 -0
  28. package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  29. package/es/schema-component/antd/association-field/AssociationSelect.js +118 -0
  30. package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
  31. package/es/schema-component/antd/association-field/Editable.js +88 -0
  32. package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
  33. package/es/schema-component/antd/association-field/FileManager.js +243 -0
  34. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  35. package/es/schema-component/antd/association-field/InternalNester.js +28 -0
  36. package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  37. package/es/schema-component/antd/association-field/InternalPicker.js +267 -0
  38. package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  39. package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
  40. package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  41. package/es/schema-component/antd/association-field/InternalViewer.js +115 -0
  42. package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
  43. package/es/schema-component/antd/association-field/Nester.js +80 -0
  44. package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  45. package/es/schema-component/antd/association-field/ReadPretty.js +38 -0
  46. package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
  47. package/es/schema-component/antd/association-field/SubTable.js +25 -0
  48. package/es/schema-component/antd/association-field/context.d.ts +7 -0
  49. package/es/schema-component/antd/association-field/context.js +2 -0
  50. package/es/schema-component/antd/association-field/hooks.d.ts +8 -0
  51. package/es/schema-component/antd/association-field/hooks.js +96 -0
  52. package/es/schema-component/antd/association-field/index.d.ts +1 -0
  53. package/es/schema-component/antd/association-field/index.js +14 -0
  54. package/es/schema-component/antd/association-field/schema.d.ts +142 -0
  55. package/es/schema-component/antd/association-field/schema.js +141 -0
  56. package/es/schema-component/antd/association-field/util.d.ts +8 -0
  57. package/es/schema-component/antd/association-field/util.js +84 -0
  58. package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  59. package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
  60. package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  61. package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
  62. package/es/schema-component/antd/expand-action/index.d.ts +1 -0
  63. package/es/schema-component/antd/expand-action/index.js +5 -0
  64. package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  65. package/es/schema-component/antd/filter/FilterItem.js +1 -1
  66. package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
  67. package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
  68. package/es/schema-component/antd/form-item/FormItem.js +183 -52
  69. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +36 -58
  70. package/es/schema-component/antd/form-v2/utils.js +3 -1
  71. package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  72. package/es/schema-component/antd/index.d.ts +3 -1
  73. package/es/schema-component/antd/index.js +3 -1
  74. package/es/schema-component/antd/menu/Menu.js +6 -3
  75. package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  76. package/es/schema-component/antd/record-picker/InputRecordPicker.js +32 -12
  77. package/es/schema-component/antd/remote-select/RemoteSelect.js +16 -18
  78. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  79. package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  80. package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
  81. package/es/schema-component/antd/table-v2/Table.js +9 -5
  82. package/es/schema-component/antd/table-v2/index.js +3 -1
  83. package/es/schema-component/antd/table-v2/utils.js +1 -1
  84. package/es/schema-component/antd/variable/Input.js +5 -5
  85. package/es/schema-component/antd/variable/TextArea.js +2 -5
  86. package/es/schema-component/common/dnd-context/index.js +3 -2
  87. package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
  88. package/es/schema-component/common/utils/uitls.js +1 -1
  89. package/es/schema-component/hooks/index.d.ts +1 -0
  90. package/es/schema-component/hooks/index.js +2 -1
  91. package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  92. package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
  93. package/es/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  94. package/es/schema-initializer/components/CreateRecordAction.js +4 -3
  95. package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  96. package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
  97. package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  98. package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
  99. package/es/schema-initializer/items/index.d.ts +1 -0
  100. package/es/schema-initializer/items/index.js +2 -1
  101. package/es/schema-initializer/utils.js +20 -8
  102. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  103. package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
  104. package/es/schema-settings/LinkageRules/Variables.js +7 -4
  105. package/es/schema-settings/SchemaSettings.js +2 -2
  106. package/lib/block-provider/DetailsBlockProvider.js +13 -1
  107. package/lib/block-provider/FormBlockProvider.js +31 -15
  108. package/lib/block-provider/hooks/index.d.ts +10 -0
  109. package/lib/block-provider/hooks/index.js +509 -289
  110. package/lib/collection-manager/Configuration/CollectionFields.js +1 -2
  111. package/lib/collection-manager/Configuration/EditFieldAction.js +0 -1
  112. package/lib/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  113. package/lib/collection-manager/action-hooks.d.ts +1 -1
  114. package/lib/collection-manager/action-hooks.js +18 -7
  115. package/lib/collection-manager/interfaces/createdBy.js +1 -1
  116. package/lib/collection-manager/interfaces/linkTo.js +2 -38
  117. package/lib/collection-manager/interfaces/m2m.js +3 -37
  118. package/lib/collection-manager/interfaces/m2o.js +3 -37
  119. package/lib/collection-manager/interfaces/o2m.js +6 -70
  120. package/lib/collection-manager/interfaces/o2o.js +30 -124
  121. package/lib/collection-manager/interfaces/updatedBy.js +1 -1
  122. package/lib/collection-manager/templates/tree.js +2 -2
  123. package/lib/filter-provider/FilterProvider.js +3 -1
  124. package/lib/locale/en_US.d.ts +3 -0
  125. package/lib/locale/en_US.js +5 -2
  126. package/lib/locale/ja_JP.d.ts +3 -0
  127. package/lib/locale/ja_JP.js +3 -0
  128. package/lib/locale/zh_CN.d.ts +4 -0
  129. package/lib/locale/zh_CN.js +4 -0
  130. package/lib/schema-component/antd/action/Action.Designer.js +4 -5
  131. package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  132. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +28 -0
  133. package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  134. package/lib/schema-component/antd/association-field/AssociationSelect.js +129 -0
  135. package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
  136. package/lib/schema-component/antd/association-field/Editable.js +97 -0
  137. package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
  138. package/lib/schema-component/antd/association-field/FileManager.js +253 -0
  139. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  140. package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
  141. package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  142. package/lib/schema-component/antd/association-field/InternalPicker.js +277 -0
  143. package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  144. package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
  145. package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  146. package/lib/schema-component/antd/association-field/InternalViewer.js +126 -0
  147. package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
  148. package/lib/schema-component/antd/association-field/Nester.js +89 -0
  149. package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  150. package/lib/schema-component/antd/association-field/ReadPretty.js +47 -0
  151. package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
  152. package/lib/schema-component/antd/association-field/SubTable.js +33 -0
  153. package/lib/schema-component/antd/association-field/context.d.ts +7 -0
  154. package/lib/schema-component/antd/association-field/context.js +9 -0
  155. package/lib/schema-component/antd/association-field/hooks.d.ts +8 -0
  156. package/lib/schema-component/antd/association-field/hooks.js +107 -0
  157. package/lib/schema-component/antd/association-field/index.d.ts +1 -0
  158. package/lib/schema-component/antd/association-field/index.js +21 -0
  159. package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
  160. package/lib/schema-component/antd/association-field/schema.js +148 -0
  161. package/lib/schema-component/antd/association-field/util.d.ts +8 -0
  162. package/lib/schema-component/antd/association-field/util.js +98 -0
  163. package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  164. package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
  165. package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  166. package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
  167. package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
  168. package/lib/schema-component/antd/expand-action/index.js +12 -0
  169. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  170. package/lib/schema-component/antd/filter/FilterItem.js +1 -1
  171. package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
  172. package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
  173. package/lib/schema-component/antd/form-item/FormItem.js +180 -48
  174. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +34 -56
  175. package/lib/schema-component/antd/form-v2/utils.js +3 -1
  176. package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  177. package/lib/schema-component/antd/index.d.ts +3 -1
  178. package/lib/schema-component/antd/index.js +33 -11
  179. package/lib/schema-component/antd/menu/Menu.js +6 -3
  180. package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  181. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +34 -13
  182. package/lib/schema-component/antd/remote-select/RemoteSelect.js +15 -17
  183. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  184. package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  185. package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
  186. package/lib/schema-component/antd/table-v2/Table.js +9 -5
  187. package/lib/schema-component/antd/table-v2/index.js +3 -1
  188. package/lib/schema-component/antd/table-v2/utils.js +1 -1
  189. package/lib/schema-component/antd/variable/Input.js +5 -5
  190. package/lib/schema-component/antd/variable/TextArea.js +2 -5
  191. package/lib/schema-component/common/dnd-context/index.js +3 -2
  192. package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
  193. package/lib/schema-component/common/utils/uitls.js +1 -1
  194. package/lib/schema-component/hooks/index.d.ts +1 -0
  195. package/lib/schema-component/hooks/index.js +11 -0
  196. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  197. package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
  198. package/lib/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  199. package/lib/schema-initializer/components/CreateRecordAction.js +4 -3
  200. package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  201. package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
  202. package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  203. package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
  204. package/lib/schema-initializer/items/index.d.ts +1 -0
  205. package/lib/schema-initializer/items/index.js +11 -0
  206. package/lib/schema-initializer/utils.js +20 -8
  207. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  208. package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
  209. package/lib/schema-settings/LinkageRules/Variables.js +7 -4
  210. package/lib/schema-settings/SchemaSettings.js +3 -3
  211. package/package.json +5 -6
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useUpdateActionProps = exports.useResetBlockActionProps = exports.useRefreshActionProps = exports.usePickActionProps = exports.useOptionalFieldList = exports.useFilterBlockActionProps = exports.useDetailsPaginationProps = exports.useDetailPrintActionProps = exports.useDestroyActionProps = exports.useCustomizeUpdateActionProps = exports.useCustomizeRequestActionProps = exports.useCustomizeBulkUpdateActionProps = exports.useCustomizeBulkEditActionProps = exports.useCreateActionProps = exports.useBulkDestroyActionProps = exports.useAssociationFilterProps = exports.useAssociationFilterBlockProps = exports.updateFilterTargets = exports.findFilterTargets = void 0;
6
+ exports.useUpdateActionProps = exports.useResetBlockActionProps = exports.useRemoveActionProps = exports.useRefreshActionProps = exports.usePickActionProps = exports.useOptionalFieldList = exports.useFilterBlockActionProps = exports.useDetailsPaginationProps = exports.useDetailPrintActionProps = exports.useDestroyActionProps = exports.useCustomizeUpdateActionProps = exports.useCustomizeRequestActionProps = exports.useCustomizeBulkUpdateActionProps = exports.useCustomizeBulkEditActionProps = exports.useCreateActionProps = exports.useBulkDestroyActionProps = exports.useAssociationNames = exports.useAssociationFilterProps = exports.useAssociationFilterBlockProps = exports.useAssociationCreateActionProps = exports.updateFilterTargets = exports.findFilterTargets = void 0;
7
7
  var _react = require("@formily/react");
8
+ var _client = require("@nocobase/utils/client");
8
9
  var _antd = require("antd");
9
- var _jsonTemplates = _interopRequireDefault(require("json-templates"));
10
10
  var _lodash = require("lodash");
11
11
  var _get = _interopRequireDefault(require("lodash/get"));
12
12
  var _omit = _interopRequireDefault(require("lodash/omit"));
@@ -28,6 +28,7 @@ var _DetailsBlockProvider = require("../DetailsBlockProvider");
28
28
  var _SharedFilterProvider = require("../SharedFilterProvider");
29
29
  var _TableFieldProvider = require("../TableFieldProvider");
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
31
32
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
32
33
  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."); }
33
34
  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); }
@@ -181,7 +182,7 @@ var useCreateActionProps = function useCreateActionProps() {
181
182
  onClick: function onClick() {
182
183
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
183
184
  var _actionSchema$xActio, _fieldSchema$xCompon;
184
- var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name, _treeParentField$fore, treeParentField, _parent$service, _parent$service$refre;
185
+ var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name, _treeParentField$fore, treeParentField, _parent$service, _parent$service$refre, data;
185
186
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
186
187
  while (1) switch (_context2.prev = _context2.next) {
187
188
  case 0:
@@ -190,7 +191,7 @@ var useCreateActionProps = function useCreateActionProps() {
190
191
  });
191
192
  _ref = (_actionSchema$xActio = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio !== void 0 ? _actionSchema$xActio : {}, _ref$assignedValues = _ref.assignedValues, originalAssignedValues = _ref$assignedValues === void 0 ? {} : _ref$assignedValues, onSuccess = _ref.onSuccess, overwriteValues = _ref.overwriteValues, skipValidator = _ref.skipValidator;
192
193
  addChild = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.addChild;
193
- assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
194
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
194
195
  currentTime: new Date(),
195
196
  currentRecord: currentRecord,
196
197
  currentUser: currentUser
@@ -216,15 +217,17 @@ var useCreateActionProps = function useCreateActionProps() {
216
217
  values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
217
218
  });
218
219
  case 14:
220
+ data = _context2.sent;
219
221
  actionField.data.loading = false;
222
+ actionField.data.data = data;
220
223
  __parent === null || __parent === void 0 ? void 0 : (_parent$service = __parent.service) === null || _parent$service === void 0 ? void 0 : (_parent$service$refre = _parent$service.refresh) === null || _parent$service$refre === void 0 ? void 0 : _parent$service$refre.call(_parent$service);
221
224
  setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
222
225
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
223
- _context2.next = 19;
226
+ _context2.next = 21;
224
227
  break;
225
228
  }
226
229
  return _context2.abrupt("return");
227
- case 19:
230
+ case 21:
228
231
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
229
232
  _antd.Modal.success({
230
233
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
@@ -258,22 +261,108 @@ var useCreateActionProps = function useCreateActionProps() {
258
261
  } else {
259
262
  _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
260
263
  }
261
- _context2.next = 25;
264
+ _context2.next = 27;
262
265
  break;
263
- case 22:
264
- _context2.prev = 22;
266
+ case 24:
267
+ _context2.prev = 24;
265
268
  _context2.t0 = _context2["catch"](11);
266
269
  actionField.data.loading = false;
267
- case 25:
270
+ case 27:
268
271
  case "end":
269
272
  return _context2.stop();
270
273
  }
271
- }, _callee2, null, [[11, 22]]);
274
+ }, _callee2, null, [[11, 24]]);
272
275
  }))();
273
276
  }
274
277
  };
275
278
  };
276
279
  exports.useCreateActionProps = useCreateActionProps;
280
+ var useAssociationCreateActionProps = function useAssociationCreateActionProps() {
281
+ var _currentUserContext$d2;
282
+ var form = (0, _react.useForm)();
283
+ var _useBlockRequestConte2 = (0, _BlockProvider.useBlockRequestContext)(),
284
+ field = _useBlockRequestConte2.field,
285
+ resource = _useBlockRequestConte2.resource;
286
+ var _useActionContext2 = (0, _schemaComponent.useActionContext)(),
287
+ setVisible = _useActionContext2.setVisible,
288
+ fieldSchema = _useActionContext2.fieldSchema;
289
+ var actionSchema = (0, _react.useFieldSchema)();
290
+ var actionField = (0, _react.useField)();
291
+ var _useCollection2 = (0, _collectionManager.useCollection)(),
292
+ fields = _useCollection2.fields,
293
+ getField = _useCollection2.getField,
294
+ getTreeParentField = _useCollection2.getTreeParentField;
295
+ var compile = (0, _schemaComponent.useCompile)();
296
+ var filterByTk = (0, _BlockProvider.useFilterByTk)();
297
+ var currentRecord = (0, _recordProvider.useRecord)();
298
+ var currentUserContext = (0, _user.useCurrentUserContext)();
299
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d2 = currentUserContext.data) === null || _currentUserContext$d2 === void 0 ? void 0 : _currentUserContext$d2.data;
300
+ return {
301
+ onClick: function onClick() {
302
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
303
+ var _actionSchema$xActio2, _fieldSchema$xCompon2;
304
+ var fieldNames, _ref2, _ref2$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name2, _treeParentField$fore2, treeParentField, data;
305
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
306
+ while (1) switch (_context3.prev = _context3.next) {
307
+ case 0:
308
+ fieldNames = fields.map(function (field) {
309
+ return field.name;
310
+ });
311
+ _ref2 = (_actionSchema$xActio2 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio2 !== void 0 ? _actionSchema$xActio2 : {}, _ref2$assignedValues = _ref2.assignedValues, originalAssignedValues = _ref2$assignedValues === void 0 ? {} : _ref2$assignedValues, onSuccess = _ref2.onSuccess, overwriteValues = _ref2.overwriteValues, skipValidator = _ref2.skipValidator;
312
+ addChild = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.addChild;
313
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
314
+ currentTime: new Date(),
315
+ currentRecord: currentRecord,
316
+ currentUser: currentUser
317
+ });
318
+ if (skipValidator) {
319
+ _context3.next = 7;
320
+ break;
321
+ }
322
+ _context3.next = 7;
323
+ return form.submit();
324
+ case 7:
325
+ values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
326
+ if (addChild) {
327
+ treeParentField = getTreeParentField();
328
+ values[(_treeParentField$name2 = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.name) !== null && _treeParentField$name2 !== void 0 ? _treeParentField$name2 : 'parent'] = currentRecord;
329
+ values[(_treeParentField$fore2 = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.foreignKey) !== null && _treeParentField$fore2 !== void 0 ? _treeParentField$fore2 : 'parentId'] = currentRecord.id;
330
+ }
331
+ actionField.data = field.data || {};
332
+ actionField.data.loading = true;
333
+ _context3.prev = 11;
334
+ _context3.next = 14;
335
+ return resource.create({
336
+ values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
337
+ });
338
+ case 14:
339
+ data = _context3.sent;
340
+ actionField.data.loading = false;
341
+ actionField.data.data = data;
342
+ setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
343
+ if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
344
+ _context3.next = 20;
345
+ break;
346
+ }
347
+ return _context3.abrupt("return");
348
+ case 20:
349
+ _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
350
+ _context3.next = 26;
351
+ break;
352
+ case 23:
353
+ _context3.prev = 23;
354
+ _context3.t0 = _context3["catch"](11);
355
+ actionField.data.loading = false;
356
+ case 26:
357
+ case "end":
358
+ return _context3.stop();
359
+ }
360
+ }, _callee3, null, [[11, 23]]);
361
+ }))();
362
+ }
363
+ };
364
+ };
365
+ exports.useAssociationCreateActionProps = useAssociationCreateActionProps;
277
366
  var findFilterTargets = function findFilterTargets(fieldSchema) {
278
367
  while (fieldSchema) {
279
368
  if (fieldSchema['x-filter-targets']) {
@@ -303,37 +392,37 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
303
392
  var fieldSchema = (0, _react.useFieldSchema)();
304
393
  var _useFilterBlock = (0, _FilterProvider.useFilterBlock)(),
305
394
  getDataBlocks = _useFilterBlock.getDataBlocks;
306
- var _useCollection2 = (0, _collectionManager.useCollection)(),
307
- name = _useCollection2.name;
395
+ var _useCollection3 = (0, _collectionManager.useCollection)(),
396
+ name = _useCollection3.name;
308
397
  var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
309
398
  getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
310
399
  actionField.data = actionField.data || {};
311
400
  return {
312
401
  onClick: function onClick() {
313
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
402
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
314
403
  var _findFilterTargets, _findFilterTargets$ta, targets, uid;
315
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
316
- while (1) switch (_context4.prev = _context4.next) {
404
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
405
+ while (1) switch (_context5.prev = _context5.next) {
317
406
  case 0:
318
407
  _findFilterTargets = findFilterTargets(fieldSchema), _findFilterTargets$ta = _findFilterTargets.targets, targets = _findFilterTargets$ta === void 0 ? [] : _findFilterTargets$ta, uid = _findFilterTargets.uid;
319
408
  actionField.data.loading = true;
320
- _context4.prev = 2;
321
- _context4.next = 5;
409
+ _context5.prev = 2;
410
+ _context5.next = 5;
322
411
  return Promise.all(getDataBlocks().map( /*#__PURE__*/function () {
323
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(block) {
412
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(block) {
324
413
  var _block$service$params, _block$service$params2, _block$service$params3;
325
414
  var target, param, storedFilter, mergedFilter;
326
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
327
- while (1) switch (_context3.prev = _context3.next) {
415
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
416
+ while (1) switch (_context4.prev = _context4.next) {
328
417
  case 0:
329
418
  target = targets.find(function (target) {
330
419
  return target.uid === block.uid;
331
420
  });
332
421
  if (target) {
333
- _context3.next = 3;
422
+ _context4.next = 3;
334
423
  break;
335
424
  }
336
- return _context3.abrupt("return");
425
+ return _context4.abrupt("return");
337
426
  case 3:
338
427
  param = ((_block$service$params = block.service.params) === null || _block$service$params === void 0 ? void 0 : _block$service$params[0]) || {}; // 保留原有的 filter
339
428
  storedFilter = ((_block$service$params2 = block.service.params) === null || _block$service$params2 === void 0 ? void 0 : (_block$service$params3 = _block$service$params2[1]) === null || _block$service$params3 === void 0 ? void 0 : _block$service$params3.filters) || {};
@@ -341,7 +430,7 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
341
430
  mergedFilter = (0, _SharedFilterProvider.mergeFilter)([].concat(_toConsumableArray(Object.values(storedFilter).map(function (filter) {
342
431
  return (0, _schemaComponent.removeNullCondition)(filter);
343
432
  })), [block.defaultFilter]));
344
- return _context3.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
433
+ return _context4.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
345
434
  page: 1,
346
435
  filter: mergedFilter
347
436
  }), {
@@ -349,28 +438,28 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
349
438
  }));
350
439
  case 8:
351
440
  case "end":
352
- return _context3.stop();
441
+ return _context4.stop();
353
442
  }
354
- }, _callee3);
443
+ }, _callee4);
355
444
  }));
356
445
  return function (_x) {
357
- return _ref2.apply(this, arguments);
446
+ return _ref3.apply(this, arguments);
358
447
  };
359
448
  }()));
360
449
  case 5:
361
450
  actionField.data.loading = false;
362
- _context4.next = 12;
451
+ _context5.next = 12;
363
452
  break;
364
453
  case 8:
365
- _context4.prev = 8;
366
- _context4.t0 = _context4["catch"](2);
367
- console.error(_context4.t0);
454
+ _context5.prev = 8;
455
+ _context5.t0 = _context5["catch"](2);
456
+ console.error(_context5.t0);
368
457
  actionField.data.loading = false;
369
458
  case 12:
370
459
  case "end":
371
- return _context4.stop();
460
+ return _context5.stop();
372
461
  }
373
- }, _callee4, null, [[2, 8]]);
462
+ }, _callee5, null, [[2, 8]]);
374
463
  }))();
375
464
  }
376
465
  };
@@ -385,37 +474,37 @@ var useResetBlockActionProps = function useResetBlockActionProps() {
385
474
  actionField.data = actionField.data || {};
386
475
  return {
387
476
  onClick: function onClick() {
388
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
477
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
389
478
  var _findFilterTargets2, targets, uid;
390
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
391
- while (1) switch (_context6.prev = _context6.next) {
479
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
480
+ while (1) switch (_context7.prev = _context7.next) {
392
481
  case 0:
393
482
  _findFilterTargets2 = findFilterTargets(fieldSchema), targets = _findFilterTargets2.targets, uid = _findFilterTargets2.uid;
394
483
  form.reset();
395
484
  actionField.data.loading = true;
396
- _context6.prev = 3;
397
- _context6.next = 6;
485
+ _context7.prev = 3;
486
+ _context7.next = 6;
398
487
  return Promise.all(getDataBlocks().map( /*#__PURE__*/function () {
399
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(block) {
488
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(block) {
400
489
  var _block$service$params4, _block$service$params5, _block$service$params6;
401
490
  var target, param, storedFilter, mergedFilter;
402
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
403
- while (1) switch (_context5.prev = _context5.next) {
491
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
492
+ while (1) switch (_context6.prev = _context6.next) {
404
493
  case 0:
405
494
  target = targets.find(function (target) {
406
495
  return target.uid === block.uid;
407
496
  });
408
497
  if (target) {
409
- _context5.next = 3;
498
+ _context6.next = 3;
410
499
  break;
411
500
  }
412
- return _context5.abrupt("return");
501
+ return _context6.abrupt("return");
413
502
  case 3:
414
503
  param = ((_block$service$params4 = block.service.params) === null || _block$service$params4 === void 0 ? void 0 : _block$service$params4[0]) || {}; // 保留原有的 filter
415
504
  storedFilter = ((_block$service$params5 = block.service.params) === null || _block$service$params5 === void 0 ? void 0 : (_block$service$params6 = _block$service$params5[1]) === null || _block$service$params6 === void 0 ? void 0 : _block$service$params6.filters) || {};
416
505
  delete storedFilter[uid];
417
506
  mergedFilter = (0, _SharedFilterProvider.mergeFilter)([].concat(_toConsumableArray(Object.values(storedFilter)), [block.defaultFilter]));
418
- return _context5.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
507
+ return _context6.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
419
508
  page: 1,
420
509
  filter: mergedFilter
421
510
  }), {
@@ -423,68 +512,68 @@ var useResetBlockActionProps = function useResetBlockActionProps() {
423
512
  }));
424
513
  case 8:
425
514
  case "end":
426
- return _context5.stop();
515
+ return _context6.stop();
427
516
  }
428
- }, _callee5);
517
+ }, _callee6);
429
518
  }));
430
519
  return function (_x2) {
431
- return _ref3.apply(this, arguments);
520
+ return _ref4.apply(this, arguments);
432
521
  };
433
522
  }()));
434
523
  case 6:
435
524
  actionField.data.loading = false;
436
- _context6.next = 12;
525
+ _context7.next = 12;
437
526
  break;
438
527
  case 9:
439
- _context6.prev = 9;
440
- _context6.t0 = _context6["catch"](3);
528
+ _context7.prev = 9;
529
+ _context7.t0 = _context7["catch"](3);
441
530
  actionField.data.loading = false;
442
531
  case 12:
443
532
  case "end":
444
- return _context6.stop();
533
+ return _context7.stop();
445
534
  }
446
- }, _callee6, null, [[3, 9]]);
535
+ }, _callee7, null, [[3, 9]]);
447
536
  }))();
448
537
  }
449
538
  };
450
539
  };
451
540
  exports.useResetBlockActionProps = useResetBlockActionProps;
452
541
  var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
453
- var _currentUserContext$d2;
454
- var _useBlockRequestConte2 = (0, _BlockProvider.useBlockRequestContext)(),
455
- resource = _useBlockRequestConte2.resource,
456
- __parent = _useBlockRequestConte2.__parent,
457
- service = _useBlockRequestConte2.service;
542
+ var _currentUserContext$d3;
543
+ var _useBlockRequestConte3 = (0, _BlockProvider.useBlockRequestContext)(),
544
+ resource = _useBlockRequestConte3.resource,
545
+ __parent = _useBlockRequestConte3.__parent,
546
+ service = _useBlockRequestConte3.service;
458
547
  var filterByTk = (0, _BlockProvider.useFilterByTk)();
459
548
  var actionSchema = (0, _react.useFieldSchema)();
460
549
  var currentRecord = (0, _recordProvider.useRecord)();
461
550
  var currentUserContext = (0, _user.useCurrentUserContext)();
462
- var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d2 = currentUserContext.data) === null || _currentUserContext$d2 === void 0 ? void 0 : _currentUserContext$d2.data;
551
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d3 = currentUserContext.data) === null || _currentUserContext$d3 === void 0 ? void 0 : _currentUserContext$d3.data;
463
552
  var history = (0, _reactRouterDom.useHistory)();
464
553
  var compile = (0, _schemaComponent.useCompile)();
465
554
  var form = (0, _react.useForm)();
466
555
  return {
467
556
  onClick: function onClick() {
468
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
469
- var _actionSchema$xActio2, _service$refresh;
470
- var _ref4, _ref4$assignedValues, originalAssignedValues, onSuccess, skipValidator, assignedValues, _parent$service2, _parent$service2$refr;
471
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
472
- while (1) switch (_context8.prev = _context8.next) {
557
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
558
+ var _actionSchema$xActio3, _service$refresh;
559
+ var _ref5, _ref5$assignedValues, originalAssignedValues, onSuccess, skipValidator, assignedValues, _parent$service2, _parent$service2$refr;
560
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
561
+ while (1) switch (_context9.prev = _context9.next) {
473
562
  case 0:
474
- _ref4 = (_actionSchema$xActio2 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio2 !== void 0 ? _actionSchema$xActio2 : {}, _ref4$assignedValues = _ref4.assignedValues, originalAssignedValues = _ref4$assignedValues === void 0 ? {} : _ref4$assignedValues, onSuccess = _ref4.onSuccess, skipValidator = _ref4.skipValidator;
475
- assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
563
+ _ref5 = (_actionSchema$xActio3 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio3 !== void 0 ? _actionSchema$xActio3 : {}, _ref5$assignedValues = _ref5.assignedValues, originalAssignedValues = _ref5$assignedValues === void 0 ? {} : _ref5$assignedValues, onSuccess = _ref5.onSuccess, skipValidator = _ref5.skipValidator;
564
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
476
565
  currentTime: new Date(),
477
566
  currentRecord: currentRecord,
478
567
  currentUser: currentUser
479
568
  });
480
569
  if (!(skipValidator === false)) {
481
- _context8.next = 5;
570
+ _context9.next = 5;
482
571
  break;
483
572
  }
484
- _context8.next = 5;
573
+ _context9.next = 5;
485
574
  return form.submit();
486
575
  case 5:
487
- _context8.next = 7;
576
+ _context9.next = 7;
488
577
  return resource.update({
489
578
  filterByTk: filterByTk,
490
579
  values: _objectSpread({}, assignedValues)
@@ -495,18 +584,18 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
495
584
  __parent === null || __parent === void 0 ? void 0 : (_parent$service2 = __parent.service) === null || _parent$service2 === void 0 ? void 0 : (_parent$service2$refr = _parent$service2.refresh) === null || _parent$service2$refr === void 0 ? void 0 : _parent$service2$refr.call(_parent$service2);
496
585
  }
497
586
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
498
- _context8.next = 11;
587
+ _context9.next = 11;
499
588
  break;
500
589
  }
501
- return _context8.abrupt("return");
590
+ return _context9.abrupt("return");
502
591
  case 11:
503
592
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
504
593
  _antd.Modal.success({
505
594
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
506
595
  onOk: function () {
507
- var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
508
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
509
- while (1) switch (_context7.prev = _context7.next) {
596
+ var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
597
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
598
+ while (1) switch (_context8.prev = _context8.next) {
510
599
  case 0:
511
600
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
512
601
  if (isURL(onSuccess.redirectTo)) {
@@ -517,9 +606,9 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
517
606
  }
518
607
  case 1:
519
608
  case "end":
520
- return _context7.stop();
609
+ return _context8.stop();
521
610
  }
522
- }, _callee7);
611
+ }, _callee8);
523
612
  }));
524
613
  function onOk() {
525
614
  return _onOk2.apply(this, arguments);
@@ -532,28 +621,28 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
532
621
  }
533
622
  case 12:
534
623
  case "end":
535
- return _context8.stop();
624
+ return _context9.stop();
536
625
  }
537
- }, _callee8);
626
+ }, _callee9);
538
627
  }))();
539
628
  }
540
629
  };
541
630
  };
542
631
  exports.useCustomizeUpdateActionProps = useCustomizeUpdateActionProps;
543
632
  var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionProps() {
544
- var _ref5, _tableBlockContext$fi, _tableBlockContext$fi2, _tableBlockContext$fi3, _currentUserContext$d3;
545
- var _useBlockRequestConte3 = (0, _BlockProvider.useBlockRequestContext)(),
546
- field = _useBlockRequestConte3.field,
547
- resource = _useBlockRequestConte3.resource,
548
- __parent = _useBlockRequestConte3.__parent,
549
- service = _useBlockRequestConte3.service;
633
+ var _ref6, _tableBlockContext$fi, _tableBlockContext$fi2, _tableBlockContext$fi3, _currentUserContext$d4;
634
+ var _useBlockRequestConte4 = (0, _BlockProvider.useBlockRequestContext)(),
635
+ field = _useBlockRequestConte4.field,
636
+ resource = _useBlockRequestConte4.resource,
637
+ __parent = _useBlockRequestConte4.__parent,
638
+ service = _useBlockRequestConte4.service;
550
639
  var expressionScope = (0, _react2.useContext)(_react.SchemaExpressionScopeContext);
551
640
  var actionSchema = (0, _react.useFieldSchema)();
552
641
  var tableBlockContext = (0, _2.useTableBlockContext)();
553
642
  var rowKey = tableBlockContext.rowKey;
554
- var selectedRecordKeys = (_ref5 = (_tableBlockContext$fi = (_tableBlockContext$fi2 = tableBlockContext.field) === null || _tableBlockContext$fi2 === void 0 ? void 0 : (_tableBlockContext$fi3 = _tableBlockContext$fi2.data) === null || _tableBlockContext$fi3 === void 0 ? void 0 : _tableBlockContext$fi3.selectedRowKeys) !== null && _tableBlockContext$fi !== void 0 ? _tableBlockContext$fi : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref5 !== void 0 ? _ref5 : {};
643
+ var selectedRecordKeys = (_ref6 = (_tableBlockContext$fi = (_tableBlockContext$fi2 = tableBlockContext.field) === null || _tableBlockContext$fi2 === void 0 ? void 0 : (_tableBlockContext$fi3 = _tableBlockContext$fi2.data) === null || _tableBlockContext$fi3 === void 0 ? void 0 : _tableBlockContext$fi3.selectedRowKeys) !== null && _tableBlockContext$fi !== void 0 ? _tableBlockContext$fi : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref6 !== void 0 ? _ref6 : {};
555
644
  var currentUserContext = (0, _user.useCurrentUserContext)();
556
- var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d3 = currentUserContext.data) === null || _currentUserContext$d3 === void 0 ? void 0 : _currentUserContext$d3.data;
645
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d4 = currentUserContext.data) === null || _currentUserContext$d4 === void 0 ? void 0 : _currentUserContext$d4.data;
557
646
  var history = (0, _reactRouterDom.useHistory)();
558
647
  var compile = (0, _schemaComponent.useCompile)();
559
648
  var _useTranslation2 = (0, _reactI18next.useTranslation)(),
@@ -561,16 +650,16 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
561
650
  var actionField = (0, _react.useField)();
562
651
  return {
563
652
  onClick: function onClick() {
564
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
565
- var _actionSchema$xActio3;
566
- var _ref6, _ref6$assignedValues, originalAssignedValues, onSuccess, updateMode, assignedValues;
567
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
568
- while (1) switch (_context12.prev = _context12.next) {
653
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
654
+ var _actionSchema$xActio4;
655
+ var _ref7, _ref7$assignedValues, originalAssignedValues, onSuccess, updateMode, assignedValues;
656
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
657
+ while (1) switch (_context13.prev = _context13.next) {
569
658
  case 0:
570
- _ref6 = (_actionSchema$xActio3 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio3 !== void 0 ? _actionSchema$xActio3 : {}, _ref6$assignedValues = _ref6.assignedValues, originalAssignedValues = _ref6$assignedValues === void 0 ? {} : _ref6$assignedValues, onSuccess = _ref6.onSuccess, updateMode = _ref6.updateMode;
659
+ _ref7 = (_actionSchema$xActio4 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio4 !== void 0 ? _actionSchema$xActio4 : {}, _ref7$assignedValues = _ref7.assignedValues, originalAssignedValues = _ref7$assignedValues === void 0 ? {} : _ref7$assignedValues, onSuccess = _ref7.onSuccess, updateMode = _ref7.updateMode;
571
660
  actionField.data = field.data || {};
572
661
  actionField.data.loading = true;
573
- assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
662
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
574
663
  currentTime: new Date(),
575
664
  currentUser: currentUser
576
665
  });
@@ -578,29 +667,29 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
578
667
  title: t('Bulk update'),
579
668
  content: updateMode === 'selected' ? t('Update selected data?') : t('Update all data?'),
580
669
  onOk: function onOk() {
581
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
670
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
582
671
  var _service$params$, _service$params, _service$refresh2;
583
- var _ref7, filter, updateData, _parent$service3, _parent$service3$refr;
584
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
585
- while (1) switch (_context10.prev = _context10.next) {
672
+ var _ref8, filter, updateData, _parent$service3, _parent$service3$refr;
673
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
674
+ while (1) switch (_context11.prev = _context11.next) {
586
675
  case 0:
587
- _ref7 = (_service$params$ = (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params[0]) !== null && _service$params$ !== void 0 ? _service$params$ : {}, filter = _ref7.filter;
676
+ _ref8 = (_service$params$ = (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params[0]) !== null && _service$params$ !== void 0 ? _service$params$ : {}, filter = _ref8.filter;
588
677
  updateData = {
589
678
  values: _objectSpread({}, assignedValues),
590
679
  filter: filter,
591
680
  forceUpdate: false
592
681
  };
593
682
  if (!(updateMode === 'selected')) {
594
- _context10.next = 8;
683
+ _context11.next = 8;
595
684
  break;
596
685
  }
597
686
  if (selectedRecordKeys === null || selectedRecordKeys === void 0 ? void 0 : selectedRecordKeys.length) {
598
- _context10.next = 7;
687
+ _context11.next = 7;
599
688
  break;
600
689
  }
601
690
  _antd.message.error(t('Please select the records to be updated'));
602
691
  actionField.data.loading = false;
603
- return _context10.abrupt("return");
692
+ return _context11.abrupt("return");
604
693
  case 7:
605
694
  updateData.filter = {
606
695
  $and: [_defineProperty({}, rowKey || 'id', {
@@ -611,37 +700,37 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
611
700
  if (!updateData.filter) {
612
701
  updateData.forceUpdate = true;
613
702
  }
614
- _context10.prev = 9;
615
- _context10.next = 12;
703
+ _context11.prev = 9;
704
+ _context11.next = 12;
616
705
  return resource.update(updateData);
617
706
  case 12:
618
- _context10.next = 16;
707
+ _context11.next = 16;
619
708
  break;
620
709
  case 14:
621
- _context10.prev = 14;
622
- _context10.t0 = _context10["catch"](9);
710
+ _context11.prev = 14;
711
+ _context11.t0 = _context11["catch"](9);
623
712
  case 16:
624
- _context10.prev = 16;
713
+ _context11.prev = 16;
625
714
  actionField.data.loading = false;
626
- return _context10.finish(16);
715
+ return _context11.finish(16);
627
716
  case 19:
628
717
  service === null || service === void 0 ? void 0 : (_service$refresh2 = service.refresh) === null || _service$refresh2 === void 0 ? void 0 : _service$refresh2.call(service);
629
718
  if (!(resource instanceof _TableFieldProvider.TableFieldResource)) {
630
719
  __parent === null || __parent === void 0 ? void 0 : (_parent$service3 = __parent.service) === null || _parent$service3 === void 0 ? void 0 : (_parent$service3$refr = _parent$service3.refresh) === null || _parent$service3$refr === void 0 ? void 0 : _parent$service3$refr.call(_parent$service3);
631
720
  }
632
721
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
633
- _context10.next = 23;
722
+ _context11.next = 23;
634
723
  break;
635
724
  }
636
- return _context10.abrupt("return");
725
+ return _context11.abrupt("return");
637
726
  case 23:
638
727
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
639
728
  _antd.Modal.success({
640
729
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
641
730
  onOk: function () {
642
- var _onOk3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
643
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
644
- while (1) switch (_context9.prev = _context9.next) {
731
+ var _onOk3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
732
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
733
+ while (1) switch (_context10.prev = _context10.next) {
645
734
  case 0:
646
735
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
647
736
  if (isURL(onSuccess.redirectTo)) {
@@ -652,9 +741,9 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
652
741
  }
653
742
  case 1:
654
743
  case "end":
655
- return _context9.stop();
744
+ return _context10.stop();
656
745
  }
657
- }, _callee9);
746
+ }, _callee10);
658
747
  }));
659
748
  function onOk() {
660
749
  return _onOk3.apply(this, arguments);
@@ -667,44 +756,44 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
667
756
  }
668
757
  case 24:
669
758
  case "end":
670
- return _context10.stop();
759
+ return _context11.stop();
671
760
  }
672
- }, _callee10, null, [[9, 14, 16, 19]]);
761
+ }, _callee11, null, [[9, 14, 16, 19]]);
673
762
  }))();
674
763
  },
675
764
  onCancel: function onCancel() {
676
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
677
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
678
- while (1) switch (_context11.prev = _context11.next) {
765
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
766
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
767
+ while (1) switch (_context12.prev = _context12.next) {
679
768
  case 0:
680
769
  actionField.data.loading = false;
681
770
  case 1:
682
771
  case "end":
683
- return _context11.stop();
772
+ return _context12.stop();
684
773
  }
685
- }, _callee11);
774
+ }, _callee12);
686
775
  }))();
687
776
  }
688
777
  });
689
778
  case 5:
690
779
  case "end":
691
- return _context12.stop();
780
+ return _context13.stop();
692
781
  }
693
- }, _callee12);
782
+ }, _callee13);
694
783
  }))();
695
784
  }
696
785
  };
697
786
  };
698
787
  exports.useCustomizeBulkUpdateActionProps = useCustomizeBulkUpdateActionProps;
699
788
  var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps() {
700
- var _ref9, _tableBlockContext$fi4, _tableBlockContext$fi5, _tableBlockContext$fi6;
789
+ var _ref10, _tableBlockContext$fi4, _tableBlockContext$fi5, _tableBlockContext$fi6;
701
790
  var form = (0, _react.useForm)();
702
791
  var _useTranslation3 = (0, _reactI18next.useTranslation)(),
703
792
  t = _useTranslation3.t;
704
- var _useBlockRequestConte4 = (0, _BlockProvider.useBlockRequestContext)(),
705
- field = _useBlockRequestConte4.field,
706
- resource = _useBlockRequestConte4.resource,
707
- __parent = _useBlockRequestConte4.__parent;
793
+ var _useBlockRequestConte5 = (0, _BlockProvider.useBlockRequestContext)(),
794
+ field = _useBlockRequestConte5.field,
795
+ resource = _useBlockRequestConte5.resource,
796
+ __parent = _useBlockRequestConte5.__parent;
708
797
  var expressionScope = (0, _react2.useContext)(_react.SchemaExpressionScopeContext);
709
798
  var actionContext = (0, _schemaComponent.useActionContext)();
710
799
  var history = (0, _reactRouterDom.useHistory)();
@@ -712,24 +801,24 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
712
801
  var actionField = (0, _react.useField)();
713
802
  var tableBlockContext = (0, _2.useTableBlockContext)();
714
803
  var rowKey = tableBlockContext.rowKey;
715
- var selectedRecordKeys = (_ref9 = (_tableBlockContext$fi4 = (_tableBlockContext$fi5 = tableBlockContext.field) === null || _tableBlockContext$fi5 === void 0 ? void 0 : (_tableBlockContext$fi6 = _tableBlockContext$fi5.data) === null || _tableBlockContext$fi6 === void 0 ? void 0 : _tableBlockContext$fi6.selectedRowKeys) !== null && _tableBlockContext$fi4 !== void 0 ? _tableBlockContext$fi4 : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref9 !== void 0 ? _ref9 : {};
804
+ var selectedRecordKeys = (_ref10 = (_tableBlockContext$fi4 = (_tableBlockContext$fi5 = tableBlockContext.field) === null || _tableBlockContext$fi5 === void 0 ? void 0 : (_tableBlockContext$fi6 = _tableBlockContext$fi5.data) === null || _tableBlockContext$fi6 === void 0 ? void 0 : _tableBlockContext$fi6.selectedRowKeys) !== null && _tableBlockContext$fi4 !== void 0 ? _tableBlockContext$fi4 : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref10 !== void 0 ? _ref10 : {};
716
805
  var setVisible = actionContext.setVisible,
717
806
  actionSchema = actionContext.fieldSchema;
718
807
  return {
719
808
  onClick: function onClick() {
720
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
721
- var _actionSchema$xActio4, _parent$service$para, _parent$service$para2;
722
- var _ref10, onSuccess, skipValidator, updateMode, _ref11, filter, values, key, value, _parent$service4, _parent$service4$refr, updateData, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
723
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
724
- while (1) switch (_context14.prev = _context14.next) {
809
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
810
+ var _actionSchema$xActio5, _parent$service$para, _parent$service$para2;
811
+ var _ref11, onSuccess, skipValidator, updateMode, _ref12, filter, values, key, value, _parent$service4, _parent$service4$refr, updateData, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
812
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
813
+ while (1) switch (_context15.prev = _context15.next) {
725
814
  case 0:
726
- _ref10 = (_actionSchema$xActio4 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio4 !== void 0 ? _actionSchema$xActio4 : {}, onSuccess = _ref10.onSuccess, skipValidator = _ref10.skipValidator, updateMode = _ref10.updateMode;
727
- _ref11 = (_parent$service$para = (_parent$service$para2 = __parent.service.params) === null || _parent$service$para2 === void 0 ? void 0 : _parent$service$para2[0]) !== null && _parent$service$para !== void 0 ? _parent$service$para : {}, filter = _ref11.filter;
815
+ _ref11 = (_actionSchema$xActio5 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio5 !== void 0 ? _actionSchema$xActio5 : {}, onSuccess = _ref11.onSuccess, skipValidator = _ref11.skipValidator, updateMode = _ref11.updateMode;
816
+ _ref12 = (_parent$service$para = (_parent$service$para2 = __parent.service.params) === null || _parent$service$para2 === void 0 ? void 0 : _parent$service$para2[0]) !== null && _parent$service$para !== void 0 ? _parent$service$para : {}, filter = _ref12.filter;
728
817
  if (skipValidator) {
729
- _context14.next = 5;
818
+ _context15.next = 5;
730
819
  break;
731
820
  }
732
- _context14.next = 5;
821
+ _context15.next = 5;
733
822
  return form.submit();
734
823
  case 5:
735
824
  values = (0, _lodash.cloneDeep)(form.values);
@@ -747,22 +836,22 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
747
836
  }
748
837
  }
749
838
  }
750
- _context14.prev = 9;
839
+ _context15.prev = 9;
751
840
  updateData = {
752
841
  values: values,
753
842
  filter: filter,
754
843
  forceUpdate: false
755
844
  };
756
845
  if (!(updateMode === 'selected')) {
757
- _context14.next = 16;
846
+ _context15.next = 16;
758
847
  break;
759
848
  }
760
849
  if (selectedRecordKeys === null || selectedRecordKeys === void 0 ? void 0 : selectedRecordKeys.length) {
761
- _context14.next = 15;
850
+ _context15.next = 15;
762
851
  break;
763
852
  }
764
853
  _antd.message.error(t('Please select the records to be updated'));
765
- return _context14.abrupt("return");
854
+ return _context15.abrupt("return");
766
855
  case 15:
767
856
  updateData.filter = {
768
857
  $and: [_defineProperty({}, rowKey || 'id', {
@@ -773,7 +862,7 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
773
862
  if (!updateData.filter) {
774
863
  updateData.forceUpdate = true;
775
864
  }
776
- _context14.next = 19;
865
+ _context15.next = 19;
777
866
  return resource.update(updateData);
778
867
  case 19:
779
868
  actionField.data.loading = false;
@@ -783,20 +872,20 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
783
872
  __parent === null || __parent === void 0 ? void 0 : (_parent$service4 = __parent.service) === null || _parent$service4 === void 0 ? void 0 : (_parent$service4$refr = _parent$service4.refresh) === null || _parent$service4$refr === void 0 ? void 0 : _parent$service4$refr.call(_parent$service4);
784
873
  setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
785
874
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
786
- _context14.next = 25;
875
+ _context15.next = 25;
787
876
  break;
788
877
  }
789
- return _context14.abrupt("return");
878
+ return _context15.abrupt("return");
790
879
  case 25:
791
880
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
792
881
  _antd.Modal.success({
793
882
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
794
883
  onOk: function () {
795
- var _onOk4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
796
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
797
- while (1) switch (_context13.prev = _context13.next) {
884
+ var _onOk4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
885
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
886
+ while (1) switch (_context14.prev = _context14.next) {
798
887
  case 0:
799
- _context13.next = 2;
888
+ _context14.next = 2;
800
889
  return form.reset();
801
890
  case 2:
802
891
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
@@ -808,9 +897,9 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
808
897
  }
809
898
  case 3:
810
899
  case "end":
811
- return _context13.stop();
900
+ return _context14.stop();
812
901
  }
813
- }, _callee13);
902
+ }, _callee14);
814
903
  }));
815
904
  function onOk() {
816
905
  return _onOk4.apply(this, arguments);
@@ -822,62 +911,62 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
822
911
  _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
823
912
  }
824
913
  case 26:
825
- _context14.prev = 26;
914
+ _context15.prev = 26;
826
915
  actionField.data.loading = false;
827
- return _context14.finish(26);
916
+ return _context15.finish(26);
828
917
  case 29:
829
918
  case "end":
830
- return _context14.stop();
919
+ return _context15.stop();
831
920
  }
832
- }, _callee14, null, [[9,, 26, 29]]);
921
+ }, _callee15, null, [[9,, 26, 29]]);
833
922
  }))();
834
923
  }
835
924
  };
836
925
  };
837
926
  exports.useCustomizeBulkEditActionProps = useCustomizeBulkEditActionProps;
838
927
  var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
839
- var _currentUserContext$d4;
928
+ var _currentUserContext$d5;
840
929
  var apiClient = (0, _apiClient.useAPIClient)();
841
930
  var history = (0, _reactRouterDom.useHistory)();
842
931
  var filterByTk = (0, _BlockProvider.useFilterByTk)();
843
932
  var actionSchema = (0, _react.useFieldSchema)();
844
933
  var compile = (0, _schemaComponent.useCompile)();
845
934
  var form = (0, _react.useForm)();
846
- var _useCollection3 = (0, _collectionManager.useCollection)(),
847
- fields = _useCollection3.fields,
848
- getField = _useCollection3.getField;
849
- var _useBlockRequestConte5 = (0, _BlockProvider.useBlockRequestContext)(),
850
- field = _useBlockRequestConte5.field,
851
- resource = _useBlockRequestConte5.resource,
852
- __parent = _useBlockRequestConte5.__parent,
853
- service = _useBlockRequestConte5.service;
935
+ var _useCollection4 = (0, _collectionManager.useCollection)(),
936
+ fields = _useCollection4.fields,
937
+ getField = _useCollection4.getField;
938
+ var _useBlockRequestConte6 = (0, _BlockProvider.useBlockRequestContext)(),
939
+ field = _useBlockRequestConte6.field,
940
+ resource = _useBlockRequestConte6.resource,
941
+ __parent = _useBlockRequestConte6.__parent,
942
+ service = _useBlockRequestConte6.service;
854
943
  var currentRecord = (0, _recordProvider.useRecord)();
855
944
  var currentUserContext = (0, _user.useCurrentUserContext)();
856
- var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d4 = currentUserContext.data) === null || _currentUserContext$d4 === void 0 ? void 0 : _currentUserContext$d4.data;
945
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d5 = currentUserContext.data) === null || _currentUserContext$d5 === void 0 ? void 0 : _currentUserContext$d5.data;
857
946
  var actionField = (0, _react.useField)();
858
- var _useActionContext2 = (0, _schemaComponent.useActionContext)(),
859
- setVisible = _useActionContext2.setVisible;
947
+ var _useActionContext3 = (0, _schemaComponent.useActionContext)(),
948
+ setVisible = _useActionContext3.setVisible;
860
949
  return {
861
950
  onClick: function onClick() {
862
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
863
- var _actionSchema$xActio5;
864
- var _ref13, skipValidator, onSuccess, requestSettings, xAction, headers, params, data, methods, fieldNames, values, requestBody, _service$refresh3, _parent$service5, _parent$service5$refr;
865
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
866
- while (1) switch (_context16.prev = _context16.next) {
951
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
952
+ var _actionSchema$xActio6;
953
+ var _ref14, skipValidator, onSuccess, requestSettings, xAction, headers, params, data, methods, fieldNames, values, requestBody, _service$refresh3, _parent$service5, _parent$service5$refr;
954
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
955
+ while (1) switch (_context17.prev = _context17.next) {
867
956
  case 0:
868
- _ref13 = (_actionSchema$xActio5 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio5 !== void 0 ? _actionSchema$xActio5 : {}, skipValidator = _ref13.skipValidator, onSuccess = _ref13.onSuccess, requestSettings = _ref13.requestSettings;
957
+ _ref14 = (_actionSchema$xActio6 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio6 !== void 0 ? _actionSchema$xActio6 : {}, skipValidator = _ref14.skipValidator, onSuccess = _ref14.onSuccess, requestSettings = _ref14.requestSettings;
869
958
  xAction = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action'];
870
959
  if (requestSettings['url']) {
871
- _context16.next = 4;
960
+ _context17.next = 4;
872
961
  break;
873
962
  }
874
- return _context16.abrupt("return");
963
+ return _context17.abrupt("return");
875
964
  case 4:
876
965
  if (!(skipValidator !== true && xAction === 'customize:form:request')) {
877
- _context16.next = 7;
966
+ _context17.next = 7;
878
967
  break;
879
968
  }
880
- _context16.next = 7;
969
+ _context17.next = 7;
881
970
  return form.submit();
882
971
  case 7:
883
972
  headers = requestSettings['headers'] ? JSON.parse(requestSettings['headers']) : {};
@@ -897,23 +986,23 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
897
986
  currentUser: currentUser
898
987
  }),
899
988
  method: requestSettings['method'],
900
- headers: (0, _jsonTemplates.default)(headers)({
989
+ headers: (0, _client.parse)(headers)({
901
990
  currentRecord: currentRecord,
902
991
  currentUser: currentUser
903
992
  }),
904
- params: (0, _jsonTemplates.default)(params)({
993
+ params: (0, _client.parse)(params)({
905
994
  currentRecord: currentRecord,
906
995
  currentUser: currentUser
907
996
  }),
908
- data: (0, _jsonTemplates.default)(data)({
997
+ data: (0, _client.parse)(data)({
909
998
  currentRecord: currentRecord,
910
999
  currentUser: currentUser
911
1000
  })
912
1001
  };
913
1002
  actionField.data = field.data || {};
914
1003
  actionField.data.loading = true;
915
- _context16.prev = 15;
916
- _context16.next = 18;
1004
+ _context17.prev = 15;
1005
+ _context17.next = 18;
917
1006
  return apiClient.request(_objectSpread({}, requestBody));
918
1007
  case 18:
919
1008
  actionField.data.loading = false;
@@ -925,18 +1014,18 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
925
1014
  setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
926
1015
  }
927
1016
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
928
- _context16.next = 24;
1017
+ _context17.next = 24;
929
1018
  break;
930
1019
  }
931
- return _context16.abrupt("return");
1020
+ return _context17.abrupt("return");
932
1021
  case 24:
933
1022
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
934
1023
  _antd.Modal.success({
935
1024
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
936
1025
  onOk: function () {
937
- var _onOk5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
938
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
939
- while (1) switch (_context15.prev = _context15.next) {
1026
+ var _onOk5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1027
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1028
+ while (1) switch (_context16.prev = _context16.next) {
940
1029
  case 0:
941
1030
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
942
1031
  if (isURL(onSuccess.redirectTo)) {
@@ -947,9 +1036,9 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
947
1036
  }
948
1037
  case 1:
949
1038
  case "end":
950
- return _context15.stop();
1039
+ return _context16.stop();
951
1040
  }
952
- }, _callee15);
1041
+ }, _callee16);
953
1042
  }));
954
1043
  function onOk() {
955
1044
  return _onOk5.apply(this, arguments);
@@ -961,60 +1050,60 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
961
1050
  _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
962
1051
  }
963
1052
  case 25:
964
- _context16.prev = 25;
1053
+ _context17.prev = 25;
965
1054
  actionField.data.loading = false;
966
- return _context16.finish(25);
1055
+ return _context17.finish(25);
967
1056
  case 28:
968
1057
  case "end":
969
- return _context16.stop();
1058
+ return _context17.stop();
970
1059
  }
971
- }, _callee16, null, [[15,, 25, 28]]);
1060
+ }, _callee17, null, [[15,, 25, 28]]);
972
1061
  }))();
973
1062
  }
974
1063
  };
975
1064
  };
976
1065
  exports.useCustomizeRequestActionProps = useCustomizeRequestActionProps;
977
1066
  var useUpdateActionProps = function useUpdateActionProps() {
978
- var _currentUserContext$d5;
1067
+ var _currentUserContext$d6;
979
1068
  var form = (0, _react.useForm)();
980
1069
  var filterByTk = (0, _BlockProvider.useFilterByTk)();
981
- var _useBlockRequestConte6 = (0, _BlockProvider.useBlockRequestContext)(),
982
- field = _useBlockRequestConte6.field,
983
- resource = _useBlockRequestConte6.resource,
984
- __parent = _useBlockRequestConte6.__parent;
985
- var _useActionContext3 = (0, _schemaComponent.useActionContext)(),
986
- setVisible = _useActionContext3.setVisible;
1070
+ var _useBlockRequestConte7 = (0, _BlockProvider.useBlockRequestContext)(),
1071
+ field = _useBlockRequestConte7.field,
1072
+ resource = _useBlockRequestConte7.resource,
1073
+ __parent = _useBlockRequestConte7.__parent;
1074
+ var _useActionContext4 = (0, _schemaComponent.useActionContext)(),
1075
+ setVisible = _useActionContext4.setVisible;
987
1076
  var actionSchema = (0, _react.useFieldSchema)();
988
1077
  var history = (0, _reactRouterDom.useHistory)();
989
- var _useCollection4 = (0, _collectionManager.useCollection)(),
990
- fields = _useCollection4.fields,
991
- getField = _useCollection4.getField;
1078
+ var _useCollection5 = (0, _collectionManager.useCollection)(),
1079
+ fields = _useCollection5.fields,
1080
+ getField = _useCollection5.getField;
992
1081
  var compile = (0, _schemaComponent.useCompile)();
993
1082
  var actionField = (0, _react.useField)();
994
1083
  var _useFormBlockContext = (0, _2.useFormBlockContext)(),
995
1084
  updateAssociationValues = _useFormBlockContext.updateAssociationValues;
996
1085
  var currentRecord = (0, _recordProvider.useRecord)();
997
1086
  var currentUserContext = (0, _user.useCurrentUserContext)();
998
- var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d5 = currentUserContext.data) === null || _currentUserContext$d5 === void 0 ? void 0 : _currentUserContext$d5.data;
1087
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d6 = currentUserContext.data) === null || _currentUserContext$d6 === void 0 ? void 0 : _currentUserContext$d6.data;
999
1088
  return {
1000
1089
  onClick: function onClick() {
1001
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1002
- var _actionSchema$xActio6;
1003
- var _ref14, _ref14$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, fieldNames, values, _parent$service6, _parent$service6$refr, _parent$__parent2, _parent$__parent2$ser, _parent$__parent2$ser2;
1004
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1005
- while (1) switch (_context18.prev = _context18.next) {
1090
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1091
+ var _actionSchema$xActio7;
1092
+ var _ref15, _ref15$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, fieldNames, values, _parent$service6, _parent$service6$refr;
1093
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1094
+ while (1) switch (_context19.prev = _context19.next) {
1006
1095
  case 0:
1007
- _ref14 = (_actionSchema$xActio6 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio6 !== void 0 ? _actionSchema$xActio6 : {}, _ref14$assignedValues = _ref14.assignedValues, originalAssignedValues = _ref14$assignedValues === void 0 ? {} : _ref14$assignedValues, onSuccess = _ref14.onSuccess, overwriteValues = _ref14.overwriteValues, skipValidator = _ref14.skipValidator;
1008
- assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
1096
+ _ref15 = (_actionSchema$xActio7 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio7 !== void 0 ? _actionSchema$xActio7 : {}, _ref15$assignedValues = _ref15.assignedValues, originalAssignedValues = _ref15$assignedValues === void 0 ? {} : _ref15$assignedValues, onSuccess = _ref15.onSuccess, overwriteValues = _ref15.overwriteValues, skipValidator = _ref15.skipValidator;
1097
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
1009
1098
  currentTime: new Date(),
1010
1099
  currentRecord: currentRecord,
1011
1100
  currentUser: currentUser
1012
1101
  });
1013
1102
  if (skipValidator) {
1014
- _context18.next = 5;
1103
+ _context19.next = 5;
1015
1104
  break;
1016
1105
  }
1017
- _context18.next = 5;
1106
+ _context19.next = 5;
1018
1107
  return form.submit();
1019
1108
  case 5:
1020
1109
  fieldNames = fields.map(function (field) {
@@ -1023,8 +1112,8 @@ var useUpdateActionProps = function useUpdateActionProps() {
1023
1112
  values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
1024
1113
  actionField.data = field.data || {};
1025
1114
  actionField.data.loading = true;
1026
- _context18.prev = 9;
1027
- _context18.next = 12;
1115
+ _context19.prev = 9;
1116
+ _context19.next = 12;
1028
1117
  return resource.update({
1029
1118
  filterByTk: filterByTk,
1030
1119
  values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues),
@@ -1032,26 +1121,23 @@ var useUpdateActionProps = function useUpdateActionProps() {
1032
1121
  });
1033
1122
  case 12:
1034
1123
  actionField.data.loading = false;
1035
- if (!(resource instanceof _TableFieldProvider.TableFieldResource)) {
1036
- __parent === null || __parent === void 0 ? void 0 : (_parent$__parent2 = __parent.__parent) === null || _parent$__parent2 === void 0 ? void 0 : (_parent$__parent2$ser = _parent$__parent2.service) === null || _parent$__parent2$ser === void 0 ? void 0 : (_parent$__parent2$ser2 = _parent$__parent2$ser.refresh) === null || _parent$__parent2$ser2 === void 0 ? void 0 : _parent$__parent2$ser2.call(_parent$__parent2$ser);
1037
- }
1038
1124
  __parent === null || __parent === void 0 ? void 0 : (_parent$service6 = __parent.service) === null || _parent$service6 === void 0 ? void 0 : (_parent$service6$refr = _parent$service6.refresh) === null || _parent$service6$refr === void 0 ? void 0 : _parent$service6$refr.call(_parent$service6);
1039
1125
  setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
1040
1126
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
1041
- _context18.next = 18;
1127
+ _context19.next = 17;
1042
1128
  break;
1043
1129
  }
1044
- return _context18.abrupt("return");
1045
- case 18:
1130
+ return _context19.abrupt("return");
1131
+ case 17:
1046
1132
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
1047
1133
  _antd.Modal.success({
1048
1134
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
1049
1135
  onOk: function () {
1050
- var _onOk6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1051
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1052
- while (1) switch (_context17.prev = _context17.next) {
1136
+ var _onOk6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1137
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1138
+ while (1) switch (_context18.prev = _context18.next) {
1053
1139
  case 0:
1054
- _context17.next = 2;
1140
+ _context18.next = 2;
1055
1141
  return form.reset();
1056
1142
  case 2:
1057
1143
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
@@ -1063,9 +1149,9 @@ var useUpdateActionProps = function useUpdateActionProps() {
1063
1149
  }
1064
1150
  case 3:
1065
1151
  case "end":
1066
- return _context17.stop();
1152
+ return _context18.stop();
1067
1153
  }
1068
- }, _callee17);
1154
+ }, _callee18);
1069
1155
  }));
1070
1156
  function onOk() {
1071
1157
  return _onOk6.apply(this, arguments);
@@ -1076,17 +1162,17 @@ var useUpdateActionProps = function useUpdateActionProps() {
1076
1162
  } else {
1077
1163
  _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
1078
1164
  }
1079
- _context18.next = 24;
1165
+ _context19.next = 23;
1080
1166
  break;
1081
- case 21:
1082
- _context18.prev = 21;
1083
- _context18.t0 = _context18["catch"](9);
1167
+ case 20:
1168
+ _context19.prev = 20;
1169
+ _context19.t0 = _context19["catch"](9);
1084
1170
  actionField.data.loading = false;
1085
- case 24:
1171
+ case 23:
1086
1172
  case "end":
1087
- return _context18.stop();
1173
+ return _context19.stop();
1088
1174
  }
1089
- }, _callee18, null, [[9, 21]]);
1175
+ }, _callee19, null, [[9, 20]]);
1090
1176
  }))();
1091
1177
  }
1092
1178
  };
@@ -1094,27 +1180,27 @@ var useUpdateActionProps = function useUpdateActionProps() {
1094
1180
  exports.useUpdateActionProps = useUpdateActionProps;
1095
1181
  var useDestroyActionProps = function useDestroyActionProps() {
1096
1182
  var filterByTk = (0, _BlockProvider.useFilterByTk)();
1097
- var _useBlockRequestConte7 = (0, _BlockProvider.useBlockRequestContext)(),
1098
- resource = _useBlockRequestConte7.resource,
1099
- service = _useBlockRequestConte7.service,
1100
- block = _useBlockRequestConte7.block,
1101
- __parent = _useBlockRequestConte7.__parent;
1102
- var _useActionContext4 = (0, _schemaComponent.useActionContext)(),
1103
- setVisible = _useActionContext4.setVisible;
1183
+ var _useBlockRequestConte8 = (0, _BlockProvider.useBlockRequestContext)(),
1184
+ resource = _useBlockRequestConte8.resource,
1185
+ service = _useBlockRequestConte8.service,
1186
+ block = _useBlockRequestConte8.block,
1187
+ __parent = _useBlockRequestConte8.__parent;
1188
+ var _useActionContext5 = (0, _schemaComponent.useActionContext)(),
1189
+ setVisible = _useActionContext5.setVisible;
1104
1190
  return {
1105
1191
  onClick: function onClick() {
1106
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1192
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1107
1193
  var _service$data;
1108
- var _ref15, _ref15$count, count, _ref15$page, page, _ref15$pageSize, pageSize, _service$params2, _service$refresh4, _parent$service7, _parent$service7$refr;
1109
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1110
- while (1) switch (_context19.prev = _context19.next) {
1194
+ var _ref16, _ref16$count, count, _ref16$page, page, _ref16$pageSize, pageSize, _service$params2, _service$refresh4, _parent$service7, _parent$service7$refr;
1195
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1196
+ while (1) switch (_context20.prev = _context20.next) {
1111
1197
  case 0:
1112
- _context19.next = 2;
1198
+ _context20.next = 2;
1113
1199
  return resource.destroy({
1114
1200
  filterByTk: filterByTk
1115
1201
  });
1116
1202
  case 2:
1117
- _ref15 = (service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.meta) || {}, _ref15$count = _ref15.count, count = _ref15$count === void 0 ? 0 : _ref15$count, _ref15$page = _ref15.page, page = _ref15$page === void 0 ? 0 : _ref15$page, _ref15$pageSize = _ref15.pageSize, pageSize = _ref15$pageSize === void 0 ? 0 : _ref15$pageSize;
1203
+ _ref16 = (service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.meta) || {}, _ref16$count = _ref16.count, count = _ref16$count === void 0 ? 0 : _ref16$count, _ref16$page = _ref16.page, page = _ref16$page === void 0 ? 0 : _ref16$page, _ref16$pageSize = _ref16.pageSize, pageSize = _ref16$pageSize === void 0 ? 0 : _ref16$pageSize;
1118
1204
  if (count % pageSize === 1) {
1119
1205
  service.run(_objectSpread(_objectSpread({}, service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2[0]), {}, {
1120
1206
  page: page - 1
@@ -1128,14 +1214,38 @@ var useDestroyActionProps = function useDestroyActionProps() {
1128
1214
  }
1129
1215
  case 5:
1130
1216
  case "end":
1131
- return _context19.stop();
1217
+ return _context20.stop();
1132
1218
  }
1133
- }, _callee19);
1219
+ }, _callee20);
1134
1220
  }))();
1135
1221
  }
1136
1222
  };
1137
1223
  };
1138
1224
  exports.useDestroyActionProps = useDestroyActionProps;
1225
+ var useRemoveActionProps = function useRemoveActionProps(associationName) {
1226
+ var filterByTk = (0, _BlockProvider.useFilterByTk)();
1227
+ var api = (0, _apiClient.useAPIClient)();
1228
+ var resource = api.resource(associationName, filterByTk);
1229
+ return {
1230
+ onClick: function onClick(value) {
1231
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1232
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1233
+ while (1) switch (_context21.prev = _context21.next) {
1234
+ case 0:
1235
+ _context21.next = 2;
1236
+ return resource.remove({
1237
+ values: [value.id]
1238
+ });
1239
+ case 2:
1240
+ case "end":
1241
+ return _context21.stop();
1242
+ }
1243
+ }, _callee21);
1244
+ }))();
1245
+ }
1246
+ };
1247
+ };
1248
+ exports.useRemoveActionProps = useRemoveActionProps;
1139
1249
  var useDetailPrintActionProps = function useDetailPrintActionProps() {
1140
1250
  var _useFormBlockContext2 = (0, _2.useFormBlockContext)(),
1141
1251
  formBlockRef = _useFormBlockContext2.formBlockRef;
@@ -1147,41 +1257,41 @@ var useDetailPrintActionProps = function useDetailPrintActionProps() {
1147
1257
  });
1148
1258
  return {
1149
1259
  onClick: function onClick() {
1150
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1151
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1152
- while (1) switch (_context20.prev = _context20.next) {
1260
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1261
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1262
+ while (1) switch (_context22.prev = _context22.next) {
1153
1263
  case 0:
1154
1264
  printHandler();
1155
1265
  case 1:
1156
1266
  case "end":
1157
- return _context20.stop();
1267
+ return _context22.stop();
1158
1268
  }
1159
- }, _callee20);
1269
+ }, _callee22);
1160
1270
  }))();
1161
1271
  }
1162
1272
  };
1163
1273
  };
1164
1274
  exports.useDetailPrintActionProps = useDetailPrintActionProps;
1165
1275
  var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
1166
- var _useBlockRequestConte8 = (0, _BlockProvider.useBlockRequestContext)(),
1167
- field = _useBlockRequestConte8.field;
1168
1276
  var _useBlockRequestConte9 = (0, _BlockProvider.useBlockRequestContext)(),
1169
- resource = _useBlockRequestConte9.resource,
1170
- service = _useBlockRequestConte9.service;
1277
+ field = _useBlockRequestConte9.field;
1278
+ var _useBlockRequestConte10 = (0, _BlockProvider.useBlockRequestContext)(),
1279
+ resource = _useBlockRequestConte10.resource,
1280
+ service = _useBlockRequestConte10.service;
1171
1281
  return {
1172
1282
  onClick: function onClick() {
1173
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1283
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1174
1284
  var _field$data2, _field$data2$selected, _field$data3, _service$refresh5;
1175
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1176
- while (1) switch (_context21.prev = _context21.next) {
1285
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1286
+ while (1) switch (_context23.prev = _context23.next) {
1177
1287
  case 0:
1178
1288
  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) {
1179
- _context21.next = 2;
1289
+ _context23.next = 2;
1180
1290
  break;
1181
1291
  }
1182
- return _context21.abrupt("return");
1292
+ return _context23.abrupt("return");
1183
1293
  case 2:
1184
- _context21.next = 4;
1294
+ _context23.next = 4;
1185
1295
  return resource.destroy({
1186
1296
  filterByTk: (_field$data3 = field.data) === null || _field$data3 === void 0 ? void 0 : _field$data3.selectedRowKeys
1187
1297
  });
@@ -1190,30 +1300,30 @@ var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
1190
1300
  service === null || service === void 0 ? void 0 : (_service$refresh5 = service.refresh) === null || _service$refresh5 === void 0 ? void 0 : _service$refresh5.call(service);
1191
1301
  case 6:
1192
1302
  case "end":
1193
- return _context21.stop();
1303
+ return _context23.stop();
1194
1304
  }
1195
- }, _callee21);
1305
+ }, _callee23);
1196
1306
  }))();
1197
1307
  }
1198
1308
  };
1199
1309
  };
1200
1310
  exports.useBulkDestroyActionProps = useBulkDestroyActionProps;
1201
1311
  var useRefreshActionProps = function useRefreshActionProps() {
1202
- var _useBlockRequestConte10 = (0, _BlockProvider.useBlockRequestContext)(),
1203
- service = _useBlockRequestConte10.service;
1312
+ var _useBlockRequestConte11 = (0, _BlockProvider.useBlockRequestContext)(),
1313
+ service = _useBlockRequestConte11.service;
1204
1314
  return {
1205
1315
  onClick: function onClick() {
1206
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1316
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1207
1317
  var _service$refresh6;
1208
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1209
- while (1) switch (_context22.prev = _context22.next) {
1318
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1319
+ while (1) switch (_context24.prev = _context24.next) {
1210
1320
  case 0:
1211
1321
  service === null || service === void 0 ? void 0 : (_service$refresh6 = service.refresh) === null || _service$refresh6 === void 0 ? void 0 : _service$refresh6.call(service);
1212
1322
  case 1:
1213
1323
  case "end":
1214
- return _context22.stop();
1324
+ return _context24.stop();
1215
1325
  }
1216
- }, _callee22);
1326
+ }, _callee24);
1217
1327
  }))();
1218
1328
  }
1219
1329
  };
@@ -1230,11 +1340,11 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
1230
1340
  total: count,
1231
1341
  pageSize: 1,
1232
1342
  onChange: function onChange(page) {
1233
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1343
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1234
1344
  var _ctx$service3, _ctx$service3$params;
1235
1345
  var params;
1236
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1237
- while (1) switch (_context23.prev = _context23.next) {
1346
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1347
+ while (1) switch (_context25.prev = _context25.next) {
1238
1348
  case 0:
1239
1349
  params = (_ctx$service3 = ctx.service) === null || _ctx$service3 === void 0 ? void 0 : (_ctx$service3$params = _ctx$service3.params) === null || _ctx$service3$params === void 0 ? void 0 : _ctx$service3$params[0];
1240
1350
  ctx.service.run(_objectSpread(_objectSpread({}, params), {}, {
@@ -1242,9 +1352,9 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
1242
1352
  }));
1243
1353
  case 2:
1244
1354
  case "end":
1245
- return _context23.stop();
1355
+ return _context25.stop();
1246
1356
  }
1247
- }, _callee23);
1357
+ }, _callee25);
1248
1358
  }))();
1249
1359
  },
1250
1360
  style: {
@@ -1255,14 +1365,14 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
1255
1365
  };
1256
1366
  exports.useDetailsPaginationProps = useDetailsPaginationProps;
1257
1367
  var useAssociationFilterProps = function useAssociationFilterProps() {
1258
- var _fieldSchema$xCompon2, _fieldSchema$xCompon3, _field$componentProps, _field$componentProps2;
1368
+ var _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps, _field$componentProps2;
1259
1369
  var collectionField = _2.AssociationFilter.useAssociationField();
1260
- var _useBlockRequestConte11 = (0, _BlockProvider.useBlockRequestContext)(),
1261
- service = _useBlockRequestConte11.service,
1262
- blockProps = _useBlockRequestConte11.props;
1370
+ var _useBlockRequestConte12 = (0, _BlockProvider.useBlockRequestContext)(),
1371
+ service = _useBlockRequestConte12.service,
1372
+ blockProps = _useBlockRequestConte12.props;
1263
1373
  var fieldSchema = (0, _react.useFieldSchema)();
1264
1374
  var valueKey = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetKey) || 'id';
1265
- var labelKey = ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : (_fieldSchema$xCompon3 = _fieldSchema$xCompon2.fieldNames) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.label) || valueKey;
1375
+ var labelKey = ((_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : (_fieldSchema$xCompon4 = _fieldSchema$xCompon3.fieldNames) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.label) || valueKey;
1266
1376
  var field = (0, _react.useField)();
1267
1377
  var collectionFieldName = collectionField.name;
1268
1378
  var _useRequest = (0, _apiClient.useRequest)({
@@ -1313,9 +1423,9 @@ var useAssociationFilterProps = function useAssociationFilterProps() {
1313
1423
  };
1314
1424
  exports.useAssociationFilterProps = useAssociationFilterProps;
1315
1425
  var useOptionalFieldList = function useOptionalFieldList() {
1316
- var _useCollection5 = (0, _collectionManager.useCollection)(),
1317
- _useCollection5$curre = _useCollection5.currentFields,
1318
- currentFields = _useCollection5$curre === void 0 ? [] : _useCollection5$curre;
1426
+ var _useCollection6 = (0, _collectionManager.useCollection)(),
1427
+ _useCollection6$curre = _useCollection6.currentFields,
1428
+ currentFields = _useCollection6$curre === void 0 ? [] : _useCollection6$curre;
1319
1429
  return currentFields.filter(function (field) {
1320
1430
  return isOptionalField(field) && field.uiSchema.enum;
1321
1431
  });
@@ -1326,7 +1436,7 @@ var isOptionalField = function isOptionalField(field) {
1326
1436
  return optionalInterfaces.includes(field.interface);
1327
1437
  };
1328
1438
  var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
1329
- var _fieldSchema$xCompon4, _fieldSchema$xCompon5, _field$componentProps3, _field$componentProps4;
1439
+ var _fieldSchema$xCompon5, _fieldSchema$xCompon6, _field$componentProps3, _field$componentProps4;
1330
1440
  var collectionField = _2.AssociationFilter.useAssociationField();
1331
1441
  var fieldSchema = (0, _react.useFieldSchema)();
1332
1442
  var optionalFieldList = useOptionalFieldList();
@@ -1336,7 +1446,7 @@ var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
1336
1446
  var field = (0, _react.useField)();
1337
1447
  var list, onSelected, handleSearchInput, params, run, data, valueKey, labelKey, filterKey;
1338
1448
  valueKey = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetKey) || 'id';
1339
- labelKey = ((_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : (_fieldSchema$xCompon5 = _fieldSchema$xCompon4.fieldNames) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : _fieldSchema$xCompon5.label) || valueKey;
1449
+ labelKey = ((_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : (_fieldSchema$xCompon6 = _fieldSchema$xCompon5.fieldNames) === null || _fieldSchema$xCompon6 === void 0 ? void 0 : _fieldSchema$xCompon6.label) || valueKey;
1340
1450
  var _useRequest2 = (0, _apiClient.useRequest)({
1341
1451
  resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target,
1342
1452
  action: 'list',
@@ -1438,4 +1548,114 @@ var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
1438
1548
  labelKey: labelKey
1439
1549
  };
1440
1550
  };
1441
- exports.useAssociationFilterBlockProps = useAssociationFilterBlockProps;
1551
+ exports.useAssociationFilterBlockProps = useAssociationFilterBlockProps;
1552
+ var useAssociationNames = function useAssociationNames(collection) {
1553
+ var _useCollectionManager2 = (0, _collectionManager.useCollectionManager)(),
1554
+ getCollectionFields = _useCollectionManager2.getCollectionFields,
1555
+ getCollectionJoinField = _useCollectionManager2.getCollectionJoinField;
1556
+ var collectionFields = getCollectionFields(collection);
1557
+ var associationFields = new Set();
1558
+ var _iterator = _createForOfIteratorHelper(collectionFields),
1559
+ _step;
1560
+ try {
1561
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1562
+ var collectionField = _step.value;
1563
+ if (collectionField.target) {
1564
+ associationFields.add(collectionField.name);
1565
+ var fields = getCollectionFields(collectionField.target);
1566
+ var _iterator2 = _createForOfIteratorHelper(fields),
1567
+ _step2;
1568
+ try {
1569
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1570
+ var field = _step2.value;
1571
+ if (field.target) {
1572
+ associationFields.add("".concat(collectionField.name, ".").concat(field.name));
1573
+ }
1574
+ }
1575
+ } catch (err) {
1576
+ _iterator2.e(err);
1577
+ } finally {
1578
+ _iterator2.f();
1579
+ }
1580
+ }
1581
+ }
1582
+ } catch (err) {
1583
+ _iterator.e(err);
1584
+ } finally {
1585
+ _iterator.f();
1586
+ }
1587
+ var fieldSchema = (0, _react.useFieldSchema)();
1588
+ var associationValues = [];
1589
+ var formSchema = fieldSchema.reduceProperties(function (buf, schema) {
1590
+ if (['FormV2', 'Details'].includes(schema['x-component'])) {
1591
+ return schema;
1592
+ }
1593
+ return buf;
1594
+ }, new _react.Schema({}));
1595
+ var getAssociationAppends = function getAssociationAppends(schema) {
1596
+ var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1597
+ return schema.reduceProperties(function (buf, s) {
1598
+ var collectionfield = s['x-collection-field'] && getCollectionJoinField(s['x-collection-field']);
1599
+ if (collectionfield && ['createdBy', 'updatedBy', 'o2m', 'obo', 'oho', 'm2o', 'm2m'].includes(collectionfield.interface)) {
1600
+ var _s$xComponentProps;
1601
+ if (['Nester', 'SubTable'].includes((_s$xComponentProps = s['x-component-props']) === null || _s$xComponentProps === void 0 ? void 0 : _s$xComponentProps.mode)) {
1602
+ associationValues.push(s.name);
1603
+ }
1604
+ buf.push(s.name);
1605
+ if (s['x-component-props'].mode === 'Nester' || s['x-component'] === 'TableField') {
1606
+ return getAssociationAppends(s, buf);
1607
+ }
1608
+ return buf;
1609
+ } else {
1610
+ if (s['x-component'] === 'Grid' || s['x-component'] === 'TableV2') {
1611
+ var _buf$concat;
1612
+ var kk = buf === null || buf === void 0 ? void 0 : (_buf$concat = buf.concat) === null || _buf$concat === void 0 ? void 0 : _buf$concat.call(buf);
1613
+ return getNesterAppends(s, kk || []);
1614
+ } else {
1615
+ var _s$xComponent;
1616
+ return !((_s$xComponent = s['x-component']) === null || _s$xComponent === void 0 ? void 0 : _s$xComponent.includes('Action.')) && getAssociationAppends(s, buf);
1617
+ }
1618
+ }
1619
+ }, arr);
1620
+ };
1621
+ function flattenNestedList(nestedList) {
1622
+ var flattenedList = [];
1623
+ function flattenHelper(list, prefix) {
1624
+ for (var i = 0; i < list.length; i++) {
1625
+ if (Array.isArray(list[i])) {
1626
+ "".concat(prefix) !== "".concat(list[i][0]) && flattenHelper(list[i], "".concat(prefix, ".").concat(list[i][0]));
1627
+ } else {
1628
+ var str = prefix.replaceAll("".concat(list[i]), '').replace('..', '.').trim();
1629
+ !list.includes(str) && flattenedList.push("".concat(str).concat(list[i]));
1630
+ }
1631
+ }
1632
+ }
1633
+ for (var i = 0; i < nestedList.length; i++) {
1634
+ flattenHelper(nestedList[i], nestedList[i][0]);
1635
+ }
1636
+ return flattenedList.filter(function (obj) {
1637
+ return !obj.startsWith('.');
1638
+ });
1639
+ }
1640
+ var getNesterAppends = function getNesterAppends(gridSchema, data) {
1641
+ gridSchema.reduceProperties(function (buf, s) {
1642
+ buf.push(getAssociationAppends(s));
1643
+ return buf;
1644
+ }, data);
1645
+ return data.filter(function (g) {
1646
+ return g.length;
1647
+ });
1648
+ };
1649
+ var data = getAssociationAppends(formSchema);
1650
+ var associations = data.filter(function (g) {
1651
+ return g.length;
1652
+ });
1653
+ var appends = flattenNestedList(associations);
1654
+ return {
1655
+ appends: appends,
1656
+ updateAssociationValues: appends.filter(function (v) {
1657
+ return associationValues.includes(v);
1658
+ })
1659
+ };
1660
+ };
1661
+ exports.useAssociationNames = useAssociationNames;