@nocobase/client-v2 2.2.0-alpha.1 → 2.2.0-alpha.11
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/APIClient.d.ts +1 -3
- package/es/BaseApplication.d.ts +3 -0
- package/es/PluginSettingsManager.d.ts +33 -0
- package/es/RouteRepository.d.ts +29 -6
- package/es/RouterManager.d.ts +15 -0
- package/es/authRedirect.d.ts +1 -0
- package/es/collection-field-interface/CollectionFieldInterface.d.ts +1 -0
- package/es/collection-field-interface/CollectionFieldInterfaceManager.d.ts +1 -0
- package/es/components/category-tabs/SortableCategoryTabs.d.ts +55 -0
- package/es/components/category-tabs/index.d.ts +9 -0
- package/es/components/form/JsonTextArea.d.ts +2 -1
- package/es/components/form/ScanInput/useCodeScanner.d.ts +3 -2
- package/es/components/form/TypedVariableInput.d.ts +31 -5
- package/es/components/form/VariableJsonTextArea.d.ts +19 -0
- package/es/components/form/filter/CollectionFilter.d.ts +2 -0
- package/es/components/form/filter/CollectionFilterItem.d.ts +11 -1
- package/es/components/form/filter/CollectionFilterPanel.d.ts +2 -0
- package/es/components/form/filter/index.d.ts +2 -0
- package/es/components/form/filter/useFilterActionProps.d.ts +2 -0
- package/es/components/form/index.d.ts +1 -0
- package/es/components/index.d.ts +2 -0
- package/es/entry-actions/EntryActionManager.d.ts +24 -0
- package/es/entry-actions/index.d.ts +9 -0
- package/es/flow/actions/afterSuccess.d.ts +8 -1
- package/es/flow/actions/index.d.ts +2 -2
- package/es/flow/actions/linkageRules.d.ts +2 -0
- package/es/flow/admin-shell/BaseLayoutModel.d.ts +6 -0
- package/es/flow/admin-shell/BaseLayoutRouteCoordinator.d.ts +7 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.d.ts +2 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutMenuFlowUtils.d.ts +2 -1
- package/es/flow/admin-shell/admin-layout/AdminLayoutMenuModels.d.ts +3 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutMenuUtils.d.ts +3 -2
- package/es/flow/admin-shell/admin-layout/AdminLayoutSlotModels.d.ts +5 -0
- package/es/flow/admin-shell/admin-layout/AppListRender.d.ts +2 -1
- package/es/flow/admin-shell/admin-layout/AppSwitcherActionPanelModel.d.ts +24 -0
- package/es/flow/admin-shell/admin-layout/index.d.ts +1 -0
- package/es/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.d.ts +6 -0
- package/es/flow/admin-shell/admin-layout/useApplications.d.ts +7 -2
- package/es/flow/components/FieldAssignExactDatePicker.d.ts +1 -0
- package/es/flow/components/FieldAssignRulesEditor.d.ts +3 -1
- package/es/flow/components/FieldAssignValueInput.d.ts +9 -0
- package/es/flow/components/FlowRoute.d.ts +2 -2
- package/es/flow/components/RunJSValueEditor.d.ts +1 -0
- package/es/flow/components/filter/FilterGroup.d.ts +1 -0
- package/es/flow/components/filter/VariableFilterItem.d.ts +6 -1
- package/es/flow/index.d.ts +1 -0
- package/es/flow/internal/registerDeviceTypeContext.d.ts +10 -0
- package/es/flow/models/base/ActionModelCore.d.ts +2 -0
- package/es/flow/models/base/BlockGridModel.d.ts +3 -0
- package/es/flow/models/base/GridModel.d.ts +1 -1
- package/es/flow/models/base/PageModel/PageModel.d.ts +12 -0
- package/es/flow/models/base/PageModel/PageModelTabBar.d.ts +22 -0
- package/es/flow/models/base/PageModel/PageTabModel.d.ts +12 -0
- package/es/flow/models/blocks/filter-form/FilterFormBlockModel.d.ts +5 -0
- package/es/flow/models/blocks/form/FormBlockModel.d.ts +4 -0
- package/es/flow/models/blocks/form/QuickEditFormModel.d.ts +17 -2
- package/es/flow/models/blocks/form/submitHandler.d.ts +1 -1
- package/es/flow/models/blocks/form/value-runtime/rules.d.ts +21 -0
- package/es/flow/models/blocks/form/value-runtime/runtime.d.ts +30 -0
- package/es/flow/models/blocks/form/value-runtime/types.d.ts +2 -2
- package/es/flow/models/blocks/js-block/JSBlock.d.ts +1 -0
- package/es/flow/models/blocks/table/TableActionsColumnModel.d.ts +1 -0
- package/es/flow/models/blocks/table/TableBlockModel.d.ts +1 -0
- package/es/flow/models/blocks/table/TableColumnModel.d.ts +1 -0
- package/es/flow/models/blocks/table/dragSort/dragSortHooks.d.ts +1 -1
- package/es/flow/models/blocks/table/dragSort/dragSortSettings.d.ts +2 -1
- package/es/flow/models/blocks/table/dragSort/dragSortUtils.d.ts +6 -4
- package/es/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.d.ts +2 -0
- package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.d.ts +6 -0
- package/es/flow/models/fields/DateTimeFieldModel/dateLimit.d.ts +15 -7
- package/es/flow/resolveViewParamsToViewList.d.ts +1 -1
- package/es/flow/routeTransientInputArgs.d.ts +14 -0
- package/es/flow/utils/dataScopeRowSnapshot.d.ts +59 -0
- package/es/flow/utils/dateTimeDisplayProps.d.ts +49 -0
- package/es/flow/utils/formValueDeps.d.ts +32 -0
- package/es/flow-compat/FieldValidation.d.ts +2 -1
- package/es/flow-compat/fieldValidationConstants.d.ts +1 -1
- package/es/flow-compat/routeTypes.d.ts +1 -0
- package/es/index.d.ts +8 -1
- package/es/index.mjs +367 -181
- package/es/utils/getRouteRuntimeVersion.d.ts +23 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/markdownSanitize.d.ts +11 -0
- package/lib/index.js +367 -181
- package/lib/locale/languageCodes.js +3 -1
- package/package.json +9 -7
- package/src/APIClient.ts +1 -10
- package/src/Application.tsx +4 -0
- package/src/BaseApplication.tsx +13 -6
- package/src/PluginSettingsManager.ts +53 -0
- package/src/RouteRepository.ts +151 -24
- package/src/RouterManager.tsx +142 -1
- package/src/__tests__/PluginSettingsManager.test.ts +13 -0
- package/src/__tests__/RouteRepository.test.ts +239 -0
- package/src/__tests__/RouterManager.test.ts +125 -0
- package/src/__tests__/app.test.tsx +73 -0
- package/src/__tests__/authRedirect.test.ts +17 -0
- package/src/__tests__/browserChecker.test.ts +61 -0
- package/src/__tests__/exports.test.ts +16 -0
- package/src/__tests__/getRouteRuntimeVersion.test.ts +68 -0
- package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +234 -2
- package/src/__tests__/plugin-manager.test.tsx +44 -2
- package/src/__tests__/settings-center.test.tsx +40 -1
- package/src/authRedirect.ts +38 -0
- package/src/collection-field-interface/CollectionFieldInterface.ts +1 -0
- package/src/collection-field-interface/CollectionFieldInterfaceManager.ts +1 -0
- package/src/collection-manager/field-configure.ts +1 -1
- package/src/collection-manager/field-validation.ts +1 -1
- package/src/collection-manager/interfaces/id.ts +1 -1
- package/src/collection-manager/interfaces/m2m.tsx +2 -2
- package/src/collection-manager/interfaces/m2o.tsx +2 -2
- package/src/collection-manager/interfaces/nanoid.ts +1 -1
- package/src/collection-manager/interfaces/o2m.tsx +2 -2
- package/src/collection-manager/interfaces/obo.tsx +2 -2
- package/src/collection-manager/interfaces/oho.tsx +2 -2
- package/src/collection-manager/interfaces/properties/index.ts +2 -2
- package/src/collection-manager/interfaces/uuid.ts +1 -1
- package/src/components/AppComponents.tsx +19 -3
- package/src/components/README.md +7 -1
- package/src/components/README.zh-CN.md +6 -1
- package/src/components/category-tabs/SortableCategoryTabs.tsx +210 -0
- package/src/components/category-tabs/index.ts +10 -0
- package/src/components/form/JsonTextArea.tsx +25 -11
- package/src/components/form/ScanInput/CodeScanner.tsx +79 -35
- package/src/components/form/ScanInput/__tests__/CodeScanner.test.tsx +101 -0
- package/src/components/form/ScanInput/__tests__/useCodeScanner.test.tsx +284 -11
- package/src/components/form/ScanInput/useCodeScanner.ts +332 -24
- package/src/components/form/TypedVariableInput.tsx +452 -101
- package/src/components/form/VariableJsonTextArea.tsx +175 -0
- package/src/components/form/__tests__/JsonTextArea.test.tsx +43 -0
- package/src/components/form/__tests__/TypedVariableInput.test.tsx +364 -12
- package/src/components/form/__tests__/VariableJsonTextArea.test.tsx +86 -0
- package/src/components/form/filter/CollectionFilter.tsx +4 -0
- package/src/components/form/filter/CollectionFilterItem.tsx +32 -7
- package/src/components/form/filter/CollectionFilterPanel.tsx +4 -0
- package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +38 -0
- package/src/components/form/filter/__tests__/useFilterActionProps.test.tsx +95 -0
- package/src/components/form/filter/index.ts +2 -0
- package/src/components/form/filter/useFilterActionProps.ts +37 -6
- package/src/components/form/index.tsx +1 -0
- package/src/components/index.ts +2 -0
- package/src/entry-actions/EntryActionManager.ts +76 -0
- package/src/entry-actions/index.ts +10 -0
- package/src/flow/FlowPage.tsx +38 -3
- package/src/flow/__tests__/FlowPage.test.tsx +201 -27
- package/src/flow/__tests__/FlowRoute.test.tsx +1181 -80
- package/src/flow/__tests__/PluginFlowEngine.test.ts +58 -0
- package/src/flow/__tests__/getKey.test.ts +7 -0
- package/src/flow/__tests__/resolveViewParamsToViewList.test.ts +34 -0
- package/src/flow/actions/__tests__/actionLinkageRules.forkProps.test.ts +115 -0
- package/src/flow/actions/__tests__/afterSuccess.test.ts +73 -0
- package/src/flow/actions/__tests__/dataScopeFilter.test.ts +120 -0
- package/src/flow/actions/__tests__/dataScopeFormValueClear.test.ts +1124 -0
- package/src/flow/actions/__tests__/fieldLinkageRules.scopeDepth.test.ts +150 -1
- package/src/flow/actions/__tests__/linkageAssignField.legacy.test.ts +135 -0
- package/src/flow/actions/__tests__/linkageRules.hiddenSync.restore.test.ts +19 -5
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +92 -0
- package/src/flow/actions/__tests__/linkageRules.tab.test.ts +171 -0
- package/src/flow/actions/__tests__/linkageRulesRefresh.test.ts +7 -3
- package/src/flow/actions/__tests__/openView.defineProps.route.test.tsx +164 -0
- package/src/flow/actions/__tests__/subFormFieldLinkageRules.inputArgs.test.ts +2 -2
- package/src/flow/actions/afterSuccess.tsx +142 -3
- package/src/flow/actions/customVariable.tsx +1 -2
- package/src/flow/actions/dataScopeFilter.ts +20 -1
- package/src/flow/actions/dateTimeFormat.tsx +42 -28
- package/src/flow/actions/index.ts +3 -1
- package/src/flow/actions/linkageRules.tsx +209 -47
- package/src/flow/actions/linkageRulesFormValueRefresh.ts +22 -130
- package/src/flow/actions/linkageRulesRefresh.tsx +2 -6
- package/src/flow/actions/openView.tsx +59 -5
- package/src/flow/actions/runjs.tsx +2 -14
- package/src/flow/actions/validation.tsx +62 -30
- package/src/flow/admin-shell/BaseLayoutModel.tsx +149 -3
- package/src/flow/admin-shell/BaseLayoutRouteCoordinator.ts +187 -42
- package/src/flow/admin-shell/__tests__/AdminLayoutRouteCoordinator.test.ts +1020 -110
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +74 -14
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.test.tsx +486 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +64 -8
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuFlowUtils.ts +5 -3
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuModels.tsx +61 -9
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuUtils.tsx +71 -8
- package/src/flow/admin-shell/admin-layout/AdminLayoutModel.tsx +1 -1
- package/src/flow/admin-shell/admin-layout/AdminLayoutSlotModels.tsx +23 -9
- package/src/flow/admin-shell/admin-layout/AppListRender.tsx +13 -2
- package/src/flow/admin-shell/admin-layout/AppSwitcherActionPanelModel.tsx +289 -0
- package/src/flow/admin-shell/admin-layout/HelpLite.tsx +1 -3
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutComponent.test.tsx +435 -0
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +99 -0
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +518 -2
- package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.test.tsx +214 -2
- package/src/flow/admin-shell/admin-layout/index.ts +1 -0
- package/src/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.test.ts +20 -0
- package/src/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.ts +33 -5
- package/src/flow/admin-shell/admin-layout/useApplications.tsx +81 -12
- package/src/flow/common/Markdown/Display.tsx +14 -3
- package/src/flow/common/Markdown/Edit.tsx +19 -7
- package/src/flow/common/Markdown/style.ts +4 -0
- package/src/flow/components/BlockItemCard.tsx +2 -2
- package/src/flow/components/DefaultValue.tsx +1 -2
- package/src/flow/components/DynamicFlowsIcon.tsx +447 -126
- package/src/flow/components/FieldAssignExactDatePicker.tsx +25 -11
- package/src/flow/components/FieldAssignRulesEditor.tsx +128 -21
- package/src/flow/components/FieldAssignValueInput.tsx +91 -20
- package/src/flow/components/FlowRoute.tsx +256 -53
- package/src/flow/components/RunJSValueEditor.tsx +9 -1
- package/src/flow/components/__tests__/DynamicFlowsIcon.test.tsx +148 -2
- package/src/flow/components/__tests__/FieldAssignRulesEditor.test.tsx +508 -4
- package/src/flow/components/__tests__/FieldAssignValueInput.context.test.tsx +216 -0
- package/src/flow/components/__tests__/fieldAssignOptions.test.ts +151 -3
- package/src/flow/components/code-editor/__tests__/useCodeRunner.test.tsx +2 -17
- package/src/flow/components/code-editor/hooks/useCodeRunner.ts +2 -14
- package/src/flow/components/code-editor/runjsDiagnostics.ts +8 -45
- package/src/flow/components/fieldAssignOptions.ts +155 -27
- package/src/flow/components/filter/FilterGroup.tsx +33 -5
- package/src/flow/components/filter/VariableFilterItem.tsx +158 -10
- package/src/flow/components/filter/__tests__/FilterGroup.test.tsx +45 -0
- package/src/flow/components/filter/__tests__/VariableFilterItem.leftMetaTree.test.tsx +9 -0
- package/src/flow/components/filter/__tests__/VariableFilterItem.test.tsx +70 -1
- package/src/flow/flows/editMarkdownFlow.tsx +1 -1
- package/src/flow/getViewDiffAndUpdateHidden.tsx +1 -0
- package/src/flow/index.ts +4 -1
- package/src/flow/internal/components/Markdown/util.ts +2 -1
- package/src/flow/internal/registerDeviceTypeContext.ts +39 -0
- package/src/flow/internal/utils/operatorSchemaHelper.ts +15 -1
- package/src/flow/models/actions/JSActionModel.tsx +2 -7
- package/src/flow/models/actions/JSCollectionActionModel.tsx +2 -7
- package/src/flow/models/actions/JSItemActionModel.tsx +2 -7
- package/src/flow/models/actions/JSRecordActionModel.tsx +2 -7
- package/src/flow/models/base/ActionModel.tsx +21 -8
- package/src/flow/models/base/ActionModelCore.tsx +11 -4
- package/src/flow/models/base/BlockGridModel.tsx +26 -0
- package/src/flow/models/base/CollectionBlockModel.tsx +6 -2
- package/src/flow/models/base/GridModel.tsx +38 -7
- package/src/flow/models/base/PageModel/PageModel.tsx +387 -50
- package/src/flow/models/base/PageModel/PageModelTabBar.tsx +114 -0
- package/src/flow/models/base/PageModel/PageTabModel.tsx +249 -18
- package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +817 -13
- package/src/flow/models/base/PageModel/__tests__/PageModelTabBar.module-isolation.test.tsx +130 -0
- package/src/flow/models/base/PageModel/__tests__/PageModelTabBar.test.tsx +118 -0
- package/src/flow/models/base/PageModel/__tests__/PageTabModel.test.ts +1075 -7
- package/src/flow/models/base/__tests__/ActionModel.test.ts +83 -0
- package/src/flow/models/base/__tests__/ActionModelCore.render.test.tsx +37 -0
- package/src/flow/models/base/__tests__/BlockGridModel.selectSceneActivation.test.ts +124 -0
- package/src/flow/models/base/__tests__/CollectionBlockModel.addAppends.test.ts +41 -0
- package/src/flow/models/base/__tests__/GridModel.dragSnapshotContainer.test.ts +239 -1
- package/src/flow/models/base/__tests__/transformRowsToSingleColumn.test.ts +48 -0
- package/src/flow/models/blocks/filter-form/FilterFormBlockModel.tsx +59 -6
- package/src/flow/models/blocks/filter-form/FilterFormItemModel.tsx +27 -12
- package/src/flow/models/blocks/filter-form/FilterFormJSActionModel.tsx +2 -7
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormItemModel.defineChildren.test.ts +36 -0
- package/src/flow/models/blocks/filter-form/__tests__/defaultValues.wiring.test.ts +143 -4
- package/src/flow/models/blocks/filter-form/fields/FilterFormCustomFieldModel.tsx +1 -1
- package/src/flow/models/blocks/filter-manager/flow-actions/__tests__/customizeFilterRender.test.tsx +56 -1
- package/src/flow/models/blocks/form/EditFormModel.tsx +1 -0
- package/src/flow/models/blocks/form/FormActionModel.tsx +1 -1
- package/src/flow/models/blocks/form/FormBlockModel.tsx +7 -0
- package/src/flow/models/blocks/form/JSFormActionModel.tsx +2 -7
- package/src/flow/models/blocks/form/QuickEditFormModel.tsx +189 -36
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +17 -0
- package/src/flow/models/blocks/form/__tests__/QuickEditFormModel.quickEdit.test.ts +350 -2
- package/src/flow/models/blocks/form/__tests__/submitHandler.test.ts +54 -1
- package/src/flow/models/blocks/form/submitHandler.ts +17 -3
- package/src/flow/models/blocks/form/value-runtime/__tests__/runtime.test.ts +940 -75
- package/src/flow/models/blocks/form/value-runtime/rules.ts +445 -13
- package/src/flow/models/blocks/form/value-runtime/runtime.ts +348 -13
- package/src/flow/models/blocks/form/value-runtime/types.ts +2 -2
- package/src/flow/models/blocks/js-block/JSBlock.tsx +225 -9
- package/src/flow/models/blocks/js-block/__tests__/JSBlockModel.test.tsx +150 -0
- package/src/flow/models/blocks/table/JSColumnModel.tsx +1 -9
- package/src/flow/models/blocks/table/TableActionsColumnModel.tsx +38 -14
- package/src/flow/models/blocks/table/TableBlockModel.tsx +42 -19
- package/src/flow/models/blocks/table/TableColumnModel.tsx +72 -6
- package/src/flow/models/blocks/table/__tests__/TableActionsColumnModel.test.tsx +111 -1
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.dragSort.test.ts +127 -0
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.mobileSettingsButtons.test.tsx +78 -0
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.quickEditRefresh.test.ts +12 -0
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowSelection.test.tsx +1 -0
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +243 -1
- package/src/flow/models/blocks/table/dragSort/dragSortHooks.tsx +28 -17
- package/src/flow/models/blocks/table/dragSort/dragSortSettings.ts +13 -6
- package/src/flow/models/blocks/table/dragSort/dragSortUtils.ts +15 -2
- package/src/flow/models/fields/AssociationFieldModel/AssociationFieldModel.tsx +1 -1
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +31 -7
- package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +61 -17
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.tsx +141 -19
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +13 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableColumnModel.rowRecord.test.ts +197 -0
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableFieldModel.reset.test.ts +180 -0
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.tsx +6 -4
- package/src/flow/models/fields/AssociationFieldModel/__tests__/AssociationFieldModel.updateAssociation.test.ts +72 -0
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +23 -0
- package/src/flow/models/fields/ClickableFieldModel.tsx +5 -0
- package/src/flow/models/fields/DateTimeFieldModel/__tests__/DateTimeNoTzFieldModel.dateLimit.test.tsx +149 -0
- package/src/flow/models/fields/DateTimeFieldModel/dateLimit.ts +149 -113
- package/src/flow/models/fields/DisplayDateTimeFieldModel.tsx +29 -1
- package/src/flow/models/fields/InputFieldModel.tsx +40 -2
- package/src/flow/models/fields/JSEditableFieldModel.tsx +2 -11
- package/src/flow/models/fields/JSFieldModel.tsx +2 -7
- package/src/flow/models/fields/JSItemModel.tsx +2 -14
- package/src/flow/models/fields/SelectFieldModel.tsx +6 -4
- package/src/flow/models/fields/TextareaFieldModel.tsx +72 -3
- package/src/flow/models/fields/VariableFieldFormModel.tsx +3 -3
- package/src/flow/models/fields/__tests__/DisplayDateTimeFieldModel.test.tsx +96 -0
- package/src/flow/models/fields/__tests__/InputFieldModel.test.tsx +117 -1
- package/src/flow/models/fields/__tests__/SelectFieldModel.test.tsx +43 -0
- package/src/flow/models/fields/__tests__/TextareaFieldModel.test.tsx +131 -0
- package/src/flow/models/fields/__tests__/VariableFieldFormModel.test.tsx +51 -0
- package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +20 -10
- package/src/flow/models/fields/mobile-components/MobileSelect.tsx +24 -12
- package/src/flow/models/topbar/TopbarActionModel.tsx +168 -10
- package/src/flow/resolveViewParamsToViewList.tsx +11 -3
- package/src/flow/routeTransientInputArgs.ts +27 -0
- package/src/flow/utils/__tests__/dateTimeFormat.test.ts +300 -0
- package/src/flow/utils/dataScopeFormValueClear.ts +219 -81
- package/src/flow/utils/dataScopeRowSnapshot.ts +616 -0
- package/src/flow/utils/dateTimeDisplayProps.ts +135 -0
- package/src/flow/utils/formValueDeps.ts +170 -0
- package/src/flow-compat/FieldValidation.tsx +122 -60
- package/src/flow-compat/Popover.tsx +43 -4
- package/src/flow-compat/__tests__/Popover.test.tsx +34 -0
- package/src/flow-compat/fieldValidationConstants.ts +1 -1
- package/src/flow-compat/routeTypes.ts +1 -0
- package/src/index.ts +14 -1
- package/src/layout-manager/__tests__/LayoutRoute.test.tsx +41 -1
- package/src/locale/languageCodes.ts +3 -1
- package/src/nocobase-buildin-plugin/index.tsx +63 -15
- package/src/settings-center/AdminSettingsLayout.tsx +10 -2
- package/src/settings-center/SystemSettingsPage.tsx +1 -2
- package/src/settings-center/plugin-manager/PluginCard.tsx +2 -2
- package/src/settings-center/plugin-manager/index.tsx +3 -0
- package/src/settings-center/utils.tsx +0 -6
- package/src/utils/getRouteRuntimeVersion.ts +185 -0
- package/src/utils/index.tsx +1 -0
- package/src/utils/markdownSanitize.ts +88 -0
|
@@ -0,0 +1,135 @@
|
|
|
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 type { FlowModelContext } from '@nocobase/flow-engine';
|
|
11
|
+
|
|
12
|
+
type DateTimeDisplayProps = {
|
|
13
|
+
dateOnly?: boolean;
|
|
14
|
+
dateFormat?: string;
|
|
15
|
+
format?: string;
|
|
16
|
+
picker?: string;
|
|
17
|
+
showTime?: boolean;
|
|
18
|
+
timeFormat?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type DateTimeCollectionField = {
|
|
22
|
+
type?: string;
|
|
23
|
+
interface?: string;
|
|
24
|
+
getComponentProps?: () => DateTimeDisplayProps;
|
|
25
|
+
targetCollection?: {
|
|
26
|
+
getField?: (name?: string) => DateTimeCollectionField | undefined;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type DateTimeModelContext = FlowModelContext & {
|
|
31
|
+
collectionField?: DateTimeCollectionField;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type DateTimeModel = {
|
|
35
|
+
props?: DateTimeDisplayProps & {
|
|
36
|
+
titleField?: string;
|
|
37
|
+
};
|
|
38
|
+
context?: DateTimeModelContext;
|
|
39
|
+
getStepParams?: (flowKey: string, stepKey: string) => DateTimeDisplayProps | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type ResolveDateTimeDisplayPropsOptions = {
|
|
43
|
+
model?: DateTimeModel;
|
|
44
|
+
collectionField?: DateTimeCollectionField;
|
|
45
|
+
titleField?: string;
|
|
46
|
+
currentProps?: DateTimeDisplayProps;
|
|
47
|
+
params?: DateTimeDisplayProps;
|
|
48
|
+
withDefaults?: boolean;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const dateTimeDisplayPropKeys: Array<keyof DateTimeDisplayProps> = [
|
|
52
|
+
'dateOnly',
|
|
53
|
+
'dateFormat',
|
|
54
|
+
'format',
|
|
55
|
+
'picker',
|
|
56
|
+
'showTime',
|
|
57
|
+
'timeFormat',
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
const pickDateTimeDisplayProps = (source?: DateTimeDisplayProps) => {
|
|
61
|
+
if (!source) {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const result: DateTimeDisplayProps = {};
|
|
66
|
+
for (const key of dateTimeDisplayPropKeys) {
|
|
67
|
+
if (key === 'dateOnly' || key === 'showTime') {
|
|
68
|
+
if (typeof source[key] !== 'undefined') {
|
|
69
|
+
result[key] = source[key];
|
|
70
|
+
}
|
|
71
|
+
} else if (typeof source[key] !== 'undefined') {
|
|
72
|
+
result[key] = source[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const stripUndefined = (props: DateTimeDisplayProps) =>
|
|
79
|
+
Object.fromEntries(Object.entries(props).filter(([, value]) => typeof value !== 'undefined')) as DateTimeDisplayProps;
|
|
80
|
+
|
|
81
|
+
const getModelCollectionField = (model?: DateTimeModel) => model?.context?.collectionField;
|
|
82
|
+
|
|
83
|
+
export const getDateTimeFormatCollectionField = (options: ResolveDateTimeDisplayPropsOptions) => {
|
|
84
|
+
const collectionField = options.collectionField || getModelCollectionField(options.model);
|
|
85
|
+
const titleField = options.titleField || options.model?.props?.titleField;
|
|
86
|
+
return collectionField?.targetCollection?.getField?.(titleField) || collectionField;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const isTimeCollectionField = (collectionField?: DateTimeCollectionField) =>
|
|
90
|
+
collectionField?.type === 'time' || collectionField?.interface === 'time';
|
|
91
|
+
|
|
92
|
+
export const isDateOnlyCollectionField = (collectionField?: DateTimeCollectionField) =>
|
|
93
|
+
collectionField?.type === 'dateOnly' || collectionField?.interface === 'dateOnly';
|
|
94
|
+
|
|
95
|
+
export const getSavedDateTimeFormatParams = (model?: DateTimeModel) =>
|
|
96
|
+
model?.getStepParams?.('datetimeSettings', 'dateFormat') || model?.getStepParams?.('timeSettings', 'dateFormat');
|
|
97
|
+
|
|
98
|
+
export const resolveDateTimeDisplayProps = (options: ResolveDateTimeDisplayPropsOptions) => {
|
|
99
|
+
const collectionField = options.collectionField || getModelCollectionField(options.model);
|
|
100
|
+
const targetCollectionField = getDateTimeFormatCollectionField(options);
|
|
101
|
+
const mergedProps = {
|
|
102
|
+
...pickDateTimeDisplayProps(collectionField?.getComponentProps?.()),
|
|
103
|
+
...pickDateTimeDisplayProps(
|
|
104
|
+
targetCollectionField !== collectionField ? targetCollectionField?.getComponentProps?.() : undefined,
|
|
105
|
+
),
|
|
106
|
+
...pickDateTimeDisplayProps(options.currentProps || options.model?.props),
|
|
107
|
+
...pickDateTimeDisplayProps(getSavedDateTimeFormatParams(options.model)),
|
|
108
|
+
...pickDateTimeDisplayProps(options.params),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
if (isTimeCollectionField(targetCollectionField)) {
|
|
112
|
+
const timeFormat = mergedProps.timeFormat || mergedProps.format || 'HH:mm:ss';
|
|
113
|
+
return stripUndefined({
|
|
114
|
+
...mergedProps,
|
|
115
|
+
timeFormat,
|
|
116
|
+
format: timeFormat,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const picker = mergedProps.picker || (options.withDefaults ? 'date' : undefined);
|
|
121
|
+
const dateFormat = mergedProps.dateFormat || (options.withDefaults ? 'YYYY-MM-DD' : undefined);
|
|
122
|
+
const timeFormat = mergedProps.timeFormat || (options.withDefaults ? 'HH:mm:ss' : undefined);
|
|
123
|
+
const showTime = isDateOnlyCollectionField(targetCollectionField) ? false : mergedProps.showTime;
|
|
124
|
+
const finalDateFormat = dateFormat || 'YYYY-MM-DD';
|
|
125
|
+
const finalTimeFormat = timeFormat || 'HH:mm:ss';
|
|
126
|
+
|
|
127
|
+
return stripUndefined({
|
|
128
|
+
...mergedProps,
|
|
129
|
+
picker,
|
|
130
|
+
dateFormat,
|
|
131
|
+
timeFormat,
|
|
132
|
+
showTime,
|
|
133
|
+
format: showTime ? `${finalDateFormat} ${finalTimeFormat}` : finalDateFormat,
|
|
134
|
+
});
|
|
135
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
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 type { FlowContext } from '@nocobase/flow-engine';
|
|
11
|
+
import { namePathToPathKey, parsePathString, pathKeyToNamePath } from '../models/blocks/form/value-runtime/path';
|
|
12
|
+
|
|
13
|
+
export type NamePath = Array<string | number>;
|
|
14
|
+
|
|
15
|
+
export type FieldIndexEntry = {
|
|
16
|
+
name: string;
|
|
17
|
+
index: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function isSameNamePath(a: NamePath, b: NamePath) {
|
|
21
|
+
return a.length === b.length && a.every((seg, index) => seg === b[index]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function isNamePathPrefix(prefix: NamePath, path: NamePath) {
|
|
25
|
+
if (prefix.length > path.length) return false;
|
|
26
|
+
return prefix.every((seg, index) => seg === path[index]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function dedupeNamePaths(paths: NamePath[]) {
|
|
30
|
+
const byKey = new Map<string, NamePath>();
|
|
31
|
+
for (const path of paths) {
|
|
32
|
+
if (!path?.length) continue;
|
|
33
|
+
byKey.set(namePathToPathKey(path), path);
|
|
34
|
+
}
|
|
35
|
+
return Array.from(byKey.values());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function minimizeNamePaths(paths: NamePath[]) {
|
|
39
|
+
const deduped = dedupeNamePaths(paths);
|
|
40
|
+
return deduped.filter((path, index) => {
|
|
41
|
+
return !deduped.some((other, otherIndex) => otherIndex !== index && isNamePathPrefix(path, other));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function parseFieldIndexEntries(fieldIndex: unknown): FieldIndexEntry[] {
|
|
46
|
+
const arr = Array.isArray(fieldIndex) ? fieldIndex : [];
|
|
47
|
+
const entries: FieldIndexEntry[] = [];
|
|
48
|
+
for (const item of arr) {
|
|
49
|
+
if (typeof item !== 'string') continue;
|
|
50
|
+
const [name, indexStr] = item.split(':');
|
|
51
|
+
const index = Number(indexStr);
|
|
52
|
+
if (!name || Number.isNaN(index)) continue;
|
|
53
|
+
entries.push({ name, index });
|
|
54
|
+
}
|
|
55
|
+
return entries;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function getFieldIndexEntriesFromContext(ctx: FlowContext | { model?: unknown; fieldIndex?: unknown }) {
|
|
59
|
+
const model = ctx?.model as { context?: { fieldIndex?: unknown } } | undefined;
|
|
60
|
+
return parseFieldIndexEntries(model?.context?.fieldIndex ?? (ctx as { fieldIndex?: unknown })?.fieldIndex);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function buildItemRowPath(entries: FieldIndexEntry[], parentDepth: number): NamePath | null {
|
|
64
|
+
const targetIndex = entries.length - 1 - parentDepth;
|
|
65
|
+
if (targetIndex < 0) return null;
|
|
66
|
+
|
|
67
|
+
const out: NamePath = [];
|
|
68
|
+
for (let index = 0; index <= targetIndex; index++) {
|
|
69
|
+
out.push(entries[index].name, entries[index].index);
|
|
70
|
+
}
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function buildItemListRootPath(entries: FieldIndexEntry[], parentDepth: number): NamePath | null {
|
|
75
|
+
const rowPath = buildItemRowPath(entries, parentDepth);
|
|
76
|
+
if (!rowPath?.length) return null;
|
|
77
|
+
return rowPath.slice(0, -1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function parseDependencyPath(subPath: string): NamePath {
|
|
81
|
+
return parsePathString(subPath).filter((seg) => typeof seg !== 'object') as NamePath;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function parsePathKey(pathKey: string): NamePath {
|
|
85
|
+
return pathKeyToNamePath(pathKey) as NamePath;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function getChangedPathsFromPayload(
|
|
89
|
+
payload: unknown,
|
|
90
|
+
options: { includeArrayChangedValues?: boolean } = {},
|
|
91
|
+
): NamePath[] {
|
|
92
|
+
const payloadObj = payload as
|
|
93
|
+
| {
|
|
94
|
+
changedPaths?: unknown;
|
|
95
|
+
changedValues?: unknown;
|
|
96
|
+
}
|
|
97
|
+
| undefined;
|
|
98
|
+
const rawChangedPaths = Array.isArray(payloadObj?.changedPaths) ? payloadObj.changedPaths : [];
|
|
99
|
+
const out: NamePath[] = [];
|
|
100
|
+
|
|
101
|
+
for (const path of rawChangedPaths) {
|
|
102
|
+
if (Array.isArray(path)) {
|
|
103
|
+
if (path.length === 1 && typeof path[0] === 'string') {
|
|
104
|
+
const namePath = pathKeyToNamePath(path[0]);
|
|
105
|
+
if (namePath.length) out.push(namePath as NamePath);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const segs = path.filter((seg) => typeof seg === 'string' || typeof seg === 'number') as NamePath;
|
|
109
|
+
if (segs.length) out.push(segs);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (typeof path === 'string' && path) {
|
|
113
|
+
out.push(pathKeyToNamePath(path) as NamePath);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (out.length) {
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const changedValues = payloadObj?.changedValues;
|
|
122
|
+
const canReadChangedValues =
|
|
123
|
+
changedValues &&
|
|
124
|
+
typeof changedValues === 'object' &&
|
|
125
|
+
(options.includeArrayChangedValues || !Array.isArray(changedValues));
|
|
126
|
+
if (canReadChangedValues) {
|
|
127
|
+
for (const key of Object.keys(changedValues)) {
|
|
128
|
+
const namePath = pathKeyToNamePath(key);
|
|
129
|
+
if (namePath.length) out.push(namePath as NamePath);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function isFormValueChangeSource(model: unknown) {
|
|
137
|
+
const candidate = model as
|
|
138
|
+
| {
|
|
139
|
+
emitter?: { on?: unknown; off?: unknown };
|
|
140
|
+
formValueRuntime?: unknown;
|
|
141
|
+
context?: { form?: unknown; setFormValues?: unknown };
|
|
142
|
+
}
|
|
143
|
+
| undefined;
|
|
144
|
+
if (!candidate || typeof candidate !== 'object') return false;
|
|
145
|
+
if (!candidate.emitter || typeof candidate.emitter.on !== 'function' || typeof candidate.emitter.off !== 'function') {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
return (
|
|
149
|
+
!!candidate.formValueRuntime || !!candidate.context?.form || typeof candidate.context?.setFormValues === 'function'
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function findFormValueChangeSource(ctx: FlowContext): unknown | null {
|
|
154
|
+
const candidates: unknown[] = [];
|
|
155
|
+
const push = (model: unknown) => {
|
|
156
|
+
if (model && !candidates.includes(model)) candidates.push(model);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const model = ctx.model as { context?: { blockModel?: unknown }; parent?: unknown } | undefined;
|
|
160
|
+
push(model?.context?.blockModel);
|
|
161
|
+
push(ctx.model);
|
|
162
|
+
|
|
163
|
+
let cursor = model?.parent as { parent?: unknown } | undefined;
|
|
164
|
+
while (cursor) {
|
|
165
|
+
push(cursor);
|
|
166
|
+
cursor = cursor?.parent as { parent?: unknown } | undefined;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return candidates.find(isFormValueChangeSource) || null;
|
|
170
|
+
}
|