@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
|
@@ -65,7 +65,7 @@ var percent = {
|
|
|
65
65
|
'x-component': 'Percent',
|
|
66
66
|
'x-component-props': {
|
|
67
67
|
stringMode: true,
|
|
68
|
-
step: '
|
|
68
|
+
step: '1',
|
|
69
69
|
addonAfter: '%'
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -89,9 +89,9 @@ var percent = {
|
|
|
89
89
|
title: '{{t("Precision")}}',
|
|
90
90
|
'x-component': 'Select',
|
|
91
91
|
'x-decorator': 'FormItem',
|
|
92
|
-
default: '
|
|
92
|
+
default: '1',
|
|
93
93
|
enum: [{
|
|
94
|
-
value: '
|
|
94
|
+
value: '1',
|
|
95
95
|
label: '1%'
|
|
96
96
|
}, {
|
|
97
97
|
value: '0.1',
|
|
@@ -105,18 +105,26 @@ var Expression = function Expression(props) {
|
|
|
105
105
|
_useState2 = _slicedToArray(_useState, 2),
|
|
106
106
|
changed = _useState2[0],
|
|
107
107
|
setChanged = _useState2[1];
|
|
108
|
-
var onChange = function
|
|
108
|
+
var onChange = (0, _react2.useCallback)(function (value) {
|
|
109
109
|
setChanged(true);
|
|
110
110
|
props.onChange(value);
|
|
111
|
-
};
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
}, [props.onChange]);
|
|
112
|
+
var _useMemo = (0, _react2.useMemo)(function () {
|
|
113
|
+
var numColumns = new Map();
|
|
114
|
+
var scope = {};
|
|
115
|
+
fields.filter(function (field) {
|
|
116
|
+
return supports.includes(field.interface);
|
|
117
|
+
}).forEach(function (field) {
|
|
118
|
+
numColumns.set(field.name, field.uiSchema.title);
|
|
119
|
+
scope[field.name] = 1;
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
numColumns: numColumns,
|
|
123
|
+
scope: scope
|
|
124
|
+
};
|
|
125
|
+
}, [fields, supports]),
|
|
126
|
+
numColumns = _useMemo.numColumns,
|
|
127
|
+
scope = _useMemo.scope;
|
|
120
128
|
var keys = Array.from(numColumns.keys());
|
|
121
129
|
var _useState3 = (0, _react2.useState)(function () {
|
|
122
130
|
var scope = {};
|
|
@@ -143,39 +151,51 @@ var Expression = function Expression(props) {
|
|
|
143
151
|
var val = renderExp(value || '', scope);
|
|
144
152
|
setHtml(val);
|
|
145
153
|
}, [value]);
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
154
|
+
var menuItems = (0, _react2.useMemo)(function () {
|
|
155
|
+
if (keys.length > 0) {
|
|
156
|
+
return keys.map(function (key) {
|
|
157
|
+
return {
|
|
158
|
+
key: key,
|
|
159
|
+
disabled: true,
|
|
160
|
+
label: /*#__PURE__*/_react2.default.createElement("button", {
|
|
161
|
+
onClick: function () {
|
|
162
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args) {
|
|
163
|
+
var val, text;
|
|
164
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
165
|
+
while (1) switch (_context.prev = _context.next) {
|
|
166
|
+
case 0:
|
|
167
|
+
inputRef.current.focus();
|
|
168
|
+
val = numColumns.get(key);
|
|
169
|
+
pasteHtml(" <span class=\"ant-tag\" style=\"margin: 0 3px;\" contentEditable=\"false\" data-key=\"".concat(key, "\">").concat(val, "</span> "));
|
|
170
|
+
text = getValue(inputRef.current);
|
|
171
|
+
onChange(text);
|
|
172
|
+
case 5:
|
|
173
|
+
case "end":
|
|
174
|
+
return _context.stop();
|
|
175
|
+
}
|
|
176
|
+
}, _callee);
|
|
177
|
+
}));
|
|
178
|
+
function onClick(_x2) {
|
|
179
|
+
return _onClick.apply(this, arguments);
|
|
180
|
+
}
|
|
181
|
+
return onClick;
|
|
182
|
+
}()
|
|
183
|
+
}, numColumns.get(key))
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
return [{
|
|
188
|
+
key: 0,
|
|
189
|
+
disabled: true,
|
|
190
|
+
label: t('No available fields')
|
|
191
|
+
}];
|
|
192
|
+
}
|
|
193
|
+
}, [keys, numColumns, onChange]);
|
|
194
|
+
var menu = (0, _react2.useMemo)(function () {
|
|
195
|
+
return {
|
|
196
|
+
items: menuItems
|
|
197
|
+
};
|
|
198
|
+
}, [menuItems]);
|
|
179
199
|
(0, _react.useFormEffects)(function () {
|
|
180
200
|
(0, _core.onFormSubmitValidateStart)(function () {
|
|
181
201
|
try {
|
|
@@ -193,7 +213,7 @@ var Expression = function Expression(props) {
|
|
|
193
213
|
});
|
|
194
214
|
return /*#__PURE__*/_react2.default.createElement(_antd.Dropdown, {
|
|
195
215
|
trigger: ['click'],
|
|
196
|
-
|
|
216
|
+
menu: menu,
|
|
197
217
|
overlayClassName: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-dropdown-menu-item {\n padding: 0;\n }\n button {\n cursor: pointer;\n padding: 5px 12px;\n text-align: left;\n color: rgba(0, 0, 0, 0.85);\n width: 100%;\n line-height: inherit;\n height: auto;\n border: 0px;\n background-color: transparent;\n &:hover {\n background-color: #f5f5f5;\n }\n }\n "])))
|
|
198
218
|
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
199
219
|
onKeyDown: function onKeyDown(e) {
|
package/lib/hooks/index.d.ts
CHANGED
package/lib/hooks/index.js
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _useAdminSchemaUid = require("./useAdminSchemaUid");
|
|
7
|
+
Object.keys(_useAdminSchemaUid).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _useAdminSchemaUid[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _useAdminSchemaUid[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
6
17
|
var _useViewport = require("./useViewport");
|
|
7
18
|
Object.keys(_useViewport).forEach(function (key) {
|
|
8
19
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAdminSchemaUid: () => any;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAdminSchemaUid = void 0;
|
|
7
|
+
var _systemSettings = require("../system-settings");
|
|
8
|
+
var useAdminSchemaUid = function useAdminSchemaUid() {
|
|
9
|
+
var _ctx$data, _ctx$data$data, _ctx$data$data$option;
|
|
10
|
+
var ctx = (0, _systemSettings.useSystemSettings)();
|
|
11
|
+
return ctx === null || ctx === void 0 ? void 0 : (_ctx$data = ctx.data) === null || _ctx$data === void 0 ? void 0 : (_ctx$data$data = _ctx$data.data) === null || _ctx$data$data === void 0 ? void 0 : (_ctx$data$data$option = _ctx$data$data.options) === null || _ctx$data$data$option === void 0 ? void 0 : _ctx$data$data$option.adminSchemaUid;
|
|
12
|
+
};
|
|
13
|
+
exports.useAdminSchemaUid = useAdminSchemaUid;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MenuProps } from 'antd';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
declare type Item = MenuProps['items'][0] & {
|
|
4
|
+
/** 在清空数组时,如果该字段为 true 则保留该选项 */
|
|
5
|
+
notdelete?: boolean;
|
|
6
|
+
/** 用于给列表排序 */
|
|
7
|
+
order?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const GetMenuItemContext: React.Context<{
|
|
10
|
+
collectMenuItem?(item: Item): void;
|
|
11
|
+
onChange?: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const GetMenuItemsContext: React.Context<{
|
|
14
|
+
pushMenuItem?(item: Item): void;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* 用于为 SchemaInitializer.Item 组件提供一些方法,比如收集菜单项数据
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare const useCollectMenuItem: () => {
|
|
21
|
+
collectMenuItem?(item: Item): void;
|
|
22
|
+
onChange?: () => void;
|
|
23
|
+
};
|
|
24
|
+
export declare const useCollectMenuItems: () => {
|
|
25
|
+
pushMenuItem?(item: Item): void;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 用于在 antd 从 4.x 升级到 5.x 中,用于把 SchemaInitializer.Item 组件这种写法转换成 Menu 组件的 items 写法
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export declare const useMenuItem: () => {
|
|
32
|
+
Component: () => React.JSX.Element;
|
|
33
|
+
getMenuItems: (Com: () => ReactNode) => Item[];
|
|
34
|
+
getMenuItem: (Com: () => JSX.Element) => Item;
|
|
35
|
+
clean: () => void;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useMenuItem = exports.useCollectMenuItems = exports.useCollectMenuItem = exports.GetMenuItemsContext = exports.GetMenuItemContext = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
+
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; }
|
|
17
|
+
var GetMenuItemContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
18
|
+
exports.GetMenuItemContext = GetMenuItemContext;
|
|
19
|
+
var GetMenuItemsContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
20
|
+
/**
|
|
21
|
+
* 用于为 SchemaInitializer.Item 组件提供一些方法,比如收集菜单项数据
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
exports.GetMenuItemsContext = GetMenuItemsContext;
|
|
25
|
+
var useCollectMenuItem = function useCollectMenuItem() {
|
|
26
|
+
return (0, _react.useContext)(GetMenuItemContext) || {};
|
|
27
|
+
};
|
|
28
|
+
exports.useCollectMenuItem = useCollectMenuItem;
|
|
29
|
+
var useCollectMenuItems = function useCollectMenuItems() {
|
|
30
|
+
return (0, _react.useContext)(GetMenuItemsContext) || {};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* 用于在 antd 从 4.x 升级到 5.x 中,用于把 SchemaInitializer.Item 组件这种写法转换成 Menu 组件的 items 写法
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
exports.useCollectMenuItems = useCollectMenuItems;
|
|
37
|
+
var useMenuItem = function useMenuItem() {
|
|
38
|
+
var list = (0, _react.useRef)([]);
|
|
39
|
+
var renderItems = (0, _react.useRef)(null);
|
|
40
|
+
var shouldRerender = (0, _react.useRef)(false);
|
|
41
|
+
var Component = (0, _react.useCallback)(function () {
|
|
42
|
+
if (!shouldRerender.current) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
shouldRerender.current = false;
|
|
46
|
+
if (renderItems.current) {
|
|
47
|
+
return renderItems.current();
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, list.current.map(function (Com, index) {
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(Com, {
|
|
51
|
+
key: index
|
|
52
|
+
});
|
|
53
|
+
}));
|
|
54
|
+
}, []);
|
|
55
|
+
var getMenuItems = (0, _react.useCallback)(function (Com) {
|
|
56
|
+
var items = [];
|
|
57
|
+
var pushMenuItem = function pushMenuItem(item) {
|
|
58
|
+
items.push(item);
|
|
59
|
+
items.sort(function (a, b) {
|
|
60
|
+
return (a.order || 0) - (b.order || 0);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
shouldRerender.current = true;
|
|
64
|
+
renderItems.current = function () {
|
|
65
|
+
var notDeleteItems = items.filter(function (item) {
|
|
66
|
+
return item.notdelete;
|
|
67
|
+
});
|
|
68
|
+
items.length = 0;
|
|
69
|
+
items.push.apply(items, _toConsumableArray(notDeleteItems));
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(GetMenuItemsContext.Provider, {
|
|
71
|
+
value: {
|
|
72
|
+
pushMenuItem: pushMenuItem
|
|
73
|
+
}
|
|
74
|
+
}, Com());
|
|
75
|
+
};
|
|
76
|
+
return items;
|
|
77
|
+
}, []);
|
|
78
|
+
var getMenuItem = (0, _react.useCallback)(function (Com) {
|
|
79
|
+
var item = {};
|
|
80
|
+
var collectMenuItem = function collectMenuItem(menuItem) {
|
|
81
|
+
Object.assign(item, menuItem);
|
|
82
|
+
};
|
|
83
|
+
shouldRerender.current = true;
|
|
84
|
+
list.current.push(function () {
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement(GetMenuItemContext.Provider, {
|
|
86
|
+
value: {
|
|
87
|
+
collectMenuItem: collectMenuItem
|
|
88
|
+
}
|
|
89
|
+
}, Com());
|
|
90
|
+
});
|
|
91
|
+
return item;
|
|
92
|
+
}, []);
|
|
93
|
+
// 防止 list 有重复元素
|
|
94
|
+
var clean = (0, _react.useCallback)(function () {
|
|
95
|
+
list.current = [];
|
|
96
|
+
}, []);
|
|
97
|
+
return {
|
|
98
|
+
Component: Component,
|
|
99
|
+
getMenuItems: getMenuItems,
|
|
100
|
+
getMenuItem: getMenuItem,
|
|
101
|
+
clean: clean
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
exports.useMenuItem = useMenuItem;
|
package/lib/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './collection-manager';
|
|
|
13
13
|
export * from './document-title';
|
|
14
14
|
export * from './filter-provider';
|
|
15
15
|
export * from './formula';
|
|
16
|
+
export * from './hooks';
|
|
16
17
|
export * from './i18n';
|
|
17
18
|
export * from './icon';
|
|
18
19
|
export * from './plugin-manager';
|
|
@@ -22,10 +23,8 @@ export * from './record-provider';
|
|
|
22
23
|
export * from './route-switch';
|
|
23
24
|
export * from './schema-component';
|
|
24
25
|
export * from './schema-initializer';
|
|
26
|
+
export * from './schema-items';
|
|
25
27
|
export * from './schema-settings';
|
|
26
28
|
export * from './schema-templates';
|
|
27
|
-
export * from './schema-items';
|
|
28
|
-
export * from './settings-form';
|
|
29
29
|
export * from './system-settings';
|
|
30
30
|
export * from './user';
|
|
31
|
-
export * from './hooks';
|
package/lib/index.js
CHANGED
|
@@ -158,6 +158,17 @@ Object.keys(_formula).forEach(function (key) {
|
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
|
+
var _hooks = require("./hooks");
|
|
162
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
163
|
+
if (key === "default" || key === "__esModule") return;
|
|
164
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
165
|
+
Object.defineProperty(exports, key, {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
get: function get() {
|
|
168
|
+
return _hooks[key];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
161
172
|
var _i18n = require("./i18n");
|
|
162
173
|
Object.keys(_i18n).forEach(function (key) {
|
|
163
174
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -257,6 +268,17 @@ Object.keys(_schemaInitializer).forEach(function (key) {
|
|
|
257
268
|
}
|
|
258
269
|
});
|
|
259
270
|
});
|
|
271
|
+
var _schemaItems = require("./schema-items");
|
|
272
|
+
Object.keys(_schemaItems).forEach(function (key) {
|
|
273
|
+
if (key === "default" || key === "__esModule") return;
|
|
274
|
+
if (key in exports && exports[key] === _schemaItems[key]) return;
|
|
275
|
+
Object.defineProperty(exports, key, {
|
|
276
|
+
enumerable: true,
|
|
277
|
+
get: function get() {
|
|
278
|
+
return _schemaItems[key];
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
});
|
|
260
282
|
var _schemaSettings = require("./schema-settings");
|
|
261
283
|
Object.keys(_schemaSettings).forEach(function (key) {
|
|
262
284
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -279,28 +301,6 @@ Object.keys(_schemaTemplates).forEach(function (key) {
|
|
|
279
301
|
}
|
|
280
302
|
});
|
|
281
303
|
});
|
|
282
|
-
var _schemaItems = require("./schema-items");
|
|
283
|
-
Object.keys(_schemaItems).forEach(function (key) {
|
|
284
|
-
if (key === "default" || key === "__esModule") return;
|
|
285
|
-
if (key in exports && exports[key] === _schemaItems[key]) return;
|
|
286
|
-
Object.defineProperty(exports, key, {
|
|
287
|
-
enumerable: true,
|
|
288
|
-
get: function get() {
|
|
289
|
-
return _schemaItems[key];
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
var _settingsForm = require("./settings-form");
|
|
294
|
-
Object.keys(_settingsForm).forEach(function (key) {
|
|
295
|
-
if (key === "default" || key === "__esModule") return;
|
|
296
|
-
if (key in exports && exports[key] === _settingsForm[key]) return;
|
|
297
|
-
Object.defineProperty(exports, key, {
|
|
298
|
-
enumerable: true,
|
|
299
|
-
get: function get() {
|
|
300
|
-
return _settingsForm[key];
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
});
|
|
304
304
|
var _systemSettings = require("./system-settings");
|
|
305
305
|
Object.keys(_systemSettings).forEach(function (key) {
|
|
306
306
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -322,15 +322,4 @@ Object.keys(_user).forEach(function (key) {
|
|
|
322
322
|
return _user[key];
|
|
323
323
|
}
|
|
324
324
|
});
|
|
325
|
-
});
|
|
326
|
-
var _hooks = require("./hooks");
|
|
327
|
-
Object.keys(_hooks).forEach(function (key) {
|
|
328
|
-
if (key === "default" || key === "__esModule") return;
|
|
329
|
-
if (key in exports && exports[key] === _hooks[key]) return;
|
|
330
|
-
Object.defineProperty(exports, key, {
|
|
331
|
-
enumerable: true,
|
|
332
|
-
get: function get() {
|
|
333
|
-
return _hooks[key];
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
325
|
});
|
package/lib/locale/en_US.d.ts
CHANGED
|
@@ -294,7 +294,7 @@ declare const _default: {
|
|
|
294
294
|
"Quick upload": string;
|
|
295
295
|
"Select file": string;
|
|
296
296
|
Subtable: string;
|
|
297
|
-
|
|
297
|
+
"Sub-form": string;
|
|
298
298
|
"Field mode": string;
|
|
299
299
|
"Allow add new data": string;
|
|
300
300
|
"Record picker": string;
|
|
@@ -704,5 +704,7 @@ declare const _default: {
|
|
|
704
704
|
"Update or create": string;
|
|
705
705
|
"Find by the following fields": string;
|
|
706
706
|
Create: string;
|
|
707
|
+
"Current form": string;
|
|
708
|
+
"Current object": string;
|
|
707
709
|
};
|
|
708
710
|
export default _default;
|
package/lib/locale/en_US.js
CHANGED
|
@@ -300,7 +300,7 @@ var _default = {
|
|
|
300
300
|
"Quick upload": "Quick upload",
|
|
301
301
|
"Select file": "Select file",
|
|
302
302
|
"Subtable": "Sub-table",
|
|
303
|
-
"
|
|
303
|
+
"Sub-form": "Sub-form",
|
|
304
304
|
"Field mode": "Field mode",
|
|
305
305
|
"Allow add new data": "Allow add new data",
|
|
306
306
|
"Record picker": "Record picker",
|
|
@@ -709,6 +709,8 @@ var _default = {
|
|
|
709
709
|
"First or create": "First or create",
|
|
710
710
|
"Update or create": "Update or create",
|
|
711
711
|
"Find by the following fields": "Find by the following fields",
|
|
712
|
-
"Create": "Create"
|
|
712
|
+
"Create": "Create",
|
|
713
|
+
"Current form": "Current form",
|
|
714
|
+
"Current object": "Current object"
|
|
713
715
|
};
|
|
714
716
|
exports.default = _default;
|
package/lib/locale/es_ES.d.ts
CHANGED
|
@@ -280,7 +280,7 @@ declare const _default: {
|
|
|
280
280
|
"Display field title": string;
|
|
281
281
|
"Field component": string;
|
|
282
282
|
Subtable: string;
|
|
283
|
-
|
|
283
|
+
"Sub-form": string;
|
|
284
284
|
"Record picker": string;
|
|
285
285
|
"Toggles the subfield mode": string;
|
|
286
286
|
"Selector mode": string;
|
package/lib/locale/es_ES.js
CHANGED
|
@@ -286,7 +286,7 @@ var _default = {
|
|
|
286
286
|
"Display field title": "Mostrar título de campo",
|
|
287
287
|
"Field component": "Componente del campo",
|
|
288
288
|
"Subtable": "Subtabla",
|
|
289
|
-
"
|
|
289
|
+
"Sub-form": "Subformulario",
|
|
290
290
|
"Record picker": "Selector de registros",
|
|
291
291
|
"Toggles the subfield mode": "Alterna el modo de subcampo",
|
|
292
292
|
"Selector mode": "Modo selector",
|
package/lib/locale/ja_JP.d.ts
CHANGED
|
@@ -540,7 +540,7 @@ declare const _default: {
|
|
|
540
540
|
"Quick upload": string;
|
|
541
541
|
"Select file": string;
|
|
542
542
|
Subtable: string;
|
|
543
|
-
|
|
543
|
+
"Sub-form": string;
|
|
544
544
|
"Sub-details": string;
|
|
545
545
|
"Field mode": string;
|
|
546
546
|
"Allow add new data": string;
|
|
@@ -612,5 +612,7 @@ declare const _default: {
|
|
|
612
612
|
"Update or create": string;
|
|
613
613
|
"Find by the following fields": string;
|
|
614
614
|
Create: string;
|
|
615
|
+
"Current form": string;
|
|
616
|
+
"Current object": string;
|
|
615
617
|
};
|
|
616
618
|
export default _default;
|
package/lib/locale/ja_JP.js
CHANGED
|
@@ -546,7 +546,7 @@ var _default = {
|
|
|
546
546
|
"Quick upload": "クイックアップロード",
|
|
547
547
|
"Select file": "ファイルを選択",
|
|
548
548
|
"Subtable": "サブテーブル",
|
|
549
|
-
"
|
|
549
|
+
"Sub-form": "サブフォーム",
|
|
550
550
|
"Sub-details": "サブリスト",
|
|
551
551
|
"Field mode": "フィールドコンポーネント",
|
|
552
552
|
"Allow add new data": "データの追加を許可",
|
|
@@ -618,6 +618,8 @@ var _default = {
|
|
|
618
618
|
"First or create": "存在しない場合に追加",
|
|
619
619
|
"Update or create": "存在しなければ新規、存在すれば更新",
|
|
620
620
|
"Find by the following fields": "次のフィールドで検索",
|
|
621
|
-
"Create": "新規のみ"
|
|
621
|
+
"Create": "新規のみ",
|
|
622
|
+
"Current form": "現在のフォーム",
|
|
623
|
+
"Current object": "現在のオブジェクト"
|
|
622
624
|
};
|
|
623
625
|
exports.default = _default;
|
package/lib/locale/pt_BR.d.ts
CHANGED
package/lib/locale/pt_BR.js
CHANGED
|
@@ -250,7 +250,7 @@ var _default = {
|
|
|
250
250
|
"Select file": "Selecionar arquivo",
|
|
251
251
|
"Allow multiple": "Permitir múltiplos",
|
|
252
252
|
"Subtable": "Subtabela",
|
|
253
|
-
"
|
|
253
|
+
"Sub-form": "Subformulário",
|
|
254
254
|
"Record picker": "Selecionador de registros",
|
|
255
255
|
"Toggles the subfield mode": "Alterna o modo de subcampo",
|
|
256
256
|
"Selector mode": "Modo de seleção",
|
package/lib/locale/ru_RU.d.ts
CHANGED
package/lib/locale/ru_RU.js
CHANGED
|
@@ -484,7 +484,7 @@ var _default = {
|
|
|
484
484
|
"Quick upload": "Быстрая загрузка",
|
|
485
485
|
"Select file": "Выбрать файл",
|
|
486
486
|
"Subtable": "Подтаблица",
|
|
487
|
-
"
|
|
487
|
+
"Sub-form": "Подформа",
|
|
488
488
|
"Regular expression": "Образец",
|
|
489
489
|
"Enabled languages": "Включенные языки",
|
|
490
490
|
"View all plugins": "Посмотреть все плагины",
|
package/lib/locale/zh_CN.d.ts
CHANGED
|
@@ -313,7 +313,7 @@ declare const _default: {
|
|
|
313
313
|
"Quick upload": string;
|
|
314
314
|
"Select file": string;
|
|
315
315
|
Subtable: string;
|
|
316
|
-
|
|
316
|
+
"Sub-form": string;
|
|
317
317
|
"Sub-details": string;
|
|
318
318
|
"Record picker": string;
|
|
319
319
|
"Toggles the subfield mode": string;
|
|
@@ -748,6 +748,8 @@ declare const _default: {
|
|
|
748
748
|
"Update or create": string;
|
|
749
749
|
"Find by the following fields": string;
|
|
750
750
|
Create: string;
|
|
751
|
+
"Current form": string;
|
|
752
|
+
"Current object": string;
|
|
751
753
|
"Quick create": string;
|
|
752
754
|
Dropdown: string;
|
|
753
755
|
"Pop-up": string;
|
package/lib/locale/zh_CN.js
CHANGED
|
@@ -319,7 +319,7 @@ var _default = {
|
|
|
319
319
|
"Quick upload": "快速上传",
|
|
320
320
|
"Select file": "选择文件",
|
|
321
321
|
"Subtable": "子表格",
|
|
322
|
-
"
|
|
322
|
+
"Sub-form": "子表单",
|
|
323
323
|
"Sub-details": "子详情",
|
|
324
324
|
"Record picker": "数据选择器",
|
|
325
325
|
"Toggles the subfield mode": "切换子字段模式",
|
|
@@ -755,6 +755,8 @@ var _default = {
|
|
|
755
755
|
"Update or create": "不存在时新增,存在时更新",
|
|
756
756
|
"Find by the following fields": "通过以下字段查找",
|
|
757
757
|
"Create": "仅新增",
|
|
758
|
+
"Current form": "当前表单",
|
|
759
|
+
"Current object": "当前对象",
|
|
758
760
|
"Quick create": "快速创建",
|
|
759
761
|
"Dropdown": "下拉菜单",
|
|
760
762
|
"Pop-up": "弹窗",
|