@gct-paas/core 0.1.4-dev.0 → 0.1.4-dev.10
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/dist/index.esm.min.mjs +8101 -0
- package/dist/index.min.cjs +386 -1
- package/dist/index.system.min.js +386 -1
- package/es/constants/core.mjs +0 -1
- package/es/constants/editor-register/editor-register.mjs +0 -1
- package/es/constants/editor-type/editor-type.d.ts +65 -1
- package/es/constants/editor-type/editor-type.mjs +14 -1
- package/es/constants/expression-type/BuiltOperators.d.ts +20 -0
- package/es/constants/expression-type/BuiltOperators.mjs +149 -0
- package/es/constants/expression-type/FunctionKeys.d.ts +1 -0
- package/es/constants/expression-type/FunctionKeys.mjs +81 -0
- package/es/constants/expression-type/editor.d.ts +8 -0
- package/es/constants/expression-type/editor.mjs +4 -0
- package/es/constants/expression-type/function.d.ts +7 -0
- package/es/constants/expression-type/function.mjs +875 -0
- package/es/constants/expression-type/index.d.ts +42 -0
- package/es/constants/expression-type/index.mjs +120 -0
- package/es/constants/expression-type/modeCfg.d.ts +30 -0
- package/es/constants/expression-type/modeCfg.mjs +268 -0
- package/es/constants/expression-type/variable.d.ts +12 -0
- package/es/constants/expression-type/variable.mjs +42 -0
- package/es/constants/form-container-type/form-container-type.mjs +0 -1
- package/es/constants/index.d.ts +9 -0
- package/es/constants/index.mjs +7 -6
- package/es/controller/edit-form/edit-form.controller.mjs +0 -1
- package/es/controller/editor/color-editor.controller.mjs +0 -1
- package/es/controller/editor/length-unit-editor.controller.mjs +0 -1
- package/es/controller/editor-item/editor-item.controller.mjs +0 -1
- package/es/controller/form/form.controller.mjs +5 -5
- package/es/controller/form-collapse/form-collapse.controller.mjs +4 -3
- package/es/controller/form-collapse-pane/form-collapse-pane.controller.mjs +4 -3
- package/es/controller/form-edit-item/form-edit-item.controller.d.ts +1 -0
- package/es/controller/form-edit-item/form-edit-item.controller.mjs +6 -2
- package/es/controller/form-group/form-group.controller.mjs +4 -3
- package/es/controller/form-item/form-item.controller.d.ts +1 -0
- package/es/controller/form-item/form-item.controller.mjs +7 -3
- package/es/controller/form-item-basic/form-item-basic.controller.mjs +3 -2
- package/es/controller/form-item-hidden/form-item-hidden.controller.mjs +0 -1
- package/es/controller/form-tab/form-tab.controller.mjs +4 -3
- package/es/controller/form-tab-pane/form-tab-pane.controller.mjs +4 -3
- package/es/controller/gct-form/gct-form.controller.mjs +5 -5
- package/es/create-app-vue.d.ts +8 -0
- package/es/create-app-vue.mjs +12 -0
- package/es/enums/app-designer/index.d.ts +13 -1
- package/es/enums/app-designer/index.mjs +8 -2
- package/es/enums/appEnum.d.ts +22 -66
- package/es/enums/appEnum.mjs +24 -15
- package/es/enums/appStateEnum.mjs +0 -1
- package/es/enums/authActionEnum.mjs +0 -1
- package/es/enums/breakpointEnum.mjs +0 -1
- package/es/enums/cacheEnum.mjs +0 -1
- package/es/enums/designEnum.d.ts +9 -3
- package/es/enums/designEnum.mjs +34 -32
- package/es/enums/developer-center/index.d.ts +1 -0
- package/es/enums/developer-center/integration.d.ts +4 -0
- package/es/enums/developer-center/integration.mjs +7 -0
- package/es/enums/exceptionEnum.mjs +0 -1
- package/es/enums/expressionEnum.d.ts +130 -0
- package/es/enums/expressionEnum.mjs +75 -0
- package/es/enums/globalEnum.d.ts +38 -0
- package/es/enums/globalEnum.mjs +25 -0
- package/es/enums/httpEnum.mjs +0 -1
- package/es/enums/index.d.ts +19 -0
- package/es/enums/index.mjs +13 -20
- package/es/enums/menuEnum.mjs +0 -1
- package/es/enums/page-designer/designer.d.ts +23 -3
- package/es/enums/page-designer/designer.mjs +90 -6
- package/es/enums/page-designer/panel.d.ts +78 -7
- package/es/enums/page-designer/panel.mjs +22 -4
- package/es/enums/page-designer/toolkit.mjs +0 -1
- package/es/enums/page-designer/widget.d.ts +2 -1
- package/es/enums/page-designer/widget.mjs +3 -3
- package/es/enums/pageEnum.mjs +0 -1
- package/es/enums/plugin-enum.mjs +0 -1
- package/es/enums/processEnum.d.ts +54 -0
- package/es/enums/processEnum.mjs +36 -2
- package/es/enums/roleEnum.mjs +0 -1
- package/es/enums/sizeEnum.mjs +0 -1
- package/es/global/gct/gct.d.ts +39 -25
- package/es/global/gct/gct.mjs +49 -27
- package/es/hooks/index.d.ts +2 -1
- package/es/hooks/use-app-inst/use-app-inst.d.ts +8 -0
- package/es/hooks/use-app-inst/use-app-inst.mjs +8 -0
- package/es/hooks/use-form/use-form.mjs +0 -1
- package/es/hooks/use-gct-form-value/use-gct-form-value.d.ts +1 -1
- package/es/hooks/use-gct-form-value/use-gct-form-value.mjs +0 -4
- package/es/hooks/use-modal/use-modal.mjs +0 -1
- package/es/hooks/use-overlay-scrollbars/use-overlay-scrollbars.d.ts +11 -0
- package/es/hooks/use-sub-app-utils/use-sub-app-utils.d.ts +27 -0
- package/es/hooks/use-sub-app-utils/use-sub-app-utils.mjs +30 -0
- package/es/hooks/useCopyToClipboard.mjs +0 -1
- package/es/index.d.ts +7 -9
- package/es/index.mjs +94 -48
- package/es/interface/controller/form-edit-item/form-edit-item.controller.d.ts +5 -0
- package/es/interface/controller/index.d.ts +0 -1
- package/es/interface/form/i-editor/i-editor-basic.d.ts +2 -2
- package/es/interface/form/i-editor/i-model-field-select-editor.d.ts +18 -0
- package/es/interface/form/i-form/i-form-collapse-pane.d.ts +4 -0
- package/es/interface/form/i-form/i-form-item-basic.d.ts +1 -1
- package/es/interface/form/i-form/i-form-tab-pane.d.ts +4 -0
- package/es/interface/form/index.d.ts +1 -0
- package/es/interface/i-app-context/i-app-context.d.ts +34 -0
- package/es/interface/i-field-code-chain/i-field-code-chain.d.ts +17 -0
- package/es/interface/i-global-var/i-global-var.d.ts +15 -0
- package/es/interface/i-mobile-home-menu-item/i-mobile-home-menu-item.d.ts +94 -0
- package/es/interface/i-pinia-action/i-global-actions.d.ts +7 -4
- package/es/interface/i-pinia-getter/i-global-getters.d.ts +1 -5
- package/es/interface/i-pinia-state/i-global-state.d.ts +7 -2
- package/es/interface/index.d.ts +5 -6
- package/es/interface/open-util/i-message-util/i-message-util.d.ts +54 -0
- package/es/interface/{i-modal → open-util/i-modal}/i-modal.d.ts +9 -10
- package/es/interface/{i-modal-data → open-util/i-modal-data}/i-modal-data.d.ts +6 -0
- package/es/interface/open-util/i-modal-options/i-modal-options.d.ts +12 -0
- package/es/interface/open-util/i-open-window-options/i-open-window-options.d.ts +59 -0
- package/es/interface/open-util/i-overlay-container/i-overlay-container.d.ts +36 -0
- package/es/interface/open-util/i-overlay-controller/i-overlay-controller.d.ts +36 -0
- package/es/interface/open-util/index.d.ts +7 -0
- package/es/interface/state/index.d.ts +0 -1
- package/es/locale/index.d.ts +19 -0
- package/es/locale/index.mjs +60 -0
- package/es/modules/env-manager/env-manager.const.d.ts +14 -0
- package/es/modules/env-manager/env-manager.const.mjs +9 -0
- package/es/modules/env-manager/env-manager.d.ts +59 -0
- package/es/modules/env-manager/env-manager.interface.d.ts +43 -0
- package/es/modules/env-manager/env-manager.interface.mjs +8 -0
- package/es/modules/env-manager/env-manager.mjs +108 -0
- package/es/modules/env-manager/index.d.ts +3 -0
- package/es/modules/error-handler/error-handler.const.d.ts +48 -0
- package/es/modules/error-handler/error-handler.const.mjs +18 -0
- package/es/modules/error-handler/error-handler.interface.d.ts +51 -0
- package/es/modules/error-handler/error-strategy.d.ts +138 -0
- package/es/modules/error-handler/error-strategy.mjs +175 -0
- package/es/modules/error-handler/index.d.ts +78 -0
- package/es/modules/error-handler/index.mjs +108 -0
- package/es/modules/platform-config/constants/index.d.ts +7 -0
- package/es/modules/platform-config/constants/login.const.d.ts +15 -0
- package/es/modules/platform-config/constants/login.const.mjs +50 -0
- package/es/modules/platform-config/constants/org.const.d.ts +9 -0
- package/es/modules/platform-config/constants/org.const.mjs +54 -0
- package/es/modules/platform-config/constants/theme.const.d.ts +9 -0
- package/es/modules/platform-config/constants/theme.const.mjs +5 -0
- package/es/modules/platform-config/constants/watermark.const.d.ts +16 -0
- package/es/modules/platform-config/constants/watermark.const.mjs +14 -0
- package/es/modules/platform-config/enums/deploy.enum.d.ts +10 -0
- package/es/modules/platform-config/enums/deploy.enum.mjs +7 -0
- package/es/modules/platform-config/enums/index.d.ts +6 -0
- package/es/modules/platform-config/enums/login.enum.d.ts +25 -0
- package/es/modules/platform-config/enums/login.enum.mjs +16 -0
- package/es/modules/platform-config/enums/platform.enum.d.ts +27 -0
- package/es/modules/platform-config/enums/platform.enum.mjs +26 -0
- package/es/modules/platform-config/index.d.ts +8 -0
- package/es/modules/platform-config/interfaces/global-setting.interface.d.ts +7 -0
- package/es/modules/platform-config/interfaces/index.d.ts +7 -0
- package/es/modules/platform-config/interfaces/login-config.interface.d.ts +17 -0
- package/es/modules/platform-config/interfaces/platform-map.interface.d.ts +8 -0
- package/es/modules/platform-config/interfaces/theme-setting.interface.d.ts +30 -0
- package/es/modules/platform-config/store.d.ts +221 -0
- package/es/modules/platform-config/store.mjs +78 -0
- package/es/modules/platform-config/useBasicSetting.d.ts +11 -0
- package/es/modules/platform-config/useBasicSetting.mjs +39 -0
- package/es/modules/platform-config/useDeploySetting.d.ts +19 -0
- package/es/modules/platform-config/useDeploySetting.mjs +27 -0
- package/es/modules/platform-config/useLoginSetting.d.ts +15 -0
- package/es/modules/platform-config/useLoginSetting.mjs +177 -0
- package/es/modules/platform-config/useOrgSetting.d.ts +34 -0
- package/es/modules/platform-config/useOrgSetting.mjs +66 -0
- package/es/modules/platform-config/useProjectSetting.d.ts +12 -0
- package/es/modules/platform-config/useProjectSetting.mjs +11 -0
- package/es/modules/platform-config/useSecuritySetting.d.ts +11 -0
- package/es/modules/platform-config/useSecuritySetting.mjs +60 -0
- package/es/modules/platform-config/useThemeSetting.d.ts +16 -0
- package/es/modules/platform-config/useThemeSetting.mjs +64 -0
- package/es/modules/platform-config/useWatermarkSetting.d.ts +21 -0
- package/es/modules/platform-config/useWatermarkSetting.mjs +26 -0
- package/es/modules/user-stores/index.d.ts +3 -0
- package/es/modules/user-stores/store/permission.store.d.ts +21 -0
- package/es/modules/user-stores/store/permission.store.mjs +38 -0
- package/es/modules/user-stores/store/tenant.store.d.ts +9 -0
- package/es/modules/user-stores/store/tenant.store.mjs +24 -0
- package/es/modules/user-stores/store/user.store.d.ts +154 -0
- package/es/modules/user-stores/store/user.store.mjs +108 -0
- package/es/modules/user-stores/types/permission.d.ts +1 -0
- package/es/modules/user-stores/types/tenant.d.ts +1 -0
- package/es/modules/user-stores/types/user.d.ts +14 -0
- package/es/register/editor-register/editor-register.d.ts +5 -13
- package/es/register/editor-register/editor-register.mjs +8 -17
- package/es/register/form-item-register/form-item-register.d.ts +4 -15
- package/es/register/form-item-register/form-item-register.mjs +7 -17
- package/es/register/index.d.ts +12 -2
- package/es/router/index.d.ts +13 -0
- package/es/router/index.mjs +31 -0
- package/es/setup-app.d.ts +8 -0
- package/es/setup-app.mjs +31 -0
- package/es/state/form/form.state.mjs +0 -1
- package/es/state/form-collapse/form-collapse.state.mjs +0 -1
- package/es/state/form-collapse-pane/form-collapse-pane.state.mjs +0 -1
- package/es/state/form-edit-item/form-edit-item.state.mjs +0 -1
- package/es/state/form-group/form-group.state.mjs +0 -1
- package/es/state/form-item/form-item.state.mjs +0 -1
- package/es/state/form-item-basic/form-item-basic.state.mjs +0 -1
- package/es/state/form-tab/form-tab.state.mjs +0 -1
- package/es/state/form-tab-pane/form-tab-pane.state.mjs +0 -1
- package/es/state/global-pinia-state/global-pinia-state.d.ts +8 -13
- package/es/state/global-pinia-state/global-pinia-state.mjs +35 -9
- package/es/store/global-store.d.ts +1 -0
- package/es/store/global-store.mjs +38 -9
- package/es/store/index.d.ts +2 -3
- package/es/store/index.mjs +0 -1
- package/es/types/index.d.ts +51 -1
- package/es/utils/axios/interceptors.mjs +2 -23
- package/es/utils/cache-adapter/cache-adapter.d.ts +2 -0
- package/es/utils/cache-adapter/cache-adapter.mjs +59 -0
- package/es/utils/deviceFingerprint.d.ts +17 -0
- package/es/utils/deviceFingerprint.mjs +73 -0
- package/es/utils/dictionary/dictionary.mjs +0 -1
- package/es/utils/i18n/index.d.ts +2 -1
- package/es/utils/i18n/index.mjs +3 -4
- package/es/utils/index.d.ts +20 -4
- package/es/utils/is-sort-filed/is-sort-filed.d.ts +10 -0
- package/es/utils/is-sort-filed/is-sort-filed.mjs +40 -0
- package/es/utils/linked-list/linked-list.d.ts +72 -0
- package/es/utils/linked-list/linked-list.mjs +119 -0
- package/es/utils/linked-node/linked-node.d.ts +31 -0
- package/es/utils/linked-node/linked-node.mjs +32 -0
- package/es/utils/lowcode/utils.d.ts +1 -0
- package/es/utils/lowcode/utils.mjs +20 -0
- package/es/utils/lowcode/validate.d.ts +13 -0
- package/es/utils/lowcode/validate.mjs +29 -0
- package/es/utils/mitt/mitt.d.ts +1 -0
- package/es/utils/mitt/mitt.mjs +5 -0
- package/es/utils/model-loader/model-loader.d.ts +118 -0
- package/es/utils/model-loader/model-loader.mjs +326 -0
- package/es/utils/namespace/namespace.d.ts +8 -0
- package/es/utils/namespace/namespace.mjs +4 -2
- package/es/utils/openUtil/index.d.ts +2 -0
- package/es/utils/openUtil/modal/modal.d.ts +61 -0
- package/es/utils/openUtil/modal/modal.mjs +80 -0
- package/es/utils/openUtil/overlay-container/overlay-container.d.ts +100 -0
- package/es/utils/openUtil/overlay-container/overlay-container.mjs +139 -0
- package/es/utils/plugin-static-resource/plugin-static-resource.mjs +1 -2
- package/es/utils/props/gct-form-item/gct-form-item.props.d.ts +63 -0
- package/es/utils/props/gct-form-item/gct-form-item.props.mjs +66 -0
- package/es/utils/props/index.d.ts +1 -0
- package/es/utils/style/index.d.ts +16 -0
- package/es/utils/style/index.mjs +141 -0
- package/es/utils/tools/tools.d.ts +23 -21
- package/es/utils/tools/tools.mjs +37 -27
- package/es/utils/treeHelper/treeHelper.d.ts +118 -0
- package/es/utils/treeHelper/treeHelper.mjs +234 -0
- package/es/utils/useUUid.d.ts +41 -0
- package/es/utils/useUUid.mjs +93 -0
- package/es/utils/util.d.ts +39 -0
- package/es/utils/util.mjs +40 -0
- package/es/utils/uuid/uuid.d.ts +3 -0
- package/es/utils/uuid/uuid.mjs +48 -0
- package/es/utils/value-helper/value-helper.d.ts +49 -0
- package/es/utils/value-helper/value-helper.mjs +111 -0
- package/es/utils/width-install/width-install.mjs +4 -2
- package/package.json +41 -22
- package/es/_virtual/_commonjsHelpers.mjs +0 -44
- package/es/_virtual/index.mjs +0 -7
- package/es/controller/index.mjs +0 -17
- package/es/enums/page-designer/index.mjs +0 -6
- package/es/global/index.mjs +0 -3
- package/es/hooks/index.mjs +0 -7
- package/es/hooks/use-namespace/use-namespace.d.ts +0 -9
- package/es/hooks/use-namespace/use-namespace.mjs +0 -9
- package/es/interface/controller/edit-form/edit-form.controller.mjs +0 -1
- package/es/interface/controller/editor/i-color-editor.controller.mjs +0 -1
- package/es/interface/controller/editor/i-length-unit-editor.controller.mjs +0 -1
- package/es/interface/controller/editor-item/editor-item.controller.mjs +0 -1
- package/es/interface/controller/form/form.controller.mjs +0 -3
- package/es/interface/controller/form-collapse/form-collapse.controller.mjs +0 -1
- package/es/interface/controller/form-collapse-pane/form-collapse-pane.controller.mjs +0 -1
- package/es/interface/controller/form-edit-item/form-edit-item.controller.mjs +0 -1
- package/es/interface/controller/form-group/form-group.controller.mjs +0 -1
- package/es/interface/controller/form-hidden-item/form-hidden-item.controller.mjs +0 -1
- package/es/interface/controller/form-item/form-item.controller.mjs +0 -1
- package/es/interface/controller/form-item-basic/form-item-basic.controller.mjs +0 -1
- package/es/interface/controller/form-tab/form-tab.controller.mjs +0 -1
- package/es/interface/controller/form-tab-pane/form-tab-pane.controller.mjs +0 -1
- package/es/interface/controller/i-designer-controller.d.ts +0 -116
- package/es/interface/controller/i-designer-controller.mjs +0 -1
- package/es/interface/controller/index.mjs +0 -1
- package/es/interface/events/form/i-form.event.mjs +0 -1
- package/es/interface/events/index.mjs +0 -1
- package/es/interface/form/i-editor/i-check-switch.mjs +0 -3
- package/es/interface/form/i-editor/i-checkbox-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-color-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-editor-basic.mjs +0 -1
- package/es/interface/form/i-editor/i-icon-select-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-info-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-length-unit-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-number-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-picker-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-radio-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-select-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-span-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-switch-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-text-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-textarea-editor.mjs +0 -3
- package/es/interface/form/i-form/i-edit-form.mjs +0 -1
- package/es/interface/form/i-form/i-form-collapse-pane.mjs +0 -1
- package/es/interface/form/i-form/i-form-collapse.mjs +0 -1
- package/es/interface/form/i-form/i-form-container.mjs +0 -1
- package/es/interface/form/i-form/i-form-edit-item.mjs +0 -1
- package/es/interface/form/i-form/i-form-group-container.mjs +0 -1
- package/es/interface/form/i-form/i-form-group.mjs +0 -1
- package/es/interface/form/i-form/i-form-hidden-item.mjs +0 -1
- package/es/interface/form/i-form/i-form-item-basic.mjs +0 -1
- package/es/interface/form/i-form/i-form-item.mjs +0 -1
- package/es/interface/form/i-form/i-form-tab-pane.mjs +0 -1
- package/es/interface/form/i-form/i-form-tab.mjs +0 -1
- package/es/interface/form/i-form/i-form.mjs +0 -1
- package/es/interface/form/index.mjs +0 -1
- package/es/interface/hooks/i-designer-hooks.d.ts +0 -26
- package/es/interface/hooks/i-designer-hooks.mjs +0 -3
- package/es/interface/hooks/index.d.ts +0 -1
- package/es/interface/hooks/index.mjs +0 -1
- package/es/interface/i-dictionary/i-dictionary-item.mjs +0 -1
- package/es/interface/i-dictionary/i-dictionary.mjs +0 -1
- package/es/interface/i-http-response/i-http-response.d.ts +0 -29
- package/es/interface/i-http-response/i-http-response.mjs +0 -1
- package/es/interface/i-import-style-map/i-import-style-map.mjs +0 -1
- package/es/interface/i-message-util/i-message-util.d.ts +0 -78
- package/es/interface/i-message-util/i-message-util.mjs +0 -1
- package/es/interface/i-modal/i-modal.mjs +0 -3
- package/es/interface/i-modal-data/i-modal-data.mjs +0 -1
- package/es/interface/i-pinia-action/i-global-actions.mjs +0 -1
- package/es/interface/i-pinia-getter/i-global-getters.mjs +0 -1
- package/es/interface/i-pinia-state/i-global-state.mjs +0 -1
- package/es/interface/index.mjs +0 -1
- package/es/interface/layout/i-flex-layout/i-flex-container.mjs +0 -1
- package/es/interface/layout/i-flex-layout/i-flex-item.mjs +0 -1
- package/es/interface/layout/i-grid-layout/i-grid-container.mjs +0 -1
- package/es/interface/layout/i-grid-layout/i-grid-item-span.mjs +0 -1
- package/es/interface/layout/i-grid-layout/i-grid-item.mjs +0 -1
- package/es/interface/layout/i-layout-basis/i-layout-container-basis.mjs +0 -1
- package/es/interface/layout/index.mjs +0 -1
- package/es/interface/low-code-types/index.d.ts +0 -4
- package/es/interface/low-code-types/index.mjs +0 -5
- package/es/interface/low-code-types/modal-types.d.ts +0 -67
- package/es/interface/low-code-types/modal-types.mjs +0 -3
- package/es/interface/low-code-types/model/index.d.ts +0 -5338
- package/es/interface/low-code-types/model/index.mjs +0 -1
- package/es/interface/low-code-types/schema/index.d.ts +0 -12
- package/es/interface/low-code-types/schema/index.mjs +0 -1
- package/es/interface/low-code-types/widget-basic-types.d.ts +0 -667
- package/es/interface/low-code-types/widget-basic-types.mjs +0 -3
- package/es/interface/provider/i-editor-provider/i-editor-provider.mjs +0 -1
- package/es/interface/provider/i-form-item-provider/i-form-item-provider.mjs +0 -1
- package/es/interface/provider/i-provider-basic/i-provider-basic.mjs +0 -1
- package/es/interface/provider/index.mjs +0 -1
- package/es/interface/state/form/form.state.mjs +0 -1
- package/es/interface/state/form-collapse/form-collapse.state.mjs +0 -1
- package/es/interface/state/form-collapse-pane/form-collapse-pane.state.mjs +0 -1
- package/es/interface/state/form-edit-item/form-edit-item.state.mjs +0 -1
- package/es/interface/state/form-group/form-group.state.mjs +0 -1
- package/es/interface/state/form-hidden-item/form-hidden-item.state.mjs +0 -1
- package/es/interface/state/form-item/form-item.state.mjs +0 -1
- package/es/interface/state/form-item-basic/form-item-basic.state.mjs +0 -1
- package/es/interface/state/form-tab/form-tab.state.mjs +0 -1
- package/es/interface/state/form-tab-pane/form-tab-pane.state.mjs +0 -1
- package/es/interface/state/i-designer-state.d.ts +0 -27
- package/es/interface/state/i-designer-state.mjs +0 -1
- package/es/interface/state/index.mjs +0 -1
- package/es/interface/style/i-border.mjs +0 -1
- package/es/interface/style/i-font.mjs +0 -1
- package/es/interface/style/i-margin.mjs +0 -1
- package/es/interface/style/i-padding.mjs +0 -1
- package/es/interface/style/i-position.mjs +0 -1
- package/es/interface/style/i-spacing.mjs +0 -1
- package/es/interface/style/index.mjs +0 -1
- package/es/node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.mjs +0 -541
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/async-series-hook/async-series-hook.mjs +0 -73
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/index.mjs +0 -2
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/sync-series-hook/sync-series-hook.mjs +0 -100
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/index.mjs +0 -2
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/array/array.mjs +0 -47
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/index.mjs +0 -5
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/object/object.mjs +0 -24
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/qx-event/qx-event.mjs +0 -94
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/qx-event-emitter/qx-event-emitter.mjs +0 -146
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/type-util/type-util.mjs +0 -149
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/util/util.mjs +0 -227
- package/es/provider/i-designer-provider/i-designer-provider.d.ts +0 -102
- package/es/provider/i-designer-provider/i-designer-provider.mjs +0 -1
- package/es/provider/index.d.ts +0 -1
- package/es/provider/index.mjs +0 -1
- package/es/register/designer-register/designer-register.d.ts +0 -53
- package/es/register/designer-register/designer-register.mjs +0 -69
- package/es/register/index.mjs +0 -6
- package/es/register/render-register/render-register.d.ts +0 -59
- package/es/register/render-register/render-register.mjs +0 -65
- package/es/service/base.service.d.ts +0 -19
- package/es/service/base.service.mjs +0 -41
- package/es/service/index.d.ts +0 -1
- package/es/service/index.mjs +0 -3
- package/es/state/index.mjs +0 -12
- package/es/utils/axios/axios.d.ts +0 -27
- package/es/utils/axios/axios.mjs +0 -84
- package/es/utils/index.mjs +0 -10
- package/es/utils/plugin-pkg-util/plugin-pkg-util.d.ts +0 -96
- package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +0 -262
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
const calcStyle = (data, ignoringStyle = []) => {
|
|
2
|
+
const style = {};
|
|
3
|
+
const padding = data.padding;
|
|
4
|
+
if (padding) {
|
|
5
|
+
if (padding.top != null && padding.top != "" && !ignoringStyle.includes("paddingTop"))
|
|
6
|
+
style["padding-top"] = padding.top;
|
|
7
|
+
if (padding.right != null && padding.right != "" && !ignoringStyle.includes("paddingRight"))
|
|
8
|
+
style["padding-right"] = padding.right;
|
|
9
|
+
if (padding.bottom != null && padding.bottom != "" && !ignoringStyle.includes("paddingBottom"))
|
|
10
|
+
style["padding-bottom"] = padding.bottom;
|
|
11
|
+
if (padding.left != null && padding.left != "" && !ignoringStyle.includes("paddingLeft"))
|
|
12
|
+
style["padding-left"] = padding.left;
|
|
13
|
+
}
|
|
14
|
+
const margin = data.margin;
|
|
15
|
+
if (margin) {
|
|
16
|
+
if (margin.top != null && margin.top != "" && !ignoringStyle.includes("marginTop"))
|
|
17
|
+
style["margin-top"] = margin.top;
|
|
18
|
+
if (margin.right != null && margin.right != "" && !ignoringStyle.includes("marginRight"))
|
|
19
|
+
style["margin-right"] = margin.right;
|
|
20
|
+
if (margin.bottom != null && margin.bottom != "" && !ignoringStyle.includes("marginBottom"))
|
|
21
|
+
style["margin-bottom"] = margin.bottom;
|
|
22
|
+
if (margin.left != null && margin.left != "" && !ignoringStyle.includes("marginLeft"))
|
|
23
|
+
style["margin-left"] = margin.left;
|
|
24
|
+
}
|
|
25
|
+
if (data.background != null && data.background != "" && !ignoringStyle.includes("backgroundColor")) {
|
|
26
|
+
style["background-color"] = data.background;
|
|
27
|
+
}
|
|
28
|
+
if (data.width != null && data.width != "" && !ignoringStyle.includes("width")) {
|
|
29
|
+
style.width = data.width;
|
|
30
|
+
}
|
|
31
|
+
if (data.height != null && data.height != "" && !ignoringStyle.includes("height")) {
|
|
32
|
+
style.height = data.height;
|
|
33
|
+
style.overflowX = "hidden";
|
|
34
|
+
style.overflowY = "auto";
|
|
35
|
+
}
|
|
36
|
+
const position = data.position;
|
|
37
|
+
if (position) {
|
|
38
|
+
if (position.position != null && position.position != "" && !ignoringStyle.includes("zIndex")) {
|
|
39
|
+
style.position = position.position;
|
|
40
|
+
style["z-index"] = 1;
|
|
41
|
+
}
|
|
42
|
+
if (position.top != null && position.top != "" && !ignoringStyle.includes("top"))
|
|
43
|
+
style.top = `${position.top}px`;
|
|
44
|
+
if (position.right != null && position.right != "" && !ignoringStyle.includes("right"))
|
|
45
|
+
style.right = `${position.right}px`;
|
|
46
|
+
if (position.bottom != null && position.bottom != "" && !ignoringStyle.includes("bottom"))
|
|
47
|
+
style.bottom = `${position.bottom}px`;
|
|
48
|
+
if (position.left != null && position.left != "" && !ignoringStyle.includes("left"))
|
|
49
|
+
style.left = `${position.left}px`;
|
|
50
|
+
}
|
|
51
|
+
const border = data.border;
|
|
52
|
+
if (border) {
|
|
53
|
+
if (border.topLeftRadius != null && border.topLeftRadius != "" && !ignoringStyle.includes("borderTopLeftRadius")) {
|
|
54
|
+
style["border-top-left-radius"] = border.topLeftRadius;
|
|
55
|
+
}
|
|
56
|
+
if (border.topRightRadius != null && border.topRightRadius != "" && !ignoringStyle.includes("borderTopRightRadius")) {
|
|
57
|
+
style["border-top-right-radius"] = border.topRightRadius;
|
|
58
|
+
}
|
|
59
|
+
if (border.bottomLeftRadius != null && border.bottomLeftRadius != "" && !ignoringStyle.includes("borderBottomLeftRadius")) {
|
|
60
|
+
style["border-bottom-left-radius"] = border.bottomLeftRadius;
|
|
61
|
+
}
|
|
62
|
+
if (border.bottomRightRadius != null && border.bottomRightRadius != "" && !ignoringStyle.includes("borderBottomRightRadius")) {
|
|
63
|
+
style["border-bottom-right-radius"] = border.bottomRightRadius;
|
|
64
|
+
}
|
|
65
|
+
if (border.top) {
|
|
66
|
+
if (border.top.color != null && border.top.color != "" && !ignoringStyle.includes("borderTopColor")) {
|
|
67
|
+
style["border-top-color"] = border.top.color;
|
|
68
|
+
}
|
|
69
|
+
if (border.top.width != null && border.top.width != "" && !ignoringStyle.includes("borderTopWidth")) {
|
|
70
|
+
style["border-top-width"] = border.top.width;
|
|
71
|
+
}
|
|
72
|
+
if (border.top.style && !ignoringStyle.includes("borderTopStyle")) {
|
|
73
|
+
style["border-top-style"] = border.top.style;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (border.right) {
|
|
77
|
+
if (border.right.color != null && border.right.color != "" && !ignoringStyle.includes("borderRightColor")) {
|
|
78
|
+
style["border-right-color"] = border.right.color;
|
|
79
|
+
}
|
|
80
|
+
if (border.right.width != null && border.right.width != "" && !ignoringStyle.includes("borderRightWidth")) {
|
|
81
|
+
style["border-right-width"] = border.right.width;
|
|
82
|
+
}
|
|
83
|
+
if (border.right.style && !ignoringStyle.includes("borderRightStyle")) {
|
|
84
|
+
style["border-right-style"] = border.right.style;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (border.bottom) {
|
|
88
|
+
if (border.bottom.color != null && border.bottom.color != "" && !ignoringStyle.includes("borderBottomColor")) {
|
|
89
|
+
style["border-bottom-color"] = border.bottom.color;
|
|
90
|
+
}
|
|
91
|
+
if (border.bottom.width != null && border.bottom.width != "" && !ignoringStyle.includes("borderBottomWidth")) {
|
|
92
|
+
style["border-bottom-width"] = border.bottom.width;
|
|
93
|
+
}
|
|
94
|
+
if (border.bottom.style && !ignoringStyle.includes("borderBottomStyle")) {
|
|
95
|
+
style["border-bottom-style"] = border.bottom.style;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (border.left) {
|
|
99
|
+
if (border.left.color != null && border.left.color != "" && !ignoringStyle.includes("borderLeftColor")) {
|
|
100
|
+
style["border-left-color"] = border.left.color;
|
|
101
|
+
}
|
|
102
|
+
if (border.left.width != null && border.left.width != "" && !ignoringStyle.includes("borderLeftWidth")) {
|
|
103
|
+
style["border-left-width"] = border.left.width;
|
|
104
|
+
}
|
|
105
|
+
if (border.left.style && !ignoringStyle.includes("borderLeftStyle")) {
|
|
106
|
+
style["border-left-style"] = border.left.style;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (data.border_radius) {
|
|
111
|
+
style["border-radius"] = `${data.border_radius}px`;
|
|
112
|
+
}
|
|
113
|
+
return style;
|
|
114
|
+
};
|
|
115
|
+
const calcFontStyle = (data, ignoringStyle = []) => {
|
|
116
|
+
const style = {};
|
|
117
|
+
const labelFont = data.labelFont;
|
|
118
|
+
if (labelFont) {
|
|
119
|
+
if (labelFont.color != null && labelFont.color != "" && !ignoringStyle.includes("color"))
|
|
120
|
+
style.color = labelFont.color;
|
|
121
|
+
if (labelFont.fontSize != null && labelFont.fontSize != "" && !ignoringStyle.includes("fontSize")) {
|
|
122
|
+
style["font-size"] = labelFont.fontSize;
|
|
123
|
+
}
|
|
124
|
+
if (labelFont.align && !ignoringStyle.includes("textAlign")) {
|
|
125
|
+
style["text-align"] = labelFont.align;
|
|
126
|
+
style["text-align-last"] = labelFont.align;
|
|
127
|
+
}
|
|
128
|
+
if (labelFont.bold === true && !ignoringStyle.includes("fontWeight")) {
|
|
129
|
+
style["font-weight"] = "bold";
|
|
130
|
+
}
|
|
131
|
+
if (labelFont.italic === true && !ignoringStyle.includes("fontStyle")) {
|
|
132
|
+
style["font-style"] = "italic";
|
|
133
|
+
}
|
|
134
|
+
if (labelFont.textDecoration && !ignoringStyle.includes("textDecoration")) {
|
|
135
|
+
style["text-decoration"] = labelFont.textDecoration;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return style;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export { calcFontStyle, calcStyle };
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* 递归合并两个对象
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @template T
|
|
6
|
-
* @template U
|
|
7
|
-
* @param {T} target 目标对象,合并后结果存放于此。The target object to merge into.
|
|
8
|
-
* @param {U} source 要合并的源对象。The source object to merge from.
|
|
9
|
-
* @returns {*} {(T & U)} 合并后的对象。The merged object.
|
|
10
|
-
*/
|
|
11
|
-
export declare function deepMerge<T extends object | null | undefined, U extends object | null | undefined>(target: T, source: U): T & U;
|
|
1
|
+
import { default as qs } from 'qs';
|
|
12
2
|
/**
|
|
13
3
|
* 获取认证令牌
|
|
14
4
|
*
|
|
@@ -37,16 +27,6 @@ export declare function getTenant(): string | null;
|
|
|
37
27
|
* @param {string} tenant
|
|
38
28
|
*/
|
|
39
29
|
export declare function setTenant(tenant: string): void;
|
|
40
|
-
/**
|
|
41
|
-
* 获取路径参数
|
|
42
|
-
*
|
|
43
|
-
* @export
|
|
44
|
-
* @returns {*} {{ aid: string; pid: string }}
|
|
45
|
-
*/
|
|
46
|
-
export declare function getPathQuery(): {
|
|
47
|
-
aid: string;
|
|
48
|
-
pid: string;
|
|
49
|
-
};
|
|
50
30
|
/**
|
|
51
31
|
* 是否为移动端设备
|
|
52
32
|
*/
|
|
@@ -58,3 +38,25 @@ export declare const isMobile: boolean;
|
|
|
58
38
|
* @returns {*}
|
|
59
39
|
*/
|
|
60
40
|
export declare function getTimezone(): string;
|
|
41
|
+
/**
|
|
42
|
+
* 递归合并两个对象
|
|
43
|
+
*
|
|
44
|
+
* @template T
|
|
45
|
+
* @template U
|
|
46
|
+
* @param {T} target 目标对象,合并后结果存放于此
|
|
47
|
+
* @param {U} source 要合并的源对象
|
|
48
|
+
* @returns {(T & U)} 合并后的对象
|
|
49
|
+
*/
|
|
50
|
+
export declare function deepMerge<T extends object | null | undefined, U extends object | null | undefined>(target: T, source: U): T & U;
|
|
51
|
+
/**
|
|
52
|
+
* 对象 → 矩阵参数(stringify)
|
|
53
|
+
* @param {*} params
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
export declare function stringifyMatrixParams(params: Record<string, string | number | null | undefined>): string;
|
|
57
|
+
/**
|
|
58
|
+
* 矩阵参数 → 对象(parse)
|
|
59
|
+
* @param {*} path
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseMatrixParams(path: string): qs.ParsedQs;
|
package/es/utils/tools/tools.mjs
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
|
+
import { getCookie, setCookie, clearCookie } from 'qx-util';
|
|
1
2
|
import { mergeWith, cloneDeep, unionWith, isEqual } from 'lodash-es';
|
|
2
|
-
import '../../
|
|
3
|
-
import '../../constants/
|
|
4
|
-
import '../../
|
|
5
|
-
import
|
|
6
|
-
import { getCookie, setCookie, clearCookie } from '../../node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/util/util.mjs';
|
|
3
|
+
import '../../constants/expression-type/modeCfg.mjs';
|
|
4
|
+
import '../../constants/expression-type/BuiltOperators.mjs';
|
|
5
|
+
import '../../constants/expression-type/function.mjs';
|
|
6
|
+
import '../../constants/expression-type/variable.mjs';
|
|
7
7
|
import { CoreConst } from '../../constants/core.mjs';
|
|
8
|
+
import '../../enums/app-designer/index.mjs';
|
|
9
|
+
import '../../enums/page-designer/designer.mjs';
|
|
10
|
+
import '../../enums/breakpointEnum.mjs';
|
|
8
11
|
import { TIMEZONE_KEY } from '../../enums/cacheEnum.mjs';
|
|
12
|
+
import qs from 'qs';
|
|
9
13
|
|
|
10
|
-
"use strict";
|
|
11
|
-
function deepMerge(target, source) {
|
|
12
|
-
return mergeWith(cloneDeep(target), source, (objValue, srcValue) => {
|
|
13
|
-
if (isObject(objValue) && isObject(srcValue)) {
|
|
14
|
-
return mergeWith(
|
|
15
|
-
cloneDeep(objValue),
|
|
16
|
-
srcValue,
|
|
17
|
-
(prevValue, nextValue) => {
|
|
18
|
-
return isArray(prevValue) ? unionWith(prevValue, nextValue, isEqual) : void 0;
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
14
|
function getToken() {
|
|
25
15
|
return getCookie(CoreConst.TOKEN);
|
|
26
16
|
}
|
|
@@ -41,13 +31,6 @@ function setTenant(tenant) {
|
|
|
41
31
|
clearCookie(CoreConst.TENANT, true);
|
|
42
32
|
}
|
|
43
33
|
}
|
|
44
|
-
function getPathQuery() {
|
|
45
|
-
const params = location.pathname.replace("/src/projects", "").split("/");
|
|
46
|
-
return {
|
|
47
|
-
aid: params[2],
|
|
48
|
-
pid: params[3]
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
34
|
const isMobile = (() => {
|
|
52
35
|
const ua = navigator.userAgent;
|
|
53
36
|
const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/;
|
|
@@ -58,5 +41,32 @@ const isMobile = (() => {
|
|
|
58
41
|
function getTimezone() {
|
|
59
42
|
return localStorage.getItem(TIMEZONE_KEY) || "UTC+08:00";
|
|
60
43
|
}
|
|
44
|
+
function deepMerge(target, source) {
|
|
45
|
+
return mergeWith(cloneDeep(target), source, (objValue, srcValue) => {
|
|
46
|
+
if (typeof objValue === "object" && typeof srcValue === "object") {
|
|
47
|
+
return mergeWith(
|
|
48
|
+
cloneDeep(objValue),
|
|
49
|
+
srcValue,
|
|
50
|
+
(prevValue, nextValue) => {
|
|
51
|
+
return Array.isArray(prevValue) ? unionWith(prevValue, nextValue, isEqual) : void 0;
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function stringifyMatrixParams(params) {
|
|
58
|
+
const str = qs.stringify(params, {
|
|
59
|
+
encode: true,
|
|
60
|
+
delimiter: ";"
|
|
61
|
+
});
|
|
62
|
+
return str ? `;${str}` : "";
|
|
63
|
+
}
|
|
64
|
+
function parseMatrixParams(path) {
|
|
65
|
+
const idx = path.indexOf(";");
|
|
66
|
+
if (idx === -1) return {};
|
|
67
|
+
return qs.parse(path, {
|
|
68
|
+
delimiter: ";"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
61
71
|
|
|
62
|
-
export { deepMerge,
|
|
72
|
+
export { deepMerge, getTenant, getTimezone, getToken, isMobile, parseMatrixParams, setTenant, setToken, stringifyMatrixParams };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 节点判断函数类型
|
|
3
|
+
*/
|
|
4
|
+
type Fn<T> = (node: T, parent?: T) => boolean | unknown;
|
|
5
|
+
/**
|
|
6
|
+
* 树结构辅助配置接口
|
|
7
|
+
*/
|
|
8
|
+
interface ITreeHelperConfig {
|
|
9
|
+
/** 节点 ID 字段名 */
|
|
10
|
+
id: string;
|
|
11
|
+
/** 子节点字段名 */
|
|
12
|
+
children: string;
|
|
13
|
+
/** 父节点 ID 字段名 */
|
|
14
|
+
pid: string;
|
|
15
|
+
/** 是否深度遍历 */
|
|
16
|
+
deep: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 树结构数据处理工具类
|
|
20
|
+
* 提供树形数据与列表数据的相互转换、节点查找、路径查找等功能
|
|
21
|
+
*/
|
|
22
|
+
export declare class TreeHelper {
|
|
23
|
+
/**
|
|
24
|
+
* 默认配置
|
|
25
|
+
*/
|
|
26
|
+
private static readonly _DEFAULT_CONFIG;
|
|
27
|
+
/**
|
|
28
|
+
* 获取合并后的配置
|
|
29
|
+
* @param config 用户配置
|
|
30
|
+
* @returns 合并后的完整配置
|
|
31
|
+
*/
|
|
32
|
+
private static _getConfig;
|
|
33
|
+
/**
|
|
34
|
+
* 将列表数据转换为树形结构
|
|
35
|
+
* @param list 列表数据
|
|
36
|
+
* @param config 配置项
|
|
37
|
+
* @param callBack 节点转换回调函数
|
|
38
|
+
* @returns 树形结构数据
|
|
39
|
+
*/
|
|
40
|
+
static listToTree<T extends IObject = IObject, R = T>(list: T[], config: Partial<ITreeHelperConfig> | undefined, callBack: (node: T) => R): R[];
|
|
41
|
+
/**
|
|
42
|
+
* 将树形结构转换为列表数据
|
|
43
|
+
* @param tree 树形结构数据
|
|
44
|
+
* @param config 配置项
|
|
45
|
+
* @returns 列表数据
|
|
46
|
+
*/
|
|
47
|
+
static treeToList<T extends IObject = IObject>(tree: T[], config?: Partial<ITreeHelperConfig>): T[];
|
|
48
|
+
/**
|
|
49
|
+
* 在树中查找单个节点
|
|
50
|
+
* @param tree 树形结构数据
|
|
51
|
+
* @param func 查找条件函数
|
|
52
|
+
* @param config 配置项
|
|
53
|
+
* @returns 找到的节点或 null
|
|
54
|
+
*/
|
|
55
|
+
static findNode<T extends IObject = IObject>(tree: T[], func: Fn<T>, config?: Partial<ITreeHelperConfig>): T | null;
|
|
56
|
+
/**
|
|
57
|
+
* 在树中查找所有匹配的节点
|
|
58
|
+
* @param tree 树形结构数据
|
|
59
|
+
* @param func 查找条件函数
|
|
60
|
+
* @param config 配置项
|
|
61
|
+
* @returns 所有匹配的节点数组
|
|
62
|
+
*/
|
|
63
|
+
static findNodeAll<T extends IObject = IObject>(tree: T[], func: Fn<T>, config?: Partial<ITreeHelperConfig>): T[];
|
|
64
|
+
/**
|
|
65
|
+
* 查找节点的路径
|
|
66
|
+
* @param tree 树形结构数据
|
|
67
|
+
* @param func 查找条件函数
|
|
68
|
+
* @param config 配置项
|
|
69
|
+
* @returns 从根节点到目标节点的路径数组,未找到返回 null
|
|
70
|
+
*/
|
|
71
|
+
static findPath<T extends IObject = IObject>(tree: T[], func: Fn<T>, config?: Partial<ITreeHelperConfig>): T[] | null;
|
|
72
|
+
/**
|
|
73
|
+
* 查找最近的符合条件的父节点
|
|
74
|
+
* @param tree 树形结构数据
|
|
75
|
+
* @param startId 起始节点 ID
|
|
76
|
+
* @param func 查找条件函数
|
|
77
|
+
* @param config 配置项
|
|
78
|
+
* @returns 找到的父节点或 undefined
|
|
79
|
+
*/
|
|
80
|
+
static findClosestParent<T extends IObject = IObject>(tree: T[], startId: string | number, func: Fn<T>, config?: Partial<ITreeHelperConfig>): T | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* 将具有 id 和 parentId 的列表转换为树形结构
|
|
83
|
+
* @param list 列表数据,需要包含 id 和 parentId 字段
|
|
84
|
+
* @param callBack 节点转换回调函数
|
|
85
|
+
* @returns 树形结构数据
|
|
86
|
+
*/
|
|
87
|
+
static list_to_tree<T extends {
|
|
88
|
+
id?: string;
|
|
89
|
+
parentId?: string;
|
|
90
|
+
}, R = T>(list: T[], callBack: (n: IObject) => R): R[];
|
|
91
|
+
/**
|
|
92
|
+
* 获取所有父级路径
|
|
93
|
+
* @param treeData 树形结构数据
|
|
94
|
+
* @param path 目标路径
|
|
95
|
+
* @returns 从根节点到目标节点的所有路径数组
|
|
96
|
+
*/
|
|
97
|
+
static getAllParentPath(treeData: (IObject & {
|
|
98
|
+
path: string;
|
|
99
|
+
})[], path: string): string[];
|
|
100
|
+
/**
|
|
101
|
+
* 递归遍历树并且根据callback返回新数据再拼装成一个新树
|
|
102
|
+
*
|
|
103
|
+
* @static
|
|
104
|
+
* @param {IObject[]} treeData
|
|
105
|
+
* @param {Function} callback
|
|
106
|
+
* @param {Partial<ITreeHelperConfig>} [config={}]
|
|
107
|
+
* @return {*}
|
|
108
|
+
*/
|
|
109
|
+
static traverseAndBuildTree(treeData: IObject[], callback: (node: IObject) => IObject | unknown, config?: Partial<ITreeHelperConfig>): IObject[];
|
|
110
|
+
/**
|
|
111
|
+
* 递归遍历树结构
|
|
112
|
+
* @param treeData 树形结构数据
|
|
113
|
+
* @param callBack 回调函数
|
|
114
|
+
* @param parentNode 父节点
|
|
115
|
+
*/
|
|
116
|
+
static eachTree<T extends IObject = IObject>(treeData: T[], callBack: (node: T, parentNode?: T) => any, parentNode?: any): void;
|
|
117
|
+
}
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
class TreeHelper {
|
|
2
|
+
/**
|
|
3
|
+
* 默认配置
|
|
4
|
+
*/
|
|
5
|
+
static _DEFAULT_CONFIG = {
|
|
6
|
+
id: "id",
|
|
7
|
+
children: "children",
|
|
8
|
+
pid: "pid",
|
|
9
|
+
deep: true
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 获取合并后的配置
|
|
13
|
+
* @param config 用户配置
|
|
14
|
+
* @returns 合并后的完整配置
|
|
15
|
+
*/
|
|
16
|
+
static _getConfig(config) {
|
|
17
|
+
return Object.assign({}, TreeHelper._DEFAULT_CONFIG, config);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 将列表数据转换为树形结构
|
|
21
|
+
* @param list 列表数据
|
|
22
|
+
* @param config 配置项
|
|
23
|
+
* @param callBack 节点转换回调函数
|
|
24
|
+
* @returns 树形结构数据
|
|
25
|
+
*/
|
|
26
|
+
static listToTree(list, config = {}, callBack) {
|
|
27
|
+
const conf = TreeHelper._getConfig(config);
|
|
28
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
29
|
+
const result = [];
|
|
30
|
+
const { id, children, pid, deep } = conf;
|
|
31
|
+
for (const node of list) {
|
|
32
|
+
const record = node;
|
|
33
|
+
if (!deep) {
|
|
34
|
+
record[children] = record[pid] === "ROOT" ? record[children] ?? [] : [];
|
|
35
|
+
} else {
|
|
36
|
+
record[children] = record[children] ?? void 0;
|
|
37
|
+
}
|
|
38
|
+
nodeMap.set(record[id], callBack(node));
|
|
39
|
+
}
|
|
40
|
+
for (const node of list) {
|
|
41
|
+
const record = node;
|
|
42
|
+
const parent = nodeMap.get(record[pid]);
|
|
43
|
+
if (parent) {
|
|
44
|
+
const parentRecord = parent;
|
|
45
|
+
if (!parentRecord[children]) {
|
|
46
|
+
parentRecord[children] = [];
|
|
47
|
+
}
|
|
48
|
+
parentRecord[children].push(callBack(node));
|
|
49
|
+
} else {
|
|
50
|
+
result.push(callBack(node));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 将树形结构转换为列表数据
|
|
57
|
+
* @param tree 树形结构数据
|
|
58
|
+
* @param config 配置项
|
|
59
|
+
* @returns 列表数据
|
|
60
|
+
*/
|
|
61
|
+
static treeToList(tree, config = {}) {
|
|
62
|
+
const { children } = TreeHelper._getConfig(config);
|
|
63
|
+
const result = [...tree];
|
|
64
|
+
for (let i = 0; i < result.length; i++) {
|
|
65
|
+
const record = result[i];
|
|
66
|
+
const child = record[children];
|
|
67
|
+
if (!Array.isArray(child)) continue;
|
|
68
|
+
result.splice(i + 1, 0, ...child);
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 在树中查找单个节点
|
|
74
|
+
* @param tree 树形结构数据
|
|
75
|
+
* @param func 查找条件函数
|
|
76
|
+
* @param config 配置项
|
|
77
|
+
* @returns 找到的节点或 null
|
|
78
|
+
*/
|
|
79
|
+
static findNode(tree, func, config = {}) {
|
|
80
|
+
const { children } = TreeHelper._getConfig(config);
|
|
81
|
+
const list = tree ? [...tree] : [];
|
|
82
|
+
for (const node of list) {
|
|
83
|
+
if (func(node)) return node;
|
|
84
|
+
const record = node;
|
|
85
|
+
const child = record[children];
|
|
86
|
+
if (Array.isArray(child)) {
|
|
87
|
+
list.push(...child);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 在树中查找所有匹配的节点
|
|
94
|
+
* @param tree 树形结构数据
|
|
95
|
+
* @param func 查找条件函数
|
|
96
|
+
* @param config 配置项
|
|
97
|
+
* @returns 所有匹配的节点数组
|
|
98
|
+
*/
|
|
99
|
+
static findNodeAll(tree, func, config = {}) {
|
|
100
|
+
const { children } = TreeHelper._getConfig(config);
|
|
101
|
+
const list = tree ? [...tree] : [];
|
|
102
|
+
const result = [];
|
|
103
|
+
for (const node of list) {
|
|
104
|
+
if (func(node)) result.push(node);
|
|
105
|
+
const record = node;
|
|
106
|
+
const child = record[children];
|
|
107
|
+
if (Array.isArray(child)) {
|
|
108
|
+
list.push(...child);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 查找节点的路径
|
|
115
|
+
* @param tree 树形结构数据
|
|
116
|
+
* @param func 查找条件函数
|
|
117
|
+
* @param config 配置项
|
|
118
|
+
* @returns 从根节点到目标节点的路径数组,未找到返回 null
|
|
119
|
+
*/
|
|
120
|
+
static findPath(tree, func, config = {}) {
|
|
121
|
+
const { children } = TreeHelper._getConfig(config);
|
|
122
|
+
const path = [];
|
|
123
|
+
const list = tree ? [...tree] : [];
|
|
124
|
+
const visitedSet = /* @__PURE__ */ new Set();
|
|
125
|
+
while (list.length) {
|
|
126
|
+
const node = list[0];
|
|
127
|
+
if (visitedSet.has(node)) {
|
|
128
|
+
path.pop();
|
|
129
|
+
list.shift();
|
|
130
|
+
} else {
|
|
131
|
+
visitedSet.add(node);
|
|
132
|
+
const record = node;
|
|
133
|
+
const child = record[children];
|
|
134
|
+
if (Array.isArray(child)) {
|
|
135
|
+
list.unshift(...child);
|
|
136
|
+
}
|
|
137
|
+
path.push(node);
|
|
138
|
+
if (func(node)) return path;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 查找最近的符合条件的父节点
|
|
145
|
+
* @param tree 树形结构数据
|
|
146
|
+
* @param startId 起始节点 ID
|
|
147
|
+
* @param func 查找条件函数
|
|
148
|
+
* @param config 配置项
|
|
149
|
+
* @returns 找到的父节点或 undefined
|
|
150
|
+
*/
|
|
151
|
+
static findClosestParent(tree, startId, func, config = {}) {
|
|
152
|
+
const { id } = TreeHelper._getConfig(config);
|
|
153
|
+
const path = TreeHelper.findPath(
|
|
154
|
+
tree,
|
|
155
|
+
(node) => node[id] === startId,
|
|
156
|
+
config
|
|
157
|
+
);
|
|
158
|
+
return path?.reverse().find((n) => func(n));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 将具有 id 和 parentId 的列表转换为树形结构
|
|
162
|
+
* @param list 列表数据,需要包含 id 和 parentId 字段
|
|
163
|
+
* @param callBack 节点转换回调函数
|
|
164
|
+
* @returns 树形结构数据
|
|
165
|
+
*/
|
|
166
|
+
static list_to_tree(list, callBack) {
|
|
167
|
+
const map = {};
|
|
168
|
+
const roots = [];
|
|
169
|
+
for (let i = 0; i < list.length; i++) {
|
|
170
|
+
const node = list[i];
|
|
171
|
+
map[node.id] = i;
|
|
172
|
+
node.children = [];
|
|
173
|
+
}
|
|
174
|
+
for (const node of list) {
|
|
175
|
+
if (node.parentId === "ROOT" || !node.parentId) {
|
|
176
|
+
roots.push(callBack(node));
|
|
177
|
+
} else {
|
|
178
|
+
const current = node;
|
|
179
|
+
const parentIndex = map[node.parentId];
|
|
180
|
+
if (parentIndex !== void 0) {
|
|
181
|
+
const parent = list[parentIndex];
|
|
182
|
+
parent.children?.push(callBack(current));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return roots;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* 获取所有父级路径
|
|
190
|
+
* @param treeData 树形结构数据
|
|
191
|
+
* @param path 目标路径
|
|
192
|
+
* @returns 从根节点到目标节点的所有路径数组
|
|
193
|
+
*/
|
|
194
|
+
static getAllParentPath(treeData, path) {
|
|
195
|
+
const menuList = TreeHelper.findPath(treeData, (n) => n.path === path);
|
|
196
|
+
return (menuList || []).map((item) => item.path);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* 递归遍历树并且根据callback返回新数据再拼装成一个新树
|
|
200
|
+
*
|
|
201
|
+
* @static
|
|
202
|
+
* @param {IObject[]} treeData
|
|
203
|
+
* @param {Function} callback
|
|
204
|
+
* @param {Partial<ITreeHelperConfig>} [config={}]
|
|
205
|
+
* @return {*}
|
|
206
|
+
*/
|
|
207
|
+
static traverseAndBuildTree(treeData, callback, config = {}) {
|
|
208
|
+
config = this._getConfig(config);
|
|
209
|
+
const { children } = config;
|
|
210
|
+
return treeData.map((node) => {
|
|
211
|
+
const newNode = callback(node) || node;
|
|
212
|
+
if (children && node[children] && node[children].length > 0) {
|
|
213
|
+
newNode[children] = this.traverseAndBuildTree(node.children, callback);
|
|
214
|
+
}
|
|
215
|
+
return newNode;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* 递归遍历树结构
|
|
220
|
+
* @param treeData 树形结构数据
|
|
221
|
+
* @param callBack 回调函数
|
|
222
|
+
* @param parentNode 父节点
|
|
223
|
+
*/
|
|
224
|
+
static eachTree(treeData, callBack, parentNode = {}) {
|
|
225
|
+
treeData.forEach((element) => {
|
|
226
|
+
const newNode = callBack(element, parentNode) || element;
|
|
227
|
+
if (element.children) {
|
|
228
|
+
TreeHelper.eachTree(element.children, callBack, newNode);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export { TreeHelper };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
interface IRandomUUidOpts {
|
|
3
|
+
/** 是否需要拼接前缀(默认不需要) */
|
|
4
|
+
needPrefix?: boolean;
|
|
5
|
+
/** 随机串只能是字符串 */
|
|
6
|
+
isString?: boolean;
|
|
7
|
+
/** 前缀,默认前缀u_ */
|
|
8
|
+
prefix?: string;
|
|
9
|
+
/** 即将生成的uuid位数(不包含前缀, 默认8位) */
|
|
10
|
+
length?: number;
|
|
11
|
+
/** 类型 */
|
|
12
|
+
chars?: string;
|
|
13
|
+
/** 是否数字打头 */
|
|
14
|
+
numPref?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 生成随机串
|
|
18
|
+
* @param uuids 不可用的uuid
|
|
19
|
+
* @param opts
|
|
20
|
+
* @param opts.needPrefix 是否需要拼接前缀(默认不需要)
|
|
21
|
+
* @param opts.isString 随机串只能是字符串
|
|
22
|
+
* @param opts.prefix 前缀,默认前缀u_
|
|
23
|
+
* @param opts.length 即将生成的uuid位数(不包含前缀, 默认8位)
|
|
24
|
+
* @param opts.chars 类型
|
|
25
|
+
* @param opts.numPref 数字打头
|
|
26
|
+
*/
|
|
27
|
+
export declare const randomUUID: {
|
|
28
|
+
(uuids?: string[], opts?: IRandomUUidOpts): string;
|
|
29
|
+
Generate(uuids?: string[], opts?: IRandomUUidOpts): {
|
|
30
|
+
next: () => string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare function useUUid(tableData: Ref<IObject[]>, keyAttr: Ref<string>, opts?: IRandomUUidOpts): {
|
|
34
|
+
oldUUids: import('vue').ComputedRef<any[]>;
|
|
35
|
+
flatTableData: import('vue').ComputedRef<IObject[]>;
|
|
36
|
+
getUuid: (uuidsProp?: string[], optsProp?: IRandomUUidOpts) => string;
|
|
37
|
+
getUuidGenerate: (uuidsProp?: string[], optsProp?: IRandomUUidOpts) => {
|
|
38
|
+
next: () => string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export {};
|