@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
|
@@ -25,7 +25,7 @@ import { DeleteOutlined, MenuOutlined } from '@ant-design/icons';
|
|
|
25
25
|
import { SortableContext, useSortable } from '@dnd-kit/sortable';
|
|
26
26
|
import { css } from '@emotion/css';
|
|
27
27
|
import { spliceArrayState } from '@formily/core/esm/shared/internals';
|
|
28
|
-
import {
|
|
28
|
+
import { observer, RecursionField, useField, useFieldSchema } from '@formily/react';
|
|
29
29
|
import { action, reaction } from '@formily/reactive';
|
|
30
30
|
import { useMemoizedFn } from 'ahooks';
|
|
31
31
|
import { Table as AntdTable } from 'antd';
|
|
@@ -35,7 +35,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
35
35
|
import { DndContext, useDesignable, useTableSize } from '../..';
|
|
36
36
|
import { RecordIndexProvider, RecordProvider, useSchemaInitializer, useTableBlockContext, useTableSelectorContext } from '../../../';
|
|
37
37
|
import { useACLFieldWhitelist } from '../../../acl/ACLProvider';
|
|
38
|
-
import { extractIndex,
|
|
38
|
+
import { extractIndex, isCollectionFieldComponent, isColumnComponent } from './utils';
|
|
39
39
|
var useArrayField = function useArrayField(props) {
|
|
40
40
|
var field = useField();
|
|
41
41
|
return props.field || field;
|
|
@@ -210,7 +210,7 @@ var useValidator = function useValidator(validator) {
|
|
|
210
210
|
}, []);
|
|
211
211
|
};
|
|
212
212
|
export var Table = observer(function (props) {
|
|
213
|
-
var _schema$parent,
|
|
213
|
+
var _schema$parent, _field$data, _field$value2, _field$value2$slice, _field$value2$slice$c, _field$value2$slice$c2, _fieldSchema$parent, _fieldSchema$parent$x;
|
|
214
214
|
var pagination1 = props.pagination,
|
|
215
215
|
useProps = props.useProps,
|
|
216
216
|
onChange = props.onChange,
|
|
@@ -236,28 +236,22 @@ export var Table = observer(function (props) {
|
|
|
236
236
|
var schema = useFieldSchema();
|
|
237
237
|
var isTableSelector = (schema === null || schema === void 0 ? void 0 : (_schema$parent = schema.parent) === null || _schema$parent === void 0 ? void 0 : _schema$parent['x-decorator']) === 'TableSelectorProvider';
|
|
238
238
|
var ctx = isTableSelector ? useTableSelectorContext() : useTableBlockContext();
|
|
239
|
-
var expandFlag = ctx.expandFlag
|
|
239
|
+
var expandFlag = ctx.expandFlag,
|
|
240
|
+
allIncludesChildren = ctx.allIncludesChildren;
|
|
240
241
|
var onRowDragEnd = useMemoizedFn(others.onRowDragEnd || function () {});
|
|
241
242
|
var paginationProps = usePaginationProps(pagination1, pagination2);
|
|
242
|
-
// const requiredValidator = field.required || required;
|
|
243
|
-
var _ref2 = (schema === null || schema === void 0 ? void 0 : (_schema$parent2 = schema.parent) === null || _schema$parent2 === void 0 ? void 0 : _schema$parent2['x-decorator-props']) || {},
|
|
244
|
-
treeTable = _ref2.treeTable;
|
|
245
243
|
var _useState = useState([]),
|
|
246
244
|
_useState2 = _slicedToArray(_useState, 2),
|
|
247
245
|
expandedKeys = _useState2[0],
|
|
248
246
|
setExpandesKeys = _useState2[1];
|
|
249
|
-
var _useState3 = useState([]),
|
|
247
|
+
var _useState3 = useState((field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.selectedRowKeys) || []),
|
|
250
248
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var _useState5 = useState(
|
|
249
|
+
selectedRowKeys = _useState4[0],
|
|
250
|
+
setSelectedRowKeys = _useState4[1];
|
|
251
|
+
var _useState5 = useState([]),
|
|
254
252
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
var _useState7 = useState([]),
|
|
258
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
259
|
-
selectedRow = _useState8[0],
|
|
260
|
-
setSelectedRow = _useState8[1];
|
|
253
|
+
selectedRow = _useState6[0],
|
|
254
|
+
setSelectedRow = _useState6[1];
|
|
261
255
|
var dataSource = (field === null || field === void 0 ? void 0 : (_field$value2 = field.value) === null || _field$value2 === void 0 ? void 0 : (_field$value2$slice = _field$value2.slice) === null || _field$value2$slice === void 0 ? void 0 : (_field$value2$slice$c = _field$value2$slice.call(_field$value2)) === null || _field$value2$slice$c === void 0 ? void 0 : (_field$value2$slice$c2 = _field$value2$slice$c.filter) === null || _field$value2$slice$c2 === void 0 ? void 0 : _field$value2$slice$c2.call(_field$value2$slice$c, Boolean)) || [];
|
|
262
256
|
var isRowSelect = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) !== 'none';
|
|
263
257
|
var onRow = null,
|
|
@@ -270,23 +264,8 @@ export var Table = observer(function (props) {
|
|
|
270
264
|
}
|
|
271
265
|
};
|
|
272
266
|
};
|
|
273
|
-
highlightRow = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n
|
|
267
|
+
highlightRow = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n & > td {\n background-color: #caedff !important;\n }\n &:hover > td {\n background-color: #caedff !important;\n }\n "])));
|
|
274
268
|
}
|
|
275
|
-
// useEffect(() => {
|
|
276
|
-
// field.setValidator((value) => {
|
|
277
|
-
// if (requiredValidator) {
|
|
278
|
-
// return Array.isArray(value) && value.length > 0 ? null : 'The field value is required';
|
|
279
|
-
// }
|
|
280
|
-
// return;
|
|
281
|
-
// });
|
|
282
|
-
// }, [requiredValidator]);
|
|
283
|
-
useEffect(function () {
|
|
284
|
-
if (treeTable !== false) {
|
|
285
|
-
var _field$value3, _field$value3$slice;
|
|
286
|
-
var keys = getIdsWithChildren((_field$value3 = field.value) === null || _field$value3 === void 0 ? void 0 : (_field$value3$slice = _field$value3.slice) === null || _field$value3$slice === void 0 ? void 0 : _field$value3$slice.call(_field$value3));
|
|
287
|
-
setAllIncludesChildren(keys);
|
|
288
|
-
}
|
|
289
|
-
}, [field.value]);
|
|
290
269
|
useEffect(function () {
|
|
291
270
|
if (expandFlag) {
|
|
292
271
|
setExpandesKeys(allIncludesChildren);
|
|
@@ -302,7 +281,7 @@ export var Table = observer(function (props) {
|
|
|
302
281
|
},
|
|
303
282
|
cell: function cell(props) {
|
|
304
283
|
return /*#__PURE__*/React.createElement("th", _objectSpread(_objectSpread({}, props), {}, {
|
|
305
|
-
className: cls(props.className, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n
|
|
284
|
+
className: cls(props.className, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n max-width: 300px;\n white-space: nowrap;\n &:hover .general-schema-designer {\n display: block;\n }\n "]))))
|
|
306
285
|
}));
|
|
307
286
|
}
|
|
308
287
|
},
|
|
@@ -334,23 +313,23 @@ export var Table = observer(function (props) {
|
|
|
334
313
|
},
|
|
335
314
|
cell: function cell(props) {
|
|
336
315
|
return /*#__PURE__*/React.createElement("td", _objectSpread(_objectSpread({}, props), {}, {
|
|
337
|
-
className: classNames(props.className, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n
|
|
316
|
+
className: classNames(props.className, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-width: 300px;\n white-space: nowrap;\n .nb-read-pretty-input-number {\n text-align: right;\n }\n "]))))
|
|
338
317
|
}));
|
|
339
318
|
}
|
|
340
319
|
}
|
|
341
320
|
};
|
|
342
321
|
}, [field, onRowDragEnd, dragSort]);
|
|
343
322
|
var defaultRowKey = function defaultRowKey(record) {
|
|
344
|
-
var _field$
|
|
345
|
-
return (_field$
|
|
323
|
+
var _field$value3, _field$value3$indexOf;
|
|
324
|
+
return (_field$value3 = field.value) === null || _field$value3 === void 0 ? void 0 : (_field$value3$indexOf = _field$value3.indexOf) === null || _field$value3$indexOf === void 0 ? void 0 : _field$value3$indexOf.call(_field$value3, record);
|
|
346
325
|
};
|
|
347
326
|
var getRowKey = function getRowKey(record) {
|
|
348
327
|
if (typeof rowKey === 'string') {
|
|
349
328
|
var _record$rowKey;
|
|
350
329
|
return (_record$rowKey = record[rowKey]) === null || _record$rowKey === void 0 ? void 0 : _record$rowKey.toString();
|
|
351
330
|
} else {
|
|
352
|
-
var
|
|
353
|
-
return (
|
|
331
|
+
var _ref2;
|
|
332
|
+
return (_ref2 = (rowKey !== null && rowKey !== void 0 ? rowKey : defaultRowKey)(record)) === null || _ref2 === void 0 ? void 0 : _ref2.toString();
|
|
354
333
|
}
|
|
355
334
|
};
|
|
356
335
|
var restProps = {
|
|
@@ -379,24 +358,24 @@ export var Table = observer(function (props) {
|
|
|
379
358
|
index = extractIndex(record.__index);
|
|
380
359
|
}
|
|
381
360
|
return /*#__PURE__*/React.createElement("div", {
|
|
382
|
-
className: classNames(checked ? 'checked' : null, css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n
|
|
361
|
+
className: classNames(checked ? 'checked' : null, css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n float: left;\n align-items: center;\n justify-content: space-evenly;\n padding-right: 8px;\n .nb-table-index {\n opacity: 0;\n }\n &:not(.checked) {\n .nb-table-index {\n opacity: 1;\n }\n }\n "]))), _defineProperty({}, css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n &:hover {\n .nb-table-index {\n opacity: 0;\n }\n .nb-origin-node {\n display: block;\n }\n }\n "]))), isRowSelect))
|
|
383
362
|
}, /*#__PURE__*/React.createElement("div", {
|
|
384
|
-
className: classNames(checked ? 'checked' : null, css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n
|
|
363
|
+
className: classNames(checked ? 'checked' : null, css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-evenly;\n "]))))
|
|
385
364
|
}, dragSort && /*#__PURE__*/React.createElement(SortHandle, {
|
|
386
365
|
id: getRowKey(record)
|
|
387
366
|
}), showIndex && /*#__PURE__*/React.createElement(TableIndex, {
|
|
388
367
|
index: index
|
|
389
368
|
})), isRowSelect && /*#__PURE__*/React.createElement("div", {
|
|
390
|
-
className: classNames('nb-origin-node', checked ? 'checked' : null, css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n
|
|
369
|
+
className: classNames('nb-origin-node', checked ? 'checked' : null, css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: absolute;\n right: 50%;\n transform: translateX(50%);\n &:not(.checked) {\n display: none;\n }\n "]))))
|
|
391
370
|
}, originNode));
|
|
392
371
|
}
|
|
393
372
|
}, rowSelection) : undefined
|
|
394
373
|
};
|
|
395
|
-
var SortableWrapper = useCallback(function (
|
|
396
|
-
var _field$
|
|
397
|
-
var children =
|
|
374
|
+
var SortableWrapper = useCallback(function (_ref3) {
|
|
375
|
+
var _field$value4, _field$value4$map;
|
|
376
|
+
var children = _ref3.children;
|
|
398
377
|
return dragSort ? /*#__PURE__*/React.createElement(SortableContext, {
|
|
399
|
-
items: ((_field$
|
|
378
|
+
items: ((_field$value4 = field.value) === null || _field$value4 === void 0 ? void 0 : (_field$value4$map = _field$value4.map) === null || _field$value4$map === void 0 ? void 0 : _field$value4$map.call(_field$value4, getRowKey)) || [],
|
|
400
379
|
children: children
|
|
401
380
|
}) : /*#__PURE__*/React.createElement(React.Fragment, {
|
|
402
381
|
children: children
|
|
@@ -416,7 +395,7 @@ export var Table = observer(function (props) {
|
|
|
416
395
|
};
|
|
417
396
|
}, [fixedBlock, tableHeight]);
|
|
418
397
|
return /*#__PURE__*/React.createElement("div", {
|
|
419
|
-
className: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n
|
|
398
|
+
className: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n height: 100%;\n overflow: hidden;\n .ant-table-wrapper {\n height: 100%;\n .ant-spin-nested-loading {\n height: 100%;\n .ant-spin-container {\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n }\n }\n .ant-table {\n overflow-x: auto;\n overflow-y: hidden;\n }\n "])))
|
|
420
399
|
}, /*#__PURE__*/React.createElement(SortableWrapper, null, /*#__PURE__*/React.createElement(AntdTable, _objectSpread(_objectSpread(_objectSpread({
|
|
421
400
|
ref: tableSizeRefCallback,
|
|
422
401
|
rowKey: rowKey !== null && rowKey !== void 0 ? rowKey : defaultRowKey,
|
|
@@ -451,4 +430,6 @@ export var Table = observer(function (props) {
|
|
|
451
430
|
return /*#__PURE__*/React.createElement("div", null, message);
|
|
452
431
|
});
|
|
453
432
|
})));
|
|
433
|
+
}, {
|
|
434
|
+
displayName: 'Table'
|
|
454
435
|
});
|
|
@@ -2,4 +2,3 @@ import { ISchema, Schema } from '@formily/react';
|
|
|
2
2
|
export declare const isCollectionFieldComponent: (schema: ISchema) => boolean;
|
|
3
3
|
export declare const isColumnComponent: (schema: Schema) => boolean;
|
|
4
4
|
export declare function extractIndex(str: any): string;
|
|
5
|
-
export declare function getIdsWithChildren(nodes: any): any[];
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
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."); }
|
|
3
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
-
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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
|
-
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); }
|
|
7
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
1
|
export var isCollectionFieldComponent = function isCollectionFieldComponent(schema) {
|
|
9
2
|
return schema['x-component'] === 'CollectionField';
|
|
10
3
|
};
|
|
@@ -20,25 +13,4 @@ export function extractIndex(str) {
|
|
|
20
13
|
}
|
|
21
14
|
});
|
|
22
15
|
return numbers.join('.');
|
|
23
|
-
}
|
|
24
|
-
export function getIdsWithChildren(nodes) {
|
|
25
|
-
var ids = [];
|
|
26
|
-
if (nodes) {
|
|
27
|
-
var _iterator = _createForOfIteratorHelper(nodes),
|
|
28
|
-
_step;
|
|
29
|
-
try {
|
|
30
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
31
|
-
var node = _step.value;
|
|
32
|
-
if ((node === null || node === void 0 ? void 0 : node.children) && node.children.length > 0) {
|
|
33
|
-
ids.push(node.id);
|
|
34
|
-
ids.push.apply(ids, _toConsumableArray(getIdsWithChildren(node === null || node === void 0 ? void 0 : node.children)));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
} catch (err) {
|
|
38
|
-
_iterator.e(err);
|
|
39
|
-
} finally {
|
|
40
|
-
_iterator.f();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return ids;
|
|
44
16
|
}
|
|
@@ -14,38 +14,51 @@ import React, { useMemo } from 'react';
|
|
|
14
14
|
import { Icon } from '../../../icon';
|
|
15
15
|
import { useSchemaInitializer } from '../../../schema-initializer';
|
|
16
16
|
import { DndContext, SortableItem } from '../../common';
|
|
17
|
+
import { useDesignable } from '../../hooks';
|
|
17
18
|
import { useDesigner } from '../../hooks/useDesigner';
|
|
18
|
-
import {
|
|
19
|
+
import { useTabsContext } from './context';
|
|
19
20
|
import { TabsDesigner } from './Tabs.Designer';
|
|
20
21
|
export var Tabs = observer(function (props) {
|
|
21
22
|
var fieldSchema = useFieldSchema();
|
|
22
23
|
var _useSchemaInitializer = useSchemaInitializer(fieldSchema['x-initializer']),
|
|
23
24
|
render = _useSchemaInitializer.render;
|
|
25
|
+
var _useDesignable = useDesignable(),
|
|
26
|
+
designable = _useDesignable.designable;
|
|
24
27
|
var contextProps = useTabsContext();
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
var _contextProps$PaneRoo = contextProps.PaneRoot,
|
|
29
|
+
PaneRoot = _contextProps$PaneRoo === void 0 ? React.Fragment : _contextProps$PaneRoo;
|
|
30
|
+
var items = useMemo(function () {
|
|
31
|
+
var result = fieldSchema.mapProperties(function (schema, key) {
|
|
32
|
+
return {
|
|
33
|
+
key: key,
|
|
34
|
+
label: /*#__PURE__*/React.createElement(RecursionField, {
|
|
35
|
+
name: key,
|
|
36
|
+
schema: schema,
|
|
37
|
+
onlyRenderSelf: true
|
|
38
|
+
}),
|
|
39
|
+
children: /*#__PURE__*/React.createElement(PaneRoot, {
|
|
40
|
+
active: key === contextProps.activeKey
|
|
41
|
+
}, /*#__PURE__*/React.createElement(RecursionField, {
|
|
42
|
+
name: key,
|
|
43
|
+
schema: schema,
|
|
44
|
+
onlyRenderProperties: true
|
|
45
|
+
}))
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
if (designable) {
|
|
49
|
+
result.push({
|
|
50
|
+
key: 'designer',
|
|
51
|
+
label: render(),
|
|
52
|
+
children: null
|
|
53
|
+
});
|
|
28
54
|
}
|
|
29
|
-
return
|
|
30
|
-
}, [
|
|
55
|
+
return result;
|
|
56
|
+
}, [fieldSchema.mapProperties(function (s, key) {
|
|
57
|
+
return key;
|
|
58
|
+
}).join()]);
|
|
31
59
|
return /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(AntdTabs, _objectSpread(_objectSpread({}, contextProps), {}, {
|
|
32
60
|
style: props.style,
|
|
33
|
-
|
|
34
|
-
right: render()
|
|
35
|
-
}
|
|
36
|
-
}), fieldSchema.mapProperties(function (schema, key) {
|
|
37
|
-
return /*#__PURE__*/React.createElement(AntdTabs.TabPane, {
|
|
38
|
-
tab: /*#__PURE__*/React.createElement(RecursionField, {
|
|
39
|
-
name: key,
|
|
40
|
-
schema: schema,
|
|
41
|
-
onlyRenderSelf: true
|
|
42
|
-
}),
|
|
43
|
-
key: key
|
|
44
|
-
}, /*#__PURE__*/React.createElement(PaneProvider, null, /*#__PURE__*/React.createElement(RecursionField, {
|
|
45
|
-
name: key,
|
|
46
|
-
schema: schema,
|
|
47
|
-
onlyRenderProperties: true
|
|
48
|
-
})));
|
|
61
|
+
items: items
|
|
49
62
|
})));
|
|
50
63
|
}, {
|
|
51
64
|
displayName: 'Tabs'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TabsProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface TabsContextProps extends TabsProps {
|
|
4
|
-
|
|
4
|
+
PaneRoot?: React.FC<any>;
|
|
5
5
|
}
|
|
6
6
|
export declare const TabsContextProvider: React.FC<TabsContextProps>;
|
|
7
7
|
export declare const useTabsContext: () => TabsContextProps;
|
|
@@ -17,7 +17,7 @@ import { isImage, toArr, toImages } from './shared';
|
|
|
17
17
|
export var ReadPretty = function ReadPretty() {
|
|
18
18
|
return null;
|
|
19
19
|
};
|
|
20
|
-
ReadPretty.File = function (props) {
|
|
20
|
+
ReadPretty.File = function File(props) {
|
|
21
21
|
var _images$photoIndex, _images, _images2, _images$photoIndex2;
|
|
22
22
|
var record = useRecord();
|
|
23
23
|
var field = useField();
|
|
@@ -51,6 +51,7 @@ ReadPretty.File = function (props) {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
key: file.name,
|
|
54
55
|
className: 'ant-upload-list-picture-card-container'
|
|
55
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
56
57
|
className: "ant-upload-list-item ant-upload-list-item-done ant-upload-list-item-list-type-picture-card"
|
|
@@ -110,6 +111,7 @@ ReadPretty.File = function (props) {
|
|
|
110
111
|
},
|
|
111
112
|
imageTitle: (_images$photoIndex2 = images[photoIndex]) === null || _images$photoIndex2 === void 0 ? void 0 : _images$photoIndex2.title,
|
|
112
113
|
toolbarButtons: [/*#__PURE__*/React.createElement("button", {
|
|
114
|
+
key: 'download',
|
|
113
115
|
style: {
|
|
114
116
|
fontSize: 22,
|
|
115
117
|
background: 'none',
|
|
@@ -128,10 +130,12 @@ ReadPretty.File = function (props) {
|
|
|
128
130
|
}, /*#__PURE__*/React.createElement(DownloadOutlined, null))]
|
|
129
131
|
}));
|
|
130
132
|
};
|
|
131
|
-
ReadPretty.Upload = function (props) {
|
|
133
|
+
ReadPretty.Upload = function Upload(props) {
|
|
132
134
|
var field = useField();
|
|
133
135
|
return (field.value || []).map(function (item) {
|
|
134
|
-
return /*#__PURE__*/React.createElement("div",
|
|
136
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
key: item.name
|
|
138
|
+
}, item.url ? /*#__PURE__*/React.createElement("a", {
|
|
135
139
|
target: '_blank',
|
|
136
140
|
href: item.url,
|
|
137
141
|
rel: "noreferrer"
|
|
@@ -55,7 +55,7 @@ export function VariableSelect(props) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
|
-
|
|
58
|
+
popupClassName: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-cascader-menu {\n margin-bottom: 0;\n }\n "]))),
|
|
59
59
|
dropdownRender: function dropdownRender(menu) {
|
|
60
60
|
return /*#__PURE__*/React.createElement(React.Fragment, null, menu, /*#__PURE__*/React.createElement("div", {
|
|
61
61
|
className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 0.5em;\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n color: rgba(0, 0, 0, 0.45);\n "])))
|
|
@@ -6,5 +6,6 @@ declare type VariablesCtx = {
|
|
|
6
6
|
export declare const useVariablesCtx: () => VariablesCtx;
|
|
7
7
|
export declare const isVariable: (str: unknown) => boolean;
|
|
8
8
|
export declare const parseVariables: (str: string, ctx: VariablesCtx) => any;
|
|
9
|
+
export declare function getInnermostKeyAndValue(obj: any): any;
|
|
9
10
|
export declare const conditionAnalyse: (rules: any, values: any) => boolean;
|
|
10
11
|
export {};
|
|
@@ -2,11 +2,16 @@ import React from 'react';
|
|
|
2
2
|
import './style.less';
|
|
3
3
|
import { SchemaInitializerButtonProps, SchemaInitializerItemComponent, SchemaInitializerItemProps } from './types';
|
|
4
4
|
export declare const SchemaInitializerItemContext: React.Context<any>;
|
|
5
|
-
export declare const SchemaInitializerButtonContext: React.Context<
|
|
5
|
+
export declare const SchemaInitializerButtonContext: React.Context<{
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
setVisible?: (v: boolean) => void;
|
|
8
|
+
searchValue?: string;
|
|
9
|
+
setSearchValue?: (v: string) => void;
|
|
10
|
+
}>;
|
|
6
11
|
export declare const SchemaInitializer: {
|
|
7
12
|
(): any;
|
|
8
13
|
Button: React.MemoExoticComponent<import("@formily/react").ReactFC<SchemaInitializerButtonProps>>;
|
|
9
|
-
Item(props: SchemaInitializerItemProps):
|
|
14
|
+
Item(props: SchemaInitializerItemProps): any;
|
|
10
15
|
itemWrap(component?: SchemaInitializerItemComponent): SchemaInitializerItemComponent;
|
|
11
16
|
ActionModal(props: SchemaInitializerActionModalProps): React.JSX.Element;
|
|
12
17
|
SwitchItem(props: any): React.JSX.Element;
|