@ibiz-template/vue3-util 0.6.0 → 0.6.1-dev.1
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.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/es/panel-component/nav-pos/nav-pos.controller.d.ts.map +1 -1
- package/es/panel-component/nav-pos/nav-pos.controller.mjs +12 -3
- package/es/util/overlay-container/overlay-container.mjs +1 -1
- package/es/util/router-callback/router-callback.d.ts +1 -1
- package/es/util/router-callback/router-callback.d.ts.map +1 -1
- package/es/util/router-callback/router-callback.mjs +6 -2
- package/lib/_virtual/_commonjsHelpers.cjs +46 -0
- package/lib/common/badge/badge.cjs +34 -0
- package/lib/common/badge/badge.css +1 -0
- package/lib/common/code-list/code-list.cjs +105 -0
- package/lib/common/code-list/code-list.css +1 -0
- package/lib/common/control-base/control-base.cjs +102 -0
- package/lib/common/control-base/control-base.css +1 -0
- package/lib/common/control-loading-placeholder/control-loading-placeholder.cjs +32 -0
- package/lib/common/control-shell/control-shell.cjs +58 -0
- package/lib/common/control-shell/control-shell.css +1 -0
- package/lib/common/icon/icon.cjs +103 -0
- package/lib/common/index.cjs +21 -0
- package/lib/common/router-view/router-view.cjs +77 -0
- package/lib/common/view-shell/view-shell.cjs +137 -0
- package/lib/common/view-shell/view-shell.css +1 -0
- package/lib/control/index.cjs +10 -0
- package/lib/control/panel/index.cjs +9 -0
- package/lib/control/panel/panel/index.cjs +18 -0
- package/lib/control/panel/panel/panel.cjs +142 -0
- package/lib/control/panel/panel/panel.css +1 -0
- package/lib/control/panel/panel/panel.provider.cjs +10 -0
- package/lib/control/panel/view-layout-panel/index.cjs +24 -0
- package/lib/control/panel/view-layout-panel/view-layout-panel.cjs +144 -0
- package/lib/control/panel/view-layout-panel/view-layout-panel.css +1 -0
- package/lib/control/panel/view-layout-panel/view-layout-panel.provider.cjs +10 -0
- package/lib/hooks/app/app.hooks.cjs +26 -0
- package/lib/hooks/index.cjs +7 -0
- package/lib/interface/index.cjs +5 -0
- package/lib/interface/util/index.cjs +5 -0
- package/lib/interface/util/route/route.cjs +3 -0
- package/lib/node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.cjs +540 -0
- package/lib/panel-component/grid-container/grid-container.cjs +108 -0
- package/lib/panel-component/grid-container/grid-container.controller.cjs +14 -0
- package/lib/panel-component/grid-container/grid-container.css +1 -0
- package/lib/panel-component/grid-container/grid-container.provider.cjs +17 -0
- package/lib/panel-component/grid-container/grid-container.state.cjs +9 -0
- package/lib/panel-component/grid-container/index.cjs +25 -0
- package/lib/panel-component/index.cjs +73 -0
- package/lib/panel-component/multi-data-container/index.cjs +28 -0
- package/lib/panel-component/multi-data-container/multi-data-container-item.controller.cjs +119 -0
- package/lib/panel-component/multi-data-container/multi-data-container-itm.state.cjs +19 -0
- package/lib/panel-component/multi-data-container/multi-data-container.cjs +89 -0
- package/lib/panel-component/multi-data-container/multi-data-container.controller.cjs +262 -0
- package/lib/panel-component/multi-data-container/multi-data-container.css +1 -0
- package/lib/panel-component/multi-data-container/multi-data-container.provider.cjs +17 -0
- package/lib/panel-component/multi-data-container/multi-data-container.state.cjs +19 -0
- package/lib/panel-component/nav-pos/index.cjs +22 -0
- package/lib/panel-component/nav-pos/nav-pos.cjs +107 -0
- package/lib/panel-component/nav-pos/nav-pos.controller.cjs +312 -0
- package/lib/panel-component/nav-pos/nav-pos.css +1 -0
- package/lib/panel-component/nav-pos/nav-pos.provider.cjs +26 -0
- package/lib/panel-component/nav-pos/nav-pos.state.cjs +49 -0
- package/lib/panel-component/panel-container/index.cjs +29 -0
- package/lib/panel-component/panel-container/panel-container.cjs +72 -0
- package/lib/panel-component/panel-container/panel-container.controller.cjs +14 -0
- package/lib/panel-component/panel-container/panel-container.css +1 -0
- package/lib/panel-component/panel-container/panel-container.provider.cjs +17 -0
- package/lib/panel-component/panel-container/panel-container.state.cjs +9 -0
- package/lib/panel-component/panel-container-group/index.cjs +28 -0
- package/lib/panel-component/panel-container-group/panel-container-group.cjs +110 -0
- package/lib/panel-component/panel-container-group/panel-container-group.controller.cjs +37 -0
- package/lib/panel-component/panel-container-group/panel-container-group.css +1 -0
- package/lib/panel-component/panel-container-group/panel-container-group.provider.cjs +17 -0
- package/lib/panel-component/panel-container-group/panel-container-group.state.cjs +9 -0
- package/lib/panel-component/panel-container-image/index.cjs +28 -0
- package/lib/panel-component/panel-container-image/panel-container-image.cjs +95 -0
- package/lib/panel-component/panel-container-image/panel-container-image.controller.cjs +14 -0
- package/lib/panel-component/panel-container-image/panel-container-image.css +1 -0
- package/lib/panel-component/panel-container-image/panel-container-image.provider.cjs +17 -0
- package/lib/panel-component/panel-container-image/panel-container-image.state.cjs +9 -0
- package/lib/panel-component/panel-ctrl-pos/index.cjs +20 -0
- package/lib/panel-component/panel-ctrl-pos/panel-ctrl-pos.cjs +47 -0
- package/lib/panel-component/panel-ctrl-pos/panel-ctrl-pos.controller.cjs +25 -0
- package/lib/panel-component/panel-ctrl-pos/panel-ctrl-pos.css +1 -0
- package/lib/panel-component/panel-ctrl-pos/panel-ctrl-pos.provider.cjs +17 -0
- package/lib/panel-component/panel-field/index.cjs +20 -0
- package/lib/panel-component/panel-field/panel-field.cjs +78 -0
- package/lib/panel-component/panel-field/panel-field.controller.cjs +132 -0
- package/lib/panel-component/panel-field/panel-field.css +1 -0
- package/lib/panel-component/panel-field/panel-field.provider.cjs +17 -0
- package/lib/panel-component/panel-field/panel-field.state.cjs +9 -0
- package/lib/panel-component/panel-item-render/index.cjs +24 -0
- package/lib/panel-component/panel-item-render/panel-item-render.cjs +49 -0
- package/lib/panel-component/panel-item-render/panel-item-render.controller.cjs +31 -0
- package/lib/panel-component/panel-item-render/panel-item-render.provider.cjs +17 -0
- package/lib/panel-component/panel-rawitem/index.cjs +32 -0
- package/lib/panel-component/panel-rawitem/panel-rawitem.cjs +61 -0
- package/lib/panel-component/panel-rawitem/panel-rawitem.controller.cjs +30 -0
- package/lib/panel-component/panel-rawitem/panel-rawitem.css +1 -0
- package/lib/panel-component/panel-rawitem/panel-rawitem.provider.cjs +17 -0
- package/lib/panel-component/panel-tab-page/index.cjs +18 -0
- package/lib/panel-component/panel-tab-page/panel-tab-page.cjs +65 -0
- package/lib/panel-component/panel-tab-page/panel-tab-page.provider.cjs +17 -0
- package/lib/panel-component/scroll-container/index.cjs +55 -0
- package/lib/panel-component/scroll-container/scroll-container/index.cjs +9 -0
- package/lib/panel-component/scroll-container/scroll-container/scroll-container.cjs +114 -0
- package/lib/panel-component/scroll-container/scroll-container/scroll-container.controller.cjs +14 -0
- package/lib/panel-component/scroll-container/scroll-container/scroll-container.css +1 -0
- package/lib/panel-component/scroll-container/scroll-container/scroll-container.provider.cjs +17 -0
- package/lib/panel-component/scroll-container/scroll-container-item/index.cjs +9 -0
- package/lib/panel-component/scroll-container/scroll-container-item/scroll-container-item.cjs +66 -0
- package/lib/panel-component/scroll-container/scroll-container-item/scroll-container-item.controller.cjs +9 -0
- package/lib/panel-component/scroll-container/scroll-container-item/scroll-container-item.css +1 -0
- package/lib/panel-component/scroll-container/scroll-container-item/scroll-container-item.provider.cjs +17 -0
- package/lib/panel-component/single-data-container/index.cjs +28 -0
- package/lib/panel-component/single-data-container/single-data-container.cjs +79 -0
- package/lib/panel-component/single-data-container/single-data-container.controller.cjs +287 -0
- package/lib/panel-component/single-data-container/single-data-container.css +1 -0
- package/lib/panel-component/single-data-container/single-data-container.provider.cjs +17 -0
- package/lib/panel-component/single-data-container/single-data-container.state.cjs +19 -0
- package/lib/plugin/index.cjs +7 -0
- package/{src/plugin/plugin-factory/plugin-factory.ts → lib/plugin/plugin-factory/plugin-factory.cjs} +137 -182
- package/lib/props/common.cjs +17 -0
- package/lib/props/editor/array.cjs +14 -0
- package/lib/props/editor/autocomplete.cjs +14 -0
- package/lib/props/editor/cascader.cjs +14 -0
- package/lib/props/editor/check-box-list.cjs +14 -0
- package/lib/props/editor/check-box.cjs +14 -0
- package/lib/props/editor/code.cjs +23 -0
- package/lib/props/editor/color-picker.cjs +14 -0
- package/lib/props/editor/common.cjs +62 -0
- package/lib/props/editor/data-picker.cjs +14 -0
- package/lib/props/editor/date-picker.cjs +14 -0
- package/lib/props/editor/date-range.cjs +14 -0
- package/lib/props/editor/dropdown-list.cjs +14 -0
- package/lib/props/editor/html.cjs +14 -0
- package/lib/props/editor/index.cjs +86 -0
- package/lib/props/editor/list-box.cjs +14 -0
- package/lib/props/editor/markdown.cjs +22 -0
- package/lib/props/editor/number-range.cjs +14 -0
- package/lib/props/editor/radio-button-list.cjs +14 -0
- package/lib/props/editor/rate.cjs +14 -0
- package/lib/props/editor/raw.cjs +14 -0
- package/lib/props/editor/slider.cjs +14 -0
- package/lib/props/editor/span.cjs +14 -0
- package/lib/props/editor/stepper.cjs +14 -0
- package/lib/props/editor/switch.cjs +14 -0
- package/lib/props/editor/text-box.cjs +30 -0
- package/lib/props/editor/upload.cjs +14 -0
- package/lib/props/index.cjs +89 -0
- package/lib/use/click-outside/click-outside.cjs +50 -0
- package/lib/use/control/index.cjs +7 -0
- package/lib/use/control/use-control-controller/use-control-controller.cjs +78 -0
- package/lib/use/event/event.cjs +39 -0
- package/lib/use/focus-blur/focus-blur.cjs +48 -0
- package/lib/use/index.cjs +34 -0
- package/lib/use/namespace/namespace.cjs +10 -0
- package/lib/use/route/route.cjs +31 -0
- package/lib/use/util/index.cjs +14 -0
- package/lib/use/view/index.cjs +7 -0
- package/lib/use/view/use-view-controller/use-view-controller.cjs +86 -0
- package/lib/use/vue/vue.cjs +64 -0
- package/lib/util/control/prepare-control.cjs +24 -0
- package/lib/util/index.cjs +43 -0
- package/lib/util/install.cjs +11 -0
- package/lib/util/overlay-container/overlay-container.cjs +116 -0
- package/lib/util/overlay-popover-container/overlay-popover-container.cjs +12 -0
- package/lib/util/overlay-view-util/overlay-view-util.cjs +70 -0
- package/lib/util/render/render.cjs +22 -0
- package/lib/util/route/route-listener.cjs +75 -0
- package/lib/util/route/route.cjs +302 -0
- package/lib/util/router-callback/router-callback-item.cjs +74 -0
- package/{src/util/router-callback/router-callback.ts → lib/util/router-callback/router-callback.cjs} +33 -37
- package/lib/util/store/app-store/app-store.cjs +12 -0
- package/lib/util/store/index.cjs +12 -0
- package/lib/util/store/ui-store/ui-store.cjs +17 -0
- package/lib/util/store/ui-store/z-index.cjs +20 -0
- package/lib/view/app-redirect-view/app-redirect-view.cjs +29 -0
- package/lib/view/common/index.cjs +15 -0
- package/lib/view/common/view.cjs +129 -0
- package/lib/view/common/view.css +1 -0
- package/lib/view/common/view.provider.cjs +10 -0
- package/lib/view/de-redirect-view/de-redirect-view.cjs +64 -0
- package/lib/view/de-redirect-view/de-redirect-view.provider.cjs +10 -0
- package/lib/view/de-redirect-view/index.cjs +22 -0
- package/lib/view/index.cjs +15 -0
- package/lib/view/portal-view/index.cjs +23 -0
- package/lib/view/portal-view/portal-view.cjs +95 -0
- package/lib/view/portal-view/portal-view.provider.cjs +10 -0
- package/lib/view/todo-redirect/todo-redirect.cjs +54 -0
- package/package.json +5 -5
- package/src/common/badge/badge.scss +0 -29
- package/src/common/badge/badge.tsx +0 -26
- package/src/common/code-list/code-list.scss +0 -15
- package/src/common/code-list/code-list.tsx +0 -127
- package/src/common/control-base/control-base.scss +0 -4
- package/src/common/control-base/control-base.tsx +0 -130
- package/src/common/control-loading-placeholder/control-loading-placeholder.tsx +0 -22
- package/src/common/control-shell/control-shell.scss +0 -5
- package/src/common/control-shell/control-shell.tsx +0 -70
- package/src/common/icon/icon.tsx +0 -82
- package/src/common/index.ts +0 -8
- package/src/common/router-view/router-view.tsx +0 -74
- package/src/common/view-shell/view-shell.scss +0 -5
- package/src/common/view-shell/view-shell.tsx +0 -163
- package/src/control/index.ts +0 -1
- package/src/control/panel/index.ts +0 -2
- package/src/control/panel/panel/index.ts +0 -12
- package/src/control/panel/panel/panel.provider.ts +0 -14
- package/src/control/panel/panel/panel.scss +0 -9
- package/src/control/panel/panel/panel.tsx +0 -166
- package/src/control/panel/view-layout-panel/index.ts +0 -18
- package/src/control/panel/view-layout-panel/view-layout-panel.provider.ts +0 -14
- package/src/control/panel/view-layout-panel/view-layout-panel.scss +0 -9
- package/src/control/panel/view-layout-panel/view-layout-panel.tsx +0 -178
- package/src/hooks/app/app.hooks.ts +0 -31
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +0 -18
- package/src/interface/index.ts +0 -1
- package/src/interface/util/index.ts +0 -1
- package/src/interface/util/route/route.ts +0 -116
- package/src/panel-component/grid-container/grid-container.controller.ts +0 -18
- package/src/panel-component/grid-container/grid-container.provider.ts +0 -30
- package/src/panel-component/grid-container/grid-container.scss +0 -17
- package/src/panel-component/grid-container/grid-container.state.ts +0 -12
- package/src/panel-component/grid-container/grid-container.tsx +0 -119
- package/src/panel-component/grid-container/index.ts +0 -19
- package/src/panel-component/index.ts +0 -13
- package/src/panel-component/multi-data-container/index.ts +0 -22
- package/src/panel-component/multi-data-container/multi-data-container-item.controller.ts +0 -166
- package/src/panel-component/multi-data-container/multi-data-container-itm.state.ts +0 -20
- package/src/panel-component/multi-data-container/multi-data-container.controller.ts +0 -308
- package/src/panel-component/multi-data-container/multi-data-container.provider.ts +0 -30
- package/src/panel-component/multi-data-container/multi-data-container.scss +0 -10
- package/src/panel-component/multi-data-container/multi-data-container.state.ts +0 -20
- package/src/panel-component/multi-data-container/multi-data-container.tsx +0 -109
- package/src/panel-component/nav-pos/index.ts +0 -16
- package/src/panel-component/nav-pos/nav-pos.controller.ts +0 -393
- package/src/panel-component/nav-pos/nav-pos.provider.ts +0 -38
- package/src/panel-component/nav-pos/nav-pos.scss +0 -4
- package/src/panel-component/nav-pos/nav-pos.state.ts +0 -52
- package/src/panel-component/nav-pos/nav-pos.tsx +0 -121
- package/src/panel-component/panel-container/index.ts +0 -27
- package/src/panel-component/panel-container/panel-container.controller.ts +0 -18
- package/src/panel-component/panel-container/panel-container.provider.ts +0 -30
- package/src/panel-component/panel-container/panel-container.scss +0 -15
- package/src/panel-component/panel-container/panel-container.state.ts +0 -12
- package/src/panel-component/panel-container/panel-container.tsx +0 -72
- package/src/panel-component/panel-container-group/index.ts +0 -22
- package/src/panel-component/panel-container-group/panel-container-group.controller.ts +0 -43
- package/src/panel-component/panel-container-group/panel-container-group.provider.ts +0 -30
- package/src/panel-component/panel-container-group/panel-container-group.scss +0 -91
- package/src/panel-component/panel-container-group/panel-container-group.state.ts +0 -12
- package/src/panel-component/panel-container-group/panel-container-group.tsx +0 -112
- package/src/panel-component/panel-container-image/index.ts +0 -22
- package/src/panel-component/panel-container-image/panel-container-image.controller.ts +0 -18
- package/src/panel-component/panel-container-image/panel-container-image.provider.ts +0 -30
- package/src/panel-component/panel-container-image/panel-container-image.scss +0 -18
- package/src/panel-component/panel-container-image/panel-container-image.state.ts +0 -12
- package/src/panel-component/panel-container-image/panel-container-image.tsx +0 -95
- package/src/panel-component/panel-ctrl-pos/index.ts +0 -14
- package/src/panel-component/panel-ctrl-pos/panel-ctrl-pos.controller.ts +0 -53
- package/src/panel-component/panel-ctrl-pos/panel-ctrl-pos.provider.ts +0 -30
- package/src/panel-component/panel-ctrl-pos/panel-ctrl-pos.scss +0 -8
- package/src/panel-component/panel-ctrl-pos/panel-ctrl-pos.tsx +0 -53
- package/src/panel-component/panel-field/index.ts +0 -14
- package/src/panel-component/panel-field/panel-field.controller.ts +0 -174
- package/src/panel-component/panel-field/panel-field.provider.ts +0 -28
- package/src/panel-component/panel-field/panel-field.scss +0 -36
- package/src/panel-component/panel-field/panel-field.state.ts +0 -12
- package/src/panel-component/panel-field/panel-field.tsx +0 -81
- package/src/panel-component/panel-item-render/index.ts +0 -18
- package/src/panel-component/panel-item-render/panel-item-render.controller.ts +0 -52
- package/src/panel-component/panel-item-render/panel-item-render.provider.ts +0 -30
- package/src/panel-component/panel-item-render/panel-item-render.tsx +0 -50
- package/src/panel-component/panel-rawitem/index.ts +0 -26
- package/src/panel-component/panel-rawitem/panel-rawitem.controller.ts +0 -34
- package/src/panel-component/panel-rawitem/panel-rawitem.provider.ts +0 -28
- package/src/panel-component/panel-rawitem/panel-rawitem.scss +0 -8
- package/src/panel-component/panel-rawitem/panel-rawitem.tsx +0 -61
- package/src/panel-component/panel-tab-page/index.ts +0 -12
- package/src/panel-component/panel-tab-page/panel-tab-page.provider.ts +0 -27
- package/src/panel-component/panel-tab-page/panel-tab-page.tsx +0 -55
- package/src/panel-component/scroll-container/index.ts +0 -44
- package/src/panel-component/scroll-container/scroll-container/index.ts +0 -2
- package/src/panel-component/scroll-container/scroll-container/scroll-container.controller.ts +0 -32
- package/src/panel-component/scroll-container/scroll-container/scroll-container.provider.ts +0 -30
- package/src/panel-component/scroll-container/scroll-container/scroll-container.scss +0 -34
- package/src/panel-component/scroll-container/scroll-container/scroll-container.tsx +0 -110
- package/src/panel-component/scroll-container/scroll-container-item/index.ts +0 -2
- package/src/panel-component/scroll-container/scroll-container-item/scroll-container-item.controller.ts +0 -25
- package/src/panel-component/scroll-container/scroll-container-item/scroll-container-item.provider.ts +0 -30
- package/src/panel-component/scroll-container/scroll-container-item/scroll-container-item.scss +0 -9
- package/src/panel-component/scroll-container/scroll-container-item/scroll-container-item.tsx +0 -60
- package/src/panel-component/single-data-container/index.ts +0 -22
- package/src/panel-component/single-data-container/single-data-container.controller.ts +0 -345
- package/src/panel-component/single-data-container/single-data-container.provider.ts +0 -30
- package/src/panel-component/single-data-container/single-data-container.scss +0 -10
- package/src/panel-component/single-data-container/single-data-container.state.ts +0 -20
- package/src/panel-component/single-data-container/single-data-container.tsx +0 -95
- package/src/plugin/index.ts +0 -1
- package/src/props/common.ts +0 -30
- package/src/props/editor/array.ts +0 -27
- package/src/props/editor/autocomplete.ts +0 -27
- package/src/props/editor/cascader.ts +0 -27
- package/src/props/editor/check-box-list.ts +0 -27
- package/src/props/editor/check-box.ts +0 -27
- package/src/props/editor/code.ts +0 -36
- package/src/props/editor/color-picker.ts +0 -27
- package/src/props/editor/common.ts +0 -94
- package/src/props/editor/data-picker.ts +0 -27
- package/src/props/editor/date-picker.ts +0 -27
- package/src/props/editor/date-range.ts +0 -23
- package/src/props/editor/dropdown-list.ts +0 -27
- package/src/props/editor/html.ts +0 -27
- package/src/props/editor/index.ts +0 -25
- package/src/props/editor/list-box.ts +0 -27
- package/src/props/editor/markdown.ts +0 -35
- package/src/props/editor/number-range.ts +0 -23
- package/src/props/editor/radio-button-list.ts +0 -27
- package/src/props/editor/rate.ts +0 -23
- package/src/props/editor/raw.ts +0 -23
- package/src/props/editor/slider.ts +0 -23
- package/src/props/editor/span.ts +0 -27
- package/src/props/editor/stepper.ts +0 -23
- package/src/props/editor/switch.ts +0 -23
- package/src/props/editor/text-box.ts +0 -79
- package/src/props/editor/upload.ts +0 -27
- package/src/props/index.ts +0 -2
- package/src/types/index.d.ts +0 -8
- package/src/use/click-outside/click-outside.ts +0 -72
- package/src/use/control/index.ts +0 -1
- package/src/use/control/use-control-controller/use-control-controller.ts +0 -153
- package/src/use/event/event.ts +0 -57
- package/src/use/focus-blur/focus-blur.ts +0 -83
- package/src/use/index.ts +0 -9
- package/src/use/namespace/namespace.ts +0 -14
- package/src/use/route/route.ts +0 -47
- package/src/use/util/index.ts +0 -26
- package/src/use/view/index.ts +0 -1
- package/src/use/view/use-view-controller/use-view-controller.ts +0 -153
- package/src/use/vue/vue.ts +0 -142
- package/src/util/control/prepare-control.ts +0 -33
- package/src/util/index.ts +0 -10
- package/src/util/install.ts +0 -14
- package/src/util/overlay-container/overlay-container.ts +0 -155
- package/src/util/overlay-popover-container/overlay-popover-container.ts +0 -30
- package/src/util/overlay-view-util/overlay-view-util.ts +0 -89
- package/src/util/render/render.ts +0 -28
- package/src/util/route/route-listener.ts +0 -91
- package/src/util/route/route.ts +0 -520
- package/src/util/router-callback/router-callback-item.ts +0 -98
- package/src/util/store/app-store/app-store.ts +0 -10
- package/src/util/store/index.ts +0 -6
- package/src/util/store/ui-store/ui-store.ts +0 -27
- package/src/util/store/ui-store/z-index.ts +0 -53
- package/src/view/app-redirect-view/app-redirect-view.tsx +0 -26
- package/src/view/common/index.ts +0 -10
- package/src/view/common/view.provider.ts +0 -14
- package/src/view/common/view.scss +0 -38
- package/src/view/common/view.tsx +0 -152
- package/src/view/de-redirect-view/de-redirect-view.provider.ts +0 -14
- package/src/view/de-redirect-view/de-redirect-view.tsx +0 -62
- package/src/view/de-redirect-view/index.ts +0 -17
- package/src/view/index.ts +0 -5
- package/src/view/portal-view/index.ts +0 -18
- package/src/view/portal-view/portal-view.provider.ts +0 -14
- package/src/view/portal-view/portal-view.tsx +0 -79
- package/src/view/todo-redirect/todo-redirect.tsx +0 -51
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { watch } from 'vue';
|
|
3
|
-
import { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
4
|
-
|
|
5
|
-
type ChangeCallback = () => void;
|
|
6
|
-
/**
|
|
7
|
-
* 监听路由变更,提供下一次变更执行的一次性回调。
|
|
8
|
-
*
|
|
9
|
-
* @export
|
|
10
|
-
* @class RouteListener
|
|
11
|
-
*/
|
|
12
|
-
export class RouteListener {
|
|
13
|
-
/**
|
|
14
|
-
* 回调集合
|
|
15
|
-
*
|
|
16
|
-
* @memberof RouteListener
|
|
17
|
-
*/
|
|
18
|
-
private callbacks: Array<ChangeCallback> = [];
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 计时器集合
|
|
22
|
-
*
|
|
23
|
-
* @private
|
|
24
|
-
* @type {any[]}
|
|
25
|
-
* @memberof RouteListener
|
|
26
|
-
*/
|
|
27
|
-
private timers: any[] = [];
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 等待路由响应时间
|
|
31
|
-
*
|
|
32
|
-
* @private
|
|
33
|
-
* @type {number}
|
|
34
|
-
* @memberof RouteListener
|
|
35
|
-
*/
|
|
36
|
-
private wait: number = 500;
|
|
37
|
-
|
|
38
|
-
constructor(route: RouteLocationNormalizedLoaded, wait?: number) {
|
|
39
|
-
if (wait) {
|
|
40
|
-
this.wait = wait;
|
|
41
|
-
}
|
|
42
|
-
watch(
|
|
43
|
-
() => route.path,
|
|
44
|
-
(newVal, oldVal) => {
|
|
45
|
-
if (newVal !== oldVal) {
|
|
46
|
-
// 执行所有回调
|
|
47
|
-
if (this.callbacks.length) {
|
|
48
|
-
for (let index = 0; index < this.callbacks.length; index++) {
|
|
49
|
-
const fn = this.callbacks[index];
|
|
50
|
-
fn();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// 清空所有回调
|
|
54
|
-
this.callbacks = [];
|
|
55
|
-
|
|
56
|
-
// 清空所有计时器
|
|
57
|
-
if (this.timers.length) {
|
|
58
|
-
for (let index = 0; index < this.timers.length; index++) {
|
|
59
|
-
const timer = this.timers[index];
|
|
60
|
-
clearTimeout(timer);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this.timers = [];
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 下一次路由变更后执行回调,只执行一次
|
|
72
|
-
*
|
|
73
|
-
* @param {ChangeCallback} callback
|
|
74
|
-
* @memberof RouteListener
|
|
75
|
-
*/
|
|
76
|
-
nextChange(callback: ChangeCallback): void {
|
|
77
|
-
if (callback) {
|
|
78
|
-
// 设定计时器,经过一段时间等不到时,执行回调,并删除回调集合里的回调
|
|
79
|
-
this.timers.push(
|
|
80
|
-
setTimeout(() => {
|
|
81
|
-
callback();
|
|
82
|
-
const index = this.callbacks.findIndex(item => item === callback);
|
|
83
|
-
this.callbacks.splice(index, 1);
|
|
84
|
-
}, this.wait),
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
// 存入回调集合等待被调用
|
|
88
|
-
this.callbacks.push(callback);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
package/src/util/route/route.ts
DELETED
|
@@ -1,520 +0,0 @@
|
|
|
1
|
-
import { notNilEmpty } from 'qx-util';
|
|
2
|
-
import { RuntimeError } from '@ibiz-template/core';
|
|
3
|
-
import qs from 'qs';
|
|
4
|
-
import { RouteLocationNormalizedLoaded as Route, useRoute } from 'vue-router';
|
|
5
|
-
import { watch } from 'vue';
|
|
6
|
-
import {
|
|
7
|
-
calcDeCodeNameById,
|
|
8
|
-
getMatchResPath,
|
|
9
|
-
IViewConfig,
|
|
10
|
-
RouteConst,
|
|
11
|
-
ViewType,
|
|
12
|
-
} from '@ibiz-template/runtime';
|
|
13
|
-
import { IRoutePath, IRoutePathNode, IRouteViewData } from '../../interface';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 路径字符串转换成路由路径对象
|
|
17
|
-
*
|
|
18
|
-
* @author lxm
|
|
19
|
-
* @date 2022-08-18 11:08:08
|
|
20
|
-
* @export
|
|
21
|
-
* @param {string} pathStr 以/开头的路径,即router的path
|
|
22
|
-
* @param {boolean} [isRouteModal=false]
|
|
23
|
-
* @returns {*} {IRoutePath}
|
|
24
|
-
*/
|
|
25
|
-
export function route2routePath(
|
|
26
|
-
route: Route,
|
|
27
|
-
isRouteModal: boolean = false,
|
|
28
|
-
): IRoutePath {
|
|
29
|
-
// 一共匹配了几级路由
|
|
30
|
-
const depth = route.matched.length;
|
|
31
|
-
|
|
32
|
-
let path = route.path;
|
|
33
|
-
if (isRouteModal) {
|
|
34
|
-
path = path.replace(new RegExp(`/${RouteConst.ROUTE_MODAL_TAG}`, 'g'), '');
|
|
35
|
-
}
|
|
36
|
-
const items = path.split('/');
|
|
37
|
-
|
|
38
|
-
// 解析路径节点
|
|
39
|
-
const pathNodes: IRoutePathNode[] = [];
|
|
40
|
-
for (let index = 1; index <= depth; index++) {
|
|
41
|
-
const viewName = items[index * 2];
|
|
42
|
-
const paramsStr = route.params[`params${index}`] as string;
|
|
43
|
-
|
|
44
|
-
/** 路由参数,默认是视图参数 */
|
|
45
|
-
let params: IParams | undefined;
|
|
46
|
-
|
|
47
|
-
/** 上下文参数 */
|
|
48
|
-
let context: IParams | undefined;
|
|
49
|
-
let srfnav: string | undefined;
|
|
50
|
-
// params为占位符时置空
|
|
51
|
-
if (!paramsStr || paramsStr === ibiz.env.routePlaceholder) {
|
|
52
|
-
params = undefined;
|
|
53
|
-
} else {
|
|
54
|
-
// 首页上下文要解析
|
|
55
|
-
params = qs.parse(paramsStr, {
|
|
56
|
-
strictNullHandling: true,
|
|
57
|
-
delimiter: ';',
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// 路由参数存在的时候,解析里面的上下文。
|
|
62
|
-
if (params) {
|
|
63
|
-
if (index === 1) {
|
|
64
|
-
// 首页的时候,路由上的参数是资源路径,属于上下文
|
|
65
|
-
context = params;
|
|
66
|
-
params = undefined;
|
|
67
|
-
} else {
|
|
68
|
-
if (params.srfnavctx) {
|
|
69
|
-
// 解析额外上下文
|
|
70
|
-
context = JSON.parse(decodeURIComponent(params.srfnavctx));
|
|
71
|
-
delete params.srfnavctx;
|
|
72
|
-
}
|
|
73
|
-
if (params.srfnav) {
|
|
74
|
-
// 解析额外自身视图导航参数
|
|
75
|
-
srfnav = params.srfnav;
|
|
76
|
-
delete params.srfnav;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
pathNodes.push({ viewName, context, params, srfnav });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// 解析应用上下文
|
|
85
|
-
let appContext;
|
|
86
|
-
if (
|
|
87
|
-
route.params.appContext &&
|
|
88
|
-
route.params.appContext !== ibiz.env.routePlaceholder
|
|
89
|
-
) {
|
|
90
|
-
appContext = qs.parse(route.params.appContext as string, {
|
|
91
|
-
strictNullHandling: true,
|
|
92
|
-
delimiter: ';',
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return { appContext, pathNodes };
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* 路由路径对象转路径字符串
|
|
101
|
-
*
|
|
102
|
-
* @author lxm
|
|
103
|
-
* @date 2022-08-18 13:08:57
|
|
104
|
-
* @export
|
|
105
|
-
* @param {IRoutePath} routePath 路由路径对象
|
|
106
|
-
* @returns {*} {string}
|
|
107
|
-
*/
|
|
108
|
-
export function routePath2string(routePath: IRoutePath): string {
|
|
109
|
-
let pathStr = '';
|
|
110
|
-
// 应用上下文
|
|
111
|
-
if (routePath.appContext) {
|
|
112
|
-
pathStr += `/${qs.stringify(routePath.appContext, {
|
|
113
|
-
delimiter: ';',
|
|
114
|
-
strictNullHandling: true,
|
|
115
|
-
})}`;
|
|
116
|
-
} else {
|
|
117
|
-
pathStr += `/${ibiz.env.routePlaceholder}`;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// 每一层级的视图路由的拼装
|
|
121
|
-
routePath.pathNodes.forEach((pathNode: IRoutePathNode, index: number) => {
|
|
122
|
-
pathStr += `/${pathNode.viewName}/`;
|
|
123
|
-
let routeParams: IParams = {};
|
|
124
|
-
// 首页路由
|
|
125
|
-
if (index === 0) {
|
|
126
|
-
if (notNilEmpty(pathNode.context)) {
|
|
127
|
-
// 对象转成a=11;b=222的格式,字符串直接附加在后面
|
|
128
|
-
routeParams = pathNode.context!;
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
// 非首页路由,视图参数直接放到路由参数上,上下文转换后放到路由参数的srfnavctx上
|
|
132
|
-
routeParams = notNilEmpty(pathNode.params) ? pathNode.params! : {};
|
|
133
|
-
|
|
134
|
-
// 合并视图上下文
|
|
135
|
-
if (notNilEmpty(pathNode.context)) {
|
|
136
|
-
const objStr = JSON.stringify(pathNode.context);
|
|
137
|
-
// undefined 的vlaue会被JSON.stringify删除,可能会转成{}
|
|
138
|
-
if (objStr !== '{}') {
|
|
139
|
-
routeParams!.srfnavctx = encodeURIComponent(objStr);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// 合并视图导航参数
|
|
144
|
-
if (pathNode.srfnav) {
|
|
145
|
-
routeParams.srfnav = pathNode.srfnav;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const paramsStr = qs.stringify(routeParams, {
|
|
150
|
-
delimiter: ';',
|
|
151
|
-
strictNullHandling: true,
|
|
152
|
-
skipNulls: true,
|
|
153
|
-
});
|
|
154
|
-
// 把路由参数转换到路由路径上去
|
|
155
|
-
if (notNilEmpty(paramsStr)) {
|
|
156
|
-
pathStr += paramsStr;
|
|
157
|
-
} else {
|
|
158
|
-
pathStr += ibiz.env.routePlaceholder;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
return pathStr;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* 获取自身的路由上下文,排除了部分不需要路由携带的参数
|
|
167
|
-
*
|
|
168
|
-
* @author lxm
|
|
169
|
-
* @date 2023-03-14 02:07:41
|
|
170
|
-
* @export
|
|
171
|
-
* @param {IContext} context
|
|
172
|
-
* @returns {*} {IParams}
|
|
173
|
-
*/
|
|
174
|
-
export function getOwnRouteContext(context: IContext): IParams {
|
|
175
|
-
const ownContext = context.getOwnContext();
|
|
176
|
-
const excludeKeys = [
|
|
177
|
-
'srfsessionid',
|
|
178
|
-
'srfappid',
|
|
179
|
-
'currentSrfNav',
|
|
180
|
-
'toRouteDepth',
|
|
181
|
-
];
|
|
182
|
-
Object.keys(ownContext).forEach(key => {
|
|
183
|
-
if (excludeKeys.includes(key)) {
|
|
184
|
-
delete ownContext[key];
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
return ownContext;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* 计算资源上下文时,需要排除自身实体codeName的视图(导航类视图和多数据视图)
|
|
192
|
-
* @return {*}
|
|
193
|
-
* @author: zhujiamin
|
|
194
|
-
* @Date: 2023-02-20 15:45:46
|
|
195
|
-
*/
|
|
196
|
-
export const excludeViewTypes: string[] = [
|
|
197
|
-
ViewType.DE_GRID_VIEW,
|
|
198
|
-
ViewType.DE_GRID_EXP_VIEW,
|
|
199
|
-
ViewType.DE_LIST_VIEW,
|
|
200
|
-
ViewType.DE_LIST_EXP_VIEW,
|
|
201
|
-
ViewType.DE_DATA_VIEW,
|
|
202
|
-
ViewType.DE_DATAVIEW_EXP_VIEW,
|
|
203
|
-
ViewType.DE_CALENDAR_VIEW,
|
|
204
|
-
ViewType.DE_CALENDAR_EXP_VIEW,
|
|
205
|
-
ViewType.DE_CHART_VIEW,
|
|
206
|
-
ViewType.DE_CHART_EXP_VIEW,
|
|
207
|
-
ViewType.DE_KANBAN_VIEW,
|
|
208
|
-
];
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* 计算资源路径,把首页后面的资源路径上下文算出来,并把第二层中对应的上下文删掉。
|
|
212
|
-
* @author lxm
|
|
213
|
-
* @date 2023-07-13 06:37:10
|
|
214
|
-
* @export
|
|
215
|
-
* @param {IRoutePath} routePath
|
|
216
|
-
* @param {IContext} context
|
|
217
|
-
* @param {string} appDataEntityId
|
|
218
|
-
* @return {*} {Promise<void>}
|
|
219
|
-
*/
|
|
220
|
-
export async function calcResRoutePath(
|
|
221
|
-
routePath: IRoutePath,
|
|
222
|
-
context: IContext,
|
|
223
|
-
appDataEntityId?: string,
|
|
224
|
-
appId?: string,
|
|
225
|
-
): Promise<void> {
|
|
226
|
-
if (!appDataEntityId) {
|
|
227
|
-
// 无实体的视图清空资源上下文
|
|
228
|
-
routePath.pathNodes[0].context = undefined;
|
|
229
|
-
} else {
|
|
230
|
-
const entity = await ibiz.hub.getAppDataEntity(appDataEntityId, appId);
|
|
231
|
-
let match = getMatchResPath(context, entity);
|
|
232
|
-
// 有实体有没有匹配到的,补一个包含自身实体主键的match
|
|
233
|
-
if (!match) {
|
|
234
|
-
match = { path: '', keys: [entity.codeName!.toLowerCase()] };
|
|
235
|
-
}
|
|
236
|
-
if (match) {
|
|
237
|
-
const currentContext = routePath.pathNodes[1].context;
|
|
238
|
-
const resContext: IParams = {};
|
|
239
|
-
// 资源路径不为空,二级视图的上下文删掉多余的资源上下文
|
|
240
|
-
match.keys.forEach(key => {
|
|
241
|
-
if (context && Object.prototype.hasOwnProperty.call(context, key)) {
|
|
242
|
-
resContext[key] = context[key];
|
|
243
|
-
if (currentContext) {
|
|
244
|
-
delete currentContext[key];
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
// 把资源路径填充到一级路由上
|
|
249
|
-
routePath.pathNodes[0].context = resContext;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* 生成route路径
|
|
256
|
-
*
|
|
257
|
-
* @author lxm
|
|
258
|
-
* @date 2022-08-17 21:08:00
|
|
259
|
-
* @export
|
|
260
|
-
* @param {IAppView} appView 视图模型
|
|
261
|
-
* @param {Route} route 路由对象
|
|
262
|
-
* @param {IContext} [context] 上下文对象
|
|
263
|
-
* @param {(IParams | undefined)} [params] 视图参数
|
|
264
|
-
* @returns {*} {string}
|
|
265
|
-
*/
|
|
266
|
-
export async function generateRoutePath(
|
|
267
|
-
appView: IViewConfig,
|
|
268
|
-
route: Route,
|
|
269
|
-
context: IContext,
|
|
270
|
-
params?: IParams,
|
|
271
|
-
): Promise<{ path: string }> {
|
|
272
|
-
const routePath = route2routePath(route);
|
|
273
|
-
// 如果上下文存在toRouteDepth时,使用上下文的层级,否则使用默认层级
|
|
274
|
-
let depth = context.srfdefaulttoroutedepth || 2; // 默认层级看上下文的srfdefaulttoroutedepth,如果没有就是2
|
|
275
|
-
if (context.toRouteDepth) {
|
|
276
|
-
depth = context.toRouteDepth;
|
|
277
|
-
// 使用完后转为undefined,避免添加到上下文里
|
|
278
|
-
context.toRouteDepth = undefined;
|
|
279
|
-
} else if (ibiz.env.isMob) {
|
|
280
|
-
// 移动端默认补充home层级
|
|
281
|
-
routePath.pathNodes[0] = {
|
|
282
|
-
viewName: 'home',
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// 删除目标层级和之后的路由,保留之前层级的路由
|
|
287
|
-
routePath.pathNodes.splice(depth - 1, routePath.pathNodes.length - depth + 1);
|
|
288
|
-
|
|
289
|
-
// 导航视图的导航参数,加在目标层级之前的一个层级的视图参数里
|
|
290
|
-
if (context.currentSrfNav) {
|
|
291
|
-
const currentNode = routePath.pathNodes[routePath.pathNodes.length - 1];
|
|
292
|
-
currentNode.params = currentNode.params || {};
|
|
293
|
-
currentNode.srfnav = context.currentSrfNav;
|
|
294
|
-
// 使用完后转为undefined,避免添加到上下文里
|
|
295
|
-
context.currentSrfNav = undefined;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// 重定向视图跳转的一级首页路由
|
|
299
|
-
if (route.fullPath.startsWith('/appredirectview')) {
|
|
300
|
-
if (params?.srfindexname) {
|
|
301
|
-
routePath.pathNodes[0].viewName = params.srfindexname;
|
|
302
|
-
delete params.srfindexname;
|
|
303
|
-
} else {
|
|
304
|
-
routePath.pathNodes[0].viewName = 'index';
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// 计算目标视图path路径
|
|
309
|
-
routePath.pathNodes.push({
|
|
310
|
-
viewName: appView.codeName!.toLowerCase(),
|
|
311
|
-
context: getOwnRouteContext(context),
|
|
312
|
-
params,
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
// 计算二级视图的资源路径加到index后面
|
|
316
|
-
if (depth === 2) {
|
|
317
|
-
await calcResRoutePath(
|
|
318
|
-
routePath,
|
|
319
|
-
context,
|
|
320
|
-
appView.appDataEntityId,
|
|
321
|
-
appView.appId,
|
|
322
|
-
);
|
|
323
|
-
|
|
324
|
-
// 多数据和导航视图,删除自身的主键上下文
|
|
325
|
-
if (excludeViewTypes.includes(appView.viewType)) {
|
|
326
|
-
const deName = calcDeCodeNameById(appView.appDataEntityId!);
|
|
327
|
-
delete routePath.pathNodes[0].context![deName];
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return { path: routePath2string(routePath) };
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* 生成route路径
|
|
336
|
-
*
|
|
337
|
-
* @author lxm
|
|
338
|
-
* @date 2022-08-17 21:08:00
|
|
339
|
-
* @export
|
|
340
|
-
* @param {IAppView} appView 视图模型
|
|
341
|
-
* @param {Route} route 路由对象
|
|
342
|
-
* @param {IContext} [context] 上下文对象
|
|
343
|
-
* @param {(IParams | undefined)} [params] 视图参数
|
|
344
|
-
* @returns {*} {string}
|
|
345
|
-
*/
|
|
346
|
-
export async function generateRoutePathByModal(
|
|
347
|
-
appView: IViewConfig,
|
|
348
|
-
route: Route,
|
|
349
|
-
context: IContext,
|
|
350
|
-
params?: IParams,
|
|
351
|
-
): Promise<{ path: string }> {
|
|
352
|
-
const routePath = route2routePath(route);
|
|
353
|
-
|
|
354
|
-
// 特殊处理 RouteConst.ROUTE_MODAL_TAG,因为只能有一级避免多次或重复点击,导致路由计算错误。再次点击时把之前的modal路由删除
|
|
355
|
-
const findIndex = routePath.pathNodes.findIndex(
|
|
356
|
-
item => item.viewName === RouteConst.ROUTE_MODAL_TAG,
|
|
357
|
-
);
|
|
358
|
-
|
|
359
|
-
if (findIndex !== -1) {
|
|
360
|
-
routePath.pathNodes = routePath.pathNodes.slice(0, findIndex);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// 导航视图的导航参数,加在目标层级之前的一个层级的视图参数里
|
|
364
|
-
if (context.currentSrfNav) {
|
|
365
|
-
const currentNode = routePath.pathNodes[routePath.pathNodes.length - 1];
|
|
366
|
-
currentNode.params = currentNode.params || {};
|
|
367
|
-
currentNode.srfnav = context.currentSrfNav;
|
|
368
|
-
// 使用完后转为undefined,避免添加到上下文里
|
|
369
|
-
context.currentSrfNav = undefined;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// 计算目标视图path路径
|
|
373
|
-
routePath.pathNodes.push({
|
|
374
|
-
viewName: `${
|
|
375
|
-
RouteConst.ROUTE_MODAL_TAG
|
|
376
|
-
}/${appView.codeName!.toLowerCase()}`,
|
|
377
|
-
context: getOwnRouteContext(context),
|
|
378
|
-
params,
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
return { path: routePath2string(routePath) };
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* 解析路由获取对应视图数据
|
|
386
|
-
*
|
|
387
|
-
* @author lxm
|
|
388
|
-
* @date 2022-08-17 22:08:51
|
|
389
|
-
* @export
|
|
390
|
-
* @param {Route} route 路由对象
|
|
391
|
-
* @param {number} depth 层级
|
|
392
|
-
* @param {boolean} [isRouteModal=false]
|
|
393
|
-
* @returns {*} {IRouteViewData}
|
|
394
|
-
*/
|
|
395
|
-
export async function parseRouteViewData(
|
|
396
|
-
route: Route,
|
|
397
|
-
depth: number,
|
|
398
|
-
isRouteModal: boolean = false,
|
|
399
|
-
): Promise<IRouteViewData> {
|
|
400
|
-
// 解析路由的视图参数
|
|
401
|
-
const routePath = route2routePath(route, isRouteModal);
|
|
402
|
-
|
|
403
|
-
// 获取对应层级的视图名称参数
|
|
404
|
-
let viewCodeName = routePath.pathNodes[depth - 1].viewName;
|
|
405
|
-
if (!viewCodeName) {
|
|
406
|
-
throw new RuntimeError(`第${depth}级路由不存在视图标识`);
|
|
407
|
-
}
|
|
408
|
-
if (viewCodeName === RouteConst.ROUTE_MODAL_TAG) {
|
|
409
|
-
viewCodeName = routePath.pathNodes[depth].viewName;
|
|
410
|
-
}
|
|
411
|
-
if (viewCodeName === 'index') {
|
|
412
|
-
viewCodeName = ibiz.hub.defaultAppIndexViewName;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// 根据路由视图名称参数查询视图模型
|
|
416
|
-
const viewModel = await ibiz.hub.getAppView(viewCodeName);
|
|
417
|
-
|
|
418
|
-
// 找不到视图模型的返回空对象
|
|
419
|
-
if (!viewModel) {
|
|
420
|
-
throw new RuntimeError(`找不到视图${viewCodeName}`);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// !解析上下文参数,整合当前层级之前所有的上下文参数
|
|
424
|
-
const context: IParams = {};
|
|
425
|
-
// 合并appData里的应用上下文
|
|
426
|
-
if (ibiz.appData?.context) {
|
|
427
|
-
Object.assign(context, ibiz.appData.context);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// 合并路由上下文
|
|
431
|
-
// 合并路由应用上下文
|
|
432
|
-
if (routePath.appContext) {
|
|
433
|
-
Object.assign(context, routePath.appContext);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// 逐层合并视图上下文,第一层首页不合,它的上下文是资源路径属于子视图。
|
|
437
|
-
if (depth !== 1) {
|
|
438
|
-
for (let index = 0; index < depth; index++) {
|
|
439
|
-
const pathNode = routePath.pathNodes[index];
|
|
440
|
-
if (notNilEmpty(pathNode.context)) {
|
|
441
|
-
Object.assign(context, pathNode.context);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// 最后一级路由对应的视图才会解析视图参数
|
|
447
|
-
const { params, srfnav } = routePath.pathNodes[depth - 1];
|
|
448
|
-
|
|
449
|
-
return {
|
|
450
|
-
viewModel,
|
|
451
|
-
context,
|
|
452
|
-
params,
|
|
453
|
-
srfnav,
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* 获取指定层级的路由路径
|
|
459
|
-
* @author lxm
|
|
460
|
-
* @date 2023-06-21 06:08:32
|
|
461
|
-
* @export
|
|
462
|
-
* @param {Route} route
|
|
463
|
-
* @param {number} depth
|
|
464
|
-
* @return {*} {string}
|
|
465
|
-
*/
|
|
466
|
-
export function getNestedRoutePath(
|
|
467
|
-
route: Route,
|
|
468
|
-
depth: number,
|
|
469
|
-
noSrfNav: boolean = true,
|
|
470
|
-
): string {
|
|
471
|
-
// 当前路由层级低于指定层级的返回空
|
|
472
|
-
if (route.matched.length < depth) {
|
|
473
|
-
return '';
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
// 只有当前层级的路由的代名称的路由如login,404等直接返回path
|
|
477
|
-
if (route.matched.length === depth && route.name) {
|
|
478
|
-
return route.path;
|
|
479
|
-
}
|
|
480
|
-
const routePath = route2routePath(route);
|
|
481
|
-
if (routePath.pathNodes.length < depth) {
|
|
482
|
-
// 当前路由层级比指定层级少时,直接返回空字符串
|
|
483
|
-
return route.path;
|
|
484
|
-
}
|
|
485
|
-
if (routePath.pathNodes.length > depth) {
|
|
486
|
-
// 删除depth后面的节点
|
|
487
|
-
routePath.pathNodes = routePath.pathNodes.slice(0, depth);
|
|
488
|
-
}
|
|
489
|
-
if (noSrfNav) {
|
|
490
|
-
// 删除至nav
|
|
491
|
-
delete routePath.pathNodes[depth - 1].srfnav;
|
|
492
|
-
}
|
|
493
|
-
return routePath2string(routePath);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* 监听路由的变更,每次变更后都会触发回调
|
|
498
|
-
* 回调函数提供根据视图层级计算好的唯一标识currentKey,只有变了视图才需要刷新
|
|
499
|
-
* @author lxm
|
|
500
|
-
* @date 2023-05-09 12:52:36
|
|
501
|
-
* @param {(args: { currentKey: string; fullPath: string }) => void} callback
|
|
502
|
-
* @param {number} depth
|
|
503
|
-
*/
|
|
504
|
-
export function onRouteChange(
|
|
505
|
-
callback: (args: { currentKey: string; fullPath: string }) => void,
|
|
506
|
-
depth: number,
|
|
507
|
-
): void {
|
|
508
|
-
const route = useRoute();
|
|
509
|
-
if (!route) {
|
|
510
|
-
throw new RuntimeError('无法正确获取route,可能是依赖问题');
|
|
511
|
-
}
|
|
512
|
-
watch(
|
|
513
|
-
() => route?.path,
|
|
514
|
-
() => {
|
|
515
|
-
const currentKey = getNestedRoutePath(route, depth);
|
|
516
|
-
callback({ currentKey, fullPath: route.fullPath });
|
|
517
|
-
},
|
|
518
|
-
{ immediate: true },
|
|
519
|
-
);
|
|
520
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { IModalData } from '@ibiz-template/runtime';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 路由视图关闭回调
|
|
5
|
-
*
|
|
6
|
-
* @author chitanda
|
|
7
|
-
* @date 2023-07-13 21:07:51
|
|
8
|
-
* @export
|
|
9
|
-
* @class RouterCallbackItem
|
|
10
|
-
*/
|
|
11
|
-
export class RouterCallbackItem {
|
|
12
|
-
protected resolve?: (modal: IModalData) => void;
|
|
13
|
-
|
|
14
|
-
protected promise?: Promise<IModalData>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* 销毁定时器
|
|
18
|
-
*
|
|
19
|
-
* @author chitanda
|
|
20
|
-
* @date 2023-07-13 21:07:51
|
|
21
|
-
* @type {number}
|
|
22
|
-
*/
|
|
23
|
-
timeout?: number;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 是否已经有打开的视图认领此回调,如果在一定时间内没有被认领,则会被清除
|
|
27
|
-
*
|
|
28
|
-
* @author chitanda
|
|
29
|
-
* @date 2023-07-13 21:07:35
|
|
30
|
-
*/
|
|
31
|
-
isActivated = false;
|
|
32
|
-
|
|
33
|
-
constructor(
|
|
34
|
-
public from: string,
|
|
35
|
-
public to: string,
|
|
36
|
-
) {
|
|
37
|
-
ibiz.log.debug('openRouter: ', from, to);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 等待视图关闭
|
|
42
|
-
*
|
|
43
|
-
* @author chitanda
|
|
44
|
-
* @date 2023-07-13 21:07:34
|
|
45
|
-
* @return {*} {Promise<IModalData>}
|
|
46
|
-
*/
|
|
47
|
-
onWillDismiss(): Promise<IModalData> {
|
|
48
|
-
if (!this.promise) {
|
|
49
|
-
this.promise = new Promise(resolve => {
|
|
50
|
-
this.resolve = resolve;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return this.promise.then(modal => {
|
|
54
|
-
ibiz.log.debug('onWillDismiss: ', this.from, this.to, modal);
|
|
55
|
-
return modal;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 关闭视图
|
|
61
|
-
*
|
|
62
|
-
* @author chitanda
|
|
63
|
-
* @date 2023-07-13 21:07:06
|
|
64
|
-
* @param {IModalData} modal
|
|
65
|
-
*/
|
|
66
|
-
close(modal: IModalData): void {
|
|
67
|
-
ibiz.log.debug('closeRouter: ', this.from, this.to, modal);
|
|
68
|
-
if (this.resolve) {
|
|
69
|
-
this.resolve(modal);
|
|
70
|
-
this.resolve = undefined;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* 激活回调
|
|
76
|
-
*
|
|
77
|
-
* @author chitanda
|
|
78
|
-
* @date 2023-07-13 21:07:29
|
|
79
|
-
*/
|
|
80
|
-
active(): void {
|
|
81
|
-
ibiz.log.debug('activeRouter: ', this.from, this.to);
|
|
82
|
-
this.isActivated = true;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 销毁回调
|
|
87
|
-
*
|
|
88
|
-
* @author chitanda
|
|
89
|
-
* @date 2023-07-13 21:07:21
|
|
90
|
-
*/
|
|
91
|
-
destroy(): void {
|
|
92
|
-
ibiz.log.debug('destroyRouter: ', this.from, this.to);
|
|
93
|
-
if (this.resolve) {
|
|
94
|
-
this.resolve({ ok: false });
|
|
95
|
-
this.resolve = undefined;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|