@ditari/bsui 5.1.4 → 5.1.6
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/cjs/components/card/Card.cjs +1 -1
- package/dist/cjs/components/card/Card.cjs.map +1 -1
- package/dist/cjs/components/dic/DicReplace.cjs +2 -2
- package/dist/cjs/components/dic/DicReplace.cjs.map +1 -1
- package/dist/cjs/components/layout/Layout.vue2.cjs +4 -18
- package/dist/cjs/components/layout/Layout.vue2.cjs.map +1 -1
- package/dist/cjs/components/layout/components/layout/HeaderLayout.vue2.cjs +3 -25
- package/dist/cjs/components/layout/components/layout/HeaderLayout.vue2.cjs.map +1 -1
- package/dist/cjs/components/tab/Tab.vue2.cjs +264 -180
- package/dist/cjs/components/tab/Tab.vue2.cjs.map +1 -1
- package/dist/cjs/components/table/Table.cjs +2 -2
- package/dist/cjs/components/table/Table.cjs.map +1 -1
- package/dist/cjs/components/table-form/TableForm.cjs +2 -2
- package/dist/cjs/components/table-form/TableForm.cjs.map +1 -1
- package/dist/cjs/components/table-form/interface.cjs +1 -1
- package/dist/cjs/components/table-form/interface.cjs.map +1 -1
- package/dist/cjs/components/table-form/style.cjs +1 -6
- package/dist/cjs/components/table-form/style.cjs.map +1 -1
- package/dist/css/components/tab/style/index.css +1 -1
- package/dist/css/index.css +1 -1
- package/dist/esm/components/card/Card.mjs +1 -1
- package/dist/esm/components/card/Card.mjs.map +1 -1
- package/dist/esm/components/dic/DicReplace.mjs +2 -2
- package/dist/esm/components/dic/DicReplace.mjs.map +1 -1
- package/dist/esm/components/layout/Layout.vue2.mjs +6 -20
- package/dist/esm/components/layout/Layout.vue2.mjs.map +1 -1
- package/dist/esm/components/layout/components/layout/HeaderLayout.vue2.mjs +5 -27
- package/dist/esm/components/layout/components/layout/HeaderLayout.vue2.mjs.map +1 -1
- package/dist/esm/components/tab/Tab.vue2.mjs +268 -184
- package/dist/esm/components/tab/Tab.vue2.mjs.map +1 -1
- package/dist/esm/components/table/Table.mjs +1 -1
- package/dist/esm/components/table/Table.mjs.map +1 -1
- package/dist/esm/components/table-form/TableForm.mjs +1 -1
- package/dist/esm/components/table-form/TableForm.mjs.map +1 -1
- package/dist/esm/components/table-form/interface.mjs +1 -1
- package/dist/esm/components/table-form/interface.mjs.map +1 -1
- package/dist/esm/components/table-form/style.mjs +1 -6
- package/dist/esm/components/table-form/style.mjs.map +1 -1
- package/dist/style/tab/style/index.scss +10 -4
- package/dist/types/components/card/Card.d.ts.map +1 -1
- package/dist/types/components/dic/DicReplace.d.ts.map +1 -1
- package/dist/types/components/layout/Layout.vue.d.ts +63 -51
- package/dist/types/components/layout/Layout.vue.d.ts.map +1 -1
- package/dist/types/components/layout/components/layout/HeaderLayout.vue.d.ts +63 -50
- package/dist/types/components/layout/components/layout/HeaderLayout.vue.d.ts.map +1 -1
- package/dist/types/components/tab/Tab.vue.d.ts +61 -22
- package/dist/types/components/tab/Tab.vue.d.ts.map +1 -1
- package/dist/types/components/table-form/TableFormItem.d.ts +4 -4
- package/dist/types/components/table-form/interface.d.ts +2 -2
- package/dist/types/components/table-form/interface.d.ts.map +1 -1
- package/dist/types/components/table-form/style.d.ts +1 -1
- package/dist/types/components/table-form/style.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, createBlock, createVNode, renderSlot } from 'vue';
|
|
2
2
|
import { theme } from 'ant-design-vue';
|
|
3
|
-
import {
|
|
3
|
+
import { storeToRefs } from 'pinia';
|
|
4
4
|
import { MenuUnfoldOutlined, MenuFoldOutlined } from '@ant-design/icons-vue';
|
|
5
5
|
import { useAppStore } from '@ditari/store';
|
|
6
6
|
import { css } from '@emotion/css';
|
|
@@ -11,29 +11,8 @@ import _sfc_main$1 from '../../../tab/Tab.vue2.mjs';
|
|
|
11
11
|
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
12
|
__name: "HeaderLayout",
|
|
13
13
|
setup(__props) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const defaultLayout = {
|
|
17
|
-
sideWidth: 200,
|
|
18
|
-
headerHeight: 44,
|
|
19
|
-
collapsedWidth: 80,
|
|
20
|
-
collapsed: false
|
|
21
|
-
};
|
|
22
|
-
const defaultModeConfig = {
|
|
23
|
-
mode: "light",
|
|
24
|
-
list: [
|
|
25
|
-
{ value: "light", label: "\u4EAE\u8272" },
|
|
26
|
-
{ value: "dark", label: "\u6DF1\u8272" },
|
|
27
|
-
{ value: "os", label: "\u8DDF\u968F\u7CFB\u7EDF" }
|
|
28
|
-
]
|
|
29
|
-
};
|
|
30
|
-
const defaultHeaderTokenStyle = {
|
|
31
|
-
bgColor: "#1677ff",
|
|
32
|
-
txtColor: "#fff"
|
|
33
|
-
};
|
|
34
|
-
const layout = appStore ? storeToRefs(appStore).layout : ref(defaultLayout);
|
|
35
|
-
const modeConfig = appStore ? storeToRefs(appStore).modeConfig : ref(defaultModeConfig);
|
|
36
|
-
const headerTokenStyle = appStore ? storeToRefs(appStore).headerTokenStyle : ref(defaultHeaderTokenStyle);
|
|
14
|
+
const appStore = useAppStore();
|
|
15
|
+
const { layout, modeConfig, headerTokenStyle } = storeToRefs(appStore);
|
|
37
16
|
const {
|
|
38
17
|
headerStyle,
|
|
39
18
|
headerTabStyle,
|
|
@@ -52,7 +31,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
52
31
|
top: 0;
|
|
53
32
|
right: 0;
|
|
54
33
|
z-index: 1;
|
|
55
|
-
background-color: ${modeConfig.value.mode !== "light" ? token.value.colorBgContainer : headerTokenStyle.value.
|
|
34
|
+
background-color: ${modeConfig.value.mode !== "light" ? token.value.colorBgContainer : headerTokenStyle.value.colorBgHeader};
|
|
56
35
|
left: ${left.value};
|
|
57
36
|
height: ${layout.value.headerHeight}px;
|
|
58
37
|
transition: left 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);
|
|
@@ -75,7 +54,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
75
54
|
align-items: center;
|
|
76
55
|
justify-content: center;
|
|
77
56
|
cursor: pointer;
|
|
78
|
-
color: ${modeConfig.value.mode === "light" ? headerTokenStyle.value.txtColor : "inherit"};
|
|
79
57
|
`
|
|
80
58
|
);
|
|
81
59
|
const rightStyle2 = computed(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderLayout.vue2.mjs","sources":["../../../../../../src/components/layout/components/layout/HeaderLayout.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport { computed, type ComputedRef
|
|
1
|
+
{"version":3,"file":"HeaderLayout.vue2.mjs","sources":["../../../../../../src/components/layout/components/layout/HeaderLayout.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport { computed, type ComputedRef } from \"vue\";\r\nimport { theme } from \"ant-design-vue\";\r\nimport { storeToRefs } from \"pinia\";\r\n\r\nimport {\r\n MenuFoldOutlined,\r\n MenuUnfoldOutlined\r\n} from \"@ant-design/icons-vue\";\r\nimport { useAppStore } from \"@ditari/store\";\r\nimport { css } from \"@emotion/css\";\r\nimport type { GlobalToken } from \"ant-design-vue/es/theme/interface\";\r\nimport type { RouteLocationNormalized } from \"vue-router\";\r\n\r\nimport Tab from \"../../../tab/Tab.vue\";\r\n\r\nconst appStore = useAppStore();\r\n\r\nconst { layout, modeConfig, headerTokenStyle } =\r\n storeToRefs(appStore);\r\n\r\nconst {\r\n headerStyle,\r\n headerTabStyle,\r\n collapsedStyle,\r\n rightStyle\r\n} = useStyle();\r\n\r\nfunction useStyle(): {\r\n headerStyle: ComputedRef<string>;\r\n headerTabStyle: ComputedRef<string>;\r\n collapsedStyle: ComputedRef<string>;\r\n rightStyle: ComputedRef<string>;\r\n} {\r\n const { useToken } = theme;\r\n const { token }: { token: ComputedRef<GlobalToken> } =\r\n useToken();\r\n\r\n const left = computed(\r\n () =>\r\n `${layout.value.collapsed ? layout.value.collapsedWidth : layout.value.sideWidth}px`\r\n );\r\n\r\n const headerStyle = computed(\r\n () => css`\r\n position: fixed;\r\n top: 0;\r\n right: 0;\r\n z-index: 1;\r\n background-color: ${modeConfig.value.mode !== \"light\"\r\n ? token.value.colorBgContainer\r\n : headerTokenStyle.value.colorBgHeader};\r\n left: ${left.value};\r\n height: ${layout.value.headerHeight}px;\r\n transition: left 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);\r\n display: flex;\r\n align-items: flex-end;\r\n `\r\n );\r\n\r\n const headerTabStyle = computed(\r\n () => css`\r\n flex: 1;\r\n overflow: hidden;\r\n padding-right: 10px;\r\n `\r\n );\r\n\r\n const collapsedStyle = computed(\r\n () => css`\r\n padding: 0 10px;\r\n height: 100%;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n cursor: pointer;\r\n `\r\n );\r\n\r\n const rightStyle = computed(\r\n () => css`\r\n height: 100%;\r\n `\r\n );\r\n\r\n return {\r\n headerStyle,\r\n headerTabStyle,\r\n collapsedStyle,\r\n rightStyle\r\n };\r\n}\r\n</script>\r\n<template>\r\n <div :class=\"[headerStyle, 'app-header-layout']\">\r\n <div\r\n :class=\"collapsedStyle\"\r\n @click=\"layout.collapsed = !layout.collapsed\"\r\n >\r\n <menu-unfold-outlined\r\n v-if=\"layout.collapsed\"\r\n class=\"trigger\"\r\n />\r\n <menu-fold-outlined v-else />\r\n </div>\r\n <div :class=\"headerTabStyle\">\r\n <Tab />\r\n </div>\r\n <div :class=\"rightStyle\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<style scoped></style>\r\n"],"names":["headerStyle","headerTabStyle","collapsedStyle","rightStyle","_createElementBlock","_unref","_createElementVNode","_createBlock","_createVNode","Tab","_renderSlot"],"mappings":";;;;;;;;;;;;;AAgBA,IAAA,MAAM,WAAW,WAAA,EAAY;AAE7B,IAAA,MAAM,EAAE,MAAA,EAAQ,UAAA,EAAY,gBAAA,EAAiB,GAC3C,YAAY,QAAQ,CAAA;AAEtB,IAAA,MAAM;AAAA,MACJ,WAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA;AAAA,QACE,QAAA,EAAS;AAEb,IAAA,SAAS,QAAA,GAKP;AACA,MAAA,MAAM,EAAE,UAAS,GAAI,KAAA;AACrB,MAAA,MAAM,EAAE,KAAA,EAAM,GACZ,QAAA,EAAS;AAEX,MAAA,MAAM,IAAA,GAAO,QAAA;AAAA,QACX,MACE,CAAA,EAAG,MAAA,CAAO,KAAA,CAAM,SAAA,GAAY,OAAO,KAAA,CAAM,cAAA,GAAiB,MAAA,CAAO,KAAA,CAAM,SAAS,CAAA,EAAA;AAAA,OACpF;AAEA,MAAA,MAAMA,YAAAA,GAAc,QAAA;AAAA,QAClB,MAAM,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAA,EAKgB,UAAA,CAAW,MAAM,IAAA,KAAS,OAAA,GAC1C,MAAM,KAAA,CAAM,gBAAA,GACZ,gBAAA,CAAiB,KAAA,CAAM,aAAa,CAAA;AAAA,YAAA,EAChC,KAAK,KAAK,CAAA;AAAA,cAAA,EACR,MAAA,CAAO,MAAM,YAAY,CAAA;AAAA;AAAA;AAAA;AAAA,IAAA;AAAA,OAKvC;AAEA,MAAA,MAAMC,eAAAA,GAAiB,QAAA;AAAA,QACrB,MAAM,GAAA;AAAA;AAAA;AAAA;AAAA,IAAA;AAAA,OAKR;AAEA,MAAA,MAAMC,eAAAA,GAAiB,QAAA;AAAA,QACrB,MAAM,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA;AAAA,OAQR;AAEA,MAAA,MAAMC,WAAAA,GAAa,QAAA;AAAA,QACjB,MAAM,GAAA;AAAA;AAAA,IAAA;AAAA,OAGR;AAEA,MAAA,OAAO;AAAA,QACL,WAAA,EAAAH,YAAAA;AAAA,QACA,cAAA,EAAAC,eAAAA;AAAA,QACA,cAAA,EAAAC,eAAAA;AAAA,QACA,UAAA,EAAAC;AAAA,OACF;AAAA,IACF;;0BAGEC,kBAAA;AAAA,QAiBM,KAAA;AAAA,QAAA;AAAA,UAjBA,uBAAQC,MAAA,WAAA,CAAA,EAAW,mBAAA,CAAA;AAAA;;UACvBC,kBAAA;AAAA,YASM,KAAA;AAAA,YAAA;AAAA,cARH,KAAA,iBAAOD,KAAA,CAAA,cAAA,CAAc,CAAA;AAAA,cACrB,+CAAOA,KAAA,CAAA,MAAA,CAAA,CAAO,SAAA,GAAS,CAAIA,KAAA,CAAA,MAAA,CAAA,CAAO,SAAA;AAAA;;cAG3BA,KAAA,CAAA,MAAA,CAAA,CAAO,SAAA,iBADfE,WAAA,CAGEF,KAAA,CAAA,kBAAA,CAAA,EAAA;AAAA;gBADA,KAAA,EAAM;AAAA,kCAERE,WAAA,CAA6BF,KAAA,CAAA,gBAAA,CAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,CAAA;AAAA;;;;UAE/BC,kBAAA;AAAA,YAEM,KAAA;AAAA,YAAA;AAAA,cAFA,KAAA,iBAAOD,KAAA,CAAA,cAAA,CAAc;AAAA;;cACzBG,YAAOC,WAAA;AAAA;;;;UAETH,kBAAA;AAAA,YAEM,KAAA;AAAA,YAAA;AAAA,cAFA,KAAA,iBAAOD,KAAA,CAAA,UAAA,CAAU;AAAA;;cACrBK,UAAA,CAAa,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA;;;;;;;;;;;;;;"}
|
|
@@ -1,157 +1,260 @@
|
|
|
1
|
-
import { defineComponent, computed, watch,
|
|
1
|
+
import { defineComponent, computed, inject, getCurrentInstance, watch, nextTick, resolveComponent, createElementBlock, openBlock, normalizeStyle, unref, normalizeClass, createVNode, createElementVNode, withCtx, Fragment, renderList, createBlock, createCommentVNode, toDisplayString, resolveDynamicComponent } from 'vue';
|
|
2
2
|
import { useRoute, useRouter } from 'vue-router';
|
|
3
3
|
import { theme } from 'ant-design-vue';
|
|
4
4
|
import { storeToRefs } from 'pinia';
|
|
5
5
|
import { AppContextKey } from '../layout/AppContext.mjs';
|
|
6
6
|
import Search from './Search.mjs';
|
|
7
|
-
import { ReloadOutlined, CloseOutlined } from '@ant-design/icons-vue';
|
|
8
|
-
import { useNavTabStore } from '@ditari/store';
|
|
9
|
-
import { css } from '@emotion/css';
|
|
7
|
+
import { ReloadOutlined, CloseOutlined, VerticalRightOutlined, VerticalLeftOutlined } from '@ant-design/icons-vue';
|
|
8
|
+
import { useAppStore, useNavTabStore } from '@ditari/store';
|
|
9
|
+
import { css, cx } from '@emotion/css';
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __defProps = Object.defineProperties;
|
|
14
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
15
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
16
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
18
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19
|
+
var __spreadValues = (a, b) => {
|
|
20
|
+
for (var prop in b || (b = {}))
|
|
21
|
+
if (__hasOwnProp.call(b, prop))
|
|
22
|
+
__defNormalProp(a, prop, b[prop]);
|
|
23
|
+
if (__getOwnPropSymbols)
|
|
24
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
25
|
+
if (__propIsEnum.call(b, prop))
|
|
26
|
+
__defNormalProp(a, prop, b[prop]);
|
|
27
|
+
}
|
|
28
|
+
return a;
|
|
29
|
+
};
|
|
30
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
12
31
|
const _hoisted_1 = { class: "d-tabs-nav" };
|
|
13
|
-
const _hoisted_2 = {
|
|
32
|
+
const _hoisted_2 = { class: "tab-item-container" };
|
|
33
|
+
const _hoisted_3 = {
|
|
14
34
|
key: 0,
|
|
15
35
|
class: "tab-item"
|
|
16
36
|
};
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
37
|
+
const _hoisted_4 = { class: "tab-item" };
|
|
38
|
+
const _hoisted_5 = { style: { "margin-left": "10px" } };
|
|
39
|
+
const _hoisted_6 = {
|
|
40
|
+
key: 0,
|
|
20
41
|
class: "tab-close"
|
|
21
42
|
};
|
|
22
|
-
const
|
|
43
|
+
const _hoisted_7 = ["onClick"];
|
|
23
44
|
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
24
45
|
__name: "Tab",
|
|
25
46
|
setup(__props) {
|
|
26
|
-
const { tabsNavStyle, tabHoverBgStyle, closeBtnStyle } = useStyle();
|
|
27
|
-
const {
|
|
28
|
-
activeKey,
|
|
29
|
-
list,
|
|
30
|
-
closeBtnStatus,
|
|
31
|
-
onChange,
|
|
32
|
-
onClose
|
|
33
|
-
} = useTab();
|
|
34
|
-
const { enableTabContextMenu, onContextMenuClick } = useTabsContextMenu();
|
|
35
47
|
function useStyle() {
|
|
36
48
|
const { useToken } = theme;
|
|
37
49
|
const { token } = useToken();
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
const appStore = useAppStore();
|
|
51
|
+
const { tabsTokenStyle } = storeToRefs(appStore);
|
|
52
|
+
const dynamicVars2 = computed(() => {
|
|
53
|
+
var _a, _b, _c, _d, _e;
|
|
54
|
+
return {
|
|
55
|
+
"--active-tab-color": (_a = tabsTokenStyle == null ? void 0 : tabsTokenStyle.value) == null ? void 0 : _a.colorBgActive,
|
|
56
|
+
"--splitColor": (_b = tabsTokenStyle == null ? void 0 : tabsTokenStyle.value) == null ? void 0 : _b.colorSplit,
|
|
57
|
+
"--active-text-color": (_c = tabsTokenStyle == null ? void 0 : tabsTokenStyle.value) == null ? void 0 : _c.colorTextActive,
|
|
58
|
+
"--active-shadow-color": (_d = tabsTokenStyle == null ? void 0 : tabsTokenStyle.value) == null ? void 0 : _d.colorShadowActive,
|
|
59
|
+
"--tabs-text-color": (_e = tabsTokenStyle == null ? void 0 : tabsTokenStyle.value) == null ? void 0 : _e.colorTabsText
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
const tabsNavStyle2 = computed(
|
|
63
|
+
() => css`
|
|
64
|
+
--active-tab-color: var(--active-tab-color);
|
|
65
|
+
--splitColor: var(--splitColor);
|
|
66
|
+
--active-text-color: var(--active-text-color);
|
|
67
|
+
--active-shadow-color: var(--active-shadow-color);
|
|
68
|
+
--tabs-text-color: var(--tabs-text-color);
|
|
48
69
|
padding-top: 10px;
|
|
49
70
|
display: flex;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const tabHoverBgStyle2 = computed(
|
|
53
|
-
|
|
71
|
+
`
|
|
72
|
+
);
|
|
73
|
+
const tabHoverBgStyle2 = computed(
|
|
74
|
+
() => css`
|
|
54
75
|
&:before {
|
|
55
76
|
background: ${token.value.colorPrimaryBgHover};
|
|
56
77
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const closeBtnStyle2 = computed(
|
|
60
|
-
|
|
78
|
+
`
|
|
79
|
+
);
|
|
80
|
+
const closeBtnStyle2 = computed(
|
|
81
|
+
() => css`
|
|
61
82
|
&:hover {
|
|
62
83
|
background: ${token.value.colorPrimaryBorderHover};
|
|
63
84
|
border-radius: 50%;
|
|
64
85
|
}
|
|
65
|
-
|
|
66
|
-
|
|
86
|
+
`
|
|
87
|
+
);
|
|
67
88
|
return {
|
|
68
89
|
tabsNavStyle: tabsNavStyle2,
|
|
69
90
|
tabHoverBgStyle: tabHoverBgStyle2,
|
|
70
|
-
closeBtnStyle: closeBtnStyle2
|
|
91
|
+
closeBtnStyle: closeBtnStyle2,
|
|
92
|
+
dynamicVars: dynamicVars2
|
|
71
93
|
};
|
|
72
94
|
}
|
|
73
|
-
function
|
|
95
|
+
function useTabAndMenu() {
|
|
74
96
|
const route = useRoute();
|
|
75
97
|
const router = useRouter();
|
|
76
98
|
const store = useNavTabStore();
|
|
77
|
-
const
|
|
78
|
-
|
|
99
|
+
const appContext = inject(
|
|
100
|
+
AppContextKey,
|
|
101
|
+
null
|
|
102
|
+
);
|
|
103
|
+
const { list: rawList, activeKey: activeKey2 } = storeToRefs(store);
|
|
104
|
+
const instance = getCurrentInstance();
|
|
105
|
+
const t = (key) => {
|
|
106
|
+
const fallback = {
|
|
107
|
+
reload: "\u5237\u65B0",
|
|
108
|
+
other: "\u5173\u95ED\u5176\u5B83",
|
|
109
|
+
selfClose: "\u5173\u95ED",
|
|
110
|
+
left: "\u5173\u95ED\u5DE6\u4FA7\u6807\u7B7E",
|
|
111
|
+
right: "\u5173\u95ED\u53F3\u4FA7\u6807\u7B7E"
|
|
112
|
+
};
|
|
113
|
+
const globalT = instance == null ? void 0 : instance.appContext.config.globalProperties.$t;
|
|
114
|
+
const i18nKey = `common.tabsContextMenu.${key}`;
|
|
115
|
+
if (typeof globalT === "function") {
|
|
116
|
+
const result = globalT(i18nKey);
|
|
117
|
+
if (result !== i18nKey) return result;
|
|
118
|
+
}
|
|
119
|
+
return fallback[key] || key;
|
|
120
|
+
};
|
|
121
|
+
const computedList = computed(() => {
|
|
122
|
+
const total = rawList.value.length;
|
|
123
|
+
return rawList.value.map((item, index) => {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
const isFirst = index === 0;
|
|
126
|
+
const isLast = index === total - 1;
|
|
127
|
+
const isOnly = total === 1;
|
|
128
|
+
const canCloseSelf = !((_a = item.meta) == null ? void 0 : _a.keepOpen) && !isOnly;
|
|
129
|
+
const hasLeftClosable = rawList.value.slice(0, index).some((i) => {
|
|
130
|
+
var _a2;
|
|
131
|
+
return !((_a2 = i.meta) == null ? void 0 : _a2.keepOpen);
|
|
132
|
+
});
|
|
133
|
+
const hasRightClosable = rawList.value.slice(index + 1).some((i) => {
|
|
134
|
+
var _a2;
|
|
135
|
+
return !((_a2 = i.meta) == null ? void 0 : _a2.keepOpen);
|
|
136
|
+
});
|
|
137
|
+
const hasOtherClosable = rawList.value.some(
|
|
138
|
+
(i) => {
|
|
139
|
+
var _a2;
|
|
140
|
+
return i.fullPath !== item.fullPath && !((_a2 = i.meta) == null ? void 0 : _a2.keepOpen);
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
144
|
+
closeBtnVisible: !((_b = item.meta) == null ? void 0 : _b.keepOpen) && !isOnly,
|
|
145
|
+
menus: [
|
|
146
|
+
{
|
|
147
|
+
key: "reload",
|
|
148
|
+
title: t("reload"),
|
|
149
|
+
icon: ReloadOutlined,
|
|
150
|
+
disabled: false
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: "selfClose",
|
|
154
|
+
title: t("selfClose"),
|
|
155
|
+
icon: CloseOutlined,
|
|
156
|
+
disabled: !canCloseSelf
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: "other",
|
|
160
|
+
title: t("other"),
|
|
161
|
+
icon: CloseOutlined,
|
|
162
|
+
disabled: !hasOtherClosable
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
key: "left",
|
|
166
|
+
title: t("left"),
|
|
167
|
+
icon: VerticalRightOutlined,
|
|
168
|
+
disabled: isFirst || !hasLeftClosable
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
key: "right",
|
|
172
|
+
title: t("right"),
|
|
173
|
+
icon: VerticalLeftOutlined,
|
|
174
|
+
disabled: isLast || !hasRightClosable
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
});
|
|
79
180
|
watch(
|
|
80
181
|
() => route.fullPath,
|
|
81
182
|
(val) => {
|
|
82
|
-
save(route);
|
|
83
|
-
|
|
183
|
+
store.save(route);
|
|
184
|
+
nextTick(() => {
|
|
185
|
+
activeKey2.value = val;
|
|
186
|
+
});
|
|
84
187
|
},
|
|
85
|
-
{
|
|
86
|
-
immediate: true
|
|
87
|
-
}
|
|
188
|
+
{ immediate: true }
|
|
88
189
|
);
|
|
89
190
|
const onChange2 = (key) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
191
|
+
const targetKey = String(key);
|
|
192
|
+
if (targetKey !== route.path) {
|
|
193
|
+
const rs = rawList.value.find(
|
|
194
|
+
(item) => item.fullPath === targetKey
|
|
195
|
+
);
|
|
196
|
+
if (rs) router.push(rs);
|
|
95
197
|
}
|
|
96
198
|
};
|
|
97
199
|
const onClose2 = ($event, key) => {
|
|
98
200
|
if (!key) return;
|
|
99
201
|
$event.stopPropagation();
|
|
100
|
-
deleteTabs(key);
|
|
101
|
-
const backRoute =
|
|
102
|
-
if (backRoute.fullPath)
|
|
202
|
+
store.deleteTabs(key);
|
|
203
|
+
const backRoute = rawList.value[rawList.value.length - 1];
|
|
204
|
+
if (backRoute == null ? void 0 : backRoute.fullPath)
|
|
103
205
|
router.push(backRoute.fullPath);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const closeBtnStatus2 = (item) => {
|
|
107
|
-
var _a;
|
|
108
|
-
if ((_a = item.meta) == null ? void 0 : _a.keepOpen) {
|
|
109
|
-
return false;
|
|
110
|
-
} else {
|
|
111
|
-
return list2.value.length !== 1;
|
|
112
|
-
}
|
|
113
206
|
};
|
|
114
|
-
return {
|
|
115
|
-
activeKey: activeKey2,
|
|
116
|
-
list: list2,
|
|
117
|
-
closeBtnStatus: closeBtnStatus2,
|
|
118
|
-
onChange: onChange2,
|
|
119
|
-
onClose: onClose2
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function useTabsContextMenu() {
|
|
123
|
-
const appContext = inject(
|
|
124
|
-
AppContextKey,
|
|
125
|
-
null
|
|
126
|
-
);
|
|
127
|
-
const store = useNavTabStore();
|
|
128
|
-
const router = useRouter();
|
|
129
207
|
const onContextMenuClick2 = ({ key }, item) => {
|
|
130
|
-
var _a
|
|
208
|
+
var _a;
|
|
131
209
|
const targetKey = item.fullPath;
|
|
210
|
+
if (!targetKey) return;
|
|
132
211
|
switch (key) {
|
|
133
212
|
case "reload":
|
|
134
213
|
(_a = appContext == null ? void 0 : appContext.onReloadPage) == null ? void 0 : _a.call(appContext, item);
|
|
135
214
|
break;
|
|
215
|
+
case "selfClose":
|
|
216
|
+
store.deleteTabs(targetKey);
|
|
217
|
+
if (activeKey2.value === targetKey) {
|
|
218
|
+
const last = rawList.value[rawList.value.length - 1];
|
|
219
|
+
if (last == null ? void 0 : last.fullPath) router.push(last.fullPath);
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
136
222
|
case "other":
|
|
137
|
-
|
|
138
|
-
|
|
223
|
+
store.closeOtherTabs(targetKey);
|
|
224
|
+
if (activeKey2.value !== targetKey)
|
|
225
|
+
router.push(targetKey);
|
|
139
226
|
break;
|
|
140
227
|
case "left":
|
|
141
|
-
|
|
142
|
-
router.push(targetKey);
|
|
228
|
+
store.closeLeftTabs(targetKey);
|
|
143
229
|
break;
|
|
144
230
|
case "right":
|
|
145
|
-
|
|
146
|
-
router.push(targetKey);
|
|
231
|
+
store.closeRightTabs(targetKey);
|
|
147
232
|
break;
|
|
148
233
|
}
|
|
149
234
|
};
|
|
150
235
|
return {
|
|
236
|
+
activeKey: activeKey2,
|
|
237
|
+
list: computedList,
|
|
151
238
|
enableTabContextMenu: (appContext == null ? void 0 : appContext.enableTabContextMenu) || false,
|
|
239
|
+
onChange: onChange2,
|
|
240
|
+
onClose: onClose2,
|
|
152
241
|
onContextMenuClick: onContextMenuClick2
|
|
153
242
|
};
|
|
154
243
|
}
|
|
244
|
+
const {
|
|
245
|
+
tabsNavStyle,
|
|
246
|
+
tabHoverBgStyle,
|
|
247
|
+
closeBtnStyle,
|
|
248
|
+
dynamicVars
|
|
249
|
+
} = useStyle();
|
|
250
|
+
const {
|
|
251
|
+
activeKey,
|
|
252
|
+
list,
|
|
253
|
+
enableTabContextMenu,
|
|
254
|
+
onChange,
|
|
255
|
+
onClose,
|
|
256
|
+
onContextMenuClick
|
|
257
|
+
} = useTabAndMenu();
|
|
155
258
|
return (_ctx, _cache) => {
|
|
156
259
|
const _component_a_menu_item = resolveComponent("a-menu-item");
|
|
157
260
|
const _component_a_menu = resolveComponent("a-menu");
|
|
@@ -161,17 +264,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
161
264
|
return openBlock(), createElementBlock(
|
|
162
265
|
"div",
|
|
163
266
|
{
|
|
164
|
-
class: normalizeClass(["tabs-nav-wrapper", unref(tabsNavStyle)])
|
|
267
|
+
class: normalizeClass(["tabs-nav-wrapper", unref(cx)(unref(tabsNavStyle))]),
|
|
268
|
+
style: normalizeStyle(unref(dynamicVars))
|
|
165
269
|
},
|
|
166
270
|
[
|
|
167
271
|
createVNode(unref(Search)),
|
|
168
272
|
createElementVNode("div", _hoisted_1, [
|
|
169
273
|
createVNode(_component_a_tabs, {
|
|
170
274
|
size: "small",
|
|
171
|
-
|
|
172
|
-
"onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => isRef(activeKey) ? activeKey.value = $event : null),
|
|
275
|
+
"active-key": unref(activeKey),
|
|
173
276
|
type: "card",
|
|
174
|
-
"hide-add":
|
|
277
|
+
"hide-add": true,
|
|
175
278
|
onChange: unref(onChange)
|
|
176
279
|
}, {
|
|
177
280
|
default: withCtx(() => [
|
|
@@ -196,108 +299,89 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
196
299
|
2
|
|
197
300
|
/* CLASS */
|
|
198
301
|
),
|
|
199
|
-
_cache[
|
|
302
|
+
_cache[0] || (_cache[0] = createElementVNode(
|
|
200
303
|
"div",
|
|
201
304
|
{ class: "tab-dividers" },
|
|
202
305
|
null,
|
|
203
306
|
-1
|
|
204
307
|
/* CACHED */
|
|
205
308
|
)),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
default: withCtx(() => {
|
|
277
|
-
var _a2;
|
|
278
|
-
return [
|
|
279
|
-
createElementVNode(
|
|
280
|
-
"div",
|
|
281
|
-
_hoisted_3,
|
|
282
|
-
toDisplayString(((_a2 = item.meta) == null ? void 0 : _a2.title) || "\u65E0\u6807\u9898"),
|
|
283
|
-
1
|
|
284
|
-
/* TEXT */
|
|
285
|
-
)
|
|
286
|
-
];
|
|
287
|
-
}),
|
|
288
|
-
_: 2
|
|
289
|
-
/* DYNAMIC */
|
|
290
|
-
},
|
|
291
|
-
1024
|
|
292
|
-
/* DYNAMIC_SLOTS */
|
|
293
|
-
)) : createCommentVNode("v-if", true),
|
|
294
|
-
unref(closeBtnStatus)(item) ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
309
|
+
createElementVNode("div", _hoisted_2, [
|
|
310
|
+
!unref(enableTabContextMenu) ? (openBlock(), createElementBlock(
|
|
311
|
+
"div",
|
|
312
|
+
_hoisted_3,
|
|
313
|
+
toDisplayString(((_a = item.meta) == null ? void 0 : _a.title) || "\u65E0\u6807\u9898"),
|
|
314
|
+
1
|
|
315
|
+
/* TEXT */
|
|
316
|
+
)) : (openBlock(), createBlock(
|
|
317
|
+
_component_a_dropdown,
|
|
318
|
+
{
|
|
319
|
+
key: 1,
|
|
320
|
+
trigger: ["contextmenu"],
|
|
321
|
+
"destroy-popup-on-hide": true
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
overlay: withCtx(() => [
|
|
325
|
+
createVNode(_component_a_menu, {
|
|
326
|
+
onClick: (e) => unref(onContextMenuClick)(e, item)
|
|
327
|
+
}, {
|
|
328
|
+
default: withCtx(() => [
|
|
329
|
+
(openBlock(true), createElementBlock(
|
|
330
|
+
Fragment,
|
|
331
|
+
null,
|
|
332
|
+
renderList(item.menus, (menu) => {
|
|
333
|
+
return openBlock(), createBlock(_component_a_menu_item, {
|
|
334
|
+
key: menu.key,
|
|
335
|
+
disabled: menu.disabled
|
|
336
|
+
}, {
|
|
337
|
+
default: withCtx(() => [
|
|
338
|
+
menu.icon ? (openBlock(), createBlock(resolveDynamicComponent(menu.icon), { key: 0 })) : createCommentVNode("v-if", true),
|
|
339
|
+
createElementVNode(
|
|
340
|
+
"span",
|
|
341
|
+
_hoisted_5,
|
|
342
|
+
toDisplayString(menu.title),
|
|
343
|
+
1
|
|
344
|
+
/* TEXT */
|
|
345
|
+
)
|
|
346
|
+
]),
|
|
347
|
+
_: 2
|
|
348
|
+
/* DYNAMIC */
|
|
349
|
+
}, 1032, ["disabled"]);
|
|
350
|
+
}),
|
|
351
|
+
128
|
|
352
|
+
/* KEYED_FRAGMENT */
|
|
353
|
+
))
|
|
354
|
+
]),
|
|
355
|
+
_: 2
|
|
356
|
+
/* DYNAMIC */
|
|
357
|
+
}, 1032, ["onClick"])
|
|
358
|
+
]),
|
|
359
|
+
default: withCtx(() => {
|
|
360
|
+
var _a2;
|
|
361
|
+
return [
|
|
362
|
+
createElementVNode(
|
|
363
|
+
"div",
|
|
364
|
+
_hoisted_4,
|
|
365
|
+
toDisplayString(((_a2 = item.meta) == null ? void 0 : _a2.title) || "\u65E0\u6807\u9898"),
|
|
366
|
+
1
|
|
367
|
+
/* TEXT */
|
|
368
|
+
)
|
|
369
|
+
];
|
|
370
|
+
}),
|
|
371
|
+
_: 2
|
|
372
|
+
/* DYNAMIC */
|
|
373
|
+
},
|
|
374
|
+
1024
|
|
375
|
+
/* DYNAMIC_SLOTS */
|
|
376
|
+
))
|
|
377
|
+
]),
|
|
378
|
+
item.closeBtnVisible ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
295
379
|
createElementVNode("div", {
|
|
296
380
|
class: normalizeClass(["close-btn", unref(closeBtnStyle)]),
|
|
297
381
|
onClick: ($event) => unref(onClose)($event, item.fullPath)
|
|
298
382
|
}, [
|
|
299
383
|
createVNode(unref(CloseOutlined))
|
|
300
|
-
], 10,
|
|
384
|
+
], 10, _hoisted_7)
|
|
301
385
|
])) : createCommentVNode("v-if", true)
|
|
302
386
|
];
|
|
303
387
|
}),
|
|
@@ -311,11 +395,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
311
395
|
]),
|
|
312
396
|
_: 1
|
|
313
397
|
/* STABLE */
|
|
314
|
-
}, 8, ["
|
|
398
|
+
}, 8, ["active-key", "onChange"])
|
|
315
399
|
])
|
|
316
400
|
],
|
|
317
|
-
|
|
318
|
-
/* CLASS */
|
|
401
|
+
6
|
|
402
|
+
/* CLASS, STYLE */
|
|
319
403
|
);
|
|
320
404
|
};
|
|
321
405
|
}
|