@nocobase/client 0.7.6-alpha.2 → 0.8.0-alpha.10
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.
- package/es/acl/ACLShortcut.d.ts +2 -0
- package/es/acl/ACLShortcut.js +31 -2
- package/es/api-client/APIClient.d.ts +1 -0
- package/es/api-client/APIClient.js +6 -1
- package/es/application/Application.d.ts +3 -1
- package/es/application/Application.js +131 -39
- package/es/block-provider/BlockProvider.js +12 -1
- package/es/block-provider/CalendarBlockProvider.d.ts +1 -0
- package/es/block-provider/CalendarBlockProvider.js +6 -3
- package/es/block-provider/TableSelectorProvider.js +21 -6
- package/es/block-provider/hooks/index.d.ts +6 -0
- package/es/block-provider/hooks/index.js +485 -115
- package/es/collection-manager/CollectionManagerProvider.js +26 -45
- package/es/collection-manager/CollectionManagerShortcut.d.ts +2 -0
- package/es/collection-manager/CollectionManagerShortcut.js +38 -3
- package/es/collection-manager/Configuration/AddFieldAction.d.ts +5 -1
- package/es/collection-manager/Configuration/AddFieldAction.js +48 -13
- package/es/collection-manager/Configuration/CollectionFieldsTable.d.ts +15 -0
- package/es/collection-manager/Configuration/CollectionFieldsTable.js +73 -0
- package/es/collection-manager/Configuration/CollectionFieldsTableArray.d.ts +8 -0
- package/es/collection-manager/Configuration/CollectionFieldsTableArray.js +250 -0
- package/es/collection-manager/Configuration/ConfigurationTable.js +6 -2
- package/es/collection-manager/Configuration/EditFieldAction.d.ts +1 -0
- package/es/collection-manager/Configuration/EditFieldAction.js +24 -11
- package/es/collection-manager/Configuration/index.d.ts +3 -0
- package/es/collection-manager/Configuration/index.js +3 -0
- package/es/collection-manager/Configuration/schemas/collectionFields.js +4 -4
- package/es/collection-manager/Configuration/schemas/collections.js +1 -1
- package/es/collection-manager/index.d.ts +1 -0
- package/es/collection-manager/index.js +2 -1
- package/es/collection-manager/interfaces/index.d.ts +1 -0
- package/es/collection-manager/interfaces/index.js +1 -0
- package/es/collection-manager/interfaces/json.d.ts +2 -0
- package/es/collection-manager/interfaces/json.js +48 -0
- package/es/collection-manager/interfaces/m2o.js +3 -3
- package/es/collection-manager/interfaces/o2m.js +5 -6
- package/es/collection-manager/interfaces/o2o.js +5 -5
- package/es/collection-manager/interfaces/properties/index.d.ts +14 -0
- package/es/collection-manager/interfaces/properties/index.js +24 -1
- package/es/collection-manager/interfaces/sequence.js +13 -9
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locale/en_US.d.ts +24 -1
- package/es/locale/en_US.js +25 -2
- package/es/locale/ja_JP.d.ts +2 -1
- package/es/locale/ja_JP.js +2 -1
- package/es/locale/ru_RU.d.ts +2 -1
- package/es/locale/ru_RU.js +2 -1
- package/es/locale/tr_TR.d.ts +1 -1
- package/es/locale/tr_TR.js +1 -1
- package/es/locale/zh_CN.d.ts +50 -1
- package/es/locale/zh_CN.js +51 -2
- package/es/plugin-manager/PluginManager.js +35 -23
- package/es/pm/PluginManagerLink.d.ts +2 -0
- package/es/pm/PluginManagerLink.js +112 -0
- package/es/pm/index.d.ts +6 -0
- package/es/pm/index.js +422 -0
- package/es/route-switch/antd/admin-layout/index.js +1 -1
- package/es/schema-component/antd/action/Action.Designer.js +35 -12
- package/es/schema-component/antd/action/Action.Modal.js +4 -2
- package/es/schema-component/antd/action/Action.js +3 -3
- package/es/schema-component/antd/action/context.d.ts +2 -0
- package/es/schema-component/antd/action/hooks.d.ts +1 -0
- package/es/schema-component/antd/calendar/Calendar.Designer.js +19 -6
- package/es/schema-component/antd/calendar/Calendar.js +137 -23
- package/es/schema-component/antd/calendar/DeleteEvent.d.ts +3 -0
- package/es/schema-component/antd/calendar/DeleteEvent.js +147 -0
- package/es/schema-component/antd/calendar/Title.js +18 -3
- package/es/schema-component/antd/calendar/components/Header.d.ts +10 -0
- package/es/schema-component/antd/calendar/components/Header.js +43 -0
- package/es/schema-component/antd/calendar/index.js +2 -0
- package/es/schema-component/antd/calendar/style.less +53 -9
- package/es/schema-component/antd/calendar/types.d.ts +6 -0
- package/es/schema-component/antd/calendar/utils.d.ts +2 -0
- package/es/schema-component/antd/calendar/utils.js +7 -0
- package/es/schema-component/antd/checkbox/Checkbox.js +13 -4
- package/es/schema-component/antd/formula-input/FormulaInput.js +28 -37
- package/es/schema-component/antd/input/Input.d.ts +1 -0
- package/es/schema-component/antd/input/Input.js +2 -0
- package/es/schema-component/antd/input/Json.d.ts +6 -0
- package/es/schema-component/antd/input/Json.js +41 -0
- package/es/schema-component/antd/input/ReadPretty.d.ts +3 -0
- package/es/schema-component/antd/input/ReadPretty.js +15 -0
- package/es/schema-component/antd/input/index.d.ts +1 -0
- package/es/schema-component/antd/input/index.js +2 -1
- package/es/schema-component/antd/markdown/Markdown.Void.js +5 -2
- package/es/schema-component/antd/radio/Radio.js +2 -1
- package/es/schema-component/antd/select/ReadPretty.js +2 -1
- package/es/schema-component/antd/select/Select.js +25 -1
- package/es/schema-component/antd/table-v2/TableSelectorDesigner.js +16 -2
- package/es/schema-component/antd/upload/Upload.js +2 -1
- package/es/schema-component/antd/upload/shared.js +5 -6
- package/es/schema-component/antd/upload/type.d.ts +2 -0
- package/es/schema-initializer/buttons/BulkEditFormItemInitializers.d.ts +1 -0
- package/es/schema-initializer/buttons/BulkEditFormItemInitializers.js +50 -0
- package/es/schema-initializer/buttons/CalendarFormActionInitializers.d.ts +143 -0
- package/es/schema-initializer/buttons/CalendarFormActionInitializers.js +146 -0
- package/es/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.d.ts +1 -0
- package/es/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.js +35 -0
- package/es/schema-initializer/buttons/FormActionInitializers.d.ts +132 -0
- package/es/schema-initializer/buttons/FormActionInitializers.js +118 -0
- package/es/schema-initializer/buttons/RecordBlockInitializers.js +2 -1
- package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
- package/es/schema-initializer/buttons/TabPaneInitializers.js +13 -0
- package/es/schema-initializer/buttons/TableActionInitializers.d.ts +56 -2
- package/es/schema-initializer/buttons/TableActionInitializers.js +45 -0
- package/es/schema-initializer/buttons/index.d.ts +3 -0
- package/es/schema-initializer/buttons/index.js +3 -0
- package/es/schema-initializer/components/BulkEditField.d.ts +7 -0
- package/es/schema-initializer/components/BulkEditField.js +187 -0
- package/es/schema-initializer/components/index.d.ts +1 -0
- package/es/schema-initializer/components/index.js +2 -1
- package/es/schema-initializer/items/BlockInitializer.js +8 -8
- package/es/schema-initializer/items/BulkEditSubmitActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/BulkEditSubmitActionInitializer.js +24 -0
- package/es/schema-initializer/items/CreateFormBulkEditBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CreateFormBulkEditBlockInitializer.js +103 -0
- package/es/schema-initializer/items/CustomizeBulkEditActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CustomizeBulkEditActionInitializer.js +61 -0
- package/es/schema-initializer/items/DeleteEventActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/DeleteEventActionInitializer.js +27 -0
- package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +7 -7
- package/es/schema-initializer/items/index.d.ts +4 -0
- package/es/schema-initializer/items/index.js +4 -0
- package/es/schema-initializer/utils.d.ts +1 -0
- package/es/schema-initializer/utils.js +74 -15
- package/es/schema-settings/SchemaSettings.d.ts +6 -0
- package/es/schema-settings/SchemaSettings.js +4 -1
- package/es/schema-templates/BlockTemplatePage.d.ts +1 -0
- package/es/schema-templates/BlockTemplatePage.js +7 -0
- package/es/schema-templates/SchemaTemplateShortcut.js +1 -1
- package/es/system-settings/SystemSettingsShortcut.d.ts +2 -0
- package/es/system-settings/SystemSettingsShortcut.js +134 -5
- package/lib/acl/ACLShortcut.d.ts +2 -0
- package/lib/acl/ACLShortcut.js +41 -4
- package/lib/api-client/APIClient.d.ts +1 -0
- package/lib/api-client/APIClient.js +6 -1
- package/lib/application/Application.d.ts +3 -1
- package/lib/application/Application.js +139 -39
- package/lib/block-provider/BlockProvider.js +11 -0
- package/lib/block-provider/CalendarBlockProvider.d.ts +1 -0
- package/lib/block-provider/CalendarBlockProvider.js +6 -3
- package/lib/block-provider/TableSelectorProvider.js +21 -6
- package/lib/block-provider/hooks/index.d.ts +6 -0
- package/lib/block-provider/hooks/index.js +496 -115
- package/lib/collection-manager/CollectionManagerProvider.js +28 -47
- package/lib/collection-manager/CollectionManagerShortcut.d.ts +2 -0
- package/lib/collection-manager/CollectionManagerShortcut.js +47 -4
- package/lib/collection-manager/Configuration/AddFieldAction.d.ts +5 -1
- package/lib/collection-manager/Configuration/AddFieldAction.js +52 -12
- package/lib/collection-manager/Configuration/CollectionFieldsTable.d.ts +15 -0
- package/lib/collection-manager/Configuration/CollectionFieldsTable.js +92 -0
- package/lib/collection-manager/Configuration/CollectionFieldsTableArray.d.ts +8 -0
- package/lib/collection-manager/Configuration/CollectionFieldsTableArray.js +273 -0
- package/lib/collection-manager/Configuration/ConfigurationTable.js +7 -2
- package/lib/collection-manager/Configuration/EditFieldAction.d.ts +1 -0
- package/lib/collection-manager/Configuration/EditFieldAction.js +26 -10
- package/lib/collection-manager/Configuration/index.d.ts +3 -0
- package/lib/collection-manager/Configuration/index.js +39 -0
- package/lib/collection-manager/Configuration/schemas/collectionFields.js +4 -4
- package/lib/collection-manager/Configuration/schemas/collections.js +1 -1
- package/lib/collection-manager/index.d.ts +1 -0
- package/lib/collection-manager/index.js +14 -0
- package/lib/collection-manager/interfaces/index.d.ts +1 -0
- package/lib/collection-manager/interfaces/index.js +13 -0
- package/lib/collection-manager/interfaces/json.d.ts +2 -0
- package/lib/collection-manager/interfaces/json.js +58 -0
- package/lib/collection-manager/interfaces/m2o.js +2 -2
- package/lib/collection-manager/interfaces/o2m.js +4 -5
- package/lib/collection-manager/interfaces/o2o.js +4 -4
- package/lib/collection-manager/interfaces/properties/index.d.ts +14 -0
- package/lib/collection-manager/interfaces/properties/index.js +26 -2
- package/lib/collection-manager/interfaces/sequence.js +13 -9
- package/lib/index.d.ts +1 -0
- package/lib/index.js +13 -0
- package/lib/locale/en_US.d.ts +24 -1
- package/lib/locale/en_US.js +25 -2
- package/lib/locale/ja_JP.d.ts +2 -1
- package/lib/locale/ja_JP.js +2 -1
- package/lib/locale/ru_RU.d.ts +2 -1
- package/lib/locale/ru_RU.js +2 -1
- package/lib/locale/tr_TR.d.ts +1 -1
- package/lib/locale/tr_TR.js +1 -1
- package/lib/locale/zh_CN.d.ts +50 -1
- package/lib/locale/zh_CN.js +51 -2
- package/lib/plugin-manager/PluginManager.js +33 -21
- package/lib/pm/PluginManagerLink.d.ts +2 -0
- package/lib/pm/PluginManagerLink.js +139 -0
- package/lib/pm/index.d.ts +6 -0
- package/lib/pm/index.js +476 -0
- package/lib/route-switch/antd/admin-layout/index.js +1 -1
- package/lib/schema-component/antd/action/Action.Designer.js +35 -12
- package/lib/schema-component/antd/action/Action.Modal.js +4 -2
- package/lib/schema-component/antd/action/Action.js +3 -3
- package/lib/schema-component/antd/action/context.d.ts +2 -0
- package/lib/schema-component/antd/action/hooks.d.ts +1 -0
- package/lib/schema-component/antd/calendar/Calendar.Designer.js +19 -6
- package/lib/schema-component/antd/calendar/Calendar.js +139 -23
- package/lib/schema-component/antd/calendar/DeleteEvent.d.ts +3 -0
- package/lib/schema-component/antd/calendar/DeleteEvent.js +173 -0
- package/lib/schema-component/antd/calendar/Title.js +18 -2
- package/lib/schema-component/antd/calendar/components/Header.d.ts +10 -0
- package/lib/schema-component/antd/calendar/components/Header.js +57 -0
- package/lib/schema-component/antd/calendar/index.js +5 -0
- package/lib/schema-component/antd/calendar/style.less +53 -9
- package/lib/schema-component/antd/calendar/types.d.ts +6 -0
- package/lib/schema-component/antd/calendar/utils.d.ts +2 -0
- package/lib/schema-component/antd/calendar/utils.js +18 -2
- package/lib/schema-component/antd/checkbox/Checkbox.js +13 -4
- package/lib/schema-component/antd/formula-input/FormulaInput.js +28 -37
- package/lib/schema-component/antd/input/Input.d.ts +1 -0
- package/lib/schema-component/antd/input/Input.js +3 -0
- package/lib/schema-component/antd/input/Json.d.ts +6 -0
- package/lib/schema-component/antd/input/Json.js +53 -0
- package/lib/schema-component/antd/input/ReadPretty.d.ts +3 -0
- package/lib/schema-component/antd/input/ReadPretty.js +16 -0
- package/lib/schema-component/antd/input/index.d.ts +1 -0
- package/lib/schema-component/antd/input/index.js +13 -0
- package/lib/schema-component/antd/markdown/Markdown.Void.js +8 -2
- package/lib/schema-component/antd/radio/Radio.js +2 -1
- package/lib/schema-component/antd/select/ReadPretty.js +2 -1
- package/lib/schema-component/antd/select/Select.js +25 -1
- package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +17 -2
- package/lib/schema-component/antd/upload/Upload.js +2 -1
- package/lib/schema-component/antd/upload/shared.js +4 -5
- package/lib/schema-component/antd/upload/type.d.ts +2 -0
- package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.d.ts +1 -0
- package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.js +66 -0
- package/lib/schema-initializer/buttons/CalendarFormActionInitializers.d.ts +143 -0
- package/lib/schema-initializer/buttons/CalendarFormActionInitializers.js +153 -0
- package/lib/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.d.ts +1 -0
- package/lib/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.js +50 -0
- package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +132 -0
- package/lib/schema-initializer/buttons/FormActionInitializers.js +121 -2
- package/lib/schema-initializer/buttons/RecordBlockInitializers.js +2 -1
- package/lib/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
- package/lib/schema-initializer/buttons/TabPaneInitializers.js +18 -2
- package/lib/schema-initializer/buttons/TableActionInitializers.d.ts +56 -2
- package/lib/schema-initializer/buttons/TableActionInitializers.js +45 -0
- package/lib/schema-initializer/buttons/index.d.ts +3 -0
- package/lib/schema-initializer/buttons/index.js +39 -0
- package/lib/schema-initializer/components/BulkEditField.d.ts +7 -0
- package/lib/schema-initializer/components/BulkEditField.js +210 -0
- package/lib/schema-initializer/components/index.d.ts +1 -0
- package/lib/schema-initializer/components/index.js +13 -0
- package/lib/schema-initializer/items/BlockInitializer.js +8 -7
- package/lib/schema-initializer/items/BulkEditSubmitActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/BulkEditSubmitActionInitializer.js +37 -0
- package/lib/schema-initializer/items/CreateFormBulkEditBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CreateFormBulkEditBlockInitializer.js +121 -0
- package/lib/schema-initializer/items/CustomizeBulkEditActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CustomizeBulkEditActionInitializer.js +74 -0
- package/lib/schema-initializer/items/DeleteEventActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/DeleteEventActionInitializer.js +40 -0
- package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +1 -1
- package/lib/schema-initializer/items/index.d.ts +4 -0
- package/lib/schema-initializer/items/index.js +52 -0
- package/lib/schema-initializer/utils.d.ts +1 -0
- package/lib/schema-initializer/utils.js +78 -16
- package/lib/schema-settings/SchemaSettings.d.ts +6 -0
- package/lib/schema-settings/SchemaSettings.js +3 -0
- package/lib/schema-templates/BlockTemplatePage.d.ts +1 -0
- package/lib/schema-templates/BlockTemplatePage.js +12 -2
- package/lib/schema-templates/SchemaTemplateShortcut.js +1 -1
- package/lib/system-settings/SystemSettingsShortcut.d.ts +2 -0
- package/lib/system-settings/SystemSettingsShortcut.js +145 -7
- package/package.json +6 -4
|
@@ -13,15 +13,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
13
13
|
import { useField, useFieldSchema, useForm } from '@formily/react';
|
|
14
14
|
import { message, Modal } from 'antd';
|
|
15
15
|
import parse from 'json-templates';
|
|
16
|
+
import { cloneDeep } from 'lodash';
|
|
16
17
|
import get from 'lodash/get';
|
|
17
18
|
import { useTranslation } from 'react-i18next';
|
|
18
19
|
import { useHistory } from 'react-router-dom';
|
|
19
20
|
import { useReactToPrint } from 'react-to-print';
|
|
20
|
-
import { useFormBlockContext } from '../..';
|
|
21
|
+
import { useFormBlockContext, useTableBlockContext } from '../..';
|
|
21
22
|
import { useAPIClient } from '../../api-client';
|
|
22
23
|
import { useCollection } from '../../collection-manager';
|
|
23
24
|
import { useRecord } from '../../record-provider';
|
|
24
25
|
import { useActionContext, useCompile } from '../../schema-component';
|
|
26
|
+
import { BulkEditFormItemValueType } from '../../schema-initializer/components';
|
|
25
27
|
import { useCurrentUserContext } from '../../user';
|
|
26
28
|
import { useBlockRequestContext, useFilterByTk } from '../BlockProvider';
|
|
27
29
|
import { useDetailsBlockContext } from '../DetailsBlockProvider';
|
|
@@ -392,8 +394,376 @@ export var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProp
|
|
|
392
394
|
}
|
|
393
395
|
};
|
|
394
396
|
};
|
|
397
|
+
export var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionProps() {
|
|
398
|
+
var _tableBlockContext$fi, _tableBlockContext$fi2, _currentUserContext$d3;
|
|
399
|
+
|
|
400
|
+
var _useBlockRequestConte3 = useBlockRequestContext(),
|
|
401
|
+
field = _useBlockRequestConte3.field,
|
|
402
|
+
resource = _useBlockRequestConte3.resource,
|
|
403
|
+
__parent = _useBlockRequestConte3.__parent,
|
|
404
|
+
service = _useBlockRequestConte3.service;
|
|
405
|
+
|
|
406
|
+
var actionSchema = useFieldSchema();
|
|
407
|
+
var currentRecord = useRecord();
|
|
408
|
+
var tableBlockContext = useTableBlockContext();
|
|
409
|
+
var rowKey = tableBlockContext.rowKey;
|
|
410
|
+
|
|
411
|
+
var _ref3 = (_tableBlockContext$fi = (_tableBlockContext$fi2 = tableBlockContext.field) === null || _tableBlockContext$fi2 === void 0 ? void 0 : _tableBlockContext$fi2.data) !== null && _tableBlockContext$fi !== void 0 ? _tableBlockContext$fi : {},
|
|
412
|
+
selectedRowKeys = _ref3.selectedRowKeys;
|
|
413
|
+
|
|
414
|
+
var currentUserContext = useCurrentUserContext();
|
|
415
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d3 = currentUserContext.data) === null || _currentUserContext$d3 === void 0 ? void 0 : _currentUserContext$d3.data;
|
|
416
|
+
var history = useHistory();
|
|
417
|
+
var compile = useCompile();
|
|
418
|
+
|
|
419
|
+
var _useTranslation2 = useTranslation(),
|
|
420
|
+
t = _useTranslation2.t;
|
|
421
|
+
|
|
422
|
+
var actionField = useField();
|
|
423
|
+
return {
|
|
424
|
+
onClick: function onClick() {
|
|
425
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
|
|
426
|
+
var _actionSchema$xActio3;
|
|
427
|
+
|
|
428
|
+
var _ref4, _ref4$assignedValues, originalAssignedValues, onSuccess, updateMode, assignedValues;
|
|
429
|
+
|
|
430
|
+
return regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
431
|
+
while (1) {
|
|
432
|
+
switch (_context8.prev = _context8.next) {
|
|
433
|
+
case 0:
|
|
434
|
+
_ref4 = (_actionSchema$xActio3 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio3 !== void 0 ? _actionSchema$xActio3 : {}, _ref4$assignedValues = _ref4.assignedValues, originalAssignedValues = _ref4$assignedValues === void 0 ? {} : _ref4$assignedValues, onSuccess = _ref4.onSuccess, updateMode = _ref4.updateMode;
|
|
435
|
+
actionField.data = field.data || {};
|
|
436
|
+
actionField.data.loading = true;
|
|
437
|
+
assignedValues = parse(originalAssignedValues)({
|
|
438
|
+
currentTime: new Date(),
|
|
439
|
+
currentUser: currentUser
|
|
440
|
+
});
|
|
441
|
+
Modal.confirm({
|
|
442
|
+
title: t('Bulk update'),
|
|
443
|
+
content: updateMode === 'selected' ? t('Update selected data?') : t('Update all data?'),
|
|
444
|
+
onOk: function onOk() {
|
|
445
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
446
|
+
var _service$params$, _service$params, _service$refresh2;
|
|
447
|
+
|
|
448
|
+
var _ref5, filter, updateData, _parent$service3, _parent$service3$refr;
|
|
449
|
+
|
|
450
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
451
|
+
while (1) {
|
|
452
|
+
switch (_context6.prev = _context6.next) {
|
|
453
|
+
case 0:
|
|
454
|
+
_ref5 = (_service$params$ = (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params[0]) !== null && _service$params$ !== void 0 ? _service$params$ : {}, filter = _ref5.filter;
|
|
455
|
+
updateData = {
|
|
456
|
+
values: _objectSpread({}, assignedValues),
|
|
457
|
+
filter: filter,
|
|
458
|
+
forceUpdate: false
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
if (!(updateMode === 'selected')) {
|
|
462
|
+
_context6.next = 8;
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) {
|
|
467
|
+
_context6.next = 7;
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
message.error(t('Please select the records to be updated'));
|
|
472
|
+
actionField.data.loading = false;
|
|
473
|
+
return _context6.abrupt("return");
|
|
474
|
+
|
|
475
|
+
case 7:
|
|
476
|
+
updateData.filter = {
|
|
477
|
+
$and: [_defineProperty({}, rowKey || 'id', {
|
|
478
|
+
$in: selectedRowKeys
|
|
479
|
+
})]
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
case 8:
|
|
483
|
+
if (!updateData.filter) {
|
|
484
|
+
updateData.forceUpdate = true;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
_context6.prev = 9;
|
|
488
|
+
_context6.next = 12;
|
|
489
|
+
return resource.update(updateData);
|
|
490
|
+
|
|
491
|
+
case 12:
|
|
492
|
+
_context6.next = 16;
|
|
493
|
+
break;
|
|
494
|
+
|
|
495
|
+
case 14:
|
|
496
|
+
_context6.prev = 14;
|
|
497
|
+
_context6.t0 = _context6["catch"](9);
|
|
498
|
+
|
|
499
|
+
case 16:
|
|
500
|
+
_context6.prev = 16;
|
|
501
|
+
actionField.data.loading = false;
|
|
502
|
+
return _context6.finish(16);
|
|
503
|
+
|
|
504
|
+
case 19:
|
|
505
|
+
service === null || service === void 0 ? void 0 : (_service$refresh2 = service.refresh) === null || _service$refresh2 === void 0 ? void 0 : _service$refresh2.call(service);
|
|
506
|
+
|
|
507
|
+
if (!(resource instanceof TableFieldResource)) {
|
|
508
|
+
__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);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
512
|
+
_context6.next = 23;
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
return _context6.abrupt("return");
|
|
517
|
+
|
|
518
|
+
case 23:
|
|
519
|
+
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
520
|
+
Modal.success({
|
|
521
|
+
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
522
|
+
onOk: function () {
|
|
523
|
+
var _onOk3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
524
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
525
|
+
while (1) {
|
|
526
|
+
switch (_context5.prev = _context5.next) {
|
|
527
|
+
case 0:
|
|
528
|
+
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
529
|
+
if (isURL(onSuccess.redirectTo)) {
|
|
530
|
+
window.location.href = onSuccess.redirectTo;
|
|
531
|
+
} else {
|
|
532
|
+
history.push(onSuccess.redirectTo);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
case 1:
|
|
537
|
+
case "end":
|
|
538
|
+
return _context5.stop();
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}, _callee5);
|
|
542
|
+
}));
|
|
543
|
+
|
|
544
|
+
function onOk() {
|
|
545
|
+
return _onOk3.apply(this, arguments);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return onOk;
|
|
549
|
+
}()
|
|
550
|
+
});
|
|
551
|
+
} else {
|
|
552
|
+
message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
case 24:
|
|
556
|
+
case "end":
|
|
557
|
+
return _context6.stop();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}, _callee6, null, [[9, 14, 16, 19]]);
|
|
561
|
+
}))();
|
|
562
|
+
},
|
|
563
|
+
onCancel: function onCancel() {
|
|
564
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
|
|
565
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
566
|
+
while (1) {
|
|
567
|
+
switch (_context7.prev = _context7.next) {
|
|
568
|
+
case 0:
|
|
569
|
+
actionField.data.loading = false;
|
|
570
|
+
|
|
571
|
+
case 1:
|
|
572
|
+
case "end":
|
|
573
|
+
return _context7.stop();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}, _callee7);
|
|
577
|
+
}))();
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
case 5:
|
|
582
|
+
case "end":
|
|
583
|
+
return _context8.stop();
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}, _callee8);
|
|
587
|
+
}))();
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
export var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps() {
|
|
592
|
+
var _tableBlockContext$fi3, _tableBlockContext$fi4;
|
|
593
|
+
|
|
594
|
+
var form = useForm();
|
|
595
|
+
|
|
596
|
+
var _useTranslation3 = useTranslation(),
|
|
597
|
+
t = _useTranslation3.t;
|
|
598
|
+
|
|
599
|
+
var _useBlockRequestConte4 = useBlockRequestContext(),
|
|
600
|
+
field = _useBlockRequestConte4.field,
|
|
601
|
+
resource = _useBlockRequestConte4.resource,
|
|
602
|
+
__parent = _useBlockRequestConte4.__parent;
|
|
603
|
+
|
|
604
|
+
var actionContext = useActionContext();
|
|
605
|
+
var history = useHistory();
|
|
606
|
+
var compile = useCompile();
|
|
607
|
+
var actionField = useField();
|
|
608
|
+
var tableBlockContext = useTableBlockContext();
|
|
609
|
+
var rowKey = tableBlockContext.rowKey;
|
|
610
|
+
|
|
611
|
+
var _ref7 = (_tableBlockContext$fi3 = (_tableBlockContext$fi4 = tableBlockContext.field) === null || _tableBlockContext$fi4 === void 0 ? void 0 : _tableBlockContext$fi4.data) !== null && _tableBlockContext$fi3 !== void 0 ? _tableBlockContext$fi3 : {},
|
|
612
|
+
selectedRowKeys = _ref7.selectedRowKeys;
|
|
613
|
+
|
|
614
|
+
var setVisible = actionContext.setVisible,
|
|
615
|
+
actionSchema = actionContext.fieldSchema;
|
|
616
|
+
return {
|
|
617
|
+
onClick: function onClick() {
|
|
618
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
|
|
619
|
+
var _actionSchema$xActio4, _parent$service$para, _parent$service$para2;
|
|
620
|
+
|
|
621
|
+
var _ref8, onSuccess, skipValidator, updateMode, _ref9, filter, values, key, value, _parent$service4, _parent$service4$refr, updateData, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
|
|
622
|
+
|
|
623
|
+
return regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
624
|
+
while (1) {
|
|
625
|
+
switch (_context10.prev = _context10.next) {
|
|
626
|
+
case 0:
|
|
627
|
+
_ref8 = (_actionSchema$xActio4 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio4 !== void 0 ? _actionSchema$xActio4 : {}, onSuccess = _ref8.onSuccess, skipValidator = _ref8.skipValidator, updateMode = _ref8.updateMode;
|
|
628
|
+
_ref9 = (_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 = _ref9.filter;
|
|
629
|
+
|
|
630
|
+
if (skipValidator) {
|
|
631
|
+
_context10.next = 5;
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
_context10.next = 5;
|
|
636
|
+
return form.submit();
|
|
637
|
+
|
|
638
|
+
case 5:
|
|
639
|
+
values = cloneDeep(form.values);
|
|
640
|
+
actionField.data = field.data || {};
|
|
641
|
+
actionField.data.loading = true;
|
|
642
|
+
|
|
643
|
+
for (key in values) {
|
|
644
|
+
if (Object.prototype.hasOwnProperty.call(values, key)) {
|
|
645
|
+
value = values[key];
|
|
646
|
+
|
|
647
|
+
if (BulkEditFormItemValueType.Clear in value) {
|
|
648
|
+
values[key] = null;
|
|
649
|
+
} else if (BulkEditFormItemValueType.ChangedTo in value) {
|
|
650
|
+
values[key] = value[BulkEditFormItemValueType.ChangedTo];
|
|
651
|
+
} else if (BulkEditFormItemValueType.RemainsTheSame in value) {
|
|
652
|
+
delete values[key];
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
_context10.prev = 9;
|
|
658
|
+
updateData = {
|
|
659
|
+
values: values,
|
|
660
|
+
filter: filter,
|
|
661
|
+
forceUpdate: false
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
if (!(updateMode === 'selected')) {
|
|
665
|
+
_context10.next = 16;
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
if (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) {
|
|
670
|
+
_context10.next = 15;
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
message.error(t('Please select the records to be updated'));
|
|
675
|
+
return _context10.abrupt("return");
|
|
676
|
+
|
|
677
|
+
case 15:
|
|
678
|
+
updateData.filter = {
|
|
679
|
+
$and: [_defineProperty({}, rowKey || 'id', {
|
|
680
|
+
$in: selectedRowKeys
|
|
681
|
+
})]
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
case 16:
|
|
685
|
+
if (!updateData.filter) {
|
|
686
|
+
updateData.forceUpdate = true;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
_context10.next = 19;
|
|
690
|
+
return resource.update(updateData);
|
|
691
|
+
|
|
692
|
+
case 19:
|
|
693
|
+
actionField.data.loading = false;
|
|
694
|
+
|
|
695
|
+
if (!(resource instanceof TableFieldResource)) {
|
|
696
|
+
__parent === null || __parent === void 0 ? void 0 : (_parent$__parent = __parent.__parent) === null || _parent$__parent === void 0 ? void 0 : (_parent$__parent$serv = _parent$__parent.service) === null || _parent$__parent$serv === void 0 ? void 0 : (_parent$__parent$serv2 = _parent$__parent$serv.refresh) === null || _parent$__parent$serv2 === void 0 ? void 0 : _parent$__parent$serv2.call(_parent$__parent$serv);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
__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);
|
|
700
|
+
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
701
|
+
|
|
702
|
+
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
703
|
+
_context10.next = 25;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
return _context10.abrupt("return");
|
|
708
|
+
|
|
709
|
+
case 25:
|
|
710
|
+
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
711
|
+
Modal.success({
|
|
712
|
+
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
713
|
+
onOk: function () {
|
|
714
|
+
var _onOk4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
|
|
715
|
+
return regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
716
|
+
while (1) {
|
|
717
|
+
switch (_context9.prev = _context9.next) {
|
|
718
|
+
case 0:
|
|
719
|
+
_context9.next = 2;
|
|
720
|
+
return form.reset();
|
|
721
|
+
|
|
722
|
+
case 2:
|
|
723
|
+
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
724
|
+
if (isURL(onSuccess.redirectTo)) {
|
|
725
|
+
window.location.href = onSuccess.redirectTo;
|
|
726
|
+
} else {
|
|
727
|
+
history.push(onSuccess.redirectTo);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
case 3:
|
|
732
|
+
case "end":
|
|
733
|
+
return _context9.stop();
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}, _callee9);
|
|
737
|
+
}));
|
|
738
|
+
|
|
739
|
+
function onOk() {
|
|
740
|
+
return _onOk4.apply(this, arguments);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
return onOk;
|
|
744
|
+
}()
|
|
745
|
+
});
|
|
746
|
+
} else {
|
|
747
|
+
message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
case 26:
|
|
751
|
+
_context10.prev = 26;
|
|
752
|
+
actionField.data.loading = false;
|
|
753
|
+
return _context10.finish(26);
|
|
754
|
+
|
|
755
|
+
case 29:
|
|
756
|
+
case "end":
|
|
757
|
+
return _context10.stop();
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}, _callee10, null, [[9,, 26, 29]]);
|
|
761
|
+
}))();
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
};
|
|
395
765
|
export var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
396
|
-
var _currentUserContext$
|
|
766
|
+
var _currentUserContext$d4;
|
|
397
767
|
|
|
398
768
|
var apiClient = useAPIClient();
|
|
399
769
|
var history = useHistory();
|
|
@@ -406,15 +776,15 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
406
776
|
fields = _useCollection2.fields,
|
|
407
777
|
getField = _useCollection2.getField;
|
|
408
778
|
|
|
409
|
-
var
|
|
410
|
-
field =
|
|
411
|
-
resource =
|
|
412
|
-
__parent =
|
|
413
|
-
service =
|
|
779
|
+
var _useBlockRequestConte5 = useBlockRequestContext(),
|
|
780
|
+
field = _useBlockRequestConte5.field,
|
|
781
|
+
resource = _useBlockRequestConte5.resource,
|
|
782
|
+
__parent = _useBlockRequestConte5.__parent,
|
|
783
|
+
service = _useBlockRequestConte5.service;
|
|
414
784
|
|
|
415
785
|
var currentRecord = useRecord();
|
|
416
786
|
var currentUserContext = useCurrentUserContext();
|
|
417
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
787
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d4 = currentUserContext.data) === null || _currentUserContext$d4 === void 0 ? void 0 : _currentUserContext$d4.data;
|
|
418
788
|
var actionField = useField();
|
|
419
789
|
|
|
420
790
|
var _useActionContext2 = useActionContext(),
|
|
@@ -423,32 +793,32 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
423
793
|
|
|
424
794
|
return {
|
|
425
795
|
onClick: function onClick() {
|
|
426
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
427
|
-
var _actionSchema$
|
|
796
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
|
|
797
|
+
var _actionSchema$xActio5;
|
|
428
798
|
|
|
429
|
-
var
|
|
799
|
+
var _ref11, skipValidator, onSuccess, requestSettings, xAction, headers, params, data, methods, fieldNames, values, requestBody, _service$refresh3, _parent$service5, _parent$service5$refr;
|
|
430
800
|
|
|
431
|
-
return regeneratorRuntime.wrap(function
|
|
801
|
+
return regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
432
802
|
while (1) {
|
|
433
|
-
switch (
|
|
803
|
+
switch (_context12.prev = _context12.next) {
|
|
434
804
|
case 0:
|
|
435
|
-
|
|
805
|
+
_ref11 = (_actionSchema$xActio5 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio5 !== void 0 ? _actionSchema$xActio5 : {}, skipValidator = _ref11.skipValidator, onSuccess = _ref11.onSuccess, requestSettings = _ref11.requestSettings;
|
|
436
806
|
xAction = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action'];
|
|
437
807
|
|
|
438
808
|
if (requestSettings['url']) {
|
|
439
|
-
|
|
809
|
+
_context12.next = 4;
|
|
440
810
|
break;
|
|
441
811
|
}
|
|
442
812
|
|
|
443
|
-
return
|
|
813
|
+
return _context12.abrupt("return");
|
|
444
814
|
|
|
445
815
|
case 4:
|
|
446
816
|
if (!(skipValidator !== true && xAction === 'customize:form:request')) {
|
|
447
|
-
|
|
817
|
+
_context12.next = 7;
|
|
448
818
|
break;
|
|
449
819
|
}
|
|
450
820
|
|
|
451
|
-
|
|
821
|
+
_context12.next = 7;
|
|
452
822
|
return form.submit();
|
|
453
823
|
|
|
454
824
|
case 7:
|
|
@@ -486,39 +856,39 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
486
856
|
};
|
|
487
857
|
actionField.data = field.data || {};
|
|
488
858
|
actionField.data.loading = true;
|
|
489
|
-
|
|
490
|
-
|
|
859
|
+
_context12.prev = 15;
|
|
860
|
+
_context12.next = 18;
|
|
491
861
|
return apiClient.request(_objectSpread({}, requestBody));
|
|
492
862
|
|
|
493
863
|
case 18:
|
|
494
864
|
actionField.data.loading = false;
|
|
495
865
|
|
|
496
866
|
if (!(resource instanceof TableFieldResource)) {
|
|
497
|
-
__parent === null || __parent === void 0 ? void 0 : (_parent$
|
|
867
|
+
__parent === null || __parent === void 0 ? void 0 : (_parent$service5 = __parent.service) === null || _parent$service5 === void 0 ? void 0 : (_parent$service5$refr = _parent$service5.refresh) === null || _parent$service5$refr === void 0 ? void 0 : _parent$service5$refr.call(_parent$service5);
|
|
498
868
|
}
|
|
499
869
|
|
|
500
|
-
service === null || service === void 0 ? void 0 : (_service$
|
|
870
|
+
service === null || service === void 0 ? void 0 : (_service$refresh3 = service.refresh) === null || _service$refresh3 === void 0 ? void 0 : _service$refresh3.call(service);
|
|
501
871
|
|
|
502
872
|
if (xAction === 'customize:form:request') {
|
|
503
873
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
504
874
|
}
|
|
505
875
|
|
|
506
876
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
507
|
-
|
|
877
|
+
_context12.next = 24;
|
|
508
878
|
break;
|
|
509
879
|
}
|
|
510
880
|
|
|
511
|
-
return
|
|
881
|
+
return _context12.abrupt("return");
|
|
512
882
|
|
|
513
883
|
case 24:
|
|
514
884
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
515
885
|
Modal.success({
|
|
516
886
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
517
887
|
onOk: function () {
|
|
518
|
-
var
|
|
519
|
-
return regeneratorRuntime.wrap(function
|
|
888
|
+
var _onOk5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
|
|
889
|
+
return regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
520
890
|
while (1) {
|
|
521
|
-
switch (
|
|
891
|
+
switch (_context11.prev = _context11.next) {
|
|
522
892
|
case 0:
|
|
523
893
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
524
894
|
if (isURL(onSuccess.redirectTo)) {
|
|
@@ -530,14 +900,14 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
530
900
|
|
|
531
901
|
case 1:
|
|
532
902
|
case "end":
|
|
533
|
-
return
|
|
903
|
+
return _context11.stop();
|
|
534
904
|
}
|
|
535
905
|
}
|
|
536
|
-
},
|
|
906
|
+
}, _callee11);
|
|
537
907
|
}));
|
|
538
908
|
|
|
539
909
|
function onOk() {
|
|
540
|
-
return
|
|
910
|
+
return _onOk5.apply(this, arguments);
|
|
541
911
|
}
|
|
542
912
|
|
|
543
913
|
return onOk;
|
|
@@ -548,30 +918,30 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
548
918
|
}
|
|
549
919
|
|
|
550
920
|
case 25:
|
|
551
|
-
|
|
921
|
+
_context12.prev = 25;
|
|
552
922
|
actionField.data.loading = false;
|
|
553
|
-
return
|
|
923
|
+
return _context12.finish(25);
|
|
554
924
|
|
|
555
925
|
case 28:
|
|
556
926
|
case "end":
|
|
557
|
-
return
|
|
927
|
+
return _context12.stop();
|
|
558
928
|
}
|
|
559
929
|
}
|
|
560
|
-
},
|
|
930
|
+
}, _callee12, null, [[15,, 25, 28]]);
|
|
561
931
|
}))();
|
|
562
932
|
}
|
|
563
933
|
};
|
|
564
934
|
};
|
|
565
935
|
export var useUpdateActionProps = function useUpdateActionProps() {
|
|
566
|
-
var _currentUserContext$
|
|
936
|
+
var _currentUserContext$d5;
|
|
567
937
|
|
|
568
938
|
var form = useForm();
|
|
569
939
|
var filterByTk = useFilterByTk();
|
|
570
940
|
|
|
571
|
-
var
|
|
572
|
-
field =
|
|
573
|
-
resource =
|
|
574
|
-
__parent =
|
|
941
|
+
var _useBlockRequestConte6 = useBlockRequestContext(),
|
|
942
|
+
field = _useBlockRequestConte6.field,
|
|
943
|
+
resource = _useBlockRequestConte6.resource,
|
|
944
|
+
__parent = _useBlockRequestConte6.__parent;
|
|
575
945
|
|
|
576
946
|
var _useActionContext3 = useActionContext(),
|
|
577
947
|
setVisible = _useActionContext3.setVisible;
|
|
@@ -591,19 +961,19 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
591
961
|
|
|
592
962
|
var currentRecord = useRecord();
|
|
593
963
|
var currentUserContext = useCurrentUserContext();
|
|
594
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
964
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d5 = currentUserContext.data) === null || _currentUserContext$d5 === void 0 ? void 0 : _currentUserContext$d5.data;
|
|
595
965
|
return {
|
|
596
966
|
onClick: function onClick() {
|
|
597
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
598
|
-
var _actionSchema$
|
|
967
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() {
|
|
968
|
+
var _actionSchema$xActio6;
|
|
599
969
|
|
|
600
|
-
var
|
|
970
|
+
var _ref12, _ref12$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, fieldNames, values, _parent$service6, _parent$service6$refr, _parent$__parent2, _parent$__parent2$ser, _parent$__parent2$ser2;
|
|
601
971
|
|
|
602
|
-
return regeneratorRuntime.wrap(function
|
|
972
|
+
return regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
603
973
|
while (1) {
|
|
604
|
-
switch (
|
|
974
|
+
switch (_context14.prev = _context14.next) {
|
|
605
975
|
case 0:
|
|
606
|
-
|
|
976
|
+
_ref12 = (_actionSchema$xActio6 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio6 !== void 0 ? _actionSchema$xActio6 : {}, _ref12$assignedValues = _ref12.assignedValues, originalAssignedValues = _ref12$assignedValues === void 0 ? {} : _ref12$assignedValues, onSuccess = _ref12.onSuccess, overwriteValues = _ref12.overwriteValues, skipValidator = _ref12.skipValidator;
|
|
607
977
|
assignedValues = parse(originalAssignedValues)({
|
|
608
978
|
currentTime: new Date(),
|
|
609
979
|
currentRecord: currentRecord,
|
|
@@ -611,11 +981,11 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
611
981
|
});
|
|
612
982
|
|
|
613
983
|
if (skipValidator) {
|
|
614
|
-
|
|
984
|
+
_context14.next = 5;
|
|
615
985
|
break;
|
|
616
986
|
}
|
|
617
987
|
|
|
618
|
-
|
|
988
|
+
_context14.next = 5;
|
|
619
989
|
return form.submit();
|
|
620
990
|
|
|
621
991
|
case 5:
|
|
@@ -625,8 +995,8 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
625
995
|
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
626
996
|
actionField.data = field.data || {};
|
|
627
997
|
actionField.data.loading = true;
|
|
628
|
-
|
|
629
|
-
|
|
998
|
+
_context14.prev = 9;
|
|
999
|
+
_context14.next = 12;
|
|
630
1000
|
return resource.update({
|
|
631
1001
|
filterByTk: filterByTk,
|
|
632
1002
|
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues),
|
|
@@ -637,30 +1007,30 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
637
1007
|
actionField.data.loading = false;
|
|
638
1008
|
|
|
639
1009
|
if (!(resource instanceof TableFieldResource)) {
|
|
640
|
-
__parent === null || __parent === void 0 ? void 0 : (_parent$
|
|
1010
|
+
__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);
|
|
641
1011
|
}
|
|
642
1012
|
|
|
643
|
-
__parent === null || __parent === void 0 ? void 0 : (_parent$
|
|
1013
|
+
__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);
|
|
644
1014
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
645
1015
|
|
|
646
1016
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
647
|
-
|
|
1017
|
+
_context14.next = 18;
|
|
648
1018
|
break;
|
|
649
1019
|
}
|
|
650
1020
|
|
|
651
|
-
return
|
|
1021
|
+
return _context14.abrupt("return");
|
|
652
1022
|
|
|
653
1023
|
case 18:
|
|
654
1024
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
655
1025
|
Modal.success({
|
|
656
1026
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
657
1027
|
onOk: function () {
|
|
658
|
-
var
|
|
659
|
-
return regeneratorRuntime.wrap(function
|
|
1028
|
+
var _onOk6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
|
|
1029
|
+
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
660
1030
|
while (1) {
|
|
661
|
-
switch (
|
|
1031
|
+
switch (_context13.prev = _context13.next) {
|
|
662
1032
|
case 0:
|
|
663
|
-
|
|
1033
|
+
_context13.next = 2;
|
|
664
1034
|
return form.reset();
|
|
665
1035
|
|
|
666
1036
|
case 2:
|
|
@@ -674,14 +1044,14 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
674
1044
|
|
|
675
1045
|
case 3:
|
|
676
1046
|
case "end":
|
|
677
|
-
return
|
|
1047
|
+
return _context13.stop();
|
|
678
1048
|
}
|
|
679
1049
|
}
|
|
680
|
-
},
|
|
1050
|
+
}, _callee13);
|
|
681
1051
|
}));
|
|
682
1052
|
|
|
683
1053
|
function onOk() {
|
|
684
|
-
return
|
|
1054
|
+
return _onOk6.apply(this, arguments);
|
|
685
1055
|
}
|
|
686
1056
|
|
|
687
1057
|
return onOk;
|
|
@@ -691,20 +1061,20 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
691
1061
|
message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
692
1062
|
}
|
|
693
1063
|
|
|
694
|
-
|
|
1064
|
+
_context14.next = 24;
|
|
695
1065
|
break;
|
|
696
1066
|
|
|
697
1067
|
case 21:
|
|
698
|
-
|
|
699
|
-
|
|
1068
|
+
_context14.prev = 21;
|
|
1069
|
+
_context14.t0 = _context14["catch"](9);
|
|
700
1070
|
actionField.data.loading = false;
|
|
701
1071
|
|
|
702
1072
|
case 24:
|
|
703
1073
|
case "end":
|
|
704
|
-
return
|
|
1074
|
+
return _context14.stop();
|
|
705
1075
|
}
|
|
706
1076
|
}
|
|
707
|
-
},
|
|
1077
|
+
}, _callee14, null, [[9, 21]]);
|
|
708
1078
|
}))();
|
|
709
1079
|
}
|
|
710
1080
|
};
|
|
@@ -712,45 +1082,45 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
712
1082
|
export var useDestroyActionProps = function useDestroyActionProps() {
|
|
713
1083
|
var filterByTk = useFilterByTk();
|
|
714
1084
|
|
|
715
|
-
var
|
|
716
|
-
resource =
|
|
717
|
-
service =
|
|
718
|
-
block =
|
|
719
|
-
__parent =
|
|
1085
|
+
var _useBlockRequestConte7 = useBlockRequestContext(),
|
|
1086
|
+
resource = _useBlockRequestConte7.resource,
|
|
1087
|
+
service = _useBlockRequestConte7.service,
|
|
1088
|
+
block = _useBlockRequestConte7.block,
|
|
1089
|
+
__parent = _useBlockRequestConte7.__parent;
|
|
720
1090
|
|
|
721
1091
|
var _useActionContext4 = useActionContext(),
|
|
722
1092
|
setVisible = _useActionContext4.setVisible;
|
|
723
1093
|
|
|
724
1094
|
return {
|
|
725
1095
|
onClick: function onClick() {
|
|
726
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
727
|
-
var _service$
|
|
1096
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15() {
|
|
1097
|
+
var _service$refresh4;
|
|
728
1098
|
|
|
729
|
-
var _parent$
|
|
1099
|
+
var _parent$service7, _parent$service7$refr;
|
|
730
1100
|
|
|
731
|
-
return regeneratorRuntime.wrap(function
|
|
1101
|
+
return regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
732
1102
|
while (1) {
|
|
733
|
-
switch (
|
|
1103
|
+
switch (_context15.prev = _context15.next) {
|
|
734
1104
|
case 0:
|
|
735
|
-
|
|
1105
|
+
_context15.next = 2;
|
|
736
1106
|
return resource.destroy({
|
|
737
1107
|
filterByTk: filterByTk
|
|
738
1108
|
});
|
|
739
1109
|
|
|
740
1110
|
case 2:
|
|
741
|
-
service === null || service === void 0 ? void 0 : (_service$
|
|
1111
|
+
service === null || service === void 0 ? void 0 : (_service$refresh4 = service.refresh) === null || _service$refresh4 === void 0 ? void 0 : _service$refresh4.call(service);
|
|
742
1112
|
|
|
743
1113
|
if (block !== 'TableField') {
|
|
744
|
-
__parent === null || __parent === void 0 ? void 0 : (_parent$
|
|
1114
|
+
__parent === null || __parent === void 0 ? void 0 : (_parent$service7 = __parent.service) === null || _parent$service7 === void 0 ? void 0 : (_parent$service7$refr = _parent$service7.refresh) === null || _parent$service7$refr === void 0 ? void 0 : _parent$service7$refr.call(_parent$service7);
|
|
745
1115
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
746
1116
|
}
|
|
747
1117
|
|
|
748
1118
|
case 4:
|
|
749
1119
|
case "end":
|
|
750
|
-
return
|
|
1120
|
+
return _context15.stop();
|
|
751
1121
|
}
|
|
752
1122
|
}
|
|
753
|
-
},
|
|
1123
|
+
}, _callee15);
|
|
754
1124
|
}))();
|
|
755
1125
|
}
|
|
756
1126
|
};
|
|
@@ -767,88 +1137,88 @@ export var useDetailPrintActionProps = function useDetailPrintActionProps() {
|
|
|
767
1137
|
});
|
|
768
1138
|
return {
|
|
769
1139
|
onClick: function onClick() {
|
|
770
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
771
|
-
return regeneratorRuntime.wrap(function
|
|
1140
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16() {
|
|
1141
|
+
return regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
772
1142
|
while (1) {
|
|
773
|
-
switch (
|
|
1143
|
+
switch (_context16.prev = _context16.next) {
|
|
774
1144
|
case 0:
|
|
775
1145
|
printHandler();
|
|
776
1146
|
|
|
777
1147
|
case 1:
|
|
778
1148
|
case "end":
|
|
779
|
-
return
|
|
1149
|
+
return _context16.stop();
|
|
780
1150
|
}
|
|
781
1151
|
}
|
|
782
|
-
},
|
|
1152
|
+
}, _callee16);
|
|
783
1153
|
}))();
|
|
784
1154
|
}
|
|
785
1155
|
};
|
|
786
1156
|
};
|
|
787
1157
|
export var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
788
|
-
var
|
|
789
|
-
field =
|
|
1158
|
+
var _useBlockRequestConte8 = useBlockRequestContext(),
|
|
1159
|
+
field = _useBlockRequestConte8.field;
|
|
790
1160
|
|
|
791
|
-
var
|
|
792
|
-
resource =
|
|
793
|
-
service =
|
|
1161
|
+
var _useBlockRequestConte9 = useBlockRequestContext(),
|
|
1162
|
+
resource = _useBlockRequestConte9.resource,
|
|
1163
|
+
service = _useBlockRequestConte9.service;
|
|
794
1164
|
|
|
795
1165
|
return {
|
|
796
1166
|
onClick: function onClick() {
|
|
797
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
798
|
-
var _field$data, _field$data$selectedR, _field$data2, _service$
|
|
1167
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17() {
|
|
1168
|
+
var _field$data, _field$data$selectedR, _field$data2, _service$refresh5;
|
|
799
1169
|
|
|
800
|
-
return regeneratorRuntime.wrap(function
|
|
1170
|
+
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
801
1171
|
while (1) {
|
|
802
|
-
switch (
|
|
1172
|
+
switch (_context17.prev = _context17.next) {
|
|
803
1173
|
case 0:
|
|
804
1174
|
if (field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : (_field$data$selectedR = _field$data.selectedRowKeys) === null || _field$data$selectedR === void 0 ? void 0 : _field$data$selectedR.length) {
|
|
805
|
-
|
|
1175
|
+
_context17.next = 2;
|
|
806
1176
|
break;
|
|
807
1177
|
}
|
|
808
1178
|
|
|
809
|
-
return
|
|
1179
|
+
return _context17.abrupt("return");
|
|
810
1180
|
|
|
811
1181
|
case 2:
|
|
812
|
-
|
|
1182
|
+
_context17.next = 4;
|
|
813
1183
|
return resource.destroy({
|
|
814
1184
|
filterByTk: (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : _field$data2.selectedRowKeys
|
|
815
1185
|
});
|
|
816
1186
|
|
|
817
1187
|
case 4:
|
|
818
1188
|
field.data.selectedRowKeys = [];
|
|
819
|
-
service === null || service === void 0 ? void 0 : (_service$
|
|
1189
|
+
service === null || service === void 0 ? void 0 : (_service$refresh5 = service.refresh) === null || _service$refresh5 === void 0 ? void 0 : _service$refresh5.call(service);
|
|
820
1190
|
|
|
821
1191
|
case 6:
|
|
822
1192
|
case "end":
|
|
823
|
-
return
|
|
1193
|
+
return _context17.stop();
|
|
824
1194
|
}
|
|
825
1195
|
}
|
|
826
|
-
},
|
|
1196
|
+
}, _callee17);
|
|
827
1197
|
}))();
|
|
828
1198
|
}
|
|
829
1199
|
};
|
|
830
1200
|
};
|
|
831
1201
|
export var useRefreshActionProps = function useRefreshActionProps() {
|
|
832
|
-
var
|
|
833
|
-
service =
|
|
1202
|
+
var _useBlockRequestConte10 = useBlockRequestContext(),
|
|
1203
|
+
service = _useBlockRequestConte10.service;
|
|
834
1204
|
|
|
835
1205
|
return {
|
|
836
1206
|
onClick: function onClick() {
|
|
837
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
838
|
-
var _service$
|
|
1207
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18() {
|
|
1208
|
+
var _service$refresh6;
|
|
839
1209
|
|
|
840
|
-
return regeneratorRuntime.wrap(function
|
|
1210
|
+
return regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
841
1211
|
while (1) {
|
|
842
|
-
switch (
|
|
1212
|
+
switch (_context18.prev = _context18.next) {
|
|
843
1213
|
case 0:
|
|
844
|
-
service === null || service === void 0 ? void 0 : (_service$
|
|
1214
|
+
service === null || service === void 0 ? void 0 : (_service$refresh6 = service.refresh) === null || _service$refresh6 === void 0 ? void 0 : _service$refresh6.call(service);
|
|
845
1215
|
|
|
846
1216
|
case 1:
|
|
847
1217
|
case "end":
|
|
848
|
-
return
|
|
1218
|
+
return _context18.stop();
|
|
849
1219
|
}
|
|
850
1220
|
}
|
|
851
|
-
},
|
|
1221
|
+
}, _callee18);
|
|
852
1222
|
}))();
|
|
853
1223
|
}
|
|
854
1224
|
};
|
|
@@ -865,13 +1235,13 @@ export var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
865
1235
|
total: count,
|
|
866
1236
|
pageSize: 1,
|
|
867
1237
|
onChange: function onChange(page) {
|
|
868
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
1238
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19() {
|
|
869
1239
|
var _ctx$service3, _ctx$service3$params;
|
|
870
1240
|
|
|
871
1241
|
var params;
|
|
872
|
-
return regeneratorRuntime.wrap(function
|
|
1242
|
+
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
873
1243
|
while (1) {
|
|
874
|
-
switch (
|
|
1244
|
+
switch (_context19.prev = _context19.next) {
|
|
875
1245
|
case 0:
|
|
876
1246
|
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];
|
|
877
1247
|
ctx.service.run(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -880,10 +1250,10 @@ export var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
880
1250
|
|
|
881
1251
|
case 2:
|
|
882
1252
|
case "end":
|
|
883
|
-
return
|
|
1253
|
+
return _context19.stop();
|
|
884
1254
|
}
|
|
885
1255
|
}
|
|
886
|
-
},
|
|
1256
|
+
}, _callee19);
|
|
887
1257
|
}))();
|
|
888
1258
|
},
|
|
889
1259
|
style: {
|