@pantograph/vue 0.30.7 → 0.30.9

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.
Files changed (46) hide show
  1. package/dist/ActionButton/ActionButton.d.ts +6 -6
  2. package/dist/Base/BaseButton/BaseButton.d.ts +1 -1
  3. package/dist/Button/Button.d.ts +6 -6
  4. package/dist/Chip/Chip.d.ts +1 -1
  5. package/dist/ChipGroup/ChipGroup.d.ts +1 -1
  6. package/dist/Combobox/Combobox.d.ts +18 -18
  7. package/dist/Combobox/index.js +95 -95
  8. package/dist/Combobox/index.umd.cjs +1 -1
  9. package/dist/Comment/CommentActions.d.ts +8 -8
  10. package/dist/Comment/CommentEditor.d.ts +16 -16
  11. package/dist/Comment/CommentMention.d.ts +34 -34
  12. package/dist/Comment/CommentReactions.d.ts +4 -4
  13. package/dist/Comment/index.js +2 -0
  14. package/dist/Comment/index.umd.cjs +1 -1
  15. package/dist/DataTable/DataTable.d.ts +7 -1
  16. package/dist/DataTable/components/DataTableHeaderCell.d.ts +6 -6
  17. package/dist/DataTable/index.js +908 -882
  18. package/dist/DataTable/index.umd.cjs +1 -1
  19. package/dist/DataTable/types/index.d.ts +6 -0
  20. package/dist/DataTable/utils/index.d.ts +1 -0
  21. package/dist/DataTable/utils/useCol.d.ts +1 -2
  22. package/dist/DataTable/utils/useRow.d.ts +9 -0
  23. package/dist/FloatButton/FloatButton.d.ts +6 -6
  24. package/dist/Form/Form.d.ts +1 -1
  25. package/dist/GOPicker/GOPicker.d.ts +4 -110
  26. package/dist/GOPicker/GOPicker.model.d.ts +26 -1
  27. package/dist/GOPicker/index.js +210 -185
  28. package/dist/GOPicker/index.umd.cjs +1 -1
  29. package/dist/IconButton/IconButton.d.ts +6 -6
  30. package/dist/Progress/Progress.d.ts +1 -1
  31. package/dist/Tree/Tree.d.ts +7 -6
  32. package/dist/Tree/Tree.model.d.ts +1 -1
  33. package/dist/Tree/index.js +1 -1
  34. package/dist/Tree/index.umd.cjs +1 -1
  35. package/dist/Tree/utils.d.ts +1 -1
  36. package/dist/Upload/Upload.d.ts +1 -1
  37. package/dist/index-CUuaEiq_.js +1 -0
  38. package/dist/index-_lrD3ofV.js +741 -0
  39. package/dist/index.js +1 -1
  40. package/dist/index.umd.cjs +1 -1
  41. package/dist/style/index.css +1 -1
  42. package/dist/use/index.js +2 -2
  43. package/dist/use/index.umd.cjs +1 -1
  44. package/package.json +2 -2
  45. package/dist/index-DBiL8Htz.js +0 -1
  46. package/dist/index-Y3XMSR_o.js +0 -740
@@ -0,0 +1,741 @@
1
+ import { defineComponent as ke, useAttrs as Qe, useSlots as Re, computed as m, createBlock as Ve, openBlock as Ie, h as R, unref as re, createElementBlock as Xe, Fragment as Ye, createVNode as Ze, createElementVNode as et, normalizeClass as tt, watch as be, ref as ie, onMounted as at, onBeforeUnmount as rt, shallowRef as lt, render as ot } from "vue";
2
+ import { getComponentOptions as Ae, generateVariantClassList as H, getBemElement as M, normCls as Le, sortPlaceholderVariantsClass as nt, getBemBlock as st, createOptionGetterFunc as F, getBemModifier as it, usePCId as ct, sortPlaceholderCls as dt, getComponentName as Ee } from "@pantograph/utils";
3
+ import { createContext as ut, RovingFocusItem as gt, RovingFocusGroup as pt } from "reka-ui";
4
+ import { cva as De } from "class-variance-authority";
5
+ import { isString as ft, uniq as _e, flattenDeep as ht, last as pe, cloneDeep as Oe, isEqual as Ke, omit as yt, isFunction as Ne } from "es-toolkit";
6
+ import mt from "@pantograph/sortable";
7
+ import { isEmptyElement as $e, useVModel as vt, useFormInput as bt, useVirtualScroll as _t, installComponent as Fe } from "@pantograph/utils-vue";
8
+ import { _ as Me } from "./IndentLevel.vue_vue_type_style_index_0_lang-CkvTqlkt.js";
9
+ import { _ as kt } from "./Icon.vue_vue_type_style_index_0_lang-CD9EvvB5.js";
10
+ import { _ as It } from "./Checkbox.vue_vue_type_style_index_0_lang-D-7D_c_A.js";
11
+ import { useConfig as St } from "./ConfigProvider/index.js";
12
+ import { _ as Ct } from "./ScrollContainer.vue_vue_type_style_index_0_lang-CRjnv1ii.js";
13
+ import { i as xt } from "./isArray-QlWcxgml.js";
14
+ import "./IndentLevel/index.js";
15
+ import { a as Pe } from "./index-D2tZoezA.js";
16
+ const Bt = ["sm", "md", "lg"], ze = { none: "gap-none", sm: "gap-sm", md: "gap-md", lg: "gap-lg" }, [wt, Tt] = ut("Tree"), Ge = /* @__PURE__ */ ke({
17
+ ...Ae("TreeNode"),
18
+ __name: "TreeNode",
19
+ props: {
20
+ node: {}
21
+ },
22
+ setup(V) {
23
+ const s = V, G = Qe(), e = Re(), a = wt(), P = De(a.prefixes.node, {
24
+ variants: {
25
+ disabled: H("disabled", a.prefixes.node),
26
+ active: H("active", a.prefixes.node)
27
+ }
28
+ }), v = (o) => a.getNodeChildren(o, !0, !1), K = m(() => v(s.node)), j = m(() => a.props.draggable ? s.node._draggable ?? !0 : !1), f = m(() => !!(a.disabled.value || s.node._disabled)), I = m(() => s.node._dragging ?? !1), k = m(
29
+ () => !I.value && (a.expandedKeys.value ?? []).includes(s.node._key)
30
+ ), S = m(() => !I.value && !a.dragging.value && a.props.showLine ? U.value ? "all" : "before" : !1), J = m(() => a.getIsSelected(s.node)), L = m(() => a.getIsChecked(s.node)), x = (o) => a.onCheck(s.node, !!o), B = m(() => a.getLevel(s.node)), U = m(
31
+ () => {
32
+ var o, c;
33
+ return !!((o = K.value) != null && o.length || (c = a.props) != null && c.lazyLoad && !s.node._leaf);
34
+ }
35
+ ), Q = m(() => ({
36
+ ...s.node,
37
+ selected: J.value,
38
+ checked: L.value,
39
+ disabled: f.value,
40
+ expanded: k.value,
41
+ unFocusable: !0
42
+ })), r = () => {
43
+ f.value || a.onSelect(s.node, !J.value);
44
+ }, i = () => {
45
+ const o = () => {
46
+ var N, y, X, E, C, Y, w, A;
47
+ const c = [];
48
+ if ((N = a.props) != null && N.draggable) {
49
+ let g = null;
50
+ a.dragging.value || (g = R(kt, {
51
+ icon: "tabler:grip-vertical",
52
+ size: a.iconSize.value,
53
+ class: a.prefixes.draggableIcon
54
+ })), c.push(R("span", { class: a.prefixes.draggable }, g));
55
+ }
56
+ c.push(
57
+ R(
58
+ Me,
59
+ {
60
+ level: B.value,
61
+ children: U.value,
62
+ size: a.indentSize.value,
63
+ expanded: k.value,
64
+ showLine: S.value,
65
+ dir: a.props.dir,
66
+ class: M(a.prefixes.node, "indent"),
67
+ loading: s.node._loading,
68
+ "branch-icon": s.node._switcherIcon ?? ((y = a.props) == null ? void 0 : y.switcherIcon),
69
+ "no-rotate-branch": s.node._noRotateSwitcherIcon ?? ((X = a.props) == null ? void 0 : X.noRotateSwitcherIcon),
70
+ onToggleExpand: (g) => {
71
+ g.stopPropagation(), a.onExpandKey(s.node);
72
+ }
73
+ },
74
+ () => {
75
+ var g;
76
+ return [(g = e.switcherIcon) == null ? void 0 : g.call(e, Q.value)];
77
+ }
78
+ )
79
+ ), (E = a.props) != null && E.checkable && c.push(
80
+ R(It, {
81
+ unExtendParent: !0,
82
+ size: a.iconSize.value,
83
+ modelValue: L.value,
84
+ "onUpdate:modelValue": x,
85
+ disabled: f.value,
86
+ onClick: (g) => g.stopPropagation()
87
+ })
88
+ );
89
+ const h = (C = e.default) == null ? void 0 : C.call(e, Q.value);
90
+ return $e(h) ? c.push(
91
+ R("div", { class: M(a.prefixes.node, "title") }, s.node._title)
92
+ ) : c.push(h), R(
93
+ "div",
94
+ {
95
+ ...G,
96
+ "data-key": (Y = a.props) != null && Y.draggable ? s.node._key : void 0,
97
+ "data-level": (w = a.props) != null && w.draggable ? B.value : void 0,
98
+ "data-draggable": (A = a.props) != null && A.draggable ? !f.value && j.value : void 0,
99
+ class: Le(
100
+ P({
101
+ disabled: f.value,
102
+ active: J.value
103
+ }),
104
+ s.node.class ?? ""
105
+ ),
106
+ onClick: r
107
+ },
108
+ c
109
+ );
110
+ };
111
+ return a.props.focusable ? R(
112
+ gt,
113
+ {
114
+ asChild: !0,
115
+ tabStopId: s.node._key
116
+ },
117
+ o
118
+ ) : o();
119
+ };
120
+ return (o, c) => (Ie(), Ve(i));
121
+ }
122
+ }), oe = (V) => ft(V);
123
+ function Kt({
124
+ getValue: V,
125
+ getDisabled: s,
126
+ arr: G,
127
+ getChildren: e,
128
+ getExtra: a,
129
+ allowNoValidKey: P
130
+ }) {
131
+ const v = [], K = (j, f) => {
132
+ j.forEach((I) => {
133
+ const k = e(I, f), S = V(I, f, k);
134
+ if (oe(S) || P != null && P(I, f, k))
135
+ v.push({
136
+ ...typeof I == "object" ? I : { _item: I },
137
+ _parentKeys: f,
138
+ _key: S,
139
+ _disabled: !!s(I),
140
+ _hasChildren: !!(k != null && k.length),
141
+ ...(a == null ? void 0 : a(I)) ?? {}
142
+ }), k != null && k.length && K(k, [...f ?? [], S]);
143
+ else
144
+ throw "every node must provide a valid key";
145
+ });
146
+ };
147
+ return K(G), v;
148
+ }
149
+ const Nt = ({
150
+ getData: V,
151
+ getExpandedKeys: s,
152
+ getValue: G,
153
+ getDisabled: e,
154
+ getChildren: a,
155
+ isFlatten: P,
156
+ getExtra: v
157
+ }) => {
158
+ const K = m(
159
+ () => P ? re(V()) : Kt({
160
+ arr: re(V()),
161
+ getChildren: a,
162
+ getValue: G,
163
+ getDisabled: e,
164
+ getExtra: v
165
+ })
166
+ ), j = m(() => {
167
+ const r = re(s()) ?? [];
168
+ return K.value.filter(
169
+ (i) => {
170
+ var o, c;
171
+ return !i._parentKeys || ((c = (o = i._parentKeys) == null ? void 0 : o.every) == null ? void 0 : c.call(o, (h) => r.includes(h)));
172
+ }
173
+ );
174
+ }), f = (r, i = !1, o = !0) => {
175
+ const c = r == null ? void 0 : r._key;
176
+ return !oe(c) || !r ? [] : K.value.filter((h) => {
177
+ var N;
178
+ if (i) {
179
+ const y = pe(h._parentKeys ?? []);
180
+ return y && y === c;
181
+ }
182
+ return (N = h._parentKeys) == null ? void 0 : N.includes(c);
183
+ }).filter((h) => h && (!o || !(h != null && h._disabled)));
184
+ }, I = () => K.value.filter((r) => !r._parentKeys), k = (r) => r ? f(r, !0, !1) : I(), S = (r) => oe(r) ? K.value.find((i) => i._key === r) : void 0, J = (r) => {
185
+ const i = S(pe(r._parentKeys ?? []));
186
+ return k(i).findIndex((o) => o._key === r._key);
187
+ }, L = (r) => {
188
+ const i = re(r);
189
+ return i && xt(i) ? Oe(i) : [];
190
+ }, x = (r, i) => {
191
+ const o = f(r);
192
+ if (o != null && o.length)
193
+ return o.some((c) => U(c, i, !1) === !0);
194
+ }, B = (r, i) => {
195
+ const o = f(r);
196
+ return o != null && o.length ? o.every((c) => U(c, i, !1) === !0) : !1;
197
+ }, U = (r, i, o = !1) => {
198
+ const c = L(i), h = r == null ? void 0 : r._key;
199
+ if (!o && !r._disabled && !c.includes(h)) {
200
+ const N = f(r);
201
+ if (N != null && N.length)
202
+ return B(r, i) ? !0 : x(r, i) ? "indeterminate" : !1;
203
+ }
204
+ return c.includes(h);
205
+ };
206
+ return {
207
+ flattenData: K,
208
+ visibleFlattenData: j,
209
+ getNodeChildren: f,
210
+ getNodeByValue: S,
211
+ getNodeIndexInScope: J,
212
+ getChildrenOrRootNodes: k,
213
+ isSomeChildrenSelected: x,
214
+ isAllChildrenSelected: B,
215
+ isSelected: U,
216
+ getRootNodes: I,
217
+ selectValue: (r, i, o, c, h, N) => {
218
+ let y = L(o);
219
+ if (oe(r._key) && !r._disabled)
220
+ if (h) {
221
+ if (i ? y.push(r._key) : y = y.filter((X) => r._key !== X), !c) {
222
+ const E = f(r).map((b) => b._key), C = y.map(S).filter((b) => b && b._parentKeys);
223
+ i || C.push(r);
224
+ const w = _e(
225
+ ht(C.map((b) => b._parentKeys))
226
+ ).filter((b) => oe(b) && b !== r._key).filter(oe).map(S).filter(Boolean), A = [], g = [];
227
+ w.forEach((b) => {
228
+ const ce = b == null ? void 0 : b._key;
229
+ B(b, y) ? A.push(ce) : g.push(ce);
230
+ }), i ? A.push(...E) : g.push(...E), y.push(...A), y = y.filter((b) => !g.includes(b));
231
+ }
232
+ } else N === "replace" ? i && (y = [r._key]) : i ? y = [r._key] : y = [];
233
+ return _e(y);
234
+ }
235
+ };
236
+ }, Pt = /* @__PURE__ */ ke({
237
+ __name: "TreePlaceholder",
238
+ props: {
239
+ level: {},
240
+ size: {},
241
+ indentSize: {},
242
+ branchIcon: {},
243
+ children: { type: Boolean }
244
+ },
245
+ setup(V) {
246
+ return (s, G) => (Ie(), Xe(Ye, null, [
247
+ Ze(re(Me), {
248
+ level: s.level,
249
+ expanded: !1,
250
+ branchIcon: s.branchIcon,
251
+ children: s.children,
252
+ size: s.indentSize
253
+ }, null, 8, ["level", "branchIcon", "children", "size"]),
254
+ et("div", {
255
+ class: tt(re(nt)({ size: s.size }))
256
+ }, null, 2)
257
+ ], 64));
258
+ }
259
+ }), zt = /* @__PURE__ */ ke({
260
+ ...Ae("Tree"),
261
+ __name: "Tree",
262
+ props: {
263
+ selectionBehavior: { default: "toggle" },
264
+ class: {},
265
+ size: {},
266
+ gap: {},
267
+ dir: {},
268
+ data: {},
269
+ flattenData: { type: Boolean },
270
+ modelValue: {},
271
+ checkedKeys: {},
272
+ expandedKeys: {},
273
+ multiple: { type: Boolean },
274
+ checkable: { type: Boolean },
275
+ selectable: { type: Boolean },
276
+ defaultExpandAll: { type: Boolean },
277
+ showLine: { type: Boolean },
278
+ inlineNode: { type: Boolean },
279
+ lazyLoad: { type: Boolean },
280
+ getLoading: {},
281
+ getNoRotateSwitcherIcon: {},
282
+ getTitle: {},
283
+ getLeaf: {},
284
+ getDraggable: {},
285
+ getKey: {},
286
+ getSwitcherIcon: {},
287
+ getDisabled: {},
288
+ getChildren: {},
289
+ groupName: {},
290
+ sortableProps: {},
291
+ focusable: { type: Boolean, default: !0 },
292
+ checkStrictly: { type: Boolean, default: void 0 },
293
+ syncCheckboxAndSelect: { type: Boolean },
294
+ virtual: { type: [Boolean, Object] },
295
+ scrollContainerProps: {},
296
+ outerVirtualScroll: { type: Boolean },
297
+ switcherIcon: {},
298
+ noRotateSwitcherIcon: { type: Boolean },
299
+ draggable: { type: Boolean },
300
+ disabled: { type: Boolean, default: void 0 }
301
+ },
302
+ emits: ["update:modelValue", "update:expandedKeys", "update:checkedKeys", "change", "expand", "select", "check", "dragStart", "dragEnd", "choose", "unchoose"],
303
+ setup(V, { expose: s, emit: G }) {
304
+ const e = V, a = G, P = Re(), v = st("tree"), K = M(v, "node"), j = M(K, "group"), f = M(K, "draggable"), I = M(f, "icon"), k = M(j, "list"), S = {
305
+ node: K,
306
+ group: j,
307
+ draggable: f,
308
+ draggableIcon: I,
309
+ groupList: k
310
+ }, J = De(v, {
311
+ variants: {
312
+ size: H(Bt, v),
313
+ gap: H(ze, v),
314
+ selectable: H("selectable", v),
315
+ disabled: H("disabled", v),
316
+ inlineNode: H("inline-node", v),
317
+ dragging: H("dragging", v)
318
+ }
319
+ }), L = {
320
+ getLoading: F({
321
+ key: "loading",
322
+ getter: e.getLoading,
323
+ noReturnOption: !0
324
+ }),
325
+ getNoRotateSwitcherIcon: F({
326
+ key: "noRotateSwitcherIcon",
327
+ getter: e.getNoRotateSwitcherIcon,
328
+ noReturnOption: !0
329
+ }),
330
+ getTitle: F({
331
+ key: "title",
332
+ getter: e.getTitle,
333
+ noReturnOption: !0
334
+ }),
335
+ getLeaf: F({
336
+ key: "leaf",
337
+ getter: e.getLeaf,
338
+ noReturnOption: !0
339
+ }),
340
+ getDraggable: F({
341
+ key: "draggable",
342
+ getter: e.getDraggable,
343
+ noReturnOption: !0
344
+ }),
345
+ getKey: F({
346
+ key: "key",
347
+ getter: e.getKey,
348
+ noReturnOption: !0
349
+ }),
350
+ getSwitcherIcon: F({
351
+ key: "switcherIcon",
352
+ getter: e.getSwitcherIcon,
353
+ noReturnOption: !0
354
+ }),
355
+ getDisabled: F({
356
+ key: "disabled",
357
+ getter: e.getDisabled,
358
+ noReturnOption: !0
359
+ }),
360
+ getChildren: F({
361
+ key: "children",
362
+ getter: e.getChildren,
363
+ noReturnOption: !0
364
+ })
365
+ }, x = (t, n) => {
366
+ var D;
367
+ const u = `get${n[0].toUpperCase() + n.slice(1)}`;
368
+ return (D = L[u]) == null ? void 0 : D.call(L, t);
369
+ }, B = vt(
370
+ e,
371
+ "expandedKeys",
372
+ a,
373
+ {
374
+ defaultValue: [],
375
+ passive: e.expandedKeys === void 0
376
+ }
377
+ ), {
378
+ flattenData: U,
379
+ visibleFlattenData: Q,
380
+ getNodeByValue: r,
381
+ getChildrenOrRootNodes: i,
382
+ getNodeIndexInScope: o,
383
+ isSelected: c,
384
+ getNodeChildren: h,
385
+ selectValue: N,
386
+ getRootNodes: y
387
+ } = Nt({
388
+ isFlatten: e.flattenData,
389
+ getData: () => e.data,
390
+ getExpandedKeys: () => B,
391
+ getValue: (t) => x(t, "key"),
392
+ getDisabled: (t) => x(t, "disabled"),
393
+ getChildren: (t) => x(t, "children"),
394
+ getExtra: (t) => ({
395
+ _switcherIcon: x(t, "switcherIcon"),
396
+ _title: x(t, "title"),
397
+ _draggable: x(t, "draggable"),
398
+ _leaf: x(t, "leaf"),
399
+ _loading: x(t, "loading"),
400
+ _noRotateSwitcherIcon: x(t, "noRotateSwitcherIcon")
401
+ })
402
+ }), X = () => U.value.filter((t) => t == null ? void 0 : t._hasChildren).map((t) => t._key);
403
+ be(
404
+ () => e.defaultExpandAll,
405
+ (t, n) => {
406
+ t && !n && (B.value = X());
407
+ },
408
+ { immediate: !0 }
409
+ );
410
+ const E = ie(e.modelValue ?? []);
411
+ be(
412
+ () => e.modelValue,
413
+ () => {
414
+ E.value = e.modelValue ?? [], e.syncCheckboxAndSelect && (w.value = e.modelValue ?? []);
415
+ },
416
+ { deep: !0 }
417
+ );
418
+ const C = m({
419
+ get() {
420
+ return E.value;
421
+ },
422
+ set(t) {
423
+ t && (e.modelValue || (E.value = t), a("update:modelValue", t));
424
+ }
425
+ }), Y = ie(e.checkedKeys ?? []);
426
+ be(
427
+ () => e.checkedKeys,
428
+ () => {
429
+ Y.value = e.checkedKeys ?? [], e.syncCheckboxAndSelect && (C.value = e.checkedKeys ?? []);
430
+ },
431
+ { deep: !0 }
432
+ );
433
+ const w = m({
434
+ get() {
435
+ return Y.value;
436
+ },
437
+ set(t) {
438
+ e.checkedKeys || (Y.value = t), a("update:checkedKeys", t);
439
+ }
440
+ }), { getDisabled: A, getSize: g } = bt({
441
+ defaults: { size: "md" },
442
+ exports: ["getDisabled", "getSize"]
443
+ }), b = (t) => !!c(t, C, !0), ce = (t) => c(t, w, e.checkStrictly), Se = (t, n) => {
444
+ if (e.selectable && !A.value) {
445
+ const u = N(
446
+ t,
447
+ n,
448
+ C,
449
+ !!(e.syncCheckboxAndSelect ? e.checkStrictly : e.checkStrictly !== !1),
450
+ e.multiple,
451
+ e.selectionBehavior
452
+ );
453
+ Ke(u, C.value) || (C.value = u, a("select", t, n, u), a("change", { modelValue: C.value, checkedKeys: w.value }), e.syncCheckboxAndSelect && (w.value = u, a("check", t, n, u)));
454
+ }
455
+ }, je = (t, n) => {
456
+ if (e.checkable && !A.value) {
457
+ const u = N(t, n, w, !!e.checkStrictly, !0);
458
+ Ke(u, w.value) || (w.value = u, a("check", t, n, w.value), a("change", { modelValue: C.value, checkedKeys: w.value }), e.syncCheckboxAndSelect && (C.value = u, a("select", t, n, u)));
459
+ }
460
+ }, ne = (t) => {
461
+ let n = !0, u = Oe(B.value ?? []);
462
+ u.includes(t._key) ? (u = u.filter((D) => D !== t._key), n = !1) : (u = _e([...u, t._key]), n = !0), B.value = u, a("expand", t, n);
463
+ }, fe = m(() => {
464
+ if (e.gap) {
465
+ if (typeof e.gap == "number") return `${e.gap}px`;
466
+ if (!Object.keys(ze).includes(e.gap)) return e.gap;
467
+ }
468
+ }), de = ie(!1), { getDir: Ue } = St(), Z = Ue(), Ce = m(() => {
469
+ switch (g.value) {
470
+ case "sm":
471
+ return "2xsm";
472
+ case "lg":
473
+ return "sm";
474
+ default:
475
+ return "xsm";
476
+ }
477
+ }), qe = m(() => g.value === "sm" ? "2xsm" : "xsm"), xe = (t) => {
478
+ var n;
479
+ return (((n = t == null ? void 0 : t._parentKeys) == null ? void 0 : n.length) ?? 0) + 1;
480
+ }, he = ie(), Be = {
481
+ iconSize: qe,
482
+ disabled: A,
483
+ props: e,
484
+ expandedKeys: B,
485
+ model: C,
486
+ dir: Z,
487
+ checked: w,
488
+ onExpandKey: ne,
489
+ onSelect: Se,
490
+ onCheck: je,
491
+ scrollContainerRef: he,
492
+ getNodeChildren: h,
493
+ getNodeField: x,
494
+ getIsSelected: b,
495
+ getIsChecked: ce,
496
+ getLevel: xe,
497
+ dragging: de,
498
+ indentSize: Ce,
499
+ prefixes: S
500
+ };
501
+ Tt(Be);
502
+ const ye = ie();
503
+ if (e.draggable) {
504
+ let t, n;
505
+ const u = (p) => {
506
+ const d = p.getAttribute("data-key");
507
+ if (d) return r(d);
508
+ }, D = it(M(v, "dragging_item"), g.value), T = () => {
509
+ var p;
510
+ (p = t == null ? void 0 : t.destroy) == null || p.call(t), t = void 0;
511
+ };
512
+ at(async () => {
513
+ let p, d, q, W, O;
514
+ const ve = (l) => ({
515
+ ...l,
516
+ node: d,
517
+ oldParents: q,
518
+ newParents: W,
519
+ oldIndex: p,
520
+ oldDraggableIndex: p,
521
+ newIndex: O,
522
+ newDraggableIndex: O
523
+ }), Te = (l, te) => {
524
+ if (l) {
525
+ const z = () => {
526
+ const ge = xe(d), _ = !!(d != null && d._hasChildren);
527
+ return {
528
+ size: g.value,
529
+ level: ge,
530
+ children: _,
531
+ indentSize: Ce.value,
532
+ branchIcon: (d ? d._switcherIcon ?? (e == null ? void 0 : e.switcherIcon) : e == null ? void 0 : e.switcherIcon) ?? "tabler:chevron-left"
533
+ };
534
+ }, $ = document.createElement("div"), ae = l.getBoundingClientRect();
535
+ $.style.width = ae.width ? `${ae.width}px` : "100%", $.style.height = ae.height ? `${ae.height}px` : "100%", $.classList.add(M(v, dt));
536
+ const se = z();
537
+ return te && (se.level = te), ot(R(Pt, se), $), $;
538
+ }
539
+ };
540
+ t ? T() : ye.value && (t = new mt(ye.value, {
541
+ ...yt(e.sortableProps || {}, ["onMove"]),
542
+ group: Ne(e.groupName) ? e.groupName() : e.groupName ?? ct(v),
543
+ filter: "[data-draggable=false]",
544
+ tree: !0,
545
+ draggable: `.${S.node}`,
546
+ handle: `.${S.node} .${S.draggable} .${S.draggableIcon}`,
547
+ dataIdAttr: "data-key",
548
+ dragClass: D,
549
+ onChoose(l) {
550
+ var te;
551
+ if (d = u(l == null ? void 0 : l.item), q = (te = d == null ? void 0 : d._parentKeys) == null ? void 0 : te.map(r).filter(Boolean), d) {
552
+ if (q != null && q.length) {
553
+ const z = pe(q);
554
+ z && (p = h(z, !0, !1).findIndex(
555
+ ($) => $._key === d._key
556
+ ));
557
+ } else
558
+ p = y().findIndex((z) => z._key === d._key);
559
+ d._dragging = !0;
560
+ }
561
+ a("choose", l);
562
+ },
563
+ onUnchoose(l) {
564
+ d && (d._dragging = !1), a("unchoose", l);
565
+ },
566
+ onStart(l) {
567
+ d != null && d._key && (B.value ?? []).includes(d._key) && (n = d, ne(n)), de.value = !0, a("dragStart", ve(l));
568
+ },
569
+ onEnd(l) {
570
+ de.value = !1, n && (ne(n), n = void 0), a("dragEnd", ve(l)), p = q = O = W = d = void 0;
571
+ },
572
+ onMove(l, te) {
573
+ var ae, se, ge;
574
+ if (O = W = void 0, l.draggedTreeItemParent) {
575
+ const _ = u(l == null ? void 0 : l.draggedTreeItemParent);
576
+ _ && (W = [
577
+ ...((ae = _ == null ? void 0 : _._parentKeys) == null ? void 0 : ae.map(r).filter(Boolean)) ?? [],
578
+ _
579
+ ], (se = h(_, !0, !1)) != null && se.length && !(B.value ?? []).includes(_._key) && ne(_));
580
+ }
581
+ const z = l.draggedTreeItemLevel ?? 1;
582
+ if (!l.draggedTreeItemBefore) O = 0;
583
+ else if (l.draggedTreeItemBefore) {
584
+ if (l.draggedTreeItemBefore.level === z) {
585
+ const _ = u(l.draggedTreeItemBefore);
586
+ _ && (O = o(_) + 1);
587
+ } else if (l.draggedTreeItemBefore.level < z)
588
+ O = 0;
589
+ else if (l.draggedTreeItemBefore.level > z) {
590
+ if (!l.draggedTreeItemAfter || l.draggedTreeItemAfter.level < z) {
591
+ const _ = pe(W ?? []);
592
+ O = i(_).length;
593
+ } else if (l.draggedTreeItemAfter.level === z) {
594
+ const _ = u(l.draggedTreeItemAfter);
595
+ _ && (O = o(_));
596
+ }
597
+ }
598
+ }
599
+ const $ = ve(l);
600
+ Ne((ge = e.sortableProps) == null ? void 0 : ge.onMove) && e.sortableProps.onMove($, te);
601
+ },
602
+ getPlaceholder(l) {
603
+ return Te(l == null ? void 0 : l.item);
604
+ },
605
+ getPlaceholderOnMove(l) {
606
+ return Te(l == null ? void 0 : l.dragged, l.draggedTreeItemLevel || 1);
607
+ }
608
+ }));
609
+ }), rt(T);
610
+ }
611
+ const We = {
612
+ none: 0,
613
+ sm: 4,
614
+ md: 6,
615
+ lg: 8
616
+ }, He = m(() => ({
617
+ get count() {
618
+ return Q.value.length ?? 0;
619
+ },
620
+ getScrollElement: () => {
621
+ var t;
622
+ return (t = he.value) == null ? void 0 : t.container.viewportElement;
623
+ },
624
+ estimateSize: () => Pe[e.size] ?? Pe.md,
625
+ overscan: 5,
626
+ get gap() {
627
+ return We[fe.value ?? g.value] ?? fe.value ?? g.value ?? 0;
628
+ }
629
+ }));
630
+ let me, ee;
631
+ if (e.virtual)
632
+ if (typeof e.virtual == "object")
633
+ me = e.virtual;
634
+ else {
635
+ const { virtualizer: t, ...n } = _t(He);
636
+ me = t, ee = n;
637
+ }
638
+ const we = m(
639
+ () => {
640
+ var t;
641
+ return e.virtual ? (((t = re(me)) == null ? void 0 : t.getVirtualItems()) ?? []).map(
642
+ (n) => Q.value[n.index]
643
+ ) : Q.value;
644
+ }
645
+ ), ue = lt(), Je = () => {
646
+ var n;
647
+ const t = () => {
648
+ const u = () => {
649
+ var le;
650
+ const T = (le = P.default) == null ? void 0 : le.call(P, {
651
+ items: we.value
652
+ });
653
+ return $e(T) ? we.value.map(
654
+ (p) => R(
655
+ Ge,
656
+ { key: p._key, node: p },
657
+ {
658
+ default: P.node,
659
+ switcherIcon: P.switcherIcon
660
+ }
661
+ )
662
+ ) : T;
663
+ }, D = () => R(
664
+ "div",
665
+ {
666
+ dir: Z.value,
667
+ role: "tree",
668
+ class: Le(
669
+ J({
670
+ size: g.value,
671
+ gap: e.gap ?? g.value,
672
+ selectable: e.selectable,
673
+ disabled: A.value,
674
+ inlineNode: e.inlineNode,
675
+ dragging: de.value
676
+ }),
677
+ e.class
678
+ ),
679
+ style: {
680
+ "--ptc-tree-gap": fe.value,
681
+ ...e.virtual ? (ee == null ? void 0 : ee.containerStyles.value) ?? {} : {}
682
+ },
683
+ ref: ye
684
+ },
685
+ u()
686
+ );
687
+ return e.focusable ? R(
688
+ pt,
689
+ {
690
+ orientation: "vertical",
691
+ asChild: !0,
692
+ currentTabStopId: ue.value,
693
+ "onUpdate:currentTabStopId": (T) => {
694
+ ue.value = T;
695
+ },
696
+ onKeyup: (T) => {
697
+ var le;
698
+ if (ue.value !== void 0) {
699
+ const p = r(ue.value);
700
+ if (p) {
701
+ const d = !!(p._hasChildren || e != null && e.lazyLoad && !p._leaf);
702
+ if ((T.key === "ArrowRight" || T.key === "ArrowLeft") && d) {
703
+ const W = !(p._dragging ?? !1) && (B.value ?? []).includes(p._key);
704
+ (W && (Z.value === "rtl" && T.key === "ArrowRight" || Z.value === "ltr" && T.key === "ArrowLeft") || !W && (Z.value === "ltr" && T.key === "ArrowRight" || Z.value === "rtl" && T.key === "ArrowLeft")) && ne(p);
705
+ }
706
+ T.key === "Enter" && Se(p, !((le = C.value) != null && le.includes(p._key)));
707
+ }
708
+ }
709
+ }
710
+ },
711
+ D
712
+ ) : D();
713
+ };
714
+ return e.virtual && !e.outerVirtualScroll ? R(
715
+ Ct,
716
+ {
717
+ ...e.scrollContainerProps,
718
+ ref: he,
719
+ dir: Z.value,
720
+ wrapProps: {
721
+ ...((n = e.scrollContainerProps) == null ? void 0 : n.wrapProps) ?? {},
722
+ style: (ee == null ? void 0 : ee.scrollWrapperStyles.value) ?? {}
723
+ }
724
+ },
725
+ t
726
+ ) : t();
727
+ };
728
+ return s(Be), (t, n) => (Ie(), Ve(Je));
729
+ }
730
+ }), Ht = Fe(zt, Ee("Tree")), Jt = Fe(Ge, Ee("TreeNode"));
731
+ export {
732
+ ze as T,
733
+ zt as _,
734
+ Ge as a,
735
+ Jt as b,
736
+ Ht as c,
737
+ Bt as d,
738
+ Kt as f,
739
+ wt as i,
740
+ Tt as p
741
+ };