@nocobase/client 0.10.0-alpha.2 → 0.10.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/acl/Configuration/MenuItemsProvider.js +3 -3
- package/es/application/Application.js +2 -2
- package/es/auth/SigninPage.js +12 -9
- package/es/block-provider/GanttBlockProvider.js +5 -4
- package/es/block-provider/TableBlockProvider.d.ts +1 -0
- package/es/block-provider/TableBlockProvider.js +51 -17
- 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 +93 -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 +5 -5
- 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/Editable.js +1 -2
- package/es/schema-component/antd/association-field/Nester.js +7 -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/form-v2/Form.js +2 -2
- package/es/schema-component/antd/gantt/components/gantt/gantt.js +0 -1
- package/es/schema-component/antd/gantt/components/grid/grid-body.js +3 -3
- package/es/schema-component/antd/gantt/components/task-item/bar/bar-small.js +1 -1
- package/es/schema-component/antd/gantt/components/task-item/task-item.js +1 -1
- package/es/schema-component/antd/gantt/helpers/bar-helper.d.ts +1 -1
- package/es/schema-component/antd/gantt/helpers/bar-helper.js +4 -4
- package/es/schema-component/antd/gantt/helpers/other-helper.js +3 -1
- package/es/schema-component/antd/grid/Grid.js +2 -2
- package/es/schema-component/antd/grid-card/GridCard.Designer.js +3 -4
- package/es/schema-component/antd/grid-card/GridCard.Item.js +3 -3
- package/es/schema-component/antd/index.less +1 -3
- package/es/schema-component/antd/list/List.Decorator.js +3 -3
- package/es/schema-component/antd/list/List.Item.js +2 -2
- package/es/schema-component/antd/list/List.d.ts +2 -2
- package/es/schema-component/antd/list/List.js +6 -6
- 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 +60 -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 +28 -47
- package/es/schema-component/antd/table-v2/utils.d.ts +0 -1
- package/es/schema-component/antd/table-v2/utils.js +0 -28
- 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 +158 -103
- 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 +110 -29
- 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/block-provider/GanttBlockProvider.js +5 -4
- package/lib/block-provider/TableBlockProvider.d.ts +1 -0
- package/lib/block-provider/TableBlockProvider.js +53 -17
- 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 +108 -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 +4 -4
- 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/Editable.js +0 -1
- package/lib/schema-component/antd/association-field/Nester.js +6 -0
- 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/form-v2/Form.js +2 -2
- package/lib/schema-component/antd/gantt/components/gantt/gantt.js +0 -1
- package/lib/schema-component/antd/gantt/components/grid/grid-body.js +2 -2
- package/lib/schema-component/antd/gantt/components/task-item/bar/bar-small.js +1 -1
- package/lib/schema-component/antd/gantt/components/task-item/task-item.js +1 -1
- package/lib/schema-component/antd/gantt/helpers/bar-helper.d.ts +1 -1
- package/lib/schema-component/antd/gantt/helpers/bar-helper.js +4 -4
- package/lib/schema-component/antd/gantt/helpers/other-helper.js +3 -1
- package/lib/schema-component/antd/grid/Grid.js +1 -1
- package/lib/schema-component/antd/grid-card/GridCard.Designer.js +4 -5
- package/lib/schema-component/antd/grid-card/GridCard.Item.js +8 -8
- package/lib/schema-component/antd/index.less +1 -3
- package/lib/schema-component/antd/list/List.Decorator.js +3 -3
- package/lib/schema-component/antd/list/List.Item.js +6 -6
- package/lib/schema-component/antd/list/List.d.ts +2 -2
- package/lib/schema-component/antd/list/List.js +24 -24
- 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 +57 -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 +26 -45
- package/lib/schema-component/antd/table-v2/utils.d.ts +0 -1
- package/lib/schema-component/antd/table-v2/utils.js +0 -29
- 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 +155 -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 +106 -27
- 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)));
|
|
@@ -12,10 +12,10 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
12
12
|
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); }
|
|
13
13
|
import { useField } from '@formily/react';
|
|
14
14
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
15
|
-
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
|
16
|
-
import { TableBlockProvider } from './TableBlockProvider';
|
|
17
15
|
import { useACLRoleContext } from '../acl/ACLProvider';
|
|
18
16
|
import { useCollection } from '../collection-manager/hooks';
|
|
17
|
+
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
|
18
|
+
import { TableBlockProvider } from './TableBlockProvider';
|
|
19
19
|
export var GanttBlockContext = /*#__PURE__*/createContext({});
|
|
20
20
|
var formatData = function formatData() {
|
|
21
21
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -28,9 +28,10 @@ var formatData = function formatData() {
|
|
|
28
28
|
var disable = checkPermassion(item);
|
|
29
29
|
var percent = item[fieldNames.progress] * 100;
|
|
30
30
|
if (item.children && item.children.length) {
|
|
31
|
+
var _item$fieldNames$star, _item$fieldNames$end;
|
|
31
32
|
tasks.push({
|
|
32
|
-
start: new Date(item[fieldNames.start]),
|
|
33
|
-
end: new Date(item[fieldNames.end]),
|
|
33
|
+
start: new Date((_item$fieldNames$star = item[fieldNames.start]) !== null && _item$fieldNames$star !== void 0 ? _item$fieldNames$star : undefined),
|
|
34
|
+
end: new Date((_item$fieldNames$end = item[fieldNames.end]) !== null && _item$fieldNames$end !== void 0 ? _item$fieldNames$end : undefined),
|
|
34
35
|
name: item[fieldNames.title],
|
|
35
36
|
id: item.id + '',
|
|
36
37
|
type: 'project',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const TableBlockContext: React.Context<any>;
|
|
3
|
+
export declare function getIdsWithChildren(nodes: any): any[];
|
|
3
4
|
export declare const TableBlockProvider: (props: any) => React.JSX.Element;
|
|
4
5
|
export declare const useTableBlockContext: () => any;
|
|
5
6
|
export declare const useTableBlockProps: () => {
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
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."); }
|
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
2
|
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; }
|
|
7
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8
4
|
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); }); }; }
|
|
@@ -13,35 +9,72 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
13
9
|
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); }
|
|
14
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
11
|
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."); }
|
|
16
|
-
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); }
|
|
17
|
-
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; }
|
|
18
12
|
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; } }
|
|
19
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
+
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."); }
|
|
16
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
20
21
|
import { createForm } from '@formily/core';
|
|
21
22
|
import { FormContext, useField, useFieldSchema } from '@formily/react';
|
|
22
23
|
import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
23
24
|
import { useCollectionManager } from '../collection-manager';
|
|
24
25
|
import { useFilterBlock } from '../filter-provider/FilterProvider';
|
|
25
26
|
import { useRecord } from '../record-provider';
|
|
26
|
-
import { FixedBlockWrapper,
|
|
27
|
+
import { FixedBlockWrapper, removeNullCondition, SchemaComponentOptions } from '../schema-component';
|
|
27
28
|
import { BlockProvider, RenderChildrenWithAssociationFilter, useBlockRequestContext } from './BlockProvider';
|
|
28
|
-
import { mergeFilter } from './SharedFilterProvider';
|
|
29
29
|
import { findFilterTargets } from './hooks';
|
|
30
|
+
import { mergeFilter } from './SharedFilterProvider';
|
|
30
31
|
export var TableBlockContext = /*#__PURE__*/createContext({});
|
|
32
|
+
export function getIdsWithChildren(nodes) {
|
|
33
|
+
var ids = [];
|
|
34
|
+
if (nodes) {
|
|
35
|
+
var _iterator = _createForOfIteratorHelper(nodes),
|
|
36
|
+
_step;
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var node = _step.value;
|
|
40
|
+
if ((node === null || node === void 0 ? void 0 : node.children) && node.children.length > 0) {
|
|
41
|
+
ids.push(node.id);
|
|
42
|
+
ids.push.apply(ids, _toConsumableArray(getIdsWithChildren(node === null || node === void 0 ? void 0 : node.children)));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
_iterator.e(err);
|
|
47
|
+
} finally {
|
|
48
|
+
_iterator.f();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return ids;
|
|
52
|
+
}
|
|
31
53
|
var InternalTableBlockProvider = function InternalTableBlockProvider(props) {
|
|
32
54
|
var params = props.params,
|
|
33
55
|
showIndex = props.showIndex,
|
|
34
56
|
dragSort = props.dragSort,
|
|
35
57
|
rowKey = props.rowKey,
|
|
36
|
-
childrenColumnName = props.childrenColumnName
|
|
58
|
+
childrenColumnName = props.childrenColumnName,
|
|
59
|
+
fieldNames = props.fieldNames;
|
|
37
60
|
var field = useField();
|
|
38
61
|
var _useBlockRequestConte = useBlockRequestContext(),
|
|
39
62
|
resource = _useBlockRequestConte.resource,
|
|
40
63
|
service = _useBlockRequestConte.service;
|
|
41
|
-
var
|
|
64
|
+
var fieldSchema = useFieldSchema();
|
|
65
|
+
var _ref = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-decorator-props']) || {},
|
|
66
|
+
treeTable = _ref.treeTable;
|
|
67
|
+
var _useState = useState(fieldNames ? true : false),
|
|
42
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
43
69
|
expandFlag = _useState2[0],
|
|
44
70
|
_setExpandFlag = _useState2[1];
|
|
71
|
+
var allIncludesChildren = useMemo(function () {
|
|
72
|
+
if (treeTable !== false) {
|
|
73
|
+
var _service$data;
|
|
74
|
+
var keys = getIdsWithChildren(service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.data);
|
|
75
|
+
return keys || [];
|
|
76
|
+
}
|
|
77
|
+
}, [service === null || service === void 0 ? void 0 : service.loading]);
|
|
45
78
|
return /*#__PURE__*/React.createElement(FixedBlockWrapper, null, /*#__PURE__*/React.createElement(TableBlockContext.Provider, {
|
|
46
79
|
value: {
|
|
47
80
|
field: field,
|
|
@@ -53,6 +86,7 @@ var InternalTableBlockProvider = function InternalTableBlockProvider(props) {
|
|
|
53
86
|
rowKey: rowKey,
|
|
54
87
|
expandFlag: expandFlag,
|
|
55
88
|
childrenColumnName: childrenColumnName,
|
|
89
|
+
allIncludesChildren: allIncludesChildren,
|
|
56
90
|
setExpandFlag: function setExpandFlag() {
|
|
57
91
|
return _setExpandFlag(!expandFlag);
|
|
58
92
|
}
|
|
@@ -117,8 +151,8 @@ export var TableBlockProvider = function TableBlockProvider(props) {
|
|
|
117
151
|
getCollection = _useCollectionManager.getCollection,
|
|
118
152
|
getCollectionField = _useCollectionManager.getCollectionField;
|
|
119
153
|
var collection = getCollection(props.collection);
|
|
120
|
-
var
|
|
121
|
-
treeTable =
|
|
154
|
+
var _ref2 = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-decorator-props']) || {},
|
|
155
|
+
treeTable = _ref2.treeTable;
|
|
122
156
|
if (props.dragSort) {
|
|
123
157
|
params['sort'] = ['sort'];
|
|
124
158
|
}
|
|
@@ -198,13 +232,13 @@ export var useTableBlockProps = function useTableBlockProps() {
|
|
|
198
232
|
ctx.field.data.selectedRowKeys = selectedRowKeys;
|
|
199
233
|
ctx === null || ctx === void 0 ? void 0 : (_ctx$field3 = ctx.field) === null || _ctx$field3 === void 0 ? void 0 : (_ctx$field3$onRowSele = _ctx$field3.onRowSelect) === null || _ctx$field3$onRowSele === void 0 ? void 0 : _ctx$field3$onRowSele.call(_ctx$field3, selectedRowKeys);
|
|
200
234
|
},
|
|
201
|
-
onRowDragEnd: function onRowDragEnd(
|
|
235
|
+
onRowDragEnd: function onRowDragEnd(_ref3) {
|
|
202
236
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
203
237
|
var from, to;
|
|
204
238
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
205
239
|
while (1) switch (_context.prev = _context.next) {
|
|
206
240
|
case 0:
|
|
207
|
-
from =
|
|
241
|
+
from = _ref3.from, to = _ref3.to;
|
|
208
242
|
_context.next = 3;
|
|
209
243
|
return ctx.resource.move({
|
|
210
244
|
sourceId: from[ctx.rowKey || 'id'],
|
|
@@ -219,10 +253,10 @@ export var useTableBlockProps = function useTableBlockProps() {
|
|
|
219
253
|
}, _callee);
|
|
220
254
|
}))();
|
|
221
255
|
},
|
|
222
|
-
onChange: function onChange(
|
|
256
|
+
onChange: function onChange(_ref4, filters, sorter) {
|
|
223
257
|
var _ctx$service$params, _ctx$service$params$, _ctx$service$params2;
|
|
224
|
-
var current =
|
|
225
|
-
pageSize =
|
|
258
|
+
var current = _ref4.current,
|
|
259
|
+
pageSize = _ref4.pageSize;
|
|
226
260
|
var sort = sorter.order ? sorter.order === "ascend" ? [sorter.field] : ["-".concat(sorter.field)] : globalSort || ((_ctx$service$params = ctx.service.params) === null || _ctx$service$params === void 0 ? void 0 : (_ctx$service$params$ = _ctx$service$params[0]) === null || _ctx$service$params$ === void 0 ? void 0 : _ctx$service$params$.sort);
|
|
227
261
|
ctx.service.run(_objectSpread(_objectSpread({}, (_ctx$service$params2 = ctx.service.params) === null || _ctx$service$params2 === void 0 ? void 0 : _ctx$service$params2[0]), {}, {
|
|
228
262
|
page: current,
|
|
@@ -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'
|