@nocobase/client 0.10.0-alpha.2 → 0.10.0-alpha.3
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/Configuration/MenuItemsProvider.js +3 -3
- package/es/application/Application.js +2 -2
- package/es/auth/SigninPage.js +12 -9
- package/es/collection-manager/Configuration/AddCollectionAction.js +31 -25
- package/es/collection-manager/Configuration/AddFieldAction.js +45 -32
- package/es/collection-manager/Configuration/AddSubFieldAction.js +24 -19
- package/es/collection-manager/Configuration/ConfigurationTabs.js +57 -50
- package/es/collection-manager/hooks/useOptions.js +39 -36
- package/es/collection-manager/interfaces/integer.js +1 -1
- package/es/collection-manager/interfaces/number.js +3 -3
- package/es/collection-manager/interfaces/percent.js +3 -3
- package/es/formula/Expression.js +66 -46
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +1 -0
- package/es/hooks/useAdminSchemaUid.d.ts +1 -0
- package/es/hooks/useAdminSchemaUid.js +6 -0
- package/es/hooks/useMenuItem.d.ts +37 -0
- package/es/hooks/useMenuItem.js +90 -0
- package/es/index.d.ts +2 -3
- package/es/index.js +3 -4
- package/es/locale/en_US.d.ts +3 -1
- package/es/locale/en_US.js +4 -2
- package/es/locale/es_ES.d.ts +1 -1
- package/es/locale/es_ES.js +1 -1
- package/es/locale/ja_JP.d.ts +3 -1
- package/es/locale/ja_JP.js +4 -2
- package/es/locale/pt_BR.d.ts +1 -1
- package/es/locale/pt_BR.js +1 -1
- package/es/locale/ru_RU.d.ts +1 -1
- package/es/locale/ru_RU.js +1 -1
- package/es/locale/zh_CN.d.ts +3 -1
- package/es/locale/zh_CN.js +3 -1
- package/es/pm/Card.js +5 -5
- package/es/pm/PluginManagerLink.js +16 -12
- package/es/pm/index.d.ts +2 -1
- package/es/pm/index.js +36 -22
- package/es/route-switch/antd/admin-layout/index.js +4 -4
- package/es/schema-component/antd/action/Action.Designer.js +3 -5
- package/es/schema-component/antd/action/Action.Drawer.js +1 -1
- package/es/schema-component/antd/action/ActionBar.js +1 -1
- package/es/schema-component/antd/association-field/SubTable.js +1 -1
- package/es/schema-component/antd/calendar/DeleteEvent.js +1 -1
- package/es/schema-component/antd/cascader/Cascader.js +1 -1
- package/es/schema-component/antd/form-item/FormItem.js +10 -3
- package/es/schema-component/antd/grid-card/GridCard.Designer.js +3 -4
- package/es/schema-component/antd/index.less +1 -3
- package/es/schema-component/antd/menu/Menu.js +306 -156
- package/es/schema-component/antd/page/Page.js +29 -23
- package/es/schema-component/antd/remote-select/RemoteSelect.js +58 -10
- package/es/schema-component/antd/remote-select/utils.d.ts +4 -0
- package/es/schema-component/antd/remote-select/utils.js +31 -0
- package/es/schema-component/antd/table-v2/FilterDynamicComponent.js +17 -2
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +51 -12
- package/es/schema-component/antd/table-v2/Table.js +9 -7
- package/es/schema-component/antd/tabs/Tabs.js +35 -22
- package/es/schema-component/antd/tabs/context.d.ts +1 -1
- package/es/schema-component/antd/upload/ReadPretty.js +7 -3
- package/es/schema-component/antd/variable/VariableSelect.js +1 -1
- package/es/schema-component/common/utils/uitls.d.ts +1 -0
- package/es/schema-component/common/utils/uitls.js +1 -1
- package/es/schema-initializer/SchemaInitializer.d.ts +7 -2
- package/es/schema-initializer/SchemaInitializer.js +155 -102
- package/es/schema-initializer/SelectCollection.d.ts +1 -2
- package/es/schema-initializer/SelectCollection.js +19 -16
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
- package/es/schema-initializer/buttons/TableActionInitializers.js +5 -5
- package/es/schema-initializer/buttons/TableColumnInitializers.js +3 -2
- package/es/schema-initializer/components/CreateRecordAction.js +37 -27
- package/es/schema-initializer/components/assigned-field/AssignedField.js +2 -1
- package/es/schema-initializer/items/CalendarBlockInitializer.js +2 -2
- package/es/schema-initializer/utils.d.ts +0 -1
- package/es/schema-initializer/utils.js +40 -25
- package/es/schema-settings/SchemaSettings.js +123 -46
- package/es/schema-settings/VariableInput/hooks/useFormVariable.d.ts +19 -0
- package/es/schema-settings/VariableInput/hooks/useFormVariable.js +89 -0
- package/es/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +8 -0
- package/es/schema-settings/VariableInput/hooks/useIterationVariable.js +77 -0
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +5 -12
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.js +19 -3
- package/es/schema-templates/BlockTemplateDetails.js +5 -1
- package/es/schema-templates/BlockTemplatePage.js +4 -1
- package/es/user/ChangePassword.d.ts +1 -2
- package/es/user/ChangePassword.js +30 -26
- package/es/user/CurrentUser.js +172 -141
- package/es/user/EditProfile.d.ts +1 -2
- package/es/user/EditProfile.js +30 -24
- package/es/user/LanguageSettings.d.ts +1 -2
- package/es/user/LanguageSettings.js +67 -64
- package/es/user/SigninPage.js +25 -22
- package/es/user/SwitchRole.d.ts +1 -2
- package/es/user/SwitchRole.js +54 -49
- package/es/user/ThemeSettings.d.ts +1 -2
- package/es/user/ThemeSettings.js +56 -52
- package/lib/acl/Configuration/MenuItemsProvider.js +3 -3
- package/lib/application/Application.js +2 -2
- package/lib/auth/SigninPage.js +25 -22
- package/lib/collection-manager/Configuration/AddCollectionAction.js +29 -23
- package/lib/collection-manager/Configuration/AddFieldAction.js +43 -30
- package/lib/collection-manager/Configuration/AddSubFieldAction.js +22 -17
- package/lib/collection-manager/Configuration/ConfigurationTabs.js +57 -49
- package/lib/collection-manager/hooks/useOptions.js +39 -36
- package/lib/collection-manager/interfaces/integer.js +1 -1
- package/lib/collection-manager/interfaces/number.js +3 -3
- package/lib/collection-manager/interfaces/percent.js +3 -3
- package/lib/formula/Expression.js +64 -44
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +11 -0
- package/lib/hooks/useAdminSchemaUid.d.ts +1 -0
- package/lib/hooks/useAdminSchemaUid.js +13 -0
- package/lib/hooks/useMenuItem.d.ts +37 -0
- package/lib/hooks/useMenuItem.js +104 -0
- package/lib/index.d.ts +2 -3
- package/lib/index.js +22 -33
- package/lib/locale/en_US.d.ts +3 -1
- package/lib/locale/en_US.js +4 -2
- package/lib/locale/es_ES.d.ts +1 -1
- package/lib/locale/es_ES.js +1 -1
- package/lib/locale/ja_JP.d.ts +3 -1
- package/lib/locale/ja_JP.js +4 -2
- package/lib/locale/pt_BR.d.ts +1 -1
- package/lib/locale/pt_BR.js +1 -1
- package/lib/locale/ru_RU.d.ts +1 -1
- package/lib/locale/ru_RU.js +1 -1
- package/lib/locale/zh_CN.d.ts +3 -1
- package/lib/locale/zh_CN.js +3 -1
- package/lib/pm/Card.js +6 -6
- package/lib/pm/PluginManagerLink.js +15 -10
- package/lib/pm/index.d.ts +2 -1
- package/lib/pm/index.js +37 -23
- package/lib/route-switch/antd/admin-layout/index.js +3 -3
- package/lib/schema-component/antd/action/Action.Designer.js +2 -4
- package/lib/schema-component/antd/action/Action.Drawer.js +1 -1
- package/lib/schema-component/antd/association-field/SubTable.js +1 -1
- package/lib/schema-component/antd/calendar/DeleteEvent.js +1 -1
- package/lib/schema-component/antd/cascader/Cascader.js +1 -1
- package/lib/schema-component/antd/form-item/FormItem.js +10 -3
- package/lib/schema-component/antd/grid-card/GridCard.Designer.js +4 -5
- package/lib/schema-component/antd/index.less +1 -3
- package/lib/schema-component/antd/menu/Menu.js +304 -154
- package/lib/schema-component/antd/page/Page.js +29 -23
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +55 -7
- package/lib/schema-component/antd/remote-select/utils.d.ts +4 -0
- package/lib/schema-component/antd/remote-select/utils.js +41 -0
- package/lib/schema-component/antd/table-v2/FilterDynamicComponent.js +17 -2
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +50 -11
- package/lib/schema-component/antd/table-v2/Table.js +9 -7
- package/lib/schema-component/antd/tabs/Tabs.js +34 -21
- package/lib/schema-component/antd/tabs/context.d.ts +1 -1
- package/lib/schema-component/antd/upload/ReadPretty.js +7 -3
- package/lib/schema-component/antd/variable/VariableSelect.js +1 -1
- package/lib/schema-component/common/utils/uitls.d.ts +1 -0
- package/lib/schema-component/common/utils/uitls.js +3 -1
- package/lib/schema-initializer/SchemaInitializer.d.ts +7 -2
- package/lib/schema-initializer/SchemaInitializer.js +154 -101
- package/lib/schema-initializer/SelectCollection.d.ts +1 -2
- package/lib/schema-initializer/SelectCollection.js +22 -17
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
- package/lib/schema-initializer/buttons/TableActionInitializers.js +5 -5
- package/lib/schema-initializer/buttons/TableColumnInitializers.js +2 -1
- package/lib/schema-initializer/components/CreateRecordAction.js +35 -25
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +2 -1
- package/lib/schema-initializer/items/CalendarBlockInitializer.js +9 -9
- package/lib/schema-initializer/utils.d.ts +0 -1
- package/lib/schema-initializer/utils.js +41 -25
- package/lib/schema-settings/SchemaSettings.js +122 -45
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.d.ts +19 -0
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +96 -0
- package/lib/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +8 -0
- package/lib/schema-settings/VariableInput/hooks/useIterationVariable.js +84 -0
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +5 -12
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +19 -3
- package/lib/schema-templates/BlockTemplateDetails.js +5 -1
- package/lib/schema-templates/BlockTemplatePage.js +5 -2
- package/lib/user/ChangePassword.d.ts +1 -2
- package/lib/user/ChangePassword.js +30 -26
- package/lib/user/CurrentUser.js +166 -135
- package/lib/user/EditProfile.d.ts +1 -2
- package/lib/user/EditProfile.js +31 -25
- package/lib/user/LanguageSettings.d.ts +1 -2
- package/lib/user/LanguageSettings.js +66 -63
- package/lib/user/SigninPage.js +25 -22
- package/lib/user/SwitchRole.d.ts +1 -2
- package/lib/user/SwitchRole.js +57 -51
- package/lib/user/ThemeSettings.d.ts +1 -2
- package/lib/user/ThemeSettings.js +59 -54
- package/package.json +9 -8
- package/es/settings-form/SettingsForm.d.ts +0 -13
- package/es/settings-form/SettingsForm.js +0 -309
- package/es/settings-form/index.d.ts +0 -1
- package/es/settings-form/index.js +0 -1
- package/lib/settings-form/SettingsForm.d.ts +0 -13
- package/lib/settings-form/SettingsForm.js +0 -320
- package/lib/settings-form/index.d.ts +0 -1
- package/lib/settings-form/index.js +0 -16
|
@@ -25,6 +25,7 @@ var TableColumnInitializers = function TableColumnInitializers(props) {
|
|
|
25
25
|
action = _props$action === void 0 ? true : _props$action;
|
|
26
26
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
27
27
|
t = _useTranslation.t;
|
|
28
|
+
var field = (0, _react2.useField)();
|
|
28
29
|
var fieldSchema = (0, _react2.useFieldSchema)();
|
|
29
30
|
var associatedFields = (0, _utils.useAssociatedTableColumnInitializerFields)();
|
|
30
31
|
var inheritFields = (0, _utils.useInheritsTableColumnInitializerFields)();
|
|
@@ -49,7 +50,7 @@ var TableColumnInitializers = function TableColumnInitializers(props) {
|
|
|
49
50
|
});
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
if ((associatedFields === null || associatedFields === void 0 ? void 0 : associatedFields.length) > 0 &&
|
|
53
|
+
if ((associatedFields === null || associatedFields === void 0 ? void 0 : associatedFields.length) > 0 && field.readPretty) {
|
|
53
54
|
fieldItems.push({
|
|
54
55
|
type: 'divider'
|
|
55
56
|
}, {
|
|
@@ -134,36 +134,46 @@ var CreateAction = (0, _react.observer)(function (props) {
|
|
|
134
134
|
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
135
135
|
getChildrenCollections = _useCollectionManager.getChildrenCollections;
|
|
136
136
|
var totalChildCollections = getChildrenCollections(collection.name);
|
|
137
|
-
var inheritsCollections =
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
var inheritsCollections = (0, _react2.useMemo)(function () {
|
|
138
|
+
return enableChildren.map(function (k) {
|
|
139
|
+
if (!k) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
var childCollection = totalChildCollections.find(function (j) {
|
|
143
|
+
return j.name === k.collection;
|
|
144
|
+
});
|
|
145
|
+
if (!childCollection) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
return _objectSpread(_objectSpread({}, childCollection), {}, {
|
|
149
|
+
title: k.title || childCollection.title
|
|
150
|
+
});
|
|
151
|
+
}).filter(function (v) {
|
|
152
|
+
return v && actionAclCheck("".concat(v.name, ":create"));
|
|
149
153
|
});
|
|
150
|
-
}
|
|
151
|
-
return v && actionAclCheck("".concat(v.name, ":create"));
|
|
152
|
-
});
|
|
154
|
+
}, [enableChildren, totalChildCollections]);
|
|
153
155
|
var linkageRules = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-linkage-rules']) || [];
|
|
154
156
|
var values = (0, _recordProvider.useRecord)();
|
|
155
157
|
var compile = (0, _schemaComponent.useCompile)();
|
|
156
158
|
var _useDesignable = (0, _.useDesignable)(),
|
|
157
159
|
designable = _useDesignable.designable;
|
|
158
160
|
var icon = props.icon || /*#__PURE__*/_react2.default.createElement(_icons.PlusOutlined, null);
|
|
159
|
-
var
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
var menuItems = (0, _react2.useMemo)(function () {
|
|
162
|
+
return inheritsCollections.map(function (option) {
|
|
163
|
+
return {
|
|
164
|
+
key: option.name,
|
|
165
|
+
label: compile(option.title),
|
|
166
|
+
onClick: function onClick() {
|
|
167
|
+
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(option.name);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
}, [inheritsCollections, _onClick]);
|
|
172
|
+
var menu = (0, _react2.useMemo)(function () {
|
|
173
|
+
return {
|
|
174
|
+
items: menuItems
|
|
175
|
+
};
|
|
176
|
+
}, [menuItems]);
|
|
167
177
|
(0, _react2.useEffect)(function () {
|
|
168
178
|
field.linkageProperty = {};
|
|
169
179
|
linkageRules.filter(function (k) {
|
|
@@ -188,12 +198,12 @@ var CreateAction = (0, _react.observer)(function (props) {
|
|
|
188
198
|
loading: false
|
|
189
199
|
})];
|
|
190
200
|
},
|
|
191
|
-
|
|
201
|
+
menu: menu,
|
|
192
202
|
onClick: function onClick(info) {
|
|
193
203
|
_onClick === null || _onClick === void 0 ? void 0 : _onClick(collection.name);
|
|
194
204
|
}
|
|
195
205
|
}, icon, props.children) : /*#__PURE__*/_react2.default.createElement(_antd.Dropdown, {
|
|
196
|
-
|
|
206
|
+
menu: menu
|
|
197
207
|
}, /*#__PURE__*/_react2.default.createElement(_antd.Button, {
|
|
198
208
|
icon: icon,
|
|
199
209
|
type: componentType
|
|
@@ -102,6 +102,7 @@ var AssignedField = function AssignedField(props) {
|
|
|
102
102
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
103
103
|
t = _useTranslation.t;
|
|
104
104
|
var compile = (0, _schemaComponent.useCompile)();
|
|
105
|
+
var collection = (0, _collectionManager.useCollection)();
|
|
105
106
|
var field = (0, _react.useField)();
|
|
106
107
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
107
108
|
var isDynamicValue = DYNAMIC_RECORD_REG.test(field.value) || DYNAMIC_USER_REG.test(field.value) || DYNAMIC_TIME_REG.test(field.value);
|
|
@@ -137,7 +138,7 @@ var AssignedField = function AssignedField(props) {
|
|
|
137
138
|
var _useCollection = (0, _collectionManager.useCollection)(),
|
|
138
139
|
getField = _useCollection.getField;
|
|
139
140
|
var collectionField = getField(fieldSchema.name);
|
|
140
|
-
var fields = (0, _collectionManager.useCollectionFilterOptions)(
|
|
141
|
+
var fields = (0, _collectionManager.useCollectionFilterOptions)(collection === null || collection === void 0 ? void 0 : collection.name);
|
|
141
142
|
var userFields = (0, _collectionManager.useCollectionFilterOptions)('users');
|
|
142
143
|
var dateTimeFields = ['createdAt', 'datetime', 'time', 'updatedAt'];
|
|
143
144
|
(0, _react2.useEffect)(function () {
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CalendarBlockInitializer = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _antd = require("@formily/antd");
|
|
9
7
|
var _icons = require("@ant-design/icons");
|
|
10
|
-
var
|
|
8
|
+
var _antd = require("@formily/antd");
|
|
9
|
+
var _react = require("@formily/react");
|
|
10
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _reactI18next = require("react-i18next");
|
|
12
12
|
var _collectionManager = require("../../collection-manager");
|
|
13
13
|
var _schemaComponent = require("../../schema-component");
|
|
@@ -32,10 +32,10 @@ var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
|
32
32
|
getCollectionField = _useCollectionManager.getCollectionField,
|
|
33
33
|
getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
|
|
34
34
|
_collectionManager.useCollectionManager;
|
|
35
|
-
var options = (0,
|
|
36
|
-
return /*#__PURE__*/
|
|
35
|
+
var options = (0, _react2.useContext)(_react.SchemaOptionsContext);
|
|
36
|
+
return /*#__PURE__*/_react2.default.createElement(_DataBlockInitializer.DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
37
37
|
componentType: 'Calendar',
|
|
38
|
-
icon: /*#__PURE__*/
|
|
38
|
+
icon: /*#__PURE__*/_react2.default.createElement(_icons.FormOutlined, null),
|
|
39
39
|
onCreateBlockSchema: function () {
|
|
40
40
|
var _onCreateBlockSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
41
41
|
var item, stringFieldsOptions, dateFieldsOptions, values;
|
|
@@ -49,12 +49,12 @@ var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
|
49
49
|
});
|
|
50
50
|
_context.next = 5;
|
|
51
51
|
return (0, _antd.FormDialog)(t('Create calendar block'), function () {
|
|
52
|
-
return /*#__PURE__*/
|
|
52
|
+
return /*#__PURE__*/_react2.default.createElement(_schemaComponent.SchemaComponentOptions, {
|
|
53
53
|
scope: options.scope,
|
|
54
54
|
components: _objectSpread({}, options.components)
|
|
55
|
-
}, /*#__PURE__*/
|
|
55
|
+
}, /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
56
56
|
layout: 'vertical'
|
|
57
|
-
}, /*#__PURE__*/
|
|
57
|
+
}, /*#__PURE__*/_react2.default.createElement(_schemaComponent.SchemaComponent, {
|
|
58
58
|
schema: {
|
|
59
59
|
properties: {
|
|
60
60
|
title: {
|
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useTableColumnInitializerFields = exports.useRemoveGridFormItem = exports.useRecordCollectionDataSourceItems = exports.useInheritsTableColumnInitializerFields = exports.useInheritsFormItemInitializerFields = exports.useFormItemInitializerFields = exports.useFilterInheritsFormItemInitializerFields = exports.useFilterFormItemInitializerFields = exports.useFilterAssociatedFormItemInitializerFields = exports.useCustomFormItemInitializerFields = exports.useCustomBulkEditFormItemInitializerFields = exports.useCurrentSchema = exports.useCollectionDataSourceItems = exports.useAssociatedTableColumnInitializerFields = exports.useAssociatedFormItemInitializerFields = exports.removeTableColumn = exports.removeGridFormItem = exports.itemsMerge = exports.gridRowColWrap = exports.findTableColumn = exports.createTableSelectorSchema = exports.createTableBlockSchema = exports.createReadPrettyFormBlockSchema = exports.createListBlockSchema = exports.createKanbanBlockSchema = exports.createGridCardBlockSchema = exports.createGanttBlockSchema = exports.createFormBlockSchema = exports.createFilterFormBlockSchema = exports.createDetailsBlockSchema = exports.createCollapseBlockSchema = exports.createCalendarBlockSchema = void 0;
|
|
7
7
|
var _react = require("@formily/react");
|
|
8
8
|
var _shared = require("@formily/shared");
|
|
9
|
+
var _client = require("@nocobase/utils/client");
|
|
10
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
11
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
10
12
|
var _reactI18next = require("react-i18next");
|
|
11
|
-
var
|
|
13
|
+
var _2 = require("../");
|
|
12
14
|
var _collectionManager = require("../collection-manager");
|
|
13
15
|
var _utils = require("../filter-provider/utils");
|
|
14
16
|
var _schemaComponent = require("../schema-component");
|
|
@@ -27,15 +29,12 @@ var _excluded = ["formItemInitializers", "actionInitializers", "collection", "as
|
|
|
27
29
|
_excluded11 = ["collection", "resource", "groupField"];
|
|
28
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
31
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
33
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
31
34
|
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; }
|
|
32
35
|
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; }
|
|
33
36
|
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; }
|
|
34
37
|
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; }
|
|
35
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
36
|
-
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."); }
|
|
37
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
38
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
38
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
40
39
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
40
|
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); }
|
|
@@ -236,6 +235,10 @@ var useInheritsTableColumnInitializerFields = function useInheritsTableColumnIni
|
|
|
236
235
|
getInheritCollections = _useCollectionManager3.getInheritCollections,
|
|
237
236
|
getCollection = _useCollectionManager3.getCollection,
|
|
238
237
|
getParentCollectionFields = _useCollectionManager3.getParentCollectionFields;
|
|
238
|
+
var fieldSchema = (0, _react.useFieldSchema)();
|
|
239
|
+
var isSubTable = fieldSchema['x-component'] === 'AssociationField.SubTable';
|
|
240
|
+
var form = (0, _react.useForm)();
|
|
241
|
+
var isReadPretty = isSubTable ? form.readPretty : true;
|
|
239
242
|
var inherits = getInheritCollections(name);
|
|
240
243
|
return inherits === null || inherits === void 0 ? void 0 : inherits.map(function (v) {
|
|
241
244
|
var fields = getParentCollectionFields(v, name);
|
|
@@ -243,18 +246,30 @@ var useInheritsTableColumnInitializerFields = function useInheritsTableColumnIni
|
|
|
243
246
|
return _defineProperty({}, targetCollection === null || targetCollection === void 0 ? void 0 : targetCollection.title, fields === null || fields === void 0 ? void 0 : fields.filter(function (field) {
|
|
244
247
|
return field === null || field === void 0 ? void 0 : field.interface;
|
|
245
248
|
}).map(function (k) {
|
|
246
|
-
var _k$uiSchema;
|
|
249
|
+
var _getCollection2, _k$uiSchema, _k$uiSchema2;
|
|
247
250
|
var interfaceConfig = getInterface(k.interface);
|
|
251
|
+
var isFileCollection = (k === null || k === void 0 ? void 0 : k.target) && ((_getCollection2 = getCollection(k === null || k === void 0 ? void 0 : k.target)) === null || _getCollection2 === void 0 ? void 0 : _getCollection2.template) === 'file';
|
|
248
252
|
var schema = {
|
|
249
253
|
name: "".concat(k.name),
|
|
250
254
|
'x-component': 'CollectionField',
|
|
251
|
-
'x-read-pretty':
|
|
255
|
+
'x-read-pretty': isReadPretty || ((_k$uiSchema = k.uiSchema) === null || _k$uiSchema === void 0 ? void 0 : _k$uiSchema['x-read-pretty']),
|
|
252
256
|
'x-collection-field': "".concat(name, ".").concat(k.name),
|
|
253
|
-
'x-component-props': {
|
|
257
|
+
'x-component-props': isFileCollection ? {
|
|
258
|
+
fieldNames: {
|
|
259
|
+
label: 'preview',
|
|
260
|
+
value: 'id'
|
|
261
|
+
}
|
|
262
|
+
} : {},
|
|
263
|
+
'x-decorator': isSubTable ? quickEditField.includes(k.interface) || isFileCollection ? 'QuickEdit' : 'FormItem' : null,
|
|
264
|
+
'x-decorator-props': {
|
|
265
|
+
labelStyle: {
|
|
266
|
+
display: 'none'
|
|
267
|
+
}
|
|
268
|
+
}
|
|
254
269
|
};
|
|
255
270
|
return {
|
|
256
271
|
type: 'item',
|
|
257
|
-
title: (k === null || k === void 0 ? void 0 : (_k$
|
|
272
|
+
title: (k === null || k === void 0 ? void 0 : (_k$uiSchema2 = k.uiSchema) === null || _k$uiSchema2 === void 0 ? void 0 : _k$uiSchema2.title) || k.name,
|
|
258
273
|
component: 'TableCollectionFieldInitializer',
|
|
259
274
|
find: findTableColumn,
|
|
260
275
|
remove: removeTableColumn,
|
|
@@ -801,7 +816,7 @@ var useCurrentSchema = function useCurrentSchema(action, key) {
|
|
|
801
816
|
var _useDesignable = (0, _schemaComponent.useDesignable)(),
|
|
802
817
|
_remove = _useDesignable.remove;
|
|
803
818
|
var schema = find(fieldSchema, key, action);
|
|
804
|
-
var ctx = (0, _react2.useContext)(
|
|
819
|
+
var ctx = (0, _react2.useContext)(_2.BlockRequestContext);
|
|
805
820
|
return {
|
|
806
821
|
schema: schema,
|
|
807
822
|
exists: !!schema,
|
|
@@ -886,28 +901,26 @@ var useCollectionDataSourceItems = function useCollectionDataSourceItems(compone
|
|
|
886
901
|
getCollectionFields = _useCollectionManager12.getCollectionFields;
|
|
887
902
|
var _useSchemaTemplateMan2 = (0, _schemaTemplates.useSchemaTemplateManager)(),
|
|
888
903
|
getTemplatesByCollection = _useSchemaTemplateMan2.getTemplatesByCollection;
|
|
889
|
-
var
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
var
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
904
|
+
var _useContext = (0, _react2.useContext)(_2.SchemaInitializerButtonContext),
|
|
905
|
+
searchValue = _useContext.searchValue,
|
|
906
|
+
setSearchValue = _useContext.setSearchValue;
|
|
907
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
908
|
+
var onChange = (0, _react2.useCallback)(_lodash.default.debounce(setSearchValue, 300), [setSearchValue]);
|
|
909
|
+
if (!setSearchValue) {
|
|
910
|
+
(0, _client.error)('useCollectionDataSourceItems: please use in SchemaInitializerButtonContext and provide setSearchValue');
|
|
911
|
+
return [];
|
|
912
|
+
}
|
|
897
913
|
var clearKeywords = function clearKeywords() {
|
|
898
|
-
|
|
899
|
-
onChange(null);
|
|
914
|
+
setSearchValue('');
|
|
900
915
|
};
|
|
901
916
|
return [{
|
|
902
917
|
key: 'tableBlock',
|
|
903
918
|
type: 'itemGroup',
|
|
904
919
|
title: /*#__PURE__*/_react2.default.createElement(_SelectCollection.SelectCollection, {
|
|
905
|
-
value:
|
|
906
|
-
onChange: onChange
|
|
907
|
-
setSelected: setSelected
|
|
920
|
+
value: searchValue,
|
|
921
|
+
onChange: onChange
|
|
908
922
|
}),
|
|
909
923
|
children: collections === null || collections === void 0 ? void 0 : (_collections$filter = collections.filter(function (item) {
|
|
910
|
-
var b = !value || selected.includes(item.name);
|
|
911
924
|
if (item.inherit) {
|
|
912
925
|
return false;
|
|
913
926
|
}
|
|
@@ -921,7 +934,10 @@ var useCollectionDataSourceItems = function useCollectionDataSourceItems(compone
|
|
|
921
934
|
} else if (item.template === 'file' && ['Kanban', 'FormItem', 'Calendar'].includes(componentName)) {
|
|
922
935
|
return false;
|
|
923
936
|
} else {
|
|
924
|
-
|
|
937
|
+
if (!item.title) {
|
|
938
|
+
return false;
|
|
939
|
+
}
|
|
940
|
+
return item.title.toUpperCase().includes(searchValue.toUpperCase()) && !((item === null || item === void 0 ? void 0 : item.isThrough) && (item === null || item === void 0 ? void 0 : item.autoCreate));
|
|
925
941
|
}
|
|
926
942
|
})) === null || _collections$filter === void 0 ? void 0 : _collections$filter.map(function (item, index) {
|
|
927
943
|
var templates = getTemplatesByCollection(item.name).filter(function (template) {
|
|
@@ -20,6 +20,7 @@ var _reactI18next = require("react-i18next");
|
|
|
20
20
|
var _2 = require("..");
|
|
21
21
|
var _hooks = require("../block-provider/hooks");
|
|
22
22
|
var _utils = require("../filter-provider/utils");
|
|
23
|
+
var _useMenuItem4 = require("../hooks/useMenuItem");
|
|
23
24
|
var _utilts = require("../schema-component/antd/association-filter/utilts");
|
|
24
25
|
var _schemaTemplates = require("../schema-templates");
|
|
25
26
|
var _BlockTemplate = require("../schema-templates/BlockTemplate");
|
|
@@ -47,13 +48,13 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
47
48
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
48
49
|
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); } }
|
|
49
50
|
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); }); }; }
|
|
50
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
51
51
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
52
52
|
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."); }
|
|
53
53
|
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); }
|
|
54
54
|
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; }
|
|
55
55
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
56
56
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
57
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
57
58
|
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; }
|
|
58
59
|
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; }
|
|
59
60
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -84,6 +85,7 @@ var SchemaSettingsProvider = function SchemaSettingsProvider(props) {
|
|
|
84
85
|
}, children);
|
|
85
86
|
};
|
|
86
87
|
exports.SchemaSettingsProvider = SchemaSettingsProvider;
|
|
88
|
+
var overlayClassName = (0, _classnames.default)('nb-schema-initializer-button-overlay', (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-dropdown-menu-item-group-list {\n max-height: 40vh;\n overflow: auto;\n }\n "]))));
|
|
87
89
|
var SchemaSettings = function SchemaSettings(props) {
|
|
88
90
|
var title = props.title,
|
|
89
91
|
dn = props.dn,
|
|
@@ -92,22 +94,44 @@ var SchemaSettings = function SchemaSettings(props) {
|
|
|
92
94
|
_useState2 = _slicedToArray(_useState, 2),
|
|
93
95
|
visible = _useState2[0],
|
|
94
96
|
setVisible = _useState2[1];
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
var _useMenuItem = (0, _useMenuItem4.useMenuItem)(),
|
|
98
|
+
Component = _useMenuItem.Component,
|
|
99
|
+
getMenuItems = _useMenuItem.getMenuItems;
|
|
100
|
+
var _useState3 = (0, _react2.useState)(false),
|
|
101
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
102
|
+
shouldRender = _useState4[0],
|
|
103
|
+
setShouldRender = _useState4[1];
|
|
104
|
+
if (!shouldRender) {
|
|
105
|
+
return /*#__PURE__*/_react2.default.createElement("div", {
|
|
106
|
+
onMouseEnter: function onMouseEnter() {
|
|
107
|
+
setShouldRender(true);
|
|
108
|
+
setVisible(true);
|
|
109
|
+
}
|
|
110
|
+
}, typeof title === 'string' ? /*#__PURE__*/_react2.default.createElement("span", null, title) : title);
|
|
111
|
+
}
|
|
112
|
+
var dropdownMenu = function dropdownMenu() {
|
|
113
|
+
return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement(Component, null), /*#__PURE__*/_react2.default.createElement(_antd2.Dropdown, {
|
|
114
|
+
open: visible,
|
|
115
|
+
onOpenChange: function onOpenChange() {
|
|
116
|
+
setShouldRender(false);
|
|
117
|
+
setVisible(false);
|
|
118
|
+
},
|
|
119
|
+
menu: {
|
|
120
|
+
items: getMenuItems(function () {
|
|
121
|
+
return props.children;
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
overlayClassName: overlayClassName
|
|
125
|
+
}, typeof title === 'string' ? /*#__PURE__*/_react2.default.createElement("span", null, title) : title));
|
|
126
|
+
};
|
|
103
127
|
if (dn) {
|
|
104
128
|
return /*#__PURE__*/_react2.default.createElement(SchemaSettingsProvider, _objectSpread({
|
|
105
129
|
visible: visible,
|
|
106
130
|
setVisible: setVisible,
|
|
107
131
|
dn: dn
|
|
108
|
-
}, others),
|
|
132
|
+
}, others), dropdownMenu());
|
|
109
133
|
}
|
|
110
|
-
return
|
|
134
|
+
return dropdownMenu();
|
|
111
135
|
};
|
|
112
136
|
exports.SchemaSettings = SchemaSettings;
|
|
113
137
|
SchemaSettings.Template = function Template(props) {
|
|
@@ -461,14 +485,17 @@ SchemaSettings.FormItemTemplate = function FormItemTemplate(props) {
|
|
|
461
485
|
}, t('Save as block template'));
|
|
462
486
|
};
|
|
463
487
|
SchemaSettings.Item = function Item(props) {
|
|
488
|
+
var _useCollectMenuItems = (0, _useMenuItem4.useCollectMenuItems)(),
|
|
489
|
+
pushMenuItem = _useCollectMenuItems.pushMenuItem;
|
|
490
|
+
var _useCollectMenuItem = (0, _useMenuItem4.useCollectMenuItem)(),
|
|
491
|
+
collectMenuItem = _useCollectMenuItem.collectMenuItem;
|
|
464
492
|
var eventKey = props.eventKey;
|
|
465
493
|
var key = (0, _react2.useMemo)(function () {
|
|
466
494
|
return (0, _shared.uid)();
|
|
467
495
|
}, []);
|
|
468
|
-
|
|
496
|
+
var item = _objectSpread(_objectSpread({}, _lodash.default.omit(props, ['children'])), {}, {
|
|
469
497
|
key: key,
|
|
470
|
-
eventKey: eventKey || key
|
|
471
|
-
}, props), {}, {
|
|
498
|
+
eventKey: eventKey || key,
|
|
472
499
|
onClick: function onClick(info) {
|
|
473
500
|
var _props$onClick;
|
|
474
501
|
info.domEvent.preventDefault();
|
|
@@ -477,17 +504,67 @@ SchemaSettings.Item = function Item(props) {
|
|
|
477
504
|
},
|
|
478
505
|
style: {
|
|
479
506
|
minWidth: 120
|
|
480
|
-
}
|
|
481
|
-
|
|
507
|
+
},
|
|
508
|
+
label: props.children || props.title,
|
|
509
|
+
title: props.title
|
|
510
|
+
});
|
|
511
|
+
pushMenuItem === null || pushMenuItem === void 0 ? void 0 : pushMenuItem(item);
|
|
512
|
+
collectMenuItem === null || collectMenuItem === void 0 ? void 0 : collectMenuItem(item);
|
|
513
|
+
return null;
|
|
482
514
|
};
|
|
483
|
-
SchemaSettings.ItemGroup = function (props) {
|
|
484
|
-
|
|
515
|
+
SchemaSettings.ItemGroup = function ItemGroup(props) {
|
|
516
|
+
var _useMenuItem2 = (0, _useMenuItem4.useMenuItem)(),
|
|
517
|
+
Component = _useMenuItem2.Component,
|
|
518
|
+
getMenuItems = _useMenuItem2.getMenuItems;
|
|
519
|
+
var _useCollectMenuItems2 = (0, _useMenuItem4.useCollectMenuItems)(),
|
|
520
|
+
pushMenuItem = _useCollectMenuItems2.pushMenuItem;
|
|
521
|
+
var key = (0, _react2.useMemo)(function () {
|
|
522
|
+
return (0, _shared.uid)();
|
|
523
|
+
}, []);
|
|
524
|
+
var item = {
|
|
525
|
+
key: key,
|
|
526
|
+
type: 'group',
|
|
527
|
+
title: props.title,
|
|
528
|
+
label: props.title,
|
|
529
|
+
children: getMenuItems(function () {
|
|
530
|
+
return props.children;
|
|
531
|
+
})
|
|
532
|
+
};
|
|
533
|
+
pushMenuItem(item);
|
|
534
|
+
return /*#__PURE__*/_react2.default.createElement(Component, null);
|
|
485
535
|
};
|
|
486
|
-
SchemaSettings.SubMenu = function (props) {
|
|
487
|
-
|
|
536
|
+
SchemaSettings.SubMenu = function SubMenu(props) {
|
|
537
|
+
var _useMenuItem3 = (0, _useMenuItem4.useMenuItem)(),
|
|
538
|
+
Component = _useMenuItem3.Component,
|
|
539
|
+
getMenuItems = _useMenuItem3.getMenuItems;
|
|
540
|
+
var _useCollectMenuItems3 = (0, _useMenuItem4.useCollectMenuItems)(),
|
|
541
|
+
pushMenuItem = _useCollectMenuItems3.pushMenuItem;
|
|
542
|
+
var key = (0, _react2.useMemo)(function () {
|
|
543
|
+
return (0, _shared.uid)();
|
|
544
|
+
}, []);
|
|
545
|
+
var item = {
|
|
546
|
+
key: key,
|
|
547
|
+
label: props.title,
|
|
548
|
+
title: props.title,
|
|
549
|
+
children: getMenuItems(function () {
|
|
550
|
+
return props.children;
|
|
551
|
+
})
|
|
552
|
+
};
|
|
553
|
+
pushMenuItem(item);
|
|
554
|
+
return /*#__PURE__*/_react2.default.createElement(Component, null);
|
|
488
555
|
};
|
|
489
|
-
SchemaSettings.Divider = function (
|
|
490
|
-
|
|
556
|
+
SchemaSettings.Divider = function Divider() {
|
|
557
|
+
var _useCollectMenuItems4 = (0, _useMenuItem4.useCollectMenuItems)(),
|
|
558
|
+
pushMenuItem = _useCollectMenuItems4.pushMenuItem;
|
|
559
|
+
var key = (0, _react2.useMemo)(function () {
|
|
560
|
+
return (0, _shared.uid)();
|
|
561
|
+
}, []);
|
|
562
|
+
var item = {
|
|
563
|
+
key: key,
|
|
564
|
+
type: 'divider'
|
|
565
|
+
};
|
|
566
|
+
pushMenuItem(item);
|
|
567
|
+
return null;
|
|
491
568
|
};
|
|
492
569
|
SchemaSettings.Remove = function Remove(props) {
|
|
493
570
|
var confirm = props.confirm,
|
|
@@ -541,6 +618,7 @@ SchemaSettings.ConnectDataBlocks = function ConnectDataBlocks(props) {
|
|
|
541
618
|
var _useFilterBlock = (0, _2.useFilterBlock)(),
|
|
542
619
|
inProvider = _useFilterBlock.inProvider;
|
|
543
620
|
var dataBlocks = (0, _utils.useSupportedBlocks)(type);
|
|
621
|
+
// eslint-disable-next-line prefer-const
|
|
544
622
|
var _findFilterTargets = (0, _hooks.findFilterTargets)(fieldSchema),
|
|
545
623
|
_findFilterTargets$ta = _findFilterTargets.targets,
|
|
546
624
|
targets = _findFilterTargets$ta === void 0 ? [] : _findFilterTargets$ta,
|
|
@@ -650,14 +728,14 @@ SchemaSettings.ConnectDataBlocks = function ConnectDataBlocks(props) {
|
|
|
650
728
|
});
|
|
651
729
|
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.SubMenu, {
|
|
652
730
|
title: t('Connect data blocks')
|
|
653
|
-
}, Content.length ? Content : /*#__PURE__*/_react2.default.createElement(_antd2.Empty, {
|
|
731
|
+
}, Content.length ? Content : /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, null, /*#__PURE__*/_react2.default.createElement(_antd2.Empty, {
|
|
654
732
|
style: {
|
|
655
733
|
width: 160,
|
|
656
734
|
padding: '0 1em'
|
|
657
735
|
},
|
|
658
736
|
description: emptyDescription,
|
|
659
737
|
image: _antd2.Empty.PRESENTED_IMAGE_SIMPLE
|
|
660
|
-
}));
|
|
738
|
+
})));
|
|
661
739
|
};
|
|
662
740
|
SchemaSettings.SelectItem = function SelectItem(props) {
|
|
663
741
|
var title = props.title,
|
|
@@ -667,10 +745,10 @@ SchemaSettings.SelectItem = function SelectItem(props) {
|
|
|
667
745
|
openOnHover = props.openOnHover,
|
|
668
746
|
_onClick = props.onClick,
|
|
669
747
|
others = _objectWithoutProperties(props, _excluded3);
|
|
670
|
-
var
|
|
671
|
-
|
|
672
|
-
open =
|
|
673
|
-
setOpen =
|
|
748
|
+
var _useState5 = (0, _react2.useState)(false),
|
|
749
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
750
|
+
open = _useState6[0],
|
|
751
|
+
setOpen = _useState6[1];
|
|
674
752
|
var onClick = function onClick() {
|
|
675
753
|
setOpen(false);
|
|
676
754
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -734,10 +812,10 @@ SchemaSettings.SwitchItem = function SwitchItem(props) {
|
|
|
734
812
|
var title = props.title,
|
|
735
813
|
onChange = props.onChange,
|
|
736
814
|
others = _objectWithoutProperties(props, _excluded5);
|
|
737
|
-
var
|
|
738
|
-
|
|
739
|
-
checked =
|
|
740
|
-
setChecked =
|
|
815
|
+
var _useState7 = (0, _react2.useState)(!!props.checked),
|
|
816
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
817
|
+
checked = _useState8[0],
|
|
818
|
+
setChecked = _useState8[1];
|
|
741
819
|
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, _objectSpread(_objectSpread({}, others), {}, {
|
|
742
820
|
onClick: function onClick() {
|
|
743
821
|
onChange === null || onChange === void 0 ? void 0 : onChange(!checked);
|
|
@@ -760,10 +838,10 @@ SchemaSettings.SwitchItem = function SwitchItem(props) {
|
|
|
760
838
|
SchemaSettings.PopupItem = function PopupItem(props) {
|
|
761
839
|
var schema = props.schema,
|
|
762
840
|
others = _objectWithoutProperties(props, _excluded6);
|
|
763
|
-
var
|
|
764
|
-
|
|
765
|
-
visible =
|
|
766
|
-
setVisible =
|
|
841
|
+
var _useState9 = (0, _react2.useState)(false),
|
|
842
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
843
|
+
visible = _useState10[0],
|
|
844
|
+
setVisible = _useState10[1];
|
|
767
845
|
var ctx = (0, _react2.useContext)(SchemaSettingsContext);
|
|
768
846
|
return /*#__PURE__*/_react2.default.createElement(_2.ActionContextProvider, {
|
|
769
847
|
value: {
|
|
@@ -791,14 +869,14 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
|
|
|
791
869
|
modalTip = props.modalTip,
|
|
792
870
|
components = props.components,
|
|
793
871
|
others = _objectWithoutProperties(props, _excluded7);
|
|
794
|
-
var
|
|
795
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
796
|
-
visible = _useState10[0],
|
|
797
|
-
setVisible = _useState10[1];
|
|
798
|
-
var _useState11 = (0, _react2.useState)(props.uid),
|
|
872
|
+
var _useState11 = (0, _react2.useState)(false),
|
|
799
873
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
800
|
-
|
|
801
|
-
|
|
874
|
+
visible = _useState12[0],
|
|
875
|
+
setVisible = _useState12[1];
|
|
876
|
+
var _useState13 = (0, _react2.useState)(props.uid),
|
|
877
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
878
|
+
schemaUid = _useState14[0],
|
|
879
|
+
setSchemaUid = _useState14[1];
|
|
802
880
|
var _useTranslation5 = (0, _reactI18next.useTranslation)(),
|
|
803
881
|
t = _useTranslation5.t;
|
|
804
882
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
@@ -885,7 +963,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
|
|
|
885
963
|
title: compile(title)
|
|
886
964
|
}, others), {}, {
|
|
887
965
|
destroyOnClose: true,
|
|
888
|
-
|
|
966
|
+
open: visible,
|
|
889
967
|
onCancel: cancelHandler,
|
|
890
968
|
footer: /*#__PURE__*/_react2.default.createElement(_antd2.Space, null, /*#__PURE__*/_react2.default.createElement(_antd2.Button, {
|
|
891
969
|
onClick: cancelHandler
|
|
@@ -1265,7 +1343,6 @@ SchemaSettings.EnableChildCollections = function EnableChildCollectionsItem(prop
|
|
|
1265
1343
|
ArrayItems: _antd.ArrayItems,
|
|
1266
1344
|
FormLayout: _antd.FormLayout
|
|
1267
1345
|
},
|
|
1268
|
-
width: 600,
|
|
1269
1346
|
schema: {
|
|
1270
1347
|
type: 'object',
|
|
1271
1348
|
title: t('Enable child collections'),
|