@nocobase/client 0.7.7-alpha.1 → 0.8.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/acl/ACLShortcut.d.ts +2 -0
- package/es/acl/ACLShortcut.js +31 -2
- package/es/application/Application.d.ts +3 -1
- package/es/application/Application.js +131 -39
- 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 +44 -13
- 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 +2 -0
- package/es/collection-manager/Configuration/index.js +2 -0
- package/es/collection-manager/Configuration/schemas/collectionFields.js +2 -2
- 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 +23 -0
- 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 +13 -1
- package/es/locale/en_US.js +14 -2
- package/es/locale/ja_JP.d.ts +1 -1
- package/es/locale/ja_JP.js +1 -1
- package/es/locale/ru_RU.d.ts +1 -1
- package/es/locale/ru_RU.js +1 -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 +39 -1
- package/es/locale/zh_CN.js +40 -2
- package/es/plugin-manager/PluginManager.js +35 -23
- package/es/pm/PluginManagerLink.d.ts +2 -0
- package/es/pm/PluginManagerLink.js +111 -0
- package/es/pm/index.d.ts +4 -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 +23 -2
- 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/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/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/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/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 +2 -0
- package/es/schema-initializer/buttons/index.js +2 -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/index.d.ts +3 -0
- package/es/schema-initializer/items/index.js +3 -0
- package/es/schema-initializer/utils.d.ts +1 -0
- package/es/schema-initializer/utils.js +67 -12
- 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/application/Application.d.ts +3 -1
- package/lib/application/Application.js +139 -39
- 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 +48 -12
- 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 +2 -0
- package/lib/collection-manager/Configuration/index.js +26 -0
- package/lib/collection-manager/Configuration/schemas/collectionFields.js +2 -2
- 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 +25 -1
- 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 +13 -1
- package/lib/locale/en_US.js +14 -2
- package/lib/locale/ja_JP.d.ts +1 -1
- package/lib/locale/ja_JP.js +1 -1
- package/lib/locale/ru_RU.d.ts +1 -1
- package/lib/locale/ru_RU.js +1 -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 +39 -1
- package/lib/locale/zh_CN.js +40 -2
- package/lib/plugin-manager/PluginManager.js +33 -21
- package/lib/pm/PluginManagerLink.d.ts +2 -0
- package/lib/pm/PluginManagerLink.js +138 -0
- package/lib/pm/index.d.ts +4 -0
- package/lib/pm/index.js +474 -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 +24 -2
- 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/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/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/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/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 +2 -0
- package/lib/schema-initializer/buttons/index.js +26 -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/index.d.ts +3 -0
- package/lib/schema-initializer/items/index.js +39 -0
- package/lib/schema-initializer/utils.d.ts +1 -0
- package/lib/schema-initializer/utils.js +71 -13
- 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 +5 -4
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
+
|
|
17
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
|
|
19
|
+
import { connect, useField, useFieldSchema } from '@formily/react';
|
|
20
|
+
import { merge, uid } from '@formily/shared';
|
|
21
|
+
import { Checkbox, Select, Space } from 'antd';
|
|
22
|
+
import React, { useEffect, useState } from 'react';
|
|
23
|
+
import { useTranslation } from 'react-i18next';
|
|
24
|
+
import { useFormBlockContext } from '../../block-provider';
|
|
25
|
+
import { CollectionFieldProvider, useCollection, useCollectionField } from '../../collection-manager';
|
|
26
|
+
import { useCompile, useComponent } from '../../schema-component';
|
|
27
|
+
|
|
28
|
+
var InternalField = function InternalField(props) {
|
|
29
|
+
var field = useField();
|
|
30
|
+
var fieldSchema = useFieldSchema();
|
|
31
|
+
|
|
32
|
+
var _useCollectionField = useCollectionField(),
|
|
33
|
+
name = _useCollectionField.name,
|
|
34
|
+
interfaceType = _useCollectionField.interface,
|
|
35
|
+
uiSchema = _useCollectionField.uiSchema;
|
|
36
|
+
|
|
37
|
+
var component = useComponent(uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['x-component']);
|
|
38
|
+
var compile = useCompile();
|
|
39
|
+
|
|
40
|
+
var setFieldProps = function setFieldProps(key, value) {
|
|
41
|
+
field[key] = typeof field[key] === 'undefined' ? value : field[key];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var setRequired = function setRequired() {
|
|
45
|
+
if (typeof fieldSchema['required'] === 'undefined') {
|
|
46
|
+
field.required = !!uiSchema['required'];
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var ctx = useFormBlockContext();
|
|
51
|
+
useEffect(function () {
|
|
52
|
+
if (ctx === null || ctx === void 0 ? void 0 : ctx.field) {
|
|
53
|
+
ctx.field.added = ctx.field.added || new Set();
|
|
54
|
+
ctx.field.added.add(fieldSchema.name);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
useEffect(function () {
|
|
58
|
+
if (!uiSchema) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setFieldProps('content', uiSchema['x-content']);
|
|
63
|
+
setFieldProps('description', uiSchema.description);
|
|
64
|
+
setFieldProps('initialValue', uiSchema.default); // if (!field.validator && uiSchema['x-validator']) {
|
|
65
|
+
// field.validator = uiSchema['x-validator'];
|
|
66
|
+
// }
|
|
67
|
+
|
|
68
|
+
if (fieldSchema['x-disabled'] === true) {
|
|
69
|
+
field.disabled = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (fieldSchema['x-read-pretty'] === true) {
|
|
73
|
+
field.readPretty = true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
setRequired(); // @ts-ignore
|
|
77
|
+
|
|
78
|
+
field.dataSource = uiSchema.enum;
|
|
79
|
+
var originalProps = compile(uiSchema['x-component-props']) || {};
|
|
80
|
+
var componentProps = merge(originalProps, field.componentProps || {});
|
|
81
|
+
field.componentProps = componentProps; // field.component = [component, componentProps];
|
|
82
|
+
}, [JSON.stringify(uiSchema)]);
|
|
83
|
+
|
|
84
|
+
if (!uiSchema) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return /*#__PURE__*/React.createElement(component, props, props.children);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
var CollectionField = connect(function (props) {
|
|
92
|
+
var fieldSchema = useFieldSchema();
|
|
93
|
+
return /*#__PURE__*/React.createElement(CollectionFieldProvider, {
|
|
94
|
+
name: fieldSchema.name
|
|
95
|
+
}, /*#__PURE__*/React.createElement(InternalField, _objectSpread({}, props)));
|
|
96
|
+
});
|
|
97
|
+
export var BulkEditFormItemValueType;
|
|
98
|
+
|
|
99
|
+
(function (BulkEditFormItemValueType) {
|
|
100
|
+
BulkEditFormItemValueType[BulkEditFormItemValueType["RemainsTheSame"] = 1] = "RemainsTheSame";
|
|
101
|
+
BulkEditFormItemValueType[BulkEditFormItemValueType["ChangedTo"] = 2] = "ChangedTo";
|
|
102
|
+
BulkEditFormItemValueType[BulkEditFormItemValueType["Clear"] = 3] = "Clear";
|
|
103
|
+
BulkEditFormItemValueType[BulkEditFormItemValueType["AddAttach"] = 4] = "AddAttach";
|
|
104
|
+
})(BulkEditFormItemValueType || (BulkEditFormItemValueType = {}));
|
|
105
|
+
|
|
106
|
+
export var BulkEditField = function BulkEditField(props) {
|
|
107
|
+
var _useTranslation = useTranslation(),
|
|
108
|
+
t = _useTranslation.t;
|
|
109
|
+
|
|
110
|
+
var fieldSchema = useFieldSchema();
|
|
111
|
+
var field = useField();
|
|
112
|
+
|
|
113
|
+
var _useState = useState(BulkEditFormItemValueType.RemainsTheSame),
|
|
114
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
115
|
+
type = _useState2[0],
|
|
116
|
+
setType = _useState2[1];
|
|
117
|
+
|
|
118
|
+
var _useState3 = useState(null),
|
|
119
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
120
|
+
value = _useState4[0],
|
|
121
|
+
setValue = _useState4[1];
|
|
122
|
+
|
|
123
|
+
var _useCollection = useCollection(),
|
|
124
|
+
getField = _useCollection.getField;
|
|
125
|
+
|
|
126
|
+
var collectionField = getField(fieldSchema.name);
|
|
127
|
+
useEffect(function () {
|
|
128
|
+
field.value = _defineProperty({}, type, value);
|
|
129
|
+
}, [type, value]);
|
|
130
|
+
|
|
131
|
+
var typeChangeHandler = function typeChangeHandler(val) {
|
|
132
|
+
setType(val);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
var valueChangeHandler = function valueChangeHandler(val) {
|
|
136
|
+
var _ref, _val$target$value, _val$target, _val$target2;
|
|
137
|
+
|
|
138
|
+
setValue((_ref = (_val$target$value = val === null || val === void 0 ? void 0 : (_val$target = val.target) === null || _val$target === void 0 ? void 0 : _val$target.value) !== null && _val$target$value !== void 0 ? _val$target$value : val === null || val === void 0 ? void 0 : (_val$target2 = val.target) === null || _val$target2 === void 0 ? void 0 : _val$target2.checked) !== null && _ref !== void 0 ? _ref : val);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
var collectionSchema = {
|
|
142
|
+
type: 'void',
|
|
143
|
+
properties: _defineProperty({}, uid(), {
|
|
144
|
+
type: 'string',
|
|
145
|
+
'x-component': 'BulkEditCollectionField',
|
|
146
|
+
'x-collection-field': fieldSchema['x-collection-field'],
|
|
147
|
+
'x-component-props': _objectSpread(_objectSpread({}, props), {}, {
|
|
148
|
+
value: value,
|
|
149
|
+
onChange: valueChangeHandler,
|
|
150
|
+
style: {
|
|
151
|
+
minWidth: 150
|
|
152
|
+
}
|
|
153
|
+
}),
|
|
154
|
+
'x-decorator': 'FormItem'
|
|
155
|
+
})
|
|
156
|
+
};
|
|
157
|
+
return /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Select, {
|
|
158
|
+
defaultValue: type,
|
|
159
|
+
value: type,
|
|
160
|
+
style: {
|
|
161
|
+
width: 150
|
|
162
|
+
},
|
|
163
|
+
onChange: typeChangeHandler
|
|
164
|
+
}, /*#__PURE__*/React.createElement(Select.Option, {
|
|
165
|
+
value: BulkEditFormItemValueType.RemainsTheSame
|
|
166
|
+
}, t('Remains the same')), /*#__PURE__*/React.createElement(Select.Option, {
|
|
167
|
+
value: BulkEditFormItemValueType.ChangedTo
|
|
168
|
+
}, t('Changed to')), /*#__PURE__*/React.createElement(Select.Option, {
|
|
169
|
+
value: BulkEditFormItemValueType.Clear
|
|
170
|
+
}, t('Clear')), ['subTable', 'linkTo', 'm2m', 'o2m', 'o2o', 'oho', 'obo', 'm2o'].includes(collectionField.interface) && /*#__PURE__*/React.createElement(Select.Option, {
|
|
171
|
+
value: BulkEditFormItemValueType.AddAttach
|
|
172
|
+
}, t('Add attach'))), [BulkEditFormItemValueType.ChangedTo, BulkEditFormItemValueType.AddAttach].includes(type) && collectionField.interface !== 'checkbox' && /*#__PURE__*/React.createElement(CollectionField, _objectSpread(_objectSpread({}, props), {}, {
|
|
173
|
+
value: value,
|
|
174
|
+
onChange: valueChangeHandler,
|
|
175
|
+
style: {
|
|
176
|
+
minWidth: 150
|
|
177
|
+
}
|
|
178
|
+
})) // <SchemaComponent
|
|
179
|
+
// schema={collectionSchema}
|
|
180
|
+
// components={{ BulkEditCollectionField: CollectionField }}
|
|
181
|
+
// onlyRenderProperties
|
|
182
|
+
// />
|
|
183
|
+
, [BulkEditFormItemValueType.ChangedTo, BulkEditFormItemValueType.AddAttach].includes(type) && collectionField.interface === 'checkbox' && /*#__PURE__*/React.createElement(Checkbox, {
|
|
184
|
+
checked: value,
|
|
185
|
+
onChange: valueChangeHandler
|
|
186
|
+
}));
|
|
187
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './assigned-field';
|
|
1
|
+
export * from './assigned-field';
|
|
2
|
+
export * from './BulkEditField';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
1
|
+
import { merge } from '@formily/shared';
|
|
7
2
|
import React from 'react';
|
|
8
|
-
import { SchemaInitializer } from
|
|
3
|
+
import { SchemaInitializer } from '..'; // Block
|
|
9
4
|
|
|
10
5
|
export var BlockInitializer = function BlockInitializer(props) {
|
|
11
6
|
var item = props.item,
|
|
7
|
+
schema = props.schema,
|
|
12
8
|
insert = props.insert;
|
|
13
9
|
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, {
|
|
14
10
|
onClick: function onClick() {
|
|
15
|
-
|
|
11
|
+
var _item$schemaInitializ;
|
|
12
|
+
|
|
13
|
+
var s = merge(schema || {}, item.schema || {});
|
|
14
|
+
item === null || item === void 0 ? void 0 : (_item$schemaInitializ = item.schemaInitialize) === null || _item$schemaInitializ === void 0 ? void 0 : _item$schemaInitializ.call(item, s);
|
|
15
|
+
insert(s);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BulkEditSubmitActionInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { ActionInitializer } from './ActionInitializer';
|
|
9
|
+
export var BulkEditSubmitActionInitializer = function BulkEditSubmitActionInitializer(props) {
|
|
10
|
+
var schema = {
|
|
11
|
+
title: '{{ t("Submit") }}',
|
|
12
|
+
'x-action': 'submit',
|
|
13
|
+
'x-component': 'Action',
|
|
14
|
+
'x-designer': 'Action.Designer',
|
|
15
|
+
'x-component-props': {
|
|
16
|
+
type: 'primary',
|
|
17
|
+
htmlType: 'submit',
|
|
18
|
+
useProps: '{{ useCustomizeBulkEditActionProps }}'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
22
|
+
schema: schema
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CreateFormBulkEditBlockInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var _excluded = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert"];
|
|
2
|
+
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
|
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
+
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
+
|
|
11
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
|
|
13
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
|
+
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
|
|
17
|
+
import { FormOutlined } from '@ant-design/icons';
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { useBlockAssociationContext } from '../../block-provider';
|
|
20
|
+
import { useCollection } from '../../collection-manager';
|
|
21
|
+
import { useSchemaTemplateManager } from '../../schema-templates';
|
|
22
|
+
import { SchemaInitializer } from '../SchemaInitializer';
|
|
23
|
+
import { createFormBlockSchema, useRecordCollectionDataSourceItems } from '../utils';
|
|
24
|
+
export var CreateFormBulkEditBlockInitializer = function CreateFormBulkEditBlockInitializer(props) {
|
|
25
|
+
var onCreateBlockSchema = props.onCreateBlockSchema,
|
|
26
|
+
componentType = props.componentType,
|
|
27
|
+
createBlockSchema = props.createBlockSchema,
|
|
28
|
+
insert = props.insert,
|
|
29
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
|
|
31
|
+
var _useSchemaTemplateMan = useSchemaTemplateManager(),
|
|
32
|
+
getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
|
|
33
|
+
|
|
34
|
+
var association = useBlockAssociationContext();
|
|
35
|
+
var collection = useCollection();
|
|
36
|
+
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
|
|
37
|
+
icon: /*#__PURE__*/React.createElement(FormOutlined, null)
|
|
38
|
+
}, others), {}, {
|
|
39
|
+
onClick: function () {
|
|
40
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
41
|
+
var item, s, blockSchema;
|
|
42
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
43
|
+
while (1) {
|
|
44
|
+
switch (_context.prev = _context.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
item = _ref.item;
|
|
47
|
+
|
|
48
|
+
if (!item.template) {
|
|
49
|
+
_context.next = 8;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_context.next = 4;
|
|
54
|
+
return getTemplateSchemaByMode(item);
|
|
55
|
+
|
|
56
|
+
case 4:
|
|
57
|
+
s = _context.sent;
|
|
58
|
+
|
|
59
|
+
if (item.template.componentName === 'FormItem') {
|
|
60
|
+
blockSchema = createFormBlockSchema({
|
|
61
|
+
actionInitializers: 'CreateFormActionInitializers',
|
|
62
|
+
association: association,
|
|
63
|
+
collection: collection.name,
|
|
64
|
+
template: s
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (item.mode === 'reference') {
|
|
68
|
+
blockSchema['x-template-key'] = item.template.key;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
insert(blockSchema);
|
|
72
|
+
} else {
|
|
73
|
+
insert(s);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_context.next = 9;
|
|
77
|
+
break;
|
|
78
|
+
|
|
79
|
+
case 8:
|
|
80
|
+
insert(createFormBlockSchema({
|
|
81
|
+
formItemInitializers: 'BulkEditFormItemInitializers',
|
|
82
|
+
actionInitializers: 'BulkEditFormActionInitializers',
|
|
83
|
+
association: association,
|
|
84
|
+
collection: collection.name
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
case 9:
|
|
88
|
+
case "end":
|
|
89
|
+
return _context.stop();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, _callee);
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
function onClick(_x) {
|
|
96
|
+
return _onClick.apply(this, arguments);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return onClick;
|
|
100
|
+
}(),
|
|
101
|
+
items: useRecordCollectionDataSourceItems('FormItem')
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CustomizeBulkEditActionInitializer: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { BlockInitializer } from './BlockInitializer';
|
|
9
|
+
export var CustomizeBulkEditActionInitializer = function CustomizeBulkEditActionInitializer(props) {
|
|
10
|
+
var schema = {
|
|
11
|
+
type: 'void',
|
|
12
|
+
title: '{{t("Bulk edit")}}',
|
|
13
|
+
'x-designer': 'Action.Designer',
|
|
14
|
+
'x-component': 'Action',
|
|
15
|
+
'x-action': 'customize:bulkEdit',
|
|
16
|
+
'x-action-settings': {
|
|
17
|
+
updateMode: 'selected'
|
|
18
|
+
},
|
|
19
|
+
'x-component-props': {
|
|
20
|
+
openMode: 'drawer'
|
|
21
|
+
},
|
|
22
|
+
properties: {
|
|
23
|
+
drawer: {
|
|
24
|
+
type: 'void',
|
|
25
|
+
title: '{{t("Bulk edit")}}',
|
|
26
|
+
'x-component': 'Action.Container',
|
|
27
|
+
'x-component-props': {
|
|
28
|
+
className: 'nb-action-popup'
|
|
29
|
+
},
|
|
30
|
+
properties: {
|
|
31
|
+
tabs: {
|
|
32
|
+
type: 'void',
|
|
33
|
+
'x-component': 'Tabs',
|
|
34
|
+
'x-component-props': {},
|
|
35
|
+
'x-initializer': 'TabPaneInitializersForBulkEditFormBlock',
|
|
36
|
+
properties: {
|
|
37
|
+
tab1: {
|
|
38
|
+
type: 'void',
|
|
39
|
+
title: '{{t("Bulk edit")}}',
|
|
40
|
+
'x-component': 'Tabs.TabPane',
|
|
41
|
+
'x-designer': 'Tabs.Designer',
|
|
42
|
+
'x-component-props': {},
|
|
43
|
+
properties: {
|
|
44
|
+
grid: {
|
|
45
|
+
type: 'void',
|
|
46
|
+
'x-component': 'Grid',
|
|
47
|
+
'x-initializer': 'CreateFormBulkEditBlockInitializers',
|
|
48
|
+
properties: {}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return /*#__PURE__*/React.createElement(BlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
59
|
+
schema: schema
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export * from './ActionInitializer';
|
|
2
2
|
export * from './BlockInitializer';
|
|
3
3
|
export * from './BulkDestroyActionInitializer';
|
|
4
|
+
export * from './BulkEditSubmitActionInitializer';
|
|
4
5
|
export * from './CalendarBlockInitializer';
|
|
5
6
|
export * from './CollectionFieldInitializer';
|
|
6
7
|
export * from './CreateActionInitializer';
|
|
7
8
|
export * from './CreateFormBlockInitializer';
|
|
9
|
+
export * from './CreateFormBulkEditBlockInitializer';
|
|
8
10
|
export * from './CreateSubmitActionInitializer';
|
|
9
11
|
export * from './CustomizeActionInitializer';
|
|
12
|
+
export * from './CustomizeBulkEditActionInitializer';
|
|
10
13
|
export * from './DataBlockInitializer';
|
|
11
14
|
export * from './DestroyActionInitializer';
|
|
12
15
|
export * from './DetailsBlockInitializer';
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export * from './ActionInitializer';
|
|
2
2
|
export * from './BlockInitializer';
|
|
3
3
|
export * from './BulkDestroyActionInitializer';
|
|
4
|
+
export * from './BulkEditSubmitActionInitializer';
|
|
4
5
|
export * from './CalendarBlockInitializer';
|
|
5
6
|
export * from './CollectionFieldInitializer';
|
|
6
7
|
export * from './CreateActionInitializer';
|
|
7
8
|
export * from './CreateFormBlockInitializer';
|
|
9
|
+
export * from './CreateFormBulkEditBlockInitializer';
|
|
8
10
|
export * from './CreateSubmitActionInitializer';
|
|
9
11
|
export * from './CustomizeActionInitializer';
|
|
12
|
+
export * from './CustomizeBulkEditActionInitializer';
|
|
10
13
|
export * from './DataBlockInitializer';
|
|
11
14
|
export * from './DestroyActionInitializer';
|
|
12
15
|
export * from './DetailsBlockInitializer';
|
|
@@ -78,6 +78,7 @@ export declare const useAssociatedTableColumnInitializerFields: () => SchemaInit
|
|
|
78
78
|
export declare const useFormItemInitializerFields: (options?: any) => SchemaInitializerItemOptions[];
|
|
79
79
|
export declare const useAssociatedFormItemInitializerFields: (options?: any) => SchemaInitializerItemOptions[];
|
|
80
80
|
export declare const useCustomFormItemInitializerFields: (options?: any) => SchemaInitializerItemOptions[];
|
|
81
|
+
export declare const useCustomBulkEditFormItemInitializerFields: (options?: any) => SchemaInitializerItemOptions[];
|
|
81
82
|
export declare const useCurrentSchema: (action: string, key: string, find?: (schema: Schema, key: string, action: string) => any, rm?: (schema: any, cb: any) => any) => {
|
|
82
83
|
schema: any;
|
|
83
84
|
exists: boolean;
|
|
@@ -209,7 +209,7 @@ export var useFormItemInitializerFields = function useFormItemInitializerFields(
|
|
|
209
209
|
return fields === null || fields === void 0 ? void 0 : (_fields$filter2 = fields.filter(function (field) {
|
|
210
210
|
return field === null || field === void 0 ? void 0 : field.interface;
|
|
211
211
|
})) === null || _fields$filter2 === void 0 ? void 0 : _fields$filter2.map(function (field) {
|
|
212
|
-
var _field$uiSchema3;
|
|
212
|
+
var _field$uiSchema3, _field$uiSchema4;
|
|
213
213
|
|
|
214
214
|
var interfaceConfig = getInterface(field.interface);
|
|
215
215
|
var schema = {
|
|
@@ -220,12 +220,13 @@ export var useFormItemInitializerFields = function useFormItemInitializerFields(
|
|
|
220
220
|
'x-component': field.interface === 'o2m' ? 'TableField' : 'CollectionField',
|
|
221
221
|
'x-decorator': 'FormItem',
|
|
222
222
|
'x-collection-field': "".concat(name, ".").concat(field.name),
|
|
223
|
-
'x-component-props': {}
|
|
223
|
+
'x-component-props': {},
|
|
224
|
+
'x-read-pretty': field === null || field === void 0 ? void 0 : (_field$uiSchema3 = field.uiSchema) === null || _field$uiSchema3 === void 0 ? void 0 : _field$uiSchema3['x-read-pretty']
|
|
224
225
|
}; // interfaceConfig?.schemaInitialize?.(schema, { field, block: 'Form', readPretty: form.readPretty });
|
|
225
226
|
|
|
226
227
|
return {
|
|
227
228
|
type: 'item',
|
|
228
|
-
title: (field === null || field === void 0 ? void 0 : (_field$
|
|
229
|
+
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema4 = field.uiSchema) === null || _field$uiSchema4 === void 0 ? void 0 : _field$uiSchema4.title) || field.name,
|
|
229
230
|
component: 'CollectionFieldInitializer',
|
|
230
231
|
remove: removeGridFormItem,
|
|
231
232
|
schemaInitialize: function schemaInitialize(s) {
|
|
@@ -264,7 +265,7 @@ export var useAssociatedFormItemInitializerFields = function useAssociatedFormIt
|
|
|
264
265
|
var groups = fields === null || fields === void 0 ? void 0 : (_fields$filter3 = fields.filter(function (field) {
|
|
265
266
|
return interfaces.includes(field.interface);
|
|
266
267
|
})) === null || _fields$filter3 === void 0 ? void 0 : _fields$filter3.map(function (field) {
|
|
267
|
-
var _subFields$filter2, _field$
|
|
268
|
+
var _subFields$filter2, _field$uiSchema5;
|
|
268
269
|
|
|
269
270
|
var subFields = getCollectionFields(field.target);
|
|
270
271
|
var items = subFields === null || subFields === void 0 ? void 0 : (_subFields$filter2 = subFields.filter(function (subField) {
|
|
@@ -306,7 +307,7 @@ export var useAssociatedFormItemInitializerFields = function useAssociatedFormIt
|
|
|
306
307
|
});
|
|
307
308
|
return {
|
|
308
309
|
type: 'subMenu',
|
|
309
|
-
title: (_field$
|
|
310
|
+
title: (_field$uiSchema5 = field.uiSchema) === null || _field$uiSchema5 === void 0 ? void 0 : _field$uiSchema5.title,
|
|
310
311
|
children: items
|
|
311
312
|
};
|
|
312
313
|
});
|
|
@@ -332,17 +333,17 @@ export var useCustomFormItemInitializerFields = function useCustomFormItemInitia
|
|
|
332
333
|
|
|
333
334
|
var remove = useRemoveGridFormItem();
|
|
334
335
|
return fields === null || fields === void 0 ? void 0 : (_fields$filter4 = fields.filter(function (field) {
|
|
335
|
-
var _field$
|
|
336
|
+
var _field$uiSchema6;
|
|
336
337
|
|
|
337
|
-
return (field === null || field === void 0 ? void 0 : field.interface) && !(field === null || field === void 0 ? void 0 : (_field$
|
|
338
|
+
return (field === null || field === void 0 ? void 0 : field.interface) && !(field === null || field === void 0 ? void 0 : (_field$uiSchema6 = field.uiSchema) === null || _field$uiSchema6 === void 0 ? void 0 : _field$uiSchema6['x-read-pretty']);
|
|
338
339
|
})) === null || _fields$filter4 === void 0 ? void 0 : _fields$filter4.map(function (field) {
|
|
339
|
-
var _field$
|
|
340
|
+
var _field$uiSchema7, _field$uiSchema8;
|
|
340
341
|
|
|
341
342
|
var interfaceConfig = getInterface(field.interface);
|
|
342
343
|
var schema = {
|
|
343
344
|
type: 'string',
|
|
344
345
|
name: field.name,
|
|
345
|
-
title: (field === null || field === void 0 ? void 0 : (_field$
|
|
346
|
+
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema7 = field.uiSchema) === null || _field$uiSchema7 === void 0 ? void 0 : _field$uiSchema7.title) || field.name,
|
|
346
347
|
'x-designer': 'FormItem.Designer',
|
|
347
348
|
'x-component': 'AssignedField',
|
|
348
349
|
'x-decorator': 'FormItem',
|
|
@@ -350,7 +351,7 @@ export var useCustomFormItemInitializerFields = function useCustomFormItemInitia
|
|
|
350
351
|
};
|
|
351
352
|
return {
|
|
352
353
|
type: 'item',
|
|
353
|
-
title: (field === null || field === void 0 ? void 0 : (_field$
|
|
354
|
+
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema8 = field.uiSchema) === null || _field$uiSchema8 === void 0 ? void 0 : _field$uiSchema8.title) || field.name,
|
|
354
355
|
component: 'CollectionFieldInitializer',
|
|
355
356
|
remove: remove,
|
|
356
357
|
schemaInitialize: function schemaInitialize(s) {
|
|
@@ -366,6 +367,60 @@ export var useCustomFormItemInitializerFields = function useCustomFormItemInitia
|
|
|
366
367
|
};
|
|
367
368
|
});
|
|
368
369
|
};
|
|
370
|
+
export var useCustomBulkEditFormItemInitializerFields = function useCustomBulkEditFormItemInitializerFields(options) {
|
|
371
|
+
var _fields$filter5;
|
|
372
|
+
|
|
373
|
+
var _useCollection6 = useCollection(),
|
|
374
|
+
name = _useCollection6.name,
|
|
375
|
+
fields = _useCollection6.fields;
|
|
376
|
+
|
|
377
|
+
var _useCollectionManager6 = useCollectionManager(),
|
|
378
|
+
getInterface = _useCollectionManager6.getInterface;
|
|
379
|
+
|
|
380
|
+
var form = useForm();
|
|
381
|
+
|
|
382
|
+
var _ref4 = options || {},
|
|
383
|
+
_ref4$readPretty = _ref4.readPretty,
|
|
384
|
+
readPretty = _ref4$readPretty === void 0 ? form.readPretty : _ref4$readPretty,
|
|
385
|
+
_ref4$block = _ref4.block,
|
|
386
|
+
block = _ref4$block === void 0 ? 'Form' : _ref4$block;
|
|
387
|
+
|
|
388
|
+
var remove = useRemoveGridFormItem();
|
|
389
|
+
return fields === null || fields === void 0 ? void 0 : (_fields$filter5 = fields.filter(function (field) {
|
|
390
|
+
var _field$uiSchema9;
|
|
391
|
+
|
|
392
|
+
return (field === null || field === void 0 ? void 0 : field.interface) && !(field === null || field === void 0 ? void 0 : (_field$uiSchema9 = field.uiSchema) === null || _field$uiSchema9 === void 0 ? void 0 : _field$uiSchema9['x-read-pretty']);
|
|
393
|
+
})) === null || _fields$filter5 === void 0 ? void 0 : _fields$filter5.map(function (field) {
|
|
394
|
+
var _field$uiSchema10, _field$uiSchema11;
|
|
395
|
+
|
|
396
|
+
var interfaceConfig = getInterface(field.interface);
|
|
397
|
+
var schema = {
|
|
398
|
+
type: 'string',
|
|
399
|
+
name: field.name,
|
|
400
|
+
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema10 = field.uiSchema) === null || _field$uiSchema10 === void 0 ? void 0 : _field$uiSchema10.title) || field.name,
|
|
401
|
+
'x-designer': 'FormItem.Designer',
|
|
402
|
+
'x-component': 'BulkEditField',
|
|
403
|
+
'x-decorator': 'FormItem',
|
|
404
|
+
'x-collection-field': "".concat(name, ".").concat(field.name)
|
|
405
|
+
};
|
|
406
|
+
return {
|
|
407
|
+
type: 'item',
|
|
408
|
+
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema11 = field.uiSchema) === null || _field$uiSchema11 === void 0 ? void 0 : _field$uiSchema11.title) || field.name,
|
|
409
|
+
component: 'CollectionFieldInitializer',
|
|
410
|
+
remove: remove,
|
|
411
|
+
schemaInitialize: function schemaInitialize(s) {
|
|
412
|
+
var _interfaceConfig$sche6;
|
|
413
|
+
|
|
414
|
+
interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche6 = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche6 === void 0 ? void 0 : _interfaceConfig$sche6.call(interfaceConfig, s, {
|
|
415
|
+
field: field,
|
|
416
|
+
block: block,
|
|
417
|
+
readPretty: readPretty
|
|
418
|
+
});
|
|
419
|
+
},
|
|
420
|
+
schema: schema
|
|
421
|
+
};
|
|
422
|
+
});
|
|
423
|
+
};
|
|
369
424
|
|
|
370
425
|
var findSchema = function findSchema(schema, key, action) {
|
|
371
426
|
if (!Schema.isSchemaInstance(schema)) return null;
|
|
@@ -493,8 +548,8 @@ export var useCollectionDataSourceItems = function useCollectionDataSourceItems(
|
|
|
493
548
|
var _useTranslation2 = useTranslation(),
|
|
494
549
|
t = _useTranslation2.t;
|
|
495
550
|
|
|
496
|
-
var
|
|
497
|
-
collections =
|
|
551
|
+
var _useCollectionManager7 = useCollectionManager(),
|
|
552
|
+
collections = _useCollectionManager7.collections;
|
|
498
553
|
|
|
499
554
|
var _useSchemaTemplateMan2 = useSchemaTemplateManager(),
|
|
500
555
|
getTemplatesByCollection = _useSchemaTemplateMan2.getTemplatesByCollection;
|
|
@@ -31,6 +31,7 @@ declare type SchemaSettingsNested = {
|
|
|
31
31
|
Popup?: React.FC<MenuItemProps & {
|
|
32
32
|
schema?: ISchema;
|
|
33
33
|
}>;
|
|
34
|
+
SwitchItem?: React.FC<SwitchItemProps>;
|
|
34
35
|
[key: string]: any;
|
|
35
36
|
};
|
|
36
37
|
interface SchemaSettingsProviderProps {
|
|
@@ -44,4 +45,9 @@ interface SchemaSettingsProviderProps {
|
|
|
44
45
|
}
|
|
45
46
|
export declare const SchemaSettingsProvider: React.FC<SchemaSettingsProviderProps>;
|
|
46
47
|
export declare const SchemaSettings: React.FC<SchemaSettingsProps> & SchemaSettingsNested;
|
|
48
|
+
interface SwitchItemProps extends Omit<MenuItemProps, 'onChange'> {
|
|
49
|
+
title: string;
|
|
50
|
+
checked?: boolean;
|
|
51
|
+
onChange?: (v: boolean) => void;
|
|
52
|
+
}
|
|
47
53
|
export {};
|