@cyberpunk-vue/components 1.13.2 → 1.13.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/index.cjs +1 -1
- package/dist/index.mjs +125 -101
- package/dist/table/index.d.ts +15 -0
- package/dist/table/src/table.d.ts +45 -0
- package/dist/table/src/table.vue.d.ts +9 -0
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -4583,33 +4583,41 @@ var Kr = Hn, qr = Un, Jr = zn, Yr = Wn, Xr = (e, t, n) => {
|
|
|
4583
4583
|
}, he = () => {
|
|
4584
4584
|
fe?.(), fe = null;
|
|
4585
4585
|
}, ge = () => {
|
|
4586
|
-
|
|
4586
|
+
if (!M.value) return;
|
|
4587
|
+
let e = M.value.getBoundingClientRect(), [t, n] = p.placement.split("-");
|
|
4588
|
+
te.value = {
|
|
4589
|
+
x: n === "end" ? e.right - e.width : e.left,
|
|
4590
|
+
y: t === "top" ? e.top : e.bottom,
|
|
4591
|
+
width: e.width
|
|
4592
|
+
}, X.value = p.maxHeight, J.value = p.placement;
|
|
4593
|
+
}, _e = () => {
|
|
4594
|
+
E.value || (ge(), R.value = !0, document.dispatchEvent(new CustomEvent(ri, { detail: O })), m("visibleChange", !0), m("focus"), v(() => {
|
|
4587
4595
|
Q.value && I.value ? I.value.focus() : p.filterable && F.value && F.value.focus();
|
|
4588
4596
|
}));
|
|
4589
|
-
}, _e = () => {
|
|
4590
|
-
R.value = !1, V.value = "", U.value = -1, m("visibleChange", !1), m("blur");
|
|
4591
4597
|
}, ve = () => {
|
|
4592
|
-
R.value
|
|
4593
|
-
}, ye = (
|
|
4594
|
-
|
|
4598
|
+
R.value = !1, V.value = "", U.value = -1, m("visibleChange", !1), m("blur");
|
|
4599
|
+
}, ye = () => {
|
|
4600
|
+
R.value ? ve() : _e();
|
|
4595
4601
|
}, be = (e) => {
|
|
4602
|
+
e.disabled || (m("update:modelValue", e.value), m("change", e.value), ve());
|
|
4603
|
+
}, xe = (e) => {
|
|
4596
4604
|
e.stopPropagation(), G.value = !0, setTimeout(() => {
|
|
4597
4605
|
m("update:modelValue", ""), m("clear"), G.value = !1;
|
|
4598
4606
|
}, p.clearDuration);
|
|
4599
|
-
},
|
|
4600
|
-
e.detail !== O && R.value &&
|
|
4601
|
-
},
|
|
4607
|
+
}, Se = (e) => e.value === p.modelValue, Ce = (e) => {
|
|
4608
|
+
e.detail !== O && R.value && ve();
|
|
4609
|
+
}, Te = (e) => {
|
|
4602
4610
|
if (!R.value) return;
|
|
4603
4611
|
let t = e.target;
|
|
4604
|
-
M.value?.contains(t) || N.value?.contains(t) ||
|
|
4605
|
-
},
|
|
4612
|
+
M.value?.contains(t) || N.value?.contains(t) || ve();
|
|
4613
|
+
}, Ee = (e) => {
|
|
4606
4614
|
if (!R.value) {
|
|
4607
|
-
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(),
|
|
4615
|
+
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), _e());
|
|
4608
4616
|
return;
|
|
4609
4617
|
}
|
|
4610
4618
|
switch (e.key) {
|
|
4611
4619
|
case "Escape":
|
|
4612
|
-
e.preventDefault(),
|
|
4620
|
+
e.preventDefault(), ve();
|
|
4613
4621
|
break;
|
|
4614
4622
|
case "ArrowDown":
|
|
4615
4623
|
e.preventDefault(), U.value = Math.min(U.value + 1, oe.value.length - 1);
|
|
@@ -4618,18 +4626,18 @@ var Kr = Hn, qr = Un, Jr = zn, Yr = Wn, Xr = (e, t, n) => {
|
|
|
4618
4626
|
e.preventDefault(), U.value = Math.max(U.value - 1, 0);
|
|
4619
4627
|
break;
|
|
4620
4628
|
case "Enter":
|
|
4621
|
-
e.preventDefault(), U.value >= 0 && U.value < oe.value.length &&
|
|
4629
|
+
e.preventDefault(), U.value >= 0 && U.value < oe.value.length && be(oe.value[U.value]);
|
|
4622
4630
|
break;
|
|
4623
4631
|
}
|
|
4624
4632
|
};
|
|
4625
4633
|
return T?.visible && H(T.visible, (e) => {
|
|
4626
|
-
!e && R.value &&
|
|
4634
|
+
!e && R.value && ve();
|
|
4627
4635
|
}), H(R, async (e) => {
|
|
4628
4636
|
e ? (await v(), me()) : he();
|
|
4629
4637
|
}), d({
|
|
4630
|
-
open:
|
|
4631
|
-
close:
|
|
4632
|
-
toggle:
|
|
4638
|
+
open: _e,
|
|
4639
|
+
close: ve,
|
|
4640
|
+
toggle: ye,
|
|
4633
4641
|
focus: () => {
|
|
4634
4642
|
M.value?.focus();
|
|
4635
4643
|
},
|
|
@@ -4637,9 +4645,9 @@ var Kr = Hn, qr = Un, Jr = zn, Yr = Wn, Xr = (e, t, n) => {
|
|
|
4637
4645
|
M.value?.blur();
|
|
4638
4646
|
}
|
|
4639
4647
|
}), C(() => {
|
|
4640
|
-
document.addEventListener(ri,
|
|
4648
|
+
document.addEventListener(ri, Ce), document.addEventListener("click", Te);
|
|
4641
4649
|
}), S(() => {
|
|
4642
|
-
he(), document.removeEventListener(ri,
|
|
4650
|
+
he(), document.removeEventListener(ri, Ce), document.removeEventListener("click", Te);
|
|
4643
4651
|
}), (r, c) => (w(), o("div", {
|
|
4644
4652
|
class: y(ce.value),
|
|
4645
4653
|
style: x(le.value)
|
|
@@ -4648,8 +4656,8 @@ var Kr = Hn, qr = Un, Jr = zn, Yr = Wn, Xr = (e, t, n) => {
|
|
|
4648
4656
|
ref: M,
|
|
4649
4657
|
class: y(L(_).e("trigger")),
|
|
4650
4658
|
tabindex: Q.value ? -1 : 0,
|
|
4651
|
-
onClick: c[2] ||= (e) => !Q.value &&
|
|
4652
|
-
onKeydown: c[3] ||= (e) => !Q.value &&
|
|
4659
|
+
onClick: c[2] ||= (e) => !Q.value && ye(),
|
|
4660
|
+
onKeydown: c[3] ||= (e) => !Q.value && Ee(e)
|
|
4653
4661
|
}, [
|
|
4654
4662
|
L(g).prefix ? (w(), o("span", {
|
|
4655
4663
|
key: 0,
|
|
@@ -4665,8 +4673,8 @@ var Kr = Hn, qr = Un, Jr = zn, Yr = Wn, Xr = (e, t, n) => {
|
|
|
4665
4673
|
autocomplete: "off",
|
|
4666
4674
|
disabled: E.value,
|
|
4667
4675
|
onClick: c[1] ||= K(() => {}, ["stop"]),
|
|
4668
|
-
onFocus:
|
|
4669
|
-
onKeydown:
|
|
4676
|
+
onFocus: _e,
|
|
4677
|
+
onKeydown: Ee
|
|
4670
4678
|
}, null, 42, ei)), [[B, ie.value]]) : (w(), o("span", {
|
|
4671
4679
|
key: 2,
|
|
4672
4680
|
class: y([L(_).e("value"), { [L(_).is("placeholder")]: !se.value }])
|
|
@@ -4674,7 +4682,7 @@ var Kr = Hn, qr = Un, Jr = zn, Yr = Wn, Xr = (e, t, n) => {
|
|
|
4674
4682
|
$.value ? (w(), o("span", {
|
|
4675
4683
|
key: 3,
|
|
4676
4684
|
class: y(L(_).e("clear")),
|
|
4677
|
-
onClick:
|
|
4685
|
+
onClick: xe
|
|
4678
4686
|
}, [...c[6] ||= [s("svg", {
|
|
4679
4687
|
viewBox: "0 0 24 24",
|
|
4680
4688
|
fill: "currentColor"
|
|
@@ -4711,13 +4719,13 @@ var Kr = Hn, qr = Un, Jr = zn, Yr = Wn, Xr = (e, t, n) => {
|
|
|
4711
4719
|
key: e.value,
|
|
4712
4720
|
class: y([
|
|
4713
4721
|
L(_).e("option"),
|
|
4714
|
-
L(_).is("selected",
|
|
4722
|
+
L(_).is("selected", Se(e)),
|
|
4715
4723
|
L(_).is("disabled", !!e.disabled),
|
|
4716
4724
|
L(_).is("hover", U.value === t)
|
|
4717
4725
|
]),
|
|
4718
|
-
onClick: (t) =>
|
|
4726
|
+
onClick: (t) => be(e),
|
|
4719
4727
|
onMouseenter: (e) => U.value = t
|
|
4720
|
-
}, [A(r.$slots, "default", { option: e }, () => [l(P(e.label), 1)]),
|
|
4728
|
+
}, [A(r.$slots, "default", { option: e }, () => [l(P(e.label), 1)]), Se(e) ? (w(), o("span", {
|
|
4721
4729
|
key: 0,
|
|
4722
4730
|
class: y(L(_).e("check"))
|
|
4723
4731
|
}, [...c[8] ||= [s("svg", {
|
|
@@ -8223,6 +8231,15 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8223
8231
|
type: Boolean,
|
|
8224
8232
|
default: !1
|
|
8225
8233
|
},
|
|
8234
|
+
rowClassName: {
|
|
8235
|
+
type: [
|
|
8236
|
+
String,
|
|
8237
|
+
Array,
|
|
8238
|
+
Object,
|
|
8239
|
+
Function
|
|
8240
|
+
],
|
|
8241
|
+
default: ""
|
|
8242
|
+
},
|
|
8226
8243
|
height: { type: [String, Number] },
|
|
8227
8244
|
maxHeight: { type: [String, Number] },
|
|
8228
8245
|
emptyText: {
|
|
@@ -8342,8 +8359,8 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8342
8359
|
}, m("sort-change", v.value);
|
|
8343
8360
|
}, C = (e) => !e.sortable || v.value.prop !== e.prop ? "" : v.value.order === "ascending" ? "is-ascending" : v.value.order === "descending" ? "is-descending" : "", E = (e, t) => v.value.prop === e.prop && v.value.order === t, O = N(/* @__PURE__ */ new Set()), j = (e) => F(e), I = r(() => {
|
|
8344
8361
|
let e = /* @__PURE__ */ new Map();
|
|
8345
|
-
if (!
|
|
8346
|
-
let t =
|
|
8362
|
+
if (!ue.value) return e;
|
|
8363
|
+
let t = de.value, n = (r, i) => {
|
|
8347
8364
|
for (let a of r) {
|
|
8348
8365
|
let r = j(a), o = Array.isArray(r[t]) ? r[t].map(j) : [], s = {
|
|
8349
8366
|
parent: i,
|
|
@@ -8360,12 +8377,12 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8360
8377
|
return n(p.data, null), e;
|
|
8361
8378
|
}), R = r(() => Array.from(I.value.keys())), z = r(() => {
|
|
8362
8379
|
let e = /* @__PURE__ */ new Map();
|
|
8363
|
-
if (
|
|
8380
|
+
if (ue.value) for (let t of R.value) e.set(le(t, -1), t);
|
|
8364
8381
|
else p.data.forEach((t, n) => {
|
|
8365
|
-
e.set(
|
|
8382
|
+
e.set(le(t, n), j(t));
|
|
8366
8383
|
});
|
|
8367
8384
|
return e;
|
|
8368
|
-
}), B = r(() =>
|
|
8385
|
+
}), B = r(() => ue.value ? p.treeCheckMode : "strict"), V = r(() => B.value !== "strict"), U = (e) => O.value.has(j(e)), ee = r(() => {
|
|
8369
8386
|
let e = V.value ? R.value : b.value;
|
|
8370
8387
|
return e.length === 0 ? !1 : e.every((e) => O.value.has(j(e)));
|
|
8371
8388
|
}), G = r(() => {
|
|
@@ -8377,7 +8394,7 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8377
8394
|
if (!t || t.descendants.length === 0) return !1;
|
|
8378
8395
|
let n = t.descendants.filter((e) => O.value.has(e)).length;
|
|
8379
8396
|
return n > 0 && n < t.descendants.length;
|
|
8380
|
-
}, Y = r(() => V.value ? R.value.filter((e) => J(e)) : []), X = (e) => e.map((e) =>
|
|
8397
|
+
}, Y = r(() => V.value ? R.value.filter((e) => J(e)) : []), X = (e) => e.map((e) => le(e, -1)), te = (e) => {
|
|
8381
8398
|
let t = O.value;
|
|
8382
8399
|
if (t.size !== e.length) return !1;
|
|
8383
8400
|
let n = z.value;
|
|
@@ -8446,75 +8463,81 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8446
8463
|
let t = se.value;
|
|
8447
8464
|
se.value = e, m("current-change", e, t);
|
|
8448
8465
|
}
|
|
8449
|
-
}, ce = (e, t) =>
|
|
8450
|
-
|
|
8466
|
+
}, ce = (e, t) => {
|
|
8467
|
+
let n = p.rowClassName;
|
|
8468
|
+
return typeof n == "function" ? n({
|
|
8469
|
+
row: e,
|
|
8470
|
+
rowIndex: t
|
|
8471
|
+
}) : n;
|
|
8472
|
+
}, le = (e, t) => typeof p.rowKey == "function" ? p.rowKey(e) : e[p.rowKey] ?? t, ue = r(() => !!p.treeProps), de = r(() => p.treeProps?.children || "children"), fe = r(() => p.treeProps?.hasChildren || ""), pe = D(/* @__PURE__ */ new Set()), me = () => {
|
|
8473
|
+
if (ue.value && p.defaultExpandAll) {
|
|
8451
8474
|
let e = /* @__PURE__ */ new Set(), t = (n) => {
|
|
8452
8475
|
for (let r of n) {
|
|
8453
|
-
let n =
|
|
8476
|
+
let n = le(r, -1), i = r[de.value];
|
|
8454
8477
|
i && i.length > 0 && (e.add(n), t(i));
|
|
8455
8478
|
}
|
|
8456
8479
|
};
|
|
8457
|
-
t(p.data),
|
|
8480
|
+
t(p.data), pe.value = e;
|
|
8458
8481
|
}
|
|
8459
8482
|
};
|
|
8460
|
-
H(() => p.data,
|
|
8483
|
+
H(() => p.data, me, { immediate: !0 }), H(() => p.checkedKeys, (e) => {
|
|
8461
8484
|
e !== void 0 && Q(e);
|
|
8462
8485
|
}, { immediate: !0 }), H(z, () => {
|
|
8463
8486
|
p.checkedKeys !== void 0 && Q(p.checkedKeys);
|
|
8464
|
-
}), H(() => p.defaultExpandAll,
|
|
8465
|
-
let
|
|
8466
|
-
if (
|
|
8467
|
-
let t = e[
|
|
8487
|
+
}), H(() => p.defaultExpandAll, me);
|
|
8488
|
+
let he = (e) => {
|
|
8489
|
+
if (fe.value && e[fe.value]) return !0;
|
|
8490
|
+
let t = e[de.value];
|
|
8468
8491
|
return Array.isArray(t) && t.length > 0;
|
|
8469
|
-
},
|
|
8470
|
-
let n =
|
|
8471
|
-
a ? r.add(n) : r.delete(n),
|
|
8472
|
-
},
|
|
8492
|
+
}, ge = (e, t) => {
|
|
8493
|
+
let n = le(e, -1), r = new Set(pe.value), i = r.has(n), a = t === void 0 ? !i : t;
|
|
8494
|
+
a ? r.add(n) : r.delete(n), pe.value = r, m("expand-change", e, a);
|
|
8495
|
+
}, _e = () => {
|
|
8473
8496
|
let e = /* @__PURE__ */ new Set(), t = (n) => {
|
|
8474
8497
|
for (let r of n) {
|
|
8475
|
-
let n =
|
|
8476
|
-
if (
|
|
8498
|
+
let n = le(r, -1);
|
|
8499
|
+
if (he(r)) {
|
|
8477
8500
|
e.add(n);
|
|
8478
|
-
let i = r[
|
|
8501
|
+
let i = r[de.value];
|
|
8479
8502
|
Array.isArray(i) && t(i);
|
|
8480
8503
|
}
|
|
8481
8504
|
}
|
|
8482
8505
|
};
|
|
8483
|
-
t(p.data),
|
|
8484
|
-
},
|
|
8485
|
-
|
|
8486
|
-
},
|
|
8487
|
-
if (!
|
|
8506
|
+
t(p.data), pe.value = e;
|
|
8507
|
+
}, ve = () => {
|
|
8508
|
+
pe.value = /* @__PURE__ */ new Set();
|
|
8509
|
+
}, be = r(() => {
|
|
8510
|
+
if (!ue.value) return [];
|
|
8488
8511
|
let e = [], t = (n, r) => {
|
|
8489
8512
|
for (let i of n) {
|
|
8490
|
-
let n =
|
|
8513
|
+
let n = le(i, -1), a = he(i), o = pe.value.has(n);
|
|
8491
8514
|
if (e.push({
|
|
8492
8515
|
row: i,
|
|
8493
8516
|
level: r,
|
|
8494
8517
|
hasChildren: a,
|
|
8495
8518
|
expanded: o
|
|
8496
8519
|
}), a && o) {
|
|
8497
|
-
let e = i[
|
|
8520
|
+
let e = i[de.value];
|
|
8498
8521
|
Array.isArray(e) && t(e, r + 1);
|
|
8499
8522
|
}
|
|
8500
8523
|
}
|
|
8501
8524
|
};
|
|
8502
8525
|
return t(b.value, 0), e;
|
|
8503
|
-
}),
|
|
8526
|
+
}), xe = r(() => ue.value ? be.value.map((e) => e.row) : b.value), Se = (e) => be.value.find((t) => t.row === e), Ce = (e) => {
|
|
8504
8527
|
let t = g.value.filter((e) => e.columnType === "default");
|
|
8505
8528
|
return t.length > 0 && t[0].id === e.id;
|
|
8506
|
-
},
|
|
8507
|
-
let t =
|
|
8508
|
-
return
|
|
8509
|
-
},
|
|
8510
|
-
if (p.loading || p.disabled || !
|
|
8511
|
-
let n =
|
|
8512
|
-
a ? r.add(n) : r.delete(n),
|
|
8529
|
+
}, we = D(/* @__PURE__ */ new Set()), Te = r(() => g.value.find((e) => e.columnType === "expand")), Ee = (e) => Te.value ? typeof p.rowExpandable == "function" ? p.rowExpandable(e) : !0 : !1, De = (e) => {
|
|
8530
|
+
let t = le(e, -1);
|
|
8531
|
+
return we.value.has(t);
|
|
8532
|
+
}, Oe = (e, t) => {
|
|
8533
|
+
if (p.loading || p.disabled || !Ee(e)) return;
|
|
8534
|
+
let n = le(e, -1), r = new Set(we.value), i = r.has(n), a = t === void 0 ? !i : t;
|
|
8535
|
+
a ? r.add(n) : r.delete(n), we.value = r, m("expand-change", e, a);
|
|
8513
8536
|
};
|
|
8514
8537
|
H(() => p.expandRowKeys, (e) => {
|
|
8515
|
-
e !== void 0 && (
|
|
8538
|
+
e !== void 0 && (we.value = new Set(e));
|
|
8516
8539
|
}, { immediate: !0 });
|
|
8517
|
-
let
|
|
8540
|
+
let ke = r(() => [
|
|
8518
8541
|
h.b(),
|
|
8519
8542
|
q(p.size) && h.m(p.size),
|
|
8520
8543
|
h.m(`type-${p.type}`),
|
|
@@ -8524,20 +8547,20 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8524
8547
|
h.is("scrollable", !!(p.height || p.maxHeight)),
|
|
8525
8548
|
h.is("loading", p.loading),
|
|
8526
8549
|
h.is("disabled", p.disabled)
|
|
8527
|
-
]),
|
|
8550
|
+
]), Ae = r(() => p.color ? p.color : p.type && p.type !== "default" ? `var(--cp-color-${p.type})` : null), je = r(() => p.color ? {
|
|
8528
8551
|
"--cp-table-color": p.color,
|
|
8529
8552
|
"--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%)`,
|
|
8530
8553
|
"--cp-table-header-border-color": `color-mix(in srgb, ${p.color} 40%, transparent)`,
|
|
8531
8554
|
"--cp-table-row-hover-bg": `color-mix(in srgb, ${p.color} 6%, transparent)`,
|
|
8532
8555
|
"--cp-table-row-current-bg": `color-mix(in srgb, ${p.color} 10%, transparent)`,
|
|
8533
8556
|
"--cp-table-row-selected-bg": `color-mix(in srgb, ${p.color} 8%, transparent)`
|
|
8534
|
-
} : {}),
|
|
8557
|
+
} : {}), Me = r(() => p.color || p.type === "default" ? void 0 : p.type), Ne = r(() => p.color || void 0), Pe = r(() => {
|
|
8535
8558
|
let e = {};
|
|
8536
8559
|
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;
|
|
8537
|
-
}),
|
|
8560
|
+
}), Fe = (e) => {
|
|
8538
8561
|
let t = {};
|
|
8539
8562
|
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;
|
|
8540
|
-
},
|
|
8563
|
+
}, Ie = (e, t) => t.prop ? t.prop.split(".").reduce((e, t) => e?.[t], e) : "", Le = (e) => e === "center" ? h.m("align-center") : e === "right" ? h.m("align-right") : "";
|
|
8541
8564
|
return d({
|
|
8542
8565
|
clearSelection: () => {
|
|
8543
8566
|
ne(/* @__PURE__ */ new Set());
|
|
@@ -8574,13 +8597,13 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8574
8597
|
let t = se.value;
|
|
8575
8598
|
se.value = e, m("current-change", e, t);
|
|
8576
8599
|
},
|
|
8577
|
-
toggleRowExpansion:
|
|
8578
|
-
expandAll:
|
|
8579
|
-
collapseAll:
|
|
8580
|
-
toggleRowExpand:
|
|
8600
|
+
toggleRowExpansion: ge,
|
|
8601
|
+
expandAll: _e,
|
|
8602
|
+
collapseAll: ve,
|
|
8603
|
+
toggleRowExpand: Oe
|
|
8581
8604
|
}), (t, r) => (w(), o("div", {
|
|
8582
|
-
class: y(
|
|
8583
|
-
style: x(
|
|
8605
|
+
class: y(ke.value),
|
|
8606
|
+
style: x(je.value)
|
|
8584
8607
|
}, [
|
|
8585
8608
|
s("div", po, [A(t.$slots, "default")]),
|
|
8586
8609
|
s("div", { class: y(L(h).e("wrapper")) }, [s("table", { class: y(L(h).e("inner")) }, [t.showHeader ? (w(), o("thead", {
|
|
@@ -8592,16 +8615,16 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8592
8615
|
L(h).e("header-cell"),
|
|
8593
8616
|
t.sortable && L(h).is("sortable", !0),
|
|
8594
8617
|
C(t),
|
|
8595
|
-
|
|
8618
|
+
Le(t.headerAlign || t.align)
|
|
8596
8619
|
]),
|
|
8597
|
-
style: x(
|
|
8620
|
+
style: x(Fe(t)),
|
|
8598
8621
|
onClick: (e) => t.sortable ? S(t) : void 0
|
|
8599
8622
|
}, [t.columnType === "selection" ? (w(), i(mi, {
|
|
8600
8623
|
key: 0,
|
|
8601
8624
|
"model-value": ee.value,
|
|
8602
8625
|
indeterminate: G.value,
|
|
8603
|
-
type:
|
|
8604
|
-
color:
|
|
8626
|
+
type: Me.value,
|
|
8627
|
+
color: Ne.value,
|
|
8605
8628
|
onChange: ae,
|
|
8606
8629
|
onClick: r[0] ||= K(() => {}, ["stop"])
|
|
8607
8630
|
}, null, 8, [
|
|
@@ -8644,26 +8667,27 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8644
8667
|
fill: "currentColor"
|
|
8645
8668
|
}, null, -1)]], 2))], 2)) : a("", !0)], 64))], 14, mo))), 128))], 2)], 2)) : a("", !0), s("tbody", {
|
|
8646
8669
|
class: y(L(h).e("body")),
|
|
8647
|
-
style: x(
|
|
8648
|
-
}, [
|
|
8670
|
+
style: x(Pe.value)
|
|
8671
|
+
}, [xe.value.length > 0 ? (w(!0), o(e, { key: 0 }, k(xe.value, (n, c) => (w(), o(e, { key: le(n, c) }, [s("tr", {
|
|
8649
8672
|
class: y([
|
|
8650
8673
|
L(h).e("row"),
|
|
8651
8674
|
L(h).is("striped", t.stripe && c % 2 == 1),
|
|
8652
8675
|
L(h).is("current", t.highlightCurrentRow && se.value === n),
|
|
8653
8676
|
L(h).is("selected", U(n)),
|
|
8654
|
-
L(h).is("expanded",
|
|
8677
|
+
L(h).is("expanded", Te.value && De(n)),
|
|
8678
|
+
ce(n, c)
|
|
8655
8679
|
]),
|
|
8656
8680
|
onClick: (e) => $(n, c, e)
|
|
8657
8681
|
}, [(w(!0), o(e, null, k(g.value, (u) => (w(), o("td", {
|
|
8658
8682
|
key: u.id,
|
|
8659
|
-
class: y([L(h).e("cell"),
|
|
8660
|
-
style: x(
|
|
8683
|
+
class: y([L(h).e("cell"), Le(u.align)]),
|
|
8684
|
+
style: x(Fe(u))
|
|
8661
8685
|
}, [u.columnType === "selection" ? (w(), i(mi, {
|
|
8662
8686
|
key: 0,
|
|
8663
8687
|
"model-value": U(n),
|
|
8664
8688
|
indeterminate: J(n),
|
|
8665
|
-
type:
|
|
8666
|
-
color:
|
|
8689
|
+
type: Me.value,
|
|
8690
|
+
color: Ne.value,
|
|
8667
8691
|
onChange: (e) => ie(n),
|
|
8668
8692
|
onClick: r[1] ||= K(() => {}, ["stop"])
|
|
8669
8693
|
}, null, 8, [
|
|
@@ -8672,28 +8696,28 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8672
8696
|
"type",
|
|
8673
8697
|
"color",
|
|
8674
8698
|
"onChange"
|
|
8675
|
-
])) : u.columnType === "expand" ? (w(), o(e, { key: 1 }, [
|
|
8699
|
+
])) : u.columnType === "expand" ? (w(), o(e, { key: 1 }, [Ee(n) ? (w(), o("span", {
|
|
8676
8700
|
key: 0,
|
|
8677
|
-
class: y([L(h).e("expand-trigger"), L(h).is("expanded",
|
|
8678
|
-
onClick: K((e) =>
|
|
8701
|
+
class: y([L(h).e("expand-trigger"), L(h).is("expanded", De(n))]),
|
|
8702
|
+
onClick: K((e) => Oe(n), ["stop"])
|
|
8679
8703
|
}, [...r[4] ||= [s("svg", {
|
|
8680
8704
|
viewBox: "0 0 16 16",
|
|
8681
8705
|
width: "14",
|
|
8682
8706
|
height: "14",
|
|
8683
8707
|
fill: "currentColor"
|
|
8684
|
-
}, [s("path", { d: "M6 3l5 5-5 5V3z" })], -1)]], 10, go)) : a("", !0)], 64)) : u.columnType === "index" ? (w(), o(e, { key: 2 }, [l(P(c + 1), 1)], 64)) :
|
|
8708
|
+
}, [s("path", { d: "M6 3l5 5-5 5V3z" })], -1)]], 10, go)) : a("", !0)], 64)) : u.columnType === "index" ? (w(), o(e, { key: 2 }, [l(P(c + 1), 1)], 64)) : ue.value && Ce(u) ? (w(), o("div", {
|
|
8685
8709
|
key: 3,
|
|
8686
8710
|
class: y(L(h).e("tree-cell"))
|
|
8687
8711
|
}, [
|
|
8688
|
-
|
|
8712
|
+
Se(n) ? (w(), o("span", {
|
|
8689
8713
|
key: 0,
|
|
8690
8714
|
class: y(L(h).e("tree-indent")),
|
|
8691
|
-
style: x({ width: `${(
|
|
8715
|
+
style: x({ width: `${(Se(n)?.level || 0) * t.indent}px` })
|
|
8692
8716
|
}, null, 6)) : a("", !0),
|
|
8693
|
-
|
|
8717
|
+
Se(n)?.hasChildren ? (w(), o("span", {
|
|
8694
8718
|
key: 1,
|
|
8695
|
-
class: y([L(h).e("expand-icon"), L(h).is("expanded",
|
|
8696
|
-
onClick: K((e) =>
|
|
8719
|
+
class: y([L(h).e("expand-icon"), L(h).is("expanded", Se(n)?.expanded)]),
|
|
8720
|
+
onClick: K((e) => ge(n), ["stop"])
|
|
8697
8721
|
}, [...r[5] ||= [s("svg", {
|
|
8698
8722
|
viewBox: "0 0 16 16",
|
|
8699
8723
|
width: "14",
|
|
@@ -8707,18 +8731,18 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8707
8731
|
row: n,
|
|
8708
8732
|
column: u,
|
|
8709
8733
|
$index: c
|
|
8710
|
-
}) }), { key: 0 })) : (w(), o(e, { key: 1 }, [l(P(
|
|
8734
|
+
}) }), { key: 0 })) : (w(), o(e, { key: 1 }, [l(P(Ie(n, u)), 1)], 64))], 2)
|
|
8711
8735
|
], 2)) : u.slots.default ? (w(), i(M({ render: () => u.slots.default({
|
|
8712
8736
|
row: n,
|
|
8713
8737
|
column: u,
|
|
8714
8738
|
$index: c
|
|
8715
|
-
}) }), { key: 4 })) : (w(), o(e, { key: 5 }, [l(P(
|
|
8739
|
+
}) }), { key: 4 })) : (w(), o(e, { key: 5 }, [l(P(Ie(n, u)), 1)], 64))], 6))), 128))], 10, ho), Te.value && De(n) ? (w(), o("tr", {
|
|
8716
8740
|
key: 0,
|
|
8717
8741
|
class: y(L(h).e("expanded-row"))
|
|
8718
8742
|
}, [s("td", {
|
|
8719
8743
|
colspan: g.value.length,
|
|
8720
8744
|
class: y(L(h).e("expanded-cell"))
|
|
8721
|
-
}, [s("div", { class: y(L(h).e("expanded-content")) }, [
|
|
8745
|
+
}, [s("div", { class: y(L(h).e("expanded-content")) }, [Te.value?.slots.default ? (w(), i(M({ render: () => Te.value.slots.default({
|
|
8722
8746
|
row: n,
|
|
8723
8747
|
$index: c
|
|
8724
8748
|
}) }), { key: 0 })) : a("", !0)], 2)], 10, vo)], 2)) : a("", !0)], 64))), 128)) : (w(), o("tr", {
|
|
@@ -8740,7 +8764,7 @@ var Ja = $(Ra), Ya = ce(Ga, "$notify"), Xa = /* @__PURE__ */ d({
|
|
|
8740
8764
|
default: W(() => [t.loading ? (w(), o("div", {
|
|
8741
8765
|
key: 0,
|
|
8742
8766
|
class: y(L(h).e("loading-overlay"))
|
|
8743
|
-
}, [A(t.$slots, "loading", {}, () => [u(L(ye), { color:
|
|
8767
|
+
}, [A(t.$slots, "loading", {}, () => [u(L(ye), { color: Ae.value || void 0 }, null, 8, ["color"]), t.loadingText ? (w(), o("span", {
|
|
8744
8768
|
key: 0,
|
|
8745
8769
|
class: y(L(h).e("loading-text"))
|
|
8746
8770
|
}, P(t.loadingText), 3)) : a("", !0)])], 2)) : a("", !0)]),
|
package/dist/table/index.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
38
38
|
readonly type: BooleanConstructor;
|
|
39
39
|
readonly default: false;
|
|
40
40
|
};
|
|
41
|
+
readonly rowClassName: {
|
|
42
|
+
readonly type: import('vue').PropType<import('.').TableRowClassName>;
|
|
43
|
+
readonly default: "";
|
|
44
|
+
};
|
|
41
45
|
readonly height: {
|
|
42
46
|
readonly type: import('vue').PropType<string | number>;
|
|
43
47
|
};
|
|
@@ -158,6 +162,7 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
158
162
|
readonly indent: number;
|
|
159
163
|
readonly stripe: boolean;
|
|
160
164
|
readonly highlightCurrentRow: boolean;
|
|
165
|
+
readonly rowClassName: import('.').TableRowClassName;
|
|
161
166
|
readonly emptyText: string;
|
|
162
167
|
readonly rowKey: string | ((row: any) => string | number);
|
|
163
168
|
readonly treeProps: import('.').TableTreeProps;
|
|
@@ -198,6 +203,10 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
198
203
|
readonly type: BooleanConstructor;
|
|
199
204
|
readonly default: false;
|
|
200
205
|
};
|
|
206
|
+
readonly rowClassName: {
|
|
207
|
+
readonly type: import('vue').PropType<import('.').TableRowClassName>;
|
|
208
|
+
readonly default: "";
|
|
209
|
+
};
|
|
201
210
|
readonly height: {
|
|
202
211
|
readonly type: import('vue').PropType<string | number>;
|
|
203
212
|
};
|
|
@@ -309,6 +318,7 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
309
318
|
readonly indent: number;
|
|
310
319
|
readonly stripe: boolean;
|
|
311
320
|
readonly highlightCurrentRow: boolean;
|
|
321
|
+
readonly rowClassName: import('.').TableRowClassName;
|
|
312
322
|
readonly emptyText: string;
|
|
313
323
|
readonly rowKey: string | ((row: any) => string | number);
|
|
314
324
|
readonly treeProps: import('.').TableTreeProps;
|
|
@@ -346,6 +356,10 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
346
356
|
readonly type: BooleanConstructor;
|
|
347
357
|
readonly default: false;
|
|
348
358
|
};
|
|
359
|
+
readonly rowClassName: {
|
|
360
|
+
readonly type: import('vue').PropType<import('.').TableRowClassName>;
|
|
361
|
+
readonly default: "";
|
|
362
|
+
};
|
|
349
363
|
readonly height: {
|
|
350
364
|
readonly type: import('vue').PropType<string | number>;
|
|
351
365
|
};
|
|
@@ -466,6 +480,7 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
|
|
|
466
480
|
readonly indent: number;
|
|
467
481
|
readonly stripe: boolean;
|
|
468
482
|
readonly highlightCurrentRow: boolean;
|
|
483
|
+
readonly rowClassName: import('.').TableRowClassName;
|
|
469
484
|
readonly emptyText: string;
|
|
470
485
|
readonly rowKey: string | ((row: any) => string | number);
|
|
471
486
|
readonly treeProps: import('.').TableTreeProps;
|
|
@@ -48,6 +48,23 @@ export interface SelectionDetail {
|
|
|
48
48
|
* 具体形态由 `selectionPayload` prop 决定
|
|
49
49
|
*/
|
|
50
50
|
export type SelectionPayload = any[] | (string | number)[] | SelectionDetail;
|
|
51
|
+
/**
|
|
52
|
+
* 行 class 绑定值,保持与 Vue `:class` 支持的形态一致
|
|
53
|
+
*/
|
|
54
|
+
export type TableRowClassValue = string | string[] | Record<string, boolean> | null | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* rowClassName 函数参数
|
|
57
|
+
*/
|
|
58
|
+
export interface TableRowClassNameParams {
|
|
59
|
+
/** 当前行数据 */
|
|
60
|
+
row: any;
|
|
61
|
+
/** 当前渲染行索引(树形表格下为展开后的可见行索引) */
|
|
62
|
+
rowIndex: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 行 class 配置
|
|
66
|
+
*/
|
|
67
|
+
export type TableRowClassName = TableRowClassValue | ((params: TableRowClassNameParams) => TableRowClassValue);
|
|
51
68
|
/**
|
|
52
69
|
* 树形数据配置
|
|
53
70
|
*/
|
|
@@ -135,6 +152,15 @@ export interface TableColumnConfig {
|
|
|
135
152
|
* </CpTableColumn>
|
|
136
153
|
* <CpTableColumn prop="name" label="姓名" />
|
|
137
154
|
* </CpTable>
|
|
155
|
+
*
|
|
156
|
+
* <!-- 行状态高亮:按业务条件返回 class -->
|
|
157
|
+
* <CpTable
|
|
158
|
+
* :data="tableData"
|
|
159
|
+
* :row-class-name="({ row }) => row.status === 'error' ? 'is-error-row' : ''"
|
|
160
|
+
* >
|
|
161
|
+
* <CpTableColumn prop="name" label="姓名" />
|
|
162
|
+
* <CpTableColumn prop="status" label="状态" />
|
|
163
|
+
* </CpTable>
|
|
138
164
|
* ```
|
|
139
165
|
*/
|
|
140
166
|
export declare const tableProps: {
|
|
@@ -185,6 +211,25 @@ export declare const tableProps: {
|
|
|
185
211
|
readonly type: BooleanConstructor;
|
|
186
212
|
readonly default: false;
|
|
187
213
|
};
|
|
214
|
+
/**
|
|
215
|
+
* 行 class 名
|
|
216
|
+
*
|
|
217
|
+
* 可传字符串、数组、对象,或函数按行动态返回 class。函数参数包含当前行数据与渲染索引。
|
|
218
|
+
* 常用于根据业务状态高亮一行或多行;组件内置可直接使用的状态类:
|
|
219
|
+
* `is-success-row`、`is-warning-row`、`is-error-row`、`is-info-row`。
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```vue
|
|
223
|
+
* <CpTable
|
|
224
|
+
* :data="tableData"
|
|
225
|
+
* :row-class-name="({ row }) => row.status === 'offline' ? 'is-error-row' : ''"
|
|
226
|
+
* />
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
readonly rowClassName: {
|
|
230
|
+
readonly type: PropType<TableRowClassName>;
|
|
231
|
+
readonly default: "";
|
|
232
|
+
};
|
|
188
233
|
/**
|
|
189
234
|
* 固定高度 (启用固定表头)
|
|
190
235
|
*/
|
|
@@ -35,6 +35,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
35
35
|
readonly type: BooleanConstructor;
|
|
36
36
|
readonly default: false;
|
|
37
37
|
};
|
|
38
|
+
readonly rowClassName: {
|
|
39
|
+
readonly type: import('vue').PropType<import('./table').TableRowClassName>;
|
|
40
|
+
readonly default: "";
|
|
41
|
+
};
|
|
38
42
|
readonly height: {
|
|
39
43
|
readonly type: import('vue').PropType<string | number>;
|
|
40
44
|
};
|
|
@@ -169,6 +173,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
169
173
|
readonly type: BooleanConstructor;
|
|
170
174
|
readonly default: false;
|
|
171
175
|
};
|
|
176
|
+
readonly rowClassName: {
|
|
177
|
+
readonly type: import('vue').PropType<import('./table').TableRowClassName>;
|
|
178
|
+
readonly default: "";
|
|
179
|
+
};
|
|
172
180
|
readonly height: {
|
|
173
181
|
readonly type: import('vue').PropType<string | number>;
|
|
174
182
|
};
|
|
@@ -266,6 +274,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
266
274
|
readonly indent: number;
|
|
267
275
|
readonly stripe: boolean;
|
|
268
276
|
readonly highlightCurrentRow: boolean;
|
|
277
|
+
readonly rowClassName: import('./table').TableRowClassName;
|
|
269
278
|
readonly emptyText: string;
|
|
270
279
|
readonly rowKey: string | ((row: any) => string | number);
|
|
271
280
|
readonly treeProps: import('./table').TableTreeProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberpunk-vue/components",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.3",
|
|
4
4
|
"description": "Cyberpunk Vue components - A futuristic Vue 3 component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@floating-ui/dom": "^1.7.6",
|
|
27
|
-
"@cyberpunk-vue/
|
|
28
|
-
"@cyberpunk-vue/
|
|
29
|
-
"@cyberpunk-vue/
|
|
27
|
+
"@cyberpunk-vue/constants": "1.13.3",
|
|
28
|
+
"@cyberpunk-vue/hooks": "1.13.3",
|
|
29
|
+
"@cyberpunk-vue/theme-chalk": "1.13.3"
|
|
30
30
|
},
|
|
31
31
|
"author": "Juxest",
|
|
32
32
|
"license": "MIT",
|