@nocobase/client-v2 2.1.0-alpha.40 → 2.1.0-alpha.45
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/Application.d.ts +7 -0
- package/es/BaseApplication.d.ts +13 -0
- package/es/RouterManager.d.ts +1 -0
- package/es/collection-field-interface/CollectionFieldInterface.d.ts +51 -15
- package/es/collection-field-interface/CollectionFieldInterfaceManager.d.ts +82 -3
- package/es/collection-manager/field-configure.d.ts +80 -0
- package/es/collection-manager/field-validation.d.ts +43 -0
- package/es/collection-manager/filter-operators/index.d.ts +46 -0
- package/es/collection-manager/filter-operators/operators.d.ts +30 -0
- package/es/collection-manager/interfaces/checkbox.d.ts +1 -41
- package/es/collection-manager/interfaces/checkboxGroup.d.ts +12 -44
- package/es/collection-manager/interfaces/collection.d.ts +12 -51
- package/es/collection-manager/interfaces/color.d.ts +1 -16
- package/es/collection-manager/interfaces/createdAt.d.ts +1 -44
- package/es/collection-manager/interfaces/createdBy.d.ts +0 -4
- package/es/collection-manager/interfaces/dateOnly.d.ts +7 -44
- package/es/collection-manager/interfaces/datetime.d.ts +1 -44
- package/es/collection-manager/interfaces/datetimeNoTz.d.ts +1 -44
- package/es/collection-manager/interfaces/email.d.ts +1 -29
- package/es/collection-manager/interfaces/id.d.ts +1 -16
- package/es/collection-manager/interfaces/index.d.ts +2 -3
- package/es/collection-manager/interfaces/input.d.ts +1 -102
- package/es/collection-manager/interfaces/integer.d.ts +1 -95
- package/es/collection-manager/interfaces/json.d.ts +16 -7
- package/es/collection-manager/interfaces/m2m.d.ts +11 -19
- package/es/collection-manager/interfaces/m2o.d.ts +11 -19
- package/es/collection-manager/interfaces/markdown.d.ts +1 -63
- package/es/collection-manager/interfaces/multipleSelect.d.ts +12 -44
- package/es/collection-manager/interfaces/nanoid.d.ts +1 -34
- package/es/collection-manager/interfaces/number.d.ts +1 -87
- package/es/collection-manager/interfaces/o2m.d.ts +12 -24
- package/es/collection-manager/interfaces/obo.d.ts +207 -0
- package/es/collection-manager/interfaces/oho.d.ts +207 -0
- package/es/collection-manager/interfaces/password.d.ts +1 -56
- package/es/collection-manager/interfaces/percent.d.ts +1 -84
- package/es/collection-manager/interfaces/phone.d.ts +1 -25
- package/es/collection-manager/interfaces/properties/index.d.ts +0 -28
- package/es/collection-manager/interfaces/radioGroup.d.ts +1 -29
- package/es/collection-manager/interfaces/richText.d.ts +1 -63
- package/es/collection-manager/interfaces/select.d.ts +12 -44
- package/es/collection-manager/interfaces/snowflake-id.d.ts +1 -34
- package/es/collection-manager/interfaces/tableoid.d.ts +1 -10
- package/es/collection-manager/interfaces/textarea.d.ts +1 -51
- package/es/collection-manager/interfaces/time.d.ts +1 -16
- package/es/collection-manager/interfaces/types.d.ts +3 -12
- package/es/collection-manager/interfaces/unixTimestamp.d.ts +1 -44
- package/es/collection-manager/interfaces/updatedAt.d.ts +1 -44
- package/es/collection-manager/interfaces/updatedBy.d.ts +0 -4
- package/es/collection-manager/interfaces/url.d.ts +1 -20
- package/es/collection-manager/interfaces/uuid.d.ts +1 -34
- package/es/collection-manager/template-fields.d.ts +53 -0
- package/es/components/KeepAlive.d.ts +22 -0
- package/es/components/RouterBridge.d.ts +9 -0
- package/es/components/form/DialogFormLayout.d.ts +5 -29
- package/es/components/form/VariableInput.d.ts +53 -2
- package/es/components/form/filter/CollectionFilter.d.ts +49 -0
- package/es/components/form/filter/CollectionFilterItem.d.ts +49 -0
- package/es/components/form/filter/DateFilterDynamicComponent.d.ts +57 -0
- package/es/components/form/filter/FilterValueInput.d.ts +29 -0
- package/es/components/form/filter/index.d.ts +11 -0
- package/es/components/form/filter/useFilterActionProps.d.ts +96 -0
- package/es/components/form/index.d.ts +1 -0
- package/es/data-source/ExtendCollectionsProvider.d.ts +50 -0
- package/es/data-source/index.d.ts +9 -0
- package/es/flow/FlowPage.d.ts +2 -1
- package/es/flow/admin-shell/AdminLayoutRouteCoordinator.d.ts +8 -40
- package/es/flow/admin-shell/BaseLayoutModel.d.ts +89 -0
- package/es/flow/admin-shell/BaseLayoutRouteCoordinator.d.ts +74 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.d.ts +12 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutModel.d.ts +7 -92
- package/es/flow/admin-shell/admin-layout/AppListRender.d.ts +11 -0
- package/es/flow/admin-shell/admin-layout/index.d.ts +3 -0
- package/es/flow/admin-shell/admin-layout/useApplications.d.ts +3 -2
- package/es/flow/admin-shell/useAdminLayoutRoutePage.d.ts +2 -2
- package/es/flow/admin-shell/useLayoutRoutePage.d.ts +23 -0
- package/es/flow/components/FlowRoute.d.ts +10 -1
- package/es/flow/components/filter/index.d.ts +2 -0
- package/es/flow/components/filter/useFilterOptions.d.ts +66 -0
- package/es/flow/index.d.ts +4 -0
- package/es/flow/models/base/PageModel/PageModel.d.ts +3 -1
- package/es/flow/models/blocks/assign-form/assignFieldValuesFlow.d.ts +84 -0
- package/es/flow/models/blocks/assign-form/index.d.ts +1 -0
- package/es/flow/models/blocks/form/FormActionGroupModel.d.ts +1 -0
- package/es/flow/models/blocks/form/FormActionModel.d.ts +9 -2
- package/es/flow/models/blocks/table/TableBlockModel.d.ts +10 -0
- package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.d.ts +1 -1
- package/es/flow-compat/passwordUtils.d.ts +1 -1
- package/es/index.d.ts +6 -0
- package/es/index.mjs +552 -459
- package/es/layout-manager/LayoutContentRoute.d.ts +14 -0
- package/es/layout-manager/LayoutManager.d.ts +22 -0
- package/es/layout-manager/LayoutRoute.d.ts +14 -0
- package/es/layout-manager/index.d.ts +13 -0
- package/es/layout-manager/types.d.ts +20 -0
- package/es/layout-manager/utils.d.ts +14 -0
- package/es/nocobase-buildin-plugin/index.d.ts +3 -10
- package/es/settings-center/index.d.ts +1 -1
- package/es/settings-center/plugin-manager/BulkEnableButton.d.ts +15 -0
- package/es/settings-center/plugin-manager/PluginCard.d.ts +15 -0
- package/es/settings-center/plugin-manager/PluginDetail.d.ts +16 -0
- package/es/settings-center/{PluginManagerPage.d.ts → plugin-manager/index.d.ts} +1 -7
- package/es/settings-center/plugin-manager/types.d.ts +34 -0
- package/lib/index.js +552 -459
- package/package.json +8 -7
- package/src/Application.tsx +51 -12
- package/src/BaseApplication.tsx +32 -0
- package/src/PluginSettingsManager.ts +1 -1
- package/src/RouterManager.tsx +17 -1
- package/src/__tests__/PluginSettingsManager.test.ts +41 -2
- package/src/__tests__/app.test.tsx +17 -1
- package/src/__tests__/globalDeps.test.ts +1 -0
- package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +45 -2
- package/src/__tests__/plugin-manager.test.tsx +177 -0
- package/src/__tests__/settings-center.test.tsx +24 -2
- package/src/collection-field-interface/CollectionFieldInterface.ts +71 -77
- package/src/collection-field-interface/CollectionFieldInterfaceManager.ts +201 -4
- package/src/collection-manager/field-configure.ts +548 -0
- package/src/collection-manager/field-validation.ts +195 -0
- package/src/collection-manager/filter-operators/index.ts +176 -0
- package/src/collection-manager/{interfaces/properties → filter-operators}/operators.ts +24 -13
- package/src/collection-manager/interfaces/checkbox.ts +2 -9
- package/src/collection-manager/interfaces/checkboxGroup.ts +2 -10
- package/src/collection-manager/interfaces/collection.ts +2 -15
- package/src/collection-manager/interfaces/color.ts +2 -2
- package/src/collection-manager/interfaces/createdAt.ts +2 -2
- package/src/collection-manager/interfaces/createdBy.ts +1 -12
- package/src/collection-manager/interfaces/dateOnly.ts +8 -2
- package/src/collection-manager/interfaces/datetime.ts +2 -2
- package/src/collection-manager/interfaces/datetimeNoTz.ts +2 -2
- package/src/collection-manager/interfaces/email.ts +2 -9
- package/src/collection-manager/interfaces/id.ts +1 -2
- package/src/collection-manager/interfaces/index.ts +2 -3
- package/src/collection-manager/interfaces/input.ts +2 -133
- package/src/collection-manager/interfaces/integer.ts +2 -71
- package/src/collection-manager/interfaces/json.tsx +17 -11
- package/src/collection-manager/interfaces/m2m.tsx +0 -21
- package/src/collection-manager/interfaces/m2o.tsx +0 -22
- package/src/collection-manager/interfaces/markdown.ts +2 -51
- package/src/collection-manager/interfaces/multipleSelect.ts +2 -14
- package/src/collection-manager/interfaces/nanoid.ts +2 -2
- package/src/collection-manager/interfaces/number.ts +2 -85
- package/src/collection-manager/interfaces/o2m.tsx +1 -22
- package/src/collection-manager/interfaces/obo.tsx +145 -0
- package/src/collection-manager/interfaces/oho.tsx +145 -0
- package/src/collection-manager/interfaces/password.ts +2 -44
- package/src/collection-manager/interfaces/percent.ts +2 -74
- package/src/collection-manager/interfaces/phone.ts +2 -2
- package/src/collection-manager/interfaces/properties/index.ts +0 -133
- package/src/collection-manager/interfaces/radioGroup.ts +2 -2
- package/src/collection-manager/interfaces/richText.ts +2 -51
- package/src/collection-manager/interfaces/select.ts +2 -14
- package/src/collection-manager/interfaces/snowflake-id.ts +2 -2
- package/src/collection-manager/interfaces/tableoid.ts +1 -2
- package/src/collection-manager/interfaces/textarea.ts +2 -51
- package/src/collection-manager/interfaces/time.ts +2 -2
- package/src/collection-manager/interfaces/types.ts +4 -12
- package/src/collection-manager/interfaces/unixTimestamp.tsx +2 -2
- package/src/collection-manager/interfaces/updatedAt.ts +2 -2
- package/src/collection-manager/interfaces/updatedBy.ts +1 -12
- package/src/collection-manager/interfaces/url.ts +2 -4
- package/src/collection-manager/interfaces/uuid.ts +2 -2
- package/src/collection-manager/template-fields.ts +109 -0
- package/src/components/KeepAlive.tsx +131 -0
- package/src/components/README.md +90 -6
- package/src/components/README.zh-CN.md +90 -7
- package/src/components/RouterBridge.tsx +28 -4
- package/src/components/__tests__/KeepAlive.test.tsx +63 -0
- package/src/components/__tests__/RouterBridge.test.tsx +27 -0
- package/src/components/form/DialogFormLayout.tsx +5 -29
- package/src/components/form/VariableInput.tsx +101 -28
- package/src/components/form/__tests__/VariableInput.test.ts +85 -0
- package/src/components/form/filter/CollectionFilter.tsx +111 -0
- package/src/components/form/filter/CollectionFilterItem.tsx +184 -0
- package/src/components/form/filter/DateFilterDynamicComponent.tsx +283 -0
- package/src/components/form/filter/FilterValueInput.tsx +198 -0
- package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +247 -0
- package/src/components/form/filter/__tests__/DateFilterDynamicComponent.test.tsx +148 -0
- package/src/components/form/filter/__tests__/FilterValueInput.test.tsx +243 -0
- package/src/components/form/filter/__tests__/compileFilterGroup.test.ts +146 -0
- package/src/components/form/filter/index.ts +13 -0
- package/src/components/form/filter/useFilterActionProps.ts +203 -0
- package/src/components/form/index.tsx +1 -0
- package/src/data-source/ExtendCollectionsProvider.tsx +144 -0
- package/src/data-source/__tests__/ExtendCollectionsProvider.test.tsx +264 -0
- package/src/data-source/index.ts +10 -0
- package/src/flow/FlowPage.tsx +35 -7
- package/src/flow/__tests__/FlowPage.test.tsx +79 -0
- package/src/flow/__tests__/FlowRoute.test.tsx +529 -2
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +191 -0
- package/src/flow/actions/__tests__/openView.subModelKey.test.tsx +33 -0
- package/src/flow/actions/aclCheck.tsx +4 -0
- package/src/flow/actions/aclCheckRefresh.tsx +4 -0
- package/src/flow/actions/dateTimeFormat.tsx +12 -8
- package/src/flow/actions/linkageRules.tsx +122 -0
- package/src/flow/actions/openView.tsx +28 -4
- package/src/flow/admin-shell/AdminLayoutRouteCoordinator.ts +11 -329
- package/src/flow/admin-shell/BaseLayoutModel.tsx +455 -0
- package/src/flow/admin-shell/BaseLayoutRouteCoordinator.ts +502 -0
- package/src/flow/admin-shell/__tests__/AdminLayoutRouteCoordinator.test.ts +547 -3
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +35 -7
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +160 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuModels.tsx +0 -12
- package/src/flow/admin-shell/admin-layout/AdminLayoutModel.tsx +28 -201
- package/src/flow/admin-shell/admin-layout/AdminLayoutSlotModels.tsx +11 -2
- package/src/flow/admin-shell/admin-layout/AppListRender.tsx +139 -0
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +1 -26
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +149 -27
- package/src/flow/admin-shell/admin-layout/index.ts +3 -0
- package/src/flow/admin-shell/admin-layout/useApplications.tsx +34 -1
- package/src/flow/admin-shell/useAdminLayoutRoutePage.ts +10 -26
- package/src/flow/admin-shell/useLayoutRoutePage.ts +61 -0
- package/src/flow/components/AdminLayout.tsx +4 -154
- package/src/flow/components/FlowRoute.tsx +105 -15
- package/src/flow/components/filter/index.ts +3 -0
- package/src/flow/components/filter/useFilterOptions.ts +102 -0
- package/src/flow/index.ts +4 -0
- package/src/flow/models/actions/UpdateRecordActionModel.tsx +14 -95
- package/src/flow/models/actions/UpdateRecordActionUtils.ts +4 -7
- package/src/flow/models/actions/__tests__/AssignFormRefill.test.ts +26 -1
- package/src/flow/models/base/ActionModel.tsx +8 -1
- package/src/flow/models/base/PageModel/PageModel.tsx +51 -18
- package/src/flow/models/base/PageModel/RootPageModel.tsx +6 -13
- package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +102 -1
- package/src/flow/models/base/RouteModel.tsx +1 -1
- package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +63 -2
- package/src/flow/models/blocks/assign-form/assignFieldValuesFlow.tsx +206 -0
- package/src/flow/models/blocks/assign-form/index.ts +1 -0
- package/src/flow/models/blocks/form/FormActionGroupModel.tsx +14 -0
- package/src/flow/models/blocks/form/FormActionModel.tsx +30 -3
- package/src/flow/models/blocks/form/FormItemModel.tsx +8 -1
- package/src/flow/models/blocks/form/__tests__/FormActionGroupModel.test.ts +46 -0
- package/src/flow/models/blocks/form/__tests__/submitHandler.test.ts +71 -0
- package/src/flow/models/blocks/form/submitHandler.ts +8 -1
- package/src/flow/models/blocks/form/submitValues.ts +4 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +118 -16
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowSelection.test.tsx +114 -0
- package/src/flow/models/fields/AssociationFieldModel/SubFormFieldModel.tsx +7 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +1 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.tsx +6 -5
- package/src/flow/models/fields/ClickableFieldModel.tsx +9 -1
- package/src/flow/models/fields/CollectionSelectorFieldModel.tsx +8 -2
- package/src/flow/models/fields/DisplayEnumFieldModel.tsx +8 -2
- package/src/flow/models/fields/DisplayTimeFieldModel.tsx +1 -1
- package/src/flow/models/fields/TimeFieldModel.tsx +1 -1
- package/src/flow/models/fields/__tests__/TimeFieldModel.test.tsx +61 -0
- package/src/flow/models/fields/mobile-components/MobileDatePicker.tsx +19 -3
- package/src/flow/models/fields/mobile-components/__tests__/MobileDatePicker.test.tsx +94 -0
- package/src/flow/models/topbar/TopbarActionModel.tsx +1 -1
- package/src/flow/utils/__tests__/dateTimeFormat.test.ts +91 -0
- package/src/index.ts +6 -0
- package/src/layout-manager/LayoutContentRoute.tsx +90 -0
- package/src/layout-manager/LayoutManager.tsx +185 -0
- package/src/layout-manager/LayoutRoute.tsx +138 -0
- package/src/layout-manager/__tests__/LayoutManager.test.tsx +335 -0
- package/src/layout-manager/__tests__/LayoutRoute.test.tsx +473 -0
- package/src/layout-manager/index.ts +14 -0
- package/src/layout-manager/types.ts +22 -0
- package/src/layout-manager/utils.ts +37 -0
- package/src/nocobase-buildin-plugin/index.tsx +69 -67
- package/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts +1 -0
- package/src/settings-center/index.ts +1 -1
- package/src/settings-center/plugin-manager/BulkEnableButton.tsx +111 -0
- package/src/settings-center/plugin-manager/PluginCard.tsx +270 -0
- package/src/settings-center/plugin-manager/PluginDetail.tsx +195 -0
- package/src/settings-center/plugin-manager/index.tsx +254 -0
- package/src/settings-center/plugin-manager/types.ts +35 -0
- package/src/settings-center/utils.tsx +8 -1
- package/src/theme/__tests__/globalStyles.test.ts +24 -0
- package/src/theme/globalStyles.ts +10 -0
- package/src/utils/globalDeps.ts +2 -0
- package/es/collection-manager/interfaces/linkTo.d.ts +0 -90
- package/es/collection-manager/interfaces/o2o.d.ts +0 -621
- package/es/collection-manager/interfaces/properties/operators.d.ts +0 -294
- package/es/collection-manager/interfaces/subTable.d.ts +0 -172
- package/src/collection-manager/interfaces/linkTo.ts +0 -120
- package/src/collection-manager/interfaces/o2o.tsx +0 -561
- package/src/collection-manager/interfaces/subTable.ts +0 -218
- package/src/settings-center/PluginManagerPage.tsx +0 -162
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
11
|
-
import { dateTimeProps, defaultProps
|
|
11
|
+
import { dateTimeProps, defaultProps } from './properties';
|
|
12
12
|
|
|
13
13
|
export class DatetimeNoTzFieldInterface extends CollectionFieldInterface {
|
|
14
14
|
name = 'datetimeNoTz';
|
|
@@ -60,7 +60,7 @@ export class DatetimeNoTzFieldInterface extends CollectionFieldInterface {
|
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
62
|
filterable = {
|
|
63
|
-
operators:
|
|
63
|
+
operators: 'datetime',
|
|
64
64
|
};
|
|
65
65
|
titleUsable = true;
|
|
66
66
|
}
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import { defaultProps, operators, unique } from './properties';
|
|
10
|
+
import { defaultProps, unique } from './properties';
|
|
12
11
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
13
12
|
|
|
14
13
|
export class EmailFieldInterface extends CollectionFieldInterface {
|
|
@@ -35,13 +34,7 @@ export class EmailFieldInterface extends CollectionFieldInterface {
|
|
|
35
34
|
unique,
|
|
36
35
|
};
|
|
37
36
|
filterable = {
|
|
38
|
-
operators:
|
|
37
|
+
operators: 'string',
|
|
39
38
|
};
|
|
40
39
|
titleUsable = true;
|
|
41
|
-
schemaInitialize(schema: ISchema, { block }) {
|
|
42
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
43
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
44
|
-
schema['x-component-props']['ellipsis'] = true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
40
|
}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
11
|
-
import { operators } from './properties';
|
|
12
11
|
|
|
13
12
|
export class IdFieldInterface extends CollectionFieldInterface {
|
|
14
13
|
name = 'id';
|
|
@@ -53,7 +52,7 @@ export class IdFieldInterface extends CollectionFieldInterface {
|
|
|
53
52
|
},
|
|
54
53
|
};
|
|
55
54
|
filterable = {
|
|
56
|
-
operators:
|
|
55
|
+
operators: 'id',
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
description = '{{t("Primary key, unique identifier, self growth") }}';
|
|
@@ -20,14 +20,14 @@ export * from './id';
|
|
|
20
20
|
export * from './input';
|
|
21
21
|
export * from './integer';
|
|
22
22
|
export * from './json';
|
|
23
|
-
export * from './linkTo';
|
|
24
23
|
export * from './m2m';
|
|
25
24
|
export * from './m2o';
|
|
26
25
|
export * from './markdown';
|
|
27
26
|
export * from './multipleSelect';
|
|
28
27
|
export * from './number';
|
|
28
|
+
export * from './obo';
|
|
29
29
|
export * from './o2m';
|
|
30
|
-
export * from './
|
|
30
|
+
export * from './oho';
|
|
31
31
|
export * from './password';
|
|
32
32
|
export * from './percent';
|
|
33
33
|
export * from './phone';
|
|
@@ -35,7 +35,6 @@ export * from './radioGroup';
|
|
|
35
35
|
export * from './richText';
|
|
36
36
|
export * from './select';
|
|
37
37
|
export * from './snowflake-id';
|
|
38
|
-
export * from './subTable';
|
|
39
38
|
export * from './tableoid';
|
|
40
39
|
export * from './textarea';
|
|
41
40
|
export * from './time';
|
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { ISchema } from '@formily/react';
|
|
11
10
|
import { isArr, isEmpty, isValid } from '@formily/shared';
|
|
12
11
|
import { registerValidateRules } from '@formily/validator';
|
|
13
12
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
14
13
|
import { i18n } from '../../i18n';
|
|
15
|
-
import { defaultProps,
|
|
14
|
+
import { defaultProps, primaryKey, unique } from './properties';
|
|
16
15
|
|
|
17
16
|
const isValidateEmpty = (value: any) => {
|
|
18
17
|
if (isArr(value)) {
|
|
@@ -88,137 +87,7 @@ export class InputFieldInterface extends CollectionFieldInterface {
|
|
|
88
87
|
},
|
|
89
88
|
};
|
|
90
89
|
filterable = {
|
|
91
|
-
operators:
|
|
90
|
+
operators: 'string',
|
|
92
91
|
};
|
|
93
92
|
titleUsable = true;
|
|
94
|
-
schemaInitialize(schema: ISchema, { block }) {
|
|
95
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
96
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
97
|
-
schema['x-component-props']['ellipsis'] = true;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
validateSchema(fieldSchema) {
|
|
101
|
-
return {
|
|
102
|
-
max: {
|
|
103
|
-
type: 'number',
|
|
104
|
-
title: '{{ t("Max length") }}',
|
|
105
|
-
minimum: 0,
|
|
106
|
-
'x-decorator': 'FormItem',
|
|
107
|
-
'x-component': 'InputNumber',
|
|
108
|
-
'x-component-props': {
|
|
109
|
-
precision: 0,
|
|
110
|
-
},
|
|
111
|
-
'x-reactions': `{{(field) => {
|
|
112
|
-
const targetValue = field.query('.min').value();
|
|
113
|
-
field.selfErrors =
|
|
114
|
-
!!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
|
|
115
|
-
'Max length must greater than min length',
|
|
116
|
-
)}' : ''
|
|
117
|
-
}}}`,
|
|
118
|
-
},
|
|
119
|
-
min: {
|
|
120
|
-
type: 'number',
|
|
121
|
-
title: '{{ t("Min length") }}',
|
|
122
|
-
minimum: 0,
|
|
123
|
-
'x-decorator': 'FormItem',
|
|
124
|
-
'x-component': 'InputNumber',
|
|
125
|
-
'x-component-props': {
|
|
126
|
-
precision: 0,
|
|
127
|
-
},
|
|
128
|
-
'x-reactions': {
|
|
129
|
-
dependencies: ['.max'],
|
|
130
|
-
fulfill: {
|
|
131
|
-
state: {
|
|
132
|
-
selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
|
|
133
|
-
'Min length must less than max length',
|
|
134
|
-
)}' : ''}}`,
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
len: {
|
|
140
|
-
type: 'number',
|
|
141
|
-
title: '{{ t("Length") }}',
|
|
142
|
-
minimum: 0,
|
|
143
|
-
'x-decorator': 'FormItem',
|
|
144
|
-
'x-component': 'InputNumber',
|
|
145
|
-
'x-component-props': {
|
|
146
|
-
precision: 0,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
format: {
|
|
150
|
-
type: 'string',
|
|
151
|
-
title: '{{ t("Format") }}',
|
|
152
|
-
'x-decorator': 'FormItem',
|
|
153
|
-
'x-component': 'Select',
|
|
154
|
-
'x-component-props': {
|
|
155
|
-
allowClear: true,
|
|
156
|
-
},
|
|
157
|
-
enum: [
|
|
158
|
-
{
|
|
159
|
-
label: '{{ t("url") }}',
|
|
160
|
-
value: 'url',
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
label: '{{ t("email") }}',
|
|
164
|
-
value: 'email',
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
label: '{{ t("ipv6") }}',
|
|
168
|
-
value: 'ipv6',
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
label: '{{ t("ipv4") }}',
|
|
172
|
-
value: 'ipv4',
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
label: '{{ t("number") }}',
|
|
176
|
-
value: 'number',
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
label: '{{ t("integer") }}',
|
|
180
|
-
value: 'integer',
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
label: '{{ t("idcard") }}',
|
|
184
|
-
value: 'idcard',
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
label: '{{ t("qq") }}',
|
|
188
|
-
value: 'qq',
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
label: '{{ t("phone") }}',
|
|
192
|
-
value: 'phone',
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
label: '{{ t("money") }}',
|
|
196
|
-
value: 'money',
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
label: '{{ t("zh") }}',
|
|
200
|
-
value: 'zh',
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
label: '{{ t("date") }}',
|
|
204
|
-
value: 'date',
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
label: '{{ t("zip") }}',
|
|
208
|
-
value: 'zip',
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
},
|
|
212
|
-
pattern: {
|
|
213
|
-
type: 'string',
|
|
214
|
-
title: '{{ t("Regular expression") }}',
|
|
215
|
-
'x-decorator': 'FormItem',
|
|
216
|
-
'x-component': 'Input',
|
|
217
|
-
'x-component-props': {
|
|
218
|
-
prefix: '/',
|
|
219
|
-
suffix: '/',
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
93
|
}
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { registerValidateFormats } from '@formily/core';
|
|
11
|
-
import {
|
|
12
|
-
import { defaultProps, operators, unique, autoIncrement, primaryKey } from './properties';
|
|
11
|
+
import { defaultProps, unique, autoIncrement, primaryKey } from './properties';
|
|
13
12
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
14
13
|
|
|
15
14
|
registerValidateFormats({
|
|
@@ -61,75 +60,7 @@ export class IntegerFieldInterface extends CollectionFieldInterface {
|
|
|
61
60
|
autoIncrement,
|
|
62
61
|
};
|
|
63
62
|
filterable = {
|
|
64
|
-
operators:
|
|
63
|
+
operators: 'number',
|
|
65
64
|
};
|
|
66
65
|
titleUsable = true;
|
|
67
|
-
validateSchema = (fieldSchema) => {
|
|
68
|
-
return {
|
|
69
|
-
maximum: {
|
|
70
|
-
type: 'number',
|
|
71
|
-
title: '{{ t("Maximum") }}',
|
|
72
|
-
'x-decorator': 'FormItem',
|
|
73
|
-
'x-component': 'InputNumber',
|
|
74
|
-
'x-component-props': {
|
|
75
|
-
precision: 0,
|
|
76
|
-
},
|
|
77
|
-
'x-reactions': `{{(field) => {
|
|
78
|
-
const targetValue = field.query('.minimum').value();
|
|
79
|
-
field.selfErrors =
|
|
80
|
-
!!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
|
|
81
|
-
'Maximum must greater than minimum',
|
|
82
|
-
)}' : ''
|
|
83
|
-
}}}`,
|
|
84
|
-
},
|
|
85
|
-
minimum: {
|
|
86
|
-
type: 'number',
|
|
87
|
-
title: '{{ t("Minimum") }}',
|
|
88
|
-
'x-decorator': 'FormItem',
|
|
89
|
-
'x-component': 'InputNumber',
|
|
90
|
-
'x-component-props': {
|
|
91
|
-
precision: 0,
|
|
92
|
-
},
|
|
93
|
-
'x-reactions': {
|
|
94
|
-
dependencies: ['.maximum'],
|
|
95
|
-
fulfill: {
|
|
96
|
-
state: {
|
|
97
|
-
selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
|
|
98
|
-
'Minimum must less than maximum',
|
|
99
|
-
)}' : ''}}`,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
format: {
|
|
105
|
-
type: 'string',
|
|
106
|
-
title: '{{ t("Format") }}',
|
|
107
|
-
'x-decorator': 'FormItem',
|
|
108
|
-
'x-component': 'Select',
|
|
109
|
-
'x-component-props': {
|
|
110
|
-
allowClear: true,
|
|
111
|
-
},
|
|
112
|
-
enum: [
|
|
113
|
-
{
|
|
114
|
-
label: '{{ t("Odd") }}',
|
|
115
|
-
value: 'odd',
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
label: '{{ t("Even") }}',
|
|
119
|
-
value: 'even',
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
pattern: {
|
|
124
|
-
type: 'string',
|
|
125
|
-
title: '{{ t("Regular expression") }}',
|
|
126
|
-
'x-decorator': 'FormItem',
|
|
127
|
-
'x-component': 'Input',
|
|
128
|
-
'x-component-props': {
|
|
129
|
-
prefix: '/',
|
|
130
|
-
suffix: '/',
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
66
|
}
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { FormItem, FormLayout } from '@formily/antd-v5';
|
|
11
10
|
import { registerValidateRules } from '@formily/core';
|
|
12
|
-
import React from 'react';
|
|
13
11
|
import { defaultProps } from './properties';
|
|
14
12
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
15
13
|
|
|
@@ -55,19 +53,27 @@ export class JsonFieldInterface extends CollectionFieldInterface {
|
|
|
55
53
|
properties = {
|
|
56
54
|
...defaultProps,
|
|
57
55
|
jsonb: {
|
|
58
|
-
type: 'boolean',
|
|
59
56
|
title: 'JSONB',
|
|
60
|
-
// 不直接用 `FormItem` 的原因是为了想要设置 `FormLayout` 的 `layout` 属性为 `horizontal` (默认就是 horizontal)
|
|
61
|
-
'x-decorator': ({ children }) => (
|
|
62
|
-
<FormLayout>
|
|
63
|
-
<FormItem>{children}</FormItem>
|
|
64
|
-
</FormLayout>
|
|
65
|
-
),
|
|
66
57
|
'x-component': 'Checkbox',
|
|
67
|
-
'x-hidden': `{{ !isDialect('postgres') }}`,
|
|
68
|
-
'x-disabled': `{{ disabledJSONB }}`,
|
|
69
58
|
},
|
|
70
59
|
};
|
|
60
|
+
configure = {
|
|
61
|
+
items: [
|
|
62
|
+
{
|
|
63
|
+
name: 'jsonb',
|
|
64
|
+
title: 'JSONB',
|
|
65
|
+
component: 'Checkbox',
|
|
66
|
+
schema: {
|
|
67
|
+
'x-content': ' ',
|
|
68
|
+
},
|
|
69
|
+
hidden: ({ context }) => {
|
|
70
|
+
const isDialect = context.isDialect;
|
|
71
|
+
return typeof isDialect === 'function' ? !isDialect('postgres') : true;
|
|
72
|
+
},
|
|
73
|
+
disabled: ({ context }) => !!context.disabledJSONB,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
71
77
|
// filterable = {
|
|
72
78
|
// operators: operators.string,
|
|
73
79
|
// };
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { ISchema } from '@formily/react';
|
|
11
10
|
import { uid } from '@formily/shared';
|
|
12
11
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
13
|
-
import { getUniqueKeyFromCollection } from './utils';
|
|
14
12
|
import { defaultProps, relationshipType, reverseFieldProperties } from './properties';
|
|
15
13
|
|
|
16
14
|
export class M2MFieldInterface extends CollectionFieldInterface {
|
|
@@ -56,24 +54,6 @@ export class M2MFieldInterface extends CollectionFieldInterface {
|
|
|
56
54
|
};
|
|
57
55
|
availableTypes = ['belongsToMany'];
|
|
58
56
|
validationType = 'object';
|
|
59
|
-
schemaInitialize(schema: ISchema, { field, readPretty, block, targetCollection }) {
|
|
60
|
-
// schema['type'] = 'array';
|
|
61
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
62
|
-
schema['x-component-props'].fieldNames = schema['x-component-props'].fieldNames || {
|
|
63
|
-
value: getUniqueKeyFromCollection(targetCollection),
|
|
64
|
-
};
|
|
65
|
-
schema['x-component-props'].fieldNames.label =
|
|
66
|
-
schema['x-component-props'].fieldNames?.label ||
|
|
67
|
-
targetCollection?.titleField ||
|
|
68
|
-
getUniqueKeyFromCollection(targetCollection);
|
|
69
|
-
|
|
70
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
71
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
72
|
-
schema['x-component-props']['ellipsis'] = true;
|
|
73
|
-
// 预览文件时需要的参数
|
|
74
|
-
schema['x-component-props']['size'] = 'small';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
57
|
initialize(values: any) {
|
|
78
58
|
if (values.type === 'belongsToMany') {
|
|
79
59
|
if (!values.through) {
|
|
@@ -142,7 +122,6 @@ export class M2MFieldInterface extends CollectionFieldInterface {
|
|
|
142
122
|
type: 'string',
|
|
143
123
|
title: '{{t("Target collection")}}',
|
|
144
124
|
required: true,
|
|
145
|
-
'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
|
|
146
125
|
'x-decorator': 'FormItem',
|
|
147
126
|
'x-component': 'Select',
|
|
148
127
|
'x-disabled': '{{ !createOnly }}',
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { ISchema } from '@formily/react';
|
|
11
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
12
|
-
import { getUniqueKeyFromCollection } from './utils';
|
|
13
11
|
import { constraintsProps, relationshipType, reverseFieldProperties } from './properties';
|
|
14
12
|
|
|
15
13
|
export class M2OFieldInterface extends CollectionFieldInterface {
|
|
@@ -55,25 +53,6 @@ export class M2OFieldInterface extends CollectionFieldInterface {
|
|
|
55
53
|
},
|
|
56
54
|
};
|
|
57
55
|
availableTypes = ['belongsTo'];
|
|
58
|
-
schemaInitialize(schema: ISchema, { field, block, readPretty, targetCollection }) {
|
|
59
|
-
// schema['type'] = 'object';
|
|
60
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
61
|
-
schema['x-component-props'].fieldNames = schema['x-component-props'].fieldNames || {
|
|
62
|
-
value: getUniqueKeyFromCollection(targetCollection),
|
|
63
|
-
};
|
|
64
|
-
schema['x-component-props'].fieldNames.label =
|
|
65
|
-
schema['x-component-props'].fieldNames?.label ||
|
|
66
|
-
targetCollection?.titleField ||
|
|
67
|
-
getUniqueKeyFromCollection(targetCollection);
|
|
68
|
-
|
|
69
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
70
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
71
|
-
schema['x-component-props']['ellipsis'] = true;
|
|
72
|
-
// 预览文件时需要的参数
|
|
73
|
-
schema['x-component-props']['size'] = 'small';
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
56
|
properties = {
|
|
78
57
|
'uiSchema.title': {
|
|
79
58
|
type: 'string',
|
|
@@ -122,7 +101,6 @@ export class M2OFieldInterface extends CollectionFieldInterface {
|
|
|
122
101
|
type: 'string',
|
|
123
102
|
title: '{{t("Target collection")}}',
|
|
124
103
|
required: true,
|
|
125
|
-
'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
|
|
126
104
|
'x-decorator': 'FormItem',
|
|
127
105
|
'x-component': 'Select',
|
|
128
106
|
'x-disabled': '{{ !createOnly }}',
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import { i18n } from '../../i18n';
|
|
12
|
-
import { defaultProps, operators } from './properties';
|
|
10
|
+
import { defaultProps } from './properties';
|
|
13
11
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
14
12
|
|
|
15
13
|
export class MarkdownFieldInterface extends CollectionFieldInterface {
|
|
@@ -31,54 +29,7 @@ export class MarkdownFieldInterface extends CollectionFieldInterface {
|
|
|
31
29
|
properties = {
|
|
32
30
|
...defaultProps,
|
|
33
31
|
};
|
|
34
|
-
schemaInitialize(schema: ISchema, { block }) {
|
|
35
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
36
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
37
|
-
schema['x-component-props']['ellipsis'] = true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
validateSchema(fieldSchema) {
|
|
41
|
-
return {
|
|
42
|
-
max: {
|
|
43
|
-
type: 'number',
|
|
44
|
-
title: '{{ t("Max length") }}',
|
|
45
|
-
minimum: 0,
|
|
46
|
-
'x-decorator': 'FormItem',
|
|
47
|
-
'x-component': 'InputNumber',
|
|
48
|
-
'x-component-props': {
|
|
49
|
-
precision: 0,
|
|
50
|
-
},
|
|
51
|
-
'x-reactions': `{{(field) => {
|
|
52
|
-
const targetValue = field.query('.min').value();
|
|
53
|
-
field.selfErrors =
|
|
54
|
-
!!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
|
|
55
|
-
'Max length must greater than min length',
|
|
56
|
-
)}' : ''
|
|
57
|
-
}}}`,
|
|
58
|
-
},
|
|
59
|
-
min: {
|
|
60
|
-
type: 'number',
|
|
61
|
-
title: '{{ t("Min length") }}',
|
|
62
|
-
minimum: 0,
|
|
63
|
-
'x-decorator': 'FormItem',
|
|
64
|
-
'x-component': 'InputNumber',
|
|
65
|
-
'x-component-props': {
|
|
66
|
-
precision: 0,
|
|
67
|
-
},
|
|
68
|
-
'x-reactions': {
|
|
69
|
-
dependencies: ['.max'],
|
|
70
|
-
fulfill: {
|
|
71
|
-
state: {
|
|
72
|
-
selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
|
|
73
|
-
'Min length must less than max length',
|
|
74
|
-
)}' : ''}}`,
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
32
|
filterable = {
|
|
82
|
-
operators:
|
|
33
|
+
operators: 'bigField',
|
|
83
34
|
};
|
|
84
35
|
}
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import { dataSource, defaultProps, operators } from './properties';
|
|
10
|
+
import { dataSource, defaultProps } from './properties';
|
|
12
11
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
13
12
|
|
|
14
13
|
export class MultipleSelectFieldInterface extends CollectionFieldInterface {
|
|
@@ -36,17 +35,6 @@ export class MultipleSelectFieldInterface extends CollectionFieldInterface {
|
|
|
36
35
|
'uiSchema.enum': dataSource,
|
|
37
36
|
};
|
|
38
37
|
filterable = {
|
|
39
|
-
operators:
|
|
38
|
+
operators: 'array',
|
|
40
39
|
};
|
|
41
|
-
schemaInitialize(schema: ISchema, { block }) {
|
|
42
|
-
const props = (schema['x-component-props'] = schema['x-component-props'] || {});
|
|
43
|
-
props.style = {
|
|
44
|
-
...(props.style || {}),
|
|
45
|
-
width: '100%',
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
49
|
-
props['ellipsis'] = true;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
40
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
11
|
-
import {
|
|
11
|
+
import { autoFill, primaryKey, unique } from './properties';
|
|
12
12
|
export class NanoidFieldInterface extends CollectionFieldInterface {
|
|
13
13
|
name = 'nanoid';
|
|
14
14
|
type = 'object';
|
|
@@ -76,7 +76,7 @@ export class NanoidFieldInterface extends CollectionFieldInterface {
|
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
78
|
filterable = {
|
|
79
|
-
operators:
|
|
79
|
+
operators: 'string',
|
|
80
80
|
};
|
|
81
81
|
titleUsable = true;
|
|
82
82
|
}
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
11
|
-
import {
|
|
12
|
-
import { defaultProps, operators, unique } from './properties';
|
|
11
|
+
import { defaultProps, unique } from './properties';
|
|
13
12
|
|
|
14
13
|
export class NumberFieldInterface extends CollectionFieldInterface {
|
|
15
14
|
name = 'number';
|
|
@@ -74,14 +73,6 @@ export class NumberFieldInterface extends CollectionFieldInterface {
|
|
|
74
73
|
'x-decorator': 'FormItem',
|
|
75
74
|
'x-disabled': '{{ !createOnly }}',
|
|
76
75
|
default: 10,
|
|
77
|
-
'x-reactions': {
|
|
78
|
-
dependencies: ['type'],
|
|
79
|
-
fulfill: {
|
|
80
|
-
state: {
|
|
81
|
-
visible: '{{$deps[0] === "decimal"}}',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
76
|
},
|
|
86
77
|
scale: {
|
|
87
78
|
type: 'string',
|
|
@@ -90,84 +81,10 @@ export class NumberFieldInterface extends CollectionFieldInterface {
|
|
|
90
81
|
'x-decorator': 'FormItem',
|
|
91
82
|
'x-disabled': '{{ !createOnly }}',
|
|
92
83
|
default: 2,
|
|
93
|
-
'x-reactions': {
|
|
94
|
-
dependencies: ['type'],
|
|
95
|
-
fulfill: {
|
|
96
|
-
state: {
|
|
97
|
-
visible: '{{$deps[0] === "decimal"}}',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
84
|
},
|
|
102
85
|
};
|
|
103
86
|
filterable = {
|
|
104
|
-
operators:
|
|
87
|
+
operators: 'number',
|
|
105
88
|
};
|
|
106
89
|
titleUsable = true;
|
|
107
|
-
validateSchema(fieldSchema) {
|
|
108
|
-
return {
|
|
109
|
-
maximum: {
|
|
110
|
-
type: 'number',
|
|
111
|
-
title: '{{ t("Maximum") }}',
|
|
112
|
-
'x-decorator': 'FormItem',
|
|
113
|
-
'x-component': 'InputNumber',
|
|
114
|
-
'x-reactions': `{{(field) => {
|
|
115
|
-
const targetValue = field.query('.minimum').value();
|
|
116
|
-
field.selfErrors =
|
|
117
|
-
!!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
|
|
118
|
-
'Maximum must greater than minimum',
|
|
119
|
-
)}' : ''
|
|
120
|
-
}}}`,
|
|
121
|
-
},
|
|
122
|
-
minimum: {
|
|
123
|
-
type: 'number',
|
|
124
|
-
title: '{{ t("Minimum") }}',
|
|
125
|
-
'x-decorator': 'FormItem',
|
|
126
|
-
'x-component': 'InputNumber',
|
|
127
|
-
'x-reactions': {
|
|
128
|
-
dependencies: ['.maximum'],
|
|
129
|
-
fulfill: {
|
|
130
|
-
state: {
|
|
131
|
-
selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
|
|
132
|
-
'Minimum must less than maximum',
|
|
133
|
-
)}' : ''}}`,
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
format: {
|
|
139
|
-
type: 'string',
|
|
140
|
-
title: '{{ t("Format") }}',
|
|
141
|
-
'x-decorator': 'FormItem',
|
|
142
|
-
'x-component': 'Select',
|
|
143
|
-
'x-component-props': {
|
|
144
|
-
allowClear: true,
|
|
145
|
-
},
|
|
146
|
-
enum: [
|
|
147
|
-
{
|
|
148
|
-
label: '{{ t("Integer") }}',
|
|
149
|
-
value: 'integer',
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
label: '{{ t("Odd") }}',
|
|
153
|
-
value: 'odd',
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
label: '{{ t("Even") }}',
|
|
157
|
-
value: 'even',
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
},
|
|
161
|
-
pattern: {
|
|
162
|
-
type: 'string',
|
|
163
|
-
title: '{{ t("Regular expression") }}',
|
|
164
|
-
'x-decorator': 'FormItem',
|
|
165
|
-
'x-component': 'Input',
|
|
166
|
-
'x-component-props': {
|
|
167
|
-
prefix: '/',
|
|
168
|
-
suffix: '/',
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
90
|
}
|