@ibiz-template/vue3-components 0.0.1-alpha.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/es/common/app-icon/app-icon.d.ts +19 -0
- package/es/common/app-icon/app-icon.js +71 -0
- package/es/common/app-keep-alive/app-keep-alive.d.ts +47 -0
- package/es/common/app-keep-alive/app-keep-alive.js +297 -0
- package/es/common/app-keep-alive/scheduler.d.ts +39 -0
- package/es/common/app-keep-alive/scheduler.js +171 -0
- package/es/common/app-router-view/app-router-view.d.ts +30 -0
- package/es/common/app-router-view/app-router-view.js +73 -0
- package/es/common/app-user/app-user.d.ts +8 -0
- package/es/common/app-user/app-user.js +60 -0
- package/es/common/grid-pagination/grid-pagination.d.ts +41 -0
- package/es/common/grid-pagination/grid-pagination.js +84 -0
- package/es/common/grid-pagination/index.d.ts +40 -0
- package/es/common/grid-pagination/index.js +9 -0
- package/es/common/index.d.ts +8 -0
- package/es/common/index.js +8 -0
- package/es/common/quick-search/quick-search.d.ts +30 -0
- package/es/common/quick-search/quick-search.js +63 -0
- package/es/common/tab-page-exp/tab-page-exp.d.ts +69 -0
- package/es/common/tab-page-exp/tab-page-exp.js +117 -0
- package/es/control/app-menu/app-menu-provider.d.ts +13 -0
- package/es/control/app-menu/app-menu-provider.js +14 -0
- package/es/control/app-menu/app-menu.d.ts +54 -0
- package/es/control/app-menu/app-menu.js +178 -0
- package/es/control/app-menu/index.d.ts +53 -0
- package/es/control/app-menu/index.js +12 -0
- package/es/control/grid-control/grid-control.d.ts +158 -0
- package/es/control/grid-control/grid-control.util.d.ts +38 -0
- package/es/control/grid-control/grid-control.util.js +84 -0
- package/es/control/grid-control/grid-field-column/grid-field-column.d.ts +26 -0
- package/es/control/grid-control/grid-field-column-provider.d.ts +15 -0
- package/es/control/grid-control/grid-field-column-provider.js +20 -0
- package/es/control/grid-control/grid-provider.d.ts +13 -0
- package/es/control/grid-control/grid-provider.js +14 -0
- package/es/control/grid-control/index.d.ts +114 -0
- package/es/control/grid-control/index.js +23 -0
- package/es/control/index.d.ts +3 -0
- package/es/control/index.js +3 -0
- package/es/control/toolbar-control/index.d.ts +43 -0
- package/es/control/toolbar-control/index.js +12 -0
- package/es/control/toolbar-control/toolbar-control.d.ts +44 -0
- package/es/control/toolbar-control/toolbar-provider.d.ts +13 -0
- package/es/control/toolbar-control/toolbar-provider.js +14 -0
- package/es/index.d.ts +4 -0
- package/es/index.js +4 -0
- package/es/layout/app-layout/app-layout.d.ts +32 -0
- package/es/layout/control-base/control-base.d.ts +17 -0
- package/es/layout/control-base/control-base.js +42 -0
- package/es/layout/control-layout/control-layout.d.ts +19 -0
- package/es/layout/control-shell/control-shell.d.ts +18 -0
- package/es/layout/index.d.ts +10 -0
- package/es/layout/index.js +20 -0
- package/es/layout/md-view-base/md-view-base.d.ts +12 -0
- package/es/layout/md-view-base/md-view-base.js +35 -0
- package/es/layout/router-shell/router-shell.d.ts +27 -0
- package/es/layout/router-shell/router-shell.js +96 -0
- package/es/layout/view-base/view-base.d.ts +18 -0
- package/es/layout/view-layout/view-layout.d.ts +44 -0
- package/es/layout/view-shell/view-shell.d.ts +42 -0
- package/es/shims-vue.d.ts +5 -0
- package/es/util/install.d.ts +3 -0
- package/es/util/install.js +9 -0
- package/es/views/edit-view/index.d.ts +3 -0
- package/es/views/edit-view/index.js +9 -0
- package/es/views/edit-view/src/edit-view.css +6 -0
- package/es/views/edit-view/src/edit-view.d.ts +3 -0
- package/es/views/edit-view/src/edit-view.js +15 -0
- package/es/views/grid-view/grid-view-engine.d.ts +8 -0
- package/es/views/grid-view/grid-view-engine.js +21 -0
- package/es/views/grid-view/grid-view-provider.d.ts +13 -0
- package/es/views/grid-view/grid-view-provider.js +14 -0
- package/es/views/grid-view/grid-view.d.ts +32 -0
- package/es/views/grid-view/grid-view.js +64 -0
- package/es/views/grid-view/index.d.ts +32 -0
- package/es/views/grid-view/index.js +14 -0
- package/es/views/index-view/index-view-default.d.ts +22 -0
- package/es/views/index-view/index-view-default.js +117 -0
- package/es/views/index-view/index-view-engine.d.ts +6 -0
- package/es/views/index-view/index-view-engine.js +9 -0
- package/es/views/index-view/index-view-exp.d.ts +29 -0
- package/es/views/index-view/index-view-exp.js +177 -0
- package/es/views/index-view/index-view-provider.d.ts +13 -0
- package/es/views/index-view/index-view-provider.js +14 -0
- package/es/views/index-view/index-view.d.ts +44 -0
- package/es/views/index-view/index-view.js +155 -0
- package/es/views/index-view/index.d.ts +44 -0
- package/es/views/index-view/index.js +14 -0
- package/es/views/index.d.ts +4 -0
- package/es/views/index.js +6 -0
- package/lib/common/app-icon/app-icon.d.ts +19 -0
- package/lib/common/app-icon/app-icon.js +71 -0
- package/lib/common/app-keep-alive/app-keep-alive.d.ts +47 -0
- package/lib/common/app-keep-alive/app-keep-alive.js +297 -0
- package/lib/common/app-keep-alive/scheduler.d.ts +39 -0
- package/lib/common/app-keep-alive/scheduler.js +171 -0
- package/lib/common/app-router-view/app-router-view.d.ts +30 -0
- package/lib/common/app-router-view/app-router-view.js +73 -0
- package/lib/common/app-user/app-user.d.ts +8 -0
- package/lib/common/app-user/app-user.js +60 -0
- package/lib/common/grid-pagination/grid-pagination.d.ts +41 -0
- package/lib/common/grid-pagination/grid-pagination.js +84 -0
- package/lib/common/grid-pagination/index.d.ts +40 -0
- package/lib/common/grid-pagination/index.js +9 -0
- package/lib/common/index.d.ts +8 -0
- package/lib/common/index.js +66 -0
- package/lib/common/quick-search/quick-search.d.ts +30 -0
- package/lib/common/quick-search/quick-search.js +63 -0
- package/lib/common/tab-page-exp/tab-page-exp.d.ts +69 -0
- package/lib/common/tab-page-exp/tab-page-exp.js +117 -0
- package/lib/control/app-menu/app-menu-provider.d.ts +13 -0
- package/lib/control/app-menu/app-menu-provider.js +14 -0
- package/lib/control/app-menu/app-menu.d.ts +54 -0
- package/lib/control/app-menu/app-menu.js +178 -0
- package/lib/control/app-menu/index.d.ts +53 -0
- package/lib/control/app-menu/index.js +12 -0
- package/lib/control/grid-control/grid-control.d.ts +158 -0
- package/lib/control/grid-control/grid-control.util.d.ts +38 -0
- package/lib/control/grid-control/grid-control.util.js +84 -0
- package/lib/control/grid-control/grid-field-column/grid-field-column.d.ts +26 -0
- package/lib/control/grid-control/grid-field-column-provider.d.ts +15 -0
- package/lib/control/grid-control/grid-field-column-provider.js +20 -0
- package/lib/control/grid-control/grid-provider.d.ts +13 -0
- package/lib/control/grid-control/grid-provider.js +14 -0
- package/lib/control/grid-control/index.d.ts +114 -0
- package/lib/control/grid-control/index.js +24 -0
- package/lib/control/index.d.ts +3 -0
- package/lib/control/index.js +26 -0
- package/lib/control/toolbar-control/index.d.ts +43 -0
- package/lib/control/toolbar-control/index.js +12 -0
- package/lib/control/toolbar-control/toolbar-control.d.ts +44 -0
- package/lib/control/toolbar-control/toolbar-provider.d.ts +13 -0
- package/lib/control/toolbar-control/toolbar-provider.js +14 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +34 -0
- package/lib/layout/app-layout/app-layout.d.ts +32 -0
- package/lib/layout/control-base/control-base.d.ts +17 -0
- package/lib/layout/control-base/control-base.js +42 -0
- package/lib/layout/control-layout/control-layout.d.ts +19 -0
- package/lib/layout/control-shell/control-shell.d.ts +18 -0
- package/lib/layout/index.d.ts +10 -0
- package/lib/layout/index.js +44 -0
- package/lib/layout/md-view-base/md-view-base.d.ts +12 -0
- package/lib/layout/md-view-base/md-view-base.js +35 -0
- package/lib/layout/router-shell/router-shell.d.ts +27 -0
- package/lib/layout/router-shell/router-shell.js +96 -0
- package/lib/layout/view-base/view-base.d.ts +18 -0
- package/lib/layout/view-layout/view-layout.d.ts +44 -0
- package/lib/layout/view-shell/view-shell.d.ts +42 -0
- package/lib/shims-vue.d.ts +5 -0
- package/lib/util/install.d.ts +3 -0
- package/lib/util/install.js +9 -0
- package/lib/views/edit-view/index.d.ts +3 -0
- package/lib/views/edit-view/index.js +8 -0
- package/lib/views/edit-view/src/edit-view.css +6 -0
- package/lib/views/edit-view/src/edit-view.d.ts +3 -0
- package/lib/views/edit-view/src/edit-view.js +14 -0
- package/lib/views/grid-view/grid-view-engine.d.ts +8 -0
- package/lib/views/grid-view/grid-view-engine.js +21 -0
- package/lib/views/grid-view/grid-view-provider.d.ts +13 -0
- package/lib/views/grid-view/grid-view-provider.js +14 -0
- package/lib/views/grid-view/grid-view.d.ts +32 -0
- package/lib/views/grid-view/grid-view.js +64 -0
- package/lib/views/grid-view/index.d.ts +32 -0
- package/lib/views/grid-view/index.js +14 -0
- package/lib/views/index-view/index-view-default.d.ts +22 -0
- package/lib/views/index-view/index-view-default.js +117 -0
- package/lib/views/index-view/index-view-engine.d.ts +6 -0
- package/lib/views/index-view/index-view-engine.js +9 -0
- package/lib/views/index-view/index-view-exp.d.ts +29 -0
- package/lib/views/index-view/index-view-exp.js +177 -0
- package/lib/views/index-view/index-view-provider.d.ts +13 -0
- package/lib/views/index-view/index-view-provider.js +14 -0
- package/lib/views/index-view/index-view.d.ts +44 -0
- package/lib/views/index-view/index-view.js +155 -0
- package/lib/views/index-view/index.d.ts +44 -0
- package/lib/views/index-view/index.js +14 -0
- package/lib/views/index.d.ts +4 -0
- package/lib/views/index.js +20 -0
- package/package.json +71 -0
- package/src/common/app-col/app-col.tsx +90 -0
- package/src/common/app-icon/app-icon.tsx +58 -0
- package/src/common/app-keep-alive/app-keep-alive.ts +441 -0
- package/src/common/app-keep-alive/scheduler.ts +281 -0
- package/src/common/app-router-view/app-router-view.tsx +73 -0
- package/src/common/app-row/app-row.tsx +31 -0
- package/src/common/app-user/app-user.scss +32 -0
- package/src/common/app-user/app-user.tsx +61 -0
- package/src/common/index.ts +9 -0
- package/src/common/quick-search/quick-search.scss +15 -0
- package/src/common/quick-search/quick-search.tsx +59 -0
- package/src/common/tab-page-exp/tab-page-exp.scss +43 -0
- package/src/common/tab-page-exp/tab-page-exp.tsx +125 -0
- package/src/control/app-menu/app-menu-provider.ts +14 -0
- package/src/control/app-menu/app-menu-state.ts +20 -0
- package/src/control/app-menu/app-menu.controller.ts +97 -0
- package/src/control/app-menu/app-menu.scss +163 -0
- package/src/control/app-menu/app-menu.tsx +305 -0
- package/src/control/app-menu/index.ts +12 -0
- package/src/control/form/form/form-control.tsx +98 -0
- package/src/control/form/form/form-state.ts +39 -0
- package/src/control/form/form/form.controller.ts +260 -0
- package/src/control/form/form/form.scss +10 -0
- package/src/control/form/form/index.ts +30 -0
- package/src/control/form/form-detail/form-detail/form-detail-state.ts +92 -0
- package/src/control/form/form-detail/form-detail/form-detail.ts +214 -0
- package/src/control/form/form-detail/form-detail/index.ts +2 -0
- package/src/control/form/form-detail/form-group-panel/form-group-panel-provider.ts +27 -0
- package/src/control/form/form-detail/form-group-panel/form-group-panel-state.ts +29 -0
- package/src/control/form/form-detail/form-group-panel/form-group-panel.controller.ts +103 -0
- package/src/control/form/form-detail/form-group-panel/index.ts +3 -0
- package/src/control/form/form-detail/form-item/form-item-container/form-item-container.scss +90 -0
- package/src/control/form/form-detail/form-item/form-item-container/form-item-container.tsx +68 -0
- package/src/control/form/form-detail/form-item/form-item-provider.ts +28 -0
- package/src/control/form/form-detail/form-item/form-item-state.ts +48 -0
- package/src/control/form/form-detail/form-item/form-item.controller.ts +341 -0
- package/src/control/form/form-detail/form-item/form-item.scss +4 -0
- package/src/control/form/form-detail/form-item/form-item.tsx +69 -0
- package/src/control/form/form-detail/form-item/index.ts +3 -0
- package/src/control/form/form-detail/form-page/form-page-item.tsx +59 -0
- package/src/control/form/form-detail/form-page/form-page-provider.ts +27 -0
- package/src/control/form/form-detail/form-page/form-page-state.ts +12 -0
- package/src/control/form/form-detail/form-page/form-page.controller.ts +20 -0
- package/src/control/form/form-detail/form-page/form-page.scss +42 -0
- package/src/control/form/form-detail/form-page/form-page.tsx +56 -0
- package/src/control/form/form-detail/index.ts +3 -0
- package/src/control/form/index.ts +12 -0
- package/src/control/form/search-form/index.ts +15 -0
- package/src/control/form/search-form/search-form-provider.ts +14 -0
- package/src/control/form/search-form/search-form-state.ts +12 -0
- package/src/control/form/search-form/search-form.controller.ts +135 -0
- package/src/control/form/search-form/search-form.scss +48 -0
- package/src/control/form/search-form/search-form.tsx +70 -0
- package/src/control/grid/grid/grid-column.controller.ts +98 -0
- package/src/control/grid/grid/grid-control.tsx +174 -0
- package/src/control/grid/grid/grid-control.util.ts +135 -0
- package/src/control/grid/grid/grid-provider.ts +13 -0
- package/src/control/grid/grid/grid-row.controller.ts +114 -0
- package/src/control/grid/grid/grid-state.ts +20 -0
- package/src/control/grid/grid/grid.controller.ts +531 -0
- package/src/control/grid/grid/grid.scss +79 -0
- package/src/control/grid/grid-field-column/grid-field-column-provider.ts +26 -0
- package/src/control/grid/grid-field-column/grid-field-column.controller.ts +189 -0
- package/src/control/grid/grid-field-column/grid-field-column.scss +19 -0
- package/src/control/grid/grid-field-column/grid-field-column.tsx +87 -0
- package/src/control/grid/grid-pagination/grid-pagination.scss +7 -0
- package/src/control/grid/grid-pagination/grid-pagination.tsx +88 -0
- package/src/control/grid/index.ts +23 -0
- package/src/control/index.ts +4 -0
- package/src/control/panel/index.ts +23 -0
- package/src/control/panel/panel/panel-item-state.ts +73 -0
- package/src/control/panel/panel/panel-item.controller.ts +161 -0
- package/src/control/panel/panel/panel-state.ts +22 -0
- package/src/control/panel/panel/panel.controller.ts +256 -0
- package/src/control/panel/panel-container/index.ts +23 -0
- package/src/control/panel/panel-container/panel-container-provider.ts +28 -0
- package/src/control/panel/panel-container/panel-container-state.ts +12 -0
- package/src/control/panel/panel-container/panel-container.controller.ts +18 -0
- package/src/control/panel/panel-container/panel-container.scss +66 -0
- package/src/control/panel/panel-container/panel-container.tsx +93 -0
- package/src/control/panel/panel-ctrl-pos/index.ts +13 -0
- package/src/control/panel/panel-ctrl-pos/panel-ctrl-pos-provider.ts +28 -0
- package/src/control/panel/panel-ctrl-pos/panel-ctrl-pos.controller.ts +23 -0
- package/src/control/panel/panel-ctrl-pos/panel-ctrl-pos.tsx +39 -0
- package/src/control/panel/view-layout-panel/view-layout-panel-provider.ts +14 -0
- package/src/control/panel/view-layout-panel/view-layout-panel.controller.ts +62 -0
- package/src/control/panel/view-layout-panel/view-layout-panel.scss +3 -0
- package/src/control/panel/view-layout-panel/view-layout-panel.tsx +127 -0
- package/src/control/panel/view-layout-panel.json +141 -0
- package/src/control/toolbar/index.ts +12 -0
- package/src/control/toolbar/toolbar-control.scss +46 -0
- package/src/control/toolbar/toolbar-control.tsx +127 -0
- package/src/control/toolbar/toolbar-provider.ts +14 -0
- package/src/control/toolbar/toolbar-state.ts +31 -0
- package/src/control/toolbar/toolbar.controllerr.ts +112 -0
- package/src/editor/index.ts +14 -0
- package/src/editor/text-box/ibiz-input/ibiz-input.scss +48 -0
- package/src/editor/text-box/ibiz-input/ibiz-input.tsx +176 -0
- package/src/editor/text-box/index.ts +1 -0
- package/src/editor/text-box/text-box-provider.ts +39 -0
- package/src/editor/text-box/text-box.controller.ts +21 -0
- package/src/index.ts +57 -0
- package/src/layout/app-layout/app-layout.scss +133 -0
- package/src/layout/app-layout/app-layout.tsx +149 -0
- package/src/layout/control-base/control-base.tsx +37 -0
- package/src/layout/control-layout/control-layout.scss +4 -0
- package/src/layout/control-layout/control-layout.tsx +29 -0
- package/src/layout/index.ts +15 -0
- package/src/layout/md-view-base/md-view-base.tsx +69 -0
- package/src/layout/view-base/view-base.scss +11 -0
- package/src/layout/view-base/view-base.tsx +147 -0
- package/src/layout/view-layout/view-layout.scss +198 -0
- package/src/layout/view-layout/view-layout.tsx +115 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/util/install.ts +11 -0
- package/src/views/grid-view/grid-view-engine.ts +68 -0
- package/src/views/grid-view/index.ts +12 -0
- package/src/views/index-view/index-view-default.ts +168 -0
- package/src/views/index-view/index-view-engine.ts +10 -0
- package/src/views/index-view/index-view-exp.ts +261 -0
- package/src/views/index-view/index-view-provider.ts +14 -0
- package/src/views/index-view/index-view.tsx +249 -0
- package/src/views/index-view/index.ts +14 -0
- package/src/views/index.ts +3 -0
- package/src/views/view/ibiz-view.tsx +49 -0
- package/src/views/view/index.ts +12 -0
- package/src/views/view/view-provider.ts +14 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PropType, VNode } from 'vue';
|
|
2
|
+
export declare const AppIcon: import("vue").DefineComponent<{
|
|
3
|
+
icon: {
|
|
4
|
+
type: PropType<ISysImage>;
|
|
5
|
+
};
|
|
6
|
+
size: {
|
|
7
|
+
type: PropType<"small" | "medium" | "large">;
|
|
8
|
+
};
|
|
9
|
+
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}> | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
|
+
icon: {
|
|
13
|
+
type: PropType<ISysImage>;
|
|
14
|
+
};
|
|
15
|
+
size: {
|
|
16
|
+
type: PropType<"small" | "medium" | "large">;
|
|
17
|
+
};
|
|
18
|
+
}>>, {}>;
|
|
19
|
+
export default AppIcon;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineComponent, computed, createVNode, resolveComponent } from "vue";
|
|
2
|
+
import { useNamespace } from "@ibiz-template/vue3-util";
|
|
3
|
+
const AppIcon = /* @__PURE__ */ defineComponent({
|
|
4
|
+
name: "AppIcon",
|
|
5
|
+
props: {
|
|
6
|
+
icon: {
|
|
7
|
+
type: Object
|
|
8
|
+
},
|
|
9
|
+
size: {
|
|
10
|
+
type: String
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
setup(props) {
|
|
14
|
+
const ns = useNamespace("icon");
|
|
15
|
+
const BaseUrl = `${ibiz.env.assetsUrl}/img/`;
|
|
16
|
+
function getContent(icon) {
|
|
17
|
+
if (icon) {
|
|
18
|
+
if (icon.cssClass) {
|
|
19
|
+
if (icon.cssClass.indexOf("fa-") !== -1) {
|
|
20
|
+
return createVNode("i", {
|
|
21
|
+
"class": [ns.b(), icon.cssClass]
|
|
22
|
+
}, null);
|
|
23
|
+
}
|
|
24
|
+
return createVNode(resolveComponent("ion-icon"), {
|
|
25
|
+
"class": ns.b(),
|
|
26
|
+
"name": icon.cssClass
|
|
27
|
+
}, null);
|
|
28
|
+
}
|
|
29
|
+
if (icon.imagePath) {
|
|
30
|
+
if (icon.imagePath.endsWith("svg")) {
|
|
31
|
+
if (icon.imagePath.startsWith("http")) {
|
|
32
|
+
return createVNode(resolveComponent("ion-icon"), {
|
|
33
|
+
"class": ns.b(),
|
|
34
|
+
"src": icon.imagePath
|
|
35
|
+
}, null);
|
|
36
|
+
}
|
|
37
|
+
return createVNode(resolveComponent("ion-icon"), {
|
|
38
|
+
"src": BaseUrl + icon.imagePath,
|
|
39
|
+
"class": ns.b()
|
|
40
|
+
}, null);
|
|
41
|
+
}
|
|
42
|
+
if (icon.imagePath.startsWith("http")) {
|
|
43
|
+
return createVNode("img", {
|
|
44
|
+
"class": ns.b(),
|
|
45
|
+
"src": icon.imagePath
|
|
46
|
+
}, null);
|
|
47
|
+
}
|
|
48
|
+
return createVNode("img", {
|
|
49
|
+
"class": ns.b(),
|
|
50
|
+
"src": BaseUrl + icon.imagePath
|
|
51
|
+
}, null);
|
|
52
|
+
}
|
|
53
|
+
if (icon.rawContent) {
|
|
54
|
+
return createVNode("img", {
|
|
55
|
+
"class": ns.b(),
|
|
56
|
+
"src": icon.rawContent
|
|
57
|
+
}, null);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const content = computed(() => {
|
|
63
|
+
return getContent(props.icon);
|
|
64
|
+
});
|
|
65
|
+
return () => content.value;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export {
|
|
69
|
+
AppIcon,
|
|
70
|
+
AppIcon as default
|
|
71
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ComponentInternalInstance, ConcreteComponent, TransitionHooks, VNode, VNodeProps } from 'vue';
|
|
2
|
+
import { queuePostFlushCb } from './scheduler';
|
|
3
|
+
export declare const enum ShapeFlags {
|
|
4
|
+
ELEMENT = 1,
|
|
5
|
+
FUNCTIONAL_COMPONENT = 2,
|
|
6
|
+
STATEFUL_COMPONENT = 4,
|
|
7
|
+
TEXT_CHILDREN = 8,
|
|
8
|
+
ARRAY_CHILDREN = 16,
|
|
9
|
+
SLOTS_CHILDREN = 32,
|
|
10
|
+
TELEPORT = 64,
|
|
11
|
+
SUSPENSE = 128,
|
|
12
|
+
COMPONENT_SHOULD_KEEP_ALIVE = 256,
|
|
13
|
+
COMPONENT_KEPT_ALIVE = 512,
|
|
14
|
+
COMPONENT = 6
|
|
15
|
+
}
|
|
16
|
+
export declare const enum MoveType {
|
|
17
|
+
ENTER = 0,
|
|
18
|
+
LEAVE = 1,
|
|
19
|
+
REORDER = 2
|
|
20
|
+
}
|
|
21
|
+
export interface ComponentRenderContext {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
_: ComponentInternalInstance;
|
|
24
|
+
}
|
|
25
|
+
type MatchPattern = string | RegExp | (string | RegExp)[];
|
|
26
|
+
export interface KeepAliveProps {
|
|
27
|
+
keyList: string[];
|
|
28
|
+
include?: MatchPattern;
|
|
29
|
+
exclude?: MatchPattern;
|
|
30
|
+
max?: number | string;
|
|
31
|
+
}
|
|
32
|
+
export declare const isKeepAlive: (vnode: VNode) => boolean;
|
|
33
|
+
export declare const AppKeepAlive: {
|
|
34
|
+
new (): {
|
|
35
|
+
$props: VNodeProps & KeepAliveProps;
|
|
36
|
+
};
|
|
37
|
+
__isKeepAlive: true;
|
|
38
|
+
};
|
|
39
|
+
export declare const getComponentName: (Component: ConcreteComponent, includeInferred?: boolean) => string | false | undefined;
|
|
40
|
+
export declare const isFunction: (val: unknown) => val is Function;
|
|
41
|
+
export declare const isAsyncWrapper: (i: ComponentInternalInstance | VNode) => boolean;
|
|
42
|
+
export declare function setTransitionHooks(vnode: VNode, hooks: TransitionHooks): void;
|
|
43
|
+
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
|
44
|
+
export declare const queuePostRenderEffect: typeof queuePostFlushCb;
|
|
45
|
+
export declare function invokeVNodeHook(hook: any, instance: ComponentInternalInstance | null, vnode: VNode, prevVNode?: VNode | null): void;
|
|
46
|
+
export declare const devtoolsComponentAdded: (component: ComponentInternalInstance) => void;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { callWithAsyncErrorHandling, getCurrentInstance, watch, onMounted, onUpdated, onBeforeUnmount, isVNode, cloneVNode } from "vue";
|
|
2
|
+
import { queuePostFlushCb } from "./scheduler";
|
|
3
|
+
var ShapeFlags = /* @__PURE__ */ ((ShapeFlags2) => {
|
|
4
|
+
ShapeFlags2[ShapeFlags2["ELEMENT"] = 1] = "ELEMENT";
|
|
5
|
+
ShapeFlags2[ShapeFlags2["FUNCTIONAL_COMPONENT"] = 2] = "FUNCTIONAL_COMPONENT";
|
|
6
|
+
ShapeFlags2[ShapeFlags2["STATEFUL_COMPONENT"] = 4] = "STATEFUL_COMPONENT";
|
|
7
|
+
ShapeFlags2[ShapeFlags2["TEXT_CHILDREN"] = 8] = "TEXT_CHILDREN";
|
|
8
|
+
ShapeFlags2[ShapeFlags2["ARRAY_CHILDREN"] = 16] = "ARRAY_CHILDREN";
|
|
9
|
+
ShapeFlags2[ShapeFlags2["SLOTS_CHILDREN"] = 32] = "SLOTS_CHILDREN";
|
|
10
|
+
ShapeFlags2[ShapeFlags2["TELEPORT"] = 64] = "TELEPORT";
|
|
11
|
+
ShapeFlags2[ShapeFlags2["SUSPENSE"] = 128] = "SUSPENSE";
|
|
12
|
+
ShapeFlags2[ShapeFlags2["COMPONENT_SHOULD_KEEP_ALIVE"] = 256] = "COMPONENT_SHOULD_KEEP_ALIVE";
|
|
13
|
+
ShapeFlags2[ShapeFlags2["COMPONENT_KEPT_ALIVE"] = 512] = "COMPONENT_KEPT_ALIVE";
|
|
14
|
+
ShapeFlags2[ShapeFlags2["COMPONENT"] = 6] = "COMPONENT";
|
|
15
|
+
return ShapeFlags2;
|
|
16
|
+
})(ShapeFlags || {});
|
|
17
|
+
var MoveType = /* @__PURE__ */ ((MoveType2) => {
|
|
18
|
+
MoveType2[MoveType2["ENTER"] = 0] = "ENTER";
|
|
19
|
+
MoveType2[MoveType2["LEAVE"] = 1] = "LEAVE";
|
|
20
|
+
MoveType2[MoveType2["REORDER"] = 2] = "REORDER";
|
|
21
|
+
return MoveType2;
|
|
22
|
+
})(MoveType || {});
|
|
23
|
+
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
|
24
|
+
const KeepAliveImpl = {
|
|
25
|
+
name: `AppKeepAlive`,
|
|
26
|
+
// Marker for special handling inside the renderer. We are not using a ===
|
|
27
|
+
// check directly on KeepAlive in the renderer, because importing it directly
|
|
28
|
+
// would prevent it from being tree-shaken.
|
|
29
|
+
__isKeepAlive: true,
|
|
30
|
+
props: {
|
|
31
|
+
include: [String, RegExp, Array],
|
|
32
|
+
exclude: [String, RegExp, Array],
|
|
33
|
+
max: [String, Number],
|
|
34
|
+
keyList: [Array]
|
|
35
|
+
},
|
|
36
|
+
setup(props, { slots }) {
|
|
37
|
+
const instance = getCurrentInstance();
|
|
38
|
+
const sharedContext = instance.ctx;
|
|
39
|
+
const cache = /* @__PURE__ */ new Map();
|
|
40
|
+
const keys = /* @__PURE__ */ new Set();
|
|
41
|
+
let current = null;
|
|
42
|
+
{
|
|
43
|
+
instance.__v_cache = cache;
|
|
44
|
+
}
|
|
45
|
+
const parentSuspense = instance.suspense;
|
|
46
|
+
const {
|
|
47
|
+
renderer: {
|
|
48
|
+
p: patch,
|
|
49
|
+
m: move,
|
|
50
|
+
um: _unmount,
|
|
51
|
+
o: { createElement }
|
|
52
|
+
}
|
|
53
|
+
} = sharedContext;
|
|
54
|
+
const storageContainer = createElement("div");
|
|
55
|
+
sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
|
56
|
+
const instance2 = vnode.component;
|
|
57
|
+
move(vnode, container, anchor, 0, parentSuspense);
|
|
58
|
+
patch(
|
|
59
|
+
instance2.vnode,
|
|
60
|
+
vnode,
|
|
61
|
+
container,
|
|
62
|
+
anchor,
|
|
63
|
+
instance2,
|
|
64
|
+
parentSuspense,
|
|
65
|
+
isSVG,
|
|
66
|
+
vnode.slotScopeIds,
|
|
67
|
+
optimized
|
|
68
|
+
);
|
|
69
|
+
queuePostRenderEffect(() => {
|
|
70
|
+
instance2.isDeactivated = false;
|
|
71
|
+
if (instance2.a) {
|
|
72
|
+
invokeArrayFns(instance2.a);
|
|
73
|
+
}
|
|
74
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
75
|
+
if (vnodeHook) {
|
|
76
|
+
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
{
|
|
80
|
+
devtoolsComponentAdded(instance2);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
sharedContext.deactivate = (vnode) => {
|
|
84
|
+
const instance2 = vnode.component;
|
|
85
|
+
move(vnode, storageContainer, null, 1, parentSuspense);
|
|
86
|
+
queuePostRenderEffect(() => {
|
|
87
|
+
if (instance2.da) {
|
|
88
|
+
invokeArrayFns(instance2.da);
|
|
89
|
+
}
|
|
90
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
91
|
+
if (vnodeHook) {
|
|
92
|
+
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
93
|
+
}
|
|
94
|
+
instance2.isDeactivated = true;
|
|
95
|
+
});
|
|
96
|
+
{
|
|
97
|
+
devtoolsComponentAdded(instance2);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
function unmount(vnode) {
|
|
101
|
+
resetShapeFlag(vnode);
|
|
102
|
+
_unmount(vnode, instance, parentSuspense, true);
|
|
103
|
+
}
|
|
104
|
+
function pruneCache(filter) {
|
|
105
|
+
cache.forEach((vnode, key) => {
|
|
106
|
+
const name = getComponentName(vnode.type);
|
|
107
|
+
if (name && (!filter || !filter(name))) {
|
|
108
|
+
pruneCacheEntry(key);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function pruneCache2(filter) {
|
|
113
|
+
cache.forEach((vnode, key) => {
|
|
114
|
+
const name = vnode.key;
|
|
115
|
+
if (name && (filter && filter(name))) {
|
|
116
|
+
pruneCacheEntry(key);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function pruneCacheEntry(key) {
|
|
121
|
+
const cached = cache.get(key);
|
|
122
|
+
if (!current || cached.type !== current.type) {
|
|
123
|
+
unmount(cached);
|
|
124
|
+
} else if (current) {
|
|
125
|
+
resetShapeFlag(current);
|
|
126
|
+
}
|
|
127
|
+
cache.delete(key);
|
|
128
|
+
keys.delete(key);
|
|
129
|
+
}
|
|
130
|
+
watch(
|
|
131
|
+
() => [props.include, props.exclude, props.keyList],
|
|
132
|
+
([include, exclude, keyList]) => {
|
|
133
|
+
include && pruneCache((name) => matches(include, name));
|
|
134
|
+
exclude && pruneCache((name) => !matches(exclude, name));
|
|
135
|
+
keyList && pruneCache2((name) => !matches(keyList, name));
|
|
136
|
+
},
|
|
137
|
+
// prune post-render after `current` has been updated
|
|
138
|
+
{ flush: "post", deep: true }
|
|
139
|
+
);
|
|
140
|
+
let pendingCacheKey = null;
|
|
141
|
+
const cacheSubtree = () => {
|
|
142
|
+
if (pendingCacheKey != null) {
|
|
143
|
+
cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
onMounted(cacheSubtree);
|
|
147
|
+
onUpdated(cacheSubtree);
|
|
148
|
+
onBeforeUnmount(() => {
|
|
149
|
+
for (const key in cache) {
|
|
150
|
+
pruneCacheEntry(key);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
return () => {
|
|
154
|
+
pendingCacheKey = null;
|
|
155
|
+
if (!slots.default) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
const children = slots.default();
|
|
159
|
+
const rawVNode = children[0];
|
|
160
|
+
if (children.length > 1) {
|
|
161
|
+
console.log(`KeepAlive should contain exactly one component child.`);
|
|
162
|
+
current = null;
|
|
163
|
+
return children;
|
|
164
|
+
}
|
|
165
|
+
if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
|
166
|
+
current = null;
|
|
167
|
+
return rawVNode;
|
|
168
|
+
}
|
|
169
|
+
let vnode = getInnerChild(rawVNode);
|
|
170
|
+
const comp = vnode.type;
|
|
171
|
+
const name = getComponentName(
|
|
172
|
+
isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
|
173
|
+
);
|
|
174
|
+
const { include, exclude, max, keyList } = props;
|
|
175
|
+
const slotKey = vnode.key;
|
|
176
|
+
if (
|
|
177
|
+
// 包括并且不匹配的
|
|
178
|
+
include && (!name || !matches(include, name)) || // 排除并且匹配的
|
|
179
|
+
exclude && name && matches(exclude, name) || // keyList中存在并且不匹配的
|
|
180
|
+
keyList && !slotKey && !matches(keyList, slotKey)
|
|
181
|
+
) {
|
|
182
|
+
current = vnode;
|
|
183
|
+
return rawVNode;
|
|
184
|
+
}
|
|
185
|
+
const key = vnode.key == null ? comp : vnode.key;
|
|
186
|
+
const cachedVNode = cache.get(key);
|
|
187
|
+
if (vnode.el) {
|
|
188
|
+
vnode = cloneVNode(vnode);
|
|
189
|
+
if (rawVNode.shapeFlag & 128) {
|
|
190
|
+
rawVNode.ssContent = vnode;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
pendingCacheKey = key;
|
|
194
|
+
if (cachedVNode) {
|
|
195
|
+
vnode.el = cachedVNode.el;
|
|
196
|
+
vnode.component = cachedVNode.component;
|
|
197
|
+
if (vnode.transition) {
|
|
198
|
+
setTransitionHooks(vnode, vnode.transition);
|
|
199
|
+
}
|
|
200
|
+
vnode.shapeFlag |= 512;
|
|
201
|
+
keys.delete(key);
|
|
202
|
+
keys.add(key);
|
|
203
|
+
} else {
|
|
204
|
+
keys.add(key);
|
|
205
|
+
if (max && keys.size > parseInt(max, 10)) {
|
|
206
|
+
pruneCacheEntry(keys.values().next().value);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
vnode.shapeFlag |= 256;
|
|
210
|
+
current = vnode;
|
|
211
|
+
vnode.keepAlive = true;
|
|
212
|
+
vnode.curPath = slotKey;
|
|
213
|
+
return vnode;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const AppKeepAlive = KeepAliveImpl;
|
|
218
|
+
function matches(pattern, name) {
|
|
219
|
+
if (Array.isArray(pattern)) {
|
|
220
|
+
return pattern.indexOf(name) > -1;
|
|
221
|
+
}
|
|
222
|
+
if (typeof pattern === "string") {
|
|
223
|
+
return pattern.split(",").includes(name);
|
|
224
|
+
}
|
|
225
|
+
if (isRegExp(pattern)) {
|
|
226
|
+
return pattern.test(name);
|
|
227
|
+
}
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
function resetShapeFlag(vnode) {
|
|
231
|
+
vnode.shapeFlag &= ~256;
|
|
232
|
+
vnode.shapeFlag &= ~512;
|
|
233
|
+
}
|
|
234
|
+
function getInnerChild(vnode) {
|
|
235
|
+
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
|
236
|
+
}
|
|
237
|
+
function isRegExp(v) {
|
|
238
|
+
return Object.prototype.toString.call(v) === "[object RegExp]";
|
|
239
|
+
}
|
|
240
|
+
const getComponentName = (Component, includeInferred = true) => {
|
|
241
|
+
return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
|
242
|
+
};
|
|
243
|
+
const isFunction = (val) => typeof val === "function";
|
|
244
|
+
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
245
|
+
function setTransitionHooks(vnode, hooks) {
|
|
246
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
247
|
+
setTransitionHooks(vnode.component.subTree, hooks);
|
|
248
|
+
} else {
|
|
249
|
+
vnode.transition = hooks;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const invokeArrayFns = (fns, arg) => {
|
|
253
|
+
for (let i = 0; i < fns.length; i++) {
|
|
254
|
+
fns[i](arg);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
const queuePostRenderEffect = queuePostFlushCb;
|
|
258
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
259
|
+
callWithAsyncErrorHandling(hook, instance, 7, [
|
|
260
|
+
vnode,
|
|
261
|
+
prevVNode
|
|
262
|
+
]);
|
|
263
|
+
}
|
|
264
|
+
const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
|
|
265
|
+
"component:added"
|
|
266
|
+
/* COMPONENT_ADDED */
|
|
267
|
+
);
|
|
268
|
+
function createDevtoolsComponentHook(hook) {
|
|
269
|
+
return (component) => {
|
|
270
|
+
emit(
|
|
271
|
+
hook,
|
|
272
|
+
component.appContext.app,
|
|
273
|
+
component.uid,
|
|
274
|
+
component.parent ? component.parent.uid : void 0,
|
|
275
|
+
component
|
|
276
|
+
);
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function emit(event, ...args) {
|
|
280
|
+
if (window.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
|
|
281
|
+
window.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit(event, ...args);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
export {
|
|
285
|
+
AppKeepAlive,
|
|
286
|
+
MoveType,
|
|
287
|
+
ShapeFlags,
|
|
288
|
+
devtoolsComponentAdded,
|
|
289
|
+
getComponentName,
|
|
290
|
+
invokeArrayFns,
|
|
291
|
+
invokeVNodeHook,
|
|
292
|
+
isAsyncWrapper,
|
|
293
|
+
isFunction,
|
|
294
|
+
isKeepAlive,
|
|
295
|
+
queuePostRenderEffect,
|
|
296
|
+
setTransitionHooks
|
|
297
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ComponentInternalInstance } from 'vue';
|
|
2
|
+
export declare const NOOP: () => void;
|
|
3
|
+
export interface SchedulerJob extends Function {
|
|
4
|
+
id?: number;
|
|
5
|
+
pre?: boolean;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
computed?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Indicates whether the effect is allowed to recursively trigger itself
|
|
10
|
+
* when managed by the scheduler.
|
|
11
|
+
*
|
|
12
|
+
* By default, a job cannot trigger itself because some built-in method calls,
|
|
13
|
+
* e.g. Array.prototype.push actually performs reads as well (#1740) which
|
|
14
|
+
* can lead to confusing infinite loops.
|
|
15
|
+
* The allowed cases are component update functions and watch callbacks.
|
|
16
|
+
* Component update functions may update child component props, which in turn
|
|
17
|
+
* trigger flush: "pre" watch callbacks that mutates state that the parent
|
|
18
|
+
* relies on (#1801). Watch callbacks doesn't track its dependencies so if it
|
|
19
|
+
* triggers itself again, it's likely intentional and it is the user's
|
|
20
|
+
* responsibility to perform recursive state mutation that eventually
|
|
21
|
+
* stabilizes (#1727).
|
|
22
|
+
*/
|
|
23
|
+
allowRecurse?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Attached by renderer.ts when setting up a component's render effect
|
|
26
|
+
* Used to obtain component information when reporting max recursive updates.
|
|
27
|
+
* dev only.
|
|
28
|
+
*/
|
|
29
|
+
ownerInstance?: ComponentInternalInstance;
|
|
30
|
+
}
|
|
31
|
+
export type SchedulerJobs = SchedulerJob | SchedulerJob[];
|
|
32
|
+
type CountMap = Map<SchedulerJob, number>;
|
|
33
|
+
export declare function nextTick<T = void>(this: T, fn?: () => void): Promise<void>;
|
|
34
|
+
export declare function queueJob(job: SchedulerJob): void;
|
|
35
|
+
export declare function invalidateJob(job: SchedulerJob): void;
|
|
36
|
+
export declare function queuePostFlushCb(cb: SchedulerJobs): void;
|
|
37
|
+
export declare function flushPreFlushCbs(seen?: CountMap, i?: number): void;
|
|
38
|
+
export declare function flushPostFlushCbs(seen?: CountMap): void;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { callWithErrorHandling } from "vue";
|
|
2
|
+
import { getComponentName } from "./app-keep-alive";
|
|
3
|
+
const __DEV__ = true;
|
|
4
|
+
const NOOP = () => {
|
|
5
|
+
};
|
|
6
|
+
let isFlushing = false;
|
|
7
|
+
let isFlushPending = false;
|
|
8
|
+
const queue = [];
|
|
9
|
+
let flushIndex = 0;
|
|
10
|
+
const pendingPostFlushCbs = [];
|
|
11
|
+
let activePostFlushCbs = null;
|
|
12
|
+
let postFlushIndex = 0;
|
|
13
|
+
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
14
|
+
let currentFlushPromise = null;
|
|
15
|
+
const RECURSION_LIMIT = 100;
|
|
16
|
+
function nextTick(fn) {
|
|
17
|
+
const p = currentFlushPromise || resolvedPromise;
|
|
18
|
+
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
19
|
+
}
|
|
20
|
+
function findInsertionIndex(id) {
|
|
21
|
+
let start = flushIndex + 1;
|
|
22
|
+
let end = queue.length;
|
|
23
|
+
while (start < end) {
|
|
24
|
+
const middle = start + end >>> 1;
|
|
25
|
+
const middleJobId = getId(queue[middle]);
|
|
26
|
+
middleJobId < id ? start = middle + 1 : end = middle;
|
|
27
|
+
}
|
|
28
|
+
return start;
|
|
29
|
+
}
|
|
30
|
+
function queueJob(job) {
|
|
31
|
+
if (!queue.length || !queue.includes(
|
|
32
|
+
job,
|
|
33
|
+
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
34
|
+
)) {
|
|
35
|
+
if (job.id == null) {
|
|
36
|
+
queue.push(job);
|
|
37
|
+
} else {
|
|
38
|
+
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
39
|
+
}
|
|
40
|
+
queueFlush();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function queueFlush() {
|
|
44
|
+
if (!isFlushing && !isFlushPending) {
|
|
45
|
+
isFlushPending = true;
|
|
46
|
+
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function invalidateJob(job) {
|
|
50
|
+
const i = queue.indexOf(job);
|
|
51
|
+
if (i > flushIndex) {
|
|
52
|
+
queue.splice(i, 1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function queuePostFlushCb(cb) {
|
|
56
|
+
if (!Array.isArray(cb)) {
|
|
57
|
+
if (!activePostFlushCbs || !activePostFlushCbs.includes(
|
|
58
|
+
cb,
|
|
59
|
+
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
60
|
+
)) {
|
|
61
|
+
pendingPostFlushCbs.push(cb);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
pendingPostFlushCbs.push(...cb);
|
|
65
|
+
}
|
|
66
|
+
queueFlush();
|
|
67
|
+
}
|
|
68
|
+
function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
69
|
+
{
|
|
70
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
71
|
+
}
|
|
72
|
+
for (; i < queue.length; i++) {
|
|
73
|
+
const cb = queue[i];
|
|
74
|
+
if (cb && cb.pre) {
|
|
75
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
queue.splice(i, 1);
|
|
79
|
+
i--;
|
|
80
|
+
cb();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function flushPostFlushCbs(seen) {
|
|
85
|
+
if (pendingPostFlushCbs.length) {
|
|
86
|
+
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
87
|
+
pendingPostFlushCbs.length = 0;
|
|
88
|
+
if (activePostFlushCbs) {
|
|
89
|
+
activePostFlushCbs.push(...deduped);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
activePostFlushCbs = deduped;
|
|
93
|
+
{
|
|
94
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
95
|
+
}
|
|
96
|
+
activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
|
|
97
|
+
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
98
|
+
if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
activePostFlushCbs[postFlushIndex]();
|
|
102
|
+
}
|
|
103
|
+
activePostFlushCbs = null;
|
|
104
|
+
postFlushIndex = 0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
108
|
+
const comparator = (a, b) => {
|
|
109
|
+
const diff = getId(a) - getId(b);
|
|
110
|
+
if (diff === 0) {
|
|
111
|
+
if (a.pre && !b.pre)
|
|
112
|
+
return -1;
|
|
113
|
+
if (b.pre && !a.pre)
|
|
114
|
+
return 1;
|
|
115
|
+
}
|
|
116
|
+
return diff;
|
|
117
|
+
};
|
|
118
|
+
function flushJobs(seen) {
|
|
119
|
+
isFlushPending = false;
|
|
120
|
+
isFlushing = true;
|
|
121
|
+
{
|
|
122
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
123
|
+
}
|
|
124
|
+
queue.sort(comparator);
|
|
125
|
+
const check = (job) => checkRecursiveUpdates(seen, job);
|
|
126
|
+
try {
|
|
127
|
+
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
128
|
+
const job = queue[flushIndex];
|
|
129
|
+
if (job && job.active !== false) {
|
|
130
|
+
if (__DEV__ && check(job)) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
callWithErrorHandling(job, null, 14);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} finally {
|
|
137
|
+
flushIndex = 0;
|
|
138
|
+
queue.length = 0;
|
|
139
|
+
flushPostFlushCbs(seen);
|
|
140
|
+
isFlushing = false;
|
|
141
|
+
currentFlushPromise = null;
|
|
142
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
143
|
+
flushJobs(seen);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function checkRecursiveUpdates(seen, fn) {
|
|
148
|
+
if (!seen.has(fn)) {
|
|
149
|
+
seen.set(fn, 1);
|
|
150
|
+
} else {
|
|
151
|
+
const count = seen.get(fn);
|
|
152
|
+
if (count > RECURSION_LIMIT) {
|
|
153
|
+
const instance = fn.ownerInstance;
|
|
154
|
+
const componentName = instance && getComponentName(instance.type);
|
|
155
|
+
console.warn(
|
|
156
|
+
`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`
|
|
157
|
+
);
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
seen.set(fn, count + 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export {
|
|
164
|
+
NOOP,
|
|
165
|
+
flushPostFlushCbs,
|
|
166
|
+
flushPreFlushCbs,
|
|
167
|
+
invalidateJob,
|
|
168
|
+
nextTick,
|
|
169
|
+
queueJob,
|
|
170
|
+
queuePostFlushCb
|
|
171
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PropType, VNode } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 只会第一次绘制的时候绘制路由相关的内容,后面路由导致的router-view的回调都屏蔽了。
|
|
4
|
+
* 通过变更manualKey,来强制刷新router-view的slot回调。并且吧manualKey传给Component的key,搭配AppKeepAlive可以缓存组件
|
|
5
|
+
*/
|
|
6
|
+
export declare const AppRouterView: import("vue").DefineComponent<{
|
|
7
|
+
name: {
|
|
8
|
+
type: PropType<string>;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
route: PropType<RouteLocationNormalizedLoaded>;
|
|
12
|
+
manualKey: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
};
|
|
15
|
+
}, {
|
|
16
|
+
renderComp: (Component: VNode, _route: any) => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}> | undefined;
|
|
19
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
name: {
|
|
21
|
+
type: PropType<string>;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
route: PropType<RouteLocationNormalizedLoaded>;
|
|
25
|
+
manualKey: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
};
|
|
28
|
+
}>>, {
|
|
29
|
+
name: string;
|
|
30
|
+
}>;
|