@cyberpunk-vue/components 1.12.1 → 1.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +154 -112
- package/dist/table/index.d.ts +23 -0
- package/dist/table/src/table.d.ts +25 -0
- package/dist/table/src/table.vue.d.ts +13 -0
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -7376,6 +7376,10 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7376
7376
|
includeHalfChecked: {
|
|
7377
7377
|
type: Boolean,
|
|
7378
7378
|
default: !1
|
|
7379
|
+
},
|
|
7380
|
+
checkedKeys: {
|
|
7381
|
+
type: Array,
|
|
7382
|
+
default: void 0
|
|
7379
7383
|
}
|
|
7380
7384
|
}, mi = {
|
|
7381
7385
|
"sort-change": (e) => !0,
|
|
@@ -7384,7 +7388,8 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7384
7388
|
"select-all": (e) => !0,
|
|
7385
7389
|
select: (e, t) => !0,
|
|
7386
7390
|
"current-change": (e, t) => !0,
|
|
7387
|
-
"expand-change": (e, t) => !0
|
|
7391
|
+
"expand-change": (e, t) => !0,
|
|
7392
|
+
"update:checkedKeys": (e) => !0
|
|
7388
7393
|
}, hi = { style: { display: "none" } }, gi = ["onClick"], _i = ["onClick"], vi = ["onClick"], yi = ["onClick"], bi = ["colspan"], xi = ["colspan"], Si = $(/* @__PURE__ */ d({
|
|
7389
7394
|
name: `${Q}Table`,
|
|
7390
7395
|
__name: "table",
|
|
@@ -7428,8 +7433,8 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7428
7433
|
}, m("sort-change", b.value);
|
|
7429
7434
|
}, E = (e) => !e.sortable || b.value.prop !== e.prop ? "" : b.value.order === "ascending" ? "is-ascending" : b.value.order === "descending" ? "is-descending" : "", k = (e, t) => b.value.prop === e.prop && b.value.order === t, P = j(/* @__PURE__ */ new Set()), I = (e) => N(e), L = r(() => {
|
|
7430
7435
|
let e = /* @__PURE__ */ new Map();
|
|
7431
|
-
if (
|
|
7432
|
-
let t =
|
|
7436
|
+
if (!le.value) return e;
|
|
7437
|
+
let t = ue.value, n = (r, i) => {
|
|
7433
7438
|
for (let a of r) {
|
|
7434
7439
|
let r = I(a), o = Array.isArray(r[t]) ? r[t].map(I) : [], s = {
|
|
7435
7440
|
parent: i,
|
|
@@ -7444,33 +7449,61 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7444
7449
|
}
|
|
7445
7450
|
};
|
|
7446
7451
|
return n(p.data, null), e;
|
|
7447
|
-
}), R = r(() => Array.from(L.value.keys())), z = r(() =>
|
|
7448
|
-
let e =
|
|
7452
|
+
}), R = r(() => Array.from(L.value.keys())), z = r(() => {
|
|
7453
|
+
let e = /* @__PURE__ */ new Map();
|
|
7454
|
+
if (le.value) for (let t of R.value) e.set(ce(t, -1), t);
|
|
7455
|
+
else p.data.forEach((t, n) => {
|
|
7456
|
+
e.set(ce(t, n), I(t));
|
|
7457
|
+
});
|
|
7458
|
+
return e;
|
|
7459
|
+
}), V = r(() => le.value ? p.treeCheckMode : "strict"), U = r(() => V.value !== "strict"), W = (e) => P.value.has(I(e)), q = r(() => {
|
|
7460
|
+
let e = U.value ? R.value : x.value;
|
|
7449
7461
|
return e.length === 0 ? !1 : e.every((e) => P.value.has(I(e)));
|
|
7450
|
-
}),
|
|
7451
|
-
let e =
|
|
7462
|
+
}), J = r(() => {
|
|
7463
|
+
let e = U.value ? R.value : x.value, t = e.filter((e) => P.value.has(I(e))).length;
|
|
7452
7464
|
return t > 0 && t < e.length;
|
|
7453
|
-
}),
|
|
7454
|
-
if (!
|
|
7465
|
+
}), Y = (e) => {
|
|
7466
|
+
if (!U.value) return !1;
|
|
7455
7467
|
let t = L.value.get(I(e));
|
|
7456
7468
|
if (!t || t.descendants.length === 0) return !1;
|
|
7457
7469
|
let n = t.descendants.filter((e) => P.value.has(e)).length;
|
|
7458
7470
|
return n > 0 && n < t.descendants.length;
|
|
7459
|
-
},
|
|
7471
|
+
}, X = r(() => U.value ? R.value.filter((e) => Y(e)) : []), Q = (e) => e.map((e) => ce(e, -1)), ee = (e) => {
|
|
7472
|
+
let t = P.value;
|
|
7473
|
+
if (t.size !== e.length) return !1;
|
|
7474
|
+
let n = z.value;
|
|
7475
|
+
for (let r of e) {
|
|
7476
|
+
let e = n.get(r);
|
|
7477
|
+
if (e === void 0 || !t.has(e)) return !1;
|
|
7478
|
+
}
|
|
7479
|
+
return !0;
|
|
7480
|
+
}, te = (e) => {
|
|
7481
|
+
if (ee(e)) return;
|
|
7482
|
+
let t = z.value, n = /* @__PURE__ */ new Set();
|
|
7483
|
+
for (let r of e) {
|
|
7484
|
+
let e = t.get(r);
|
|
7485
|
+
e !== void 0 && n.add(e);
|
|
7486
|
+
}
|
|
7487
|
+
P.value = n;
|
|
7488
|
+
}, ne = (e) => {
|
|
7489
|
+
P.value = e;
|
|
7490
|
+
let t = Array.from(e), n = re(t);
|
|
7491
|
+
return m("selection-change", n), m("update:checkedKeys", Q(t)), n;
|
|
7492
|
+
}, re = (e) => {
|
|
7460
7493
|
if (p.selectionPayload === "detail") {
|
|
7461
|
-
let t =
|
|
7494
|
+
let t = X.value;
|
|
7462
7495
|
return {
|
|
7463
7496
|
rows: e,
|
|
7464
|
-
keys:
|
|
7497
|
+
keys: Q(e),
|
|
7465
7498
|
halfRows: [...t],
|
|
7466
|
-
halfKeys:
|
|
7499
|
+
halfKeys: Q(t)
|
|
7467
7500
|
};
|
|
7468
7501
|
}
|
|
7469
|
-
let t = p.includeHalfChecked ? [...e, ...
|
|
7470
|
-
return p.selectionPayload === "keys" ?
|
|
7471
|
-
},
|
|
7502
|
+
let t = p.includeHalfChecked ? [...e, ...X.value] : e;
|
|
7503
|
+
return p.selectionPayload === "keys" ? Q(t) : t;
|
|
7504
|
+
}, ae = (e) => {
|
|
7472
7505
|
if (p.loading || p.disabled) return;
|
|
7473
|
-
let t = I(e), n = new Set(P.value), r =
|
|
7506
|
+
let t = I(e), n = new Set(P.value), r = V.value, i = r === "strict" ? void 0 : L.value.get(t);
|
|
7474
7507
|
if (i && r === "cascade") {
|
|
7475
7508
|
let e = [t, ...i.descendants], r = !e.every((e) => n.has(e));
|
|
7476
7509
|
for (let t of e) r ? n.add(t) : n.delete(t);
|
|
@@ -7494,85 +7527,85 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7494
7527
|
}
|
|
7495
7528
|
}
|
|
7496
7529
|
else n.has(t) ? n.delete(t) : n.add(t);
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
m("select", a, e), m("selection-change", a);
|
|
7500
|
-
}, te = () => {
|
|
7530
|
+
m("select", ne(n), e);
|
|
7531
|
+
}, $ = () => {
|
|
7501
7532
|
if (p.loading || p.disabled) return;
|
|
7502
|
-
let e =
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
m("select-all", n), m("selection-change", n);
|
|
7506
|
-
}, ne = T(null), re = (e, t, n) => {
|
|
7533
|
+
let e = U.value ? R.value : x.value;
|
|
7534
|
+
m("select-all", ne(q.value ? /* @__PURE__ */ new Set() : new Set(e.map(I))));
|
|
7535
|
+
}, oe = T(null), se = (e, t, n) => {
|
|
7507
7536
|
if (!(p.loading || p.disabled) && (m("row-click", e, t, n), p.highlightCurrentRow)) {
|
|
7508
|
-
let t =
|
|
7509
|
-
|
|
7537
|
+
let t = oe.value;
|
|
7538
|
+
oe.value = e, m("current-change", e, t);
|
|
7510
7539
|
}
|
|
7511
|
-
},
|
|
7512
|
-
if (
|
|
7540
|
+
}, ce = (e, t) => typeof p.rowKey == "function" ? p.rowKey(e) : e[p.rowKey] ?? t, le = r(() => !!p.treeProps), ue = r(() => p.treeProps?.children || "children"), de = r(() => p.treeProps?.hasChildren || ""), fe = T(/* @__PURE__ */ new Set()), pe = () => {
|
|
7541
|
+
if (le.value && p.defaultExpandAll) {
|
|
7513
7542
|
let e = /* @__PURE__ */ new Set(), t = (n) => {
|
|
7514
7543
|
for (let r of n) {
|
|
7515
|
-
let n =
|
|
7544
|
+
let n = ce(r, -1), i = r[ue.value];
|
|
7516
7545
|
i && i.length > 0 && (e.add(n), t(i));
|
|
7517
7546
|
}
|
|
7518
7547
|
};
|
|
7519
|
-
t(p.data),
|
|
7548
|
+
t(p.data), fe.value = e;
|
|
7520
7549
|
}
|
|
7521
7550
|
};
|
|
7522
|
-
B(() => p.data,
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7551
|
+
B(() => p.data, pe, { immediate: !0 }), B(() => p.checkedKeys, (e) => {
|
|
7552
|
+
e !== void 0 && te(e);
|
|
7553
|
+
}, { immediate: !0 }), B(z, () => {
|
|
7554
|
+
p.checkedKeys !== void 0 && te(p.checkedKeys);
|
|
7555
|
+
}), B(() => p.defaultExpandAll, pe);
|
|
7556
|
+
let me = (e) => {
|
|
7557
|
+
if (de.value && e[de.value]) return !0;
|
|
7558
|
+
let t = e[ue.value];
|
|
7526
7559
|
return Array.isArray(t) && t.length > 0;
|
|
7527
|
-
},
|
|
7528
|
-
let n =
|
|
7529
|
-
a ? r.add(n) : r.delete(n),
|
|
7530
|
-
},
|
|
7560
|
+
}, he = (e, t) => {
|
|
7561
|
+
let n = ce(e, -1), r = new Set(fe.value), i = r.has(n), a = t === void 0 ? !i : t;
|
|
7562
|
+
a ? r.add(n) : r.delete(n), fe.value = r, m("expand-change", e, a);
|
|
7563
|
+
}, ge = () => {
|
|
7531
7564
|
let e = /* @__PURE__ */ new Set(), t = (n) => {
|
|
7532
7565
|
for (let r of n) {
|
|
7533
|
-
let n =
|
|
7534
|
-
if (
|
|
7566
|
+
let n = ce(r, -1);
|
|
7567
|
+
if (me(r)) {
|
|
7535
7568
|
e.add(n);
|
|
7536
|
-
let i = r[
|
|
7569
|
+
let i = r[ue.value];
|
|
7537
7570
|
Array.isArray(i) && t(i);
|
|
7538
7571
|
}
|
|
7539
7572
|
}
|
|
7540
7573
|
};
|
|
7541
|
-
t(p.data),
|
|
7542
|
-
},
|
|
7543
|
-
|
|
7544
|
-
},
|
|
7545
|
-
if (
|
|
7574
|
+
t(p.data), fe.value = e;
|
|
7575
|
+
}, ve = () => {
|
|
7576
|
+
fe.value = /* @__PURE__ */ new Set();
|
|
7577
|
+
}, ye = r(() => {
|
|
7578
|
+
if (!le.value) return [];
|
|
7546
7579
|
let e = [], t = (n, r) => {
|
|
7547
7580
|
for (let i of n) {
|
|
7548
|
-
let n =
|
|
7581
|
+
let n = ce(i, -1), a = me(i), o = fe.value.has(n);
|
|
7549
7582
|
if (e.push({
|
|
7550
7583
|
row: i,
|
|
7551
7584
|
level: r,
|
|
7552
7585
|
hasChildren: a,
|
|
7553
7586
|
expanded: o
|
|
7554
7587
|
}), a && o) {
|
|
7555
|
-
let e = i[
|
|
7588
|
+
let e = i[ue.value];
|
|
7556
7589
|
Array.isArray(e) && t(e, r + 1);
|
|
7557
7590
|
}
|
|
7558
7591
|
}
|
|
7559
7592
|
};
|
|
7560
7593
|
return t(x.value, 0), e;
|
|
7561
|
-
}),
|
|
7594
|
+
}), be = r(() => le.value ? ye.value.map((e) => e.row) : x.value), xe = (e) => ye.value.find((t) => t.row === e), Se = (e) => {
|
|
7562
7595
|
let t = g.value.filter((e) => e.columnType === "default");
|
|
7563
7596
|
return t.length > 0 && t[0].id === e.id;
|
|
7564
|
-
},
|
|
7565
|
-
let t =
|
|
7566
|
-
return
|
|
7567
|
-
},
|
|
7568
|
-
if (p.loading || p.disabled || !
|
|
7569
|
-
let n =
|
|
7570
|
-
a ? r.add(n) : r.delete(n),
|
|
7597
|
+
}, Ce = T(/* @__PURE__ */ new Set()), we = r(() => g.value.find((e) => e.columnType === "expand")), Te = (e) => we.value ? typeof p.rowExpandable == "function" ? p.rowExpandable(e) : !0 : !1, Ee = (e) => {
|
|
7598
|
+
let t = ce(e, -1);
|
|
7599
|
+
return Ce.value.has(t);
|
|
7600
|
+
}, De = (e, t) => {
|
|
7601
|
+
if (p.loading || p.disabled || !Te(e)) return;
|
|
7602
|
+
let n = ce(e, -1), r = new Set(Ce.value), i = r.has(n), a = t === void 0 ? !i : t;
|
|
7603
|
+
a ? r.add(n) : r.delete(n), Ce.value = r, m("expand-change", e, a);
|
|
7571
7604
|
};
|
|
7572
7605
|
B(() => p.expandRowKeys, (e) => {
|
|
7573
|
-
e !== void 0 && (
|
|
7606
|
+
e !== void 0 && (Ce.value = new Set(e));
|
|
7574
7607
|
}, { immediate: !0 });
|
|
7575
|
-
let
|
|
7608
|
+
let Oe = r(() => [
|
|
7576
7609
|
h.b(),
|
|
7577
7610
|
K(p.size) && h.m(p.size),
|
|
7578
7611
|
h.m(`type-${p.type}`),
|
|
@@ -7582,35 +7615,44 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7582
7615
|
h.is("scrollable", !!(p.height || p.maxHeight)),
|
|
7583
7616
|
h.is("loading", p.loading),
|
|
7584
7617
|
h.is("disabled", p.disabled)
|
|
7585
|
-
]),
|
|
7618
|
+
]), ke = r(() => p.color ? p.color : p.type && p.type !== "default" ? `var(--cp-color-${p.type})` : null), Ae = r(() => p.color ? {
|
|
7586
7619
|
"--cp-table-color": p.color,
|
|
7587
7620
|
"--cp-table-header-bg": `linear-gradient(180deg, color-mix(in srgb, ${p.color} 18%, transparent) 0%, color-mix(in srgb, ${p.color} 6%, transparent) 100%)`,
|
|
7588
7621
|
"--cp-table-header-border-color": `color-mix(in srgb, ${p.color} 40%, transparent)`,
|
|
7589
7622
|
"--cp-table-row-hover-bg": `color-mix(in srgb, ${p.color} 6%, transparent)`,
|
|
7590
7623
|
"--cp-table-row-current-bg": `color-mix(in srgb, ${p.color} 10%, transparent)`,
|
|
7591
7624
|
"--cp-table-row-selected-bg": `color-mix(in srgb, ${p.color} 8%, transparent)`
|
|
7592
|
-
} : {}),
|
|
7625
|
+
} : {}), je = r(() => p.color || p.type === "default" ? void 0 : p.type), Me = r(() => p.color || void 0), Ne = r(() => {
|
|
7593
7626
|
let e = {};
|
|
7594
7627
|
return p.height && (e.height = typeof p.height == "number" ? `${p.height}px` : p.height, e["overflow-y"] = "auto"), p.maxHeight && (e["max-height"] = typeof p.maxHeight == "number" ? `${p.maxHeight}px` : p.maxHeight, e["overflow-y"] = "auto"), e;
|
|
7595
|
-
}),
|
|
7628
|
+
}), Pe = (e) => {
|
|
7596
7629
|
let t = {};
|
|
7597
7630
|
return e.width && (t.width = typeof e.width == "number" ? `${e.width}px` : e.width), e.minWidth && (t.minWidth = typeof e.minWidth == "number" ? `${e.minWidth}px` : e.minWidth), (e.columnType === "selection" || e.columnType === "index" || e.columnType === "expand") && (e.width || (t.width = "50px")), t;
|
|
7598
|
-
},
|
|
7631
|
+
}, Fe = (e, t) => t.prop ? t.prop.split(".").reduce((e, t) => e?.[t], e) : "", Ie = (e) => e === "center" ? h.m("align-center") : e === "right" ? h.m("align-right") : "";
|
|
7599
7632
|
return d({
|
|
7600
7633
|
clearSelection: () => {
|
|
7601
|
-
|
|
7634
|
+
ne(/* @__PURE__ */ new Set());
|
|
7635
|
+
},
|
|
7636
|
+
setSelectionKeys: (e) => {
|
|
7637
|
+
if (ee(e)) return;
|
|
7638
|
+
let t = z.value, n = /* @__PURE__ */ new Set();
|
|
7639
|
+
for (let r of e) {
|
|
7640
|
+
let e = t.get(r);
|
|
7641
|
+
e !== void 0 && n.add(e);
|
|
7642
|
+
}
|
|
7643
|
+
ne(n);
|
|
7602
7644
|
},
|
|
7603
7645
|
getSelectionRows: () => Array.from(P.value),
|
|
7604
|
-
getSelectionKeys: () =>
|
|
7605
|
-
getHalfCheckedRows: () => [...
|
|
7606
|
-
getHalfCheckedKeys: () => X
|
|
7646
|
+
getSelectionKeys: () => Q(Array.from(P.value)),
|
|
7647
|
+
getHalfCheckedRows: () => [...X.value],
|
|
7648
|
+
getHalfCheckedKeys: () => Q(X.value),
|
|
7607
7649
|
getSelectionDetail: () => {
|
|
7608
|
-
let e = Array.from(P.value), t =
|
|
7650
|
+
let e = Array.from(P.value), t = X.value;
|
|
7609
7651
|
return {
|
|
7610
7652
|
rows: e,
|
|
7611
|
-
keys:
|
|
7653
|
+
keys: Q(e),
|
|
7612
7654
|
halfRows: [...t],
|
|
7613
|
-
halfKeys:
|
|
7655
|
+
halfKeys: Q(t)
|
|
7614
7656
|
};
|
|
7615
7657
|
},
|
|
7616
7658
|
sort: (e, t) => {
|
|
@@ -7620,16 +7662,16 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7620
7662
|
}, m("sort-change", b.value);
|
|
7621
7663
|
},
|
|
7622
7664
|
setCurrentRow: (e) => {
|
|
7623
|
-
let t =
|
|
7624
|
-
|
|
7665
|
+
let t = oe.value;
|
|
7666
|
+
oe.value = e, m("current-change", e, t);
|
|
7625
7667
|
},
|
|
7626
|
-
toggleRowExpansion:
|
|
7627
|
-
expandAll:
|
|
7628
|
-
collapseAll:
|
|
7629
|
-
toggleRowExpand:
|
|
7668
|
+
toggleRowExpansion: he,
|
|
7669
|
+
expandAll: ge,
|
|
7670
|
+
collapseAll: ve,
|
|
7671
|
+
toggleRowExpand: De
|
|
7630
7672
|
}), (t, r) => (S(), o("div", {
|
|
7631
|
-
class: v(
|
|
7632
|
-
style: y(
|
|
7673
|
+
class: v(Oe.value),
|
|
7674
|
+
style: y(Ae.value)
|
|
7633
7675
|
}, [
|
|
7634
7676
|
s("div", hi, [O(t.$slots, "default")]),
|
|
7635
7677
|
s("div", { class: v(F(h).e("wrapper")) }, [s("table", { class: v(F(h).e("inner")) }, [t.showHeader ? (S(), o("thead", {
|
|
@@ -7641,17 +7683,17 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7641
7683
|
F(h).e("header-cell"),
|
|
7642
7684
|
t.sortable && F(h).is("sortable", !0),
|
|
7643
7685
|
E(t),
|
|
7644
|
-
|
|
7686
|
+
Ie(t.headerAlign || t.align)
|
|
7645
7687
|
]),
|
|
7646
|
-
style: y(
|
|
7688
|
+
style: y(Pe(t)),
|
|
7647
7689
|
onClick: (e) => t.sortable ? w(t) : void 0
|
|
7648
7690
|
}, [t.columnType === "selection" ? (S(), i(yn, {
|
|
7649
7691
|
key: 0,
|
|
7650
|
-
"model-value":
|
|
7651
|
-
indeterminate:
|
|
7652
|
-
type:
|
|
7653
|
-
color:
|
|
7654
|
-
onChange:
|
|
7692
|
+
"model-value": q.value,
|
|
7693
|
+
indeterminate: J.value,
|
|
7694
|
+
type: je.value,
|
|
7695
|
+
color: Me.value,
|
|
7696
|
+
onChange: $,
|
|
7655
7697
|
onClick: r[0] ||= G(() => {}, ["stop"])
|
|
7656
7698
|
}, null, 8, [
|
|
7657
7699
|
"model-value",
|
|
@@ -7693,27 +7735,27 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7693
7735
|
fill: "currentColor"
|
|
7694
7736
|
}, null, -1)]], 2))], 2)) : a("", !0)], 64))], 14, gi))), 128))], 2)], 2)) : a("", !0), s("tbody", {
|
|
7695
7737
|
class: v(F(h).e("body")),
|
|
7696
|
-
style: y(
|
|
7697
|
-
}, [
|
|
7738
|
+
style: y(Ne.value)
|
|
7739
|
+
}, [be.value.length > 0 ? (S(!0), o(e, { key: 0 }, D(be.value, (n, c) => (S(), o(e, { key: ce(n, c) }, [s("tr", {
|
|
7698
7740
|
class: v([
|
|
7699
7741
|
F(h).e("row"),
|
|
7700
7742
|
F(h).is("striped", t.stripe && c % 2 == 1),
|
|
7701
|
-
F(h).is("current", t.highlightCurrentRow &&
|
|
7702
|
-
F(h).is("selected",
|
|
7703
|
-
F(h).is("expanded",
|
|
7743
|
+
F(h).is("current", t.highlightCurrentRow && oe.value === n),
|
|
7744
|
+
F(h).is("selected", W(n)),
|
|
7745
|
+
F(h).is("expanded", we.value && Ee(n))
|
|
7704
7746
|
]),
|
|
7705
|
-
onClick: (e) =>
|
|
7747
|
+
onClick: (e) => se(n, c, e)
|
|
7706
7748
|
}, [(S(!0), o(e, null, D(g.value, (u) => (S(), o("td", {
|
|
7707
7749
|
key: u.id,
|
|
7708
|
-
class: v([F(h).e("cell"),
|
|
7709
|
-
style: y(
|
|
7750
|
+
class: v([F(h).e("cell"), Ie(u.align)]),
|
|
7751
|
+
style: y(Pe(u))
|
|
7710
7752
|
}, [u.columnType === "selection" ? (S(), i(yn, {
|
|
7711
7753
|
key: 0,
|
|
7712
|
-
"model-value":
|
|
7713
|
-
indeterminate:
|
|
7714
|
-
type:
|
|
7715
|
-
color:
|
|
7716
|
-
onChange: (e) =>
|
|
7754
|
+
"model-value": W(n),
|
|
7755
|
+
indeterminate: Y(n),
|
|
7756
|
+
type: je.value,
|
|
7757
|
+
color: Me.value,
|
|
7758
|
+
onChange: (e) => ae(n),
|
|
7717
7759
|
onClick: r[1] ||= G(() => {}, ["stop"])
|
|
7718
7760
|
}, null, 8, [
|
|
7719
7761
|
"model-value",
|
|
@@ -7721,28 +7763,28 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7721
7763
|
"type",
|
|
7722
7764
|
"color",
|
|
7723
7765
|
"onChange"
|
|
7724
|
-
])) : u.columnType === "expand" ? (S(), o(e, { key: 1 }, [
|
|
7766
|
+
])) : u.columnType === "expand" ? (S(), o(e, { key: 1 }, [Te(n) ? (S(), o("span", {
|
|
7725
7767
|
key: 0,
|
|
7726
|
-
class: v([F(h).e("expand-trigger"), F(h).is("expanded",
|
|
7727
|
-
onClick: G((e) =>
|
|
7768
|
+
class: v([F(h).e("expand-trigger"), F(h).is("expanded", Ee(n))]),
|
|
7769
|
+
onClick: G((e) => De(n), ["stop"])
|
|
7728
7770
|
}, [...r[4] ||= [s("svg", {
|
|
7729
7771
|
viewBox: "0 0 16 16",
|
|
7730
7772
|
width: "14",
|
|
7731
7773
|
height: "14",
|
|
7732
7774
|
fill: "currentColor"
|
|
7733
|
-
}, [s("path", { d: "M6 3l5 5-5 5V3z" })], -1)]], 10, vi)) : a("", !0)], 64)) : u.columnType === "index" ? (S(), o(e, { key: 2 }, [l(M(c + 1), 1)], 64)) :
|
|
7775
|
+
}, [s("path", { d: "M6 3l5 5-5 5V3z" })], -1)]], 10, vi)) : a("", !0)], 64)) : u.columnType === "index" ? (S(), o(e, { key: 2 }, [l(M(c + 1), 1)], 64)) : le.value && Se(u) ? (S(), o("div", {
|
|
7734
7776
|
key: 3,
|
|
7735
7777
|
class: v(F(h).e("tree-cell"))
|
|
7736
7778
|
}, [
|
|
7737
|
-
|
|
7779
|
+
xe(n) ? (S(), o("span", {
|
|
7738
7780
|
key: 0,
|
|
7739
7781
|
class: v(F(h).e("tree-indent")),
|
|
7740
|
-
style: y({ width: `${(
|
|
7782
|
+
style: y({ width: `${(xe(n)?.level || 0) * t.indent}px` })
|
|
7741
7783
|
}, null, 6)) : a("", !0),
|
|
7742
|
-
|
|
7784
|
+
xe(n)?.hasChildren ? (S(), o("span", {
|
|
7743
7785
|
key: 1,
|
|
7744
|
-
class: v([F(h).e("expand-icon"), F(h).is("expanded",
|
|
7745
|
-
onClick: G((e) =>
|
|
7786
|
+
class: v([F(h).e("expand-icon"), F(h).is("expanded", xe(n)?.expanded)]),
|
|
7787
|
+
onClick: G((e) => he(n), ["stop"])
|
|
7746
7788
|
}, [...r[5] ||= [s("svg", {
|
|
7747
7789
|
viewBox: "0 0 16 16",
|
|
7748
7790
|
width: "14",
|
|
@@ -7756,18 +7798,18 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7756
7798
|
row: n,
|
|
7757
7799
|
column: u,
|
|
7758
7800
|
$index: c
|
|
7759
|
-
}) }), { key: 0 })) : (S(), o(e, { key: 1 }, [l(M(
|
|
7801
|
+
}) }), { key: 0 })) : (S(), o(e, { key: 1 }, [l(M(Fe(n, u)), 1)], 64))], 2)
|
|
7760
7802
|
], 2)) : u.slots.default ? (S(), i(A({ render: () => u.slots.default({
|
|
7761
7803
|
row: n,
|
|
7762
7804
|
column: u,
|
|
7763
7805
|
$index: c
|
|
7764
|
-
}) }), { key: 4 })) : (S(), o(e, { key: 5 }, [l(M(
|
|
7806
|
+
}) }), { key: 4 })) : (S(), o(e, { key: 5 }, [l(M(Fe(n, u)), 1)], 64))], 6))), 128))], 10, _i), we.value && Ee(n) ? (S(), o("tr", {
|
|
7765
7807
|
key: 0,
|
|
7766
7808
|
class: v(F(h).e("expanded-row"))
|
|
7767
7809
|
}, [s("td", {
|
|
7768
7810
|
colspan: g.value.length,
|
|
7769
7811
|
class: v(F(h).e("expanded-cell"))
|
|
7770
|
-
}, [s("div", { class: v(F(h).e("expanded-content")) }, [
|
|
7812
|
+
}, [s("div", { class: v(F(h).e("expanded-content")) }, [we.value?.slots.default ? (S(), i(A({ render: () => we.value.slots.default({
|
|
7771
7813
|
row: n,
|
|
7772
7814
|
$index: c
|
|
7773
7815
|
}) }), { key: 0 })) : a("", !0)], 2)], 10, bi)], 2)) : a("", !0)], 64))), 128)) : (S(), o("tr", {
|
|
@@ -7789,7 +7831,7 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7789
7831
|
default: H(() => [t.loading ? (S(), o("div", {
|
|
7790
7832
|
key: 0,
|
|
7791
7833
|
class: v(F(h).e("loading-overlay"))
|
|
7792
|
-
}, [O(t.$slots, "loading", {}, () => [u(F(_e), { color:
|
|
7834
|
+
}, [O(t.$slots, "loading", {}, () => [u(F(_e), { color: ke.value || void 0 }, null, 8, ["color"]), t.loadingText ? (S(), o("span", {
|
|
7793
7835
|
key: 0,
|
|
7794
7836
|
class: v(F(h).e("loading-text"))
|
|
7795
7837
|
}, M(t.loadingText), 3)) : a("", !0)])], 2)) : a("", !0)]),
|
package/dist/table/index.d.ts
CHANGED
|
@@ -107,16 +107,22 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
107
107
|
readonly type: BooleanConstructor;
|
|
108
108
|
readonly default: false;
|
|
109
109
|
};
|
|
110
|
+
readonly checkedKeys: {
|
|
111
|
+
readonly type: import('vue').PropType<(string | number)[]>;
|
|
112
|
+
readonly default: undefined;
|
|
113
|
+
};
|
|
110
114
|
}>> & Readonly<{
|
|
111
115
|
onSelect?: ((selection: import('.').SelectionPayload, row: any) => any) | undefined;
|
|
112
116
|
"onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
|
|
113
117
|
"onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
|
|
118
|
+
"onUpdate:checkedKeys"?: ((keys: (string | number)[]) => any) | undefined;
|
|
114
119
|
"onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
|
|
115
120
|
"onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
|
|
116
121
|
"onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
|
|
117
122
|
"onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
|
|
118
123
|
}>, {
|
|
119
124
|
clearSelection: () => void;
|
|
125
|
+
setSelectionKeys: (keys: (string | number)[]) => void;
|
|
120
126
|
getSelectionRows: () => any[];
|
|
121
127
|
getSelectionKeys: () => (string | number)[];
|
|
122
128
|
getHalfCheckedRows: () => any[];
|
|
@@ -132,6 +138,7 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
132
138
|
select: (selection: import('.').SelectionPayload, row: any) => void;
|
|
133
139
|
"select-all": (selection: import('.').SelectionPayload) => void;
|
|
134
140
|
"current-change": (currentRow: any, oldRow: any) => void;
|
|
141
|
+
"update:checkedKeys": (keys: (string | number)[]) => void;
|
|
135
142
|
"sort-change": (sortState: import('.').SortState) => void;
|
|
136
143
|
"row-click": (row: any, index: number, event: MouseEvent) => void;
|
|
137
144
|
"selection-change": (selection: import('.').SelectionPayload) => void;
|
|
@@ -147,6 +154,7 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
147
154
|
readonly loadingText: string;
|
|
148
155
|
readonly showHeader: boolean;
|
|
149
156
|
readonly defaultExpandAll: boolean;
|
|
157
|
+
readonly checkedKeys: (string | number)[];
|
|
150
158
|
readonly indent: number;
|
|
151
159
|
readonly stripe: boolean;
|
|
152
160
|
readonly highlightCurrentRow: boolean;
|
|
@@ -259,16 +267,22 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
259
267
|
readonly type: BooleanConstructor;
|
|
260
268
|
readonly default: false;
|
|
261
269
|
};
|
|
270
|
+
readonly checkedKeys: {
|
|
271
|
+
readonly type: import('vue').PropType<(string | number)[]>;
|
|
272
|
+
readonly default: undefined;
|
|
273
|
+
};
|
|
262
274
|
}>> & Readonly<{
|
|
263
275
|
onSelect?: ((selection: import('.').SelectionPayload, row: any) => any) | undefined;
|
|
264
276
|
"onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
|
|
265
277
|
"onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
|
|
278
|
+
"onUpdate:checkedKeys"?: ((keys: (string | number)[]) => any) | undefined;
|
|
266
279
|
"onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
|
|
267
280
|
"onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
|
|
268
281
|
"onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
|
|
269
282
|
"onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
|
|
270
283
|
}>, {
|
|
271
284
|
clearSelection: () => void;
|
|
285
|
+
setSelectionKeys: (keys: (string | number)[]) => void;
|
|
272
286
|
getSelectionRows: () => any[];
|
|
273
287
|
getSelectionKeys: () => (string | number)[];
|
|
274
288
|
getHalfCheckedRows: () => any[];
|
|
@@ -291,6 +305,7 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
291
305
|
readonly loadingText: string;
|
|
292
306
|
readonly showHeader: boolean;
|
|
293
307
|
readonly defaultExpandAll: boolean;
|
|
308
|
+
readonly checkedKeys: (string | number)[];
|
|
294
309
|
readonly indent: number;
|
|
295
310
|
readonly stripe: boolean;
|
|
296
311
|
readonly highlightCurrentRow: boolean;
|
|
@@ -400,16 +415,22 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
400
415
|
readonly type: BooleanConstructor;
|
|
401
416
|
readonly default: false;
|
|
402
417
|
};
|
|
418
|
+
readonly checkedKeys: {
|
|
419
|
+
readonly type: import('vue').PropType<(string | number)[]>;
|
|
420
|
+
readonly default: undefined;
|
|
421
|
+
};
|
|
403
422
|
}>> & Readonly<{
|
|
404
423
|
onSelect?: ((selection: import('.').SelectionPayload, row: any) => any) | undefined;
|
|
405
424
|
"onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
|
|
406
425
|
"onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
|
|
426
|
+
"onUpdate:checkedKeys"?: ((keys: (string | number)[]) => any) | undefined;
|
|
407
427
|
"onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
|
|
408
428
|
"onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
|
|
409
429
|
"onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
|
|
410
430
|
"onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
|
|
411
431
|
}>, {
|
|
412
432
|
clearSelection: () => void;
|
|
433
|
+
setSelectionKeys: (keys: (string | number)[]) => void;
|
|
413
434
|
getSelectionRows: () => any[];
|
|
414
435
|
getSelectionKeys: () => (string | number)[];
|
|
415
436
|
getHalfCheckedRows: () => any[];
|
|
@@ -425,6 +446,7 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
425
446
|
select: (selection: import('.').SelectionPayload, row: any) => void;
|
|
426
447
|
"select-all": (selection: import('.').SelectionPayload) => void;
|
|
427
448
|
"current-change": (currentRow: any, oldRow: any) => void;
|
|
449
|
+
"update:checkedKeys": (keys: (string | number)[]) => void;
|
|
428
450
|
"sort-change": (sortState: import('.').SortState) => void;
|
|
429
451
|
"row-click": (row: any, index: number, event: MouseEvent) => void;
|
|
430
452
|
"selection-change": (selection: import('.').SelectionPayload) => void;
|
|
@@ -440,6 +462,7 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
440
462
|
readonly loadingText: string;
|
|
441
463
|
readonly showHeader: boolean;
|
|
442
464
|
readonly defaultExpandAll: boolean;
|
|
465
|
+
readonly checkedKeys: (string | number)[];
|
|
443
466
|
readonly indent: number;
|
|
444
467
|
readonly stripe: boolean;
|
|
445
468
|
readonly highlightCurrentRow: boolean;
|
|
@@ -99,6 +99,7 @@ export interface TableColumnConfig {
|
|
|
99
99
|
* @exposes getHalfCheckedRows() - 获取半选行对象数组(仅联动模式)
|
|
100
100
|
* @exposes getHalfCheckedKeys() - 获取半选行 rowKey 数组(仅联动模式)
|
|
101
101
|
* @exposes getSelectionDetail() - 获取结构化选中详情 { rows, keys, halfRows, halfKeys }
|
|
102
|
+
* @exposes setSelectionKeys(keys) - 程序式设置选中 rowKey 数组
|
|
102
103
|
* @exposes sort(prop, order) - 编程式排序
|
|
103
104
|
* @exposes setCurrentRow(row) - 设置当前行
|
|
104
105
|
* @exposes toggleRowExpand(row, expanded?) - 切换行展开(展开列模式)
|
|
@@ -338,6 +339,28 @@ export declare const tableProps: {
|
|
|
338
339
|
readonly type: BooleanConstructor;
|
|
339
340
|
readonly default: false;
|
|
340
341
|
};
|
|
342
|
+
/**
|
|
343
|
+
* 受控选中 rowKey 数组(配合 `v-model:checked-keys`)
|
|
344
|
+
* 典型场景:表单回填、编辑已有记录、权限/批量分配等
|
|
345
|
+
*
|
|
346
|
+
* - 传入 `undefined`(默认):组件使用内部状态,非受控
|
|
347
|
+
* - 传入数组(含空数组):进入受控模式,外部数组为真相来源
|
|
348
|
+
*
|
|
349
|
+
* 回填时**不做级联归一化**:传 `[3]` 就只选中 id=3 那一行,即便在 cascade/bubble 模式下也不会
|
|
350
|
+
* 自动补勾父节点或后代。父节点的 indeterminate 视觉态由组件自动计算。
|
|
351
|
+
* 这样保证 `v-model:checkedKeys` 读写对称——`getSelectionKeys()` 输出什么,回填就能用什么。
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```vue
|
|
355
|
+
* <CpTable v-model:checked-keys="form.selectedIds" row-key="id" :data="list">
|
|
356
|
+
* <CpTableColumn type="selection" />
|
|
357
|
+
* </CpTable>
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
readonly checkedKeys: {
|
|
361
|
+
readonly type: PropType<(string | number)[]>;
|
|
362
|
+
readonly default: undefined;
|
|
363
|
+
};
|
|
341
364
|
};
|
|
342
365
|
export type TableProps = ExtractPropTypes<typeof tableProps>;
|
|
343
366
|
/**
|
|
@@ -359,5 +382,7 @@ export declare const tableEmits: {
|
|
|
359
382
|
'current-change': (currentRow: any | null, oldRow: any | null) => boolean;
|
|
360
383
|
/** 树形行展开/折叠 或 行展开列展开/折叠 */
|
|
361
384
|
'expand-change': (row: any, expanded: boolean) => boolean;
|
|
385
|
+
/** 受控 checkedKeys 变化(用于 `v-model:checked-keys`) */
|
|
386
|
+
'update:checkedKeys': (keys: (string | number)[]) => boolean;
|
|
362
387
|
};
|
|
363
388
|
export type TableEmits = typeof tableEmits;
|
|
@@ -104,9 +104,15 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
104
104
|
readonly type: BooleanConstructor;
|
|
105
105
|
readonly default: false;
|
|
106
106
|
};
|
|
107
|
+
readonly checkedKeys: {
|
|
108
|
+
readonly type: import('vue').PropType<(string | number)[]>;
|
|
109
|
+
readonly default: undefined;
|
|
110
|
+
};
|
|
107
111
|
}>, {
|
|
108
112
|
/** 清空选择 */
|
|
109
113
|
clearSelection: () => void;
|
|
114
|
+
/** 程序式设置选中 rowKey 数组(不做级联归一化,与受控 prop 语义一致) */
|
|
115
|
+
setSelectionKeys: (keys: (string | number)[]) => void;
|
|
110
116
|
/** 获取完全选中行对象数组 */
|
|
111
117
|
getSelectionRows: () => any[];
|
|
112
118
|
/** 获取完全选中行的 rowKey 数组 */
|
|
@@ -133,6 +139,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
133
139
|
select: (selection: SelectionPayload, row: any) => void;
|
|
134
140
|
"select-all": (selection: SelectionPayload) => void;
|
|
135
141
|
"current-change": (currentRow: any, oldRow: any) => void;
|
|
142
|
+
"update:checkedKeys": (keys: (string | number)[]) => void;
|
|
136
143
|
"sort-change": (sortState: SortState) => void;
|
|
137
144
|
"row-click": (row: any, index: number, event: MouseEvent) => void;
|
|
138
145
|
"selection-change": (selection: SelectionPayload) => void;
|
|
@@ -231,10 +238,15 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
231
238
|
readonly type: BooleanConstructor;
|
|
232
239
|
readonly default: false;
|
|
233
240
|
};
|
|
241
|
+
readonly checkedKeys: {
|
|
242
|
+
readonly type: import('vue').PropType<(string | number)[]>;
|
|
243
|
+
readonly default: undefined;
|
|
244
|
+
};
|
|
234
245
|
}>> & Readonly<{
|
|
235
246
|
onSelect?: ((selection: SelectionPayload, row: any) => any) | undefined;
|
|
236
247
|
"onSelect-all"?: ((selection: SelectionPayload) => any) | undefined;
|
|
237
248
|
"onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
|
|
249
|
+
"onUpdate:checkedKeys"?: ((keys: (string | number)[]) => any) | undefined;
|
|
238
250
|
"onSort-change"?: ((sortState: SortState) => any) | undefined;
|
|
239
251
|
"onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
|
|
240
252
|
"onSelection-change"?: ((selection: SelectionPayload) => any) | undefined;
|
|
@@ -250,6 +262,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
250
262
|
readonly loadingText: string;
|
|
251
263
|
readonly showHeader: boolean;
|
|
252
264
|
readonly defaultExpandAll: boolean;
|
|
265
|
+
readonly checkedKeys: (string | number)[];
|
|
253
266
|
readonly indent: number;
|
|
254
267
|
readonly stripe: boolean;
|
|
255
268
|
readonly highlightCurrentRow: boolean;
|