@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
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { describe, it, expect, vi } from 'vitest';
|
|
12
|
+
import { RUNJS_OPEN_VIEW_ROUTE_STATE } from '@nocobase/flow-engine';
|
|
12
13
|
import { openView } from '../openView';
|
|
13
14
|
import { FlowPage } from '../../FlowPage';
|
|
15
|
+
import { ROUTE_TRANSIENT_INPUT_ARGS_KEY } from '../../routeTransientInputArgs';
|
|
14
16
|
|
|
15
17
|
describe('openView action - route mode defineProperties/defineMethods', () => {
|
|
16
18
|
const createRouteManagedCtx = () => {
|
|
@@ -50,6 +52,27 @@ describe('openView action - route mode defineProperties/defineMethods', () => {
|
|
|
50
52
|
return { ctx, engine };
|
|
51
53
|
};
|
|
52
54
|
|
|
55
|
+
const createFirstStageCtx = (inputArgs: Record<PropertyKey, unknown>) => {
|
|
56
|
+
const navigateTo = vi.fn();
|
|
57
|
+
const ctx: any = {
|
|
58
|
+
inputArgs,
|
|
59
|
+
engine: { context: { themeToken: { colorBgLayout: '#fff' } } },
|
|
60
|
+
model: {
|
|
61
|
+
uid: 'popup-uid',
|
|
62
|
+
context: {
|
|
63
|
+
inputArgs: {},
|
|
64
|
+
defineProperty: vi.fn(),
|
|
65
|
+
},
|
|
66
|
+
flowEngine: { context: { themeToken: { colorBgLayout: '#fff' } } },
|
|
67
|
+
},
|
|
68
|
+
view: {
|
|
69
|
+
navigation: { navigateTo },
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return { ctx, navigateTo };
|
|
74
|
+
};
|
|
75
|
+
|
|
53
76
|
it('injects defineProperties/defineMethods on onModelLoaded even when not present in current inputArgs', async () => {
|
|
54
77
|
const { ctx } = createRouteManagedCtx();
|
|
55
78
|
|
|
@@ -149,4 +172,145 @@ describe('openView action - route mode defineProperties/defineMethods', () => {
|
|
|
149
172
|
const defineMethodCalls = pageModelContext.defineMethod.mock.calls.map((c: any[]) => c[0]);
|
|
150
173
|
expect(defineMethodCalls).toContain('pong');
|
|
151
174
|
});
|
|
175
|
+
|
|
176
|
+
it('passes formData through route navigation state', async () => {
|
|
177
|
+
const navigateTo = vi.fn();
|
|
178
|
+
const ctx: any = {
|
|
179
|
+
inputArgs: {
|
|
180
|
+
formData: {
|
|
181
|
+
start: '2026-06-24 08:00:00',
|
|
182
|
+
end: '2026-06-24 09:00:00',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
engine: {
|
|
186
|
+
context: {},
|
|
187
|
+
},
|
|
188
|
+
model: {
|
|
189
|
+
uid: 'popup-uid',
|
|
190
|
+
context: {
|
|
191
|
+
defineProperty: vi.fn(),
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
view: {
|
|
195
|
+
navigation: {
|
|
196
|
+
navigateTo,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
isNavigationEnabled: true,
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
await openView.handler(ctx, { navigation: true });
|
|
203
|
+
|
|
204
|
+
expect(navigateTo).toHaveBeenCalledWith(
|
|
205
|
+
{
|
|
206
|
+
viewUid: 'popup-uid',
|
|
207
|
+
filterByTk: undefined,
|
|
208
|
+
sourceId: undefined,
|
|
209
|
+
tabUid: undefined,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
state: {
|
|
213
|
+
[ROUTE_TRANSIENT_INPUT_ARGS_KEY]: {
|
|
214
|
+
'popup-uid': {
|
|
215
|
+
formData: {
|
|
216
|
+
start: '2026-06-24 08:00:00',
|
|
217
|
+
end: '2026-06-24 09:00:00',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it('adds route state to first-stage navigation only for RunJS ctx.openView calls', async () => {
|
|
227
|
+
const { ctx, navigateTo } = createFirstStageCtx({
|
|
228
|
+
mode: 'dialog',
|
|
229
|
+
size: 'large',
|
|
230
|
+
[RUNJS_OPEN_VIEW_ROUTE_STATE]: { mode: 'dialog', size: 'large' },
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
await openView.handler(ctx, { mode: 'drawer', size: 'medium', navigation: true });
|
|
234
|
+
|
|
235
|
+
expect(navigateTo).toHaveBeenCalledWith(
|
|
236
|
+
{
|
|
237
|
+
viewUid: 'popup-uid',
|
|
238
|
+
filterByTk: undefined,
|
|
239
|
+
sourceId: undefined,
|
|
240
|
+
tabUid: undefined,
|
|
241
|
+
openViewRouteState: { mode: 'dialog', size: 'large' },
|
|
242
|
+
},
|
|
243
|
+
undefined,
|
|
244
|
+
);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('normalizes first-stage RunJS route state mode on mobile layout', async () => {
|
|
248
|
+
const { ctx, navigateTo } = createFirstStageCtx({
|
|
249
|
+
isMobileLayout: true,
|
|
250
|
+
mode: 'dialog',
|
|
251
|
+
size: 'large',
|
|
252
|
+
[RUNJS_OPEN_VIEW_ROUTE_STATE]: { mode: 'dialog', size: 'large' },
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
await openView.handler(ctx, { mode: 'drawer', size: 'medium', navigation: true });
|
|
256
|
+
|
|
257
|
+
expect(navigateTo).toHaveBeenCalledWith(
|
|
258
|
+
{
|
|
259
|
+
viewUid: 'popup-uid',
|
|
260
|
+
filterByTk: undefined,
|
|
261
|
+
sourceId: undefined,
|
|
262
|
+
tabUid: undefined,
|
|
263
|
+
openViewRouteState: { mode: 'embed', size: 'large' },
|
|
264
|
+
},
|
|
265
|
+
undefined,
|
|
266
|
+
);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it('uses route replay mode and size before persisted openView defaults', async () => {
|
|
270
|
+
const { ctx } = createRouteManagedCtx();
|
|
271
|
+
ctx.inputArgs.mode = 'dialog';
|
|
272
|
+
ctx.inputArgs.size = 'large';
|
|
273
|
+
|
|
274
|
+
await openView.handler(ctx, { mode: 'drawer', size: 'medium', navigation: true });
|
|
275
|
+
|
|
276
|
+
expect(ctx.viewer.open).toHaveBeenCalledWith(
|
|
277
|
+
expect.objectContaining({
|
|
278
|
+
type: 'dialog',
|
|
279
|
+
width: '80%',
|
|
280
|
+
}),
|
|
281
|
+
);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it('uses decoded openView route state during route replay', async () => {
|
|
285
|
+
const { ctx } = createRouteManagedCtx();
|
|
286
|
+
ctx.inputArgs.openViewRouteState = { mode: 'dialog', size: 'large' };
|
|
287
|
+
|
|
288
|
+
await openView.handler(ctx, { mode: 'drawer', size: 'medium', navigation: true });
|
|
289
|
+
|
|
290
|
+
expect(ctx.viewer.open).toHaveBeenCalledWith(
|
|
291
|
+
expect.objectContaining({
|
|
292
|
+
type: 'dialog',
|
|
293
|
+
width: '80%',
|
|
294
|
+
}),
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('keeps first-stage navigation unchanged for non-RunJS openView calls', async () => {
|
|
299
|
+
const { ctx, navigateTo } = createFirstStageCtx({
|
|
300
|
+
mode: 'dialog',
|
|
301
|
+
size: 'large',
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
await openView.handler(ctx, { mode: 'drawer', size: 'medium', navigation: true });
|
|
305
|
+
|
|
306
|
+
expect(navigateTo).toHaveBeenCalledWith(
|
|
307
|
+
{
|
|
308
|
+
viewUid: 'popup-uid',
|
|
309
|
+
filterByTk: undefined,
|
|
310
|
+
sourceId: undefined,
|
|
311
|
+
tabUid: undefined,
|
|
312
|
+
},
|
|
313
|
+
undefined,
|
|
314
|
+
);
|
|
315
|
+
});
|
|
152
316
|
});
|
|
@@ -13,7 +13,7 @@ import { subFormFieldLinkageRules } from '../linkageRules';
|
|
|
13
13
|
import { SubFormFieldModel, SubFormListFieldModel } from '../../models/fields/AssociationFieldModel/SubFormFieldModel';
|
|
14
14
|
|
|
15
15
|
describe('subFormFieldLinkageRules action', () => {
|
|
16
|
-
it('passes inputArgs to fork runtime context', async () => {
|
|
16
|
+
it('passes inputArgs to fork runtime context when grid forks are stored in a Set', async () => {
|
|
17
17
|
const linkageAssignHandler = vi.fn();
|
|
18
18
|
const engine = new FlowEngine();
|
|
19
19
|
const forkModel = new FlowModel({ uid: 'fork-model', flowEngine: engine }) as any;
|
|
@@ -38,7 +38,7 @@ describe('subFormFieldLinkageRules action', () => {
|
|
|
38
38
|
hidden: false,
|
|
39
39
|
subModels: {
|
|
40
40
|
grid: {
|
|
41
|
-
forks: [forkModel],
|
|
41
|
+
forks: new Set([forkModel]),
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
},
|
|
@@ -7,13 +7,152 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
FlowContext,
|
|
12
|
+
createRecordMetaFactory,
|
|
13
|
+
createRecordResolveOnServerWithLocal,
|
|
14
|
+
defineAction,
|
|
15
|
+
tExpr,
|
|
16
|
+
useFlowSettingsContext,
|
|
17
|
+
type Collection,
|
|
18
|
+
type FlowRuntimeContext,
|
|
19
|
+
type MetaTreeNode,
|
|
20
|
+
type PropertyMetaFactory,
|
|
21
|
+
} from '@nocobase/flow-engine';
|
|
11
22
|
import { isURL } from '@nocobase/utils/client';
|
|
12
|
-
import {
|
|
23
|
+
import React, { useMemo } from 'react';
|
|
24
|
+
import {
|
|
25
|
+
TextAreaWithContextSelector,
|
|
26
|
+
type TextAreaWithContextSelectorProps,
|
|
27
|
+
} from '../components/TextAreaWithContextSelector';
|
|
28
|
+
|
|
29
|
+
type ResponseRecordPlainStepContext = {
|
|
30
|
+
steps?: FlowRuntimeContext['steps'];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type ResponseRecordFlowDefinitionContext = {
|
|
34
|
+
flowKey?: string;
|
|
35
|
+
model?: {
|
|
36
|
+
getFlow?: (flowKey: string) => { steps?: Record<string, unknown> } | undefined;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type ResponseRecordContext = FlowContext &
|
|
41
|
+
ResponseRecordPlainStepContext & {
|
|
42
|
+
blockModel?: { collection?: Collection };
|
|
43
|
+
collection?: Collection;
|
|
44
|
+
model?: FlowRuntimeContext['model'] & { collection?: Collection };
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function getResponseRecordSteps(ctx: FlowContext | ResponseRecordPlainStepContext): FlowRuntimeContext['steps'] {
|
|
48
|
+
return 'steps' in ctx ? ctx.steps || {} : {};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getAfterSuccessResponseRecord(ctx: FlowContext | ResponseRecordPlainStepContext) {
|
|
52
|
+
const steps = getResponseRecordSteps(ctx);
|
|
53
|
+
const preferredStepKeys = ['saveResource', 'submit', 'request', 'apply', 'save'];
|
|
54
|
+
|
|
55
|
+
for (const stepKey of preferredStepKeys) {
|
|
56
|
+
if (Object.prototype.hasOwnProperty.call(steps, stepKey) && steps[stepKey]?.result != null) {
|
|
57
|
+
return steps[stepKey].result;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const results = Object.entries(steps)
|
|
62
|
+
.filter(([stepKey, step]) => stepKey !== 'afterSuccess' && step?.result != null)
|
|
63
|
+
.map(([, step]) => step.result);
|
|
64
|
+
return results[results.length - 1];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getResponseRecordMeta(ctx: ResponseRecordContext): PropertyMetaFactory | undefined {
|
|
68
|
+
if (!hasResponseRecordSource(ctx)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const collectionAccessor = getResponseRecordCollectionAccessor(ctx);
|
|
72
|
+
if (!collectionAccessor()) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
return createRecordMetaFactory(collectionAccessor, ctx.t('Response record'), () => {
|
|
76
|
+
const collection = collectionAccessor();
|
|
77
|
+
const record = getAfterSuccessResponseRecord(ctx);
|
|
78
|
+
if (!collection || !record) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const filterByTk = collection.getFilterByTK(record);
|
|
83
|
+
if (filterByTk == null) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
collection: collection.name,
|
|
88
|
+
dataSourceKey: collection.dataSourceKey || 'main',
|
|
89
|
+
filterByTk,
|
|
90
|
+
};
|
|
91
|
+
} catch (error) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function hasResponseRecordSource(ctx: FlowContext | ResponseRecordPlainStepContext) {
|
|
98
|
+
if (Object.prototype.hasOwnProperty.call(getResponseRecordSteps(ctx), 'saveResource')) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const { model, flowKey } = ctx as ResponseRecordFlowDefinitionContext;
|
|
103
|
+
if (!model || typeof model.getFlow !== 'function' || !flowKey) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return Object.prototype.hasOwnProperty.call(model.getFlow(flowKey)?.steps || {}, 'saveResource');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function getResponseRecordCollectionAccessor(ctx: ResponseRecordContext) {
|
|
111
|
+
return () => ctx.blockModel?.collection || ctx.collection || ctx.model?.collection || null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function getMetaTreeWithResponseRecord(ctx: FlowRuntimeContext): MetaTreeNode[] {
|
|
115
|
+
const responseRecordMeta = getResponseRecordMeta(ctx);
|
|
116
|
+
if (!responseRecordMeta) {
|
|
117
|
+
return ctx.getPropertyMetaTree?.() || [];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const scoped = new FlowContext();
|
|
121
|
+
scoped.addDelegate(ctx);
|
|
122
|
+
scoped.defineProperty('responseRecord', {
|
|
123
|
+
get: () => getAfterSuccessResponseRecord(ctx),
|
|
124
|
+
cache: false,
|
|
125
|
+
resolveOnServer: createRecordResolveOnServerWithLocal(getResponseRecordCollectionAccessor(ctx), () =>
|
|
126
|
+
getAfterSuccessResponseRecord(ctx),
|
|
127
|
+
),
|
|
128
|
+
meta: responseRecordMeta,
|
|
129
|
+
});
|
|
130
|
+
return scoped.getPropertyMetaTree();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function AfterSuccessRedirectTextArea(props: TextAreaWithContextSelectorProps) {
|
|
134
|
+
const flowCtx = useFlowSettingsContext();
|
|
135
|
+
const metaTree = useMemo(() => () => getMetaTreeWithResponseRecord(flowCtx), [flowCtx]);
|
|
136
|
+
|
|
137
|
+
return <TextAreaWithContextSelector {...props} metaTree={metaTree} />;
|
|
138
|
+
}
|
|
13
139
|
|
|
14
140
|
export const afterSuccess = defineAction({
|
|
15
141
|
name: 'afterSuccess',
|
|
16
142
|
title: tExpr('After successful submission'),
|
|
143
|
+
defineProperties(ctx) {
|
|
144
|
+
const responseRecordMeta = getResponseRecordMeta(ctx);
|
|
145
|
+
return {
|
|
146
|
+
responseRecord: {
|
|
147
|
+
get: () => getAfterSuccessResponseRecord(ctx),
|
|
148
|
+
cache: false,
|
|
149
|
+
resolveOnServer: createRecordResolveOnServerWithLocal(getResponseRecordCollectionAccessor(ctx), () =>
|
|
150
|
+
getAfterSuccessResponseRecord(ctx),
|
|
151
|
+
),
|
|
152
|
+
...(responseRecordMeta ? { meta: responseRecordMeta } : {}),
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
},
|
|
17
156
|
uiSchema: {
|
|
18
157
|
successMessage: {
|
|
19
158
|
type: 'string',
|
|
@@ -46,7 +185,7 @@ export const afterSuccess = defineAction({
|
|
|
46
185
|
type: 'string',
|
|
47
186
|
title: tExpr('Link'),
|
|
48
187
|
'x-decorator': 'FormItem',
|
|
49
|
-
'x-component':
|
|
188
|
+
'x-component': AfterSuccessRedirectTextArea,
|
|
50
189
|
'x-reactions': {
|
|
51
190
|
dependencies: ['actionAfterSuccess'],
|
|
52
191
|
fulfill: {
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
defineAction,
|
|
13
13
|
isRunJSValue,
|
|
14
14
|
normalizeRunJSValue,
|
|
15
|
-
runjsWithSafeGlobals,
|
|
16
15
|
tExpr,
|
|
17
16
|
type RunJSValue,
|
|
18
17
|
useFlowContext,
|
|
@@ -43,7 +42,7 @@ export const customVariable = defineAction({
|
|
|
43
42
|
if (variable.type === 'runjs') {
|
|
44
43
|
const getFunction = async () => {
|
|
45
44
|
const { code, version } = normalizeRunJSValue(variable.runjs);
|
|
46
|
-
return
|
|
45
|
+
return ctx.runjs(code, undefined, { version });
|
|
47
46
|
};
|
|
48
47
|
const metaFunction = () => ({
|
|
49
48
|
title: variable.title,
|
|
@@ -7,11 +7,17 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { isVariableExpression, pruneFilter } from '@nocobase/flow-engine';
|
|
10
|
+
import { extractPropertyPath, isVariableExpression, pruneFilter } from '@nocobase/flow-engine';
|
|
11
11
|
import { transformFilter } from '@nocobase/utils/client';
|
|
12
12
|
import _ from 'lodash';
|
|
13
13
|
|
|
14
14
|
const PRESERVE_NULL = { __nocobaseDataScopeNull__: true };
|
|
15
|
+
const SERVER_CURRENT_ROLE_VARIABLE = '{{$nRole}}';
|
|
16
|
+
const CURRENT_ROLE_EXPRESSION_RE = /^\s*\{\{\s*ctx\.role\s*\}\}\s*$/;
|
|
17
|
+
|
|
18
|
+
function isCurrentRoleExpression(value: unknown) {
|
|
19
|
+
return typeof value === 'string' && CURRENT_ROLE_EXPRESSION_RE.test(value);
|
|
20
|
+
}
|
|
15
21
|
|
|
16
22
|
function isPreserveNull(value: any) {
|
|
17
23
|
return (
|
|
@@ -39,14 +45,27 @@ function restorePreservedNull(value: any): any {
|
|
|
39
45
|
return value;
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
function isUrlSearchParamsExpression(value: any) {
|
|
49
|
+
if (!isVariableExpression(value)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return extractPropertyPath(value)?.[0] === 'urlSearchParams';
|
|
54
|
+
}
|
|
55
|
+
|
|
42
56
|
function markEmptyVariableValues(rawNode: any, resolvedNode: any) {
|
|
43
57
|
if (!rawNode || !resolvedNode || typeof rawNode !== 'object' || typeof resolvedNode !== 'object') {
|
|
44
58
|
return;
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
if ('path' in rawNode && 'operator' in rawNode) {
|
|
62
|
+
if (isCurrentRoleExpression(rawNode.value)) {
|
|
63
|
+
resolvedNode.value = SERVER_CURRENT_ROLE_VARIABLE;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
48
66
|
if (
|
|
49
67
|
isVariableExpression(rawNode.value) &&
|
|
68
|
+
!isUrlSearchParamsExpression(rawNode.value) &&
|
|
50
69
|
(resolvedNode.value === undefined || resolvedNode.value === null || resolvedNode.value === '')
|
|
51
70
|
) {
|
|
52
71
|
resolvedNode.value = PRESERVE_NULL;
|
|
@@ -11,13 +11,36 @@ import { css } from '@emotion/css';
|
|
|
11
11
|
import { defineAction, tExpr } from '@nocobase/flow-engine';
|
|
12
12
|
import { getPickerFormat } from '@nocobase/utils/client';
|
|
13
13
|
import { DateFormatCom, ExpiresRadio } from '../components';
|
|
14
|
+
import {
|
|
15
|
+
getDateTimeFormatCollectionField,
|
|
16
|
+
isDateOnlyCollectionField,
|
|
17
|
+
isTimeCollectionField,
|
|
18
|
+
resolveDateTimeDisplayProps,
|
|
19
|
+
} from '../utils/dateTimeDisplayProps';
|
|
20
|
+
|
|
21
|
+
const isTableColumnFieldSubModel = (model) => {
|
|
22
|
+
const parent = model?.parent;
|
|
23
|
+
return (
|
|
24
|
+
parent?.subModels?.field === model &&
|
|
25
|
+
(parent?.use === 'TableColumnModel' || parent?.constructor?.name === 'TableColumnModel')
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const syncTableColumnDateTimeFormatProps = (ctx, props) => {
|
|
30
|
+
const model = ctx.model;
|
|
31
|
+
if (!isTableColumnFieldSubModel(model)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
model.parent?.setProps?.(props);
|
|
36
|
+
};
|
|
14
37
|
|
|
15
38
|
export const dateTimeFormat = defineAction({
|
|
16
39
|
title: tExpr('Date display format'),
|
|
17
40
|
name: 'dateDisplayFormat',
|
|
18
41
|
uiSchema: (ctx) => {
|
|
19
|
-
const
|
|
20
|
-
const isTimeField = collectionField
|
|
42
|
+
const collectionField = getDateTimeFormatCollectionField({ model: ctx.model });
|
|
43
|
+
const isTimeField = isTimeCollectionField(collectionField);
|
|
21
44
|
const timeFormatField = {
|
|
22
45
|
type: 'string',
|
|
23
46
|
title: '{{t("Time format")}}',
|
|
@@ -43,7 +66,7 @@ export const dateTimeFormat = defineAction({
|
|
|
43
66
|
(field) => {
|
|
44
67
|
if (!isTimeField) {
|
|
45
68
|
const { showTime, picker } = field.form.values || {};
|
|
46
|
-
field.hidden = !showTime || picker !== 'date';
|
|
69
|
+
field.hidden = isDateOnlyCollectionField(collectionField) || !showTime || picker !== 'date';
|
|
47
70
|
}
|
|
48
71
|
},
|
|
49
72
|
],
|
|
@@ -146,10 +169,11 @@ export const dateTimeFormat = defineAction({
|
|
|
146
169
|
},
|
|
147
170
|
},
|
|
148
171
|
(field) => {
|
|
149
|
-
const
|
|
172
|
+
const collectionField = getDateTimeFormatCollectionField({ model: ctx.model });
|
|
150
173
|
const { picker } = field.form.values || {};
|
|
151
|
-
|
|
152
|
-
|
|
174
|
+
const isDateOnlyField = isDateOnlyCollectionField(collectionField);
|
|
175
|
+
field.hidden = isDateOnlyField || picker !== 'date';
|
|
176
|
+
if (isDateOnlyField || picker !== 'date') {
|
|
153
177
|
field.value = false;
|
|
154
178
|
}
|
|
155
179
|
},
|
|
@@ -159,34 +183,24 @@ export const dateTimeFormat = defineAction({
|
|
|
159
183
|
};
|
|
160
184
|
},
|
|
161
185
|
defaultParams: (ctx: any) => {
|
|
162
|
-
const { showTime, dateFormat,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
};
|
|
166
|
-
const collectionField = ctx.model.context.collectionField;
|
|
167
|
-
const isTimeField = collectionField.type === 'time' || collectionField.interface === 'time';
|
|
186
|
+
const { showTime, dateFormat, timeFormat, picker } = resolveDateTimeDisplayProps({
|
|
187
|
+
model: ctx.model,
|
|
188
|
+
withDefaults: true,
|
|
189
|
+
});
|
|
168
190
|
return {
|
|
169
191
|
picker: picker || 'date',
|
|
170
192
|
dateFormat: dateFormat || 'YYYY-MM-DD',
|
|
171
|
-
timeFormat: timeFormat ||
|
|
193
|
+
timeFormat: timeFormat || 'HH:mm:ss',
|
|
172
194
|
showTime,
|
|
173
195
|
};
|
|
174
196
|
},
|
|
197
|
+
async beforeParamsSave(ctx: any, params) {
|
|
198
|
+
const props = resolveDateTimeDisplayProps({ model: ctx.model, params });
|
|
199
|
+
ctx.model.setProps(props);
|
|
200
|
+
syncTableColumnDateTimeFormatProps(ctx, props);
|
|
201
|
+
await ctx.model.save?.();
|
|
202
|
+
},
|
|
175
203
|
handler(ctx: any, params) {
|
|
176
|
-
|
|
177
|
-
const isTimeField = collectionField.type === 'time' || collectionField.interface === 'time';
|
|
178
|
-
if (isTimeField) {
|
|
179
|
-
const timeFormat = params?.timeFormat || params?.format || 'HH:mm:ss';
|
|
180
|
-
ctx.model.setProps({
|
|
181
|
-
...params,
|
|
182
|
-
timeFormat,
|
|
183
|
-
format: timeFormat,
|
|
184
|
-
});
|
|
185
|
-
} else {
|
|
186
|
-
ctx.model.setProps({
|
|
187
|
-
...params,
|
|
188
|
-
format: params?.showTime ? `${params.dateFormat} ${params.timeFormat}` : params.dateFormat,
|
|
189
|
-
});
|
|
190
|
-
}
|
|
204
|
+
ctx.model.setProps(resolveDateTimeDisplayProps({ model: ctx.model, params }));
|
|
191
205
|
},
|
|
192
206
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export { afterSuccess } from './afterSuccess';
|
|
11
11
|
export * from './confirm';
|
|
12
12
|
export * from './dataScope';
|
|
13
13
|
export * from './openView';
|
|
@@ -43,10 +43,12 @@ export {
|
|
|
43
43
|
linkageSetDetailsFieldProps,
|
|
44
44
|
actionLinkageRules,
|
|
45
45
|
menuLinkageRules,
|
|
46
|
+
tabLinkageRules,
|
|
46
47
|
blockLinkageRules,
|
|
47
48
|
linkageSetBlockProps,
|
|
48
49
|
linkageSetActionProps,
|
|
49
50
|
linkageSetMenuItemProps,
|
|
51
|
+
linkageSetTabProps,
|
|
50
52
|
linkageSetFieldProps,
|
|
51
53
|
subFormLinkageSetFieldProps,
|
|
52
54
|
linkageAssignField,
|