@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Spin } from 'antd';
|
|
2
2
|
import React, { createContext, useContext } from 'react';
|
|
3
3
|
import { useRequest } from '../../api-client';
|
|
4
|
-
import {
|
|
4
|
+
import { useAdminSchemaUid } from '../../hooks';
|
|
5
5
|
var MenuItemsContext = /*#__PURE__*/createContext(null);
|
|
6
6
|
export var toItems = function toItems() {
|
|
7
7
|
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -26,9 +26,9 @@ export var useMenuItems = function useMenuItems() {
|
|
|
26
26
|
};
|
|
27
27
|
export var MenuItemsProvider = function MenuItemsProvider(props) {
|
|
28
28
|
var _service$data, _service$data$data;
|
|
29
|
-
var
|
|
29
|
+
var adminSchemaUid = useAdminSchemaUid();
|
|
30
30
|
var options = {
|
|
31
|
-
url: "uiSchemas:getProperties/".concat(
|
|
31
|
+
url: "uiSchemas:getProperties/".concat(adminSchemaUid)
|
|
32
32
|
};
|
|
33
33
|
var service = useRequest(options);
|
|
34
34
|
if (service.loading) {
|
|
@@ -29,6 +29,8 @@ import { Link, NavLink } from 'react-router-dom';
|
|
|
29
29
|
import { ACLProvider } from '../acl';
|
|
30
30
|
import { AntdConfigProvider } from '../antd-config-provider';
|
|
31
31
|
import { APIClient, APIClientProvider } from '../api-client';
|
|
32
|
+
import { SigninPage, SignupPage } from '../auth';
|
|
33
|
+
import { SigninPageExtensionProvider } from '../auth/SigninPageExtension';
|
|
32
34
|
import { BlockSchemaComponentProvider } from '../block-provider';
|
|
33
35
|
import { RemoteDocumentTitleProvider } from '../document-title';
|
|
34
36
|
import { i18n } from '../i18n';
|
|
@@ -40,8 +42,6 @@ import { ErrorFallback } from '../schema-component/antd/error-fallback';
|
|
|
40
42
|
import { SchemaInitializerProvider } from '../schema-initializer';
|
|
41
43
|
import { BlockTemplateDetails, BlockTemplatePage } from '../schema-templates';
|
|
42
44
|
import { SystemSettingsProvider } from '../system-settings';
|
|
43
|
-
import { SigninPage, SignupPage } from '../auth';
|
|
44
|
-
import { SigninPageExtensionProvider } from '../auth/SigninPageExtension';
|
|
45
45
|
import { compose } from './compose';
|
|
46
46
|
export var getCurrentTimezone = function getCurrentTimezone() {
|
|
47
47
|
var timezoneOffset = new Date().getTimezoneOffset() / -60;
|
package/es/auth/SigninPage.js
CHANGED
|
@@ -15,14 +15,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
15
15
|
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; }
|
|
16
16
|
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; } }
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
import { Space, Tabs } from 'antd';
|
|
19
|
-
import React, { useCallback, useContext, createContext, createElement, useState } from 'react';
|
|
20
18
|
import { css } from '@emotion/css';
|
|
19
|
+
import { useForm } from '@formily/react';
|
|
20
|
+
import { Space, Tabs } from 'antd';
|
|
21
|
+
import React, { createContext, createElement, useCallback, useContext, useState } from 'react';
|
|
21
22
|
import { useTranslation } from 'react-i18next';
|
|
22
23
|
import { useNavigate, useSearchParams } from 'react-router-dom';
|
|
23
24
|
import { useAPIClient, useCurrentDocumentTitle, useRequest, useViewport } from '..';
|
|
24
25
|
import { useSigninPageExtension } from './SigninPageExtension';
|
|
25
|
-
import { useForm } from '@formily/react';
|
|
26
26
|
var SigninPageContext = /*#__PURE__*/createContext({});
|
|
27
27
|
export var SigninPageProvider = function SigninPageProvider(props) {
|
|
28
28
|
var components = useContext(SigninPageContext);
|
|
@@ -129,12 +129,15 @@ export var SigninPage = function SigninPage() {
|
|
|
129
129
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
130
130
|
direction: "vertical",
|
|
131
131
|
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n "])))
|
|
132
|
-
}, tabs.length > 1 ? /*#__PURE__*/React.createElement(Tabs,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
}, tabs.length > 1 ? /*#__PURE__*/React.createElement(Tabs, {
|
|
133
|
+
items: tabs.map(function (tab) {
|
|
134
|
+
return {
|
|
135
|
+
label: tab.tabTitle,
|
|
136
|
+
key: tab.name,
|
|
137
|
+
children: tab.component
|
|
138
|
+
};
|
|
139
|
+
})
|
|
140
|
+
}) : tabs.length ? /*#__PURE__*/React.createElement("div", null, tabs[0].component) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(Space, {
|
|
138
141
|
direction: "vertical",
|
|
139
142
|
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n "])))
|
|
140
143
|
}, signinExtension)));
|
|
@@ -21,9 +21,9 @@ import { DownOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
21
21
|
import { ArrayTable } from '@formily/antd';
|
|
22
22
|
import { useField, useForm } from '@formily/react';
|
|
23
23
|
import { uid } from '@formily/shared';
|
|
24
|
-
import { Button, Dropdown
|
|
24
|
+
import { Button, Dropdown } from 'antd';
|
|
25
25
|
import { cloneDeep } from 'lodash';
|
|
26
|
-
import React, { useState } from 'react';
|
|
26
|
+
import React, { useMemo, useState } from 'react';
|
|
27
27
|
import { useTranslation } from 'react-i18next';
|
|
28
28
|
import { useRequest } from '../../api-client';
|
|
29
29
|
import { RecordProvider, useRecord } from '../../record-provider';
|
|
@@ -308,21 +308,38 @@ export var AddCollectionAction = function AddCollectionAction(props) {
|
|
|
308
308
|
var compile = useCompile();
|
|
309
309
|
var _useTranslation = useTranslation(),
|
|
310
310
|
t = _useTranslation.t;
|
|
311
|
-
var collectionTemplates = templateOptions
|
|
312
|
-
var items =
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
311
|
+
var collectionTemplates = useMemo(templateOptions, []);
|
|
312
|
+
var items = useMemo(function () {
|
|
313
|
+
var result = [];
|
|
314
|
+
collectionTemplates.forEach(function (item) {
|
|
315
|
+
if (item.divider) {
|
|
316
|
+
result.push({
|
|
317
|
+
type: 'divider'
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
result.push({
|
|
321
|
+
label: compile(item.title),
|
|
322
|
+
key: item.name
|
|
317
323
|
});
|
|
318
|
-
}
|
|
319
|
-
items.push({
|
|
320
|
-
label: compile(item.title),
|
|
321
|
-
key: item.name
|
|
322
324
|
});
|
|
323
|
-
|
|
325
|
+
return result;
|
|
326
|
+
}, [collectionTemplates]);
|
|
324
327
|
var _useResourceActionCon2 = useResourceActionContext(),
|
|
325
328
|
category = _useResourceActionCon2.state.category;
|
|
329
|
+
var menu = useMemo(function () {
|
|
330
|
+
return {
|
|
331
|
+
style: {
|
|
332
|
+
maxHeight: '60vh',
|
|
333
|
+
overflow: 'auto'
|
|
334
|
+
},
|
|
335
|
+
onClick: function onClick(info) {
|
|
336
|
+
var schema = getSchema(getTemplate(info.key), category, compile);
|
|
337
|
+
setSchema(schema);
|
|
338
|
+
setVisible(true);
|
|
339
|
+
},
|
|
340
|
+
items: items
|
|
341
|
+
};
|
|
342
|
+
}, [category, items]);
|
|
326
343
|
return /*#__PURE__*/React.createElement(RecordProvider, {
|
|
327
344
|
record: record
|
|
328
345
|
}, /*#__PURE__*/React.createElement(ActionContextProvider, {
|
|
@@ -334,18 +351,7 @@ export var AddCollectionAction = function AddCollectionAction(props) {
|
|
|
334
351
|
getPopupContainer: getContainer,
|
|
335
352
|
trigger: trigger,
|
|
336
353
|
align: align,
|
|
337
|
-
|
|
338
|
-
style: {
|
|
339
|
-
maxHeight: '60vh',
|
|
340
|
-
overflow: 'auto'
|
|
341
|
-
},
|
|
342
|
-
onClick: function onClick(info) {
|
|
343
|
-
var schema = getSchema(getTemplate(info.key), category, compile);
|
|
344
|
-
setSchema(schema);
|
|
345
|
-
setVisible(true);
|
|
346
|
-
},
|
|
347
|
-
items: items
|
|
348
|
-
})
|
|
354
|
+
menu: menu
|
|
349
355
|
}, children || /*#__PURE__*/React.createElement(Button, {
|
|
350
356
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
351
357
|
type: 'primary'
|
|
@@ -17,9 +17,9 @@ import { PlusOutlined } from '@ant-design/icons';
|
|
|
17
17
|
import { ArrayTable } from '@formily/antd';
|
|
18
18
|
import { useField, useForm } from '@formily/react';
|
|
19
19
|
import { uid } from '@formily/shared';
|
|
20
|
-
import { Button, Dropdown
|
|
20
|
+
import { Button, Dropdown } from 'antd';
|
|
21
21
|
import { cloneDeep } from 'lodash';
|
|
22
|
-
import React, { useState } from 'react';
|
|
22
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
23
23
|
import { useTranslation } from 'react-i18next';
|
|
24
24
|
import { useRequest } from '../../api-client';
|
|
25
25
|
import { RecordProvider, useRecord } from '../../record-provider';
|
|
@@ -27,7 +27,6 @@ import { ActionContextProvider, SchemaComponent, useActionContext, useCompile }
|
|
|
27
27
|
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
28
28
|
import { useCancelAction } from '../action-hooks';
|
|
29
29
|
import { useCollectionManager } from '../hooks';
|
|
30
|
-
import { useOptions } from '../hooks/useOptions';
|
|
31
30
|
import * as components from './components';
|
|
32
31
|
import { getOptions } from './interfaces';
|
|
33
32
|
var getSchema = function getSchema(schema, record, compile) {
|
|
@@ -217,8 +216,7 @@ export var AddFieldAction = function AddFieldAction(props) {
|
|
|
217
216
|
var compile = useCompile();
|
|
218
217
|
var _useTranslation = useTranslation(),
|
|
219
218
|
t = _useTranslation.t;
|
|
220
|
-
var
|
|
221
|
-
var getFieldOptions = function getFieldOptions() {
|
|
219
|
+
var getFieldOptions = useCallback(function () {
|
|
222
220
|
var _ref = getTemplate(record.template) || {},
|
|
223
221
|
availableFieldInterfaces = _ref.availableFieldInterfaces;
|
|
224
222
|
var _ref2 = availableFieldInterfaces || {},
|
|
@@ -260,19 +258,32 @@ export var AddFieldAction = function AddFieldAction(props) {
|
|
|
260
258
|
}
|
|
261
259
|
});
|
|
262
260
|
return optionArr;
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
261
|
+
}, [getTemplate, record]);
|
|
262
|
+
var items = useMemo(function () {
|
|
263
|
+
return getFieldOptions().map(function (option) {
|
|
264
|
+
if (option.children.length === 0) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
type: 'group',
|
|
269
|
+
label: compile(option.label),
|
|
270
|
+
title: compile(option.label),
|
|
271
|
+
key: option.label,
|
|
272
|
+
children: option.children.filter(function (child) {
|
|
273
|
+
return !['o2o', 'subTable', 'linkTo'].includes(child.name);
|
|
274
|
+
}).map(function (child) {
|
|
275
|
+
return {
|
|
276
|
+
label: compile(child.title),
|
|
277
|
+
title: compile(child.title),
|
|
278
|
+
key: child.name,
|
|
279
|
+
dataTargetScope: child.targetScope
|
|
280
|
+
};
|
|
281
|
+
})
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
}, [getFieldOptions]);
|
|
285
|
+
var menu = useMemo(function () {
|
|
286
|
+
return {
|
|
276
287
|
style: {
|
|
277
288
|
maxHeight: '60vh',
|
|
278
289
|
overflow: 'auto'
|
|
@@ -286,20 +297,22 @@ export var AddFieldAction = function AddFieldAction(props) {
|
|
|
286
297
|
setSchema(schema);
|
|
287
298
|
setVisible(true);
|
|
288
299
|
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
},
|
|
301
|
+
items: items
|
|
302
|
+
};
|
|
303
|
+
}, [getInterface, items, record]);
|
|
304
|
+
return record.template !== 'view' && /*#__PURE__*/React.createElement(RecordProvider, {
|
|
305
|
+
record: record
|
|
306
|
+
}, /*#__PURE__*/React.createElement(ActionContextProvider, {
|
|
307
|
+
value: {
|
|
308
|
+
visible: visible,
|
|
309
|
+
setVisible: setVisible
|
|
310
|
+
}
|
|
311
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
312
|
+
getPopupContainer: getContainer,
|
|
313
|
+
trigger: trigger,
|
|
314
|
+
align: align,
|
|
315
|
+
menu: menu
|
|
303
316
|
}, children || /*#__PURE__*/React.createElement(Button, {
|
|
304
317
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
305
318
|
type: 'primary'
|
|
@@ -16,9 +16,9 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
16
16
|
import { PlusOutlined } from '@ant-design/icons';
|
|
17
17
|
import { ArrayTable } from '@formily/antd';
|
|
18
18
|
import { uid } from '@formily/shared';
|
|
19
|
-
import { Button, Dropdown
|
|
19
|
+
import { Button, Dropdown } from 'antd';
|
|
20
20
|
import { cloneDeep } from 'lodash';
|
|
21
|
-
import React, { useState } from 'react';
|
|
21
|
+
import React, { useMemo, useState } from 'react';
|
|
22
22
|
import { useTranslation } from 'react-i18next';
|
|
23
23
|
import { useRequest } from '../../api-client';
|
|
24
24
|
import { RecordProvider } from '../../record-provider';
|
|
@@ -122,26 +122,23 @@ export var AddSubFieldAction = function AddSubFieldAction() {
|
|
|
122
122
|
var options = useOptions();
|
|
123
123
|
var _useTranslation = useTranslation(),
|
|
124
124
|
t = _useTranslation.t;
|
|
125
|
-
var items =
|
|
126
|
-
|
|
125
|
+
var items = useMemo(function () {
|
|
126
|
+
return options.map(function (option) {
|
|
127
|
+
var children = option.children.map(function (child) {
|
|
128
|
+
return {
|
|
129
|
+
label: compile(child.title),
|
|
130
|
+
key: child.name
|
|
131
|
+
};
|
|
132
|
+
});
|
|
127
133
|
return {
|
|
128
|
-
label: compile(
|
|
129
|
-
key:
|
|
134
|
+
label: compile(option.label),
|
|
135
|
+
key: option.key,
|
|
136
|
+
children: children
|
|
130
137
|
};
|
|
131
138
|
});
|
|
139
|
+
}, [options]);
|
|
140
|
+
var menu = useMemo(function () {
|
|
132
141
|
return {
|
|
133
|
-
label: compile(option.label),
|
|
134
|
-
key: option.key,
|
|
135
|
-
children: children
|
|
136
|
-
};
|
|
137
|
-
});
|
|
138
|
-
return /*#__PURE__*/React.createElement(ActionContextProvider, {
|
|
139
|
-
value: {
|
|
140
|
-
visible: visible,
|
|
141
|
-
setVisible: setVisible
|
|
142
|
-
}
|
|
143
|
-
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
144
|
-
overlay: /*#__PURE__*/React.createElement(Menu, {
|
|
145
142
|
style: {
|
|
146
143
|
maxHeight: '60vh',
|
|
147
144
|
overflow: 'auto'
|
|
@@ -152,7 +149,15 @@ export var AddSubFieldAction = function AddSubFieldAction() {
|
|
|
152
149
|
setVisible(true);
|
|
153
150
|
},
|
|
154
151
|
items: items
|
|
155
|
-
}
|
|
152
|
+
};
|
|
153
|
+
}, [items]);
|
|
154
|
+
return /*#__PURE__*/React.createElement(ActionContextProvider, {
|
|
155
|
+
value: {
|
|
156
|
+
visible: visible,
|
|
157
|
+
setVisible: setVisible
|
|
158
|
+
}
|
|
159
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
160
|
+
menu: menu
|
|
156
161
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
157
162
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
158
163
|
type: 'primary'
|
|
@@ -17,7 +17,8 @@ import { MenuOutlined } from '@ant-design/icons';
|
|
|
17
17
|
import { DndContext, DragOverlay, MouseSensor, useDraggable, useDroppable, useSensor, useSensors } from '@dnd-kit/core';
|
|
18
18
|
import { RecursionField, observer } from '@formily/react';
|
|
19
19
|
import { uid } from '@formily/shared';
|
|
20
|
-
import { Badge, Card, Dropdown,
|
|
20
|
+
import { Badge, Card, Dropdown, Modal, Tabs } from 'antd';
|
|
21
|
+
import _ from 'lodash';
|
|
21
22
|
import React, { useContext, useState } from 'react';
|
|
22
23
|
import { useAPIClient } from '../../api-client';
|
|
23
24
|
import { SchemaComponent, SchemaComponentOptions, useCompile } from '../../schema-component';
|
|
@@ -262,26 +263,30 @@ export var ConfigurationTabs = function ConfigurationTabs() {
|
|
|
262
263
|
return _ref4.apply(this, arguments);
|
|
263
264
|
};
|
|
264
265
|
}();
|
|
265
|
-
var menu = function
|
|
266
|
-
return
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
266
|
+
var menu = _.memoize(function (item) {
|
|
267
|
+
return {
|
|
268
|
+
items: [{
|
|
269
|
+
key: 'edit',
|
|
270
|
+
label: /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
271
|
+
schema: {
|
|
272
|
+
type: 'void',
|
|
273
|
+
properties: _defineProperty({}, uid(), {
|
|
274
|
+
'x-component': 'EditCategory',
|
|
275
|
+
'x-component-props': {
|
|
276
|
+
item: item
|
|
277
|
+
}
|
|
278
|
+
})
|
|
275
279
|
}
|
|
276
280
|
})
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
281
|
+
}, {
|
|
282
|
+
key: 'delete',
|
|
283
|
+
label: compile("{{t('Delete category')}}"),
|
|
284
|
+
onClick: function onClick() {
|
|
285
|
+
return remove(item.id);
|
|
286
|
+
}
|
|
287
|
+
}]
|
|
288
|
+
};
|
|
289
|
+
});
|
|
285
290
|
return /*#__PURE__*/React.createElement(DndProvider, null, /*#__PURE__*/React.createElement(Tabs, {
|
|
286
291
|
addIcon: /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
287
292
|
schema: {
|
|
@@ -304,35 +309,37 @@ export var ConfigurationTabs = function ConfigurationTabs() {
|
|
|
304
309
|
destroyInactiveTabPane: true,
|
|
305
310
|
tabBarStyle: {
|
|
306
311
|
marginBottom: '0px'
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
312
|
+
},
|
|
313
|
+
items: tabsItems.map(function (item) {
|
|
314
|
+
return {
|
|
315
|
+
label: item.id !== 'all' ? /*#__PURE__*/React.createElement("div", {
|
|
316
|
+
"data-no-dnd": "true"
|
|
317
|
+
}, /*#__PURE__*/React.createElement(TabTitle, {
|
|
318
|
+
item: item
|
|
319
|
+
})) : compile(item.name),
|
|
320
|
+
key: item.id,
|
|
321
|
+
closable: item.closable,
|
|
322
|
+
closeIcon: /*#__PURE__*/React.createElement(Dropdown, {
|
|
323
|
+
menu: menu(item)
|
|
324
|
+
}, /*#__PURE__*/React.createElement(MenuOutlined, null)),
|
|
325
|
+
children: /*#__PURE__*/React.createElement(Card, {
|
|
326
|
+
bordered: false
|
|
327
|
+
}, /*#__PURE__*/React.createElement(SchemaComponentOptions, {
|
|
328
|
+
components: {
|
|
329
|
+
CollectionFields: CollectionFields
|
|
330
|
+
},
|
|
331
|
+
inherit: true,
|
|
332
|
+
scope: {
|
|
333
|
+
loadCategories: loadCategories,
|
|
334
|
+
categoryVisible: item.id === 'all',
|
|
335
|
+
categoryId: item.id
|
|
336
|
+
}
|
|
337
|
+
}, /*#__PURE__*/React.createElement(RecursionField, {
|
|
338
|
+
name: key,
|
|
339
|
+
schema: item.schema,
|
|
340
|
+
onlyRenderProperties: true
|
|
341
|
+
})))
|
|
342
|
+
};
|
|
343
|
+
})
|
|
344
|
+
}));
|
|
338
345
|
};
|
|
@@ -5,45 +5,48 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import set from 'lodash/set';
|
|
8
|
+
import { useMemo } from 'react';
|
|
8
9
|
import { useCollectionManager } from './useCollectionManager';
|
|
9
10
|
export var useOptions = function useOptions() {
|
|
10
11
|
var _useCollectionManager = useCollectionManager(),
|
|
11
12
|
interfaces = _useCollectionManager.interfaces;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return Object.keys(groupLabels).map(function (groupName) {
|
|
34
|
-
return {
|
|
35
|
-
label: groupLabels[groupName],
|
|
36
|
-
key: groupName,
|
|
37
|
-
children: Object.keys(fields[groupName] || {}).map(function (type) {
|
|
38
|
-
var field = fields[groupName][type];
|
|
39
|
-
return _objectSpread({
|
|
40
|
-
value: type,
|
|
41
|
-
label: field.title,
|
|
42
|
-
name: type
|
|
43
|
-
}, fields[groupName][type]);
|
|
44
|
-
}).sort(function (a, b) {
|
|
45
|
-
return a.order - b.order;
|
|
46
|
-
})
|
|
13
|
+
return useMemo(function () {
|
|
14
|
+
var fields = {};
|
|
15
|
+
Object.keys(interfaces).forEach(function (type) {
|
|
16
|
+
var schema = interfaces[type];
|
|
17
|
+
registerField(schema.group || 'others', type, _objectSpread({
|
|
18
|
+
order: 0
|
|
19
|
+
}, schema));
|
|
20
|
+
});
|
|
21
|
+
function registerField(group, type, schema) {
|
|
22
|
+
fields[group] = fields[group] || {};
|
|
23
|
+
set(fields, [group, type], schema);
|
|
24
|
+
}
|
|
25
|
+
var groupLabels = {
|
|
26
|
+
basic: '{{t("Basic")}}',
|
|
27
|
+
choices: '{{t("Choices")}}',
|
|
28
|
+
media: '{{t("Media")}}',
|
|
29
|
+
datetime: '{{t("Date & Time")}}',
|
|
30
|
+
relation: '{{t("Relation")}}',
|
|
31
|
+
advanced: '{{t("Advanced type")}}',
|
|
32
|
+
systemInfo: '{{t("System info")}}',
|
|
33
|
+
others: '{{t("Others")}}'
|
|
47
34
|
};
|
|
48
|
-
|
|
35
|
+
return Object.keys(groupLabels).map(function (groupName) {
|
|
36
|
+
return {
|
|
37
|
+
label: groupLabels[groupName],
|
|
38
|
+
key: groupName,
|
|
39
|
+
children: Object.keys(fields[groupName] || {}).map(function (type) {
|
|
40
|
+
var field = fields[groupName][type];
|
|
41
|
+
return _objectSpread({
|
|
42
|
+
value: type,
|
|
43
|
+
label: field.title,
|
|
44
|
+
name: type
|
|
45
|
+
}, fields[groupName][type]);
|
|
46
|
+
}).sort(function (a, b) {
|
|
47
|
+
return a.order - b.order;
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}, [interfaces]);
|
|
49
52
|
};
|
|
@@ -22,7 +22,7 @@ export var number = {
|
|
|
22
22
|
'x-component': 'InputNumber',
|
|
23
23
|
'x-component-props': {
|
|
24
24
|
stringMode: true,
|
|
25
|
-
step: '
|
|
25
|
+
step: '1'
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
},
|
|
@@ -35,9 +35,9 @@ export var number = {
|
|
|
35
35
|
title: '{{t("Precision")}}',
|
|
36
36
|
'x-component': 'Select',
|
|
37
37
|
'x-decorator': 'FormItem',
|
|
38
|
-
default: '
|
|
38
|
+
default: '1',
|
|
39
39
|
enum: [{
|
|
40
|
-
value: '
|
|
40
|
+
value: '1',
|
|
41
41
|
label: '1'
|
|
42
42
|
}, {
|
|
43
43
|
value: '0.1',
|
|
@@ -59,7 +59,7 @@ export var percent = {
|
|
|
59
59
|
'x-component': 'Percent',
|
|
60
60
|
'x-component-props': {
|
|
61
61
|
stringMode: true,
|
|
62
|
-
step: '
|
|
62
|
+
step: '1',
|
|
63
63
|
addonAfter: '%'
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -83,9 +83,9 @@ export var percent = {
|
|
|
83
83
|
title: '{{t("Precision")}}',
|
|
84
84
|
'x-component': 'Select',
|
|
85
85
|
'x-decorator': 'FormItem',
|
|
86
|
-
default: '
|
|
86
|
+
default: '1',
|
|
87
87
|
enum: [{
|
|
88
|
-
value: '
|
|
88
|
+
value: '1',
|
|
89
89
|
label: '1%'
|
|
90
90
|
}, {
|
|
91
91
|
value: '0.1',
|