@touchvue/ui 1.0.0-beta.50 → 1.0.0-beta.52
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/components/form/src/form.vue.d.ts +0 -3
- package/es/components/index.d.ts +3 -1
- package/es/components/input/src/input.vue.d.ts +1 -10
- package/es/components/rate/index.d.ts +4 -0
- package/es/components/rate/src/instance.d.ts +2 -0
- package/es/components/rate/src/rate.vue.d.ts +77 -0
- package/es/components/select/src/select.d.ts +0 -8
- package/es/components/select/src/select.vue.d.ts +0 -9
- package/es/components/switch/src/switch.vue.d.ts +3 -3
- package/es/components/tab/src/tab.d.ts +1 -1
- package/es/components/tab/src/tab.vue.d.ts +17 -4
- package/es/index.d.mjs +1 -0
- package/es/index.d.mjs.map +1 -1
- package/es/index.mjs +1 -0
- package/es/index.mjs.map +1 -1
- package/es/packages/components/cascader/src/cascader.vue2.mjs +1 -1
- package/es/packages/components/cascader/src/cascader.vue2.mjs.map +1 -1
- package/es/packages/components/checkbox/src/Checkbox.vue2.mjs +1 -1
- package/es/packages/components/checkbox/src/Checkbox.vue2.mjs.map +1 -1
- package/es/packages/components/checkboxes/src/Checkboxes.vue2.mjs.map +1 -1
- package/es/packages/components/datepicker/src/DatePicker.vue2.mjs +2 -3
- package/es/packages/components/datepicker/src/DatePicker.vue2.mjs.map +1 -1
- package/es/packages/components/daterange/src/date-range.vue2.mjs +18 -6
- package/es/packages/components/daterange/src/date-range.vue2.mjs.map +1 -1
- package/es/packages/components/form/src/form.vue2.mjs +1 -2
- package/es/packages/components/form/src/form.vue2.mjs.map +1 -1
- package/es/packages/components/index.d.mjs +1 -0
- package/es/packages/components/index.d.mjs.map +1 -1
- package/es/packages/components/index.mjs +1 -0
- package/es/packages/components/index.mjs.map +1 -1
- package/es/packages/components/input/src/input.vue2.mjs +63 -62
- package/es/packages/components/input/src/input.vue2.mjs.map +1 -1
- package/es/packages/components/page/src/page.vue2.mjs +9 -4
- package/es/packages/components/page/src/page.vue2.mjs.map +1 -1
- package/es/packages/components/rate/index.d.mjs +2 -0
- package/es/packages/components/rate/index.d.mjs.map +1 -0
- package/es/packages/components/rate/index.mjs +7 -0
- package/es/packages/components/rate/index.mjs.map +1 -0
- package/es/packages/components/rate/src/instance.d.mjs +2 -0
- package/es/packages/components/rate/src/instance.d.mjs.map +1 -0
- package/es/packages/components/rate/src/instance.mjs +2 -0
- package/es/packages/components/rate/src/instance.mjs.map +1 -0
- package/es/packages/components/rate/src/rate.vue.mjs +7 -0
- package/es/packages/components/rate/src/rate.vue.mjs.map +1 -0
- package/es/packages/components/rate/src/rate.vue2.mjs +153 -0
- package/es/packages/components/rate/src/rate.vue2.mjs.map +1 -0
- package/es/packages/components/segment/src/segment.vue.mjs +1 -4
- package/es/packages/components/segment/src/segment.vue.mjs.map +1 -1
- package/es/packages/components/select/src/hooks/use-select-class-style.mjs +1 -1
- package/es/packages/components/select/src/hooks/use-select-class-style.mjs.map +1 -1
- package/es/packages/components/select/src/select.mjs +0 -8
- package/es/packages/components/select/src/select.mjs.map +1 -1
- package/es/packages/components/select/src/select.vue2.mjs +11 -2
- package/es/packages/components/select/src/select.vue2.mjs.map +1 -1
- package/es/packages/components/switch/src/switch.vue2.mjs +4 -4
- package/es/packages/components/switch/src/switch.vue2.mjs.map +1 -1
- package/es/packages/components/tab/src/tab.vue2.mjs +378 -47
- package/es/packages/components/tab/src/tab.vue2.mjs.map +1 -1
- package/es/packages/components/transfer/src/transfer.vue2.mjs.map +1 -1
- package/es/packages/components/upload/src/upload.vue2.mjs +2 -2
- package/es/packages/components/upload/src/upload.vue2.mjs.map +1 -1
- package/es/packages/utils/disabledArea.mjs +2 -2
- package/es/packages/utils/disabledArea.mjs.map +1 -1
- package/es/packages/utils/validate.mjs +18 -11
- package/es/packages/utils/validate.mjs.map +1 -1
- package/global.d.ts +1 -0
- package/lib/components/form/src/form.vue.d.ts +0 -3
- package/lib/components/index.d.ts +3 -1
- package/lib/components/input/src/input.vue.d.ts +1 -10
- package/lib/components/rate/index.d.ts +4 -0
- package/lib/components/rate/src/instance.d.ts +2 -0
- package/lib/components/rate/src/rate.vue.d.ts +77 -0
- package/lib/components/select/src/select.d.ts +0 -8
- package/lib/components/select/src/select.vue.d.ts +0 -9
- package/lib/components/switch/src/switch.vue.d.ts +3 -3
- package/lib/components/tab/src/tab.d.ts +1 -1
- package/lib/components/tab/src/tab.vue.d.ts +17 -4
- package/lib/index.d.js +8 -6
- package/lib/index.d.js.map +1 -1
- package/lib/index.js +13 -11
- package/lib/index.js.map +1 -1
- package/lib/packages/components/cascader/src/cascader.vue2.js +1 -1
- package/lib/packages/components/cascader/src/cascader.vue2.js.map +1 -1
- package/lib/packages/components/checkbox/src/Checkbox.vue2.js +1 -1
- package/lib/packages/components/checkbox/src/Checkbox.vue2.js.map +1 -1
- package/lib/packages/components/checkboxes/src/Checkboxes.vue2.js.map +1 -1
- package/lib/packages/components/datepicker/src/DatePicker.vue2.js +2 -3
- package/lib/packages/components/datepicker/src/DatePicker.vue2.js.map +1 -1
- package/lib/packages/components/daterange/src/date-range.vue2.js +18 -6
- package/lib/packages/components/daterange/src/date-range.vue2.js.map +1 -1
- package/lib/packages/components/form/src/form.vue2.js +1 -2
- package/lib/packages/components/form/src/form.vue2.js.map +1 -1
- package/lib/packages/components/index.d.js +2 -0
- package/lib/packages/components/index.d.js.map +1 -1
- package/lib/packages/components/index.js +2 -0
- package/lib/packages/components/index.js.map +1 -1
- package/lib/packages/components/input/src/input.vue2.js +63 -62
- package/lib/packages/components/input/src/input.vue2.js.map +1 -1
- package/lib/packages/components/page/src/page.vue2.js +9 -4
- package/lib/packages/components/page/src/page.vue2.js.map +1 -1
- package/lib/packages/components/rate/index.d.js +3 -0
- package/lib/packages/components/rate/index.d.js.map +1 -0
- package/lib/packages/components/rate/index.js +9 -0
- package/lib/packages/components/rate/index.js.map +1 -0
- package/lib/packages/components/rate/src/instance.d.js +3 -0
- package/lib/packages/components/rate/src/instance.d.js.map +1 -0
- package/lib/packages/components/rate/src/instance.js +3 -0
- package/lib/packages/components/rate/src/instance.js.map +1 -0
- package/lib/packages/components/rate/src/rate.vue.js +11 -0
- package/lib/packages/components/rate/src/rate.vue.js.map +1 -0
- package/lib/packages/components/rate/src/rate.vue2.js +157 -0
- package/lib/packages/components/rate/src/rate.vue2.js.map +1 -0
- package/lib/packages/components/segment/src/segment.vue.js +1 -4
- package/lib/packages/components/segment/src/segment.vue.js.map +1 -1
- package/lib/packages/components/select/src/hooks/use-select-class-style.js +1 -1
- package/lib/packages/components/select/src/hooks/use-select-class-style.js.map +1 -1
- package/lib/packages/components/select/src/select.js +0 -8
- package/lib/packages/components/select/src/select.js.map +1 -1
- package/lib/packages/components/select/src/select.vue2.js +11 -2
- package/lib/packages/components/select/src/select.vue2.js.map +1 -1
- package/lib/packages/components/switch/src/switch.vue2.js +4 -4
- package/lib/packages/components/switch/src/switch.vue2.js.map +1 -1
- package/lib/packages/components/tab/src/tab.vue2.js +377 -46
- package/lib/packages/components/tab/src/tab.vue2.js.map +1 -1
- package/lib/packages/components/transfer/src/transfer.vue2.js.map +1 -1
- package/lib/packages/components/upload/src/upload.vue2.js +2 -2
- package/lib/packages/components/upload/src/upload.vue2.js.map +1 -1
- package/lib/packages/utils/disabledArea.js +2 -2
- package/lib/packages/utils/disabledArea.js.map +1 -1
- package/lib/packages/utils/validate.js +24 -17
- package/lib/packages/utils/validate.js.map +1 -1
- package/package.json +1 -1
- package/theme/components/index.css +326 -122
- package/theme/index.css +326 -122
- package/theme/skin/default.css +326 -122
- package/types/global.d.ts +1 -0
|
@@ -12,7 +12,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
12
12
|
...__default__,
|
|
13
13
|
props: {
|
|
14
14
|
flex: Boolean,
|
|
15
|
-
|
|
15
|
+
disabled: Boolean,
|
|
16
16
|
modelValue: {
|
|
17
17
|
type: [Boolean, String, Number],
|
|
18
18
|
default: false
|
|
@@ -77,7 +77,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
77
77
|
const props = __props;
|
|
78
78
|
const emit = __emit;
|
|
79
79
|
const ivalue = vue.ref(props.modelValue);
|
|
80
|
-
const disabled = vue.ref(props.
|
|
80
|
+
const disabled = vue.ref(props.disabled);
|
|
81
81
|
vue.watch(
|
|
82
82
|
() => props.modelValue,
|
|
83
83
|
(val) => {
|
|
@@ -86,13 +86,13 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
86
86
|
{ immediate: true }
|
|
87
87
|
);
|
|
88
88
|
vue.watch(
|
|
89
|
-
() => props.
|
|
89
|
+
() => props.disabled,
|
|
90
90
|
(val) => {
|
|
91
91
|
disabled.value = val;
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
94
|
const setClass = vue.computed(() => {
|
|
95
|
-
const arr = ["to-
|
|
95
|
+
const arr = ["to-disable-target"];
|
|
96
96
|
if (ivalue.value === props.onValue) {
|
|
97
97
|
arr.push(`is-on`);
|
|
98
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.vue2.js","sources":["../../../../../../packages/components/switch/src/switch.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as DO_defineComponent } from 'vue';\nexport default /*#__PURE__*/ DO_defineComponent({\n\tname: 'ToSwitch'\n});\n</script>\n<template>\n\t<div v-dis.opacity=\"disabled\" v-tip=\"changed ? t('to.switch.changed') : ''\" :flex=\"flex ? flex : null\" class=\"to-switch\" :style=\"setStyle\" :class=\"setClass\" @click=\"toggle\">\n\t\t<div class=\"to-switch-on\">\n\t\t\t<div v-if=\"onText\" class=\"to-switch-on-text\">{{ onText }}</div>\n\t\t\t<to-icon v-if=\"onIcon\" class=\"to-switch-on-icon\" :value=\"onIcon\"></to-icon>\n\t\t</div>\n\t\t<div class=\"to-switch-off\">\n\t\t\t<div v-if=\"offText\" class=\"to-switch-off-text\">{{ offText }}</div>\n\t\t\t<to-icon v-if=\"offIcon\" class=\"to-switch-off-icon\" :value=\"offIcon\"></to-icon>\n\t\t</div>\n\t\t<div class=\"to-switch-slider\"></div>\n\t</div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { CSSProperties, computed, ref, watch, inject } from 'vue'\nimport { t } from '@touchvue/locale'\n\n\n\nconst ToForm = inject<{ comparable?: boolean }>('ToForm')\n\nconst valueStore = ref([])\n\nconst props = defineProps({\n\tflex: Boolean,\n\
|
|
1
|
+
{"version":3,"file":"switch.vue2.js","sources":["../../../../../../packages/components/switch/src/switch.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as DO_defineComponent } from 'vue';\nexport default /*#__PURE__*/ DO_defineComponent({\n\tname: 'ToSwitch'\n});\n</script>\n<template>\n\t<div v-dis.opacity=\"disabled\" v-tip=\"changed ? t('to.switch.changed') : ''\" :flex=\"flex ? flex : null\" class=\"to-switch\" :style=\"setStyle\" :class=\"setClass\" @click=\"toggle\">\n\t\t<div class=\"to-switch-on\">\n\t\t\t<div v-if=\"onText\" class=\"to-switch-on-text\">{{ onText }}</div>\n\t\t\t<to-icon v-if=\"onIcon\" class=\"to-switch-on-icon\" :value=\"onIcon\"></to-icon>\n\t\t</div>\n\t\t<div class=\"to-switch-off\">\n\t\t\t<div v-if=\"offText\" class=\"to-switch-off-text\">{{ offText }}</div>\n\t\t\t<to-icon v-if=\"offIcon\" class=\"to-switch-off-icon\" :value=\"offIcon\"></to-icon>\n\t\t</div>\n\t\t<div class=\"to-switch-slider\"></div>\n\t</div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { CSSProperties, computed, ref, watch, inject } from 'vue'\nimport { t } from '@touchvue/locale'\n\n\n\nconst ToForm = inject<{ comparable?: boolean }>('ToForm')\n\nconst valueStore = ref([])\n\nconst props = defineProps({\n\tflex: Boolean,\n\tdisabled: Boolean,\n\tmodelValue: {\n\t\ttype: [Boolean, String, Number],\n\t\tdefault: false\n\t},\n\tonValue: {\n\t\ttype: [Boolean, String, Number],\n\t\tdefault: true\n\t},\n\toffValue: {\n\t\ttype: [Boolean, String, Number],\n\t\tdefault: false\n\t},\n\tonColor: {\n\t\ttype: String,\n\t\tdefault: 'primary'\n\t},\n\toffColor: {\n\t\ttype: String,\n\t\tdefault: 'info'\n\t},\n\tonText: {\n\t\ttype: String,\n\t\tdefault: ''\n\t},\n\toffText: {\n\t\ttype: String,\n\t\tdefault: ''\n\t},\n\tonIcon: {\n\t\ttype: String,\n\t\tdefault: ''\n\t},\n\toffIcon: {\n\t\ttype: String,\n\t\tdefault: ''\n\t},\n\tcolor: {\n\t\ttype: String,\n\t\tdefault: 'default'\n\t},\n\tmode: {\n\t\ttype: String,\n\t\tdefault: 'default'\n\t},\n\tbeforeChange: {\n\t\ttype: [Function, String, Boolean],\n\t\tdefault: ''\n\t},\n\tcomparable: {\n\t\ttype: Boolean,\n\t\tdefault: false\n\t},\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: ''\n\t}\n})\n\nconst emit = defineEmits(['update:modelValue', 'change'])\n\nconst ivalue = ref(props.modelValue)\nconst disabled = ref(props.disabled)\n\nwatch(\n\t() => props.modelValue,\n\tval => {\n\t\tivalue.value = val\n\t},\n\t{ immediate: true }\n)\n\nwatch(\n\t() => props.disabled,\n\tval => {\n\t\tdisabled.value = val\n\t}\n)\n\nconst setClass = computed(() => {\n\tconst arr = ['to-disable-target']\n\tif (ivalue.value === props.onValue) {\n\t\tarr.push(`is-on`)\n\t}\n\tif (props.color) {\n\t\tarr.push(`color-${props.color}`)\n\t}\n\tif (props.mode) {\n\t\tarr.push(`mode-${props.mode}`)\n\t}\n\tif (ToForm?.comparable || props.comparable) {\n\t\tarr.push('to-compare')\n\t}\n\tif (changed.value) {\n\t\tarr.push('to-switch-changed')\n\t}\n\treturn arr\n})\n\nconst setStyle = computed(() => {\n\tconst obj: CSSProperties = {}\n\tif (props.width) {\n\t\tobj['--width'] = props.width + 'em'\n\t}\n\treturn obj\n})\n\nconst changed = computed(() => {\n\tif ((props.comparable || ToForm?.comparable) && valueStore.value.length > 0 && ivalue.value !== valueStore.value[0]) {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n})\n\nasync function toggle() {\n\tif (disabled.value) return\n\tlet flag = true\n\tif (typeof props.beforeChange === 'boolean') {\n\t\tflag = props.beforeChange\n\t} else {\n\t\tif (props.beforeChange) {\n\t\t\tif (typeof props.beforeChange === 'function') {\n\t\t\t\tif (typeof props.beforeChange().then === 'function') {\n\t\t\t\t\tflag = await props.beforeChange()\n\t\t\t\t} else {\n\t\t\t\t\tflag = props.beforeChange()\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tflag = !!props.beforeChange\n\t\t\t}\n\t\t}\n\t}\n\tif (!flag) return false\n\tivalue.value = ivalue.value === props.onValue ? props.offValue : props.onValue\n\temit('update:modelValue', ivalue.value)\n\temit('change', ivalue.value)\n}\n\nconst compare = () => {\n\tvalueStore.value.unshift(ivalue.value)\n}\n// 撤销\nconst restore = () => {\n\tivalue.value = valueStore.value[0]\n\tvalueStore.value.splice(0, 1)\n}\n\nconst setDisabled = (f: boolean) => {\n\tdisabled.value = f\n}\ndefineExpose({\n\tcompare,\n\trestore,\n\tchanged,\n\tsetDisabled\n})\n</script>\n"],"names":["DO_defineComponent","inject","ref","watch","computed","_createElementBlock","_normalizeClass","_createElementVNode","_createBlock","_unref","t"],"mappings":";;;;;;;AAEA,MAAA,cAA6BA,mBAAmB,CAAA;AAAA,EAC/C,IAAM,EAAA,UAAA;AACP,CAAC,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBD,IAAM,MAAA,MAAA,GAASC,WAAiC,QAAQ,CAAA,CAAA;AAExD,IAAM,MAAA,UAAA,GAAaC,OAAI,CAAA,EAAE,CAAA,CAAA;AAEzB,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AA6Dd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AAEb,IAAM,MAAA,MAAA,GAASA,OAAI,CA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
|
8
8
|
var index = require('../../../locale/index.js');
|
|
9
|
+
var useDevice = require('../../../hooks/useDevice.js');
|
|
9
10
|
|
|
10
11
|
const __default__ = vue.defineComponent({
|
|
11
12
|
name: "ToTab"
|
|
@@ -21,7 +22,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
21
22
|
removable: { type: Boolean, default: false },
|
|
22
23
|
position: { default: "" },
|
|
23
24
|
itemDir: { default: "" },
|
|
24
|
-
over: { default: "
|
|
25
|
+
over: { default: "" },
|
|
25
26
|
event: { default: "click" },
|
|
26
27
|
contentType: { default: "" },
|
|
27
28
|
title: { default: "" },
|
|
@@ -38,12 +39,31 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
38
39
|
const selectValue = vue.ref("");
|
|
39
40
|
const _data = vue.ref([]);
|
|
40
41
|
const floatRef = vue.ref(null);
|
|
42
|
+
const overflowFloatRef = vue.ref(null);
|
|
43
|
+
const overflowIconRef = vue.ref(null);
|
|
44
|
+
const overflowTabs = vue.ref([]);
|
|
45
|
+
const overflowFloatShow = vue.computed(() => props.over === "float" && overflowTabs.value.length > 0);
|
|
41
46
|
const ul = vue.ref(null);
|
|
42
47
|
const list = vue.ref(null);
|
|
48
|
+
const tabScrollRef = vue.ref(null);
|
|
49
|
+
const tabScrollWidth = vue.ref(0);
|
|
50
|
+
const tabScrollLeft = vue.ref(0);
|
|
51
|
+
const tabScrollable = vue.ref(false);
|
|
52
|
+
const tabScrollDragging = vue.ref(false);
|
|
53
|
+
const activeOver = vue.ref("");
|
|
43
54
|
let scrollTimer = null;
|
|
44
55
|
const controlShow = vue.ref(false);
|
|
45
56
|
let stopChange = false;
|
|
57
|
+
let activeOverVersion = 0;
|
|
46
58
|
const slot = vue.useSlots();
|
|
59
|
+
const { isPc } = useDevice.useDevice();
|
|
60
|
+
const tabScrollShow = vue.computed(() => isPc.value && tabScrollable.value);
|
|
61
|
+
const tabScrollStyle = vue.computed(() => {
|
|
62
|
+
return {
|
|
63
|
+
width: `${tabScrollWidth.value}px`,
|
|
64
|
+
left: `${tabScrollLeft.value}px`
|
|
65
|
+
};
|
|
66
|
+
});
|
|
47
67
|
vue.watch(
|
|
48
68
|
() => props.modelValue,
|
|
49
69
|
(val, old) => {
|
|
@@ -64,8 +84,26 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
64
84
|
},
|
|
65
85
|
{ deep: true }
|
|
66
86
|
);
|
|
87
|
+
vue.watch(
|
|
88
|
+
() => isPc.value,
|
|
89
|
+
() => {
|
|
90
|
+
updateTabLayout();
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
vue.watch(
|
|
94
|
+
() => props.over,
|
|
95
|
+
() => {
|
|
96
|
+
updateTabLayout();
|
|
97
|
+
}
|
|
98
|
+
);
|
|
67
99
|
vue.onMounted(() => {
|
|
68
100
|
initData();
|
|
101
|
+
window.addEventListener("resize", updateTabLayout);
|
|
102
|
+
});
|
|
103
|
+
vue.onBeforeUnmount(() => {
|
|
104
|
+
window.removeEventListener("resize", updateTabLayout);
|
|
105
|
+
stopTabScrollDrag();
|
|
106
|
+
scrollStop();
|
|
69
107
|
});
|
|
70
108
|
function initData() {
|
|
71
109
|
if (props.data && props.data.length) {
|
|
@@ -86,6 +124,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
86
124
|
setLayout();
|
|
87
125
|
});
|
|
88
126
|
}
|
|
127
|
+
if (props.over === "float") {
|
|
128
|
+
updateOverflowTabs();
|
|
129
|
+
}
|
|
130
|
+
updateTabScroll();
|
|
131
|
+
updateActiveOver();
|
|
89
132
|
}
|
|
90
133
|
const setTabStyle = vue.computed(() => {
|
|
91
134
|
let obj = {};
|
|
@@ -122,12 +165,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
122
165
|
if (props.align) {
|
|
123
166
|
arr.push(`align-${props.align}`);
|
|
124
167
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const setUlClass = vue.computed(() => {
|
|
128
|
-
let arr = [];
|
|
129
|
-
if (props.over) {
|
|
130
|
-
arr.push(`over-${props.over}`);
|
|
168
|
+
if (activeOver.value) {
|
|
169
|
+
arr.push(`over-${activeOver.value}`);
|
|
131
170
|
}
|
|
132
171
|
return arr;
|
|
133
172
|
});
|
|
@@ -142,8 +181,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
142
181
|
}
|
|
143
182
|
return obj;
|
|
144
183
|
});
|
|
145
|
-
async function changeTab(item, index, event) {
|
|
146
|
-
if (props.event !== event)
|
|
184
|
+
async function changeTab(item, index, event, force = false) {
|
|
185
|
+
if (!force && props.event !== event)
|
|
147
186
|
return false;
|
|
148
187
|
if (item.disabled)
|
|
149
188
|
return false;
|
|
@@ -170,6 +209,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
170
209
|
setTimeout(() => {
|
|
171
210
|
stopChange = false;
|
|
172
211
|
}, 10);
|
|
212
|
+
return true;
|
|
173
213
|
}
|
|
174
214
|
async function removePTab(item, idx) {
|
|
175
215
|
let flag = true;
|
|
@@ -198,6 +238,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
198
238
|
if (props.over === "control") {
|
|
199
239
|
setLayout();
|
|
200
240
|
}
|
|
241
|
+
if (props.over === "float") {
|
|
242
|
+
updateOverflowTabs();
|
|
243
|
+
}
|
|
244
|
+
updateTabScroll();
|
|
245
|
+
updateActiveOver();
|
|
201
246
|
emit("remove", item.value, item, idx);
|
|
202
247
|
setTimeout(() => {
|
|
203
248
|
stopChange = false;
|
|
@@ -221,6 +266,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
221
266
|
setLayout();
|
|
222
267
|
});
|
|
223
268
|
}
|
|
269
|
+
if (props.over === "float") {
|
|
270
|
+
updateOverflowTabs();
|
|
271
|
+
}
|
|
272
|
+
updateTabScroll();
|
|
273
|
+
updateActiveOver();
|
|
224
274
|
}
|
|
225
275
|
setTimeout(() => {
|
|
226
276
|
stopChange = false;
|
|
@@ -230,6 +280,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
230
280
|
let idx = _data.value.findIndex((item) => item.label === oldLabel);
|
|
231
281
|
if (idx !== -1) {
|
|
232
282
|
_data.value[idx].label = label;
|
|
283
|
+
updateTabLayout();
|
|
233
284
|
}
|
|
234
285
|
}
|
|
235
286
|
function getPicOn(pic) {
|
|
@@ -255,31 +306,208 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
255
306
|
function contextmenu(item, idx) {
|
|
256
307
|
emit("contextmenu", item.value, item, idx);
|
|
257
308
|
}
|
|
309
|
+
function updateTabLayout() {
|
|
310
|
+
if (props.over === "control") {
|
|
311
|
+
setLayout();
|
|
312
|
+
}
|
|
313
|
+
updateActiveOver();
|
|
314
|
+
updateOverflowTabs();
|
|
315
|
+
updateTabScroll();
|
|
316
|
+
}
|
|
317
|
+
function handleListScroll() {
|
|
318
|
+
setOverflowTabs();
|
|
319
|
+
setTabScroll();
|
|
320
|
+
}
|
|
321
|
+
function updateOverflowTabs() {
|
|
322
|
+
vue.nextTick(() => {
|
|
323
|
+
setOverflowTabs();
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
function setOverflowTabs() {
|
|
327
|
+
if (props.over !== "float" || !list.value || !ul.value) {
|
|
328
|
+
overflowTabs.value = [];
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const listRect = list.value.getBoundingClientRect();
|
|
332
|
+
if (!listRect.width || !listRect.height) {
|
|
333
|
+
overflowTabs.value = [];
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const hiddenIndexes = /* @__PURE__ */ new Set();
|
|
337
|
+
const itemNodes = Array.from(ul.value.querySelectorAll(".to-tab-item"));
|
|
338
|
+
itemNodes.forEach((node) => {
|
|
339
|
+
const index = Number(node.dataset.tabIndex);
|
|
340
|
+
if (Number.isNaN(index))
|
|
341
|
+
return;
|
|
342
|
+
const rect = node.getBoundingClientRect();
|
|
343
|
+
const isHidden = rect.left < listRect.left - 1 || rect.right > listRect.right + 1 || rect.top < listRect.top - 1 || rect.bottom > listRect.bottom + 1;
|
|
344
|
+
if (isHidden) {
|
|
345
|
+
hiddenIndexes.add(index);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
const oldShow = overflowTabs.value.length > 0;
|
|
349
|
+
overflowTabs.value = _data.value.map((item, index) => ({ item, index })).filter((tab) => hiddenIndexes.has(tab.index));
|
|
350
|
+
if (oldShow !== overflowTabs.value.length > 0) {
|
|
351
|
+
updateOverflowTabs();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function updateTabScroll() {
|
|
355
|
+
vue.nextTick(() => {
|
|
356
|
+
setTabScroll();
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function setTabScroll() {
|
|
360
|
+
if (!isPc.value || !list.value || !ul.value) {
|
|
361
|
+
tabScrollable.value = false;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const listWidth = list.value.clientWidth;
|
|
365
|
+
const scrollWidth = ul.value.scrollWidth;
|
|
366
|
+
const scrollRange = scrollWidth - listWidth;
|
|
367
|
+
if (listWidth <= 0 || scrollRange <= 1) {
|
|
368
|
+
tabScrollable.value = false;
|
|
369
|
+
tabScrollWidth.value = 0;
|
|
370
|
+
tabScrollLeft.value = 0;
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
tabScrollable.value = true;
|
|
374
|
+
tabScrollWidth.value = Math.max(listWidth * listWidth / scrollWidth, 16);
|
|
375
|
+
const trackRange = Math.max(listWidth - tabScrollWidth.value, 0);
|
|
376
|
+
const scrollRatio = list.value.scrollLeft / scrollRange;
|
|
377
|
+
tabScrollLeft.value = list.value.scrollLeft + scrollRatio * trackRange;
|
|
378
|
+
}
|
|
379
|
+
function getTabScrollRange() {
|
|
380
|
+
if (!list.value || !ul.value)
|
|
381
|
+
return 0;
|
|
382
|
+
return Math.max(ul.value.scrollWidth - list.value.clientWidth, 0);
|
|
383
|
+
}
|
|
384
|
+
async function updateActiveOver() {
|
|
385
|
+
const version = ++activeOverVersion;
|
|
386
|
+
const over = props.over;
|
|
387
|
+
if (over !== "avg" && over !== "wrap") {
|
|
388
|
+
activeOver.value = over;
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
activeOver.value = "";
|
|
392
|
+
await vue.nextTick();
|
|
393
|
+
if (version !== activeOverVersion || props.over !== over || !list.value || !ul.value)
|
|
394
|
+
return;
|
|
395
|
+
activeOver.value = getTabScrollRange() > 1 ? over : "";
|
|
396
|
+
await vue.nextTick();
|
|
397
|
+
if (version !== activeOverVersion)
|
|
398
|
+
return;
|
|
399
|
+
setTabScroll();
|
|
400
|
+
}
|
|
401
|
+
function setTabScrollLeft(scrollLeft) {
|
|
402
|
+
if (!list.value)
|
|
403
|
+
return;
|
|
404
|
+
const scrollRange = getTabScrollRange();
|
|
405
|
+
list.value.scrollLeft = Math.max(0, Math.min(scrollRange, scrollLeft));
|
|
406
|
+
setTabScroll();
|
|
407
|
+
setOverflowTabs();
|
|
408
|
+
}
|
|
409
|
+
function startTabScrollDrag(event) {
|
|
410
|
+
if (!tabScrollShow.value || !list.value || !ul.value)
|
|
411
|
+
return;
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
tabScrollDragging.value = true;
|
|
414
|
+
const startX = event.clientX;
|
|
415
|
+
const startScrollLeft = list.value.scrollLeft;
|
|
416
|
+
const listWidth = list.value.clientWidth;
|
|
417
|
+
const scrollRange = getTabScrollRange();
|
|
418
|
+
const trackRange = Math.max(listWidth - tabScrollWidth.value, 1);
|
|
419
|
+
const move = (moveEvent) => {
|
|
420
|
+
moveEvent.preventDefault();
|
|
421
|
+
const nextScrollLeft = startScrollLeft + (moveEvent.clientX - startX) / trackRange * scrollRange;
|
|
422
|
+
setTabScrollLeft(nextScrollLeft);
|
|
423
|
+
};
|
|
424
|
+
const up = () => {
|
|
425
|
+
stopTabScrollDrag();
|
|
426
|
+
};
|
|
427
|
+
window.addEventListener("mousemove", move);
|
|
428
|
+
window.addEventListener("mouseup", up, { once: true });
|
|
429
|
+
tabScrollMove = move;
|
|
430
|
+
tabScrollUp = up;
|
|
431
|
+
}
|
|
432
|
+
let tabScrollMove = null;
|
|
433
|
+
let tabScrollUp = null;
|
|
434
|
+
function stopTabScrollDrag() {
|
|
435
|
+
tabScrollDragging.value = false;
|
|
436
|
+
if (tabScrollMove) {
|
|
437
|
+
window.removeEventListener("mousemove", tabScrollMove);
|
|
438
|
+
tabScrollMove = null;
|
|
439
|
+
}
|
|
440
|
+
if (tabScrollUp) {
|
|
441
|
+
window.removeEventListener("mouseup", tabScrollUp);
|
|
442
|
+
tabScrollUp = null;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
async function toggleOverflowFloat() {
|
|
446
|
+
var _a, _b, _c, _d;
|
|
447
|
+
updateOverflowTabs();
|
|
448
|
+
await vue.nextTick();
|
|
449
|
+
if (overflowTabs.value.length) {
|
|
450
|
+
(_b = (_a = overflowFloatRef.value) == null ? void 0 : _a.toggle) == null ? void 0 : _b.call(_a, overflowIconRef.value);
|
|
451
|
+
} else {
|
|
452
|
+
(_d = (_c = overflowFloatRef.value) == null ? void 0 : _c.close) == null ? void 0 : _d.call(_c);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
async function changeOverflowTab(tab) {
|
|
456
|
+
var _a, _b;
|
|
457
|
+
const changed = await changeTab(tab.item, tab.index, "click", true);
|
|
458
|
+
if (changed !== false) {
|
|
459
|
+
(_b = (_a = overflowFloatRef.value) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a);
|
|
460
|
+
scrollTabIntoView(tab.index);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
async function removeOverflowTab(tab) {
|
|
464
|
+
var _a, _b;
|
|
465
|
+
await removePTab(tab.item, tab.index);
|
|
466
|
+
updateOverflowTabs();
|
|
467
|
+
await vue.nextTick();
|
|
468
|
+
if (!overflowTabs.value.length) {
|
|
469
|
+
(_b = (_a = overflowFloatRef.value) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function scrollTabIntoView(index) {
|
|
473
|
+
vue.nextTick(() => {
|
|
474
|
+
var _a;
|
|
475
|
+
const node = (_a = ul.value) == null ? void 0 : _a.querySelector(`.to-tab-item[data-tab-index="${index}"]`);
|
|
476
|
+
node == null ? void 0 : node.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
477
|
+
updateOverflowTabs();
|
|
478
|
+
updateTabScroll();
|
|
479
|
+
});
|
|
480
|
+
}
|
|
258
481
|
function controlLeftScroll() {
|
|
259
482
|
scrollTimer = setInterval(() => {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
// behavior: 'smooth' // 平滑滚动效果
|
|
263
|
-
});
|
|
483
|
+
var _a;
|
|
484
|
+
setTabScrollLeft((((_a = list.value) == null ? void 0 : _a.scrollLeft) || 0) - 3);
|
|
264
485
|
}, 1);
|
|
265
486
|
}
|
|
266
487
|
function controlRightScroll() {
|
|
267
488
|
scrollTimer = setInterval(() => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
// behavior: 'smooth' // 平滑滚动效果
|
|
271
|
-
});
|
|
489
|
+
var _a;
|
|
490
|
+
setTabScrollLeft((((_a = list.value) == null ? void 0 : _a.scrollLeft) || 0) + 3);
|
|
272
491
|
}, 1);
|
|
273
492
|
}
|
|
274
493
|
function scrollStop() {
|
|
275
|
-
|
|
494
|
+
if (scrollTimer) {
|
|
495
|
+
clearInterval(scrollTimer);
|
|
496
|
+
scrollTimer = null;
|
|
497
|
+
}
|
|
276
498
|
}
|
|
277
499
|
function setLayout() {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
500
|
+
vue.nextTick(() => {
|
|
501
|
+
if (!list.value || !ul.value) {
|
|
502
|
+
controlShow.value = false;
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
controlShow.value = getTabScrollRange() > 1;
|
|
506
|
+
if (!controlShow.value) {
|
|
507
|
+
list.value.scrollLeft = 0;
|
|
508
|
+
}
|
|
509
|
+
setTabScroll();
|
|
510
|
+
});
|
|
283
511
|
}
|
|
284
512
|
vue.provide("TabProvide", {
|
|
285
513
|
addTab,
|
|
@@ -289,6 +517,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
289
517
|
});
|
|
290
518
|
return (_ctx, _cache) => {
|
|
291
519
|
const _component_to_pic = vue.resolveComponent("to-pic");
|
|
520
|
+
const _component_to_scroll = vue.resolveComponent("to-scroll");
|
|
292
521
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
293
522
|
key: vue.unref(index.langKey),
|
|
294
523
|
class: vue.normalizeClass(["to-tab", setClass.value]),
|
|
@@ -315,7 +544,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
315
544
|
{
|
|
316
545
|
ref_key: "list",
|
|
317
546
|
ref: list,
|
|
318
|
-
class: "to-tab-list"
|
|
547
|
+
class: "to-tab-list",
|
|
548
|
+
onScroll: handleListScroll
|
|
319
549
|
},
|
|
320
550
|
[
|
|
321
551
|
vue.createElementVNode(
|
|
@@ -323,7 +553,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
323
553
|
{
|
|
324
554
|
ref_key: "ul",
|
|
325
555
|
ref: ul,
|
|
326
|
-
class:
|
|
556
|
+
class: "to-tab-wrapper"
|
|
327
557
|
},
|
|
328
558
|
[
|
|
329
559
|
(vue.openBlock(true), vue.createElementBlock(
|
|
@@ -339,6 +569,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
339
569
|
])) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
340
570
|
key: 1,
|
|
341
571
|
class: vue.normalizeClass(["to-tab-item", { "is-on": item.value === selectValue.value, "is-disabled": item.disabled }]),
|
|
572
|
+
"data-tab-index": index,
|
|
342
573
|
style: vue.normalizeStyle(setTabStyle.value),
|
|
343
574
|
onClick: ($event) => changeTab(item, index, "click"),
|
|
344
575
|
onMouseover: ($event) => changeTab(item, index, "hover"),
|
|
@@ -356,16 +587,13 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
356
587
|
class: "to-tab-item-pic",
|
|
357
588
|
src: item.value === selectValue.value ? getPicOn(item.pic) : item.pic
|
|
358
589
|
}, null, 8, ["src"])) : vue.createCommentVNode("v-if", true),
|
|
359
|
-
item.icon ? (vue.openBlock(), vue.
|
|
590
|
+
item.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.ToIcon), {
|
|
360
591
|
key: 1,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
mode: "tab-icon"
|
|
367
|
-
}, null, 8, ["value", "type"])
|
|
368
|
-
])) : vue.createCommentVNode("v-if", true),
|
|
592
|
+
value: item.icon,
|
|
593
|
+
class: "to-tab-item-icon",
|
|
594
|
+
type: item.value === selectValue.value ? "fill" : "",
|
|
595
|
+
mode: "tab-icon"
|
|
596
|
+
}, null, 8, ["value", "type"])) : vue.createCommentVNode("v-if", true),
|
|
369
597
|
vue.createElementVNode("div", { class: "to-tab-item-label" }, [
|
|
370
598
|
vue.renderSlot(_ctx.$slots, "label", vue.mergeProps({ ref_for: true }, item), () => [
|
|
371
599
|
vue.createTextVNode(
|
|
@@ -387,7 +615,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
387
615
|
]),
|
|
388
616
|
vue.createElementVNode("div", { class: "to-tab-indicator" })
|
|
389
617
|
])
|
|
390
|
-
], 46, ["onClick", "onMouseover", "onContextmenu"]))
|
|
618
|
+
], 46, ["data-tab-index", "onClick", "onMouseover", "onContextmenu"]))
|
|
391
619
|
],
|
|
392
620
|
64
|
|
393
621
|
/* STABLE_FRAGMENT */
|
|
@@ -397,14 +625,30 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
397
625
|
/* KEYED_FRAGMENT */
|
|
398
626
|
))
|
|
399
627
|
],
|
|
400
|
-
|
|
401
|
-
/*
|
|
402
|
-
)
|
|
628
|
+
512
|
|
629
|
+
/* NEED_PATCH */
|
|
630
|
+
),
|
|
631
|
+
tabScrollShow.value ? (vue.openBlock(), vue.createElementBlock(
|
|
632
|
+
"div",
|
|
633
|
+
{
|
|
634
|
+
key: 0,
|
|
635
|
+
ref_key: "tabScrollRef",
|
|
636
|
+
ref: tabScrollRef,
|
|
637
|
+
class: vue.normalizeClass(["to-tab-list-scroll", { "is-dragging": tabScrollDragging.value }]),
|
|
638
|
+
style: vue.normalizeStyle(tabScrollStyle.value),
|
|
639
|
+
onMousedown: startTabScrollDrag
|
|
640
|
+
},
|
|
641
|
+
[
|
|
642
|
+
vue.createElementVNode("div", { class: "to-tab-list-scroll-bar" })
|
|
643
|
+
],
|
|
644
|
+
38
|
|
645
|
+
/* CLASS, STYLE, NEED_HYDRATION */
|
|
646
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
403
647
|
],
|
|
404
|
-
|
|
405
|
-
/* NEED_PATCH */
|
|
648
|
+
544
|
|
649
|
+
/* NEED_HYDRATION, NEED_PATCH */
|
|
406
650
|
),
|
|
407
|
-
controlShow.value ||
|
|
651
|
+
controlShow.value || overflowFloatShow.value || vue.unref(slot).fn ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
408
652
|
key: 1,
|
|
409
653
|
class: "to-tab-fn"
|
|
410
654
|
}, [
|
|
@@ -427,11 +671,98 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
427
671
|
onMouseleave: scrollStop
|
|
428
672
|
})) : vue.createCommentVNode("v-if", true),
|
|
429
673
|
vue.renderSlot(_ctx.$slots, "fn"),
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
674
|
+
overflowFloatShow.value ? (vue.openBlock(), vue.createBlock(
|
|
675
|
+
vue.unref(index$1.ToIcon),
|
|
676
|
+
{
|
|
677
|
+
key: 2,
|
|
678
|
+
ref_key: "overflowIconRef",
|
|
679
|
+
ref: overflowIconRef,
|
|
680
|
+
value: "more",
|
|
681
|
+
link: "",
|
|
682
|
+
onClick: toggleOverflowFloat
|
|
683
|
+
},
|
|
684
|
+
null,
|
|
685
|
+
512
|
|
686
|
+
/* NEED_PATCH */
|
|
687
|
+
)) : vue.createCommentVNode("v-if", true),
|
|
688
|
+
overflowFloatShow.value ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
689
|
+
key: 3,
|
|
690
|
+
to: "body"
|
|
691
|
+
}, [
|
|
692
|
+
vue.createElementVNode("div", { class: "to-tab" }, [
|
|
693
|
+
vue.createVNode(
|
|
694
|
+
vue.unref(index$2.ToFloat),
|
|
695
|
+
{
|
|
696
|
+
ref_key: "overflowFloatRef",
|
|
697
|
+
ref: overflowFloatRef,
|
|
698
|
+
align: "right",
|
|
699
|
+
global: false,
|
|
700
|
+
class: "to-tab-over-float",
|
|
701
|
+
lazy: false,
|
|
702
|
+
width: "12"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
default: vue.withCtx(() => [
|
|
706
|
+
vue.createVNode(_component_to_scroll, { class: "to-tab-over-scroll" }, {
|
|
707
|
+
default: vue.withCtx(() => [
|
|
708
|
+
vue.createElementVNode("div", { class: "to-tab-over-list" }, [
|
|
709
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
710
|
+
vue.Fragment,
|
|
711
|
+
null,
|
|
712
|
+
vue.renderList(overflowTabs.value, (tab) => {
|
|
713
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
714
|
+
key: tab.index,
|
|
715
|
+
class: vue.normalizeClass(["to-tab-over-item", { "is-on": tab.item.value === selectValue.value, "is-disabled": tab.item.disabled }]),
|
|
716
|
+
onClick: ($event) => changeOverflowTab(tab),
|
|
717
|
+
onContextmenu: ($event) => contextmenu(tab.item, tab.index)
|
|
718
|
+
}, [
|
|
719
|
+
tab.item.pic ? (vue.openBlock(), vue.createBlock(_component_to_pic, {
|
|
720
|
+
key: 0,
|
|
721
|
+
class: "to-tab-over-item-pic",
|
|
722
|
+
src: tab.item.value === selectValue.value ? getPicOn(tab.item.pic) : tab.item.pic
|
|
723
|
+
}, null, 8, ["src"])) : vue.createCommentVNode("v-if", true),
|
|
724
|
+
tab.item.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.ToIcon), {
|
|
725
|
+
key: 1,
|
|
726
|
+
value: tab.item.icon,
|
|
727
|
+
class: "to-tab-over-item-icon",
|
|
728
|
+
type: tab.item.value === selectValue.value ? "fill" : "",
|
|
729
|
+
mode: "tab-icon"
|
|
730
|
+
}, null, 8, ["value", "type"])) : vue.createCommentVNode("v-if", true),
|
|
731
|
+
vue.createElementVNode("div", { class: "to-tab-over-item-label" }, [
|
|
732
|
+
vue.renderSlot(_ctx.$slots, "label", vue.mergeProps({ ref_for: true }, tab.item), () => [
|
|
733
|
+
vue.createTextVNode(
|
|
734
|
+
vue.toDisplayString(tab.item.label),
|
|
735
|
+
1
|
|
736
|
+
/* TEXT */
|
|
737
|
+
)
|
|
738
|
+
])
|
|
739
|
+
]),
|
|
740
|
+
_ctx.removable ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.ToIcon), {
|
|
741
|
+
key: 2,
|
|
742
|
+
value: "close",
|
|
743
|
+
link: "",
|
|
744
|
+
class: "to-tab-over-item-remove",
|
|
745
|
+
onClick: vue.withModifiers(($event) => removeOverflowTab(tab), ["stop"])
|
|
746
|
+
}, null, 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
|
|
747
|
+
], 42, ["onClick", "onContextmenu"]);
|
|
748
|
+
}),
|
|
749
|
+
128
|
|
750
|
+
/* KEYED_FRAGMENT */
|
|
751
|
+
))
|
|
752
|
+
])
|
|
753
|
+
]),
|
|
754
|
+
_: 3
|
|
755
|
+
/* FORWARDED */
|
|
756
|
+
})
|
|
757
|
+
]),
|
|
758
|
+
_: 3
|
|
759
|
+
/* FORWARDED */
|
|
760
|
+
},
|
|
761
|
+
512
|
|
762
|
+
/* NEED_PATCH */
|
|
763
|
+
)
|
|
764
|
+
])
|
|
765
|
+
])) : vue.createCommentVNode("v-if", true)
|
|
435
766
|
])) : vue.createCommentVNode("v-if", true),
|
|
436
767
|
vue.createElementVNode("div", { class: "to-tab-divider" })
|
|
437
768
|
]),
|