@1337exp/taoui 5.50.0 → 5.51.0
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/CHANGELOG.md +26 -0
- package/README.md +5 -5
- package/README.ru.md +5 -5
- package/dist/index.d.ts +234 -4
- package/dist/index.js +942 -126
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/skills/taoui/SKILL.md +10 -5
- package/skills/taoui/references/components.md +14 -6
- package/skills/taoui/references/patterns.md +273 -273
- package/skills/taoui/references/starters.md +435 -0
- package/src/styles/base.css +4 -4
- package/src/styles/tokens/primitives.css +8 -5
- package/src/styles/tokens/semantic.css +8 -2
package/dist/index.js
CHANGED
|
@@ -242,7 +242,19 @@ const localeEn = {
|
|
|
242
242
|
dropdownMenu: { menuLabel: "Menu" },
|
|
243
243
|
menubar: { ariaLabel: "Menu bar" },
|
|
244
244
|
nav: { ariaLabel: "Navigation", moreLabel: "More" },
|
|
245
|
-
tree: {
|
|
245
|
+
tree: {
|
|
246
|
+
ariaLabel: "Tree",
|
|
247
|
+
loadingLabel: "Loading…",
|
|
248
|
+
menuLabel: "Context menu",
|
|
249
|
+
countLabel: { one: "{count} item", other: "{count} items" },
|
|
250
|
+
rootLabel: "the top level",
|
|
251
|
+
cutText: "{item} cut. Go to a folder or a row and press Ctrl+V to move it there, Escape to cancel.",
|
|
252
|
+
copyText: "{item} copied. Go to a folder or a row and press Ctrl+V to put a copy there, Escape to cancel.",
|
|
253
|
+
movedText: "{item} moved to {target}.",
|
|
254
|
+
copiedText: "{item} copied to {target}.",
|
|
255
|
+
canceledText: "Move canceled.",
|
|
256
|
+
refusedText: "{item} cannot go to {target}."
|
|
257
|
+
},
|
|
246
258
|
checklist: { selectAllLabel: "Select all", counterText: "{checked} of {total}" },
|
|
247
259
|
contextMenu: { menuLabel: "Context menu" },
|
|
248
260
|
empty: { title: "Nothing here" },
|
|
@@ -481,7 +493,19 @@ const localeRu = {
|
|
|
481
493
|
dropdownMenu: { menuLabel: "Меню" },
|
|
482
494
|
menubar: { ariaLabel: "Строка меню" },
|
|
483
495
|
nav: { ariaLabel: "Навигация", moreLabel: "Ещё" },
|
|
484
|
-
tree: {
|
|
496
|
+
tree: {
|
|
497
|
+
ariaLabel: "Дерево",
|
|
498
|
+
loadingLabel: "Загрузка…",
|
|
499
|
+
menuLabel: "Контекстное меню",
|
|
500
|
+
countLabel: { one: "{count} элемент", few: "{count} элемента", many: "{count} элементов", other: "{count} элемента" },
|
|
501
|
+
rootLabel: "верхний уровень",
|
|
502
|
+
cutText: "{item}: вырезано. Перейдите к папке или строке и нажмите Ctrl+V, чтобы перенести туда; Escape отменяет.",
|
|
503
|
+
copyText: "{item}: скопировано. Перейдите к папке или строке и нажмите Ctrl+V, чтобы положить туда копию; Escape отменяет.",
|
|
504
|
+
movedText: "{item}: перенесено в {target}.",
|
|
505
|
+
copiedText: "{item}: скопировано в {target}.",
|
|
506
|
+
canceledText: "Перенос отменён.",
|
|
507
|
+
refusedText: "{item}: сюда нельзя ({target})."
|
|
508
|
+
},
|
|
485
509
|
checklist: { selectAllLabel: "Выбрать всё", counterText: "{checked} из {total}" },
|
|
486
510
|
contextMenu: { menuLabel: "Контекстное меню" },
|
|
487
511
|
empty: { title: "Ничего нет" },
|
|
@@ -630,7 +654,7 @@ const _hoisted_2$12 = {
|
|
|
630
654
|
class: "tao-loader__ellipsis",
|
|
631
655
|
"aria-hidden": "true"
|
|
632
656
|
};
|
|
633
|
-
const _hoisted_3$
|
|
657
|
+
const _hoisted_3$S = {
|
|
634
658
|
key: 1,
|
|
635
659
|
class: "tao-loader__ring",
|
|
636
660
|
"aria-hidden": "true"
|
|
@@ -692,7 +716,7 @@ const _sfc_main$1p = /* @__PURE__ */ defineComponent({
|
|
|
692
716
|
createElementVNode("div", null, null, -1),
|
|
693
717
|
createElementVNode("div", null, null, -1),
|
|
694
718
|
createElementVNode("div", null, null, -1)
|
|
695
|
-
])])) : __props.variant === "ring" ? (openBlock(), createElementBlock("span", _hoisted_3$
|
|
719
|
+
])])) : __props.variant === "ring" ? (openBlock(), createElementBlock("span", _hoisted_3$S)) : __props.variant === "diamonds" ? (openBlock(), createElementBlock("span", _hoisted_4$K, [..._cache[1] || (_cache[1] = [
|
|
696
720
|
createStaticVNode('<span class="tao-loader__axis" data-v-03f29efb><i class="tao-loader__swap-left" data-v-03f29efb></i><i class="tao-loader__swap-right" data-v-03f29efb></i><i class="tao-loader__swap-hollow" data-v-03f29efb></i></span><span class="tao-loader__axis tao-loader__axis--cross" data-v-03f29efb><i class="tao-loader__swap-left" data-v-03f29efb></i><i class="tao-loader__swap-right" data-v-03f29efb></i><i class="tao-loader__swap-hollow" data-v-03f29efb></i></span>', 2)
|
|
697
721
|
])])) : (openBlock(), createElementBlock("span", _hoisted_5$y)),
|
|
698
722
|
!__props.decorative ? (openBlock(), createElementBlock("span", _hoisted_6$r, toDisplayString(unref(l10n).label), 1)) : createCommentVNode("", true)
|
|
@@ -890,7 +914,7 @@ const _hoisted_1$1b = {
|
|
|
890
914
|
class: "tao-input__affix tao-input__affix--prefix"
|
|
891
915
|
};
|
|
892
916
|
const _hoisted_2$10 = ["id", "type", "value", "placeholder", "disabled", "aria-invalid", "aria-describedby"];
|
|
893
|
-
const _hoisted_3$
|
|
917
|
+
const _hoisted_3$R = {
|
|
894
918
|
key: 1,
|
|
895
919
|
class: "tao-input__affix tao-input__affix--suffix"
|
|
896
920
|
};
|
|
@@ -958,7 +982,7 @@ const _sfc_main$1m = /* @__PURE__ */ defineComponent({
|
|
|
958
982
|
onBlur: handleBlur,
|
|
959
983
|
onFocus: handleFocus
|
|
960
984
|
}), null, 16, _hoisted_2$10),
|
|
961
|
-
has("suffix") ? (openBlock(), createElementBlock("span", _hoisted_3$
|
|
985
|
+
has("suffix") ? (openBlock(), createElementBlock("span", _hoisted_3$R, [
|
|
962
986
|
renderSlot(_ctx.$slots, "suffix", {}, void 0, true)
|
|
963
987
|
])) : createCommentVNode("", true)
|
|
964
988
|
], 2)
|
|
@@ -972,7 +996,7 @@ const _hoisted_1$1a = {
|
|
|
972
996
|
class: "tao-input-group__addon tao-input-group__addon--before"
|
|
973
997
|
};
|
|
974
998
|
const _hoisted_2$$ = { class: "tao-input-group__field" };
|
|
975
|
-
const _hoisted_3$
|
|
999
|
+
const _hoisted_3$Q = {
|
|
976
1000
|
key: 1,
|
|
977
1001
|
class: "tao-input-group__addon tao-input-group__addon--after"
|
|
978
1002
|
};
|
|
@@ -1009,7 +1033,7 @@ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
|
|
|
1009
1033
|
createElementVNode("div", _hoisted_2$$, [
|
|
1010
1034
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1011
1035
|
]),
|
|
1012
|
-
has("after") ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
1036
|
+
has("after") ? (openBlock(), createElementBlock("div", _hoisted_3$Q, [
|
|
1013
1037
|
renderSlot(_ctx.$slots, "after", {}, void 0, true)
|
|
1014
1038
|
])) : createCommentVNode("", true)
|
|
1015
1039
|
], 34);
|
|
@@ -1022,7 +1046,7 @@ const _hoisted_2$_ = {
|
|
|
1022
1046
|
key: 0,
|
|
1023
1047
|
class: "tao-input-number__steppers"
|
|
1024
1048
|
};
|
|
1025
|
-
const _hoisted_3$
|
|
1049
|
+
const _hoisted_3$P = ["aria-label", "disabled"];
|
|
1026
1050
|
const _hoisted_4$J = { "aria-hidden": "true" };
|
|
1027
1051
|
const _hoisted_5$x = ["aria-label", "disabled"];
|
|
1028
1052
|
const _hoisted_6$q = { "aria-hidden": "true" };
|
|
@@ -1200,7 +1224,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
1200
1224
|
createVNode(TaoIcon, { name: "tao-plus" })
|
|
1201
1225
|
], true)
|
|
1202
1226
|
])
|
|
1203
|
-
], 8, _hoisted_3$
|
|
1227
|
+
], 8, _hoisted_3$P),
|
|
1204
1228
|
createElementVNode("button", {
|
|
1205
1229
|
type: "button",
|
|
1206
1230
|
class: "tao-input-number__step",
|
|
@@ -1223,7 +1247,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
|
|
|
1223
1247
|
const TaoInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-dc5bb759"]]);
|
|
1224
1248
|
const _hoisted_1$18 = ["aria-label", "disabled"];
|
|
1225
1249
|
const _hoisted_2$Z = { "aria-hidden": "true" };
|
|
1226
|
-
const _hoisted_3$
|
|
1250
|
+
const _hoisted_3$O = ["id", "value", "disabled", "aria-invalid", "aria-describedby", "aria-valuenow", "aria-valuemin", "aria-valuemax"];
|
|
1227
1251
|
const _hoisted_4$I = ["aria-label", "disabled"];
|
|
1228
1252
|
const _hoisted_5$w = { "aria-hidden": "true" };
|
|
1229
1253
|
const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
@@ -1391,7 +1415,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
|
1391
1415
|
onFocus,
|
|
1392
1416
|
onBlur,
|
|
1393
1417
|
onKeydown: onKeydown2
|
|
1394
|
-
}), null, 16, _hoisted_3$
|
|
1418
|
+
}), null, 16, _hoisted_3$O),
|
|
1395
1419
|
createElementVNode("button", {
|
|
1396
1420
|
type: "button",
|
|
1397
1421
|
class: "tao-quantity__btn tao-quantity__btn--inc",
|
|
@@ -1418,7 +1442,7 @@ const _hoisted_2$Y = {
|
|
|
1418
1442
|
key: 0,
|
|
1419
1443
|
class: "tao-card__overlay"
|
|
1420
1444
|
};
|
|
1421
|
-
const _hoisted_3$
|
|
1445
|
+
const _hoisted_3$N = {
|
|
1422
1446
|
key: 1,
|
|
1423
1447
|
class: "tao-card__overlay"
|
|
1424
1448
|
};
|
|
@@ -1438,15 +1462,15 @@ const _hoisted_7$j = {
|
|
|
1438
1462
|
key: 1,
|
|
1439
1463
|
class: "tao-card__sub"
|
|
1440
1464
|
};
|
|
1441
|
-
const _hoisted_8$
|
|
1465
|
+
const _hoisted_8$f = {
|
|
1442
1466
|
key: 2,
|
|
1443
1467
|
class: "tao-card__body"
|
|
1444
1468
|
};
|
|
1445
|
-
const _hoisted_9$
|
|
1469
|
+
const _hoisted_9$b = {
|
|
1446
1470
|
key: 3,
|
|
1447
1471
|
class: "tao-card__footer"
|
|
1448
1472
|
};
|
|
1449
|
-
const _hoisted_10$
|
|
1473
|
+
const _hoisted_10$7 = {
|
|
1450
1474
|
key: 3,
|
|
1451
1475
|
class: "tao-card__corner"
|
|
1452
1476
|
};
|
|
@@ -1510,7 +1534,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
1510
1534
|
_ctx.$slots.overlay ? (openBlock(), createElementBlock("div", _hoisted_2$Y, [
|
|
1511
1535
|
renderSlot(_ctx.$slots, "overlay", {}, void 0, true)
|
|
1512
1536
|
])) : createCommentVNode("", true)
|
|
1513
|
-
])) : _ctx.$slots.overlay ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
1537
|
+
])) : _ctx.$slots.overlay ? (openBlock(), createElementBlock("div", _hoisted_3$N, [
|
|
1514
1538
|
renderSlot(_ctx.$slots, "overlay", {}, void 0, true)
|
|
1515
1539
|
])) : createCommentVNode("", true),
|
|
1516
1540
|
hasContent.value ? (openBlock(), createElementBlock("div", {
|
|
@@ -1529,14 +1553,14 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
1529
1553
|
renderSlot(_ctx.$slots, "sub", {}, void 0, true)
|
|
1530
1554
|
])) : createCommentVNode("", true)
|
|
1531
1555
|
])) : createCommentVNode("", true),
|
|
1532
|
-
has("default") ? (openBlock(), createElementBlock("div", _hoisted_8$
|
|
1556
|
+
has("default") ? (openBlock(), createElementBlock("div", _hoisted_8$f, [
|
|
1533
1557
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1534
1558
|
])) : createCommentVNode("", true),
|
|
1535
|
-
has("footer") ? (openBlock(), createElementBlock("div", _hoisted_9$
|
|
1559
|
+
has("footer") ? (openBlock(), createElementBlock("div", _hoisted_9$b, [
|
|
1536
1560
|
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
1537
1561
|
])) : createCommentVNode("", true)
|
|
1538
1562
|
], 4)) : createCommentVNode("", true),
|
|
1539
|
-
hasCorner.value ? (openBlock(), createElementBlock("div", _hoisted_10$
|
|
1563
|
+
hasCorner.value ? (openBlock(), createElementBlock("div", _hoisted_10$7, [
|
|
1540
1564
|
renderSlot(_ctx.$slots, "corner", {}, void 0, true),
|
|
1541
1565
|
__props.closable ? (openBlock(), createElementBlock("button", {
|
|
1542
1566
|
key: 0,
|
|
@@ -1736,12 +1760,12 @@ const _hoisted_2$X = {
|
|
|
1736
1760
|
key: 0,
|
|
1737
1761
|
class: "tao-modal__header"
|
|
1738
1762
|
};
|
|
1739
|
-
const _hoisted_3$
|
|
1763
|
+
const _hoisted_3$M = ["id"];
|
|
1740
1764
|
const _hoisted_4$G = { key: 1 };
|
|
1741
1765
|
const _hoisted_5$u = ["aria-label"];
|
|
1742
1766
|
const _hoisted_6$o = { "aria-hidden": "true" };
|
|
1743
1767
|
const _hoisted_7$i = { class: "tao-modal__content" };
|
|
1744
|
-
const _hoisted_8$
|
|
1768
|
+
const _hoisted_8$e = {
|
|
1745
1769
|
key: 1,
|
|
1746
1770
|
class: "tao-modal__footer"
|
|
1747
1771
|
};
|
|
@@ -1836,7 +1860,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
1836
1860
|
key: 0,
|
|
1837
1861
|
id: unref(titleId),
|
|
1838
1862
|
class: "tao-modal__title"
|
|
1839
|
-
}, toDisplayString(__props.title), 9, _hoisted_3$
|
|
1863
|
+
}, toDisplayString(__props.title), 9, _hoisted_3$M)) : (openBlock(), createElementBlock("span", _hoisted_4$G))
|
|
1840
1864
|
], true),
|
|
1841
1865
|
__props.closable ? (openBlock(), createElementBlock("button", {
|
|
1842
1866
|
key: 0,
|
|
@@ -1855,7 +1879,7 @@ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
|
1855
1879
|
createElementVNode("div", _hoisted_7$i, [
|
|
1856
1880
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1857
1881
|
]),
|
|
1858
|
-
has("footer") ? (openBlock(), createElementBlock("div", _hoisted_8$
|
|
1882
|
+
has("footer") ? (openBlock(), createElementBlock("div", _hoisted_8$e, [
|
|
1859
1883
|
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
1860
1884
|
])) : createCommentVNode("", true)
|
|
1861
1885
|
], 16, _hoisted_1$16)
|
|
@@ -2201,7 +2225,7 @@ function apcaContrast(text, background) {
|
|
|
2201
2225
|
}
|
|
2202
2226
|
return (sapc > 0 ? sapc - 0.027 : sapc + 0.027) * 100;
|
|
2203
2227
|
}
|
|
2204
|
-
const bestOn = (
|
|
2228
|
+
const bestOn = (fill2, dark) => dark ? contrastRatio(fill2, WHITE) >= contrastRatio(fill2, BLACK) ? WHITE : BLACK : Math.abs(apcaContrast(WHITE, fill2)) >= Math.abs(apcaContrast(BLACK, fill2)) ? WHITE : BLACK;
|
|
2205
2229
|
const STATUS = {
|
|
2206
2230
|
danger: { range: [8, 40], dark: "#dc3545", light: "#dc3545" },
|
|
2207
2231
|
warning: { range: [78, 102], dark: "#d4a017", light: "#b8860b" },
|
|
@@ -2274,14 +2298,14 @@ function buildPaletteRoles(def, mode) {
|
|
|
2274
2298
|
}
|
|
2275
2299
|
}
|
|
2276
2300
|
const fitted = (c) => {
|
|
2277
|
-
let
|
|
2278
|
-
|
|
2279
|
-
let on2 = bestOn(
|
|
2280
|
-
if (contrastRatio(
|
|
2281
|
-
|
|
2282
|
-
on2 = bestOn(
|
|
2283
|
-
}
|
|
2284
|
-
return { fill:
|
|
2301
|
+
let fill22 = oklchToHex({ ...c, L: Math.min(Math.max(c.L, 0.3), 0.9) });
|
|
2302
|
+
fill22 = shiftUntil(fill22, dark ? 1 : -1, (x) => ink(x) >= 3.2);
|
|
2303
|
+
let on2 = bestOn(fill22, dark);
|
|
2304
|
+
if (contrastRatio(fill22, on2) < 4.5) {
|
|
2305
|
+
fill22 = shiftUntil(fill22, on2 === WHITE ? -1 : 1, (x) => contrastRatio(x, on2) >= 4.5);
|
|
2306
|
+
on2 = bestOn(fill22, dark);
|
|
2307
|
+
}
|
|
2308
|
+
return { fill: fill22, on: on2, distance: colourDistance(fill22, accent) };
|
|
2285
2309
|
};
|
|
2286
2310
|
let best = null;
|
|
2287
2311
|
for (const c of candidates) {
|
|
@@ -2294,12 +2318,12 @@ function buildPaletteRoles(def, mode) {
|
|
|
2294
2318
|
break;
|
|
2295
2319
|
}
|
|
2296
2320
|
}
|
|
2297
|
-
const { fill, on } = best;
|
|
2298
|
-
const text = shiftUntil(
|
|
2321
|
+
const { fill: fill2, on } = best;
|
|
2322
|
+
const text = shiftUntil(fill2, dark ? 1 : -1, (c) => ink(c) >= 4.6);
|
|
2299
2323
|
const hoverStep = on === WHITE ? -1 : 1;
|
|
2300
|
-
const fillHover = shiftUntil(
|
|
2301
|
-
status[name] = { fill, on, text, distance: colourDistance(
|
|
2302
|
-
statusRoles[`--tao-color-${name}`] =
|
|
2324
|
+
const fillHover = shiftUntil(fill2, hoverStep, (c) => Math.abs(hexToOklch(c).L - hexToOklch(fill2).L) >= 0.04);
|
|
2325
|
+
status[name] = { fill: fill2, on, text, distance: colourDistance(fill2, accent) };
|
|
2326
|
+
statusRoles[`--tao-color-${name}`] = fill2;
|
|
2303
2327
|
statusRoles[`--tao-color-${name}-hover`] = fillHover;
|
|
2304
2328
|
statusRoles[`--tao-color-on-${name}`] = on;
|
|
2305
2329
|
statusRoles[`--tao-color-${name}-text`] = text;
|
|
@@ -2506,7 +2530,7 @@ function zoneGradient(zones, min, max, vertical = false, dimmed = false) {
|
|
|
2506
2530
|
}
|
|
2507
2531
|
const _hoisted_1$14 = ["aria-disabled"];
|
|
2508
2532
|
const _hoisted_2$V = ["id", "tabindex", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-label", "aria-orientation", "aria-disabled", "aria-invalid", "aria-describedby", "aria-keyshortcuts", "onKeydown"];
|
|
2509
|
-
const _hoisted_3$
|
|
2533
|
+
const _hoisted_3$L = {
|
|
2510
2534
|
key: 2,
|
|
2511
2535
|
class: "tao-slider__value"
|
|
2512
2536
|
};
|
|
@@ -2866,7 +2890,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
2866
2890
|
], 6)) : createCommentVNode("", true)
|
|
2867
2891
|
], 64);
|
|
2868
2892
|
}), 128)),
|
|
2869
|
-
__props.showValue && editing.value === null ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
2893
|
+
__props.showValue && editing.value === null ? (openBlock(), createElementBlock("div", _hoisted_3$L, [
|
|
2870
2894
|
renderSlot(_ctx.$slots, "pre-value", {}, void 0, true),
|
|
2871
2895
|
createTextVNode(toDisplayString(barText.value), 1),
|
|
2872
2896
|
renderSlot(_ctx.$slots, "post-value", {}, void 0, true)
|
|
@@ -3001,7 +3025,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
|
3001
3025
|
});
|
|
3002
3026
|
const _hoisted_1$13 = { class: "tao-scrubber__controls" };
|
|
3003
3027
|
const _hoisted_2$U = { class: "tao-scrubber__track" };
|
|
3004
|
-
const _hoisted_3$
|
|
3028
|
+
const _hoisted_3$K = {
|
|
3005
3029
|
key: 0,
|
|
3006
3030
|
class: "tao-scrubber__time"
|
|
3007
3031
|
};
|
|
@@ -3099,7 +3123,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
3099
3123
|
} : void 0
|
|
3100
3124
|
]), 1032, ["model-value", "max", "step", "marks", "marks-side", "variant", "size", "disabled"])
|
|
3101
3125
|
]),
|
|
3102
|
-
__props.showTime ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
3126
|
+
__props.showTime ? (openBlock(), createElementBlock("div", _hoisted_3$K, [
|
|
3103
3127
|
renderSlot(_ctx.$slots, "time", {
|
|
3104
3128
|
time: __props.modelValue,
|
|
3105
3129
|
length: __props.length,
|
|
@@ -3514,7 +3538,7 @@ const _hoisted_2$T = {
|
|
|
3514
3538
|
key: 0,
|
|
3515
3539
|
class: "tao-spoiler__title"
|
|
3516
3540
|
};
|
|
3517
|
-
const _hoisted_3$
|
|
3541
|
+
const _hoisted_3$J = ["id"];
|
|
3518
3542
|
const _hoisted_4$E = { class: "tao-spoiler__content-inner" };
|
|
3519
3543
|
const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
3520
3544
|
...{ name: "TaoSpoiler" },
|
|
@@ -3612,7 +3636,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
3612
3636
|
createElementVNode("div", _hoisted_4$E, [
|
|
3613
3637
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
3614
3638
|
])
|
|
3615
|
-
], 8, _hoisted_3$
|
|
3639
|
+
], 8, _hoisted_3$J)) : createCommentVNode("", true)
|
|
3616
3640
|
]),
|
|
3617
3641
|
_: 3
|
|
3618
3642
|
})
|
|
@@ -4009,7 +4033,7 @@ const _hoisted_2$S = {
|
|
|
4009
4033
|
class: "tao-menu__separator",
|
|
4010
4034
|
role: "separator"
|
|
4011
4035
|
};
|
|
4012
|
-
const _hoisted_3$
|
|
4036
|
+
const _hoisted_3$I = ["lang"];
|
|
4013
4037
|
const _hoisted_4$D = ["id", "role", "lang", "aria-checked", "aria-disabled", "aria-haspopup", "aria-expanded", "aria-keyshortcuts", "onClick", "onMouseenter"];
|
|
4014
4038
|
const _hoisted_5$s = { class: "tao-menu__text" };
|
|
4015
4039
|
const _hoisted_6$m = {
|
|
@@ -4186,8 +4210,15 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
4186
4210
|
if (!listen || typeof window === "undefined") {
|
|
4187
4211
|
return;
|
|
4188
4212
|
}
|
|
4213
|
+
const anchor = props.anchor;
|
|
4214
|
+
const holder = isVirtualAnchor(anchor) ? document.elementFromPoint?.(anchor.x + (anchor.width ?? 0) / 2, anchor.y + (anchor.height ?? 0) / 2) ?? returnTo : anchor;
|
|
4189
4215
|
const onScroll = (event) => {
|
|
4190
|
-
|
|
4216
|
+
const target = event.target;
|
|
4217
|
+
if (target instanceof Element && target.closest(".tao-menu")) {
|
|
4218
|
+
return;
|
|
4219
|
+
}
|
|
4220
|
+
const page = !(target instanceof Element) || target === document.documentElement || target === document.body;
|
|
4221
|
+
if (!page && holder && !target.contains(holder)) {
|
|
4191
4222
|
return;
|
|
4192
4223
|
}
|
|
4193
4224
|
tree.closeAll("scroll");
|
|
@@ -4224,7 +4255,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
4224
4255
|
class: "tao-menu__label",
|
|
4225
4256
|
role: "presentation",
|
|
4226
4257
|
lang: item.lang
|
|
4227
|
-
}, toDisplayString(item.label), 9, _hoisted_3$
|
|
4258
|
+
}, toDisplayString(item.label), 9, _hoisted_3$I)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
4228
4259
|
createElementVNode("div", {
|
|
4229
4260
|
id: itemId(index),
|
|
4230
4261
|
ref_for: true,
|
|
@@ -4292,9 +4323,8 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
|
|
|
4292
4323
|
};
|
|
4293
4324
|
}
|
|
4294
4325
|
});
|
|
4295
|
-
const _hoisted_1$Y =
|
|
4296
|
-
const _hoisted_2$R =
|
|
4297
|
-
const _hoisted_3$I = {
|
|
4326
|
+
const _hoisted_1$Y = ["tabindex", "aria-expanded", "aria-label"];
|
|
4327
|
+
const _hoisted_2$R = {
|
|
4298
4328
|
key: 1,
|
|
4299
4329
|
"aria-hidden": "true"
|
|
4300
4330
|
};
|
|
@@ -4308,7 +4338,8 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
4308
4338
|
closeOnScroll: { type: Boolean, default: false },
|
|
4309
4339
|
size: { default: void 0 },
|
|
4310
4340
|
dots: { default: "vertical" },
|
|
4311
|
-
tabbable: { type: Boolean, default: true }
|
|
4341
|
+
tabbable: { type: Boolean, default: true },
|
|
4342
|
+
block: { type: Boolean, default: false }
|
|
4312
4343
|
},
|
|
4313
4344
|
emits: ["select"],
|
|
4314
4345
|
setup(__props, { emit: __emit }) {
|
|
@@ -4333,7 +4364,9 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
4333
4364
|
}
|
|
4334
4365
|
}
|
|
4335
4366
|
return (_ctx, _cache) => {
|
|
4336
|
-
return openBlock(), createElementBlock("div",
|
|
4367
|
+
return openBlock(), createElementBlock("div", {
|
|
4368
|
+
class: normalizeClass(["tao-dropdown-menu", { "tao-dropdown-menu--block": __props.block }])
|
|
4369
|
+
}, [
|
|
4337
4370
|
createElementVNode("button", {
|
|
4338
4371
|
ref_key: "triggerRef",
|
|
4339
4372
|
ref: triggerRef,
|
|
@@ -4346,14 +4379,14 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
4346
4379
|
onClick: toggleMenu,
|
|
4347
4380
|
onKeydown: onTriggerKeydown
|
|
4348
4381
|
}, [
|
|
4349
|
-
_ctx.$slots.button ? renderSlot(_ctx.$slots, "button", {}, void 0,
|
|
4382
|
+
_ctx.$slots.button ? renderSlot(_ctx.$slots, "button", {}, void 0, void 0, 0) : (openBlock(), createElementBlock("span", _hoisted_2$R, [
|
|
4350
4383
|
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
4351
4384
|
createVNode(TaoIcon, {
|
|
4352
4385
|
name: __props.dots === "horizontal" ? "tao-more-horizontal" : "tao-more-vertical"
|
|
4353
4386
|
}, null, 8, ["name"])
|
|
4354
|
-
]
|
|
4387
|
+
])
|
|
4355
4388
|
]))
|
|
4356
|
-
], 42,
|
|
4389
|
+
], 42, _hoisted_1$Y),
|
|
4357
4390
|
createVNode(_sfc_main$16, {
|
|
4358
4391
|
items: __props.items,
|
|
4359
4392
|
open: isOpen.value,
|
|
@@ -4367,16 +4400,16 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
4367
4400
|
_ctx.$slots.item ? {
|
|
4368
4401
|
name: "item",
|
|
4369
4402
|
fn: withCtx((slotProps) => [
|
|
4370
|
-
renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps(slotProps))
|
|
4403
|
+
renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps(slotProps)))
|
|
4371
4404
|
]),
|
|
4372
4405
|
key: "0"
|
|
4373
4406
|
} : void 0
|
|
4374
4407
|
]), 1032, ["items", "open", "anchor", "placement", "label", "close-on-scroll"])
|
|
4375
|
-
]);
|
|
4408
|
+
], 2);
|
|
4376
4409
|
};
|
|
4377
4410
|
}
|
|
4378
4411
|
});
|
|
4379
|
-
const TaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-
|
|
4412
|
+
const TaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-e46b1e30"]]);
|
|
4380
4413
|
const _hoisted_1$X = { class: "tao-language-switch__sr" };
|
|
4381
4414
|
const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
4382
4415
|
...{ name: "TaoLanguageSwitch" },
|
|
@@ -4448,7 +4481,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
|
|
|
4448
4481
|
};
|
|
4449
4482
|
}
|
|
4450
4483
|
});
|
|
4451
|
-
const TaoLanguageSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__scopeId", "data-v-
|
|
4484
|
+
const TaoLanguageSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__scopeId", "data-v-2e26bf7f"]]);
|
|
4452
4485
|
function resolveTourTarget(target, root = document) {
|
|
4453
4486
|
if (!target) {
|
|
4454
4487
|
return null;
|
|
@@ -4500,12 +4533,12 @@ const _hoisted_7$g = {
|
|
|
4500
4533
|
key: 0,
|
|
4501
4534
|
class: "tao-tour__progress"
|
|
4502
4535
|
};
|
|
4503
|
-
const _hoisted_8$
|
|
4536
|
+
const _hoisted_8$d = {
|
|
4504
4537
|
class: "tao-tour__dots",
|
|
4505
4538
|
"aria-hidden": "true"
|
|
4506
4539
|
};
|
|
4507
|
-
const _hoisted_9$
|
|
4508
|
-
const _hoisted_10$
|
|
4540
|
+
const _hoisted_9$a = { class: "tao-tour__progress-text" };
|
|
4541
|
+
const _hoisted_10$6 = { class: "tao-tour__actions" };
|
|
4509
4542
|
const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
4510
4543
|
...{ name: "TaoTour" },
|
|
4511
4544
|
__name: "TaoTour",
|
|
@@ -4713,7 +4746,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
|
4713
4746
|
]),
|
|
4714
4747
|
createElementVNode("div", _hoisted_6$l, [
|
|
4715
4748
|
__props.count > 1 ? (openBlock(), createElementBlock("span", _hoisted_7$g, [
|
|
4716
|
-
createElementVNode("span", _hoisted_8$
|
|
4749
|
+
createElementVNode("span", _hoisted_8$d, [
|
|
4717
4750
|
(openBlock(true), createElementBlock(Fragment, null, renderList(dots.value, (i) => {
|
|
4718
4751
|
return openBlock(), createElementBlock("i", {
|
|
4719
4752
|
key: i,
|
|
@@ -4721,9 +4754,9 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
|
|
|
4721
4754
|
}, null, 2);
|
|
4722
4755
|
}), 128))
|
|
4723
4756
|
]),
|
|
4724
|
-
createElementVNode("span", _hoisted_9$
|
|
4757
|
+
createElementVNode("span", _hoisted_9$a, toDisplayString(progress.value), 1)
|
|
4725
4758
|
])) : createCommentVNode("", true),
|
|
4726
|
-
createElementVNode("span", _hoisted_10$
|
|
4759
|
+
createElementVNode("span", _hoisted_10$6, [
|
|
4727
4760
|
!isLast.value ? (openBlock(), createBlock(TaoButton, {
|
|
4728
4761
|
key: 0,
|
|
4729
4762
|
size: "small",
|
|
@@ -6070,8 +6103,8 @@ const _hoisted_5$p = {
|
|
|
6070
6103
|
};
|
|
6071
6104
|
const _hoisted_6$j = { class: "tao-file-drop__name" };
|
|
6072
6105
|
const _hoisted_7$f = { class: "tao-file-drop__meta" };
|
|
6073
|
-
const _hoisted_8$
|
|
6074
|
-
const _hoisted_9$
|
|
6106
|
+
const _hoisted_8$c = ["aria-label", "onClick"];
|
|
6107
|
+
const _hoisted_9$9 = { "aria-hidden": "true" };
|
|
6075
6108
|
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
6076
6109
|
...{ name: "TaoFileDrop", inheritAttrs: false },
|
|
6077
6110
|
__name: "TaoFileDrop",
|
|
@@ -6240,12 +6273,12 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
6240
6273
|
"aria-label": unref(l10n).removeLabel.replace("{name}", file.name),
|
|
6241
6274
|
onClick: ($event) => removeAt(index)
|
|
6242
6275
|
}, [
|
|
6243
|
-
createElementVNode("span", _hoisted_9$
|
|
6276
|
+
createElementVNode("span", _hoisted_9$9, [
|
|
6244
6277
|
renderSlot(_ctx.$slots, "remove-icon", {}, () => [
|
|
6245
6278
|
createVNode(TaoIcon, { name: "tao-close" })
|
|
6246
6279
|
], true)
|
|
6247
6280
|
])
|
|
6248
|
-
], 8, _hoisted_8$
|
|
6281
|
+
], 8, _hoisted_8$c)
|
|
6249
6282
|
]);
|
|
6250
6283
|
}), 128))
|
|
6251
6284
|
])) : createCommentVNode("", true)
|
|
@@ -7245,7 +7278,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
7245
7278
|
const props = __props;
|
|
7246
7279
|
const runs = computed(() => sparklineRuns(props.values, props.min, props.max));
|
|
7247
7280
|
const line = computed(() => sparklinePath(runs.value));
|
|
7248
|
-
const
|
|
7281
|
+
const fill2 = computed(() => props.area ? sparklineArea(runs.value) : "");
|
|
7249
7282
|
const last = computed(() => {
|
|
7250
7283
|
const run = runs.value[runs.value.length - 1];
|
|
7251
7284
|
const point = run?.[run.length - 1];
|
|
@@ -7261,10 +7294,10 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
7261
7294
|
"aria-hidden": __props.label ? void 0 : "true"
|
|
7262
7295
|
}, [
|
|
7263
7296
|
(openBlock(), createElementBlock("svg", _hoisted_2$C, [
|
|
7264
|
-
|
|
7297
|
+
fill2.value ? (openBlock(), createElementBlock("path", {
|
|
7265
7298
|
key: 0,
|
|
7266
7299
|
class: "tao-sparkline__area",
|
|
7267
|
-
d:
|
|
7300
|
+
d: fill2.value
|
|
7268
7301
|
}, null, 8, _hoisted_3$w)) : createCommentVNode("", true),
|
|
7269
7302
|
createElementVNode("path", {
|
|
7270
7303
|
class: "tao-sparkline__line",
|
|
@@ -7358,7 +7391,7 @@ const _hoisted_6$i = {
|
|
|
7358
7391
|
"aria-hidden": "true"
|
|
7359
7392
|
};
|
|
7360
7393
|
const _hoisted_7$e = { class: "tao-donut__name" };
|
|
7361
|
-
const _hoisted_8$
|
|
7394
|
+
const _hoisted_8$b = { class: "tao-donut__share" };
|
|
7362
7395
|
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
7363
7396
|
...{ name: "TaoDonut" },
|
|
7364
7397
|
__name: "TaoDonut",
|
|
@@ -7456,7 +7489,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
7456
7489
|
style: normalizeStyle({ background: arc.stroke })
|
|
7457
7490
|
}, null, 6),
|
|
7458
7491
|
createElementVNode("span", _hoisted_7$e, toDisplayString(arc.label), 1),
|
|
7459
|
-
createElementVNode("span", _hoisted_8$
|
|
7492
|
+
createElementVNode("span", _hoisted_8$b, toDisplayString(percent(arc.share)), 1)
|
|
7460
7493
|
]);
|
|
7461
7494
|
}), 128))
|
|
7462
7495
|
])) : createCommentVNode("", true)
|
|
@@ -7478,7 +7511,7 @@ const _hoisted_4$s = ["data-r", "data-c", "tabindex", "onPointerenter", "onFocus
|
|
|
7478
7511
|
const _hoisted_5$m = { class: "tao-sr-only" };
|
|
7479
7512
|
const _hoisted_6$h = { class: "tao-heatmap__tip-where" };
|
|
7480
7513
|
const _hoisted_7$d = { class: "tao-heatmap__tip-value" };
|
|
7481
|
-
const _hoisted_8$
|
|
7514
|
+
const _hoisted_8$a = {
|
|
7482
7515
|
key: 1,
|
|
7483
7516
|
class: "tao-heatmap__legend",
|
|
7484
7517
|
"aria-hidden": "true"
|
|
@@ -7708,7 +7741,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
7708
7741
|
return openBlock(), createElementBlock("span", { key: c }, toDisplayString(col), 1);
|
|
7709
7742
|
}), 128))
|
|
7710
7743
|
], 512),
|
|
7711
|
-
__props.legend && legendItems.value.length ? (openBlock(), createElementBlock("ul", _hoisted_8$
|
|
7744
|
+
__props.legend && legendItems.value.length ? (openBlock(), createElementBlock("ul", _hoisted_8$a, [
|
|
7712
7745
|
(openBlock(true), createElementBlock(Fragment, null, renderList(legendItems.value, (item) => {
|
|
7713
7746
|
return openBlock(), createElementBlock("li", {
|
|
7714
7747
|
key: item.level,
|
|
@@ -7741,12 +7774,12 @@ const _hoisted_6$g = {
|
|
|
7741
7774
|
"aria-hidden": "true"
|
|
7742
7775
|
};
|
|
7743
7776
|
const _hoisted_7$c = { class: "tao-nav__label" };
|
|
7744
|
-
const _hoisted_8$
|
|
7745
|
-
const _hoisted_9$
|
|
7777
|
+
const _hoisted_8$9 = ["aria-hidden"];
|
|
7778
|
+
const _hoisted_9$8 = {
|
|
7746
7779
|
key: 0,
|
|
7747
7780
|
class: "tao-nav__entry tao-nav__entry--more"
|
|
7748
7781
|
};
|
|
7749
|
-
const _hoisted_10$
|
|
7782
|
+
const _hoisted_10$5 = ["aria-expanded"];
|
|
7750
7783
|
const _hoisted_11$4 = {
|
|
7751
7784
|
class: "tao-nav__icon",
|
|
7752
7785
|
"aria-hidden": "true"
|
|
@@ -7771,6 +7804,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
7771
7804
|
ariaLabel: { default: void 0 },
|
|
7772
7805
|
moreLabel: { default: void 0 },
|
|
7773
7806
|
floating: { type: Boolean, default: false },
|
|
7807
|
+
fill: { type: Boolean, default: false },
|
|
7774
7808
|
indicator: { default: "pill" },
|
|
7775
7809
|
surface: { default: "flat" },
|
|
7776
7810
|
badgeTone: { default: "accent" }
|
|
@@ -7821,7 +7855,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
7821
7855
|
}
|
|
7822
7856
|
return (_ctx, _cache) => {
|
|
7823
7857
|
return openBlock(), createElementBlock("div", {
|
|
7824
|
-
class: normalizeClass(["tao-nav", [`tao-nav--${__props.layout}`, `tao-nav--indicator-${__props.indicator}`, { "tao-nav--standalone": standalone.value, "tao-nav--floating": __props.floating, "tao-nav--badges-neutral": __props.badgeTone === "neutral" }]])
|
|
7858
|
+
class: normalizeClass(["tao-nav", [`tao-nav--${__props.layout}`, `tao-nav--indicator-${__props.indicator}`, { "tao-nav--standalone": standalone.value, "tao-nav--floating": __props.floating, "tao-nav--fill": __props.fill && !standalone.value, "tao-nav--badges-neutral": __props.badgeTone === "neutral" }]])
|
|
7825
7859
|
}, [
|
|
7826
7860
|
createElementVNode("div", _hoisted_1$C, [
|
|
7827
7861
|
createElementVNode("nav", {
|
|
@@ -7866,13 +7900,13 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
7866
7900
|
key: 1,
|
|
7867
7901
|
class: normalizeClass(["tao-nav__badge", { "tao-nav__badge--dot": item.badge === true }]),
|
|
7868
7902
|
"aria-hidden": item.badge === true ? "true" : void 0
|
|
7869
|
-
}, toDisplayString(badgeText(item)), 11, _hoisted_8$
|
|
7903
|
+
}, toDisplayString(badgeText(item)), 11, _hoisted_8$9)) : createCommentVNode("", true)
|
|
7870
7904
|
]),
|
|
7871
7905
|
_: 2
|
|
7872
7906
|
}, 1032, ["class", "href", "type", "disabled", "aria-disabled", "aria-current", "onClick"]))
|
|
7873
7907
|
], 2);
|
|
7874
7908
|
}), 128)),
|
|
7875
|
-
overflowing.value ? (openBlock(), createElementBlock("li", _hoisted_9$
|
|
7909
|
+
overflowing.value ? (openBlock(), createElementBlock("li", _hoisted_9$8, [
|
|
7876
7910
|
createElementVNode("button", {
|
|
7877
7911
|
ref_key: "moreButton",
|
|
7878
7912
|
ref: moreButton,
|
|
@@ -7889,7 +7923,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
7889
7923
|
})
|
|
7890
7924
|
]),
|
|
7891
7925
|
createElementVNode("span", _hoisted_12$2, toDisplayString(unref(l10n).moreLabel), 1)
|
|
7892
|
-
], 10, _hoisted_10$
|
|
7926
|
+
], 10, _hoisted_10$5)
|
|
7893
7927
|
])) : createCommentVNode("", true)
|
|
7894
7928
|
]),
|
|
7895
7929
|
has("footer") ? (openBlock(), createElementBlock("div", _hoisted_13$1, [
|
|
@@ -7915,7 +7949,13 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
7915
7949
|
};
|
|
7916
7950
|
}
|
|
7917
7951
|
});
|
|
7918
|
-
const TaoNav = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-
|
|
7952
|
+
const TaoNav = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-c92f903e"]]);
|
|
7953
|
+
function menuSelection(mode, selected, node) {
|
|
7954
|
+
if (mode === "none" || node.disabled || selected.has(node.id)) {
|
|
7955
|
+
return void 0;
|
|
7956
|
+
}
|
|
7957
|
+
return mode === "single" ? node.id : [node.id];
|
|
7958
|
+
}
|
|
7919
7959
|
function visibleRows(nodes, expanded, children) {
|
|
7920
7960
|
const rows = [];
|
|
7921
7961
|
const ancestors = /* @__PURE__ */ new Set();
|
|
@@ -7965,8 +8005,482 @@ function toggleCheck(node, checked2, children) {
|
|
|
7965
8005
|
}
|
|
7966
8006
|
return next;
|
|
7967
8007
|
}
|
|
8008
|
+
function isTreeContainer(node) {
|
|
8009
|
+
return Array.isArray(node.children) || Boolean(node.hasChildren);
|
|
8010
|
+
}
|
|
8011
|
+
function compareTreeNodes(locale) {
|
|
8012
|
+
let collator;
|
|
8013
|
+
try {
|
|
8014
|
+
collator = new Intl.Collator(locale, { numeric: true, sensitivity: "base" });
|
|
8015
|
+
} catch {
|
|
8016
|
+
collator = new Intl.Collator(void 0, { numeric: true, sensitivity: "base" });
|
|
8017
|
+
}
|
|
8018
|
+
return (a, b) => Number(isTreeContainer(b)) - Number(isTreeContainer(a)) || collator.compare(a.label, b.label);
|
|
8019
|
+
}
|
|
8020
|
+
function sortTreeNodes(list, sort, locale) {
|
|
8021
|
+
if (sort === "none") {
|
|
8022
|
+
return list;
|
|
8023
|
+
}
|
|
8024
|
+
return list.slice().sort(sort === "name" ? compareTreeNodes(locale) : sort);
|
|
8025
|
+
}
|
|
8026
|
+
function topmostIds(ids, parentOf) {
|
|
8027
|
+
const set = new Set(ids);
|
|
8028
|
+
return ids.filter((id) => {
|
|
8029
|
+
for (let p = parentOf(id); p != null; p = parentOf(p)) {
|
|
8030
|
+
if (set.has(p)) {
|
|
8031
|
+
return false;
|
|
8032
|
+
}
|
|
8033
|
+
}
|
|
8034
|
+
return true;
|
|
8035
|
+
});
|
|
8036
|
+
}
|
|
8037
|
+
function dropTarget(input) {
|
|
8038
|
+
const { rows, fraction: fraction2, dragged, childIds, parentOf } = input;
|
|
8039
|
+
const hovered = rows[input.over];
|
|
8040
|
+
if (!hovered) {
|
|
8041
|
+
return null;
|
|
8042
|
+
}
|
|
8043
|
+
const moving = new Set(dragged);
|
|
8044
|
+
for (let p = hovered.node.id; p != null; p = parentOf(p)) {
|
|
8045
|
+
if (moving.has(p)) {
|
|
8046
|
+
return null;
|
|
8047
|
+
}
|
|
8048
|
+
}
|
|
8049
|
+
const container = isTreeContainer(hovered.node) && !hovered.node.disabled;
|
|
8050
|
+
if (input.sorted) {
|
|
8051
|
+
const parentId = container ? hovered.node.id : hovered.parentId;
|
|
8052
|
+
const now2 = childIds(parentId) ?? [];
|
|
8053
|
+
if (dragged.every((id) => now2.includes(id))) {
|
|
8054
|
+
return null;
|
|
8055
|
+
}
|
|
8056
|
+
const parentRow = parentId === null ? void 0 : rows.find((row) => row.node.id === parentId);
|
|
8057
|
+
return {
|
|
8058
|
+
parentId,
|
|
8059
|
+
index: now2.filter((id) => !moving.has(id)).length,
|
|
8060
|
+
targetId: hovered.node.id,
|
|
8061
|
+
position: "inside",
|
|
8062
|
+
// the top level has no row: the mark is the whole tree (an empty rowId) / у верхнего уровня нет строки
|
|
8063
|
+
mark: { rowId: parentRow ? parentId : "", side: "inside", level: parentRow?.level ?? 0 }
|
|
8064
|
+
};
|
|
8065
|
+
}
|
|
8066
|
+
let position = container ? fraction2 < 0.25 ? "before" : fraction2 > 0.75 ? "after" : "inside" : fraction2 < 0.5 ? "before" : "after";
|
|
8067
|
+
const rest = (parentId) => (childIds(parentId) ?? []).filter((id) => !moving.has(id));
|
|
8068
|
+
let drop;
|
|
8069
|
+
if (position === "after" && hovered.expanded && (childIds(hovered.node.id)?.length ?? 0) > 0) {
|
|
8070
|
+
position = "inside";
|
|
8071
|
+
drop = {
|
|
8072
|
+
parentId: hovered.node.id,
|
|
8073
|
+
index: 0,
|
|
8074
|
+
targetId: hovered.node.id,
|
|
8075
|
+
position,
|
|
8076
|
+
mark: { rowId: hovered.node.id, side: "after", level: hovered.level + 1 }
|
|
8077
|
+
};
|
|
8078
|
+
} else if (position === "inside") {
|
|
8079
|
+
drop = {
|
|
8080
|
+
parentId: hovered.node.id,
|
|
8081
|
+
index: rest(hovered.node.id).length,
|
|
8082
|
+
targetId: hovered.node.id,
|
|
8083
|
+
position,
|
|
8084
|
+
mark: { rowId: hovered.node.id, side: "inside", level: hovered.level }
|
|
8085
|
+
};
|
|
8086
|
+
} else {
|
|
8087
|
+
let target = hovered;
|
|
8088
|
+
if (position === "after" && input.level !== void 0) {
|
|
8089
|
+
while (target.level > input.level && target.posinset === target.setsize && target.parentId !== null) {
|
|
8090
|
+
const parent = rows.find((row) => row.node.id === target.parentId);
|
|
8091
|
+
if (!parent) {
|
|
8092
|
+
break;
|
|
8093
|
+
}
|
|
8094
|
+
target = parent;
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
const siblings = rest(target.parentId);
|
|
8098
|
+
const at = siblings.indexOf(target.node.id);
|
|
8099
|
+
drop = {
|
|
8100
|
+
parentId: target.parentId,
|
|
8101
|
+
index: position === "before" ? at : at + 1,
|
|
8102
|
+
targetId: target.node.id,
|
|
8103
|
+
position,
|
|
8104
|
+
mark: { rowId: hovered.node.id, side: position, level: target.level }
|
|
8105
|
+
};
|
|
8106
|
+
}
|
|
8107
|
+
const now = childIds(drop.parentId) ?? [];
|
|
8108
|
+
if (dragged.every((id) => now.includes(id))) {
|
|
8109
|
+
const others = now.filter((id) => !moving.has(id));
|
|
8110
|
+
const after = [...others.slice(0, drop.index), ...dragged, ...others.slice(drop.index)];
|
|
8111
|
+
if (after.length === now.length && after.every((id, i) => id === now[i])) {
|
|
8112
|
+
return null;
|
|
8113
|
+
}
|
|
8114
|
+
}
|
|
8115
|
+
return drop;
|
|
8116
|
+
}
|
|
8117
|
+
function moveTreeNodes(nodes, move) {
|
|
8118
|
+
const moving = new Set(move.ids);
|
|
8119
|
+
const taken = /* @__PURE__ */ new Map();
|
|
8120
|
+
const strip = (list) => list.filter((node) => {
|
|
8121
|
+
if (moving.has(node.id)) {
|
|
8122
|
+
taken.set(node.id, node);
|
|
8123
|
+
return false;
|
|
8124
|
+
}
|
|
8125
|
+
return true;
|
|
8126
|
+
}).map((node) => node.children ? { ...node, children: strip(node.children) } : node);
|
|
8127
|
+
const stripped = strip(nodes);
|
|
8128
|
+
const items = move.ids.map((id) => taken.get(id)).filter((node) => Boolean(node));
|
|
8129
|
+
const insert = (list) => {
|
|
8130
|
+
const next = list.slice();
|
|
8131
|
+
next.splice(Math.max(0, Math.min(move.index, next.length)), 0, ...items);
|
|
8132
|
+
return next;
|
|
8133
|
+
};
|
|
8134
|
+
if (move.parentId === null) {
|
|
8135
|
+
return insert(stripped);
|
|
8136
|
+
}
|
|
8137
|
+
const put = (list) => list.map(
|
|
8138
|
+
(node) => node.id === move.parentId ? { ...node, children: insert(node.children ?? []) } : node.children ? { ...node, children: put(node.children) } : node
|
|
8139
|
+
);
|
|
8140
|
+
return put(stripped);
|
|
8141
|
+
}
|
|
8142
|
+
const DRAG_START = 5;
|
|
8143
|
+
const OPEN_DELAY = 650;
|
|
8144
|
+
const EDGE = 36;
|
|
8145
|
+
const EDGE_SPEED = 800;
|
|
8146
|
+
function fill(template, values) {
|
|
8147
|
+
return template.replace(/\{(\w+)\}/g, (match, key) => values[key] ?? match);
|
|
8148
|
+
}
|
|
8149
|
+
function scrollParent(el) {
|
|
8150
|
+
for (let p = el?.parentElement ?? null; p; p = p.parentElement) {
|
|
8151
|
+
const overflow = getComputedStyle(p).overflowY;
|
|
8152
|
+
if (/(auto|scroll)/.test(overflow) && p.scrollHeight > p.clientHeight) {
|
|
8153
|
+
return p;
|
|
8154
|
+
}
|
|
8155
|
+
}
|
|
8156
|
+
return null;
|
|
8157
|
+
}
|
|
8158
|
+
function useTreeMove(o) {
|
|
8159
|
+
const dragging = shallowRef(/* @__PURE__ */ new Set());
|
|
8160
|
+
const drop = shallowRef(null);
|
|
8161
|
+
const refused = ref(false);
|
|
8162
|
+
const ghost = ref(null);
|
|
8163
|
+
const pending = shallowRef(/* @__PURE__ */ new Set());
|
|
8164
|
+
const clipboard = shallowRef(null);
|
|
8165
|
+
let press = null;
|
|
8166
|
+
let ids = [];
|
|
8167
|
+
let copy = false;
|
|
8168
|
+
let last = { x: 0, y: 0 };
|
|
8169
|
+
let swallow = false;
|
|
8170
|
+
let openTimer;
|
|
8171
|
+
let openFor = "";
|
|
8172
|
+
let frame = 0;
|
|
8173
|
+
let scroller = null;
|
|
8174
|
+
const label = (list) => list.length === 1 ? o.node(list[0])?.label ?? list[0] : o.texts().count(list.length);
|
|
8175
|
+
const targetLabel = (move) => move.parentId === null ? o.texts().root : o.node(move.parentId)?.label ?? move.parentId;
|
|
8176
|
+
function idsFor(row) {
|
|
8177
|
+
const selected = o.selected();
|
|
8178
|
+
const picked = selected.has(row.node.id) ? o.rows().map((r) => r.node.id).filter((id) => selected.has(id)) : [row.node.id];
|
|
8179
|
+
return topmostIds(picked, o.parentOf).filter((id) => {
|
|
8180
|
+
const node = o.node(id);
|
|
8181
|
+
return node && !node.disabled && o.movable(node) && !pending.value.has(id);
|
|
8182
|
+
});
|
|
8183
|
+
}
|
|
8184
|
+
const moveOf = (d, list, asCopy) => ({
|
|
8185
|
+
ids: list,
|
|
8186
|
+
parentId: d.parentId,
|
|
8187
|
+
index: d.index,
|
|
8188
|
+
targetId: d.targetId,
|
|
8189
|
+
position: d.position,
|
|
8190
|
+
copy: asCopy
|
|
8191
|
+
});
|
|
8192
|
+
async function commit(move) {
|
|
8193
|
+
const from = move.ids.map((id) => o.parentOf(id) ?? null);
|
|
8194
|
+
pending.value = /* @__PURE__ */ new Set([...pending.value, ...move.ids]);
|
|
8195
|
+
o.announce(fill(move.copy ? o.texts().copied : o.texts().moved, { item: label(move.ids), target: targetLabel(move) }));
|
|
8196
|
+
try {
|
|
8197
|
+
await o.move(move);
|
|
8198
|
+
o.moved(move, from);
|
|
8199
|
+
} catch (error) {
|
|
8200
|
+
o.failed(move, error);
|
|
8201
|
+
} finally {
|
|
8202
|
+
const next = new Set(pending.value);
|
|
8203
|
+
move.ids.forEach((id) => next.delete(id));
|
|
8204
|
+
pending.value = next;
|
|
8205
|
+
}
|
|
8206
|
+
}
|
|
8207
|
+
function rowAt(y) {
|
|
8208
|
+
const count = o.rows().length;
|
|
8209
|
+
let lo = 0;
|
|
8210
|
+
let hi = count - 1;
|
|
8211
|
+
while (lo <= hi) {
|
|
8212
|
+
const mid = lo + hi >> 1;
|
|
8213
|
+
const box = o.rowEl(mid)?.getBoundingClientRect();
|
|
8214
|
+
if (!box) {
|
|
8215
|
+
return -1;
|
|
8216
|
+
}
|
|
8217
|
+
if (y < box.top) {
|
|
8218
|
+
hi = mid - 1;
|
|
8219
|
+
} else if (y >= box.bottom) {
|
|
8220
|
+
lo = mid + 1;
|
|
8221
|
+
} else {
|
|
8222
|
+
return mid;
|
|
8223
|
+
}
|
|
8224
|
+
}
|
|
8225
|
+
return -1;
|
|
8226
|
+
}
|
|
8227
|
+
function levelAt(x, el) {
|
|
8228
|
+
const box = el.getBoundingClientRect();
|
|
8229
|
+
const indent = el.querySelector(".tao-tree__toggle")?.getBoundingClientRect().width || 16;
|
|
8230
|
+
const start = box.left + (parseFloat(getComputedStyle(el).paddingLeft) || 0);
|
|
8231
|
+
return Math.max(1, Math.floor((x - start) / indent) + 1);
|
|
8232
|
+
}
|
|
8233
|
+
function clearOpen() {
|
|
8234
|
+
clearTimeout(openTimer);
|
|
8235
|
+
openFor = "";
|
|
8236
|
+
}
|
|
8237
|
+
function update() {
|
|
8238
|
+
const rows = o.rows();
|
|
8239
|
+
const index = rowAt(last.y);
|
|
8240
|
+
const el = index >= 0 ? o.rowEl(index) : null;
|
|
8241
|
+
let next = null;
|
|
8242
|
+
refused.value = false;
|
|
8243
|
+
if (el) {
|
|
8244
|
+
const box = el.getBoundingClientRect();
|
|
8245
|
+
next = dropTarget({
|
|
8246
|
+
rows,
|
|
8247
|
+
over: index,
|
|
8248
|
+
fraction: box.height ? (last.y - box.top) / box.height : 0.5,
|
|
8249
|
+
level: levelAt(last.x, el),
|
|
8250
|
+
dragged: ids,
|
|
8251
|
+
childIds: o.childIds,
|
|
8252
|
+
parentOf: o.parentOf,
|
|
8253
|
+
sorted: o.sorted()
|
|
8254
|
+
});
|
|
8255
|
+
if (next && !o.canDrop(moveOf(next, ids, copy))) {
|
|
8256
|
+
next = null;
|
|
8257
|
+
refused.value = true;
|
|
8258
|
+
}
|
|
8259
|
+
}
|
|
8260
|
+
drop.value = next;
|
|
8261
|
+
if (ghost.value) {
|
|
8262
|
+
ghost.value = { ...ghost.value, x: last.x, y: last.y, copy };
|
|
8263
|
+
}
|
|
8264
|
+
const row = index >= 0 ? rows[index] : void 0;
|
|
8265
|
+
const opens = next?.position === "inside" && next.mark.side === "inside" && row && row.branch && !row.expanded;
|
|
8266
|
+
if (!opens) {
|
|
8267
|
+
clearOpen();
|
|
8268
|
+
} else if (openFor !== row.node.id) {
|
|
8269
|
+
clearOpen();
|
|
8270
|
+
openFor = row.node.id;
|
|
8271
|
+
openTimer = setTimeout(() => {
|
|
8272
|
+
const now = o.rows().find((r) => r.node.id === openFor);
|
|
8273
|
+
if (now && !now.expanded) {
|
|
8274
|
+
void Promise.resolve(o.expand(now)).then(() => dragging.value.size && update());
|
|
8275
|
+
}
|
|
8276
|
+
}, OPEN_DELAY);
|
|
8277
|
+
}
|
|
8278
|
+
}
|
|
8279
|
+
let frameAt = 0;
|
|
8280
|
+
function startEdgeScroll() {
|
|
8281
|
+
if (!frame && typeof requestAnimationFrame !== "undefined") {
|
|
8282
|
+
frameAt = performance.now();
|
|
8283
|
+
frame = requestAnimationFrame(edgeScroll);
|
|
8284
|
+
}
|
|
8285
|
+
}
|
|
8286
|
+
function edgeScroll(now) {
|
|
8287
|
+
frame = 0;
|
|
8288
|
+
if (!dragging.value.size) {
|
|
8289
|
+
return;
|
|
8290
|
+
}
|
|
8291
|
+
const dt = Math.min(50, Math.max(0, now - frameAt)) / 1e3;
|
|
8292
|
+
frameAt = now;
|
|
8293
|
+
const box = scroller ? scroller.getBoundingClientRect() : { top: 0, bottom: window.innerHeight };
|
|
8294
|
+
const into = last.y < box.top + EDGE ? last.y - (box.top + EDGE) : last.y > box.bottom - EDGE ? last.y - (box.bottom - EDGE) : 0;
|
|
8295
|
+
if (into) {
|
|
8296
|
+
const depth = Math.max(-1, Math.min(1, into / EDGE));
|
|
8297
|
+
const step = Math.round(depth * EDGE_SPEED * dt);
|
|
8298
|
+
if (scroller) {
|
|
8299
|
+
scroller.scrollTop += step;
|
|
8300
|
+
} else {
|
|
8301
|
+
window.scrollBy(0, step);
|
|
8302
|
+
}
|
|
8303
|
+
update();
|
|
8304
|
+
}
|
|
8305
|
+
frame = requestAnimationFrame(edgeScroll);
|
|
8306
|
+
}
|
|
8307
|
+
function begin() {
|
|
8308
|
+
const row = o.rows()[press.index];
|
|
8309
|
+
ids = row ? idsFor(row) : [];
|
|
8310
|
+
if (!ids.length) {
|
|
8311
|
+
press = null;
|
|
8312
|
+
stopListening();
|
|
8313
|
+
return;
|
|
8314
|
+
}
|
|
8315
|
+
dragging.value = new Set(ids);
|
|
8316
|
+
ghost.value = { x: last.x, y: last.y, text: label(ids), copy };
|
|
8317
|
+
scroller = scrollParent(o.root.value);
|
|
8318
|
+
document.addEventListener("keydown", onDragKey, true);
|
|
8319
|
+
document.addEventListener("keyup", onDragKey, true);
|
|
8320
|
+
window.addEventListener("blur", cancel);
|
|
8321
|
+
startEdgeScroll();
|
|
8322
|
+
update();
|
|
8323
|
+
}
|
|
8324
|
+
function onPointerDown(event, index) {
|
|
8325
|
+
if (!o.enabled() || event.button !== 0 || event.pointerType === "touch" || press || dragging.value.size) {
|
|
8326
|
+
return;
|
|
8327
|
+
}
|
|
8328
|
+
if (event.target?.closest?.(".tao-tree__toggle, .tao-tree__check, .tao-tree__actions")) {
|
|
8329
|
+
return;
|
|
8330
|
+
}
|
|
8331
|
+
const node = o.rows()[index]?.node;
|
|
8332
|
+
if (!node || node.disabled || !o.movable(node) || pending.value.has(node.id)) {
|
|
8333
|
+
return;
|
|
8334
|
+
}
|
|
8335
|
+
press = { x: event.clientX, y: event.clientY, index, pointerId: event.pointerId };
|
|
8336
|
+
last = { x: event.clientX, y: event.clientY };
|
|
8337
|
+
document.addEventListener("pointermove", onPointerMove);
|
|
8338
|
+
document.addEventListener("pointerup", onPointerUp);
|
|
8339
|
+
document.addEventListener("pointercancel", cancel);
|
|
8340
|
+
}
|
|
8341
|
+
function onPointerMove(event) {
|
|
8342
|
+
if (!press || event.pointerId !== press.pointerId) {
|
|
8343
|
+
return;
|
|
8344
|
+
}
|
|
8345
|
+
last = { x: event.clientX, y: event.clientY };
|
|
8346
|
+
copy = event.ctrlKey || event.altKey;
|
|
8347
|
+
if (!dragging.value.size) {
|
|
8348
|
+
if (Math.hypot(last.x - press.x, last.y - press.y) < DRAG_START) {
|
|
8349
|
+
return;
|
|
8350
|
+
}
|
|
8351
|
+
begin();
|
|
8352
|
+
return;
|
|
8353
|
+
}
|
|
8354
|
+
event.preventDefault();
|
|
8355
|
+
update();
|
|
8356
|
+
}
|
|
8357
|
+
function onPointerUp(event) {
|
|
8358
|
+
if (!press || event.pointerId !== press.pointerId) {
|
|
8359
|
+
return;
|
|
8360
|
+
}
|
|
8361
|
+
const wasDrag = dragging.value.size > 0;
|
|
8362
|
+
const asCopy = event.ctrlKey || event.altKey;
|
|
8363
|
+
const target = drop.value;
|
|
8364
|
+
const list = ids;
|
|
8365
|
+
finish();
|
|
8366
|
+
if (wasDrag) {
|
|
8367
|
+
swallow = true;
|
|
8368
|
+
setTimeout(() => swallow = false);
|
|
8369
|
+
if (target) {
|
|
8370
|
+
void commit(moveOf(target, list, asCopy));
|
|
8371
|
+
}
|
|
8372
|
+
}
|
|
8373
|
+
}
|
|
8374
|
+
function onDragKey(event) {
|
|
8375
|
+
if (event.key === "Escape") {
|
|
8376
|
+
event.preventDefault();
|
|
8377
|
+
event.stopPropagation();
|
|
8378
|
+
cancel();
|
|
8379
|
+
o.announce(o.texts().canceled);
|
|
8380
|
+
return;
|
|
8381
|
+
}
|
|
8382
|
+
const next = event.ctrlKey || event.altKey;
|
|
8383
|
+
if (next !== copy) {
|
|
8384
|
+
copy = next;
|
|
8385
|
+
update();
|
|
8386
|
+
}
|
|
8387
|
+
}
|
|
8388
|
+
function stopListening() {
|
|
8389
|
+
document.removeEventListener("pointermove", onPointerMove);
|
|
8390
|
+
document.removeEventListener("pointerup", onPointerUp);
|
|
8391
|
+
document.removeEventListener("pointercancel", cancel);
|
|
8392
|
+
document.removeEventListener("keydown", onDragKey, true);
|
|
8393
|
+
document.removeEventListener("keyup", onDragKey, true);
|
|
8394
|
+
window.removeEventListener("blur", cancel);
|
|
8395
|
+
}
|
|
8396
|
+
function finish() {
|
|
8397
|
+
press = null;
|
|
8398
|
+
ids = [];
|
|
8399
|
+
copy = false;
|
|
8400
|
+
stopListening();
|
|
8401
|
+
clearOpen();
|
|
8402
|
+
if (frame) {
|
|
8403
|
+
cancelAnimationFrame(frame);
|
|
8404
|
+
frame = 0;
|
|
8405
|
+
}
|
|
8406
|
+
dragging.value = /* @__PURE__ */ new Set();
|
|
8407
|
+
drop.value = null;
|
|
8408
|
+
refused.value = false;
|
|
8409
|
+
ghost.value = null;
|
|
8410
|
+
}
|
|
8411
|
+
function cancel() {
|
|
8412
|
+
finish();
|
|
8413
|
+
}
|
|
8414
|
+
function onKeydown2(event, index) {
|
|
8415
|
+
if (!o.enabled()) {
|
|
8416
|
+
return false;
|
|
8417
|
+
}
|
|
8418
|
+
const row = o.rows()[index];
|
|
8419
|
+
if (!row) {
|
|
8420
|
+
return false;
|
|
8421
|
+
}
|
|
8422
|
+
const mod = event.ctrlKey || event.metaKey;
|
|
8423
|
+
const key = event.key.toLowerCase();
|
|
8424
|
+
if (mod && (key === "x" || key === "c") && !event.altKey && !event.shiftKey) {
|
|
8425
|
+
const list = idsFor(row);
|
|
8426
|
+
if (!list.length) {
|
|
8427
|
+
return false;
|
|
8428
|
+
}
|
|
8429
|
+
event.preventDefault();
|
|
8430
|
+
clipboard.value = { ids: list, copy: key === "c" };
|
|
8431
|
+
o.announce(fill(key === "c" ? o.texts().copy : o.texts().cut, { item: label(list) }));
|
|
8432
|
+
return true;
|
|
8433
|
+
}
|
|
8434
|
+
if (mod && key === "v" && clipboard.value) {
|
|
8435
|
+
event.preventDefault();
|
|
8436
|
+
const { ids: list, copy: asCopy } = clipboard.value;
|
|
8437
|
+
const alive = list.filter((id) => o.node(id));
|
|
8438
|
+
const into = isTreeContainer(row.node) && !row.node.disabled;
|
|
8439
|
+
const d = dropTarget({
|
|
8440
|
+
rows: o.rows(),
|
|
8441
|
+
over: index,
|
|
8442
|
+
fraction: into ? 0.5 : 0.99,
|
|
8443
|
+
dragged: alive,
|
|
8444
|
+
childIds: o.childIds,
|
|
8445
|
+
parentOf: o.parentOf,
|
|
8446
|
+
sorted: o.sorted()
|
|
8447
|
+
});
|
|
8448
|
+
const move = d && moveOf(d, alive, asCopy);
|
|
8449
|
+
if (!move || !alive.length || !o.canDrop(move)) {
|
|
8450
|
+
o.announce(fill(o.texts().refused, { item: label(alive.length ? alive : list), target: row.node.label }));
|
|
8451
|
+
return true;
|
|
8452
|
+
}
|
|
8453
|
+
if (!asCopy) {
|
|
8454
|
+
clipboard.value = null;
|
|
8455
|
+
}
|
|
8456
|
+
void commit(move);
|
|
8457
|
+
return true;
|
|
8458
|
+
}
|
|
8459
|
+
if (event.key === "Escape" && clipboard.value) {
|
|
8460
|
+
event.preventDefault();
|
|
8461
|
+
clipboard.value = null;
|
|
8462
|
+
o.announce(o.texts().canceled);
|
|
8463
|
+
return true;
|
|
8464
|
+
}
|
|
8465
|
+
return false;
|
|
8466
|
+
}
|
|
8467
|
+
onBeforeUnmount(finish);
|
|
8468
|
+
return {
|
|
8469
|
+
dragging,
|
|
8470
|
+
drop,
|
|
8471
|
+
refused,
|
|
8472
|
+
ghost,
|
|
8473
|
+
pending,
|
|
8474
|
+
clipboard,
|
|
8475
|
+
onPointerDown,
|
|
8476
|
+
onKeydown: onKeydown2,
|
|
8477
|
+
/** The click right after a drag: the tree ignores it. / Клик сразу после перетаскивания: дерево его не считает. */
|
|
8478
|
+
swallowClick: () => swallow,
|
|
8479
|
+
cancel
|
|
8480
|
+
};
|
|
8481
|
+
}
|
|
7968
8482
|
const _hoisted_1$B = ["aria-label", "aria-multiselectable"];
|
|
7969
|
-
const _hoisted_2$x = ["id", "tabindex", "aria-level", "aria-setsize", "aria-posinset", "aria-expanded", "aria-selected", "aria-checked", "aria-disabled", "aria-busy", "onKeydown", "onClick", "onFocus"];
|
|
8483
|
+
const _hoisted_2$x = ["id", "tabindex", "aria-level", "aria-setsize", "aria-posinset", "aria-expanded", "aria-selected", "aria-checked", "aria-disabled", "aria-busy", "onKeydown", "onPointerdown", "onClick", "onDblclick", "onContextmenu", "onFocus"];
|
|
7970
8484
|
const _hoisted_3$r = ["onClick"];
|
|
7971
8485
|
const _hoisted_4$q = ["title"];
|
|
7972
8486
|
const _hoisted_5$k = ["onClick"];
|
|
@@ -7976,6 +8490,19 @@ const _hoisted_6$f = {
|
|
|
7976
8490
|
"aria-hidden": "true"
|
|
7977
8491
|
};
|
|
7978
8492
|
const _hoisted_7$b = { class: "tao-tree__label" };
|
|
8493
|
+
const _hoisted_8$8 = {
|
|
8494
|
+
key: 2,
|
|
8495
|
+
class: "tao-tree__hint"
|
|
8496
|
+
};
|
|
8497
|
+
const _hoisted_9$7 = {
|
|
8498
|
+
key: 0,
|
|
8499
|
+
class: "tao-tree__ghost-copy"
|
|
8500
|
+
};
|
|
8501
|
+
const _hoisted_10$4 = {
|
|
8502
|
+
class: "tao-sr-only",
|
|
8503
|
+
role: "status",
|
|
8504
|
+
"aria-live": "polite"
|
|
8505
|
+
};
|
|
7979
8506
|
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
7980
8507
|
...{ name: "TaoTree" },
|
|
7981
8508
|
__name: "TaoTree",
|
|
@@ -7988,13 +8515,21 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
7988
8515
|
checked: { default: void 0 },
|
|
7989
8516
|
load: { type: Function, default: void 0 },
|
|
7990
8517
|
size: { default: void 0 },
|
|
8518
|
+
menu: { type: [Array, Function], default: void 0 },
|
|
8519
|
+
onMove: { type: Function, default: void 0 },
|
|
8520
|
+
sort: { type: [String, Function], default: "none" },
|
|
8521
|
+
movable: { type: [Boolean, Function], default: true },
|
|
8522
|
+
canDrop: { type: Function, default: void 0 },
|
|
7991
8523
|
ariaLabel: { default: void 0 },
|
|
7992
|
-
loadingLabel: { default: void 0 }
|
|
8524
|
+
loadingLabel: { default: void 0 },
|
|
8525
|
+
menuLabel: { default: void 0 }
|
|
7993
8526
|
},
|
|
7994
|
-
emits: ["update:expanded", "update:selected", "update:checked", "select", "load-error"],
|
|
8527
|
+
emits: ["update:expanded", "update:selected", "update:checked", "select", "open", "load-error", "menu", "menu-select", "move-error"],
|
|
7995
8528
|
setup(__props, { emit: __emit }) {
|
|
7996
8529
|
const props = __props;
|
|
7997
8530
|
const l10n = useLocaleText(props, "tree");
|
|
8531
|
+
const locale = useTaoLocale();
|
|
8532
|
+
const text = (key) => l10n.value[key] ?? localeEn.tree[key];
|
|
7998
8533
|
const emit = __emit;
|
|
7999
8534
|
const ownExpanded = ref([]);
|
|
8000
8535
|
const ownSelected = ref(null);
|
|
@@ -8021,37 +8556,78 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8021
8556
|
}
|
|
8022
8557
|
const loaded = shallowReactive(/* @__PURE__ */ new Map());
|
|
8023
8558
|
const loading = shallowReactive(/* @__PURE__ */ new Set());
|
|
8024
|
-
const
|
|
8025
|
-
const
|
|
8559
|
+
const raw = (node) => node.children ?? loaded.get(node.id);
|
|
8560
|
+
const order = computed(() => {
|
|
8561
|
+
const sort = props.sort;
|
|
8562
|
+
const code = locale.value.code;
|
|
8563
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
8564
|
+
return (list) => {
|
|
8565
|
+
let sorted = cache.get(list);
|
|
8566
|
+
if (!sorted) {
|
|
8567
|
+
sorted = sortTreeNodes(list, sort, code);
|
|
8568
|
+
cache.set(list, sorted);
|
|
8569
|
+
}
|
|
8570
|
+
return sorted;
|
|
8571
|
+
};
|
|
8572
|
+
});
|
|
8573
|
+
const children = (node) => {
|
|
8574
|
+
const own = raw(node);
|
|
8575
|
+
return own && order.value(own);
|
|
8576
|
+
};
|
|
8577
|
+
const rows = computed(() => visibleRows(order.value(props.nodes), expandedSet.value, children));
|
|
8026
8578
|
const rowIndex = computed(() => new Map(rows.value.map((row, index) => [row.node.id, index])));
|
|
8579
|
+
async function loadChildren(node) {
|
|
8580
|
+
loading.add(node.id);
|
|
8581
|
+
try {
|
|
8582
|
+
const list = await props.load(node);
|
|
8583
|
+
loaded.set(node.id, list);
|
|
8584
|
+
if (checkedSet.value.has(node.id) && list.length) {
|
|
8585
|
+
const next = new Set(checkedSet.value);
|
|
8586
|
+
next.delete(node.id);
|
|
8587
|
+
list.filter((child) => !child.disabled).forEach((child) => next.add(child.id));
|
|
8588
|
+
setChecked(next);
|
|
8589
|
+
}
|
|
8590
|
+
return true;
|
|
8591
|
+
} catch (error) {
|
|
8592
|
+
emit("load-error", node, error);
|
|
8593
|
+
return false;
|
|
8594
|
+
} finally {
|
|
8595
|
+
loading.delete(node.id);
|
|
8596
|
+
}
|
|
8597
|
+
}
|
|
8027
8598
|
async function expand(row) {
|
|
8028
8599
|
const { node } = row;
|
|
8029
8600
|
if (!row.branch || row.expanded || loading.has(node.id)) {
|
|
8030
8601
|
return;
|
|
8031
8602
|
}
|
|
8032
8603
|
if (children(node) === void 0 && node.hasChildren) {
|
|
8033
|
-
if (!props.load) {
|
|
8034
|
-
return;
|
|
8035
|
-
}
|
|
8036
|
-
loading.add(node.id);
|
|
8037
|
-
try {
|
|
8038
|
-
const list = await props.load(node);
|
|
8039
|
-
loaded.set(node.id, list);
|
|
8040
|
-
if (checkedSet.value.has(node.id) && list.length) {
|
|
8041
|
-
const next = new Set(checkedSet.value);
|
|
8042
|
-
next.delete(node.id);
|
|
8043
|
-
list.filter((child) => !child.disabled).forEach((child) => next.add(child.id));
|
|
8044
|
-
setChecked(next);
|
|
8045
|
-
}
|
|
8046
|
-
} catch (error) {
|
|
8047
|
-
emit("load-error", node, error);
|
|
8604
|
+
if (!props.load || !await loadChildren(node)) {
|
|
8048
8605
|
return;
|
|
8049
|
-
} finally {
|
|
8050
|
-
loading.delete(node.id);
|
|
8051
8606
|
}
|
|
8052
8607
|
}
|
|
8053
8608
|
setExpanded(/* @__PURE__ */ new Set([...expandedSet.value, node.id]));
|
|
8054
8609
|
}
|
|
8610
|
+
watch(
|
|
8611
|
+
rows,
|
|
8612
|
+
(list) => {
|
|
8613
|
+
if (!props.load) {
|
|
8614
|
+
return;
|
|
8615
|
+
}
|
|
8616
|
+
for (const row of list) {
|
|
8617
|
+
const { node } = row;
|
|
8618
|
+
if (row.expanded && node.hasChildren && raw(node) === void 0 && !loading.has(node.id)) {
|
|
8619
|
+
void loadChildren(node).then((ok) => {
|
|
8620
|
+
if (!ok && expandedSet.value.has(node.id)) {
|
|
8621
|
+
const next = new Set(expandedSet.value);
|
|
8622
|
+
next.delete(node.id);
|
|
8623
|
+
setExpanded(next);
|
|
8624
|
+
}
|
|
8625
|
+
});
|
|
8626
|
+
}
|
|
8627
|
+
}
|
|
8628
|
+
},
|
|
8629
|
+
{ immediate: true }
|
|
8630
|
+
);
|
|
8055
8631
|
function collapse(row) {
|
|
8056
8632
|
const focused = rows.value[current2.value];
|
|
8057
8633
|
const focusInside = Boolean(focused && isInside(focused, row.node.id));
|
|
@@ -8110,6 +8686,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8110
8686
|
};
|
|
8111
8687
|
const treeId = useId();
|
|
8112
8688
|
const rowRefs = ref([]);
|
|
8689
|
+
const treeRef = ref(null);
|
|
8113
8690
|
const current2 = ref(0);
|
|
8114
8691
|
const rowDomId = (row) => `${treeId}-${row.node.id}`;
|
|
8115
8692
|
watch(
|
|
@@ -8137,6 +8714,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8137
8714
|
return;
|
|
8138
8715
|
}
|
|
8139
8716
|
current2.value = index;
|
|
8717
|
+
if (onMenuKey(event, row, index) || moveRows.onKeydown(event, index)) {
|
|
8718
|
+
return;
|
|
8719
|
+
}
|
|
8140
8720
|
if (event.key === "*") {
|
|
8141
8721
|
event.preventDefault();
|
|
8142
8722
|
rows.value.filter((other) => other.parentId === row.parentId && other.branch && !other.expanded).forEach((other) => void expand(other));
|
|
@@ -8162,11 +8742,10 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8162
8742
|
}
|
|
8163
8743
|
if (event.key === "Enter") {
|
|
8164
8744
|
event.preventDefault();
|
|
8165
|
-
if (props.selection
|
|
8166
|
-
toggle(row);
|
|
8167
|
-
} else {
|
|
8745
|
+
if (props.selection !== "none") {
|
|
8168
8746
|
pick(row);
|
|
8169
8747
|
}
|
|
8748
|
+
activateRow(row);
|
|
8170
8749
|
return;
|
|
8171
8750
|
}
|
|
8172
8751
|
if (event.key === " " && !event.target.closest(".tao-tree__actions")) {
|
|
@@ -8182,7 +8761,32 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8182
8761
|
}
|
|
8183
8762
|
nav.onKeydown(event);
|
|
8184
8763
|
}
|
|
8764
|
+
function activateRow(row) {
|
|
8765
|
+
if (row.node.disabled) {
|
|
8766
|
+
return;
|
|
8767
|
+
}
|
|
8768
|
+
if (row.branch) {
|
|
8769
|
+
toggle(row);
|
|
8770
|
+
} else {
|
|
8771
|
+
emit("open", row.node);
|
|
8772
|
+
}
|
|
8773
|
+
}
|
|
8774
|
+
function onRowDblClick(row) {
|
|
8775
|
+
if (row.node.disabled) {
|
|
8776
|
+
return;
|
|
8777
|
+
}
|
|
8778
|
+
if (props.selection === "multiple" && !selectedSet.value.has(row.node.id)) {
|
|
8779
|
+
setSelected([...selectedSet.value, row.node.id]);
|
|
8780
|
+
}
|
|
8781
|
+
if (props.selection === "none" && row.branch) {
|
|
8782
|
+
return;
|
|
8783
|
+
}
|
|
8784
|
+
activateRow(row);
|
|
8785
|
+
}
|
|
8185
8786
|
function onRowClick(row, index) {
|
|
8787
|
+
if (moveRows.swallowClick()) {
|
|
8788
|
+
return;
|
|
8789
|
+
}
|
|
8186
8790
|
current2.value = index;
|
|
8187
8791
|
if (props.selection === "none") {
|
|
8188
8792
|
if (row.branch) {
|
|
@@ -8192,6 +8796,160 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8192
8796
|
}
|
|
8193
8797
|
pick(row);
|
|
8194
8798
|
}
|
|
8799
|
+
const menuOpen = ref(false);
|
|
8800
|
+
const menuAnchor = ref(null);
|
|
8801
|
+
const menuItems = shallowRef([]);
|
|
8802
|
+
const menuNode = shallowRef(null);
|
|
8803
|
+
const menuIds = ref([]);
|
|
8804
|
+
let keyMenuAt = -Infinity;
|
|
8805
|
+
function rowAnchor(index) {
|
|
8806
|
+
const el = rowRefs.value[index];
|
|
8807
|
+
if (!el) {
|
|
8808
|
+
return null;
|
|
8809
|
+
}
|
|
8810
|
+
const box = el.getBoundingClientRect();
|
|
8811
|
+
const label = el.querySelector(".tao-tree__label")?.getBoundingClientRect();
|
|
8812
|
+
return { x: label ? label.left : box.left, y: box.top, width: 0, height: box.height };
|
|
8813
|
+
}
|
|
8814
|
+
function openMenu(row, index, anchor) {
|
|
8815
|
+
if (!props.menu || !anchor) {
|
|
8816
|
+
return false;
|
|
8817
|
+
}
|
|
8818
|
+
const change = menuSelection(props.selection, selectedSet.value, row.node);
|
|
8819
|
+
const ids = change !== void 0 ? [row.node.id] : selectedSet.value.has(row.node.id) ? [...selectedSet.value] : [row.node.id];
|
|
8820
|
+
const items = typeof props.menu === "function" ? props.menu(row.node, ids) : props.menu;
|
|
8821
|
+
if (!items.length) {
|
|
8822
|
+
return false;
|
|
8823
|
+
}
|
|
8824
|
+
if (change !== void 0) {
|
|
8825
|
+
setSelected(change);
|
|
8826
|
+
}
|
|
8827
|
+
current2.value = index;
|
|
8828
|
+
menuNode.value = row.node;
|
|
8829
|
+
menuIds.value = ids;
|
|
8830
|
+
menuItems.value = items;
|
|
8831
|
+
menuAnchor.value = anchor;
|
|
8832
|
+
menuOpen.value = false;
|
|
8833
|
+
void nextTick(() => menuOpen.value = true);
|
|
8834
|
+
return true;
|
|
8835
|
+
}
|
|
8836
|
+
function onRowContextMenu(event, row, index) {
|
|
8837
|
+
if (performance.now() - keyMenuAt < 500) {
|
|
8838
|
+
event.preventDefault();
|
|
8839
|
+
return;
|
|
8840
|
+
}
|
|
8841
|
+
emit("menu", row.node, event);
|
|
8842
|
+
if (event.defaultPrevented) {
|
|
8843
|
+
return;
|
|
8844
|
+
}
|
|
8845
|
+
const fromKeyboard = event.clientX === 0 && event.clientY === 0;
|
|
8846
|
+
const anchor = fromKeyboard ? rowAnchor(index) : { x: event.clientX, y: event.clientY };
|
|
8847
|
+
if (openMenu(row, index, anchor)) {
|
|
8848
|
+
event.preventDefault();
|
|
8849
|
+
}
|
|
8850
|
+
}
|
|
8851
|
+
function onMenuKey(event, row, index) {
|
|
8852
|
+
if (!props.menu || !(event.key === "ContextMenu" || event.key === "F10" && event.shiftKey)) {
|
|
8853
|
+
return false;
|
|
8854
|
+
}
|
|
8855
|
+
emit("menu", row.node, event);
|
|
8856
|
+
if (!event.defaultPrevented && !openMenu(row, index, rowAnchor(index))) {
|
|
8857
|
+
return false;
|
|
8858
|
+
}
|
|
8859
|
+
event.preventDefault();
|
|
8860
|
+
keyMenuAt = performance.now();
|
|
8861
|
+
return true;
|
|
8862
|
+
}
|
|
8863
|
+
function onMenuSelect(id) {
|
|
8864
|
+
if (menuNode.value) {
|
|
8865
|
+
emit("menu-select", id, menuNode.value, menuIds.value);
|
|
8866
|
+
}
|
|
8867
|
+
}
|
|
8868
|
+
function onMenuClose() {
|
|
8869
|
+
menuOpen.value = false;
|
|
8870
|
+
}
|
|
8871
|
+
const known = computed(() => {
|
|
8872
|
+
const parent = /* @__PURE__ */ new Map();
|
|
8873
|
+
const kids = /* @__PURE__ */ new Map();
|
|
8874
|
+
const byId = /* @__PURE__ */ new Map();
|
|
8875
|
+
const walk = (list, parentId) => {
|
|
8876
|
+
kids.set(
|
|
8877
|
+
parentId,
|
|
8878
|
+
list.map((node) => node.id)
|
|
8879
|
+
);
|
|
8880
|
+
for (const node of list) {
|
|
8881
|
+
if (byId.has(node.id)) {
|
|
8882
|
+
continue;
|
|
8883
|
+
}
|
|
8884
|
+
byId.set(node.id, node);
|
|
8885
|
+
parent.set(node.id, parentId);
|
|
8886
|
+
const own = children(node);
|
|
8887
|
+
if (own) {
|
|
8888
|
+
walk(own, node.id);
|
|
8889
|
+
}
|
|
8890
|
+
}
|
|
8891
|
+
};
|
|
8892
|
+
walk(order.value(props.nodes), null);
|
|
8893
|
+
return { parent, kids, byId };
|
|
8894
|
+
});
|
|
8895
|
+
async function reload(id) {
|
|
8896
|
+
const node = known.value.byId.get(id);
|
|
8897
|
+
if (!node || node.children || !loaded.has(id)) {
|
|
8898
|
+
return;
|
|
8899
|
+
}
|
|
8900
|
+
loaded.delete(id);
|
|
8901
|
+
if (!expandedSet.value.has(id) || !props.load) {
|
|
8902
|
+
return;
|
|
8903
|
+
}
|
|
8904
|
+
loading.add(id);
|
|
8905
|
+
try {
|
|
8906
|
+
loaded.set(id, await props.load(node));
|
|
8907
|
+
} catch (error) {
|
|
8908
|
+
emit("load-error", node, error);
|
|
8909
|
+
} finally {
|
|
8910
|
+
loading.delete(id);
|
|
8911
|
+
}
|
|
8912
|
+
}
|
|
8913
|
+
const canMove = computed(() => Boolean(props.onMove));
|
|
8914
|
+
const liveText = ref("");
|
|
8915
|
+
function announce(message) {
|
|
8916
|
+
liveText.value = "";
|
|
8917
|
+
void nextTick(() => liveText.value = message);
|
|
8918
|
+
}
|
|
8919
|
+
const moveRows = useTreeMove({
|
|
8920
|
+
root: treeRef,
|
|
8921
|
+
rows: () => rows.value,
|
|
8922
|
+
rowEl: (index) => rowRefs.value[index],
|
|
8923
|
+
enabled: () => canMove.value,
|
|
8924
|
+
movable: (node) => typeof props.movable === "function" ? props.movable(node) : props.movable,
|
|
8925
|
+
canDrop: (move) => props.canDrop?.(move) ?? true,
|
|
8926
|
+
selected: () => selectedSet.value,
|
|
8927
|
+
childIds: (id) => known.value.kids.get(id),
|
|
8928
|
+
parentOf: (id) => known.value.parent.get(id),
|
|
8929
|
+
node: (id) => known.value.byId.get(id),
|
|
8930
|
+
sorted: () => props.sort !== "none",
|
|
8931
|
+
expand: (row) => expand(row),
|
|
8932
|
+
move: (move) => props.onMove?.(move),
|
|
8933
|
+
moved: (move, from) => (/* @__PURE__ */ new Set([move.parentId, ...from])).forEach((id) => id !== null && void reload(id)),
|
|
8934
|
+
failed: (move, error) => emit("move-error", move, error),
|
|
8935
|
+
announce,
|
|
8936
|
+
texts: () => ({
|
|
8937
|
+
count: (count) => formatText(text("countLabel"), { count }),
|
|
8938
|
+
root: text("rootLabel"),
|
|
8939
|
+
cut: text("cutText"),
|
|
8940
|
+
copy: text("copyText"),
|
|
8941
|
+
moved: text("movedText"),
|
|
8942
|
+
copied: text("copiedText"),
|
|
8943
|
+
canceled: text("canceledText"),
|
|
8944
|
+
refused: text("refusedText")
|
|
8945
|
+
})
|
|
8946
|
+
});
|
|
8947
|
+
const { dragging, refused, ghost, pending, clipboard } = moveRows;
|
|
8948
|
+
const isCut = (id) => Boolean(clipboard.value && !clipboard.value.copy && clipboard.value.ids.includes(id));
|
|
8949
|
+
const dropClass = (row) => {
|
|
8950
|
+
const mark = moveRows.drop.value?.mark;
|
|
8951
|
+
return mark && mark.rowId === row.node.id ? `tao-tree__row--drop-${mark.side}` : void 0;
|
|
8952
|
+
};
|
|
8195
8953
|
const slotProps = (row) => ({
|
|
8196
8954
|
node: row.node,
|
|
8197
8955
|
level: row.level,
|
|
@@ -8200,7 +8958,17 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8200
8958
|
});
|
|
8201
8959
|
return (_ctx, _cache) => {
|
|
8202
8960
|
return openBlock(), createElementBlock("ul", {
|
|
8203
|
-
|
|
8961
|
+
ref_key: "treeRef",
|
|
8962
|
+
ref: treeRef,
|
|
8963
|
+
class: normalizeClass(["tao-tree", [
|
|
8964
|
+
unref(sizeClass)(__props.size),
|
|
8965
|
+
{
|
|
8966
|
+
"tao-tree--menu-open": menuOpen.value,
|
|
8967
|
+
"tao-tree--dragging": unref(dragging).size > 0,
|
|
8968
|
+
"tao-tree--refused": unref(refused),
|
|
8969
|
+
"tao-tree--drop-root": unref(moveRows).drop.value?.mark.rowId === ""
|
|
8970
|
+
}
|
|
8971
|
+
]]),
|
|
8204
8972
|
role: "tree",
|
|
8205
8973
|
"aria-label": unref(l10n).ariaLabel,
|
|
8206
8974
|
"aria-multiselectable": __props.selection === "multiple" || void 0
|
|
@@ -8211,10 +8979,18 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8211
8979
|
key: row.node.id,
|
|
8212
8980
|
ref_for: true,
|
|
8213
8981
|
ref: (el) => rowRefs.value[index] = el,
|
|
8214
|
-
class: normalizeClass(["tao-tree__row",
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8982
|
+
class: normalizeClass(["tao-tree__row", [
|
|
8983
|
+
row.node.tone && `tao-tree__row--toned tao-tree__row--${row.node.tone}`,
|
|
8984
|
+
dropClass(row),
|
|
8985
|
+
{
|
|
8986
|
+
"tao-tree__row--selected": selectedSet.value.has(row.node.id),
|
|
8987
|
+
"tao-tree__row--disabled": row.node.disabled,
|
|
8988
|
+
"tao-tree__row--menu": menuOpen.value && menuNode.value?.id === row.node.id,
|
|
8989
|
+
"tao-tree__row--dragged": unref(dragging).has(row.node.id),
|
|
8990
|
+
"tao-tree__row--pending": unref(pending).has(row.node.id),
|
|
8991
|
+
"tao-tree__row--cut": isCut(row.node.id)
|
|
8992
|
+
}
|
|
8993
|
+
]]),
|
|
8218
8994
|
role: "treeitem",
|
|
8219
8995
|
tabindex: current2.value === index ? 0 : -1,
|
|
8220
8996
|
"aria-level": row.level,
|
|
@@ -8224,10 +9000,13 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8224
9000
|
"aria-selected": __props.selection === "none" ? void 0 : selectedSet.value.has(row.node.id),
|
|
8225
9001
|
"aria-checked": __props.checkable ? ariaChecked(row) : void 0,
|
|
8226
9002
|
"aria-disabled": row.node.disabled || void 0,
|
|
8227
|
-
"aria-busy": unref(loading).has(row.node.id) || void 0,
|
|
8228
|
-
style: normalizeStyle({ "--_level": row.level - 1 }),
|
|
9003
|
+
"aria-busy": unref(loading).has(row.node.id) || unref(pending).has(row.node.id) || void 0,
|
|
9004
|
+
style: normalizeStyle({ "--_level": row.level - 1, "--_drop-level": (unref(moveRows).drop.value?.mark.level ?? 1) - 1 }),
|
|
8229
9005
|
onKeydown: ($event) => onKeydown2($event, index),
|
|
9006
|
+
onPointerdown: ($event) => unref(moveRows).onPointerDown($event, index),
|
|
8230
9007
|
onClick: ($event) => onRowClick(row, index),
|
|
9008
|
+
onDblclick: ($event) => onRowDblClick(row),
|
|
9009
|
+
onContextmenu: ($event) => onRowContextMenu($event, row, index),
|
|
8231
9010
|
onFocus: ($event) => current2.value = index
|
|
8232
9011
|
}, [
|
|
8233
9012
|
(openBlock(true), createElementBlock(Fragment, null, renderList(row.level - 1, (n) => {
|
|
@@ -8240,7 +9019,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8240
9019
|
createElementVNode("span", {
|
|
8241
9020
|
class: normalizeClass(["tao-tree__toggle", { "tao-tree__toggle--open": row.expanded }]),
|
|
8242
9021
|
"aria-hidden": "true",
|
|
8243
|
-
onClick: withModifiers(($event) => row.branch && toggle(row), ["stop"])
|
|
9022
|
+
onClick: withModifiers(($event) => row.branch && toggle(row), ["stop"]),
|
|
9023
|
+
onDblclick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
9024
|
+
}, ["stop"]))
|
|
8244
9025
|
}, [
|
|
8245
9026
|
unref(loading).has(row.node.id) ? (openBlock(), createElementBlock("span", {
|
|
8246
9027
|
key: 0,
|
|
@@ -8250,13 +9031,15 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8250
9031
|
key: 1,
|
|
8251
9032
|
name: "tao-chevron-right"
|
|
8252
9033
|
})) : createCommentVNode("", true)
|
|
8253
|
-
],
|
|
9034
|
+
], 42, _hoisted_3$r),
|
|
8254
9035
|
__props.checkable ? (openBlock(), createElementBlock("span", {
|
|
8255
9036
|
key: 0,
|
|
8256
9037
|
class: normalizeClass(["tao-tree__check", `tao-tree__check--${stateOf(row)}`]),
|
|
8257
9038
|
"aria-hidden": "true",
|
|
8258
|
-
onClick: withModifiers(($event) => check(row), ["stop"])
|
|
8259
|
-
|
|
9039
|
+
onClick: withModifiers(($event) => check(row), ["stop"]),
|
|
9040
|
+
onDblclick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
9041
|
+
}, ["stop"]))
|
|
9042
|
+
}, null, 42, _hoisted_5$k)) : createCommentVNode("", true),
|
|
8260
9043
|
_ctx.$slots.icon || row.node.icon ? (openBlock(), createElementBlock("span", _hoisted_6$f, [
|
|
8261
9044
|
renderSlot(_ctx.$slots, "icon", mergeProps({ ref_for: true }, slotProps(row)), () => [
|
|
8262
9045
|
createVNode(TaoIcon, {
|
|
@@ -8269,23 +9052,54 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
8269
9052
|
createTextVNode(toDisplayString(row.node.label), 1)
|
|
8270
9053
|
], true)
|
|
8271
9054
|
]),
|
|
9055
|
+
row.node.hint ? (openBlock(), createElementBlock("span", _hoisted_8$8, [
|
|
9056
|
+
_cache[5] || (_cache[5] = createElementVNode("span", { class: "tao-sr-only" }, ", ", -1)),
|
|
9057
|
+
createTextVNode(toDisplayString(row.node.hint), 1)
|
|
9058
|
+
])) : createCommentVNode("", true),
|
|
8272
9059
|
_ctx.$slots.actions ? (openBlock(), createElementBlock("span", {
|
|
8273
|
-
key:
|
|
9060
|
+
key: 3,
|
|
8274
9061
|
class: "tao-tree__actions",
|
|
8275
|
-
onClick: _cache[
|
|
9062
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
8276
9063
|
}, ["stop"])),
|
|
8277
|
-
|
|
9064
|
+
onDblclick: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
9065
|
+
}, ["stop"])),
|
|
9066
|
+
onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
|
|
8278
9067
|
}, ["stop"]))
|
|
8279
9068
|
}, [
|
|
8280
9069
|
renderSlot(_ctx.$slots, "actions", mergeProps({ ref_for: true }, slotProps(row)), void 0, true)
|
|
8281
9070
|
], 32)) : createCommentVNode("", true)
|
|
8282
9071
|
], 46, _hoisted_2$x);
|
|
8283
|
-
}), 128))
|
|
9072
|
+
}), 128)),
|
|
9073
|
+
__props.menu ? (openBlock(), createBlock(_sfc_main$16, {
|
|
9074
|
+
key: 0,
|
|
9075
|
+
items: menuItems.value,
|
|
9076
|
+
open: menuOpen.value,
|
|
9077
|
+
anchor: menuAnchor.value,
|
|
9078
|
+
label: text("menuLabel"),
|
|
9079
|
+
"close-on-scroll": "",
|
|
9080
|
+
onSelect: onMenuSelect,
|
|
9081
|
+
onClose: onMenuClose
|
|
9082
|
+
}, null, 8, ["items", "open", "anchor", "label"])) : createCommentVNode("", true),
|
|
9083
|
+
canMove.value ? (openBlock(), createBlock(Teleport, {
|
|
9084
|
+
key: 1,
|
|
9085
|
+
to: "body"
|
|
9086
|
+
}, [
|
|
9087
|
+
unref(ghost) ? (openBlock(), createElementBlock("div", {
|
|
9088
|
+
key: 0,
|
|
9089
|
+
class: normalizeClass(["tao-tree__ghost", unref(sizeClass)(__props.size)]),
|
|
9090
|
+
"aria-hidden": "true",
|
|
9091
|
+
style: normalizeStyle({ left: `${unref(ghost).x + 14}px`, top: `${unref(ghost).y + 10}px` })
|
|
9092
|
+
}, [
|
|
9093
|
+
unref(ghost).copy ? (openBlock(), createElementBlock("span", _hoisted_9$7, "+")) : createCommentVNode("", true),
|
|
9094
|
+
createTextVNode(toDisplayString(unref(ghost).text), 1)
|
|
9095
|
+
], 6)) : createCommentVNode("", true),
|
|
9096
|
+
createElementVNode("div", _hoisted_10$4, toDisplayString(liveText.value), 1)
|
|
9097
|
+
])) : createCommentVNode("", true)
|
|
8284
9098
|
], 10, _hoisted_1$B);
|
|
8285
9099
|
};
|
|
8286
9100
|
}
|
|
8287
9101
|
});
|
|
8288
|
-
const TaoTree = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-
|
|
9102
|
+
const TaoTree = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-847c4220"]]);
|
|
8289
9103
|
const _hoisted_1$A = ["id", "disabled", "aria-describedby", "aria-invalid", "aria-labelledby"];
|
|
8290
9104
|
const _hoisted_2$w = {
|
|
8291
9105
|
key: 0,
|
|
@@ -13271,7 +14085,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
13271
14085
|
};
|
|
13272
14086
|
}
|
|
13273
14087
|
});
|
|
13274
|
-
const TaoList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-
|
|
14088
|
+
const TaoList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-b29b5b48"]]);
|
|
13275
14089
|
const _hoisted_1$a = ["aria-current", "aria-disabled"];
|
|
13276
14090
|
const _hoisted_2$8 = {
|
|
13277
14091
|
key: 0,
|
|
@@ -15812,6 +16626,7 @@ export {
|
|
|
15812
16626
|
applyTaoMode,
|
|
15813
16627
|
applyTaoPalette,
|
|
15814
16628
|
colorModel,
|
|
16629
|
+
compareTreeNodes,
|
|
15815
16630
|
confirm,
|
|
15816
16631
|
contrastRatio,
|
|
15817
16632
|
TaoUI as default,
|
|
@@ -15831,6 +16646,7 @@ export {
|
|
|
15831
16646
|
menuReturnsFocus,
|
|
15832
16647
|
mergeRanges,
|
|
15833
16648
|
moveTarget,
|
|
16649
|
+
moveTreeNodes,
|
|
15834
16650
|
normalizeHex,
|
|
15835
16651
|
parseAcceptLanguage,
|
|
15836
16652
|
parseColor,
|