dou-ui 0.1.0-alpha.21 → 0.1.0-alpha.23
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/components/chat-input/chat-input.vue_vue_type_script_setup_true_lang.js +19 -14
- package/dist/components/chat-input/chat-input.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/chat-input/chat-input2.js.map +1 -1
- package/dist/components/chat-list/chat-list.js.map +1 -1
- package/dist/components/chat-list/chat-list.vue_vue_type_script_setup_true_lang.js +51 -19
- package/dist/components/chat-list/chat-list.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/chat-list/chat-list2.js.map +1 -1
- package/dist/components/chat-message/chat-message.js.map +1 -1
- package/dist/components/chat-message/chat-message.vue_vue_type_script_setup_true_lang.js +52 -12
- package/dist/components/chat-message/chat-message.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/chat-message/chat-message2.js.map +1 -1
- package/dist/components/chat-plan/chat-plan.js.map +1 -1
- package/dist/components/chat-plan/chat-plan.vue_vue_type_script_setup_true_lang.js +22 -9
- package/dist/components/chat-plan/chat-plan.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/chat-plan/chat-plan2.js.map +1 -1
- package/dist/components/code-block/code-block.js.map +1 -1
- package/dist/components/code-block/code-block.vue_vue_type_script_setup_true_lang.js +144 -7
- package/dist/components/code-block/code-block.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dock/dock-group.js.map +1 -1
- package/dist/components/dock/dock-group.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/components/dock/dock-group.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dock/dock.js.map +1 -1
- package/dist/components/dock/dock.vue_vue_type_script_setup_true_lang.js +30 -4
- package/dist/components/dock/dock.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dock/style.js +1 -0
- package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/form/form2.js.map +1 -1
- package/dist/components/image/image-preview.js.map +1 -1
- package/dist/components/image/image-preview.vue_vue_type_script_setup_true_lang.js +63 -95
- package/dist/components/image/image-preview.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/image/use-preview-viewport.js +619 -0
- package/dist/components/image/use-preview-viewport.js.map +1 -0
- package/dist/components/image/viewport.js +142 -0
- package/dist/components/image/viewport.js.map +1 -0
- package/dist/components/link/link.js.map +1 -1
- package/dist/components/link/link.vue_vue_type_script_setup_true_lang.js +59 -14
- package/dist/components/link/link.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/popover/popover.vue_vue_type_script_setup_true_lang.js +13 -3
- package/dist/components/popover/popover.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/splitter/splitter.js.map +1 -1
- package/dist/components/splitter/splitter.vue_vue_type_script_setup_true_lang.js +111 -41
- package/dist/components/splitter/splitter.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/style.js +1 -0
- package/dist/components/tabs/tab-button.js +6 -0
- package/dist/components/tabs/tab-button.js.map +1 -0
- package/dist/components/tabs/tab-button.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/components/tabs/tab-button.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/tabs/tab-drag.js +10 -2
- package/dist/components/tabs/tab-drag.js.map +1 -1
- package/dist/components/tabs/tab-panel.js.map +1 -1
- package/dist/components/tabs/tab-panel.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/components/tabs/tab-panel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/tabs/tabs.vue_vue_type_script_setup_true_lang.js +430 -181
- package/dist/components/tabs/tabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tabs2.js.map +1 -1
- package/dist/components/virtual-list/virtual-list.vue_vue_type_script_setup_true_lang.js +77 -34
- package/dist/components/virtual-list/virtual-list.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/virtual-list/virtual-list2.js.map +1 -1
- package/dist/composables/use-floating.js +60 -8
- package/dist/composables/use-floating.js.map +1 -1
- package/dist/composables/use-measured-sizes.js +7 -3
- package/dist/composables/use-measured-sizes.js.map +1 -1
- package/dist/composables/use-popup.js +3 -0
- package/dist/composables/use-popup.js.map +1 -1
- package/dist/composables/use-touch-scroll.js +141 -29
- package/dist/composables/use-touch-scroll.js.map +1 -1
- package/dist/locale/en.js +3 -2
- package/dist/locale/en.js.map +1 -1
- package/dist/locale/zh-cn.js +3 -2
- package/dist/locale/zh-cn.js.map +1 -1
- package/dist/locale/zh-tw.js +3 -2
- package/dist/locale/zh-tw.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/chat-list/chat-list.d.ts +13 -0
- package/dist/types/components/chat-list/index.d.ts +2 -0
- package/dist/types/components/chat-message/chat-message.d.ts +19 -0
- package/dist/types/components/chat-message/chat-message.vue.d.ts +1 -0
- package/dist/types/components/chat-message/index.d.ts +3 -0
- package/dist/types/components/chat-plan/chat-plan.d.ts +3 -1
- package/dist/types/components/chat-plan/chat-plan.vue.d.ts +1 -0
- package/dist/types/components/chat-plan/index.d.ts +3 -0
- package/dist/types/components/code-block/code-block.d.ts +23 -0
- package/dist/types/components/code-block/code-block.vue.d.ts +8 -2
- package/dist/types/components/code-block/index.d.ts +19 -3
- package/dist/types/components/dock/dock.d.ts +6 -0
- package/dist/types/components/image/image.d.ts +1 -1
- package/dist/types/components/image/use-preview-viewport.d.ts +48 -0
- package/dist/types/components/image/viewport.d.ts +58 -0
- package/dist/types/components/link/index.d.ts +3 -0
- package/dist/types/components/link/link.d.ts +12 -3
- package/dist/types/components/link/link.vue.d.ts +1 -0
- package/dist/types/components/popover/index.d.ts +3 -0
- package/dist/types/components/popover/popover.d.ts +7 -0
- package/dist/types/components/popover/popover.vue.d.ts +1 -0
- package/dist/types/components/splitter/index.d.ts +6 -9
- package/dist/types/components/splitter/splitter.d.ts +31 -4
- package/dist/types/components/splitter/splitter.vue.d.ts +3 -4
- package/dist/types/components/tabs/index.d.ts +3 -0
- package/dist/types/components/tabs/tab-button.vue.d.ts +28 -0
- package/dist/types/components/tabs/tab-drag.d.ts +8 -0
- package/dist/types/components/tabs/tab-panel.vue.d.ts +1 -0
- package/dist/types/components/tabs/tabs.d.ts +6 -0
- package/dist/types/composables/use-floating.d.ts +1 -1
- package/dist/types/composables/use-measured-sizes.d.ts +2 -0
- package/dist/types/composables/use-touch-scroll.d.ts +8 -0
- package/dist/types/locale/types.d.ts +6 -3
- package/package.json +3 -3
|
@@ -4,31 +4,30 @@ import { useLocale } from "../config-provider/use-config.js";
|
|
|
4
4
|
import { useReducedMotion } from "../../composables/use-motion.js";
|
|
5
5
|
import { devWarn } from "../../utils/status-check.js";
|
|
6
6
|
import { useFormSize } from "../form/use-form-item.js";
|
|
7
|
-
import {
|
|
7
|
+
import { DouPopover } from "../popover/index.js";
|
|
8
8
|
import { announce } from "../../utils/announce.js";
|
|
9
|
+
import tab_button_default from "./tab-button.js";
|
|
9
10
|
import { pressTab, registerTabDropZone } from "./tab-drag.js";
|
|
10
11
|
import { tabsKey } from "./tabs.js";
|
|
11
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent,
|
|
12
|
-
import {
|
|
12
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onUpdated, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toRef, triggerRef, unref, useId, useModel, useSlots, useTemplateRef, watch, withCtx, withModifiers } from "vue";
|
|
13
|
+
import { CheckIcon, ChevronDownIcon, CloseIcon, PinIcon, PlusIcon } from "@dou-ui/icons";
|
|
13
14
|
// src/components/tabs/tabs.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
-
var _hoisted_1 = ["
|
|
15
|
-
var _hoisted_2 = ["aria-
|
|
16
|
-
var _hoisted_3 = [
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"aria-
|
|
20
|
-
"aria-label",
|
|
21
|
-
"aria-disabled",
|
|
22
|
-
"tabindex",
|
|
15
|
+
var _hoisted_1 = ["aria-orientation"];
|
|
16
|
+
var _hoisted_2 = ["aria-label"];
|
|
17
|
+
var _hoisted_3 = ["aria-label"];
|
|
18
|
+
var _hoisted_4 = [
|
|
19
|
+
"disabled",
|
|
20
|
+
"aria-current",
|
|
23
21
|
"aria-keyshortcuts",
|
|
24
22
|
"onClick",
|
|
25
|
-
"onPointerdown",
|
|
26
23
|
"onKeydown"
|
|
27
24
|
];
|
|
28
|
-
var
|
|
29
|
-
|
|
25
|
+
var _hoisted_5 = [
|
|
26
|
+
"aria-label",
|
|
27
|
+
"title",
|
|
28
|
+
"onClick"
|
|
29
|
+
];
|
|
30
30
|
var _hoisted_6 = ["aria-label"];
|
|
31
|
-
var ARROWS_MIN_WIDTH = 160;
|
|
32
31
|
var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
33
32
|
name: "DouTabs",
|
|
34
33
|
__name: "tabs",
|
|
@@ -97,8 +96,14 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
97
96
|
function reorder() {
|
|
98
97
|
if (!sync()) triggerRef(panels);
|
|
99
98
|
}
|
|
100
|
-
onUpdated(
|
|
101
|
-
|
|
99
|
+
onUpdated(() => {
|
|
100
|
+
sync();
|
|
101
|
+
updateOverflow();
|
|
102
|
+
});
|
|
103
|
+
const pinnedPanels = computed(() => panels.value.filter((entry) => !!entry.props.pinned));
|
|
104
|
+
const regularPanels = computed(() => panels.value.filter((entry) => !entry.props.pinned));
|
|
105
|
+
const orderedPanels = computed(() => [...pinnedPanels.value, ...regularPanels.value]);
|
|
106
|
+
const firstEnabled = computed(() => orderedPanels.value.find((entry) => !entry.props.disabled));
|
|
102
107
|
const selected = computed(() => model.value ?? firstEnabled.value?.props.value);
|
|
103
108
|
const key = (value) => String(value).replace(/\s+/g, "-");
|
|
104
109
|
const tabId = (value) => `${id}-tab-${key(value)}`;
|
|
@@ -116,30 +121,38 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
116
121
|
await selectValue(entry.props.value);
|
|
117
122
|
}
|
|
118
123
|
async function selectValue(next) {
|
|
119
|
-
if (next === selected.value) return;
|
|
120
|
-
if (props.beforeLeave && !await props.beforeLeave(next, selected.value)) return;
|
|
124
|
+
if (next === selected.value) return true;
|
|
125
|
+
if (props.beforeLeave && !await props.beforeLeave(next, selected.value)) return false;
|
|
121
126
|
model.value = next;
|
|
122
127
|
emit("change", next);
|
|
128
|
+
return true;
|
|
123
129
|
}
|
|
124
|
-
const isClosable = (entry) => !entry.props.disabled && (entry.props.closable ?? props.closable);
|
|
130
|
+
const isClosable = (entry) => !entry.props.disabled && (entry.props.closable ?? (entry.props.pinned ? false : props.closable));
|
|
125
131
|
function remove(entry) {
|
|
126
132
|
if (isClosable(entry)) emit("remove", entry.props.value);
|
|
127
133
|
}
|
|
128
134
|
const listRef = useTemplateRef("list");
|
|
135
|
+
const pinnedRef = useTemplateRef("pinned");
|
|
129
136
|
const headerRef = useTemplateRef("header");
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
const pinnedTabElements = /* @__PURE__ */ new Map();
|
|
138
|
+
const regularTabElements = /* @__PURE__ */ new Map();
|
|
139
|
+
function setTabElement(zone, uid, el) {
|
|
140
|
+
const map = zone === "pinned" ? pinnedTabElements : regularTabElements;
|
|
141
|
+
if (el instanceof HTMLElement) map.set(uid, el);
|
|
142
|
+
else map.delete(uid);
|
|
134
143
|
}
|
|
135
144
|
function tabElement(entry) {
|
|
136
|
-
return
|
|
145
|
+
return (entry.props.pinned ? pinnedTabElements : regularTabElements).get(entry.uid);
|
|
137
146
|
}
|
|
138
|
-
/** The label slot of a panel, rendered inside its
|
|
147
|
+
/** The label slot of a panel, rendered inside its overflow list item. */
|
|
139
148
|
const TabLabel = ({ entry, selected: isSelected }) => entry.slots.label?.({ selected: isSelected }) ?? labelText(entry);
|
|
140
149
|
const labelText = (entry) => entry.props.label ?? String(entry.props.value);
|
|
141
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* Whether the tab shows its icon alone (with label in a tooltip):
|
|
152
|
+
* pinned tabs with an icon always do; with `iconOnly`, every tab with an icon does.
|
|
153
|
+
*/
|
|
142
154
|
function iconAlone(entry) {
|
|
155
|
+
if (entry.props.pinned) return !!entry.props.icon;
|
|
143
156
|
if (!props.iconOnly) return false;
|
|
144
157
|
if (entry.props.icon) {
|
|
145
158
|
if (process.env.NODE_ENV !== "production" && entry.props.label === void 0) devWarn(`[dou-ui] DouTabs: \`iconOnly\` names each tab by its \`label\`; the DouTabPanel "${entry.props.value}" has none and is named by its value.`);
|
|
@@ -149,13 +162,9 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
149
162
|
return false;
|
|
150
163
|
}
|
|
151
164
|
const tipPlacement = computed(() => props.placement === "start" ? "right" : props.placement === "end" ? "left" : "top");
|
|
152
|
-
const TabTip = ({ entry }, { slots: tip }) => iconAlone(entry) ? h(DouTooltip, {
|
|
153
|
-
content: labelText(entry),
|
|
154
|
-
placement: tipPlacement.value
|
|
155
|
-
}, tip) : tip.default?.();
|
|
156
165
|
function onKeydown(event, entry) {
|
|
157
166
|
if (event.altKey && isDraggable(entry) && moveByKey(event, entry)) return;
|
|
158
|
-
const enabled =
|
|
167
|
+
const enabled = orderedPanels.value.filter((panel) => !panel.props.disabled);
|
|
159
168
|
const index = enabled.indexOf(entry);
|
|
160
169
|
let target;
|
|
161
170
|
const [prev, next] = vertical.value ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"];
|
|
@@ -205,14 +214,15 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
205
214
|
if (!el) return;
|
|
206
215
|
pressTab(event, {
|
|
207
216
|
el,
|
|
208
|
-
root:
|
|
217
|
+
root: headerRef.value,
|
|
209
218
|
drag: () => ({
|
|
210
219
|
value: entry.props.value,
|
|
211
220
|
label: labelText(entry),
|
|
212
221
|
group: props.group,
|
|
213
222
|
name: props.name,
|
|
214
223
|
index: panels.value.indexOf(entry),
|
|
215
|
-
source: self
|
|
224
|
+
source: self,
|
|
225
|
+
pinned: !!entry.props.pinned
|
|
216
226
|
}),
|
|
217
227
|
onStart: () => draggingUid.value = entry.uid,
|
|
218
228
|
onEnd: () => {
|
|
@@ -222,10 +232,12 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
222
232
|
}
|
|
223
233
|
});
|
|
224
234
|
}
|
|
225
|
-
/** Where a tab dropped now would go: before the tab at `index`, or after the last. */
|
|
226
235
|
const marker = ref(null);
|
|
227
|
-
function
|
|
228
|
-
|
|
236
|
+
function zoneEntries(zone) {
|
|
237
|
+
return zone === "pinned" ? pinnedPanels.value : regularPanels.value;
|
|
238
|
+
}
|
|
239
|
+
function insertionAt(zone, x, y) {
|
|
240
|
+
const entries = zoneEntries(zone);
|
|
229
241
|
const index = entries.findIndex((entry) => {
|
|
230
242
|
const rect = tabElement(entry)?.getBoundingClientRect();
|
|
231
243
|
if (!rect) return false;
|
|
@@ -239,12 +251,25 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
239
251
|
*/
|
|
240
252
|
const fromHere = (drag) => drag.source === self || drag.name !== void 0 && drag.name === props.name && drag.group === props.group;
|
|
241
253
|
/** Whether dropping there leaves the tab where it is. */
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
|
|
254
|
+
function stays(drag, zone, slot) {
|
|
255
|
+
if (!fromHere(drag)) return false;
|
|
256
|
+
const currentIndex = zoneEntries(zone).findIndex((entry) => entry.props.value === drag.value);
|
|
257
|
+
return currentIndex >= 0 && (slot === currentIndex || slot === currentIndex + 1);
|
|
258
|
+
}
|
|
259
|
+
/** Map a visual zone slot back to an insertion index in `panels.value`. */
|
|
260
|
+
function rawInsertIndex(zone, slot) {
|
|
261
|
+
const entries = zoneEntries(zone);
|
|
262
|
+
if (!entries.length) return zone === "pinned" ? 0 : panels.value.length;
|
|
263
|
+
const before = entries[slot];
|
|
264
|
+
if (before) return panels.value.indexOf(before);
|
|
265
|
+
const last = entries.at(-1);
|
|
266
|
+
return panels.value.indexOf(last) + 1;
|
|
267
|
+
}
|
|
268
|
+
function markerOffset(zone, slot, container) {
|
|
269
|
+
const entries = zoneEntries(zone);
|
|
270
|
+
const style = getComputedStyle(container);
|
|
246
271
|
const gap = Number.parseFloat(vertical.value ? style.rowGap : style.columnGap) || 0;
|
|
247
|
-
const before = entries[
|
|
272
|
+
const before = entries[slot] && tabElement(entries[slot]);
|
|
248
273
|
if (before) return (vertical.value ? before.offsetTop : before.offsetLeft) - gap / 2;
|
|
249
274
|
const last = entries.at(-1);
|
|
250
275
|
const after = last && tabElement(last);
|
|
@@ -278,26 +303,34 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
278
303
|
el: () => headerRef.value,
|
|
279
304
|
accepts: (drag) => drag.source === self || props.draggable && !!props.group && drag.group === props.group,
|
|
280
305
|
over(drag, x, y) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
306
|
+
const zone = drag.pinned ? "pinned" : "regular";
|
|
307
|
+
if (zone === "regular") scrollNearEdge(x, y);
|
|
308
|
+
const slot = insertionAt(zone, x, y);
|
|
309
|
+
if (stays(drag, zone, slot)) {
|
|
284
310
|
marker.value = null;
|
|
285
311
|
return;
|
|
286
312
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
313
|
+
let at = 1;
|
|
314
|
+
if (zone === "regular" || pinnedPanels.value.length > 0) {
|
|
315
|
+
const container = zone === "pinned" ? pinnedRef.value : listRef.value;
|
|
316
|
+
if (container) {
|
|
317
|
+
const end = Math.max(1, (vertical.value ? container.scrollHeight : container.scrollWidth) - 2);
|
|
318
|
+
at = Math.min(Math.max(markerOffset(zone, slot, container), 1), end);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (marker.value?.zone !== zone || marker.value.slot !== slot || marker.value.at !== at) marker.value = {
|
|
322
|
+
zone,
|
|
323
|
+
slot,
|
|
292
324
|
at
|
|
293
325
|
};
|
|
294
326
|
},
|
|
295
327
|
leave: () => marker.value = null,
|
|
296
328
|
drop(drag) {
|
|
297
|
-
const
|
|
329
|
+
const current = marker.value;
|
|
298
330
|
marker.value = null;
|
|
299
|
-
if (
|
|
331
|
+
if (!current) return;
|
|
300
332
|
const within = fromHere(drag);
|
|
333
|
+
const raw = rawInsertIndex(current.zone, current.slot);
|
|
301
334
|
emit("move", {
|
|
302
335
|
value: drag.value,
|
|
303
336
|
from: {
|
|
@@ -306,7 +339,7 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
306
339
|
},
|
|
307
340
|
to: {
|
|
308
341
|
name: props.name,
|
|
309
|
-
index: within &&
|
|
342
|
+
index: within && raw > drag.index ? raw - 1 : raw
|
|
310
343
|
}
|
|
311
344
|
});
|
|
312
345
|
selectValue(drag.value);
|
|
@@ -319,37 +352,45 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
319
352
|
onUpdated(() => dropZone.update());
|
|
320
353
|
onBeforeUnmount(() => dropZone.remove());
|
|
321
354
|
const markerStyle = computed(() => {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
355
|
+
if (marker.value?.zone !== "regular") return { display: "none" };
|
|
356
|
+
return { transform: vertical.value ? `translateY(${marker.value.at}px)` : `translateX(${marker.value.at}px)` };
|
|
357
|
+
});
|
|
358
|
+
const pinnedMarkerStyle = computed(() => {
|
|
359
|
+
if (marker.value?.zone !== "pinned") return { display: "none" };
|
|
360
|
+
return { transform: vertical.value ? `translateY(${marker.value.at}px)` : `translateX(${marker.value.at}px)` };
|
|
325
361
|
});
|
|
326
362
|
/** A tab moved with the keyboard keeps the focus once it is in its new place. */
|
|
327
363
|
let focusAfterMove;
|
|
328
364
|
function moveByKey(event, entry) {
|
|
329
365
|
const [prev, next] = vertical.value ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"];
|
|
330
|
-
const
|
|
331
|
-
const
|
|
366
|
+
const zone = entry.props.pinned ? "pinned" : "regular";
|
|
367
|
+
const entries = zoneEntries(zone);
|
|
368
|
+
const zoneIndex = entries.indexOf(entry);
|
|
332
369
|
const last = entries.length - 1;
|
|
333
|
-
const
|
|
334
|
-
if (
|
|
370
|
+
const targetSlot = event.key === prev ? zoneIndex - 1 : event.key === next ? zoneIndex + 1 : event.key === "Home" ? 0 : event.key === "End" ? last : null;
|
|
371
|
+
if (targetSlot === null) return false;
|
|
335
372
|
event.preventDefault();
|
|
336
|
-
if (
|
|
373
|
+
if (targetSlot < 0 || targetSlot > last || targetSlot === zoneIndex) return true;
|
|
374
|
+
const fromIndex = panels.value.indexOf(entry);
|
|
375
|
+
const anchor = entries[targetSlot];
|
|
376
|
+
const toIndex = panels.value.indexOf(anchor);
|
|
337
377
|
focusAfterMove = entry.props.value;
|
|
338
378
|
emit("move", {
|
|
339
379
|
value: entry.props.value,
|
|
340
380
|
from: {
|
|
341
381
|
name: props.name,
|
|
342
|
-
index
|
|
382
|
+
index: fromIndex
|
|
343
383
|
},
|
|
344
384
|
to: {
|
|
345
385
|
name: props.name,
|
|
346
|
-
index:
|
|
386
|
+
index: toIndex
|
|
347
387
|
}
|
|
348
388
|
});
|
|
389
|
+
const position = (zone === "pinned" ? 0 : pinnedPanels.value.length) + targetSlot + 1;
|
|
349
390
|
announce(t("tabs.moved", {
|
|
350
391
|
label: labelText(entry),
|
|
351
|
-
position
|
|
352
|
-
total:
|
|
392
|
+
position,
|
|
393
|
+
total: orderedPanels.value.length
|
|
353
394
|
}));
|
|
354
395
|
return true;
|
|
355
396
|
}
|
|
@@ -366,61 +407,172 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
366
407
|
return keys.length ? keys.join(" ") : void 0;
|
|
367
408
|
}
|
|
368
409
|
const indicator = ref(null);
|
|
410
|
+
const pinnedIndicator = ref(null);
|
|
369
411
|
const settled = ref(false);
|
|
370
412
|
function measure() {
|
|
371
|
-
const
|
|
372
|
-
const entry = panels.value.find((panel) => panel.props.value === selected.value);
|
|
413
|
+
const entry = orderedPanels.value.find((panel) => panel.props.value === selected.value);
|
|
373
414
|
const tab = entry && tabElement(entry);
|
|
374
415
|
watchTab(tab);
|
|
375
|
-
if (!
|
|
416
|
+
if (!entry || !tab) {
|
|
376
417
|
indicator.value = null;
|
|
418
|
+
pinnedIndicator.value = null;
|
|
377
419
|
return;
|
|
378
420
|
}
|
|
379
|
-
|
|
421
|
+
const box = {
|
|
380
422
|
left: tab.offsetLeft,
|
|
381
423
|
top: tab.offsetTop,
|
|
382
424
|
width: tab.offsetWidth,
|
|
383
425
|
height: tab.offsetHeight
|
|
384
426
|
};
|
|
427
|
+
if (entry.props.pinned) {
|
|
428
|
+
pinnedIndicator.value = box;
|
|
429
|
+
indicator.value = null;
|
|
430
|
+
} else {
|
|
431
|
+
indicator.value = box;
|
|
432
|
+
pinnedIndicator.value = null;
|
|
433
|
+
}
|
|
385
434
|
}
|
|
386
435
|
const overflow = ref({
|
|
387
436
|
start: false,
|
|
388
|
-
end: false
|
|
437
|
+
end: false,
|
|
438
|
+
any: false
|
|
389
439
|
});
|
|
440
|
+
const hasOverflow = computed(() => !vertical.value && overflow.value.any);
|
|
441
|
+
const overflowOpen = ref(false);
|
|
390
442
|
const reduced = useReducedMotion();
|
|
391
|
-
|
|
443
|
+
function setOverflow(start, end, any) {
|
|
444
|
+
const prev = overflow.value;
|
|
445
|
+
if (prev.start === start && prev.end === end && prev.any === any) return;
|
|
446
|
+
overflow.value = {
|
|
447
|
+
start,
|
|
448
|
+
end,
|
|
449
|
+
any
|
|
450
|
+
};
|
|
451
|
+
}
|
|
392
452
|
function updateOverflow() {
|
|
393
|
-
const width = headerRef.value?.clientWidth || Infinity;
|
|
394
|
-
arrows.value = width >= ARROWS_MIN_WIDTH;
|
|
395
453
|
const list = listRef.value;
|
|
396
454
|
if (!list) {
|
|
397
|
-
|
|
398
|
-
start: false,
|
|
399
|
-
end: false
|
|
400
|
-
};
|
|
455
|
+
setOverflow(false, false, false);
|
|
401
456
|
return;
|
|
402
457
|
}
|
|
403
458
|
if (vertical.value) {
|
|
404
459
|
const max = list.scrollHeight - list.clientHeight;
|
|
405
460
|
const top = scrollPositionOf(list).top;
|
|
406
|
-
|
|
407
|
-
start: top > 1,
|
|
408
|
-
end: top < max - 1
|
|
409
|
-
};
|
|
461
|
+
setOverflow(top > 1, top < max - 1, false);
|
|
410
462
|
return;
|
|
411
463
|
}
|
|
412
464
|
const max = list.scrollWidth - list.clientWidth;
|
|
413
465
|
const left = Math.abs(scrollPositionOf(list).left);
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
466
|
+
setOverflow(left > 1, left < max - 1, max > 1);
|
|
467
|
+
}
|
|
468
|
+
watch(hasOverflow, (value) => {
|
|
469
|
+
if (!value) overflowOpen.value = false;
|
|
470
|
+
});
|
|
471
|
+
function onWheel(event) {
|
|
472
|
+
if (vertical.value || event.ctrlKey || event.metaKey) return;
|
|
473
|
+
const list = listRef.value;
|
|
474
|
+
if (!list) return;
|
|
475
|
+
const max = list.scrollWidth - list.clientWidth;
|
|
476
|
+
if (max <= 1) return;
|
|
477
|
+
if (event.deltaX !== 0 || event.deltaY === 0) return;
|
|
478
|
+
const scale = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? list.clientWidth : 1;
|
|
479
|
+
const delta = event.deltaY * scale;
|
|
480
|
+
const next = getComputedStyle(list).direction === "rtl" ? Math.min(0, Math.max(-max, list.scrollLeft - delta)) : Math.min(max, Math.max(0, list.scrollLeft + delta));
|
|
481
|
+
event.preventDefault();
|
|
482
|
+
if (next !== list.scrollLeft) {
|
|
483
|
+
list.scrollLeft = next;
|
|
484
|
+
updateOverflow();
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
const overflowItems = /* @__PURE__ */ new Map();
|
|
488
|
+
function setOverflowItem(uid, el) {
|
|
489
|
+
if (el instanceof HTMLButtonElement) overflowItems.set(uid, el);
|
|
490
|
+
else overflowItems.delete(uid);
|
|
491
|
+
}
|
|
492
|
+
let pendingOverflowFocus = "selected";
|
|
493
|
+
let focusOverflowAfterRemove;
|
|
494
|
+
function focusOverflowItem(target = "selected") {
|
|
495
|
+
const enabled = orderedPanels.value.filter((panel) => !panel.props.disabled);
|
|
496
|
+
if (!enabled.length) return;
|
|
497
|
+
let entry;
|
|
498
|
+
if (target === "first") entry = enabled[0];
|
|
499
|
+
else if (target === "last") entry = enabled.at(-1);
|
|
500
|
+
else if (target === "selected") entry = enabled.find((panel) => panel.props.value === selected.value) ?? enabled[0];
|
|
501
|
+
else entry = enabled.find((panel) => panel.props.value === target) ?? enabled[0];
|
|
502
|
+
const el = entry && overflowItems.get(entry.uid);
|
|
503
|
+
if (!el) return;
|
|
504
|
+
el.scrollIntoView?.({ block: "nearest" });
|
|
505
|
+
el.focus({ preventScroll: true });
|
|
506
|
+
}
|
|
507
|
+
watch(overflowOpen, (open) => {
|
|
508
|
+
if (!open) return;
|
|
509
|
+
const target = pendingOverflowFocus;
|
|
510
|
+
pendingOverflowFocus = "selected";
|
|
511
|
+
nextTick(() => focusOverflowItem(target));
|
|
512
|
+
});
|
|
513
|
+
watch(panels, () => {
|
|
514
|
+
if (focusOverflowAfterRemove === void 0) return;
|
|
515
|
+
const target = focusOverflowAfterRemove;
|
|
516
|
+
focusOverflowAfterRemove = void 0;
|
|
517
|
+
if (!overflowOpen.value) return;
|
|
518
|
+
focusOverflowItem(target);
|
|
519
|
+
}, { flush: "post" });
|
|
520
|
+
function onOverflowTriggerKeydown(event) {
|
|
521
|
+
if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
|
|
522
|
+
event.preventDefault();
|
|
523
|
+
const target = event.key === "ArrowUp" ? "last" : "selected";
|
|
524
|
+
if (overflowOpen.value) {
|
|
525
|
+
focusOverflowItem(target);
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
pendingOverflowFocus = target;
|
|
529
|
+
overflowOpen.value = true;
|
|
530
|
+
}
|
|
531
|
+
function onOverflowItemKeydown(event, entry) {
|
|
532
|
+
const enabled = orderedPanels.value.filter((panel) => !panel.props.disabled);
|
|
533
|
+
const index = enabled.indexOf(entry);
|
|
534
|
+
let target;
|
|
535
|
+
switch (event.key) {
|
|
536
|
+
case "ArrowDown":
|
|
537
|
+
target = enabled[(index + 1) % enabled.length];
|
|
538
|
+
break;
|
|
539
|
+
case "ArrowUp":
|
|
540
|
+
target = enabled[(index - 1 + enabled.length) % enabled.length];
|
|
541
|
+
break;
|
|
542
|
+
case "Home":
|
|
543
|
+
target = enabled[0];
|
|
544
|
+
break;
|
|
545
|
+
case "End":
|
|
546
|
+
target = enabled.at(-1);
|
|
547
|
+
break;
|
|
548
|
+
case "Delete":
|
|
549
|
+
case "Backspace":
|
|
550
|
+
if (!isClosable(entry)) return;
|
|
551
|
+
event.preventDefault();
|
|
552
|
+
focusOverflowAfterRemove = (enabled[index + 1] ?? enabled[index - 1])?.props.value;
|
|
553
|
+
remove(entry);
|
|
554
|
+
return;
|
|
555
|
+
default: return;
|
|
556
|
+
}
|
|
557
|
+
if (!target) return;
|
|
558
|
+
event.preventDefault();
|
|
559
|
+
const el = overflowItems.get(target.uid);
|
|
560
|
+
el?.scrollIntoView?.({ block: "nearest" });
|
|
561
|
+
el?.focus({ preventScroll: true });
|
|
562
|
+
}
|
|
563
|
+
async function selectFromOverflow(entry, event) {
|
|
564
|
+
if (entry.props.disabled) return;
|
|
565
|
+
if (!await selectValue(entry.props.value)) return;
|
|
566
|
+
overflowOpen.value = false;
|
|
567
|
+
await nextTick();
|
|
568
|
+
reveal(settled.value);
|
|
569
|
+
if (event.detail === 0) tabElement(entry)?.focus({ preventScroll: true });
|
|
418
570
|
}
|
|
419
571
|
function reveal(smooth) {
|
|
420
572
|
const list = listRef.value;
|
|
421
|
-
const entry =
|
|
573
|
+
const entry = orderedPanels.value.find((panel) => panel.props.value === selected.value);
|
|
422
574
|
const tab = entry && tabElement(entry);
|
|
423
|
-
if (!list || !tab) return;
|
|
575
|
+
if (!list || !tab || entry.props.pinned) return;
|
|
424
576
|
const margin = 32;
|
|
425
577
|
if (vertical.value) {
|
|
426
578
|
const top = tab.offsetTop - margin;
|
|
@@ -442,22 +594,20 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
442
594
|
behavior: smooth && !reduced.value ? "smooth" : "auto"
|
|
443
595
|
});
|
|
444
596
|
}
|
|
445
|
-
function scrollByPage(direction) {
|
|
446
|
-
const list = listRef.value;
|
|
447
|
-
if (!list) return;
|
|
448
|
-
list.scrollBy({
|
|
449
|
-
left: direction * list.clientWidth * .8,
|
|
450
|
-
behavior: reduced.value ? "auto" : "smooth"
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
597
|
let observer;
|
|
454
598
|
let watchedTab;
|
|
599
|
+
let watchedPinned;
|
|
455
600
|
function watchTab(tab) {
|
|
456
601
|
if (tab === watchedTab) return;
|
|
457
602
|
if (watchedTab) observer?.unobserve(watchedTab);
|
|
458
603
|
watchedTab = tab;
|
|
459
604
|
if (tab) observer?.observe(tab);
|
|
460
605
|
}
|
|
606
|
+
watch(pinnedRef, (el) => {
|
|
607
|
+
if (watchedPinned) observer?.unobserve(watchedPinned);
|
|
608
|
+
watchedPinned = el ?? void 0;
|
|
609
|
+
if (watchedPinned) observer?.observe(watchedPinned);
|
|
610
|
+
});
|
|
461
611
|
onMounted(() => {
|
|
462
612
|
measure();
|
|
463
613
|
updateOverflow();
|
|
@@ -469,6 +619,10 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
469
619
|
updateOverflow();
|
|
470
620
|
});
|
|
471
621
|
observer.observe(listRef.value);
|
|
622
|
+
if (pinnedRef.value) {
|
|
623
|
+
watchedPinned = pinnedRef.value;
|
|
624
|
+
observer.observe(watchedPinned);
|
|
625
|
+
}
|
|
472
626
|
if (watchedTab) observer.observe(watchedTab);
|
|
473
627
|
}
|
|
474
628
|
});
|
|
@@ -476,6 +630,7 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
476
630
|
watch([
|
|
477
631
|
selected,
|
|
478
632
|
panels,
|
|
633
|
+
pinnedPanels,
|
|
479
634
|
size,
|
|
480
635
|
() => props.placement,
|
|
481
636
|
() => props.iconOnly,
|
|
@@ -486,8 +641,7 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
486
641
|
reveal(settled.value);
|
|
487
642
|
}));
|
|
488
643
|
const rootStyle = computed(() => props.height === void 0 ? void 0 : { height: typeof props.height === "number" ? `${props.height}px` : props.height });
|
|
489
|
-
|
|
490
|
-
const box = indicator.value;
|
|
644
|
+
function styleForIndicator(box) {
|
|
491
645
|
if (!box) return { display: "none" };
|
|
492
646
|
return vertical.value ? {
|
|
493
647
|
transform: `translateY(${box.top}px)`,
|
|
@@ -496,7 +650,9 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
496
650
|
transform: `translateX(${box.left}px)`,
|
|
497
651
|
width: `${box.width}px`
|
|
498
652
|
};
|
|
499
|
-
}
|
|
653
|
+
}
|
|
654
|
+
const indicatorStyle = computed(() => styleForIndicator(indicator.value));
|
|
655
|
+
const pinnedIndicatorStyle = computed(() => styleForIndicator(pinnedIndicator.value));
|
|
500
656
|
return (_ctx, _cache) => {
|
|
501
657
|
return openBlock(), createElementBlock("div", {
|
|
502
658
|
class: normalizeClass([
|
|
@@ -514,84 +670,111 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
514
670
|
ref: "header",
|
|
515
671
|
class: normalizeClass(unref(ns).e("header"))
|
|
516
672
|
}, [
|
|
517
|
-
!vertical.value && arrows.value && (overflow.value.start || overflow.value.end) ? (openBlock(), createElementBlock("button", {
|
|
518
|
-
key: 0,
|
|
519
|
-
type: "button",
|
|
520
|
-
tabindex: "-1",
|
|
521
|
-
class: normalizeClass([unref(ns).e("scroll"), unref(ns).is("start", true)]),
|
|
522
|
-
disabled: !overflow.value.start,
|
|
523
|
-
"aria-label": unref(t)("tabs.scrollPrev"),
|
|
524
|
-
onClick: _cache[0] || (_cache[0] = ($event) => scrollByPage(-1))
|
|
525
|
-
}, [createVNode(unref(ChevronLeftIcon))], 10, _hoisted_1)) : createCommentVNode("", true),
|
|
526
673
|
createElementVNode("div", {
|
|
674
|
+
class: normalizeClass(unref(ns).e("tablist")),
|
|
675
|
+
role: "tablist",
|
|
676
|
+
"aria-orientation": vertical.value ? "vertical" : "horizontal"
|
|
677
|
+
}, [pinnedPanels.value.length || marker.value?.zone === "pinned" ? (openBlock(), createElementBlock("div", {
|
|
678
|
+
key: 0,
|
|
679
|
+
ref: "pinned",
|
|
680
|
+
class: normalizeClass([unref(ns).e("pinned"), unref(ns).is("divided", pinnedPanels.value.length > 0 && (regularPanels.value.length > 0 || marker.value?.zone === "regular"))])
|
|
681
|
+
}, [
|
|
682
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(pinnedPanels.value, (entry) => {
|
|
683
|
+
return openBlock(), createBlock(tab_button_default, {
|
|
684
|
+
key: entry.uid,
|
|
685
|
+
entry,
|
|
686
|
+
"tab-id": tabId(entry.props.value),
|
|
687
|
+
"panel-id": panelId(entry.props.value),
|
|
688
|
+
"label-text": labelText(entry),
|
|
689
|
+
selected: entry.props.value === selected.value,
|
|
690
|
+
closable: isClosable(entry),
|
|
691
|
+
"icon-alone": iconAlone(entry),
|
|
692
|
+
draggable: isDraggable(entry),
|
|
693
|
+
dragging: draggingUid.value === entry.uid,
|
|
694
|
+
"tip-placement": tipPlacement.value,
|
|
695
|
+
"key-shortcuts": keyShortcuts(entry),
|
|
696
|
+
"set-el": (el) => setTabElement("pinned", entry.uid, el),
|
|
697
|
+
onClick: ($event) => onClick(entry),
|
|
698
|
+
onPointerdown: ($event) => onPointerdown($event, entry),
|
|
699
|
+
onKeydown: ($event) => onKeydown($event, entry),
|
|
700
|
+
onRemove: ($event) => remove(entry)
|
|
701
|
+
}, null, 8, [
|
|
702
|
+
"entry",
|
|
703
|
+
"tab-id",
|
|
704
|
+
"panel-id",
|
|
705
|
+
"label-text",
|
|
706
|
+
"selected",
|
|
707
|
+
"closable",
|
|
708
|
+
"icon-alone",
|
|
709
|
+
"draggable",
|
|
710
|
+
"dragging",
|
|
711
|
+
"tip-placement",
|
|
712
|
+
"key-shortcuts",
|
|
713
|
+
"set-el",
|
|
714
|
+
"onClick",
|
|
715
|
+
"onPointerdown",
|
|
716
|
+
"onKeydown",
|
|
717
|
+
"onRemove"
|
|
718
|
+
]);
|
|
719
|
+
}), 128)),
|
|
720
|
+
createElementVNode("span", {
|
|
721
|
+
class: normalizeClass(unref(ns).e("indicator")),
|
|
722
|
+
style: normalizeStyle(pinnedIndicatorStyle.value),
|
|
723
|
+
"aria-hidden": "true"
|
|
724
|
+
}, null, 6),
|
|
725
|
+
__props.draggable ? (openBlock(), createElementBlock("span", {
|
|
726
|
+
key: 0,
|
|
727
|
+
class: normalizeClass(unref(ns).e("marker")),
|
|
728
|
+
style: normalizeStyle(pinnedMarkerStyle.value),
|
|
729
|
+
"aria-hidden": "true"
|
|
730
|
+
}, null, 6)) : createCommentVNode("", true)
|
|
731
|
+
], 2)) : createCommentVNode("", true), createElementVNode("div", {
|
|
527
732
|
ref: "list",
|
|
528
733
|
class: normalizeClass([
|
|
529
734
|
unref(ns).e("list"),
|
|
530
735
|
unref(ns).is("fade-start", overflow.value.start),
|
|
531
736
|
unref(ns).is("fade-end", overflow.value.end)
|
|
532
737
|
]),
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
onScrollPassive: updateOverflow
|
|
738
|
+
onScrollPassive: updateOverflow,
|
|
739
|
+
onWheel
|
|
536
740
|
}, [
|
|
537
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
538
|
-
return openBlock(), createBlock(
|
|
741
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(regularPanels.value, (entry) => {
|
|
742
|
+
return openBlock(), createBlock(tab_button_default, {
|
|
539
743
|
key: entry.uid,
|
|
540
|
-
entry
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
class: normalizeClass(unref(ns).e("label"))
|
|
575
|
-
}, [createVNode(TabLabel, {
|
|
576
|
-
entry,
|
|
577
|
-
selected: entry.props.value === selected.value
|
|
578
|
-
}, null, 8, ["entry", "selected"])], 2)) : createCommentVNode("", true),
|
|
579
|
-
isClosable(entry) ? (openBlock(), createBlock(unref(DouTooltip), {
|
|
580
|
-
key: 2,
|
|
581
|
-
content: unref(t)("tabs.close"),
|
|
582
|
-
shortcut: "delete",
|
|
583
|
-
disabled: iconAlone(entry)
|
|
584
|
-
}, {
|
|
585
|
-
default: withCtx(() => [createElementVNode("span", {
|
|
586
|
-
class: normalizeClass(unref(ns).e("close")),
|
|
587
|
-
"aria-hidden": "true",
|
|
588
|
-
onClick: withModifiers(($event) => remove(entry), ["stop"])
|
|
589
|
-
}, [createVNode(unref(CloseIcon))], 10, _hoisted_4)]),
|
|
590
|
-
_: 2
|
|
591
|
-
}, 1032, ["content", "disabled"])) : createCommentVNode("", true)
|
|
592
|
-
], 42, _hoisted_3)]),
|
|
593
|
-
_: 2
|
|
594
|
-
}, 1032, ["entry"]);
|
|
744
|
+
entry,
|
|
745
|
+
"tab-id": tabId(entry.props.value),
|
|
746
|
+
"panel-id": panelId(entry.props.value),
|
|
747
|
+
"label-text": labelText(entry),
|
|
748
|
+
selected: entry.props.value === selected.value,
|
|
749
|
+
closable: isClosable(entry),
|
|
750
|
+
"icon-alone": iconAlone(entry),
|
|
751
|
+
draggable: isDraggable(entry),
|
|
752
|
+
dragging: draggingUid.value === entry.uid,
|
|
753
|
+
"tip-placement": tipPlacement.value,
|
|
754
|
+
"key-shortcuts": keyShortcuts(entry),
|
|
755
|
+
"set-el": (el) => setTabElement("regular", entry.uid, el),
|
|
756
|
+
onClick: ($event) => onClick(entry),
|
|
757
|
+
onPointerdown: ($event) => onPointerdown($event, entry),
|
|
758
|
+
onKeydown: ($event) => onKeydown($event, entry),
|
|
759
|
+
onRemove: ($event) => remove(entry)
|
|
760
|
+
}, null, 8, [
|
|
761
|
+
"entry",
|
|
762
|
+
"tab-id",
|
|
763
|
+
"panel-id",
|
|
764
|
+
"label-text",
|
|
765
|
+
"selected",
|
|
766
|
+
"closable",
|
|
767
|
+
"icon-alone",
|
|
768
|
+
"draggable",
|
|
769
|
+
"dragging",
|
|
770
|
+
"tip-placement",
|
|
771
|
+
"key-shortcuts",
|
|
772
|
+
"set-el",
|
|
773
|
+
"onClick",
|
|
774
|
+
"onPointerdown",
|
|
775
|
+
"onKeydown",
|
|
776
|
+
"onRemove"
|
|
777
|
+
]);
|
|
595
778
|
}), 128)),
|
|
596
779
|
createElementVNode("span", {
|
|
597
780
|
class: normalizeClass(unref(ns).e("indicator")),
|
|
@@ -604,25 +787,91 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
604
787
|
style: normalizeStyle(markerStyle.value),
|
|
605
788
|
"aria-hidden": "true"
|
|
606
789
|
}, null, 6)) : createCommentVNode("", true)
|
|
607
|
-
],
|
|
608
|
-
|
|
609
|
-
key:
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
},
|
|
790
|
+
], 34)], 10, _hoisted_1),
|
|
791
|
+
hasOverflow.value ? (openBlock(), createBlock(unref(DouPopover), {
|
|
792
|
+
key: 0,
|
|
793
|
+
open: overflowOpen.value,
|
|
794
|
+
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => overflowOpen.value = $event),
|
|
795
|
+
placement: "bottom-end",
|
|
796
|
+
trigger: "click",
|
|
797
|
+
offset: 6,
|
|
798
|
+
class: normalizeClass([unref(ns).e("overflow-popover"), unref(ns).m(unref(size))])
|
|
799
|
+
}, {
|
|
800
|
+
content: withCtx(() => [createElementVNode("div", {
|
|
801
|
+
class: normalizeClass(unref(ns).e("overflow-list")),
|
|
802
|
+
role: "list",
|
|
803
|
+
"aria-label": unref(t)("tabs.more")
|
|
804
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(orderedPanels.value, (entry, index) => {
|
|
805
|
+
return openBlock(), createElementBlock(Fragment, { key: entry.uid }, [index === pinnedPanels.value.length && pinnedPanels.value.length > 0 ? (openBlock(), createElementBlock("div", {
|
|
806
|
+
key: 0,
|
|
807
|
+
role: "separator",
|
|
808
|
+
class: normalizeClass(unref(ns).e("overflow-divider"))
|
|
809
|
+
}, null, 2)) : createCommentVNode("", true), createElementVNode("div", {
|
|
810
|
+
role: "listitem",
|
|
811
|
+
class: normalizeClass([
|
|
812
|
+
unref(ns).e("overflow-item"),
|
|
813
|
+
unref(ns).is("selected", entry.props.value === selected.value),
|
|
814
|
+
unref(ns).is("disabled", !!entry.props.disabled),
|
|
815
|
+
unref(ns).is("closable", isClosable(entry)),
|
|
816
|
+
unref(ns).is("pinned", !!entry.props.pinned)
|
|
817
|
+
])
|
|
818
|
+
}, [createElementVNode("button", {
|
|
819
|
+
ref_for: true,
|
|
820
|
+
ref: (el) => setOverflowItem(entry.uid, el),
|
|
821
|
+
type: "button",
|
|
822
|
+
class: normalizeClass(unref(ns).e("overflow-select")),
|
|
823
|
+
disabled: entry.props.disabled,
|
|
824
|
+
"aria-current": entry.props.value === selected.value ? "true" : void 0,
|
|
825
|
+
"aria-keyshortcuts": isClosable(entry) ? "Delete" : void 0,
|
|
826
|
+
onClick: ($event) => selectFromOverflow(entry, $event),
|
|
827
|
+
onKeydown: ($event) => onOverflowItemKeydown($event, entry)
|
|
828
|
+
}, [
|
|
829
|
+
entry.props.icon ? (openBlock(), createBlock(resolveDynamicComponent(entry.props.icon), {
|
|
830
|
+
key: 0,
|
|
831
|
+
class: normalizeClass(unref(ns).e("overflow-icon")),
|
|
832
|
+
"aria-hidden": "true"
|
|
833
|
+
}, null, 8, ["class"])) : createCommentVNode("", true),
|
|
834
|
+
createElementVNode("span", { class: normalizeClass(unref(ns).e("overflow-label")) }, [createVNode(TabLabel, {
|
|
835
|
+
entry,
|
|
836
|
+
selected: entry.props.value === selected.value
|
|
837
|
+
}, null, 8, ["entry", "selected"])], 2),
|
|
838
|
+
entry.props.pinned ? (openBlock(), createBlock(unref(PinIcon), {
|
|
839
|
+
key: 1,
|
|
840
|
+
class: normalizeClass(unref(ns).e("overflow-pin")),
|
|
841
|
+
"aria-hidden": "true"
|
|
842
|
+
}, null, 8, ["class"])) : createCommentVNode("", true),
|
|
843
|
+
entry.props.value === selected.value ? (openBlock(), createBlock(unref(CheckIcon), {
|
|
844
|
+
key: 2,
|
|
845
|
+
class: normalizeClass(unref(ns).e("overflow-check")),
|
|
846
|
+
"aria-hidden": "true"
|
|
847
|
+
}, null, 8, ["class"])) : createCommentVNode("", true)
|
|
848
|
+
], 42, _hoisted_4), isClosable(entry) ? (openBlock(), createElementBlock("button", {
|
|
849
|
+
key: 0,
|
|
850
|
+
type: "button",
|
|
851
|
+
tabindex: "-1",
|
|
852
|
+
class: normalizeClass(unref(ns).e("overflow-close")),
|
|
853
|
+
"aria-label": `${unref(t)("tabs.close")} ${labelText(entry)}`,
|
|
854
|
+
title: unref(t)("tabs.close"),
|
|
855
|
+
onClick: withModifiers(($event) => remove(entry), ["stop"])
|
|
856
|
+
}, [createVNode(unref(CloseIcon), { "aria-hidden": "true" })], 10, _hoisted_5)) : createCommentVNode("", true)], 2)], 64);
|
|
857
|
+
}), 128))], 10, _hoisted_3)]),
|
|
858
|
+
default: withCtx(() => [createElementVNode("button", {
|
|
859
|
+
type: "button",
|
|
860
|
+
class: normalizeClass([unref(ns).e("overflow"), unref(ns).is("open", overflowOpen.value)]),
|
|
861
|
+
"aria-label": unref(t)("tabs.more"),
|
|
862
|
+
onKeydown: onOverflowTriggerKeydown
|
|
863
|
+
}, [createVNode(unref(ChevronDownIcon), { "aria-hidden": "true" })], 42, _hoisted_2)]),
|
|
864
|
+
_: 1
|
|
865
|
+
}, 8, ["open", "class"])) : createCommentVNode("", true),
|
|
617
866
|
__props.addable ? (openBlock(), createElementBlock("button", {
|
|
618
|
-
key:
|
|
867
|
+
key: 1,
|
|
619
868
|
type: "button",
|
|
620
869
|
class: normalizeClass(unref(ns).e("add")),
|
|
621
870
|
"aria-label": unref(t)("tabs.add"),
|
|
622
|
-
onClick: _cache[
|
|
871
|
+
onClick: _cache[1] || (_cache[1] = ($event) => emit("add"))
|
|
623
872
|
}, [createVNode(unref(PlusIcon))], 10, _hoisted_6)) : createCommentVNode("", true),
|
|
624
873
|
slots.extra ? (openBlock(), createElementBlock("div", {
|
|
625
|
-
key:
|
|
874
|
+
key: 2,
|
|
626
875
|
class: normalizeClass(unref(ns).e("extra"))
|
|
627
876
|
}, [renderSlot(_ctx.$slots, "extra")], 2)) : createCommentVNode("", true)
|
|
628
877
|
], 2), renderSlot(_ctx.$slots, "default")], 6);
|