@cyberpunk-vue/components 1.12.1 → 1.12.3
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/avatar/index.d.ts +15 -0
- package/dist/avatar/src/avatar-group.d.ts +10 -0
- package/dist/avatar/src/avatar-group.vue.d.ts +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +160 -114
- 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
|
@@ -3062,6 +3062,10 @@ var se = {
|
|
|
3062
3062
|
type: Number,
|
|
3063
3063
|
default: void 0
|
|
3064
3064
|
},
|
|
3065
|
+
total: {
|
|
3066
|
+
type: Number,
|
|
3067
|
+
default: void 0
|
|
3068
|
+
},
|
|
3065
3069
|
size: {
|
|
3066
3070
|
type: [String, Number],
|
|
3067
3071
|
default: "md"
|
|
@@ -3185,8 +3189,8 @@ var se = {
|
|
|
3185
3189
|
let e = p();
|
|
3186
3190
|
return n.max === void 0 || n.max >= e.length ? e.length : n.max;
|
|
3187
3191
|
}), h = r(() => {
|
|
3188
|
-
let e = p();
|
|
3189
|
-
return n.max === void 0 || n.max >= e.length ? 0 : e.length - n.max;
|
|
3192
|
+
let e = p(), t = n.max === void 0 ? e.length : Math.min(n.max, e.length);
|
|
3193
|
+
return n.total !== void 0 && n.total > t ? n.total - t : n.max === void 0 || n.max >= e.length ? 0 : e.length - n.max;
|
|
3190
3194
|
}), g = r(() => n.collapseShape ?? n.shape), _ = r(() => [
|
|
3191
3195
|
c.e("counter"),
|
|
3192
3196
|
c.bem("", "counter", `shape-${g.value}`),
|
|
@@ -7376,6 +7380,10 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7376
7380
|
includeHalfChecked: {
|
|
7377
7381
|
type: Boolean,
|
|
7378
7382
|
default: !1
|
|
7383
|
+
},
|
|
7384
|
+
checkedKeys: {
|
|
7385
|
+
type: Array,
|
|
7386
|
+
default: void 0
|
|
7379
7387
|
}
|
|
7380
7388
|
}, mi = {
|
|
7381
7389
|
"sort-change": (e) => !0,
|
|
@@ -7384,7 +7392,8 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7384
7392
|
"select-all": (e) => !0,
|
|
7385
7393
|
select: (e, t) => !0,
|
|
7386
7394
|
"current-change": (e, t) => !0,
|
|
7387
|
-
"expand-change": (e, t) => !0
|
|
7395
|
+
"expand-change": (e, t) => !0,
|
|
7396
|
+
"update:checkedKeys": (e) => !0
|
|
7388
7397
|
}, hi = { style: { display: "none" } }, gi = ["onClick"], _i = ["onClick"], vi = ["onClick"], yi = ["onClick"], bi = ["colspan"], xi = ["colspan"], Si = $(/* @__PURE__ */ d({
|
|
7389
7398
|
name: `${Q}Table`,
|
|
7390
7399
|
__name: "table",
|
|
@@ -7428,8 +7437,8 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7428
7437
|
}, m("sort-change", b.value);
|
|
7429
7438
|
}, 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
7439
|
let e = /* @__PURE__ */ new Map();
|
|
7431
|
-
if (
|
|
7432
|
-
let t =
|
|
7440
|
+
if (!le.value) return e;
|
|
7441
|
+
let t = ue.value, n = (r, i) => {
|
|
7433
7442
|
for (let a of r) {
|
|
7434
7443
|
let r = I(a), o = Array.isArray(r[t]) ? r[t].map(I) : [], s = {
|
|
7435
7444
|
parent: i,
|
|
@@ -7444,33 +7453,61 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7444
7453
|
}
|
|
7445
7454
|
};
|
|
7446
7455
|
return n(p.data, null), e;
|
|
7447
|
-
}), R = r(() => Array.from(L.value.keys())), z = r(() =>
|
|
7448
|
-
let e =
|
|
7456
|
+
}), R = r(() => Array.from(L.value.keys())), z = r(() => {
|
|
7457
|
+
let e = /* @__PURE__ */ new Map();
|
|
7458
|
+
if (le.value) for (let t of R.value) e.set(ce(t, -1), t);
|
|
7459
|
+
else p.data.forEach((t, n) => {
|
|
7460
|
+
e.set(ce(t, n), I(t));
|
|
7461
|
+
});
|
|
7462
|
+
return e;
|
|
7463
|
+
}), V = r(() => le.value ? p.treeCheckMode : "strict"), U = r(() => V.value !== "strict"), W = (e) => P.value.has(I(e)), q = r(() => {
|
|
7464
|
+
let e = U.value ? R.value : x.value;
|
|
7449
7465
|
return e.length === 0 ? !1 : e.every((e) => P.value.has(I(e)));
|
|
7450
|
-
}),
|
|
7451
|
-
let e =
|
|
7466
|
+
}), J = r(() => {
|
|
7467
|
+
let e = U.value ? R.value : x.value, t = e.filter((e) => P.value.has(I(e))).length;
|
|
7452
7468
|
return t > 0 && t < e.length;
|
|
7453
|
-
}),
|
|
7454
|
-
if (!
|
|
7469
|
+
}), Y = (e) => {
|
|
7470
|
+
if (!U.value) return !1;
|
|
7455
7471
|
let t = L.value.get(I(e));
|
|
7456
7472
|
if (!t || t.descendants.length === 0) return !1;
|
|
7457
7473
|
let n = t.descendants.filter((e) => P.value.has(e)).length;
|
|
7458
7474
|
return n > 0 && n < t.descendants.length;
|
|
7459
|
-
},
|
|
7475
|
+
}, X = r(() => U.value ? R.value.filter((e) => Y(e)) : []), Q = (e) => e.map((e) => ce(e, -1)), ee = (e) => {
|
|
7476
|
+
let t = P.value;
|
|
7477
|
+
if (t.size !== e.length) return !1;
|
|
7478
|
+
let n = z.value;
|
|
7479
|
+
for (let r of e) {
|
|
7480
|
+
let e = n.get(r);
|
|
7481
|
+
if (e === void 0 || !t.has(e)) return !1;
|
|
7482
|
+
}
|
|
7483
|
+
return !0;
|
|
7484
|
+
}, te = (e) => {
|
|
7485
|
+
if (ee(e)) return;
|
|
7486
|
+
let t = z.value, n = /* @__PURE__ */ new Set();
|
|
7487
|
+
for (let r of e) {
|
|
7488
|
+
let e = t.get(r);
|
|
7489
|
+
e !== void 0 && n.add(e);
|
|
7490
|
+
}
|
|
7491
|
+
P.value = n;
|
|
7492
|
+
}, ne = (e) => {
|
|
7493
|
+
P.value = e;
|
|
7494
|
+
let t = Array.from(e), n = re(t);
|
|
7495
|
+
return m("selection-change", n), m("update:checkedKeys", Q(t)), n;
|
|
7496
|
+
}, re = (e) => {
|
|
7460
7497
|
if (p.selectionPayload === "detail") {
|
|
7461
|
-
let t =
|
|
7498
|
+
let t = X.value;
|
|
7462
7499
|
return {
|
|
7463
7500
|
rows: e,
|
|
7464
|
-
keys:
|
|
7501
|
+
keys: Q(e),
|
|
7465
7502
|
halfRows: [...t],
|
|
7466
|
-
halfKeys:
|
|
7503
|
+
halfKeys: Q(t)
|
|
7467
7504
|
};
|
|
7468
7505
|
}
|
|
7469
|
-
let t = p.includeHalfChecked ? [...e, ...
|
|
7470
|
-
return p.selectionPayload === "keys" ?
|
|
7471
|
-
},
|
|
7506
|
+
let t = p.includeHalfChecked ? [...e, ...X.value] : e;
|
|
7507
|
+
return p.selectionPayload === "keys" ? Q(t) : t;
|
|
7508
|
+
}, ae = (e) => {
|
|
7472
7509
|
if (p.loading || p.disabled) return;
|
|
7473
|
-
let t = I(e), n = new Set(P.value), r =
|
|
7510
|
+
let t = I(e), n = new Set(P.value), r = V.value, i = r === "strict" ? void 0 : L.value.get(t);
|
|
7474
7511
|
if (i && r === "cascade") {
|
|
7475
7512
|
let e = [t, ...i.descendants], r = !e.every((e) => n.has(e));
|
|
7476
7513
|
for (let t of e) r ? n.add(t) : n.delete(t);
|
|
@@ -7494,85 +7531,85 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7494
7531
|
}
|
|
7495
7532
|
}
|
|
7496
7533
|
else n.has(t) ? n.delete(t) : n.add(t);
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
m("select", a, e), m("selection-change", a);
|
|
7500
|
-
}, te = () => {
|
|
7534
|
+
m("select", ne(n), e);
|
|
7535
|
+
}, $ = () => {
|
|
7501
7536
|
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) => {
|
|
7537
|
+
let e = U.value ? R.value : x.value;
|
|
7538
|
+
m("select-all", ne(q.value ? /* @__PURE__ */ new Set() : new Set(e.map(I))));
|
|
7539
|
+
}, oe = T(null), se = (e, t, n) => {
|
|
7507
7540
|
if (!(p.loading || p.disabled) && (m("row-click", e, t, n), p.highlightCurrentRow)) {
|
|
7508
|
-
let t =
|
|
7509
|
-
|
|
7541
|
+
let t = oe.value;
|
|
7542
|
+
oe.value = e, m("current-change", e, t);
|
|
7510
7543
|
}
|
|
7511
|
-
},
|
|
7512
|
-
if (
|
|
7544
|
+
}, 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 = () => {
|
|
7545
|
+
if (le.value && p.defaultExpandAll) {
|
|
7513
7546
|
let e = /* @__PURE__ */ new Set(), t = (n) => {
|
|
7514
7547
|
for (let r of n) {
|
|
7515
|
-
let n =
|
|
7548
|
+
let n = ce(r, -1), i = r[ue.value];
|
|
7516
7549
|
i && i.length > 0 && (e.add(n), t(i));
|
|
7517
7550
|
}
|
|
7518
7551
|
};
|
|
7519
|
-
t(p.data),
|
|
7552
|
+
t(p.data), fe.value = e;
|
|
7520
7553
|
}
|
|
7521
7554
|
};
|
|
7522
|
-
B(() => p.data,
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7555
|
+
B(() => p.data, pe, { immediate: !0 }), B(() => p.checkedKeys, (e) => {
|
|
7556
|
+
e !== void 0 && te(e);
|
|
7557
|
+
}, { immediate: !0 }), B(z, () => {
|
|
7558
|
+
p.checkedKeys !== void 0 && te(p.checkedKeys);
|
|
7559
|
+
}), B(() => p.defaultExpandAll, pe);
|
|
7560
|
+
let me = (e) => {
|
|
7561
|
+
if (de.value && e[de.value]) return !0;
|
|
7562
|
+
let t = e[ue.value];
|
|
7526
7563
|
return Array.isArray(t) && t.length > 0;
|
|
7527
|
-
},
|
|
7528
|
-
let n =
|
|
7529
|
-
a ? r.add(n) : r.delete(n),
|
|
7530
|
-
},
|
|
7564
|
+
}, he = (e, t) => {
|
|
7565
|
+
let n = ce(e, -1), r = new Set(fe.value), i = r.has(n), a = t === void 0 ? !i : t;
|
|
7566
|
+
a ? r.add(n) : r.delete(n), fe.value = r, m("expand-change", e, a);
|
|
7567
|
+
}, ge = () => {
|
|
7531
7568
|
let e = /* @__PURE__ */ new Set(), t = (n) => {
|
|
7532
7569
|
for (let r of n) {
|
|
7533
|
-
let n =
|
|
7534
|
-
if (
|
|
7570
|
+
let n = ce(r, -1);
|
|
7571
|
+
if (me(r)) {
|
|
7535
7572
|
e.add(n);
|
|
7536
|
-
let i = r[
|
|
7573
|
+
let i = r[ue.value];
|
|
7537
7574
|
Array.isArray(i) && t(i);
|
|
7538
7575
|
}
|
|
7539
7576
|
}
|
|
7540
7577
|
};
|
|
7541
|
-
t(p.data),
|
|
7542
|
-
},
|
|
7543
|
-
|
|
7544
|
-
},
|
|
7545
|
-
if (
|
|
7578
|
+
t(p.data), fe.value = e;
|
|
7579
|
+
}, ve = () => {
|
|
7580
|
+
fe.value = /* @__PURE__ */ new Set();
|
|
7581
|
+
}, ye = r(() => {
|
|
7582
|
+
if (!le.value) return [];
|
|
7546
7583
|
let e = [], t = (n, r) => {
|
|
7547
7584
|
for (let i of n) {
|
|
7548
|
-
let n =
|
|
7585
|
+
let n = ce(i, -1), a = me(i), o = fe.value.has(n);
|
|
7549
7586
|
if (e.push({
|
|
7550
7587
|
row: i,
|
|
7551
7588
|
level: r,
|
|
7552
7589
|
hasChildren: a,
|
|
7553
7590
|
expanded: o
|
|
7554
7591
|
}), a && o) {
|
|
7555
|
-
let e = i[
|
|
7592
|
+
let e = i[ue.value];
|
|
7556
7593
|
Array.isArray(e) && t(e, r + 1);
|
|
7557
7594
|
}
|
|
7558
7595
|
}
|
|
7559
7596
|
};
|
|
7560
7597
|
return t(x.value, 0), e;
|
|
7561
|
-
}),
|
|
7598
|
+
}), be = r(() => le.value ? ye.value.map((e) => e.row) : x.value), xe = (e) => ye.value.find((t) => t.row === e), Se = (e) => {
|
|
7562
7599
|
let t = g.value.filter((e) => e.columnType === "default");
|
|
7563
7600
|
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),
|
|
7601
|
+
}, 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) => {
|
|
7602
|
+
let t = ce(e, -1);
|
|
7603
|
+
return Ce.value.has(t);
|
|
7604
|
+
}, De = (e, t) => {
|
|
7605
|
+
if (p.loading || p.disabled || !Te(e)) return;
|
|
7606
|
+
let n = ce(e, -1), r = new Set(Ce.value), i = r.has(n), a = t === void 0 ? !i : t;
|
|
7607
|
+
a ? r.add(n) : r.delete(n), Ce.value = r, m("expand-change", e, a);
|
|
7571
7608
|
};
|
|
7572
7609
|
B(() => p.expandRowKeys, (e) => {
|
|
7573
|
-
e !== void 0 && (
|
|
7610
|
+
e !== void 0 && (Ce.value = new Set(e));
|
|
7574
7611
|
}, { immediate: !0 });
|
|
7575
|
-
let
|
|
7612
|
+
let Oe = r(() => [
|
|
7576
7613
|
h.b(),
|
|
7577
7614
|
K(p.size) && h.m(p.size),
|
|
7578
7615
|
h.m(`type-${p.type}`),
|
|
@@ -7582,35 +7619,44 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7582
7619
|
h.is("scrollable", !!(p.height || p.maxHeight)),
|
|
7583
7620
|
h.is("loading", p.loading),
|
|
7584
7621
|
h.is("disabled", p.disabled)
|
|
7585
|
-
]),
|
|
7622
|
+
]), ke = r(() => p.color ? p.color : p.type && p.type !== "default" ? `var(--cp-color-${p.type})` : null), Ae = r(() => p.color ? {
|
|
7586
7623
|
"--cp-table-color": p.color,
|
|
7587
7624
|
"--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
7625
|
"--cp-table-header-border-color": `color-mix(in srgb, ${p.color} 40%, transparent)`,
|
|
7589
7626
|
"--cp-table-row-hover-bg": `color-mix(in srgb, ${p.color} 6%, transparent)`,
|
|
7590
7627
|
"--cp-table-row-current-bg": `color-mix(in srgb, ${p.color} 10%, transparent)`,
|
|
7591
7628
|
"--cp-table-row-selected-bg": `color-mix(in srgb, ${p.color} 8%, transparent)`
|
|
7592
|
-
} : {}),
|
|
7629
|
+
} : {}), je = r(() => p.color || p.type === "default" ? void 0 : p.type), Me = r(() => p.color || void 0), Ne = r(() => {
|
|
7593
7630
|
let e = {};
|
|
7594
7631
|
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
|
-
}),
|
|
7632
|
+
}), Pe = (e) => {
|
|
7596
7633
|
let t = {};
|
|
7597
7634
|
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
|
-
},
|
|
7635
|
+
}, 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
7636
|
return d({
|
|
7600
7637
|
clearSelection: () => {
|
|
7601
|
-
|
|
7638
|
+
ne(/* @__PURE__ */ new Set());
|
|
7639
|
+
},
|
|
7640
|
+
setSelectionKeys: (e) => {
|
|
7641
|
+
if (ee(e)) return;
|
|
7642
|
+
let t = z.value, n = /* @__PURE__ */ new Set();
|
|
7643
|
+
for (let r of e) {
|
|
7644
|
+
let e = t.get(r);
|
|
7645
|
+
e !== void 0 && n.add(e);
|
|
7646
|
+
}
|
|
7647
|
+
ne(n);
|
|
7602
7648
|
},
|
|
7603
7649
|
getSelectionRows: () => Array.from(P.value),
|
|
7604
|
-
getSelectionKeys: () =>
|
|
7605
|
-
getHalfCheckedRows: () => [...
|
|
7606
|
-
getHalfCheckedKeys: () => X
|
|
7650
|
+
getSelectionKeys: () => Q(Array.from(P.value)),
|
|
7651
|
+
getHalfCheckedRows: () => [...X.value],
|
|
7652
|
+
getHalfCheckedKeys: () => Q(X.value),
|
|
7607
7653
|
getSelectionDetail: () => {
|
|
7608
|
-
let e = Array.from(P.value), t =
|
|
7654
|
+
let e = Array.from(P.value), t = X.value;
|
|
7609
7655
|
return {
|
|
7610
7656
|
rows: e,
|
|
7611
|
-
keys:
|
|
7657
|
+
keys: Q(e),
|
|
7612
7658
|
halfRows: [...t],
|
|
7613
|
-
halfKeys:
|
|
7659
|
+
halfKeys: Q(t)
|
|
7614
7660
|
};
|
|
7615
7661
|
},
|
|
7616
7662
|
sort: (e, t) => {
|
|
@@ -7620,16 +7666,16 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7620
7666
|
}, m("sort-change", b.value);
|
|
7621
7667
|
},
|
|
7622
7668
|
setCurrentRow: (e) => {
|
|
7623
|
-
let t =
|
|
7624
|
-
|
|
7669
|
+
let t = oe.value;
|
|
7670
|
+
oe.value = e, m("current-change", e, t);
|
|
7625
7671
|
},
|
|
7626
|
-
toggleRowExpansion:
|
|
7627
|
-
expandAll:
|
|
7628
|
-
collapseAll:
|
|
7629
|
-
toggleRowExpand:
|
|
7672
|
+
toggleRowExpansion: he,
|
|
7673
|
+
expandAll: ge,
|
|
7674
|
+
collapseAll: ve,
|
|
7675
|
+
toggleRowExpand: De
|
|
7630
7676
|
}), (t, r) => (S(), o("div", {
|
|
7631
|
-
class: v(
|
|
7632
|
-
style: y(
|
|
7677
|
+
class: v(Oe.value),
|
|
7678
|
+
style: y(Ae.value)
|
|
7633
7679
|
}, [
|
|
7634
7680
|
s("div", hi, [O(t.$slots, "default")]),
|
|
7635
7681
|
s("div", { class: v(F(h).e("wrapper")) }, [s("table", { class: v(F(h).e("inner")) }, [t.showHeader ? (S(), o("thead", {
|
|
@@ -7641,17 +7687,17 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7641
7687
|
F(h).e("header-cell"),
|
|
7642
7688
|
t.sortable && F(h).is("sortable", !0),
|
|
7643
7689
|
E(t),
|
|
7644
|
-
|
|
7690
|
+
Ie(t.headerAlign || t.align)
|
|
7645
7691
|
]),
|
|
7646
|
-
style: y(
|
|
7692
|
+
style: y(Pe(t)),
|
|
7647
7693
|
onClick: (e) => t.sortable ? w(t) : void 0
|
|
7648
7694
|
}, [t.columnType === "selection" ? (S(), i(yn, {
|
|
7649
7695
|
key: 0,
|
|
7650
|
-
"model-value":
|
|
7651
|
-
indeterminate:
|
|
7652
|
-
type:
|
|
7653
|
-
color:
|
|
7654
|
-
onChange:
|
|
7696
|
+
"model-value": q.value,
|
|
7697
|
+
indeterminate: J.value,
|
|
7698
|
+
type: je.value,
|
|
7699
|
+
color: Me.value,
|
|
7700
|
+
onChange: $,
|
|
7655
7701
|
onClick: r[0] ||= G(() => {}, ["stop"])
|
|
7656
7702
|
}, null, 8, [
|
|
7657
7703
|
"model-value",
|
|
@@ -7693,27 +7739,27 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7693
7739
|
fill: "currentColor"
|
|
7694
7740
|
}, null, -1)]], 2))], 2)) : a("", !0)], 64))], 14, gi))), 128))], 2)], 2)) : a("", !0), s("tbody", {
|
|
7695
7741
|
class: v(F(h).e("body")),
|
|
7696
|
-
style: y(
|
|
7697
|
-
}, [
|
|
7742
|
+
style: y(Ne.value)
|
|
7743
|
+
}, [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
7744
|
class: v([
|
|
7699
7745
|
F(h).e("row"),
|
|
7700
7746
|
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",
|
|
7747
|
+
F(h).is("current", t.highlightCurrentRow && oe.value === n),
|
|
7748
|
+
F(h).is("selected", W(n)),
|
|
7749
|
+
F(h).is("expanded", we.value && Ee(n))
|
|
7704
7750
|
]),
|
|
7705
|
-
onClick: (e) =>
|
|
7751
|
+
onClick: (e) => se(n, c, e)
|
|
7706
7752
|
}, [(S(!0), o(e, null, D(g.value, (u) => (S(), o("td", {
|
|
7707
7753
|
key: u.id,
|
|
7708
|
-
class: v([F(h).e("cell"),
|
|
7709
|
-
style: y(
|
|
7754
|
+
class: v([F(h).e("cell"), Ie(u.align)]),
|
|
7755
|
+
style: y(Pe(u))
|
|
7710
7756
|
}, [u.columnType === "selection" ? (S(), i(yn, {
|
|
7711
7757
|
key: 0,
|
|
7712
|
-
"model-value":
|
|
7713
|
-
indeterminate:
|
|
7714
|
-
type:
|
|
7715
|
-
color:
|
|
7716
|
-
onChange: (e) =>
|
|
7758
|
+
"model-value": W(n),
|
|
7759
|
+
indeterminate: Y(n),
|
|
7760
|
+
type: je.value,
|
|
7761
|
+
color: Me.value,
|
|
7762
|
+
onChange: (e) => ae(n),
|
|
7717
7763
|
onClick: r[1] ||= G(() => {}, ["stop"])
|
|
7718
7764
|
}, null, 8, [
|
|
7719
7765
|
"model-value",
|
|
@@ -7721,28 +7767,28 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7721
7767
|
"type",
|
|
7722
7768
|
"color",
|
|
7723
7769
|
"onChange"
|
|
7724
|
-
])) : u.columnType === "expand" ? (S(), o(e, { key: 1 }, [
|
|
7770
|
+
])) : u.columnType === "expand" ? (S(), o(e, { key: 1 }, [Te(n) ? (S(), o("span", {
|
|
7725
7771
|
key: 0,
|
|
7726
|
-
class: v([F(h).e("expand-trigger"), F(h).is("expanded",
|
|
7727
|
-
onClick: G((e) =>
|
|
7772
|
+
class: v([F(h).e("expand-trigger"), F(h).is("expanded", Ee(n))]),
|
|
7773
|
+
onClick: G((e) => De(n), ["stop"])
|
|
7728
7774
|
}, [...r[4] ||= [s("svg", {
|
|
7729
7775
|
viewBox: "0 0 16 16",
|
|
7730
7776
|
width: "14",
|
|
7731
7777
|
height: "14",
|
|
7732
7778
|
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)) :
|
|
7779
|
+
}, [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
7780
|
key: 3,
|
|
7735
7781
|
class: v(F(h).e("tree-cell"))
|
|
7736
7782
|
}, [
|
|
7737
|
-
|
|
7783
|
+
xe(n) ? (S(), o("span", {
|
|
7738
7784
|
key: 0,
|
|
7739
7785
|
class: v(F(h).e("tree-indent")),
|
|
7740
|
-
style: y({ width: `${(
|
|
7786
|
+
style: y({ width: `${(xe(n)?.level || 0) * t.indent}px` })
|
|
7741
7787
|
}, null, 6)) : a("", !0),
|
|
7742
|
-
|
|
7788
|
+
xe(n)?.hasChildren ? (S(), o("span", {
|
|
7743
7789
|
key: 1,
|
|
7744
|
-
class: v([F(h).e("expand-icon"), F(h).is("expanded",
|
|
7745
|
-
onClick: G((e) =>
|
|
7790
|
+
class: v([F(h).e("expand-icon"), F(h).is("expanded", xe(n)?.expanded)]),
|
|
7791
|
+
onClick: G((e) => he(n), ["stop"])
|
|
7746
7792
|
}, [...r[5] ||= [s("svg", {
|
|
7747
7793
|
viewBox: "0 0 16 16",
|
|
7748
7794
|
width: "14",
|
|
@@ -7756,18 +7802,18 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7756
7802
|
row: n,
|
|
7757
7803
|
column: u,
|
|
7758
7804
|
$index: c
|
|
7759
|
-
}) }), { key: 0 })) : (S(), o(e, { key: 1 }, [l(M(
|
|
7805
|
+
}) }), { key: 0 })) : (S(), o(e, { key: 1 }, [l(M(Fe(n, u)), 1)], 64))], 2)
|
|
7760
7806
|
], 2)) : u.slots.default ? (S(), i(A({ render: () => u.slots.default({
|
|
7761
7807
|
row: n,
|
|
7762
7808
|
column: u,
|
|
7763
7809
|
$index: c
|
|
7764
|
-
}) }), { key: 4 })) : (S(), o(e, { key: 5 }, [l(M(
|
|
7810
|
+
}) }), { 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
7811
|
key: 0,
|
|
7766
7812
|
class: v(F(h).e("expanded-row"))
|
|
7767
7813
|
}, [s("td", {
|
|
7768
7814
|
colspan: g.value.length,
|
|
7769
7815
|
class: v(F(h).e("expanded-cell"))
|
|
7770
|
-
}, [s("div", { class: v(F(h).e("expanded-content")) }, [
|
|
7816
|
+
}, [s("div", { class: v(F(h).e("expanded-content")) }, [we.value?.slots.default ? (S(), i(A({ render: () => we.value.slots.default({
|
|
7771
7817
|
row: n,
|
|
7772
7818
|
$index: c
|
|
7773
7819
|
}) }), { key: 0 })) : a("", !0)], 2)], 10, bi)], 2)) : a("", !0)], 64))), 128)) : (S(), o("tr", {
|
|
@@ -7789,7 +7835,7 @@ var $r = $(Ur), ei = oe(Xr, "$notify"), ti = /* @__PURE__ */ d({
|
|
|
7789
7835
|
default: H(() => [t.loading ? (S(), o("div", {
|
|
7790
7836
|
key: 0,
|
|
7791
7837
|
class: v(F(h).e("loading-overlay"))
|
|
7792
|
-
}, [O(t.$slots, "loading", {}, () => [u(F(_e), { color:
|
|
7838
|
+
}, [O(t.$slots, "loading", {}, () => [u(F(_e), { color: ke.value || void 0 }, null, 8, ["color"]), t.loadingText ? (S(), o("span", {
|
|
7793
7839
|
key: 0,
|
|
7794
7840
|
class: v(F(h).e("loading-text"))
|
|
7795
7841
|
}, 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;
|