@nocobase/client-v2 2.1.0-alpha.40 → 2.1.0-alpha.46
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/authRedirect.d.ts +12 -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/TypedVariableInput.d.ts +75 -0
- 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 +2 -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/AdminLayoutMenuModels.d.ts +1 -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/ConditionBuilder.d.ts +1 -0
- package/es/flow/components/FieldAssignRulesEditor.d.ts +3 -1
- package/es/flow/components/FieldAssignValueInput.d.ts +1 -0
- package/es/flow/components/FlowRoute.d.ts +10 -1
- package/es/flow/components/fieldAssignOptions.d.ts +10 -0
- package/es/flow/components/filter/LinkageFilterItem.d.ts +1 -0
- package/es/flow/components/filter/VariableFilterItem.d.ts +1 -0
- package/es/flow/components/filter/index.d.ts +2 -0
- package/es/flow/components/filter/metaTreeAssociationDepth.d.ts +13 -0
- package/es/flow/components/filter/useFilterOptions.d.ts +66 -0
- package/es/flow/index.d.ts +4 -0
- package/es/flow/models/base/AssociationFieldGroupModel.d.ts +2 -33
- package/es/flow/models/base/PageModel/PageModel.d.ts +3 -1
- package/es/flow/models/blocks/assign-form/assignFieldValuesFlow.d.ts +92 -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/blocks/table/TableColumnModel.d.ts +2 -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 +50 -2
- package/src/__tests__/plugin-manager.test.tsx +177 -0
- package/src/__tests__/settings-center.test.tsx +24 -2
- package/src/authRedirect.ts +43 -0
- 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 +138 -6
- package/src/components/README.zh-CN.md +138 -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/TypedVariableInput.tsx +441 -0
- package/src/components/form/VariableInput.tsx +101 -28
- package/src/components/form/__tests__/TypedVariableInput.test.tsx +152 -0
- 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 +2 -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 +537 -3
- package/src/flow/actions/__tests__/linkageRules.hiddenSync.restore.test.ts +100 -0
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +191 -0
- package/src/flow/actions/__tests__/linkageRulesRefresh.test.ts +23 -1
- 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/dataScope.tsx +8 -1
- package/src/flow/actions/dateTimeFormat.tsx +12 -8
- package/src/flow/actions/linkageRules.tsx +127 -2
- package/src/flow/actions/linkageRulesRefresh.tsx +2 -3
- package/src/flow/actions/openView.tsx +28 -4
- package/src/flow/actions/setTargetDataScope.tsx +1 -1
- 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 +15 -13
- 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 +76 -27
- 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/resolveAdminRouteRuntimeTarget.test.ts +11 -0
- package/src/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.ts +2 -4
- 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/common/Markdown/Edit.tsx +32 -4
- package/src/flow/components/AdminLayout.tsx +4 -154
- package/src/flow/components/ConditionBuilder.tsx +12 -2
- package/src/flow/components/FieldAssignRulesEditor.tsx +37 -46
- package/src/flow/components/FieldAssignValueInput.tsx +8 -4
- package/src/flow/components/FlowRoute.tsx +105 -15
- package/src/flow/components/__tests__/FieldAssignRulesEditor.test.tsx +112 -1
- package/src/flow/components/__tests__/fieldAssignOptions.test.ts +71 -1
- package/src/flow/components/code-editor/__tests__/runjsCompletions.test.ts +272 -27
- package/src/flow/components/code-editor/runjsCompletions.ts +490 -9
- package/src/flow/components/fieldAssignOptions.ts +23 -6
- package/src/flow/components/filter/LinkageFilterItem.tsx +22 -9
- package/src/flow/components/filter/VariableFilterItem.tsx +27 -9
- package/src/flow/components/filter/__tests__/fieldsToOptions.test.ts +48 -0
- package/src/flow/components/filter/__tests__/metaTreeAssociationDepth.test.ts +60 -0
- package/src/flow/components/filter/fieldsToOptions.ts +9 -4
- package/src/flow/components/filter/index.ts +3 -0
- package/src/flow/components/filter/metaTreeAssociationDepth.ts +69 -0
- package/src/flow/components/filter/useFilterOptions.ts +102 -0
- package/src/flow/index.ts +4 -0
- package/src/flow/models/actions/FilterActionModel.tsx +15 -3
- 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 +116 -1
- package/src/flow/models/base/ActionModel.tsx +8 -1
- package/src/flow/models/base/AssociationFieldGroupModel.tsx +20 -3
- package/src/flow/models/base/GridModel.tsx +1 -1
- package/src/flow/models/base/PageModel/ChildPageModel.tsx +5 -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__/ChildPageModel.test.ts +12 -0
- 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/base/__tests__/AssociationFieldGroupModel.test.ts +86 -0
- package/src/flow/models/base/__tests__/GridModel.render.test.tsx +53 -0
- package/src/flow/models/blocks/assign-form/AssignFormGridModel.tsx +12 -3
- package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +77 -6
- package/src/flow/models/blocks/assign-form/__tests__/assignFieldValuesFlow.editor.test.tsx +216 -0
- package/src/flow/models/blocks/assign-form/assignFieldValuesFlow.tsx +308 -0
- package/src/flow/models/blocks/assign-form/index.ts +1 -0
- package/src/flow/models/blocks/filter-form/FilterFormItemModel.tsx +1 -1
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.defineChildren.test.ts +6 -1
- package/src/flow/models/blocks/filter-manager/flow-actions/connectFields.tsx +48 -6
- 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/FormAssociationItemModel.tsx +9 -0
- package/src/flow/models/blocks/form/FormItemModel.tsx +17 -1
- package/src/flow/models/blocks/form/__tests__/FormActionGroupModel.test.ts +46 -0
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +17 -0
- package/src/flow/models/blocks/form/__tests__/FormItemModel.defineChildren.test.ts +27 -2
- 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/form/value-runtime/__tests__/runtime.test.ts +29 -0
- package/src/flow/models/blocks/form/value-runtime/runtime.ts +5 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +118 -16
- package/src/flow/models/blocks/table/TableColumnModel.tsx +15 -5
- package/src/flow/models/blocks/table/TableCustomColumnModel.tsx +2 -2
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowSelection.test.tsx +114 -0
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +18 -0
- package/src/flow/models/fields/AssociationFieldModel/SubFormFieldModel.tsx +7 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.tsx +6 -7
- 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/MobileLazySelect.tsx +5 -3
- package/src/flow/models/fields/mobile-components/__tests__/MobileDatePicker.test.tsx +94 -0
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +70 -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
|
@@ -7,14 +7,10 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { Field } from '@formily/core';
|
|
11
10
|
import { ISchema } from '@formily/react';
|
|
12
|
-
import { uid } from '@formily/shared';
|
|
13
11
|
import { css } from '@emotion/css';
|
|
14
12
|
import { DateFormatCom } from '../../../flow/components/ExpiresRadio';
|
|
15
13
|
|
|
16
|
-
export * as operators from './operators';
|
|
17
|
-
|
|
18
14
|
export const type: ISchema = {
|
|
19
15
|
type: 'string',
|
|
20
16
|
title: '{{t("Storage type")}}',
|
|
@@ -51,17 +47,6 @@ export const unique = {
|
|
|
51
47
|
'x-decorator': 'FormItem',
|
|
52
48
|
'x-component': 'Checkbox',
|
|
53
49
|
'x-disabled': '{{ !createMainOnly || primaryKeyOnly }}',
|
|
54
|
-
'x-reactions': [
|
|
55
|
-
{
|
|
56
|
-
dependencies: ['primaryKey'],
|
|
57
|
-
when: '{{$deps[0]}}',
|
|
58
|
-
fulfill: {
|
|
59
|
-
state: {
|
|
60
|
-
value: false,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
50
|
};
|
|
66
51
|
export const primaryKey = {
|
|
67
52
|
type: 'boolean',
|
|
@@ -69,17 +54,6 @@ export const primaryKey = {
|
|
|
69
54
|
'x-decorator': 'FormItem',
|
|
70
55
|
'x-component': 'Checkbox',
|
|
71
56
|
'x-disabled': '{{ !createMainOnly || primaryKeyOnly }}',
|
|
72
|
-
'x-reactions': [
|
|
73
|
-
{
|
|
74
|
-
dependencies: ['unique'],
|
|
75
|
-
when: '{{$deps[0]&&createMainOnly}}',
|
|
76
|
-
fulfill: {
|
|
77
|
-
state: {
|
|
78
|
-
value: false,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
57
|
};
|
|
84
58
|
|
|
85
59
|
export const autoIncrement = {
|
|
@@ -89,17 +63,6 @@ export const autoIncrement = {
|
|
|
89
63
|
'x-decorator': 'FormItem',
|
|
90
64
|
'x-component': 'Checkbox',
|
|
91
65
|
'x-disabled': '{{ !createMainOnly }}',
|
|
92
|
-
'x-reactions': [
|
|
93
|
-
{
|
|
94
|
-
dependencies: ['primaryKey'],
|
|
95
|
-
when: '{{$deps[0]&&createMainOnly}}',
|
|
96
|
-
fulfill: {
|
|
97
|
-
state: {
|
|
98
|
-
value: true,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
66
|
};
|
|
104
67
|
|
|
105
68
|
export const autoFill = {
|
|
@@ -155,56 +118,6 @@ export const reverseFieldProperties: Record<string, ISchema> = {
|
|
|
155
118
|
'x-decorator': 'FormItem',
|
|
156
119
|
'x-component': 'Checkbox',
|
|
157
120
|
'x-content': '{{t("Create inverse field in the target collection")}}',
|
|
158
|
-
'x-reactions': [
|
|
159
|
-
{
|
|
160
|
-
target: 'reverseField.type',
|
|
161
|
-
when: '{{!!$self.value}}',
|
|
162
|
-
fulfill: {
|
|
163
|
-
state: {
|
|
164
|
-
hidden: false,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
otherwise: {
|
|
168
|
-
state: {
|
|
169
|
-
hidden: true,
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
target: 'reverseField.uiSchema.title',
|
|
175
|
-
when: '{{!!$self.value}}',
|
|
176
|
-
fulfill: {
|
|
177
|
-
state: {
|
|
178
|
-
hidden: false,
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
otherwise: {
|
|
182
|
-
state: {
|
|
183
|
-
hidden: true,
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
target: 'reverseField.name',
|
|
189
|
-
when: '{{!!$self.value}}',
|
|
190
|
-
fulfill: {
|
|
191
|
-
state: {
|
|
192
|
-
hidden: false,
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
otherwise: {
|
|
196
|
-
state: {
|
|
197
|
-
hidden: true,
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
(field) => {
|
|
202
|
-
const values = field.form.values;
|
|
203
|
-
const { reverseField } = values;
|
|
204
|
-
field.value = !!reverseField?.key;
|
|
205
|
-
field.disabled = !!reverseField?.key;
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
121
|
},
|
|
209
122
|
'reverseField.type': {
|
|
210
123
|
...relationshipType,
|
|
@@ -308,44 +221,12 @@ export const dateTimeProps: { [key: string]: ISchema } = {
|
|
|
308
221
|
value: 'custom',
|
|
309
222
|
},
|
|
310
223
|
],
|
|
311
|
-
'x-reactions': {
|
|
312
|
-
dependencies: ['uiSchema.x-component-props.picker'],
|
|
313
|
-
fulfill: {
|
|
314
|
-
state: {
|
|
315
|
-
value: `{{ getPickerFormat($deps[0])}}`,
|
|
316
|
-
componentProps: { picker: `{{$deps[0]}}` },
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
224
|
},
|
|
321
225
|
'uiSchema.x-component-props.showTime': {
|
|
322
226
|
type: 'boolean',
|
|
323
227
|
'x-decorator': 'FormItem',
|
|
324
228
|
'x-component': 'Checkbox',
|
|
325
229
|
'x-content': '{{t("Show time")}}',
|
|
326
|
-
'x-reactions': [
|
|
327
|
-
`{{(field) => {
|
|
328
|
-
field.query('..[].timeFormat').take(f => {
|
|
329
|
-
f.display = field.value ? 'visible' : 'none';
|
|
330
|
-
f.value='HH:mm:ss'
|
|
331
|
-
});
|
|
332
|
-
}}}`,
|
|
333
|
-
{
|
|
334
|
-
dependencies: ['uiSchema.x-component-props.picker'],
|
|
335
|
-
when: '{{$deps[0]==="date"}}',
|
|
336
|
-
fulfill: {
|
|
337
|
-
state: {
|
|
338
|
-
hidden: false,
|
|
339
|
-
},
|
|
340
|
-
},
|
|
341
|
-
otherwise: {
|
|
342
|
-
state: {
|
|
343
|
-
hidden: true,
|
|
344
|
-
value: false,
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
],
|
|
349
230
|
},
|
|
350
231
|
'uiSchema.x-component-props.timeFormat': {
|
|
351
232
|
type: 'string',
|
|
@@ -363,14 +244,6 @@ export const dateTimeProps: { [key: string]: ISchema } = {
|
|
|
363
244
|
value: 'HH:mm:ss',
|
|
364
245
|
},
|
|
365
246
|
],
|
|
366
|
-
'x-reactions': {
|
|
367
|
-
dependencies: ['uiSchema.x-component-props.showTime'],
|
|
368
|
-
fulfill: {
|
|
369
|
-
state: {
|
|
370
|
-
hidden: `{{ !$deps[0] }}`,
|
|
371
|
-
},
|
|
372
|
-
},
|
|
373
|
-
},
|
|
374
247
|
},
|
|
375
248
|
};
|
|
376
249
|
|
|
@@ -446,12 +319,6 @@ export const dataSource: ISchema = {
|
|
|
446
319
|
required: true,
|
|
447
320
|
'x-decorator': 'FormItem',
|
|
448
321
|
'x-component': 'Input',
|
|
449
|
-
'x-reactions': (field: Field) => {
|
|
450
|
-
if (!field.initialValue && !field.initialized) {
|
|
451
|
-
field.initialValue = uid();
|
|
452
|
-
field.setValue(uid());
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
322
|
},
|
|
456
323
|
},
|
|
457
324
|
},
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
11
|
-
import { dataSource, defaultProps
|
|
11
|
+
import { dataSource, defaultProps } from './properties';
|
|
12
12
|
|
|
13
13
|
export class RadioGroupFieldInterface extends CollectionFieldInterface {
|
|
14
14
|
name = 'radioGroup';
|
|
@@ -31,7 +31,7 @@ export class RadioGroupFieldInterface extends CollectionFieldInterface {
|
|
|
31
31
|
'uiSchema.enum': dataSource,
|
|
32
32
|
};
|
|
33
33
|
filterable = {
|
|
34
|
-
operators:
|
|
34
|
+
operators: 'enumType',
|
|
35
35
|
};
|
|
36
36
|
titleUsable = true;
|
|
37
37
|
}
|
|
@@ -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 RichTextFieldInterface extends CollectionFieldInterface {
|
|
@@ -31,54 +29,7 @@ export class RichTextFieldInterface 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 SelectFieldInterface extends CollectionFieldInterface {
|
|
@@ -33,18 +32,7 @@ export class SelectFieldInterface extends CollectionFieldInterface {
|
|
|
33
32
|
'uiSchema.enum': dataSource,
|
|
34
33
|
};
|
|
35
34
|
filterable = {
|
|
36
|
-
operators:
|
|
35
|
+
operators: 'enumType',
|
|
37
36
|
};
|
|
38
37
|
titleUsable = true;
|
|
39
|
-
schemaInitialize(schema: ISchema, { block }) {
|
|
40
|
-
const props = (schema['x-component-props'] = schema['x-component-props'] || {});
|
|
41
|
-
props.style = {
|
|
42
|
-
...(props.style || {}),
|
|
43
|
-
width: '100%',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
47
|
-
props['ellipsis'] = true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
38
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
11
|
-
import { defaultProps,
|
|
11
|
+
import { defaultProps, unique, primaryKey } from './properties';
|
|
12
12
|
|
|
13
13
|
export class SnowflakeIdFieldInterface extends CollectionFieldInterface {
|
|
14
14
|
name = 'snowflakeId';
|
|
@@ -52,7 +52,7 @@ export class SnowflakeIdFieldInterface extends CollectionFieldInterface {
|
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
filterable = {
|
|
55
|
-
operators:
|
|
55
|
+
operators: 'number',
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
description =
|
|
@@ -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 TableoidFieldInterface extends CollectionFieldInterface {
|
|
14
13
|
name = 'tableoid';
|
|
@@ -48,6 +47,6 @@ export class TableoidFieldInterface extends CollectionFieldInterface {
|
|
|
48
47
|
},
|
|
49
48
|
};
|
|
50
49
|
filterable = {
|
|
51
|
-
operators:
|
|
50
|
+
operators: 'tableoid',
|
|
52
51
|
};
|
|
53
52
|
}
|
|
@@ -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 TextareaFieldInterface extends CollectionFieldInterface {
|
|
@@ -40,54 +38,7 @@ export class TextareaFieldInterface extends CollectionFieldInterface {
|
|
|
40
38
|
'x-component': 'Checkbox',
|
|
41
39
|
},
|
|
42
40
|
};
|
|
43
|
-
schemaInitialize(schema: ISchema, { block }) {
|
|
44
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
45
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
46
|
-
schema['x-component-props']['ellipsis'] = true;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
validateSchema = (fieldSchema) => {
|
|
50
|
-
return {
|
|
51
|
-
max: {
|
|
52
|
-
type: 'number',
|
|
53
|
-
title: '{{ t("Max length") }}',
|
|
54
|
-
minimum: 0,
|
|
55
|
-
'x-decorator': 'FormItem',
|
|
56
|
-
'x-component': 'InputNumber',
|
|
57
|
-
'x-component-props': {
|
|
58
|
-
precision: 0,
|
|
59
|
-
},
|
|
60
|
-
'x-reactions': `{{(field) => {
|
|
61
|
-
const targetValue = field.query('.min').value();
|
|
62
|
-
field.selfErrors =
|
|
63
|
-
!!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
|
|
64
|
-
'Max length must greater than min length',
|
|
65
|
-
)}' : ''
|
|
66
|
-
}}}`,
|
|
67
|
-
},
|
|
68
|
-
min: {
|
|
69
|
-
type: 'number',
|
|
70
|
-
title: '{{ t("Min length") }}',
|
|
71
|
-
minimum: 0,
|
|
72
|
-
'x-decorator': 'FormItem',
|
|
73
|
-
'x-component': 'InputNumber',
|
|
74
|
-
'x-component-props': {
|
|
75
|
-
precision: 0,
|
|
76
|
-
},
|
|
77
|
-
'x-reactions': {
|
|
78
|
-
dependencies: ['.max'],
|
|
79
|
-
fulfill: {
|
|
80
|
-
state: {
|
|
81
|
-
selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
|
|
82
|
-
'Min length must less than max length',
|
|
83
|
-
)}' : ''}}`,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
41
|
filterable = {
|
|
91
|
-
operators:
|
|
42
|
+
operators: 'string',
|
|
92
43
|
};
|
|
93
44
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
11
|
-
import { defaultProps,
|
|
11
|
+
import { defaultProps, timeProps } from './properties';
|
|
12
12
|
|
|
13
13
|
export class TimeFieldInterface extends CollectionFieldInterface {
|
|
14
14
|
name = 'time';
|
|
@@ -31,7 +31,7 @@ export class TimeFieldInterface extends CollectionFieldInterface {
|
|
|
31
31
|
...timeProps,
|
|
32
32
|
};
|
|
33
33
|
filterable = {
|
|
34
|
-
operators:
|
|
34
|
+
operators: 'time',
|
|
35
35
|
};
|
|
36
36
|
titleUsable = true;
|
|
37
37
|
}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
import { ISchema } from '@formily/react';
|
|
11
11
|
|
|
12
|
+
import type { FieldFilterable, FieldFilterOperator } from '../filter-operators';
|
|
13
|
+
|
|
12
14
|
interface IDefault {
|
|
13
15
|
type: string;
|
|
14
16
|
uiSchema?: ISchema;
|
|
@@ -19,22 +21,12 @@ export interface IField extends ISchema {
|
|
|
19
21
|
group?: string;
|
|
20
22
|
order?: number;
|
|
21
23
|
default?: IDefault;
|
|
22
|
-
operators?:
|
|
24
|
+
operators?: FieldFilterOperator[];
|
|
23
25
|
/**
|
|
24
26
|
* - 如果该值为空,则在 Filter 组件中该字段会被过滤掉
|
|
25
27
|
* - 如果该值为空,则不会在变量列表中看到该字段
|
|
26
28
|
*/
|
|
27
|
-
filterable?:
|
|
28
|
-
/**
|
|
29
|
-
* 字段所支持的操作符,会在 Filter 组件中显示,比如设置 `数据范围` 的时候可以看见
|
|
30
|
-
*/
|
|
31
|
-
operators?: any[];
|
|
32
|
-
/**
|
|
33
|
-
* 为当前字段添加子选项,这个子选项会在 Filter 组件中显示,比如设置 `数据范围` 的时候可以看见
|
|
34
|
-
*/
|
|
35
|
-
children?: any[];
|
|
36
|
-
[key: string]: any;
|
|
37
|
-
};
|
|
29
|
+
filterable?: FieldFilterable;
|
|
38
30
|
// NOTE: set to `true` means field could be used as a title field
|
|
39
31
|
titleUsable?: boolean;
|
|
40
32
|
[key: string]: any;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
11
|
-
import { defaultProps,
|
|
11
|
+
import { defaultProps, dateTimeProps } from './properties';
|
|
12
12
|
export class UnixTimestampFieldInterface extends CollectionFieldInterface {
|
|
13
13
|
name = 'unixTimestamp';
|
|
14
14
|
type = 'object';
|
|
@@ -62,7 +62,7 @@ export class UnixTimestampFieldInterface extends CollectionFieldInterface {
|
|
|
62
62
|
},
|
|
63
63
|
};
|
|
64
64
|
filterable = {
|
|
65
|
-
operators:
|
|
65
|
+
operators: 'datetime',
|
|
66
66
|
};
|
|
67
67
|
titleUsable = true;
|
|
68
68
|
}
|
|
@@ -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 UpdatedAtFieldInterface extends CollectionFieldInterface {
|
|
14
14
|
name = 'updatedAt';
|
|
@@ -35,7 +35,7 @@ export class UpdatedAtFieldInterface extends CollectionFieldInterface {
|
|
|
35
35
|
...dateTimeProps,
|
|
36
36
|
};
|
|
37
37
|
filterable = {
|
|
38
|
-
operators:
|
|
38
|
+
operators: 'datetime',
|
|
39
39
|
};
|
|
40
40
|
titleUsable = true;
|
|
41
41
|
}
|
|
@@ -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
|
-
import { cloneDeep } from 'lodash';
|
|
12
10
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
13
|
-
import { defaultProps
|
|
11
|
+
import { defaultProps } from './properties';
|
|
14
12
|
|
|
15
13
|
export class UpdatedByFieldInterface extends CollectionFieldInterface {
|
|
16
14
|
name = 'updatedBy';
|
|
@@ -66,14 +64,5 @@ export class UpdatedByFieldInterface extends CollectionFieldInterface {
|
|
|
66
64
|
// },
|
|
67
65
|
// ],
|
|
68
66
|
};
|
|
69
|
-
schemaInitialize(schema: ISchema, { block }) {
|
|
70
|
-
schema['properties'] = {
|
|
71
|
-
viewer: cloneDeep(recordPickerViewer),
|
|
72
|
-
};
|
|
73
|
-
if (['Table', 'Kanban'].includes(block)) {
|
|
74
|
-
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
75
|
-
schema['x-component-props']['ellipsis'] = true;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
67
|
description = '{{t("Store the last update user of each record")}}';
|
|
79
68
|
}
|
|
@@ -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 } from './properties';
|
|
10
|
+
import { defaultProps } from './properties';
|
|
12
11
|
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
13
12
|
|
|
14
13
|
export class UrlFieldInterface extends CollectionFieldInterface {
|
|
@@ -35,7 +34,6 @@ export class UrlFieldInterface extends CollectionFieldInterface {
|
|
|
35
34
|
},
|
|
36
35
|
];
|
|
37
36
|
availableTypes = ['string', 'text'];
|
|
38
|
-
schemaInitialize(schema: ISchema, { block }) {}
|
|
39
37
|
validationType = 'string';
|
|
40
38
|
availableValidationOptions = ['uri', 'pattern'];
|
|
41
39
|
properties = {
|
|
@@ -43,6 +41,6 @@ export class UrlFieldInterface extends CollectionFieldInterface {
|
|
|
43
41
|
};
|
|
44
42
|
titleUsable = true;
|
|
45
43
|
filterable = {
|
|
46
|
-
operators:
|
|
44
|
+
operators: 'string',
|
|
47
45
|
};
|
|
48
46
|
}
|
|
@@ -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
|
|
|
13
13
|
export class UUIDFieldInterface extends CollectionFieldInterface {
|
|
14
14
|
name = 'uuid';
|
|
@@ -66,7 +66,7 @@ export class UUIDFieldInterface extends CollectionFieldInterface {
|
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
filterable = {
|
|
69
|
-
operators:
|
|
69
|
+
operators: 'string',
|
|
70
70
|
};
|
|
71
71
|
titleUsable = true;
|
|
72
72
|
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { cloneDeep, merge } from 'lodash';
|
|
11
|
+
import type { ReactNode } from 'react';
|
|
12
|
+
|
|
13
|
+
export interface CollectionTemplateFieldOption {
|
|
14
|
+
label: ReactNode;
|
|
15
|
+
value: string | number | boolean;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CollectionTemplateField {
|
|
20
|
+
name: string;
|
|
21
|
+
interface?: string;
|
|
22
|
+
type?: string;
|
|
23
|
+
title?: ReactNode;
|
|
24
|
+
options?: CollectionTemplateFieldOption[];
|
|
25
|
+
component?: string;
|
|
26
|
+
componentProps?: Record<string, unknown>;
|
|
27
|
+
uiSchema?: Record<string, unknown>;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface FieldInterfaceConfigureLike {
|
|
32
|
+
default?: {
|
|
33
|
+
uiSchema?: Record<string, unknown>;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface FieldInterfaceLike {
|
|
39
|
+
default?: {
|
|
40
|
+
uiSchema?: Record<string, unknown>;
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CollectionTemplateFieldNormalizeManager {
|
|
46
|
+
getFieldInterfaceConfigure?: (
|
|
47
|
+
name: string,
|
|
48
|
+
collectionInfo?: Record<string, unknown>,
|
|
49
|
+
) => FieldInterfaceConfigureLike | undefined;
|
|
50
|
+
getFieldInterface?: (name: string) => FieldInterfaceLike | undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface NormalizeCollectionTemplateFieldOptions {
|
|
54
|
+
collectionInfo?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function normalizeCollectionTemplateField(
|
|
58
|
+
field: CollectionTemplateField,
|
|
59
|
+
manager?: CollectionTemplateFieldNormalizeManager,
|
|
60
|
+
options: NormalizeCollectionTemplateFieldOptions = {},
|
|
61
|
+
) {
|
|
62
|
+
const fieldInterfaceName = field.interface;
|
|
63
|
+
const fieldInterfaceDefault = fieldInterfaceName
|
|
64
|
+
? manager?.getFieldInterfaceConfigure?.(fieldInterfaceName, options.collectionInfo)?.default ||
|
|
65
|
+
manager?.getFieldInterface?.(fieldInterfaceName)?.default
|
|
66
|
+
: undefined;
|
|
67
|
+
|
|
68
|
+
const normalized = merge({}, cloneDeep(fieldInterfaceDefault || {}), cloneDeep(field));
|
|
69
|
+
const uiSchema = merge({}, cloneDeep(fieldInterfaceDefault?.uiSchema || {}), cloneDeep(field.uiSchema || {}));
|
|
70
|
+
|
|
71
|
+
if (field.title !== undefined) {
|
|
72
|
+
uiSchema.title = field.title;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (field.options !== undefined) {
|
|
76
|
+
uiSchema.enum = cloneDeep(field.options);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (field.component !== undefined) {
|
|
80
|
+
uiSchema['x-component'] = field.component;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (field.componentProps !== undefined) {
|
|
84
|
+
uiSchema['x-component-props'] = merge(
|
|
85
|
+
{},
|
|
86
|
+
cloneDeep(fieldInterfaceDefault?.uiSchema?.['x-component-props'] || {}),
|
|
87
|
+
cloneDeep(field.componentProps),
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
delete normalized.title;
|
|
92
|
+
delete normalized.options;
|
|
93
|
+
delete normalized.component;
|
|
94
|
+
delete normalized.componentProps;
|
|
95
|
+
|
|
96
|
+
if (Object.keys(uiSchema).length) {
|
|
97
|
+
normalized.uiSchema = uiSchema;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return normalized;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function normalizeCollectionTemplateFields(
|
|
104
|
+
fields: CollectionTemplateField[] = [],
|
|
105
|
+
manager?: CollectionTemplateFieldNormalizeManager,
|
|
106
|
+
options?: NormalizeCollectionTemplateFieldOptions,
|
|
107
|
+
) {
|
|
108
|
+
return fields.map((field) => normalizeCollectionTemplateField(field, manager, options));
|
|
109
|
+
}
|