@nocobase/client 0.10.0-alpha.4 → 0.10.1-alpha.1
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/ACLProvider.js +1 -1
- package/es/acl/Configuration/StrategyActions.js +1 -0
- package/es/api-client/APIClient.js +21 -5
- package/es/collection-manager/CollectionFieldProvider.js +4 -1
- package/es/collection-manager/Configuration/AddFieldAction.js +17 -4
- package/es/collection-manager/Configuration/CollectionFields.js +7 -3
- package/es/collection-manager/Configuration/EditFieldAction.js +14 -4
- package/es/collection-manager/Configuration/OverridingCollectionField.js +14 -4
- package/es/collection-manager/Configuration/components/index.js +3 -0
- package/es/collection-manager/action-hooks.d.ts +4 -0
- package/es/collection-manager/action-hooks.js +36 -61
- package/es/collection-manager/index.d.ts +1 -0
- package/es/collection-manager/index.js +2 -1
- package/es/collection-manager/interfaces/collection.d.ts +2 -0
- package/es/collection-manager/interfaces/collection.js +40 -0
- package/es/collection-manager/interfaces/index.d.ts +2 -0
- package/es/collection-manager/interfaces/index.js +2 -0
- package/es/collection-manager/interfaces/properties/index.d.ts +1 -0
- package/es/collection-manager/interfaces/properties/index.js +10 -0
- package/es/collection-manager/interfaces/properties/operators.d.ts +46 -0
- package/es/collection-manager/interfaces/properties/operators.js +59 -0
- package/es/collection-manager/interfaces/tableoid.d.ts +2 -0
- package/es/collection-manager/interfaces/tableoid.js +43 -0
- package/es/collection-manager/templates/components/PreviewFields.js +2 -0
- package/es/locale/en_US.d.ts +1 -0
- package/es/locale/en_US.js +2 -1
- package/es/locale/ja_JP.d.ts +1 -0
- package/es/locale/ja_JP.js +2 -1
- package/es/locale/uk_UA.d.ts +714 -0
- package/es/locale/uk_UA.js +713 -0
- package/es/locale/zh_CN.d.ts +1 -0
- package/es/locale/zh_CN.js +2 -1
- package/es/pm/index.js +0 -3
- package/es/schema-component/antd/action/Action.Designer.js +33 -11
- package/es/schema-component/antd/action/Action.js +3 -2
- package/es/schema-component/antd/association-field/InternalPicker.js +3 -2
- package/es/schema-component/antd/association-field/InternalViewer.js +2 -2
- package/es/schema-component/antd/association-field/Nester.js +2 -2
- package/es/schema-component/antd/auto-complete/AutoComplete.d.ts +6 -0
- package/es/schema-component/antd/auto-complete/AutoComplete.js +6 -0
- package/es/schema-component/antd/auto-complete/index.d.ts +1 -0
- package/es/schema-component/antd/auto-complete/index.js +1 -0
- package/es/schema-component/antd/calendar/ViewSelect.js +1 -0
- package/es/schema-component/antd/collection-select/CollectionSelect.d.ts +2 -0
- package/es/schema-component/antd/collection-select/CollectionSelect.js +22 -8
- package/es/schema-component/antd/cron/CronSet.d.ts +1 -1
- package/es/schema-component/antd/cron/CronSet.js +4 -3
- package/es/schema-component/antd/date-picker/util.js +3 -0
- package/es/schema-component/antd/filter/Filter.js +9 -4
- package/es/schema-component/antd/filter/FilterGroup.js +1 -1
- package/es/schema-component/antd/filter/FilterItem.js +2 -1
- package/es/schema-component/antd/filter/FilterItems.js +1 -1
- package/es/schema-component/antd/filter/context.d.ts +1 -0
- package/es/schema-component/antd/filter/useFilterActionProps.js +8 -99
- package/es/schema-component/antd/filter/useValues.js +3 -3
- package/es/schema-component/antd/form-item/FormItem.js +47 -38
- package/es/schema-component/antd/form-v2/Templates.js +2 -3
- package/es/schema-component/antd/index.d.ts +1 -0
- package/es/schema-component/antd/index.js +1 -0
- package/es/schema-component/antd/preview/Preview.js +31 -6
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +1 -0
- package/es/schema-component/antd/remote-select/RemoteSelect.js +31 -13
- package/es/schema-component/antd/select/Select.js +1 -1
- package/es/schema-component/antd/upload/ReadPretty.js +74 -15
- package/es/schema-component/antd/upload/Upload.js +102 -24
- package/es/schema-component/antd/upload/shared.d.ts +5 -3
- package/es/schema-component/antd/upload/shared.js +6 -1
- package/es/schema-component/antd/upload/style.less +1 -1
- package/es/schema-component/antd/variable/Input.js +69 -70
- package/es/schema-component/antd/variable/JSONInput.js +22 -5
- package/es/schema-component/antd/variable/TextArea.js +133 -38
- package/es/schema-component/antd/variable/VariableSelect.d.ts +7 -2
- package/es/schema-component/antd/variable/VariableSelect.js +49 -12
- package/es/schema-component/common/utils/uitls.d.ts +3 -2
- package/es/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +2 -2
- package/es/schema-initializer/buttons/TableColumnInitializers.js +4 -4
- package/es/schema-initializer/components/CreateRecordAction.js +43 -6
- package/es/schema-initializer/components/DuplicateAction.js +28 -15
- package/es/schema-initializer/components/assigned-field/AssignedField.js +36 -150
- package/es/schema-initializer/index.d.ts +1 -1
- package/es/schema-initializer/index.js +1 -1
- package/es/schema-settings/DataTemplates/components/Designer.js +1 -0
- package/es/schema-settings/EnableChildCollections/DynamicComponent.d.ts +9 -0
- package/es/schema-settings/EnableChildCollections/DynamicComponent.js +48 -0
- package/es/schema-settings/EnableChildCollections/index.js +5 -4
- package/es/schema-settings/GeneralSchemaDesigner.js +5 -1
- package/es/schema-settings/LinkageRules/LinkageRuleAction.js +2 -0
- package/es/schema-settings/LinkageRules/index.js +4 -3
- package/es/schema-settings/SchemaSettings.js +39 -8
- package/es/schema-settings/VariableInput/VariableInput.d.ts +2 -0
- package/es/schema-settings/VariableInput/VariableInput.js +8 -3
- package/es/schema-settings/VariableInput/hooks/useFormVariable.d.ts +2 -4
- package/es/schema-settings/VariableInput/hooks/useFormVariable.js +15 -8
- package/es/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +16 -5
- package/es/schema-settings/VariableInput/hooks/useIterationVariable.js +63 -45
- package/es/schema-settings/VariableInput/hooks/useUserVariable.js +0 -2
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +22 -5
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.js +4 -4
- package/es/schema-settings/VariableInput/type.d.ts +3 -2
- package/es/user/CurrentUser.js +0 -1
- package/es/user/CurrentUserProvider.d.ts +1 -0
- package/es/user/CurrentUserProvider.js +23 -1
- package/es/user/LanguageSettings.js +1 -0
- package/es/user/SwitchRole.js +2 -24
- package/es/user/ThemeSettings.js +1 -0
- package/lib/acl/ACLProvider.js +1 -1
- package/lib/acl/Configuration/StrategyActions.js +1 -0
- package/lib/api-client/APIClient.js +21 -5
- package/lib/collection-manager/CollectionFieldProvider.js +4 -1
- package/lib/collection-manager/Configuration/AddFieldAction.js +17 -4
- package/lib/collection-manager/Configuration/CollectionFields.js +7 -3
- package/lib/collection-manager/Configuration/EditFieldAction.js +13 -3
- package/lib/collection-manager/Configuration/OverridingCollectionField.js +13 -3
- package/lib/collection-manager/Configuration/components/index.js +3 -0
- package/lib/collection-manager/action-hooks.d.ts +4 -0
- package/lib/collection-manager/action-hooks.js +38 -62
- package/lib/collection-manager/index.d.ts +1 -0
- package/lib/collection-manager/index.js +11 -0
- package/lib/collection-manager/interfaces/collection.d.ts +2 -0
- package/lib/collection-manager/interfaces/collection.js +47 -0
- package/lib/collection-manager/interfaces/index.d.ts +2 -0
- package/lib/collection-manager/interfaces/index.js +22 -0
- package/lib/collection-manager/interfaces/properties/index.d.ts +1 -0
- package/lib/collection-manager/interfaces/properties/index.js +13 -2
- package/lib/collection-manager/interfaces/properties/operators.d.ts +46 -0
- package/lib/collection-manager/interfaces/properties/operators.js +63 -2
- package/lib/collection-manager/interfaces/tableoid.d.ts +2 -0
- package/lib/collection-manager/interfaces/tableoid.js +50 -0
- package/lib/collection-manager/templates/components/PreviewFields.js +2 -0
- package/lib/locale/en_US.d.ts +1 -0
- package/lib/locale/en_US.js +2 -1
- package/lib/locale/ja_JP.d.ts +1 -0
- package/lib/locale/ja_JP.js +2 -1
- package/lib/locale/uk_UA.d.ts +714 -0
- package/lib/locale/uk_UA.js +720 -0
- package/lib/locale/zh_CN.d.ts +1 -0
- package/lib/locale/zh_CN.js +2 -1
- package/lib/pm/index.js +0 -3
- package/lib/schema-component/antd/action/Action.Designer.js +32 -10
- package/lib/schema-component/antd/action/Action.js +3 -2
- package/lib/schema-component/antd/association-field/InternalPicker.js +2 -1
- package/lib/schema-component/antd/association-field/InternalViewer.js +1 -1
- package/lib/schema-component/antd/association-field/Nester.js +2 -2
- package/lib/schema-component/antd/auto-complete/AutoComplete.d.ts +6 -0
- package/lib/schema-component/antd/auto-complete/AutoComplete.js +13 -0
- package/lib/schema-component/antd/auto-complete/index.d.ts +1 -0
- package/lib/schema-component/antd/auto-complete/index.js +16 -0
- package/lib/schema-component/antd/calendar/ViewSelect.js +1 -0
- package/lib/schema-component/antd/collection-select/CollectionSelect.d.ts +2 -0
- package/lib/schema-component/antd/collection-select/CollectionSelect.js +22 -7
- package/lib/schema-component/antd/cron/CronSet.d.ts +1 -1
- package/lib/schema-component/antd/cron/CronSet.js +17 -16
- package/lib/schema-component/antd/date-picker/util.js +3 -0
- package/lib/schema-component/antd/filter/Filter.js +11 -5
- package/lib/schema-component/antd/filter/FilterGroup.js +1 -1
- package/lib/schema-component/antd/filter/FilterItem.js +2 -1
- package/lib/schema-component/antd/filter/FilterItems.js +1 -1
- package/lib/schema-component/antd/filter/context.d.ts +1 -0
- package/lib/schema-component/antd/filter/useFilterActionProps.js +8 -99
- package/lib/schema-component/antd/filter/useValues.js +3 -3
- package/lib/schema-component/antd/form-item/FormItem.js +45 -36
- package/lib/schema-component/antd/form-v2/Templates.js +2 -3
- package/lib/schema-component/antd/index.d.ts +1 -0
- package/lib/schema-component/antd/index.js +11 -0
- package/lib/schema-component/antd/preview/Preview.js +30 -5
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +1 -0
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +30 -12
- package/lib/schema-component/antd/upload/ReadPretty.js +72 -13
- package/lib/schema-component/antd/upload/Upload.js +99 -21
- package/lib/schema-component/antd/upload/shared.d.ts +5 -3
- package/lib/schema-component/antd/upload/shared.js +8 -2
- package/lib/schema-component/antd/upload/style.less +1 -1
- package/lib/schema-component/antd/variable/Input.js +67 -67
- package/lib/schema-component/antd/variable/JSONInput.js +21 -4
- package/lib/schema-component/antd/variable/TextArea.js +131 -37
- package/lib/schema-component/antd/variable/VariableSelect.d.ts +7 -2
- package/lib/schema-component/antd/variable/VariableSelect.js +47 -11
- package/lib/schema-component/common/utils/uitls.d.ts +3 -2
- package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +2 -2
- package/lib/schema-initializer/buttons/TableColumnInitializers.js +7 -7
- package/lib/schema-initializer/components/CreateRecordAction.js +42 -5
- package/lib/schema-initializer/components/DuplicateAction.js +41 -27
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +34 -148
- package/lib/schema-initializer/index.d.ts +1 -1
- package/lib/schema-initializer/index.js +7 -0
- package/lib/schema-settings/DataTemplates/components/Designer.js +1 -0
- package/lib/schema-settings/EnableChildCollections/DynamicComponent.d.ts +9 -0
- package/lib/schema-settings/EnableChildCollections/DynamicComponent.js +58 -0
- package/lib/schema-settings/EnableChildCollections/index.js +5 -4
- package/lib/schema-settings/GeneralSchemaDesigner.js +5 -1
- package/lib/schema-settings/LinkageRules/LinkageRuleAction.js +2 -0
- package/lib/schema-settings/LinkageRules/index.js +4 -3
- package/lib/schema-settings/SchemaSettings.js +36 -5
- package/lib/schema-settings/VariableInput/VariableInput.d.ts +2 -0
- package/lib/schema-settings/VariableInput/VariableInput.js +7 -2
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.d.ts +2 -4
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +15 -8
- package/lib/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +16 -5
- package/lib/schema-settings/VariableInput/hooks/useIterationVariable.js +63 -45
- package/lib/schema-settings/VariableInput/hooks/useUserVariable.js +0 -2
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +22 -5
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +4 -4
- package/lib/schema-settings/VariableInput/type.d.ts +3 -2
- package/lib/user/CurrentUser.js +0 -1
- package/lib/user/CurrentUserProvider.d.ts +1 -0
- package/lib/user/CurrentUserProvider.js +24 -1
- package/lib/user/LanguageSettings.js +1 -0
- package/lib/user/SwitchRole.js +2 -24
- package/lib/user/ThemeSettings.js +1 -0
- package/package.json +5 -5
package/es/acl/ACLProvider.js
CHANGED
|
@@ -202,7 +202,7 @@ export var ACLCollectionProvider = function ACLCollectionProvider(props) {
|
|
|
202
202
|
if (allowAll) {
|
|
203
203
|
return props.children;
|
|
204
204
|
}
|
|
205
|
-
var actionPath = schema['x-acl-action'];
|
|
205
|
+
var actionPath = schema === null || schema === void 0 ? void 0 : schema['x-acl-action'];
|
|
206
206
|
if (!actionPath) {
|
|
207
207
|
return props.children;
|
|
208
208
|
}
|
|
@@ -93,6 +93,7 @@ export var StrategyActions = connect(function (props) {
|
|
|
93
93
|
title: t('Data scope'),
|
|
94
94
|
render: function render(scope, action) {
|
|
95
95
|
return !action.onNewRecord && /*#__PURE__*/React.createElement(Select, {
|
|
96
|
+
dropdownMatchSelectWidth: false,
|
|
96
97
|
size: 'small',
|
|
97
98
|
value: scope,
|
|
98
99
|
options: [{
|
|
@@ -31,6 +31,7 @@ var handleErrorMessage = function handleErrorMessage(error) {
|
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
+
var errorCache = new Map();
|
|
34
35
|
export var APIClient = /*#__PURE__*/function (_APIClientSDK) {
|
|
35
36
|
_inherits(APIClient, _APIClientSDK);
|
|
36
37
|
var _super = _createSuper(APIClient);
|
|
@@ -82,12 +83,27 @@ export var APIClient = /*#__PURE__*/function (_APIClientSDK) {
|
|
|
82
83
|
if ((error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : _error$response3$data.type) === 'application/json') {
|
|
83
84
|
handleErrorMessage(error);
|
|
84
85
|
} else {
|
|
85
|
-
var _error$response4, _error$response4$data,
|
|
86
|
+
var _error$response4, _error$response4$data, _errs, _errs$map;
|
|
87
|
+
if (errorCache.size > 10) {
|
|
88
|
+
errorCache.clear();
|
|
89
|
+
}
|
|
90
|
+
var errs = (error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : _error$response4$data.errors) || [{
|
|
91
|
+
message: 'Server error'
|
|
92
|
+
}];
|
|
93
|
+
errs = errs.filter(function (error) {
|
|
94
|
+
var lastTime = errorCache.get(error.message);
|
|
95
|
+
if (lastTime && new Date().getTime() - lastTime < 500) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
errorCache.set(error.message, new Date().getTime());
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
if (errs.length === 0) {
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
86
104
|
_notification.error({
|
|
87
|
-
message:
|
|
88
|
-
return /*#__PURE__*/React.createElement('div', {
|
|
89
|
-
children: error.message
|
|
90
|
-
});
|
|
105
|
+
message: (_errs = errs) === null || _errs === void 0 ? void 0 : (_errs$map = _errs.map) === null || _errs$map === void 0 ? void 0 : _errs$map.call(_errs, function (error) {
|
|
106
|
+
return /*#__PURE__*/React.createElement('div', {}, error.message);
|
|
91
107
|
})
|
|
92
108
|
});
|
|
93
109
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useFieldSchema } from '@formily/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useRecord } from '../record-provider';
|
|
3
4
|
import { CollectionFieldContext } from './context';
|
|
4
5
|
import { useCollection, useCollectionManager } from './hooks';
|
|
5
6
|
export var CollectionFieldProvider = function CollectionFieldProvider(props) {
|
|
@@ -11,9 +12,11 @@ export var CollectionFieldProvider = function CollectionFieldProvider(props) {
|
|
|
11
12
|
var fieldSchema = useFieldSchema();
|
|
12
13
|
var _useCollection = useCollection(),
|
|
13
14
|
getField = _useCollection.getField;
|
|
15
|
+
var _useRecord = useRecord(),
|
|
16
|
+
__collection = _useRecord.__collection;
|
|
14
17
|
var _useCollectionManager = useCollectionManager(),
|
|
15
18
|
getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
|
|
16
|
-
var value = field || getField((field === null || field === void 0 ? void 0 : field.name) || name) || getCollectionJoinField(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-collection-field']);
|
|
19
|
+
var value = __collection ? getCollectionJoinField("".concat(__collection, ".").concat(name)) : field || getField((field === null || field === void 0 ? void 0 : field.name) || name) || getCollectionJoinField(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-collection-field']);
|
|
17
20
|
if (!value) {
|
|
18
21
|
return fallback;
|
|
19
22
|
}
|
|
@@ -24,9 +24,9 @@ import { useTranslation } from 'react-i18next';
|
|
|
24
24
|
import { useRequest } from '../../api-client';
|
|
25
25
|
import { RecordProvider, useRecord } from '../../record-provider';
|
|
26
26
|
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
|
27
|
-
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
28
27
|
import { useCancelAction } from '../action-hooks';
|
|
29
28
|
import { useCollectionManager } from '../hooks';
|
|
29
|
+
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
30
30
|
import * as components from './components';
|
|
31
31
|
import { getOptions } from './interfaces';
|
|
32
32
|
var getSchema = function getSchema(schema, record, compile) {
|
|
@@ -197,10 +197,12 @@ export var AddFieldAction = function AddFieldAction(props) {
|
|
|
197
197
|
record = props.item,
|
|
198
198
|
children = props.children,
|
|
199
199
|
trigger = props.trigger,
|
|
200
|
-
align = props.align
|
|
200
|
+
align = props.align,
|
|
201
|
+
database = props.database;
|
|
201
202
|
var _useCollectionManager2 = useCollectionManager(),
|
|
202
203
|
getInterface = _useCollectionManager2.getInterface,
|
|
203
|
-
getTemplate = _useCollectionManager2.getTemplate
|
|
204
|
+
getTemplate = _useCollectionManager2.getTemplate,
|
|
205
|
+
collections = _useCollectionManager2.collections;
|
|
204
206
|
var _useState = useState(false),
|
|
205
207
|
_useState2 = _slicedToArray(_useState, 2),
|
|
206
208
|
visible = _useState2[0],
|
|
@@ -216,6 +218,14 @@ export var AddFieldAction = function AddFieldAction(props) {
|
|
|
216
218
|
var compile = useCompile();
|
|
217
219
|
var _useTranslation = useTranslation(),
|
|
218
220
|
t = _useTranslation.t;
|
|
221
|
+
var currentCollections = useMemo(function () {
|
|
222
|
+
return collections.map(function (v) {
|
|
223
|
+
return {
|
|
224
|
+
label: compile(v.title),
|
|
225
|
+
value: v.name
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
}, []);
|
|
219
229
|
var getFieldOptions = useCallback(function () {
|
|
220
230
|
var _ref = getTemplate(record.template) || {},
|
|
221
231
|
availableFieldInterfaces = _ref.availableFieldInterfaces;
|
|
@@ -229,6 +239,8 @@ export var AddFieldAction = function AddFieldAction(props) {
|
|
|
229
239
|
children: v.children.filter(function (v) {
|
|
230
240
|
if (v.value === 'id') {
|
|
231
241
|
return typeof record['autoGenId'] === 'boolean' ? record['autoGenId'] : true;
|
|
242
|
+
} else if (v.value === 'tableoid') {
|
|
243
|
+
return (database === null || database === void 0 ? void 0 : database.dialect) === 'postgres';
|
|
232
244
|
} else {
|
|
233
245
|
return typeof record[v.value] === 'boolean' ? record[v.value] : true;
|
|
234
246
|
}
|
|
@@ -330,7 +342,8 @@ export var AddFieldAction = function AddFieldAction(props) {
|
|
|
330
342
|
useCreateCollectionField: useCreateCollectionField,
|
|
331
343
|
record: record,
|
|
332
344
|
showReverseFieldConfig: true,
|
|
333
|
-
targetScope: targetScope
|
|
345
|
+
targetScope: targetScope,
|
|
346
|
+
collections: currentCollections
|
|
334
347
|
}, scope)
|
|
335
348
|
})));
|
|
336
349
|
};
|
|
@@ -25,17 +25,18 @@ import { FieldContext, FormContext, useField } from '@formily/react';
|
|
|
25
25
|
import { Space, Switch, Table, Tag, Tooltip } from 'antd';
|
|
26
26
|
import React, { useContext, useMemo } from 'react';
|
|
27
27
|
import { useTranslation } from 'react-i18next';
|
|
28
|
+
import { useCurrentAppInfo } from '../../appInfo';
|
|
28
29
|
import { RecordProvider, useRecord } from '../../record-provider';
|
|
29
30
|
import { Action, useAttach, useCompile } from '../../schema-component';
|
|
30
|
-
import { ResourceActionContext, ResourceActionProvider, useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
31
31
|
import { isDeleteButtonDisabled, useBulkDestroyActionAndRefreshCM, useDestroyActionAndRefreshCM } from '../action-hooks';
|
|
32
32
|
import { useCollectionManager } from '../hooks/useCollectionManager';
|
|
33
|
+
import { ResourceActionContext, ResourceActionProvider, useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
33
34
|
import { AddCollectionField } from './AddFieldAction';
|
|
34
35
|
import { EditCollectionField } from './EditFieldAction';
|
|
35
36
|
import { OverridingCollectionField } from './OverridingCollectionField';
|
|
37
|
+
import { collection } from './schemas/collectionFields';
|
|
36
38
|
import { SyncFieldsAction } from './SyncFieldsAction';
|
|
37
39
|
import { ViewCollectionField } from './ViewInheritedField';
|
|
38
|
-
import { collection } from './schemas/collectionFields';
|
|
39
40
|
var indentStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-table {\n margin-left: -16px !important;\n }\n"])));
|
|
40
41
|
var rowStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ant-table-cell {\n background-color: white;\n }\n"])));
|
|
41
42
|
var tableContainer = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n tr {\n display: flex;\n }\n td,\n th {\n flex: 2;\n width: 0;\n &:last-child {\n flex: 1;\n }\n }\n .ant-table-selection-column,\n .ant-table-row-expand-icon-cell {\n flex-basis: 50px !important;\n min-width: 50px;\n flex: 0;\n }\n"])));
|
|
@@ -289,6 +290,8 @@ export var CollectionFields = function CollectionFields() {
|
|
|
289
290
|
var field = useField();
|
|
290
291
|
var _useRecord3 = useRecord(),
|
|
291
292
|
name = _useRecord3.name;
|
|
293
|
+
var _useCurrentAppInfo = useCurrentAppInfo(),
|
|
294
|
+
database = _useCurrentAppInfo.data.database;
|
|
292
295
|
var _useCollectionManager5 = useCollectionManager(),
|
|
293
296
|
getInterface = _useCollectionManager5.getInterface,
|
|
294
297
|
getInheritCollections = _useCollectionManager5.getInheritCollections,
|
|
@@ -411,7 +414,8 @@ export var CollectionFields = function CollectionFields() {
|
|
|
411
414
|
};
|
|
412
415
|
}, [t]);
|
|
413
416
|
var addProps = {
|
|
414
|
-
type: 'primary'
|
|
417
|
+
type: 'primary',
|
|
418
|
+
database: database
|
|
415
419
|
};
|
|
416
420
|
var syncProps = {
|
|
417
421
|
type: 'primary'
|
|
@@ -18,14 +18,14 @@ import { useForm } from '@formily/react';
|
|
|
18
18
|
import { uid } from '@formily/shared';
|
|
19
19
|
import cloneDeep from 'lodash/cloneDeep';
|
|
20
20
|
import set from 'lodash/set';
|
|
21
|
-
import React, { useState } from 'react';
|
|
21
|
+
import React, { useMemo, useState } from 'react';
|
|
22
22
|
import { useTranslation } from 'react-i18next';
|
|
23
23
|
import { useAPIClient, useRequest } from '../../api-client';
|
|
24
24
|
import { RecordProvider, useRecord } from '../../record-provider';
|
|
25
25
|
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
|
26
|
-
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
27
26
|
import { useCancelAction, useUpdateAction } from '../action-hooks';
|
|
28
27
|
import { useCollectionManager } from '../hooks';
|
|
28
|
+
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
29
29
|
import * as components from './components';
|
|
30
30
|
var getSchema = function getSchema(schema, record, compile, getContainer) {
|
|
31
31
|
var _record$__parent;
|
|
@@ -167,7 +167,8 @@ export var EditFieldAction = function EditFieldAction(props) {
|
|
|
167
167
|
record = props.item,
|
|
168
168
|
children = props.children;
|
|
169
169
|
var _useCollectionManager2 = useCollectionManager(),
|
|
170
|
-
getInterface = _useCollectionManager2.getInterface
|
|
170
|
+
getInterface = _useCollectionManager2.getInterface,
|
|
171
|
+
collections = _useCollectionManager2.collections;
|
|
171
172
|
var _useState = useState(false),
|
|
172
173
|
_useState2 = _slicedToArray(_useState, 2),
|
|
173
174
|
visible = _useState2[0],
|
|
@@ -184,6 +185,14 @@ export var EditFieldAction = function EditFieldAction(props) {
|
|
|
184
185
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
185
186
|
data = _useState6[0],
|
|
186
187
|
setData = _useState6[1];
|
|
188
|
+
var currentCollections = useMemo(function () {
|
|
189
|
+
return collections.map(function (v) {
|
|
190
|
+
return {
|
|
191
|
+
label: compile(v.title),
|
|
192
|
+
value: v.name
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
}, []);
|
|
187
196
|
return /*#__PURE__*/React.createElement(RecordProvider, {
|
|
188
197
|
record: record
|
|
189
198
|
}, /*#__PURE__*/React.createElement(ActionContextProvider, {
|
|
@@ -240,7 +249,8 @@ export var EditFieldAction = function EditFieldAction(props) {
|
|
|
240
249
|
getContainer: getContainer,
|
|
241
250
|
useUpdateCollectionField: useUpdateCollectionField,
|
|
242
251
|
useCancelAction: useCancelAction,
|
|
243
|
-
showReverseFieldConfig: !(data === null || data === void 0 ? void 0 : data.reverseField)
|
|
252
|
+
showReverseFieldConfig: !(data === null || data === void 0 ? void 0 : data.reverseField),
|
|
253
|
+
collections: currentCollections
|
|
244
254
|
}, scope)
|
|
245
255
|
})));
|
|
246
256
|
};
|
|
@@ -18,14 +18,14 @@ import { useForm } from '@formily/react';
|
|
|
18
18
|
import { uid } from '@formily/shared';
|
|
19
19
|
import { omit, set } from 'lodash';
|
|
20
20
|
import cloneDeep from 'lodash/cloneDeep';
|
|
21
|
-
import React, { useState } from 'react';
|
|
21
|
+
import React, { useMemo, useState } from 'react';
|
|
22
22
|
import { useTranslation } from 'react-i18next';
|
|
23
23
|
import { useAPIClient, useRequest } from '../../api-client';
|
|
24
24
|
import { RecordProvider, useRecord } from '../../record-provider';
|
|
25
25
|
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
|
26
|
-
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
27
26
|
import { useCancelAction } from '../action-hooks';
|
|
28
27
|
import { useCollectionManager } from '../hooks';
|
|
28
|
+
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
|
29
29
|
import * as components from './components';
|
|
30
30
|
var getSchema = function getSchema(schema, record, compile, getContainer) {
|
|
31
31
|
var _record$__parent;
|
|
@@ -157,7 +157,8 @@ export var OverridingFieldAction = function OverridingFieldAction(props) {
|
|
|
157
157
|
var _useCollectionManager2 = useCollectionManager(),
|
|
158
158
|
getInterface = _useCollectionManager2.getInterface,
|
|
159
159
|
getCurrentCollectionFields = _useCollectionManager2.getCurrentCollectionFields,
|
|
160
|
-
getChildrenCollections = _useCollectionManager2.getChildrenCollections
|
|
160
|
+
getChildrenCollections = _useCollectionManager2.getChildrenCollections,
|
|
161
|
+
collections = _useCollectionManager2.collections;
|
|
161
162
|
var _useState = useState(false),
|
|
162
163
|
_useState2 = _slicedToArray(_useState, 2),
|
|
163
164
|
visible = _useState2[0],
|
|
@@ -183,6 +184,14 @@ export var OverridingFieldAction = function OverridingFieldAction(props) {
|
|
|
183
184
|
setData = _useState6[1];
|
|
184
185
|
var currentFields = getCurrentCollectionFields(currentCollection);
|
|
185
186
|
var disabled = getIsOverriding(currentFields, record);
|
|
187
|
+
var currentCollections = useMemo(function () {
|
|
188
|
+
return collections.map(function (v) {
|
|
189
|
+
return {
|
|
190
|
+
label: compile(v.title),
|
|
191
|
+
value: v.name
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
}, []);
|
|
186
195
|
return /*#__PURE__*/React.createElement(RecordProvider, {
|
|
187
196
|
record: _objectSpread(_objectSpread({}, record), {}, {
|
|
188
197
|
collectionName: record.__parent.name
|
|
@@ -254,7 +263,8 @@ export var OverridingFieldAction = function OverridingFieldAction(props) {
|
|
|
254
263
|
targetScope: {
|
|
255
264
|
target: getFilterCollections(target),
|
|
256
265
|
through: getFilterCollections(through)
|
|
257
|
-
}
|
|
266
|
+
},
|
|
267
|
+
collections: currentCollections
|
|
258
268
|
}, scope)
|
|
259
269
|
})));
|
|
260
270
|
};
|
|
@@ -38,6 +38,7 @@ export var ThroughForeignKey = observer(function () {
|
|
|
38
38
|
getCollectionFields = _useCollectionManager3.getCollectionFields;
|
|
39
39
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
|
|
40
40
|
allowClear: true,
|
|
41
|
+
dropdownMatchSelectWidth: false,
|
|
41
42
|
placeholder: '留空时,自动生成 FK 字段',
|
|
42
43
|
disabled: field.disabled,
|
|
43
44
|
value: field.value,
|
|
@@ -61,6 +62,7 @@ export var TargetForeignKey = observer(function () {
|
|
|
61
62
|
getCollectionFields = _useCollectionManager4.getCollectionFields;
|
|
62
63
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
|
|
63
64
|
allowClear: true,
|
|
65
|
+
dropdownMatchSelectWidth: false,
|
|
64
66
|
placeholder: '留空时,自动生成 FK 字段',
|
|
65
67
|
disabled: field.disabled,
|
|
66
68
|
value: field.value,
|
|
@@ -85,6 +87,7 @@ export var SourceCollection = observer(function () {
|
|
|
85
87
|
var compile = useCompile();
|
|
86
88
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
|
|
87
89
|
disabled: true,
|
|
90
|
+
dropdownMatchSelectWidth: false,
|
|
88
91
|
value: collection.name,
|
|
89
92
|
options: [{
|
|
90
93
|
value: collection.name,
|
|
@@ -25,6 +25,10 @@ export declare const useChildrenCollections: (collectionName: string) => {
|
|
|
25
25
|
value: any;
|
|
26
26
|
label: any;
|
|
27
27
|
}[];
|
|
28
|
+
export declare const useSelfAndChildrenCollections: (collectionName: string) => {
|
|
29
|
+
value: any;
|
|
30
|
+
label: any;
|
|
31
|
+
}[];
|
|
28
32
|
export declare const useCollectionFilterOptions: (collectionName: string) => any[];
|
|
29
33
|
export declare const useLinkageCollectionFilterOptions: (collectionName: string) => any[];
|
|
30
34
|
export declare const useCollectionFieldsOptions: (collectionName: string, maxDepth?: number, excludes?: any[]) => any[];
|
|
@@ -22,7 +22,6 @@ import omit from 'lodash/omit';
|
|
|
22
22
|
import { useEffect, useMemo } from 'react';
|
|
23
23
|
import { useTranslation } from 'react-i18next';
|
|
24
24
|
import { useCollection, useCollectionManager } from '.';
|
|
25
|
-
import { useCompile } from '..';
|
|
26
25
|
import { useRequest } from '../api-client';
|
|
27
26
|
import { useRecord } from '../record-provider';
|
|
28
27
|
import { useActionContext } from '../schema-component';
|
|
@@ -163,13 +162,31 @@ export var useChildrenCollections = function useChildrenCollections(collectionNa
|
|
|
163
162
|
};
|
|
164
163
|
});
|
|
165
164
|
};
|
|
166
|
-
export var
|
|
165
|
+
export var useSelfAndChildrenCollections = function useSelfAndChildrenCollections(collectionName) {
|
|
167
166
|
var _useCollectionManager3 = useCollectionManager(),
|
|
168
|
-
getCollectionFields = _useCollectionManager3.getCollectionFields,
|
|
169
|
-
getInterface = _useCollectionManager3.getInterface,
|
|
170
167
|
getChildrenCollections = _useCollectionManager3.getChildrenCollections,
|
|
171
168
|
getCollection = _useCollectionManager3.getCollection;
|
|
172
|
-
var
|
|
169
|
+
var childrenCollections = getChildrenCollections(collectionName);
|
|
170
|
+
var self = getCollection(collectionName);
|
|
171
|
+
if (!collectionName) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
var options = childrenCollections.map(function (collection) {
|
|
175
|
+
return {
|
|
176
|
+
value: collection.name,
|
|
177
|
+
label: (collection === null || collection === void 0 ? void 0 : collection.title) || collection.name
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
options.unshift({
|
|
181
|
+
value: self.name,
|
|
182
|
+
label: (self === null || self === void 0 ? void 0 : self.title) || self.name
|
|
183
|
+
});
|
|
184
|
+
return options;
|
|
185
|
+
};
|
|
186
|
+
export var useCollectionFilterOptions = function useCollectionFilterOptions(collectionName) {
|
|
187
|
+
var _useCollectionManager4 = useCollectionManager(),
|
|
188
|
+
getCollectionFields = _useCollectionManager4.getCollectionFields,
|
|
189
|
+
getInterface = _useCollectionManager4.getInterface;
|
|
173
190
|
return useMemo(function () {
|
|
174
191
|
var fields = getCollectionFields(collectionName);
|
|
175
192
|
var field2option = function field2option(field, depth) {
|
|
@@ -223,55 +240,13 @@ export var useCollectionFilterOptions = function useCollectionFilterOptions(coll
|
|
|
223
240
|
return options;
|
|
224
241
|
};
|
|
225
242
|
var options = getOptions(fields, 1);
|
|
226
|
-
var collection = getCollection(collectionName);
|
|
227
|
-
var childrenCollections = getChildrenCollections(collectionName);
|
|
228
|
-
if (childrenCollections.length > 0 && !options.find(function (v) {
|
|
229
|
-
return v.name == 'tableoid';
|
|
230
|
-
})) {
|
|
231
|
-
options.push({
|
|
232
|
-
name: 'tableoid',
|
|
233
|
-
type: 'string',
|
|
234
|
-
title: '{{t("Table OID(Inheritance)")}}',
|
|
235
|
-
schema: {
|
|
236
|
-
'x-component': 'Select',
|
|
237
|
-
enum: [{
|
|
238
|
-
value: collectionName,
|
|
239
|
-
label: compile(collection.title)
|
|
240
|
-
}].concat(childrenCollections.map(function (v) {
|
|
241
|
-
return {
|
|
242
|
-
value: v.name,
|
|
243
|
-
label: compile(v.title)
|
|
244
|
-
};
|
|
245
|
-
}))
|
|
246
|
-
},
|
|
247
|
-
operators: [{
|
|
248
|
-
label: '{{t("contains")}}',
|
|
249
|
-
value: '$childIn',
|
|
250
|
-
schema: {
|
|
251
|
-
'x-component': 'Select',
|
|
252
|
-
'x-component-props': {
|
|
253
|
-
mode: 'tags'
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}, {
|
|
257
|
-
label: '{{t("does not contain")}}',
|
|
258
|
-
value: '$childNotIn',
|
|
259
|
-
schema: {
|
|
260
|
-
'x-component': 'Select',
|
|
261
|
-
'x-component-props': {
|
|
262
|
-
mode: 'tags'
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}]
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
243
|
return options;
|
|
269
244
|
}, [collectionName]);
|
|
270
245
|
};
|
|
271
246
|
export var useLinkageCollectionFilterOptions = function useLinkageCollectionFilterOptions(collectionName) {
|
|
272
|
-
var
|
|
273
|
-
getCollectionFields =
|
|
274
|
-
getInterface =
|
|
247
|
+
var _useCollectionManager5 = useCollectionManager(),
|
|
248
|
+
getCollectionFields = _useCollectionManager5.getCollectionFields,
|
|
249
|
+
getInterface = _useCollectionManager5.getInterface;
|
|
275
250
|
var fields = getCollectionFields(collectionName);
|
|
276
251
|
var field2option = function field2option(field, depth) {
|
|
277
252
|
var _field$uiSchema3, _operators$filter2;
|
|
@@ -335,9 +310,9 @@ export var useLinkageCollectionFilterOptions = function useLinkageCollectionFilt
|
|
|
335
310
|
export var useCollectionFieldsOptions = function useCollectionFieldsOptions(collectionName) {
|
|
336
311
|
var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
337
312
|
var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
338
|
-
var
|
|
339
|
-
getCollectionFields =
|
|
340
|
-
getInterface =
|
|
313
|
+
var _useCollectionManager6 = useCollectionManager(),
|
|
314
|
+
getCollectionFields = _useCollectionManager6.getCollectionFields,
|
|
315
|
+
getInterface = _useCollectionManager6.getInterface;
|
|
341
316
|
var fields = getCollectionFields(collectionName).filter(function (v) {
|
|
342
317
|
return !excludes.includes(v.interface);
|
|
343
318
|
});
|
|
@@ -705,8 +680,8 @@ export var useValuesFromRA = function useValuesFromRA(options) {
|
|
|
705
680
|
export var useCreateActionAndRefreshCM = function useCreateActionAndRefreshCM() {
|
|
706
681
|
var _useCreateAction = useCreateAction(),
|
|
707
682
|
_run3 = _useCreateAction.run;
|
|
708
|
-
var
|
|
709
|
-
refreshCM =
|
|
683
|
+
var _useCollectionManager7 = useCollectionManager(),
|
|
684
|
+
refreshCM = _useCollectionManager7.refreshCM;
|
|
710
685
|
return {
|
|
711
686
|
run: function run() {
|
|
712
687
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
@@ -730,8 +705,8 @@ export var useCreateActionAndRefreshCM = function useCreateActionAndRefreshCM()
|
|
|
730
705
|
export var useUpdateActionAndRefreshCM = function useUpdateActionAndRefreshCM() {
|
|
731
706
|
var _useUpdateAction = useUpdateAction(),
|
|
732
707
|
_run4 = _useUpdateAction.run;
|
|
733
|
-
var
|
|
734
|
-
refreshCM =
|
|
708
|
+
var _useCollectionManager8 = useCollectionManager(),
|
|
709
|
+
refreshCM = _useCollectionManager8.refreshCM;
|
|
735
710
|
return {
|
|
736
711
|
run: function run() {
|
|
737
712
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
@@ -755,8 +730,8 @@ export var useUpdateActionAndRefreshCM = function useUpdateActionAndRefreshCM()
|
|
|
755
730
|
export var useDestroyActionAndRefreshCM = function useDestroyActionAndRefreshCM() {
|
|
756
731
|
var _useDestroyAction = useDestroyAction(),
|
|
757
732
|
_run5 = _useDestroyAction.run;
|
|
758
|
-
var
|
|
759
|
-
refreshCM =
|
|
733
|
+
var _useCollectionManager9 = useCollectionManager(),
|
|
734
|
+
refreshCM = _useCollectionManager9.refreshCM;
|
|
760
735
|
return {
|
|
761
736
|
run: function run() {
|
|
762
737
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
@@ -791,8 +766,8 @@ export var isDeleteButtonDisabled = function isDeleteButtonDisabled(record) {
|
|
|
791
766
|
export var useBulkDestroyActionAndRefreshCM = function useBulkDestroyActionAndRefreshCM() {
|
|
792
767
|
var _useBulkDestroyAction = useBulkDestroyAction(),
|
|
793
768
|
_run6 = _useBulkDestroyAction.run;
|
|
794
|
-
var
|
|
795
|
-
refreshCM =
|
|
769
|
+
var _useCollectionManager10 = useCollectionManager(),
|
|
770
|
+
refreshCM = _useCollectionManager10.refreshCM;
|
|
796
771
|
return {
|
|
797
772
|
run: function run() {
|
|
798
773
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
@@ -16,4 +16,5 @@ export * from './ResourceActionProvider';
|
|
|
16
16
|
export { getConfigurableProperties } from './templates/properties';
|
|
17
17
|
export * from './templates/types';
|
|
18
18
|
export * from './types';
|
|
19
|
-
export * from './CollectionHistoryProvider';
|
|
19
|
+
export * from './CollectionHistoryProvider';
|
|
20
|
+
export * from './interfaces/properties';
|
|
@@ -0,0 +1,40 @@
|
|
|
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
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
|
+
import { collectionDataSource, defaultProps, operators } from './properties';
|
|
8
|
+
export var collection = {
|
|
9
|
+
name: 'collection',
|
|
10
|
+
type: 'string',
|
|
11
|
+
group: 'advanced',
|
|
12
|
+
order: 5,
|
|
13
|
+
title: '{{t("Collection")}}',
|
|
14
|
+
sortable: true,
|
|
15
|
+
default: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
uiSchema: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
'x-component': 'CollectionSelect'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
availableTypes: ['string'],
|
|
23
|
+
hasDefaultValue: false,
|
|
24
|
+
properties: _objectSpread(_objectSpread({}, defaultProps), {}, {
|
|
25
|
+
'uiSchema.enum': collectionDataSource
|
|
26
|
+
}),
|
|
27
|
+
filterable: {
|
|
28
|
+
operators: operators.collection
|
|
29
|
+
},
|
|
30
|
+
schemaInitialize: function schemaInitialize(schema, _ref) {
|
|
31
|
+
var block = _ref.block;
|
|
32
|
+
var props = schema['x-component-props'] = schema['x-component-props'] || {};
|
|
33
|
+
props.style = _objectSpread(_objectSpread({}, props.style || {}), {}, {
|
|
34
|
+
width: '100%'
|
|
35
|
+
});
|
|
36
|
+
if (['Table', 'Kanban'].includes(block)) {
|
|
37
|
+
props['ellipsis'] = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './checkbox';
|
|
2
2
|
export * from './checkboxGroup';
|
|
3
3
|
export * from './chinaRegion';
|
|
4
|
+
export * from './collection';
|
|
4
5
|
export * from './createdAt';
|
|
5
6
|
export * from './createdBy';
|
|
6
7
|
export * from './datetime';
|
|
@@ -25,6 +26,7 @@ export * from './radioGroup';
|
|
|
25
26
|
export * from './richText';
|
|
26
27
|
export * from './select';
|
|
27
28
|
export * from './subTable';
|
|
29
|
+
export * from './tableoid';
|
|
28
30
|
export * from './textarea';
|
|
29
31
|
export * from './time';
|
|
30
32
|
export * from './updatedAt';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './checkbox';
|
|
2
2
|
export * from './checkboxGroup';
|
|
3
3
|
export * from './chinaRegion';
|
|
4
|
+
export * from './collection';
|
|
4
5
|
export * from './createdAt';
|
|
5
6
|
export * from './createdBy';
|
|
6
7
|
export * from './datetime';
|
|
@@ -25,6 +26,7 @@ export * from './radioGroup';
|
|
|
25
26
|
export * from './richText';
|
|
26
27
|
export * from './select';
|
|
27
28
|
export * from './subTable';
|
|
29
|
+
export * from './tableoid';
|
|
28
30
|
export * from './textarea';
|
|
29
31
|
export * from './time';
|
|
30
32
|
export * from './updatedAt';
|
|
@@ -405,4 +405,14 @@ export var recordPickerViewer = {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
+
};
|
|
409
|
+
export var collectionDataSource = {
|
|
410
|
+
type: 'string',
|
|
411
|
+
title: '{{t("Options")}}',
|
|
412
|
+
'x-decorator': 'FormItem',
|
|
413
|
+
'x-component': 'Select',
|
|
414
|
+
'x-component-props': {
|
|
415
|
+
multiple: true
|
|
416
|
+
},
|
|
417
|
+
enum: '{{collections}}'
|
|
408
418
|
};
|
|
@@ -165,3 +165,49 @@ export declare const boolean: ({
|
|
|
165
165
|
noValue: boolean;
|
|
166
166
|
selected?: undefined;
|
|
167
167
|
})[];
|
|
168
|
+
export declare const tableoid: {
|
|
169
|
+
label: string;
|
|
170
|
+
value: string;
|
|
171
|
+
schema: {
|
|
172
|
+
'x-component': string;
|
|
173
|
+
'x-component-props': {
|
|
174
|
+
mode: string;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
}[];
|
|
178
|
+
export declare const collection: ({
|
|
179
|
+
label: string;
|
|
180
|
+
value: string;
|
|
181
|
+
selected: boolean;
|
|
182
|
+
schema: {
|
|
183
|
+
'x-component': string;
|
|
184
|
+
'x-component-props'?: undefined;
|
|
185
|
+
};
|
|
186
|
+
noValue?: undefined;
|
|
187
|
+
} | {
|
|
188
|
+
label: string;
|
|
189
|
+
value: string;
|
|
190
|
+
schema: {
|
|
191
|
+
'x-component': string;
|
|
192
|
+
'x-component-props'?: undefined;
|
|
193
|
+
};
|
|
194
|
+
selected?: undefined;
|
|
195
|
+
noValue?: undefined;
|
|
196
|
+
} | {
|
|
197
|
+
label: string;
|
|
198
|
+
value: string;
|
|
199
|
+
schema: {
|
|
200
|
+
'x-component': string;
|
|
201
|
+
'x-component-props': {
|
|
202
|
+
mode: string;
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
selected?: undefined;
|
|
206
|
+
noValue?: undefined;
|
|
207
|
+
} | {
|
|
208
|
+
label: string;
|
|
209
|
+
value: string;
|
|
210
|
+
noValue: boolean;
|
|
211
|
+
selected?: undefined;
|
|
212
|
+
schema?: undefined;
|
|
213
|
+
})[];
|