@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
|
@@ -17,7 +17,8 @@ import { MenuOutlined } from '@ant-design/icons';
|
|
|
17
17
|
import { DndContext, DragOverlay, MouseSensor, useDraggable, useDroppable, useSensor, useSensors } from '@dnd-kit/core';
|
|
18
18
|
import { RecursionField, observer } from '@formily/react';
|
|
19
19
|
import { uid } from '@formily/shared';
|
|
20
|
-
import { Badge, Card, Dropdown,
|
|
20
|
+
import { Badge, Card, Dropdown, Modal, Tabs } from 'antd';
|
|
21
|
+
import _ from 'lodash';
|
|
21
22
|
import React, { useContext, useState } from 'react';
|
|
22
23
|
import { useAPIClient } from '../../api-client';
|
|
23
24
|
import { SchemaComponent, SchemaComponentOptions, useCompile } from '../../schema-component';
|
|
@@ -262,26 +263,30 @@ export var ConfigurationTabs = function ConfigurationTabs() {
|
|
|
262
263
|
return _ref4.apply(this, arguments);
|
|
263
264
|
};
|
|
264
265
|
}();
|
|
265
|
-
var menu = function
|
|
266
|
-
return
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
266
|
+
var menu = _.memoize(function (item) {
|
|
267
|
+
return {
|
|
268
|
+
items: [{
|
|
269
|
+
key: 'edit',
|
|
270
|
+
label: /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
271
|
+
schema: {
|
|
272
|
+
type: 'void',
|
|
273
|
+
properties: _defineProperty({}, uid(), {
|
|
274
|
+
'x-component': 'EditCategory',
|
|
275
|
+
'x-component-props': {
|
|
276
|
+
item: item
|
|
277
|
+
}
|
|
278
|
+
})
|
|
275
279
|
}
|
|
276
280
|
})
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
281
|
+
}, {
|
|
282
|
+
key: 'delete',
|
|
283
|
+
label: compile("{{t('Delete category')}}"),
|
|
284
|
+
onClick: function onClick() {
|
|
285
|
+
return remove(item.id);
|
|
286
|
+
}
|
|
287
|
+
}]
|
|
288
|
+
};
|
|
289
|
+
});
|
|
285
290
|
return /*#__PURE__*/React.createElement(DndProvider, null, /*#__PURE__*/React.createElement(Tabs, {
|
|
286
291
|
addIcon: /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
287
292
|
schema: {
|
|
@@ -304,35 +309,37 @@ export var ConfigurationTabs = function ConfigurationTabs() {
|
|
|
304
309
|
destroyInactiveTabPane: true,
|
|
305
310
|
tabBarStyle: {
|
|
306
311
|
marginBottom: '0px'
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
312
|
+
},
|
|
313
|
+
items: tabsItems.map(function (item) {
|
|
314
|
+
return {
|
|
315
|
+
label: item.id !== 'all' ? /*#__PURE__*/React.createElement("div", {
|
|
316
|
+
"data-no-dnd": "true"
|
|
317
|
+
}, /*#__PURE__*/React.createElement(TabTitle, {
|
|
318
|
+
item: item
|
|
319
|
+
})) : compile(item.name),
|
|
320
|
+
key: item.id,
|
|
321
|
+
closable: item.closable,
|
|
322
|
+
closeIcon: /*#__PURE__*/React.createElement(Dropdown, {
|
|
323
|
+
menu: menu(item)
|
|
324
|
+
}, /*#__PURE__*/React.createElement(MenuOutlined, null)),
|
|
325
|
+
children: /*#__PURE__*/React.createElement(Card, {
|
|
326
|
+
bordered: false
|
|
327
|
+
}, /*#__PURE__*/React.createElement(SchemaComponentOptions, {
|
|
328
|
+
components: {
|
|
329
|
+
CollectionFields: CollectionFields
|
|
330
|
+
},
|
|
331
|
+
inherit: true,
|
|
332
|
+
scope: {
|
|
333
|
+
loadCategories: loadCategories,
|
|
334
|
+
categoryVisible: item.id === 'all',
|
|
335
|
+
categoryId: item.id
|
|
336
|
+
}
|
|
337
|
+
}, /*#__PURE__*/React.createElement(RecursionField, {
|
|
338
|
+
name: key,
|
|
339
|
+
schema: item.schema,
|
|
340
|
+
onlyRenderProperties: true
|
|
341
|
+
})))
|
|
342
|
+
};
|
|
343
|
+
})
|
|
344
|
+
}));
|
|
338
345
|
};
|
|
@@ -5,45 +5,48 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import set from 'lodash/set';
|
|
8
|
+
import { useMemo } from 'react';
|
|
8
9
|
import { useCollectionManager } from './useCollectionManager';
|
|
9
10
|
export var useOptions = function useOptions() {
|
|
10
11
|
var _useCollectionManager = useCollectionManager(),
|
|
11
12
|
interfaces = _useCollectionManager.interfaces;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return Object.keys(groupLabels).map(function (groupName) {
|
|
34
|
-
return {
|
|
35
|
-
label: groupLabels[groupName],
|
|
36
|
-
key: groupName,
|
|
37
|
-
children: Object.keys(fields[groupName] || {}).map(function (type) {
|
|
38
|
-
var field = fields[groupName][type];
|
|
39
|
-
return _objectSpread({
|
|
40
|
-
value: type,
|
|
41
|
-
label: field.title,
|
|
42
|
-
name: type
|
|
43
|
-
}, fields[groupName][type]);
|
|
44
|
-
}).sort(function (a, b) {
|
|
45
|
-
return a.order - b.order;
|
|
46
|
-
})
|
|
13
|
+
return useMemo(function () {
|
|
14
|
+
var fields = {};
|
|
15
|
+
Object.keys(interfaces).forEach(function (type) {
|
|
16
|
+
var schema = interfaces[type];
|
|
17
|
+
registerField(schema.group || 'others', type, _objectSpread({
|
|
18
|
+
order: 0
|
|
19
|
+
}, schema));
|
|
20
|
+
});
|
|
21
|
+
function registerField(group, type, schema) {
|
|
22
|
+
fields[group] = fields[group] || {};
|
|
23
|
+
set(fields, [group, type], schema);
|
|
24
|
+
}
|
|
25
|
+
var groupLabels = {
|
|
26
|
+
basic: '{{t("Basic")}}',
|
|
27
|
+
choices: '{{t("Choices")}}',
|
|
28
|
+
media: '{{t("Media")}}',
|
|
29
|
+
datetime: '{{t("Date & Time")}}',
|
|
30
|
+
relation: '{{t("Relation")}}',
|
|
31
|
+
advanced: '{{t("Advanced type")}}',
|
|
32
|
+
systemInfo: '{{t("System info")}}',
|
|
33
|
+
others: '{{t("Others")}}'
|
|
47
34
|
};
|
|
48
|
-
|
|
35
|
+
return Object.keys(groupLabels).map(function (groupName) {
|
|
36
|
+
return {
|
|
37
|
+
label: groupLabels[groupName],
|
|
38
|
+
key: groupName,
|
|
39
|
+
children: Object.keys(fields[groupName] || {}).map(function (type) {
|
|
40
|
+
var field = fields[groupName][type];
|
|
41
|
+
return _objectSpread({
|
|
42
|
+
value: type,
|
|
43
|
+
label: field.title,
|
|
44
|
+
name: type
|
|
45
|
+
}, fields[groupName][type]);
|
|
46
|
+
}).sort(function (a, b) {
|
|
47
|
+
return a.order - b.order;
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}, [interfaces]);
|
|
49
52
|
};
|
|
@@ -22,7 +22,7 @@ export var number = {
|
|
|
22
22
|
'x-component': 'InputNumber',
|
|
23
23
|
'x-component-props': {
|
|
24
24
|
stringMode: true,
|
|
25
|
-
step: '
|
|
25
|
+
step: '1'
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
},
|
|
@@ -35,9 +35,9 @@ export var number = {
|
|
|
35
35
|
title: '{{t("Precision")}}',
|
|
36
36
|
'x-component': 'Select',
|
|
37
37
|
'x-decorator': 'FormItem',
|
|
38
|
-
default: '
|
|
38
|
+
default: '1',
|
|
39
39
|
enum: [{
|
|
40
|
-
value: '
|
|
40
|
+
value: '1',
|
|
41
41
|
label: '1'
|
|
42
42
|
}, {
|
|
43
43
|
value: '0.1',
|
|
@@ -59,7 +59,7 @@ export var percent = {
|
|
|
59
59
|
'x-component': 'Percent',
|
|
60
60
|
'x-component-props': {
|
|
61
61
|
stringMode: true,
|
|
62
|
-
step: '
|
|
62
|
+
step: '1',
|
|
63
63
|
addonAfter: '%'
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -83,9 +83,9 @@ export var percent = {
|
|
|
83
83
|
title: '{{t("Precision")}}',
|
|
84
84
|
'x-component': 'Select',
|
|
85
85
|
'x-decorator': 'FormItem',
|
|
86
|
-
default: '
|
|
86
|
+
default: '1',
|
|
87
87
|
enum: [{
|
|
88
|
-
value: '
|
|
88
|
+
value: '1',
|
|
89
89
|
label: '1%'
|
|
90
90
|
}, {
|
|
91
91
|
value: '0.1',
|
package/es/formula/Expression.js
CHANGED
|
@@ -14,8 +14,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
14
14
|
import { css } from '@emotion/css';
|
|
15
15
|
import { onFormSubmitValidateStart } from '@formily/core';
|
|
16
16
|
import { useField, useFormEffects } from '@formily/react';
|
|
17
|
-
import { Dropdown
|
|
18
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
17
|
+
import { Dropdown } from 'antd';
|
|
18
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
20
|
function pasteHtml(html) {
|
|
21
21
|
var selectPastedContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -97,18 +97,26 @@ export var Expression = function Expression(props) {
|
|
|
97
97
|
_useState2 = _slicedToArray(_useState, 2),
|
|
98
98
|
changed = _useState2[0],
|
|
99
99
|
setChanged = _useState2[1];
|
|
100
|
-
var onChange = function
|
|
100
|
+
var onChange = useCallback(function (value) {
|
|
101
101
|
setChanged(true);
|
|
102
102
|
props.onChange(value);
|
|
103
|
-
};
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
}, [props.onChange]);
|
|
104
|
+
var _useMemo = useMemo(function () {
|
|
105
|
+
var numColumns = new Map();
|
|
106
|
+
var scope = {};
|
|
107
|
+
fields.filter(function (field) {
|
|
108
|
+
return supports.includes(field.interface);
|
|
109
|
+
}).forEach(function (field) {
|
|
110
|
+
numColumns.set(field.name, field.uiSchema.title);
|
|
111
|
+
scope[field.name] = 1;
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
numColumns: numColumns,
|
|
115
|
+
scope: scope
|
|
116
|
+
};
|
|
117
|
+
}, [fields, supports]),
|
|
118
|
+
numColumns = _useMemo.numColumns,
|
|
119
|
+
scope = _useMemo.scope;
|
|
112
120
|
var keys = Array.from(numColumns.keys());
|
|
113
121
|
var _useState3 = useState(function () {
|
|
114
122
|
var scope = {};
|
|
@@ -135,39 +143,51 @@ export var Expression = function Expression(props) {
|
|
|
135
143
|
var val = renderExp(value || '', scope);
|
|
136
144
|
setHtml(val);
|
|
137
145
|
}, [value]);
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
146
|
+
var menuItems = useMemo(function () {
|
|
147
|
+
if (keys.length > 0) {
|
|
148
|
+
return keys.map(function (key) {
|
|
149
|
+
return {
|
|
150
|
+
key: key,
|
|
151
|
+
disabled: true,
|
|
152
|
+
label: /*#__PURE__*/React.createElement("button", {
|
|
153
|
+
onClick: function () {
|
|
154
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(args) {
|
|
155
|
+
var val, text;
|
|
156
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
157
|
+
while (1) switch (_context.prev = _context.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
inputRef.current.focus();
|
|
160
|
+
val = numColumns.get(key);
|
|
161
|
+
pasteHtml(" <span class=\"ant-tag\" style=\"margin: 0 3px;\" contentEditable=\"false\" data-key=\"".concat(key, "\">").concat(val, "</span> "));
|
|
162
|
+
text = getValue(inputRef.current);
|
|
163
|
+
onChange(text);
|
|
164
|
+
case 5:
|
|
165
|
+
case "end":
|
|
166
|
+
return _context.stop();
|
|
167
|
+
}
|
|
168
|
+
}, _callee);
|
|
169
|
+
}));
|
|
170
|
+
function onClick(_x2) {
|
|
171
|
+
return _onClick.apply(this, arguments);
|
|
172
|
+
}
|
|
173
|
+
return onClick;
|
|
174
|
+
}()
|
|
175
|
+
}, numColumns.get(key))
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
return [{
|
|
180
|
+
key: 0,
|
|
181
|
+
disabled: true,
|
|
182
|
+
label: t('No available fields')
|
|
183
|
+
}];
|
|
184
|
+
}
|
|
185
|
+
}, [keys, numColumns, onChange]);
|
|
186
|
+
var menu = useMemo(function () {
|
|
187
|
+
return {
|
|
188
|
+
items: menuItems
|
|
189
|
+
};
|
|
190
|
+
}, [menuItems]);
|
|
171
191
|
useFormEffects(function () {
|
|
172
192
|
onFormSubmitValidateStart(function () {
|
|
173
193
|
try {
|
|
@@ -185,7 +205,7 @@ export var Expression = function Expression(props) {
|
|
|
185
205
|
});
|
|
186
206
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
187
207
|
trigger: ['click'],
|
|
188
|
-
|
|
208
|
+
menu: menu,
|
|
189
209
|
overlayClassName: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-dropdown-menu-item {\n padding: 0;\n }\n button {\n cursor: pointer;\n padding: 5px 12px;\n text-align: left;\n color: rgba(0, 0, 0, 0.85);\n width: 100%;\n line-height: inherit;\n height: auto;\n border: 0px;\n background-color: transparent;\n &:hover {\n background-color: #f5f5f5;\n }\n }\n "])))
|
|
190
210
|
}, /*#__PURE__*/React.createElement("div", {
|
|
191
211
|
onKeyDown: function onKeyDown(e) {
|
package/es/hooks/index.d.ts
CHANGED
package/es/hooks/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAdminSchemaUid: () => any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useSystemSettings } from '../system-settings';
|
|
2
|
+
export var useAdminSchemaUid = function useAdminSchemaUid() {
|
|
3
|
+
var _ctx$data, _ctx$data$data, _ctx$data$data$option;
|
|
4
|
+
var ctx = useSystemSettings();
|
|
5
|
+
return ctx === null || ctx === void 0 ? void 0 : (_ctx$data = ctx.data) === null || _ctx$data === void 0 ? void 0 : (_ctx$data$data = _ctx$data.data) === null || _ctx$data$data === void 0 ? void 0 : (_ctx$data$data$option = _ctx$data$data.options) === null || _ctx$data$data$option === void 0 ? void 0 : _ctx$data$data$option.adminSchemaUid;
|
|
6
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MenuProps } from 'antd';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
declare type Item = MenuProps['items'][0] & {
|
|
4
|
+
/** 在清空数组时,如果该字段为 true 则保留该选项 */
|
|
5
|
+
notdelete?: boolean;
|
|
6
|
+
/** 用于给列表排序 */
|
|
7
|
+
order?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const GetMenuItemContext: React.Context<{
|
|
10
|
+
collectMenuItem?(item: Item): void;
|
|
11
|
+
onChange?: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const GetMenuItemsContext: React.Context<{
|
|
14
|
+
pushMenuItem?(item: Item): void;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* 用于为 SchemaInitializer.Item 组件提供一些方法,比如收集菜单项数据
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare const useCollectMenuItem: () => {
|
|
21
|
+
collectMenuItem?(item: Item): void;
|
|
22
|
+
onChange?: () => void;
|
|
23
|
+
};
|
|
24
|
+
export declare const useCollectMenuItems: () => {
|
|
25
|
+
pushMenuItem?(item: Item): void;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 用于在 antd 从 4.x 升级到 5.x 中,用于把 SchemaInitializer.Item 组件这种写法转换成 Menu 组件的 items 写法
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export declare const useMenuItem: () => {
|
|
32
|
+
Component: () => React.JSX.Element;
|
|
33
|
+
getMenuItems: (Com: () => ReactNode) => Item[];
|
|
34
|
+
getMenuItem: (Com: () => JSX.Element) => Item;
|
|
35
|
+
clean: () => void;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
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 _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); }
|
|
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
|
+
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; }
|
|
7
|
+
import _ from 'lodash';
|
|
8
|
+
import React, { createContext, useCallback, useContext, useRef } from 'react';
|
|
9
|
+
export var GetMenuItemContext = /*#__PURE__*/createContext(null);
|
|
10
|
+
export var GetMenuItemsContext = /*#__PURE__*/createContext(null);
|
|
11
|
+
/**
|
|
12
|
+
* 用于为 SchemaInitializer.Item 组件提供一些方法,比如收集菜单项数据
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export var useCollectMenuItem = function useCollectMenuItem() {
|
|
16
|
+
return useContext(GetMenuItemContext) || {};
|
|
17
|
+
};
|
|
18
|
+
export var useCollectMenuItems = function useCollectMenuItems() {
|
|
19
|
+
return useContext(GetMenuItemsContext) || {};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 用于在 antd 从 4.x 升级到 5.x 中,用于把 SchemaInitializer.Item 组件这种写法转换成 Menu 组件的 items 写法
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export var useMenuItem = function useMenuItem() {
|
|
26
|
+
var list = useRef([]);
|
|
27
|
+
var renderItems = useRef(null);
|
|
28
|
+
var shouldRerender = useRef(false);
|
|
29
|
+
var Component = useCallback(function () {
|
|
30
|
+
if (!shouldRerender.current) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
shouldRerender.current = false;
|
|
34
|
+
if (renderItems.current) {
|
|
35
|
+
return renderItems.current();
|
|
36
|
+
}
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, list.current.map(function (Com, index) {
|
|
38
|
+
return /*#__PURE__*/React.createElement(Com, {
|
|
39
|
+
key: index
|
|
40
|
+
});
|
|
41
|
+
}));
|
|
42
|
+
}, []);
|
|
43
|
+
var getMenuItems = useCallback(function (Com) {
|
|
44
|
+
var items = [];
|
|
45
|
+
var pushMenuItem = function pushMenuItem(item) {
|
|
46
|
+
items.push(item);
|
|
47
|
+
items.sort(function (a, b) {
|
|
48
|
+
return (a.order || 0) - (b.order || 0);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
shouldRerender.current = true;
|
|
52
|
+
renderItems.current = function () {
|
|
53
|
+
var notDeleteItems = items.filter(function (item) {
|
|
54
|
+
return item.notdelete;
|
|
55
|
+
}).map(function (item) {
|
|
56
|
+
return _.omit(item, 'notdelete');
|
|
57
|
+
});
|
|
58
|
+
items.length = 0;
|
|
59
|
+
items.push.apply(items, _toConsumableArray(notDeleteItems));
|
|
60
|
+
return /*#__PURE__*/React.createElement(GetMenuItemsContext.Provider, {
|
|
61
|
+
value: {
|
|
62
|
+
pushMenuItem: pushMenuItem
|
|
63
|
+
}
|
|
64
|
+
}, Com());
|
|
65
|
+
};
|
|
66
|
+
return items;
|
|
67
|
+
}, []);
|
|
68
|
+
var getMenuItem = useCallback(function (Com) {
|
|
69
|
+
var item = {};
|
|
70
|
+
var collectMenuItem = function collectMenuItem(menuItem) {
|
|
71
|
+
Object.assign(item, menuItem);
|
|
72
|
+
};
|
|
73
|
+
shouldRerender.current = true;
|
|
74
|
+
list.current.push(function () {
|
|
75
|
+
return /*#__PURE__*/React.createElement(GetMenuItemContext.Provider, {
|
|
76
|
+
value: {
|
|
77
|
+
collectMenuItem: collectMenuItem
|
|
78
|
+
}
|
|
79
|
+
}, Com());
|
|
80
|
+
});
|
|
81
|
+
return item;
|
|
82
|
+
}, []);
|
|
83
|
+
// 防止 list 有重复元素
|
|
84
|
+
var clean = useCallback(function () {
|
|
85
|
+
list.current = [];
|
|
86
|
+
}, []);
|
|
87
|
+
return {
|
|
88
|
+
Component: Component,
|
|
89
|
+
getMenuItems: getMenuItems,
|
|
90
|
+
getMenuItem: getMenuItem,
|
|
91
|
+
clean: clean
|
|
92
|
+
};
|
|
93
|
+
};
|
package/es/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './collection-manager';
|
|
|
13
13
|
export * from './document-title';
|
|
14
14
|
export * from './filter-provider';
|
|
15
15
|
export * from './formula';
|
|
16
|
+
export * from './hooks';
|
|
16
17
|
export * from './i18n';
|
|
17
18
|
export * from './icon';
|
|
18
19
|
export * from './plugin-manager';
|
|
@@ -22,10 +23,8 @@ export * from './record-provider';
|
|
|
22
23
|
export * from './route-switch';
|
|
23
24
|
export * from './schema-component';
|
|
24
25
|
export * from './schema-initializer';
|
|
26
|
+
export * from './schema-items';
|
|
25
27
|
export * from './schema-settings';
|
|
26
28
|
export * from './schema-templates';
|
|
27
|
-
export * from './schema-items';
|
|
28
|
-
export * from './settings-form';
|
|
29
29
|
export * from './system-settings';
|
|
30
30
|
export * from './user';
|
|
31
|
-
export * from './hooks';
|
package/es/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from './collection-manager';
|
|
|
13
13
|
export * from './document-title';
|
|
14
14
|
export * from './filter-provider';
|
|
15
15
|
export * from './formula';
|
|
16
|
+
export * from './hooks';
|
|
16
17
|
export * from './i18n';
|
|
17
18
|
export * from './icon';
|
|
18
19
|
export * from './plugin-manager';
|
|
@@ -22,10 +23,8 @@ export * from './record-provider';
|
|
|
22
23
|
export * from './route-switch';
|
|
23
24
|
export * from './schema-component';
|
|
24
25
|
export * from './schema-initializer';
|
|
26
|
+
export * from './schema-items';
|
|
25
27
|
export * from './schema-settings';
|
|
26
28
|
export * from './schema-templates';
|
|
27
|
-
export * from './schema-items';
|
|
28
|
-
export * from './settings-form';
|
|
29
29
|
export * from './system-settings';
|
|
30
|
-
export * from './user';
|
|
31
|
-
export * from './hooks';
|
|
30
|
+
export * from './user';
|
package/es/locale/en_US.d.ts
CHANGED
|
@@ -294,7 +294,7 @@ declare const _default: {
|
|
|
294
294
|
"Quick upload": string;
|
|
295
295
|
"Select file": string;
|
|
296
296
|
Subtable: string;
|
|
297
|
-
|
|
297
|
+
"Sub-form": string;
|
|
298
298
|
"Field mode": string;
|
|
299
299
|
"Allow add new data": string;
|
|
300
300
|
"Record picker": string;
|
|
@@ -704,5 +704,7 @@ declare const _default: {
|
|
|
704
704
|
"Update or create": string;
|
|
705
705
|
"Find by the following fields": string;
|
|
706
706
|
Create: string;
|
|
707
|
+
"Current form": string;
|
|
708
|
+
"Current object": string;
|
|
707
709
|
};
|
|
708
710
|
export default _default;
|
package/es/locale/en_US.js
CHANGED
|
@@ -294,7 +294,7 @@ export default {
|
|
|
294
294
|
"Quick upload": "Quick upload",
|
|
295
295
|
"Select file": "Select file",
|
|
296
296
|
"Subtable": "Sub-table",
|
|
297
|
-
"
|
|
297
|
+
"Sub-form": "Sub-form",
|
|
298
298
|
"Field mode": "Field mode",
|
|
299
299
|
"Allow add new data": "Allow add new data",
|
|
300
300
|
"Record picker": "Record picker",
|
|
@@ -703,5 +703,7 @@ export default {
|
|
|
703
703
|
"First or create": "First or create",
|
|
704
704
|
"Update or create": "Update or create",
|
|
705
705
|
"Find by the following fields": "Find by the following fields",
|
|
706
|
-
"Create": "Create"
|
|
706
|
+
"Create": "Create",
|
|
707
|
+
"Current form": "Current form",
|
|
708
|
+
"Current object": "Current object"
|
|
707
709
|
};
|
package/es/locale/es_ES.d.ts
CHANGED
|
@@ -280,7 +280,7 @@ declare const _default: {
|
|
|
280
280
|
"Display field title": string;
|
|
281
281
|
"Field component": string;
|
|
282
282
|
Subtable: string;
|
|
283
|
-
|
|
283
|
+
"Sub-form": string;
|
|
284
284
|
"Record picker": string;
|
|
285
285
|
"Toggles the subfield mode": string;
|
|
286
286
|
"Selector mode": string;
|