@gulibs/react-vtable 0.0.14 → 0.0.15
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 +4 -4
- package/dist/index.js +131 -129
- package/dist/pro-table.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
47
47
|
["partial", x],
|
|
48
48
|
["partialRight", S],
|
|
49
49
|
["rearg", w]
|
|
50
|
-
], me = "[object Arguments]", he = "[object Array]", ge = "[object AsyncFunction]", D = "[object Boolean]", _e = "[object Date]", ve = "[object DOMException]", ye = "[object Error]", O = "[object Function]",
|
|
50
|
+
], me = "[object Arguments]", he = "[object Array]", ge = "[object AsyncFunction]", D = "[object Boolean]", _e = "[object Date]", ve = "[object DOMException]", ye = "[object Error]", O = "[object Function]", be = "[object GeneratorFunction]", k = "[object Map]", A = "[object Number]", xe = "[object Null]", Se = "[object Object]", Ce = "[object Promise]", we = "[object Proxy]", Te = "[object RegExp]", Ee = "[object Set]", De = "[object String]", Oe = "[object Symbol]", ke = "[object Undefined]", Ae = "[object WeakMap]", je = "[object WeakSet]", Me = "[object ArrayBuffer]", Ne = "[object DataView]", Pe = "[object Float32Array]", Fe = "[object Float64Array]", Ie = "[object Int8Array]", Le = "[object Int16Array]", Re = "[object Int32Array]", ze = "[object Uint8Array]", Be = "[object Uint8ClampedArray]", Ve = "[object Uint16Array]", He = "[object Uint32Array]", Ue = /\b__p \+= '';/g, We = /\b(__p \+=) '' \+/g, Ge = /(__e\(.*?\)|\b__t\)) \+\n'';/g, Ke = /&(?:amp|lt|gt|quot|#39);/g, qe = /[&<>"']/g, Je = RegExp(Ke.source), Ye = RegExp(qe.source), Xe = /<%-([\s\S]+?)%>/g, Ze = /<%([\s\S]+?)%>/g, Qe = /<%=([\s\S]+?)%>/g, $e = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, et = /^\w*$/, tt = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, nt = /[\\^$.*+?()[\]{}|]/g, rt = RegExp(nt.source), it = /^\s+/, j = /\s/, at = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, ot = /\{\n\/\* \[wrapped with (.+)\] \*/, st = /,? & /, ct = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, lt = /[()=,{}\[\]\/\s]/, ut = /\\(\\)?/g, dt = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, ft = /\w*$/, pt = /^[-+]0x[0-9a-f]+$/i, mt = /^0b[01]+$/i, ht = /^\[object .+?Constructor\]$/, gt = /^0o[0-7]+$/i, _t = /^(?:0|[1-9]\d*)$/, vt = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, yt = /($^)/, bt = /['\n\r\u2028\u2029\\]/g, xt = "\\ud800-\\udfff", St = "\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff", Ct = "\\u2700-\\u27bf", M = "a-z\\xdf-\\xf6\\xf8-\\xff", wt = "\\xac\\xb1\\xd7\\xf7", Tt = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Et = "\\u2000-\\u206f", Dt = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Ot = "A-Z\\xc0-\\xd6\\xd8-\\xde", kt = "\\ufe0e\\ufe0f", At = wt + Tt + Et + Dt, jt = "['’]", N = "[" + xt + "]", Mt = "[" + At + "]", Nt = "[" + St + "]", Pt = "\\d+", Ft = "[" + Ct + "]", It = "[" + M + "]", Lt = "[^" + xt + At + Pt + Ct + M + Ot + "]", Rt = "\\ud83c[\\udffb-\\udfff]", zt = "(?:" + Nt + "|" + Rt + ")", Bt = "[^" + xt + "]", Vt = "(?:\\ud83c[\\udde6-\\uddff]){2}", Ht = "[\\ud800-\\udbff][\\udc00-\\udfff]", Ut = "[" + Ot + "]", Wt = "\\u200d", Gt = "(?:" + It + "|" + Lt + ")", Kt = "(?:" + Ut + "|" + Lt + ")", qt = "(?:" + jt + "(?:d|ll|m|re|s|t|ve))?", Jt = "(?:" + jt + "(?:D|LL|M|RE|S|T|VE))?", Yt = zt + "?", Xt = "[" + kt + "]?", Zt = "(?:" + Wt + "(?:" + [
|
|
51
51
|
Bt,
|
|
52
52
|
Vt,
|
|
53
53
|
Ht
|
|
@@ -79,9 +79,9 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
79
79
|
Pt,
|
|
80
80
|
tn
|
|
81
81
|
].join("|"), "g"), ln = RegExp("[" + Wt + xt + St + kt + "]"), P = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, un = /* @__PURE__ */ "Array.Buffer.DataView.Date.Error.Float32Array.Float64Array.Function.Int8Array.Int16Array.Int32Array.Map.Math.Object.Promise.RegExp.Set.String.Symbol.TypeError.Uint8Array.Uint8ClampedArray.Uint16Array.Uint32Array.WeakMap._.clearTimeout.isFinite.parseInt.setTimeout".split("."), dn = -1, F = {};
|
|
82
|
-
F[Pe] = F[Fe] = F[Ie] = F[Le] = F[Re] = F[ze] = F[Be] = F[Ve] = F[He] = !0, F[me] = F[he] = F[Me] = F[D] = F[Ne] = F[_e] = F[ye] = F[O] = F[
|
|
82
|
+
F[Pe] = F[Fe] = F[Ie] = F[Le] = F[Re] = F[ze] = F[Be] = F[Ve] = F[He] = !0, F[me] = F[he] = F[Me] = F[D] = F[Ne] = F[_e] = F[ye] = F[O] = F[k] = F[A] = F[Se] = F[Te] = F[Ee] = F[De] = F[Ae] = !1;
|
|
83
83
|
var I = {};
|
|
84
|
-
I[me] = I[he] = I[Me] = I[Ne] = I[D] = I[_e] = I[Pe] = I[Fe] = I[Ie] = I[Le] = I[Re] = I[
|
|
84
|
+
I[me] = I[he] = I[Me] = I[Ne] = I[D] = I[_e] = I[Pe] = I[Fe] = I[Ie] = I[Le] = I[Re] = I[k] = I[A] = I[Se] = I[Te] = I[Ee] = I[De] = I[Oe] = I[ze] = I[Be] = I[Ve] = I[He] = !0, I[ye] = I[O] = I[Ae] = !1;
|
|
85
85
|
var L = {
|
|
86
86
|
À: "A",
|
|
87
87
|
Á: "A",
|
|
@@ -789,7 +789,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
789
789
|
if (m) {
|
|
790
790
|
if (s = fs(e), !c) return mo(e, s);
|
|
791
791
|
} else {
|
|
792
|
-
var h = cs(e), g = h == O || h ==
|
|
792
|
+
var h = cs(e), g = h == O || h == be;
|
|
793
793
|
if (Su(e)) return ro(e, c);
|
|
794
794
|
if (h == Se || h == me || g && !a) {
|
|
795
795
|
if (s = l || g ? {} : ps(e), !c) return l ? _o(e, Ti(s, e)) : go(e, wi(s, e));
|
|
@@ -974,7 +974,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
974
974
|
return f ? (a ||= new ui(), qo(e, t, n, r, i, a)) : !1;
|
|
975
975
|
}
|
|
976
976
|
function oa(e) {
|
|
977
|
-
return Y(e) && cs(e) ==
|
|
977
|
+
return Y(e) && cs(e) == k;
|
|
978
978
|
}
|
|
979
979
|
function sa(e, t, r, i) {
|
|
980
980
|
var a = r.length, o = a, s = !i;
|
|
@@ -1581,7 +1581,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
1581
1581
|
function Bo(e) {
|
|
1582
1582
|
return function(t) {
|
|
1583
1583
|
var n = cs(t);
|
|
1584
|
-
return n ==
|
|
1584
|
+
return n == k ? _r(t) : n == Ee ? xr(t) : nr(t, e(t));
|
|
1585
1585
|
};
|
|
1586
1586
|
}
|
|
1587
1587
|
function Vo(e, t, r, i, a, s, c, l) {
|
|
@@ -1653,11 +1653,11 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
1653
1653
|
case Me: return !(e.byteLength != t.byteLength || !a(new Bt(e), new Bt(t)));
|
|
1654
1654
|
case D:
|
|
1655
1655
|
case _e:
|
|
1656
|
-
case
|
|
1656
|
+
case A: return hu(+e, +t);
|
|
1657
1657
|
case ye: return e.name == t.name && e.message == t.message;
|
|
1658
1658
|
case Te:
|
|
1659
1659
|
case De: return e == t + "";
|
|
1660
|
-
case
|
|
1660
|
+
case k: var s = _r;
|
|
1661
1661
|
case Ee:
|
|
1662
1662
|
var c = r & m;
|
|
1663
1663
|
if (s ||= br, e.size != t.size && !c) return !1;
|
|
@@ -1759,11 +1759,11 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
1759
1759
|
for (var t = []; e;) Ln(t, os(e)), e = Ht(e);
|
|
1760
1760
|
return t;
|
|
1761
1761
|
} : $f, cs = qi;
|
|
1762
|
-
(vn && cs(new vn(/* @__PURE__ */ new ArrayBuffer(1))) != Ne || yn && cs(new yn()) !=
|
|
1762
|
+
(vn && cs(new vn(/* @__PURE__ */ new ArrayBuffer(1))) != Ne || yn && cs(new yn()) != k || bn && cs(bn.resolve()) != Ce || Sn && cs(new Sn()) != Ee || z && cs(new z()) != Ae) && (cs = function(e) {
|
|
1763
1763
|
var t = qi(e), r = t == Se ? e.constructor : n, i = r ? Us(r) : "";
|
|
1764
1764
|
if (i) switch (i) {
|
|
1765
1765
|
case Sr: return Ne;
|
|
1766
|
-
case Or: return
|
|
1766
|
+
case Or: return k;
|
|
1767
1767
|
case kr: return Ce;
|
|
1768
1768
|
case Mr: return Ee;
|
|
1769
1769
|
case Nr: return Ae;
|
|
@@ -1829,8 +1829,8 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
1829
1829
|
case Be:
|
|
1830
1830
|
case Ve:
|
|
1831
1831
|
case He: return co(e, n);
|
|
1832
|
-
case
|
|
1833
|
-
case
|
|
1832
|
+
case k: return new r();
|
|
1833
|
+
case A:
|
|
1834
1834
|
case De: return new r(e);
|
|
1835
1835
|
case Te: return oo(e);
|
|
1836
1836
|
case Ee: return new r();
|
|
@@ -2382,7 +2382,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
2382
2382
|
if (e == null) return 0;
|
|
2383
2383
|
if (bu(e)) return Gu(e) ? wr(e) : e.length;
|
|
2384
2384
|
var t = cs(e);
|
|
2385
|
-
return t ==
|
|
2385
|
+
return t == k || t == Ee ? e.size : pa(e).length;
|
|
2386
2386
|
}
|
|
2387
2387
|
function Ll(e, t, r) {
|
|
2388
2388
|
var i = K(e) ? Bn : Ra;
|
|
@@ -2603,7 +2603,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
2603
2603
|
if (e == null) return !0;
|
|
2604
2604
|
if (bu(e) && (K(e) || typeof e == "string" || typeof e.splice == "function" || Su(e) || qu(e) || vu(e))) return !e.length;
|
|
2605
2605
|
var t = cs(e);
|
|
2606
|
-
if (t ==
|
|
2606
|
+
if (t == k || t == Ee) return !e.size;
|
|
2607
2607
|
if (ws(e)) return !pa(e).length;
|
|
2608
2608
|
for (var n in e) if (N.call(e, n)) return !1;
|
|
2609
2609
|
return !0;
|
|
@@ -2627,7 +2627,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
2627
2627
|
function Au(e) {
|
|
2628
2628
|
if (!J(e)) return !1;
|
|
2629
2629
|
var t = qi(e);
|
|
2630
|
-
return t == O || t ==
|
|
2630
|
+
return t == O || t == be || t == ge || t == we;
|
|
2631
2631
|
}
|
|
2632
2632
|
function ju(e) {
|
|
2633
2633
|
return typeof e == "number" && e == Z(e);
|
|
@@ -2663,7 +2663,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
2663
2663
|
return e == null;
|
|
2664
2664
|
}
|
|
2665
2665
|
function Bu(e) {
|
|
2666
|
-
return typeof e == "number" || Y(e) && qi(e) ==
|
|
2666
|
+
return typeof e == "number" || Y(e) && qi(e) == A;
|
|
2667
2667
|
}
|
|
2668
2668
|
function Vu(e) {
|
|
2669
2669
|
if (!Y(e) || qi(e) != Se) return !1;
|
|
@@ -2701,7 +2701,7 @@ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDes
|
|
|
2701
2701
|
if (bu(e)) return Gu(e) ? Tr(e) : mo(e);
|
|
2702
2702
|
if (qt && e[qt]) return gr(e[qt]());
|
|
2703
2703
|
var t = cs(e);
|
|
2704
|
-
return (t ==
|
|
2704
|
+
return (t == k ? _r : t == Ee ? br : Gd)(e);
|
|
2705
2705
|
}
|
|
2706
2706
|
function ed(e) {
|
|
2707
2707
|
return e ? (e = nd(e), e === oe || e === -oe ? (e < 0 ? -1 : 1) * ce : e === e ? e : 0) : e === 0 ? e : 0;
|
|
@@ -4084,7 +4084,7 @@ function useProTable(e) {
|
|
|
4084
4084
|
payload: e
|
|
4085
4085
|
});
|
|
4086
4086
|
}, [x, T.total]);
|
|
4087
|
-
let
|
|
4087
|
+
let be = useMemo(() => t.filter((e) => !e.hideInTable).map((e) => ({
|
|
4088
4088
|
id: e.key || String(e.dataIndex),
|
|
4089
4089
|
accessorKey: e.dataIndex,
|
|
4090
4090
|
header: e.title,
|
|
@@ -4111,9 +4111,9 @@ function useProTable(e) {
|
|
|
4111
4111
|
return t ? parseFloat(t[1]) : parseInt(String(e.width)) || 100;
|
|
4112
4112
|
})() : 100 : e.fixed ? 100 : void 0,
|
|
4113
4113
|
...e
|
|
4114
|
-
})), [t]),
|
|
4114
|
+
})), [t]), k = useReactTable({
|
|
4115
4115
|
data: T.data,
|
|
4116
|
-
columns:
|
|
4116
|
+
columns: be,
|
|
4117
4117
|
state: {
|
|
4118
4118
|
sorting: ie,
|
|
4119
4119
|
columnFilters: oe,
|
|
@@ -4139,7 +4139,7 @@ function useProTable(e) {
|
|
|
4139
4139
|
pageCount: Math.ceil(T.total / T.pageSize),
|
|
4140
4140
|
columnResizeMode: "onChange",
|
|
4141
4141
|
enableColumnPinning: !0
|
|
4142
|
-
}),
|
|
4142
|
+
}), A = useCallback((e, t) => {
|
|
4143
4143
|
r ? (E({
|
|
4144
4144
|
type: "SET_PAGINATION",
|
|
4145
4145
|
payload: {
|
|
@@ -4243,12 +4243,12 @@ function useProTable(e) {
|
|
|
4243
4243
|
}
|
|
4244
4244
|
});
|
|
4245
4245
|
}, [n, x]), {
|
|
4246
|
-
table:
|
|
4246
|
+
table: k,
|
|
4247
4247
|
state: T,
|
|
4248
4248
|
dispatch: E,
|
|
4249
4249
|
actions: Ce,
|
|
4250
4250
|
handlers: {
|
|
4251
|
-
handlePaginationChange:
|
|
4251
|
+
handlePaginationChange: A,
|
|
4252
4252
|
handleSearch: xe,
|
|
4253
4253
|
handleReset: Se
|
|
4254
4254
|
}
|
|
@@ -6242,51 +6242,53 @@ function DraggableRow({ row: e, children: t }) {
|
|
|
6242
6242
|
});
|
|
6243
6243
|
}
|
|
6244
6244
|
const ProTable = forwardRef((e, t) => {
|
|
6245
|
-
let { columns: r = [], className: i, classNames: o, style: l, tableStyle: u, size: d = "middle", bordered: m = !1, loading: h = !1, toolbar: g, pagination: _, paginationRender: v, rowSelection: y, draggable: b, editable: x, headerTitle: S, headerSubTitle: C, footer: ne, onRow: T, search: E, cardBordered: re = !1, cardProps: ie, tableRender: ce, tableExtraRender: le, emptyRender: ue, onSubmit: de, onReset: fe, scroll: pe, sticky: me, tableLayout: he, locale: ge, expandable: D, rowKey: _e = "id" } = e, [
|
|
6245
|
+
let { columns: r = [], className: i, classNames: o, style: l, tableStyle: u, size: d = "middle", bordered: m = !1, loading: h = !1, toolbar: g, pagination: _, paginationRender: v, rowSelection: y, draggable: b, editable: x, headerTitle: S, headerSubTitle: C, footer: ne, onRow: T, search: E, cardBordered: re = !1, cardProps: ie, tableRender: ce, tableExtraRender: le, emptyRender: ue, onSubmit: de, onReset: fe, scroll: pe, sticky: me, tableLayout: he, locale: ge, expandable: D, rowKey: _e = "id", actionRef: ve } = e, [ye, O] = useState(() => r);
|
|
6246
6246
|
useEffect(() => {
|
|
6247
|
-
|
|
6247
|
+
O(r);
|
|
6248
6248
|
}, [r]);
|
|
6249
|
-
let
|
|
6249
|
+
let be = {
|
|
6250
6250
|
...e,
|
|
6251
|
-
columns:
|
|
6252
|
-
}, { table: k, state: A, actions:
|
|
6253
|
-
columns:
|
|
6251
|
+
columns: ye
|
|
6252
|
+
}, { table: k, state: A, actions: xe, handlers: Se } = useProTable(be), { request: Ce } = be, { visibleColumns: we, setVisibleColumns: Te, columnSettings: Ee, updateColumnSettings: De } = useColumns({
|
|
6253
|
+
columns: ye,
|
|
6254
6254
|
rowSelection: !!y,
|
|
6255
6255
|
draggable: !!b,
|
|
6256
6256
|
editable: !!x
|
|
6257
|
-
}),
|
|
6257
|
+
}), Oe = D !== !1 && D !== void 0, ke = D !== !1 && D !== void 0 && D.childrenColumnName || "children", Ae = typeof _e == "function" ? _e : (e) => e[_e] || e.id || e.key, je = useCallback((e) => {
|
|
6258
6258
|
let t = [];
|
|
6259
6259
|
return e.forEach((e) => {
|
|
6260
|
-
t.push(
|
|
6261
|
-
let n = e[
|
|
6262
|
-
n && Array.isArray(n) && n.length > 0 && t.push(...
|
|
6260
|
+
t.push(Ae(e));
|
|
6261
|
+
let n = e[ke];
|
|
6262
|
+
n && Array.isArray(n) && n.length > 0 && t.push(...je(n));
|
|
6263
6263
|
}), t;
|
|
6264
|
-
}, [
|
|
6264
|
+
}, [ke, Ae]), [Me, Ne] = useState(() => D !== !1 && D !== void 0 && D.defaultExpandAllRows && A.data.length > 0 ? je(A.data) : D !== !1 && D !== void 0 && D.defaultExpandedRowKeys || []), Pe = D !== !1 && D !== void 0 ? D.expandedRowKeys ?? Me : Me, Fe = D !== !1 && D !== void 0 && D.expandedRowKeys !== void 0;
|
|
6265
6265
|
useEffect(() => {
|
|
6266
|
-
D !== !1 && D !== void 0 && D.defaultExpandAllRows && A.data.length > 0 && !
|
|
6266
|
+
D !== !1 && D !== void 0 && D.defaultExpandAllRows && A.data.length > 0 && !Fe && Ne(je(A.data));
|
|
6267
6267
|
}, [
|
|
6268
6268
|
A.data,
|
|
6269
6269
|
D !== !1 && D !== void 0 ? D.defaultExpandAllRows : !1,
|
|
6270
|
-
|
|
6271
|
-
|
|
6270
|
+
je,
|
|
6271
|
+
Fe
|
|
6272
6272
|
]);
|
|
6273
|
-
let
|
|
6274
|
-
let n =
|
|
6275
|
-
r = D !== !1 && D !== void 0 && D.accordion ? t ? [n] : [] : t ? [...
|
|
6273
|
+
let Ie = useCallback((e, t) => {
|
|
6274
|
+
let n = Ae(e), r;
|
|
6275
|
+
r = D !== !1 && D !== void 0 && D.accordion ? t ? [n] : [] : t ? [...Pe, n] : Pe.filter((e) => e !== n), Fe || Ne(r), D !== !1 && D !== void 0 && (D.onExpand?.(t, e), D.onExpandedRowsChange?.(r));
|
|
6276
6276
|
}, [
|
|
6277
|
-
Ne,
|
|
6278
|
-
D,
|
|
6279
6277
|
Pe,
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6278
|
+
D,
|
|
6279
|
+
Fe,
|
|
6280
|
+
Ae
|
|
6281
|
+
]), Le = useCallback((e) => {
|
|
6282
|
+
let t = e[ke];
|
|
6283
6283
|
return !!(t && Array.isArray(t) && t.length > 0);
|
|
6284
|
-
}, [
|
|
6285
|
-
let t =
|
|
6286
|
-
return
|
|
6287
|
-
}, [
|
|
6288
|
-
useImperativeHandle(t, () =>
|
|
6289
|
-
|
|
6284
|
+
}, [ke]), Re = useCallback((e) => {
|
|
6285
|
+
let t = Ae(e);
|
|
6286
|
+
return Pe.includes(t);
|
|
6287
|
+
}, [Pe, Ae]), [ze, Be] = useState(d), [Ve, He] = useState(!1), Ue = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor));
|
|
6288
|
+
useImperativeHandle(t, () => xe, [xe]), useEffect(() => {
|
|
6289
|
+
ve && (typeof ve == "function" ? ve(xe) : ve && typeof ve == "object" && "current" in ve && (ve.current = xe));
|
|
6290
|
+
}, [xe, ve]);
|
|
6291
|
+
let We = (e) => {
|
|
6290
6292
|
if (b && typeof b == "object" && typeof b.onDragEnd == "function") {
|
|
6291
6293
|
let { active: t, over: n } = e;
|
|
6292
6294
|
if (!n || t.id === n.id) return;
|
|
@@ -6295,7 +6297,7 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6295
6297
|
let t = [...A.data], [n] = t.splice(i, 1);
|
|
6296
6298
|
t.splice(a, 0, n);
|
|
6297
6299
|
try {
|
|
6298
|
-
|
|
6300
|
+
xe.setTableData(t);
|
|
6299
6301
|
} catch {}
|
|
6300
6302
|
try {
|
|
6301
6303
|
b.onDragEnd({
|
|
@@ -6308,60 +6310,60 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6308
6310
|
} catch {}
|
|
6309
6311
|
}
|
|
6310
6312
|
}
|
|
6311
|
-
},
|
|
6313
|
+
}, Ge = () => {
|
|
6312
6314
|
try {
|
|
6313
6315
|
k.toggleAllRowsSelected?.(!1);
|
|
6314
6316
|
} catch {}
|
|
6315
|
-
|
|
6316
|
-
},
|
|
6317
|
-
|
|
6318
|
-
},
|
|
6319
|
-
|
|
6320
|
-
},
|
|
6317
|
+
xe.clearSelected();
|
|
6318
|
+
}, Ke = (e) => {
|
|
6319
|
+
Se.handleSearch(e), de?.(e);
|
|
6320
|
+
}, et = () => {
|
|
6321
|
+
Se.handleReset(), fe?.();
|
|
6322
|
+
}, nt = (e, t) => {
|
|
6321
6323
|
if (k.setColumnFilters((n) => {
|
|
6322
6324
|
let r = (Array.isArray(n) ? n : []).filter((t) => t.id !== e);
|
|
6323
6325
|
return t.length > 0 && r.push({
|
|
6324
6326
|
id: e,
|
|
6325
6327
|
value: t
|
|
6326
6328
|
}), r;
|
|
6327
|
-
}),
|
|
6329
|
+
}), Ce) {
|
|
6328
6330
|
let n = { ...A.filters };
|
|
6329
|
-
t.length > 0 ? n[e] = t : delete n[e],
|
|
6331
|
+
t.length > 0 ? n[e] = t : delete n[e], Se.handleSearch(n);
|
|
6330
6332
|
}
|
|
6331
|
-
},
|
|
6332
|
-
if (k.setColumnFilters((t) => (Array.isArray(t) ? t : []).filter((t) => t.id !== e)),
|
|
6333
|
+
}, it = (e) => {
|
|
6334
|
+
if (k.setColumnFilters((t) => (Array.isArray(t) ? t : []).filter((t) => t.id !== e)), Ce) {
|
|
6333
6335
|
let t = { ...A.filters };
|
|
6334
|
-
delete t[e],
|
|
6336
|
+
delete t[e], Se.handleSearch(t);
|
|
6335
6337
|
}
|
|
6336
|
-
},
|
|
6338
|
+
}, j = (e, t) => {
|
|
6337
6339
|
if (e === "order" && Array.isArray(t)) {
|
|
6338
|
-
|
|
6340
|
+
O(t);
|
|
6339
6341
|
return;
|
|
6340
6342
|
}
|
|
6341
6343
|
if (typeof e == "string" && t && t.fixed !== void 0) {
|
|
6342
6344
|
let n = e, r = t.fixed;
|
|
6343
|
-
|
|
6345
|
+
O((e) => e.map((e) => (e.key || String(e.dataIndex)) === n ? {
|
|
6344
6346
|
...e,
|
|
6345
6347
|
fixed: r
|
|
6346
6348
|
} : e));
|
|
6347
6349
|
return;
|
|
6348
6350
|
}
|
|
6349
|
-
|
|
6350
|
-
},
|
|
6351
|
+
De(e, t);
|
|
6352
|
+
}, at = {
|
|
6351
6353
|
small: "text-xs [&_th]:py-1.5 [&_td]:py-1",
|
|
6352
6354
|
middle: "text-sm [&_th]:py-2 [&_td]:py-2",
|
|
6353
6355
|
large: "text-base [&_th]:py-3 [&_td]:py-3"
|
|
6354
|
-
},
|
|
6355
|
-
let n = e.original, r =
|
|
6356
|
+
}, ot = ye.length + (y ? 1 : 0) + (b ? 1 : 0), st = (e, t = 0) => {
|
|
6357
|
+
let n = e.original, r = Ae(n) || e.original.id || e.original.key || e.id, i = A.editingKey === r;
|
|
6356
6358
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
6357
6359
|
/* @__PURE__ */ jsx(ExpandIcon, {
|
|
6358
6360
|
record: n,
|
|
6359
6361
|
indent: t,
|
|
6360
|
-
hasChild:
|
|
6361
|
-
expanded:
|
|
6362
|
+
hasChild: Le(n),
|
|
6363
|
+
expanded: Re(n),
|
|
6362
6364
|
expandable: D,
|
|
6363
|
-
isExpandable:
|
|
6364
|
-
onExpand:
|
|
6365
|
+
isExpandable: Oe,
|
|
6366
|
+
onExpand: Ie
|
|
6365
6367
|
}),
|
|
6366
6368
|
y && /* @__PURE__ */ jsx(TableCell, {
|
|
6367
6369
|
className: "w-8",
|
|
@@ -6372,7 +6374,7 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6372
6374
|
})
|
|
6373
6375
|
}),
|
|
6374
6376
|
e.getVisibleCells().map((t) => {
|
|
6375
|
-
let n =
|
|
6377
|
+
let n = ye.find((e) => (e.key || String(e.dataIndex)) === t.column.id), a = getFixedStyle(t.column), o = n?.width || t.column.getSize(), s = t.column.getIsPinned();
|
|
6376
6378
|
return x && n?.editable && i ? /* @__PURE__ */ jsx(TableCell, {
|
|
6377
6379
|
className: cn("align-middle", n?.align && `text-${n.align}`),
|
|
6378
6380
|
style: {
|
|
@@ -6415,10 +6417,10 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6415
6417
|
...e.original,
|
|
6416
6418
|
[n.dataIndex]: t
|
|
6417
6419
|
};
|
|
6418
|
-
|
|
6420
|
+
xe.saveEditable(r, i), x?.onSave && x.onSave(r, i, e.original);
|
|
6419
6421
|
},
|
|
6420
|
-
onCancel: () =>
|
|
6421
|
-
onStartEdit: () =>
|
|
6422
|
+
onCancel: () => xe.cancelEditable(r),
|
|
6423
|
+
onStartEdit: () => xe.startEditable(r)
|
|
6422
6424
|
})
|
|
6423
6425
|
}), o = !!n?.ellipsis;
|
|
6424
6426
|
if (n?.tooltip && !i) {
|
|
@@ -6525,22 +6527,22 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6525
6527
|
editingKey: A.editingKey || ""
|
|
6526
6528
|
},
|
|
6527
6529
|
editable: x,
|
|
6528
|
-
onEdit: () =>
|
|
6530
|
+
onEdit: () => xe.startEditable(r),
|
|
6529
6531
|
onSave: () => {
|
|
6530
|
-
|
|
6532
|
+
xe.cancelEditable(r);
|
|
6531
6533
|
},
|
|
6532
|
-
onCancel: () =>
|
|
6534
|
+
onCancel: () => xe.cancelEditable(r),
|
|
6533
6535
|
onDelete: x.onDelete ? () => {
|
|
6534
6536
|
x.onDelete && x.onDelete(r, e.original);
|
|
6535
6537
|
} : void 0
|
|
6536
6538
|
})
|
|
6537
6539
|
})
|
|
6538
6540
|
] });
|
|
6539
|
-
},
|
|
6540
|
-
let n =
|
|
6541
|
+
}, ct = (e, t = 0) => {
|
|
6542
|
+
let n = Ae(e), r = Le(e), i = Re(e), a = e[ke], o = {
|
|
6541
6543
|
id: String(n),
|
|
6542
6544
|
original: e,
|
|
6543
|
-
index: A.data.findIndex((e) =>
|
|
6545
|
+
index: A.data.findIndex((e) => Ae(e) === n),
|
|
6544
6546
|
getIsSelected: () => {
|
|
6545
6547
|
try {
|
|
6546
6548
|
return k.getRow(String(n))?.getIsSelected() ?? !1;
|
|
@@ -6554,7 +6556,7 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6554
6556
|
t && t.toggleSelected(e);
|
|
6555
6557
|
} catch {}
|
|
6556
6558
|
},
|
|
6557
|
-
getVisibleCells: () =>
|
|
6559
|
+
getVisibleCells: () => ye.filter((e) => !e.hideInTable).map((t) => {
|
|
6558
6560
|
let n = t.key || String(t.dataIndex), r = t.dataPath || t.dataIndex, i = () => {
|
|
6559
6561
|
if (r) return getNestedValue(e, Array.isArray(r) || typeof r == "string" ? r : String(r));
|
|
6560
6562
|
}, a = null;
|
|
@@ -6598,25 +6600,25 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6598
6600
|
}, s = T?.(e, t) || {}, c = [];
|
|
6599
6601
|
return b ? c.push(/* @__PURE__ */ jsx(DraggableRow, {
|
|
6600
6602
|
row: o,
|
|
6601
|
-
children:
|
|
6603
|
+
children: st(o, t)
|
|
6602
6604
|
}, o.id)) : c.push(/* @__PURE__ */ jsx(TableRow, {
|
|
6603
6605
|
"data-state": o.getIsSelected && o.getIsSelected() ? "selected" : void 0,
|
|
6604
6606
|
...s,
|
|
6605
|
-
children:
|
|
6607
|
+
children: st(o, t)
|
|
6606
6608
|
}, o.id)), i && r && a && a.length > 0 && a.forEach((e) => {
|
|
6607
|
-
c.push(...
|
|
6609
|
+
c.push(...ct(e, t + 1));
|
|
6608
6610
|
}), c;
|
|
6609
|
-
},
|
|
6611
|
+
}, lt = (e, t) => {
|
|
6610
6612
|
let n = T?.(e.original, t) || {};
|
|
6611
6613
|
return b ? /* @__PURE__ */ jsx(DraggableRow, {
|
|
6612
6614
|
row: e,
|
|
6613
|
-
children:
|
|
6615
|
+
children: st(e, 0)
|
|
6614
6616
|
}, e.id) : /* @__PURE__ */ jsx(TableRow, {
|
|
6615
6617
|
"data-state": e.getIsSelected && e.getIsSelected() ? "selected" : void 0,
|
|
6616
6618
|
...n,
|
|
6617
|
-
children:
|
|
6619
|
+
children: st(e, 0)
|
|
6618
6620
|
}, e.id);
|
|
6619
|
-
},
|
|
6621
|
+
}, ut = /* @__PURE__ */ jsx("div", {
|
|
6620
6622
|
className: cn("relative", pe?.x && "overflow-x-auto", pe?.y && "overflow-y-auto", o?.container),
|
|
6621
6623
|
children: /* @__PURE__ */ jsx("div", {
|
|
6622
6624
|
className: cn("rounded-md", m && "border", o?.wrapper),
|
|
@@ -6626,12 +6628,12 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6626
6628
|
maxHeight: pe?.y ? `${pe.y}px` : void 0
|
|
6627
6629
|
},
|
|
6628
6630
|
children: /* @__PURE__ */ jsx(DndContext, {
|
|
6629
|
-
sensors:
|
|
6631
|
+
sensors: Ue,
|
|
6630
6632
|
collisionDetection: closestCenter,
|
|
6631
6633
|
modifiers: [restrictToVerticalAxis],
|
|
6632
|
-
onDragEnd:
|
|
6634
|
+
onDragEnd: We,
|
|
6633
6635
|
children: /* @__PURE__ */ jsxs(Table, {
|
|
6634
|
-
className: cn(
|
|
6636
|
+
className: cn(at[ze], me && "sticky-header", o?.table),
|
|
6635
6637
|
style: {
|
|
6636
6638
|
...u,
|
|
6637
6639
|
width: "100%",
|
|
@@ -6647,7 +6649,7 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6647
6649
|
zIndex: 10
|
|
6648
6650
|
} : void 0,
|
|
6649
6651
|
children: k.getHeaderGroups().map((e) => /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
6650
|
-
|
|
6652
|
+
Oe && D?.showExpandColumn !== !1 && /* @__PURE__ */ jsx(TableHead, {
|
|
6651
6653
|
className: "w-8",
|
|
6652
6654
|
style: { width: `${D?.expandColumnWidth || 50}px` }
|
|
6653
6655
|
}),
|
|
@@ -6661,7 +6663,7 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6661
6663
|
})
|
|
6662
6664
|
}),
|
|
6663
6665
|
e.headers.map((e, t) => {
|
|
6664
|
-
let n =
|
|
6666
|
+
let n = ye.find((t) => (t.key || String(t.dataIndex)) === e.column.id), r = getFixedStyle(e.column), i = n?.headerEllipsis ?? n?.ellipsis, a = n?.headerTooltip ?? n?.tooltip, o = n?.width || e.column.getSize(), s = e.column.getIsPinned();
|
|
6665
6667
|
return /* @__PURE__ */ jsx(TableHead, {
|
|
6666
6668
|
style: {
|
|
6667
6669
|
...r,
|
|
@@ -6731,8 +6733,8 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6731
6733
|
filters: n.filters
|
|
6732
6734
|
},
|
|
6733
6735
|
value: Array.isArray(k.getColumn(n.key || String(n.dataIndex))?.getFilterValue()) ? k.getColumn(n.key || String(n.dataIndex))?.getFilterValue() : [],
|
|
6734
|
-
onChange: (e) =>
|
|
6735
|
-
onClear: () =>
|
|
6736
|
+
onChange: (e) => nt(n.key || String(n.dataIndex), e),
|
|
6737
|
+
onClear: () => it(n.key || String(n.dataIndex))
|
|
6736
6738
|
})]
|
|
6737
6739
|
})]
|
|
6738
6740
|
})
|
|
@@ -6742,42 +6744,42 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6742
6744
|
}), /* @__PURE__ */ jsx(TableBody, {
|
|
6743
6745
|
className: cn(o?.tableBody),
|
|
6744
6746
|
children: h ? /* @__PURE__ */ jsx(LoadingState, {
|
|
6745
|
-
columnCount:
|
|
6747
|
+
columnCount: ye.length,
|
|
6746
6748
|
draggable: !!b,
|
|
6747
6749
|
rowSelection: !!y,
|
|
6748
6750
|
rowCount: A.pageSize
|
|
6749
6751
|
}) : A.data.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
6750
|
-
colSpan:
|
|
6752
|
+
colSpan: ot,
|
|
6751
6753
|
emptyRender: ue
|
|
6752
6754
|
}) : b ? /* @__PURE__ */ jsx(SortableContext, {
|
|
6753
6755
|
items: k.getRowModel().rows.map((e) => e.id),
|
|
6754
6756
|
strategy: verticalListSortingStrategy,
|
|
6755
|
-
children: k.getRowModel().rows.map((e, t) =>
|
|
6756
|
-
}) :
|
|
6757
|
-
let t =
|
|
6758
|
-
return /* @__PURE__ */ jsx(Fragment, { children: t },
|
|
6759
|
-
}) }) : k.getRowModel().rows.map((e, t) =>
|
|
6757
|
+
children: k.getRowModel().rows.map((e, t) => lt(e, t))
|
|
6758
|
+
}) : Oe ? /* @__PURE__ */ jsx(Fragment$1, { children: A.data.map((e) => {
|
|
6759
|
+
let t = ct(e, 0);
|
|
6760
|
+
return /* @__PURE__ */ jsx(Fragment, { children: t }, Ae(e));
|
|
6761
|
+
}) }) : k.getRowModel().rows.map((e, t) => lt(e, t))
|
|
6760
6762
|
})]
|
|
6761
6763
|
})
|
|
6762
6764
|
})
|
|
6763
6765
|
})
|
|
6764
|
-
}),
|
|
6766
|
+
}), dt = ce ? ce(e, ut, {
|
|
6765
6767
|
toolbar: g !== !1,
|
|
6766
6768
|
search: E !== !1,
|
|
6767
6769
|
table: !0
|
|
6768
|
-
}) :
|
|
6770
|
+
}) : ut, ft = cn("flex flex-col gap-4 transition-all duration-300 ease-in-out", Ve ? "fixed inset-0 z-50 bg-background p-4 transform scale-100" : "transform scale-100", i), pt = /* @__PURE__ */ jsx(LocaleProvider, {
|
|
6769
6771
|
locale: ge,
|
|
6770
6772
|
children: /* @__PURE__ */ jsxs("div", {
|
|
6771
|
-
className:
|
|
6773
|
+
className: ft,
|
|
6772
6774
|
style: l,
|
|
6773
6775
|
children: [
|
|
6774
6776
|
E !== !1 && (() => {
|
|
6775
|
-
let e = extractSearchColumns(
|
|
6777
|
+
let e = extractSearchColumns(ye);
|
|
6776
6778
|
return e.length > 0 || typeof E == "object" && E ? /* @__PURE__ */ jsx(Search, {
|
|
6777
6779
|
...typeof E == "object" ? E : {},
|
|
6778
6780
|
columns: e,
|
|
6779
|
-
onSearch:
|
|
6780
|
-
onReset:
|
|
6781
|
+
onSearch: Ke,
|
|
6782
|
+
onReset: et,
|
|
6781
6783
|
loading: A.loading
|
|
6782
6784
|
}) : null;
|
|
6783
6785
|
})(),
|
|
@@ -6786,27 +6788,27 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6786
6788
|
title: S,
|
|
6787
6789
|
subTitle: C,
|
|
6788
6790
|
table: k,
|
|
6789
|
-
columns:
|
|
6791
|
+
columns: ye,
|
|
6790
6792
|
loading: A.loading,
|
|
6791
|
-
onReload: () =>
|
|
6792
|
-
fullScreen:
|
|
6793
|
-
onFullScreenChange:
|
|
6794
|
-
density:
|
|
6795
|
-
onDensityChange:
|
|
6796
|
-
visibleColumns:
|
|
6797
|
-
onVisibleColumnsChange:
|
|
6798
|
-
columnSettings:
|
|
6799
|
-
onColumnSettingsChange:
|
|
6793
|
+
onReload: () => xe.reload(),
|
|
6794
|
+
fullScreen: Ve,
|
|
6795
|
+
onFullScreenChange: He,
|
|
6796
|
+
density: ze,
|
|
6797
|
+
onDensityChange: Be,
|
|
6798
|
+
visibleColumns: we,
|
|
6799
|
+
onVisibleColumnsChange: Te,
|
|
6800
|
+
columnSettings: Ee,
|
|
6801
|
+
onColumnSettingsChange: j
|
|
6800
6802
|
}),
|
|
6801
6803
|
y && /* @__PURE__ */ jsx(BatchActions, {
|
|
6802
6804
|
selectedCount: k.getFilteredSelectedRowModel().rows.length,
|
|
6803
6805
|
selectedRows: k.getFilteredSelectedRowModel().rows.map((e) => e.original),
|
|
6804
|
-
onClear:
|
|
6806
|
+
onClear: Ge,
|
|
6805
6807
|
alwaysShow: y.alwaysShowAlert,
|
|
6806
6808
|
batchActions: y.batchActions
|
|
6807
6809
|
}),
|
|
6808
6810
|
le?.(e, A.data),
|
|
6809
|
-
|
|
6811
|
+
dt,
|
|
6810
6812
|
ne && /* @__PURE__ */ jsx("div", {
|
|
6811
6813
|
className: "px-4",
|
|
6812
6814
|
children: ne(A.data)
|
|
@@ -6817,7 +6819,7 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6817
6819
|
current: A.current,
|
|
6818
6820
|
pageSize: A.pageSize,
|
|
6819
6821
|
total: A.total,
|
|
6820
|
-
onPaginationChange:
|
|
6822
|
+
onPaginationChange: Se.handlePaginationChange
|
|
6821
6823
|
});
|
|
6822
6824
|
return v ? v({
|
|
6823
6825
|
pagination: {
|
|
@@ -6827,7 +6829,7 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6827
6829
|
total: A.total
|
|
6828
6830
|
},
|
|
6829
6831
|
onChange: (t, n) => {
|
|
6830
|
-
e.onChange?.(t, n),
|
|
6832
|
+
e.onChange?.(t, n), Se.handlePaginationChange(t, n);
|
|
6831
6833
|
},
|
|
6832
6834
|
defaultDom: t
|
|
6833
6835
|
}) : t;
|
|
@@ -6838,8 +6840,8 @@ const ProTable = forwardRef((e, t) => {
|
|
|
6838
6840
|
return re ? /* @__PURE__ */ jsx(Card, {
|
|
6839
6841
|
...ie,
|
|
6840
6842
|
className: cn(ie?.className),
|
|
6841
|
-
children: /* @__PURE__ */ jsx(CardContent, { children:
|
|
6842
|
-
}) :
|
|
6843
|
+
children: /* @__PURE__ */ jsx(CardContent, { children: pt })
|
|
6844
|
+
}) : pt;
|
|
6843
6845
|
});
|
|
6844
6846
|
var cache = /* @__PURE__ */ new Map();
|
|
6845
6847
|
function useRequest(e, t = {}) {
|
package/dist/pro-table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pro-table.d.ts","sourceRoot":"","sources":["../lib/pro-table.tsx"],"names":[],"mappings":"AACA,OAAO,KAON,MAAM,OAAO,CAAC;AAmBf,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAa,MAAM,SAAS,CAAC;AA0JxE,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"pro-table.d.ts","sourceRoot":"","sources":["../lib/pro-table.tsx"],"names":[],"mappings":"AACA,OAAO,KAON,MAAM,OAAO,CAAC;AAmBf,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAa,MAAM,SAAS,CAAC;AA0JxE,eAAO,MAAM,QAAQ,EAo5ChB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,KAC7D,KAAK,CAAC,YAAY,CAAC"}
|