@gisce/react-formiga-table
Advanced tools
Comparing version 1.0.0-alpha.12 to 1.0.0-rc.1
@@ -1,3 +0,4 @@ | ||
import { TableProps } from "../types"; | ||
export declare const Table: (props: TableProps) => any; | ||
/// <reference types="react" /> | ||
import { TableProps, TableRef } from "../types"; | ||
export declare const Table: import("react").ForwardRefExoticComponent<TableProps & import("react").RefAttributes<TableRef>>; | ||
//# sourceMappingURL=Table.d.ts.map |
import { jsx as a, jsxs as w, Fragment as D } from "react/jsx-runtime"; | ||
import _, { useState as R, useRef as Q, useEffect as M, useCallback as b } from "react"; | ||
import W from "use-deep-compare-effect"; | ||
import X from "style-object-to-css-string"; | ||
import Y from "styled-components"; | ||
const Z = ({ | ||
import _, { useState as R, useRef as W, useEffect as M, useCallback as k, forwardRef as X, useImperativeHandle as Y } from "react"; | ||
import Z from "use-deep-compare-effect"; | ||
import U from "style-object-to-css-string"; | ||
import O from "styled-components"; | ||
const ee = ({ | ||
dataSource: e, | ||
@@ -11,3 +11,3 @@ onFetchChildrenForRecord: t, | ||
}) => { | ||
const [n, u] = R([]), [c, h] = R([]), i = Q(/* @__PURE__ */ new Map()), [s, o] = R( | ||
const [n, g] = R([]), [s, h] = R([]), i = W(/* @__PURE__ */ new Map()), [o, c] = R( | ||
e.map( | ||
@@ -22,3 +22,3 @@ (d) => A({ | ||
M(() => { | ||
o( | ||
c( | ||
e.map( | ||
@@ -33,42 +33,42 @@ (d) => A({ | ||
}, [e]); | ||
const p = b( | ||
const u = k( | ||
(d) => { | ||
n.indexOf(d) === -1 ? (n.push(d), u([...n])) : u(n.filter((f) => f !== d)); | ||
n.indexOf(d) === -1 ? (n.push(d), g([...n])) : g(n.filter((f) => f !== d)); | ||
}, | ||
[n] | ||
), y = b( | ||
), p = k( | ||
(d) => n.includes(d), | ||
[n] | ||
), g = b( | ||
(d) => c.includes(d), | ||
[c] | ||
), C = (d) => i.current.get(d) || 0, k = b( | ||
), b = k( | ||
(d) => s.includes(d), | ||
[s] | ||
), y = (d) => i.current.get(d) || 0, x = k( | ||
(d) => { | ||
const f = s.find((l) => l.id === d); | ||
const f = o.find((l) => l.id === d); | ||
return f ? f[r] !== void 0 && f[r].length > 0 : !1; | ||
}, | ||
[r, s] | ||
), L = b( | ||
[r, o] | ||
), L = k( | ||
(d) => { | ||
const f = s.find((l) => l.id === d); | ||
const f = o.find((l) => l.id === d); | ||
return f ? f.isLoading : !1; | ||
}, | ||
[s] | ||
), v = b( | ||
[o] | ||
), E = k( | ||
(d) => { | ||
const f = s.find((m) => m.id === d); | ||
const f = o.find((m) => m.id === d); | ||
if (!f) | ||
return []; | ||
const l = f[r]; | ||
return l ? s.filter((m) => l.includes(m.id)) : []; | ||
return l ? o.filter((m) => l.includes(m.id)) : []; | ||
}, | ||
[r, s] | ||
), x = b( | ||
[r, o] | ||
), v = k( | ||
async (d) => { | ||
const f = s.find((l) => l.id === d.id); | ||
const f = o.find((l) => l.id === d.id); | ||
if (!f) | ||
return !1; | ||
if (!f.isLoading) { | ||
if (!y(d.id) && !g(f.id)) { | ||
o( | ||
if (!p(d.id) && !b(f.id)) { | ||
c( | ||
F( | ||
@@ -79,3 +79,3 @@ { | ||
}, | ||
s | ||
o | ||
) | ||
@@ -87,3 +87,3 @@ ); | ||
i.current.set(m.id, f.level + 1); | ||
}), o( | ||
}), c( | ||
F( | ||
@@ -95,3 +95,3 @@ { | ||
[ | ||
...s, | ||
...o, | ||
...l.map((m) => A({ | ||
@@ -104,5 +104,5 @@ entry: m, | ||
) | ||
), c.push(f.id), h([...c]); | ||
), s.push(f.id), h([...s]); | ||
} catch (l) { | ||
console.error(l), o( | ||
console.error(l), c( | ||
F( | ||
@@ -113,3 +113,3 @@ { | ||
}, | ||
s | ||
o | ||
) | ||
@@ -119,21 +119,21 @@ ); | ||
} | ||
p(d.id); | ||
u(d.id); | ||
} | ||
}, | ||
[ | ||
s, | ||
y, | ||
g, | ||
o, | ||
p, | ||
b, | ||
u, | ||
t, | ||
c, | ||
s, | ||
r | ||
] | ||
), E = b( | ||
(d) => L(d.id) ? "loading" : k(d.id) ? y(d.id) ? "collapse" : "expand" : "none", | ||
[L, k, y] | ||
), I = b(() => { | ||
const f = s.filter((l) => l.level === 0).map((l) => l.id); | ||
), C = k( | ||
(d) => L(d.id) ? "loading" : x(d.id) ? p(d.id) ? "collapse" : "expand" : "none", | ||
[L, x, p] | ||
), I = k(() => { | ||
const f = o.filter((l) => l.level === 0).map((l) => l.id); | ||
return n.forEach((l) => { | ||
const m = s.find((K) => K.id === l); | ||
const m = o.find((K) => K.id === l); | ||
m && m.child_id && m.child_id.forEach((K) => { | ||
@@ -143,10 +143,10 @@ f.includes(K) || f.push(K); | ||
}), f; | ||
}, [n, s]); | ||
}, [n, o]); | ||
return { | ||
keyIsOpened: y, | ||
onExpandableIconClicked: x, | ||
getExpandableStatusForRow: E, | ||
getChildsForParent: v, | ||
keyIsOpened: p, | ||
onExpandableIconClicked: v, | ||
getExpandableStatusForRow: C, | ||
getChildsForParent: E, | ||
getAllVisibleKeys: I, | ||
getLevelForKey: C | ||
getLevelForKey: y | ||
}; | ||
@@ -167,3 +167,3 @@ }; | ||
} | ||
const F = (e, t) => t.map((r) => r.id === e.id ? e : r), U = ({ | ||
const F = (e, t) => t.map((r) => r.id === e.id ? e : r), te = ({ | ||
selectionRowKeysProps: e = [] | ||
@@ -174,6 +174,6 @@ }) => { | ||
); | ||
W(() => { | ||
Z(() => { | ||
r(e); | ||
}, [e]); | ||
const n = b( | ||
const n = k( | ||
(i) => { | ||
@@ -187,11 +187,11 @@ if (t.length === i.length || t.length > 0) { | ||
[t, r] | ||
), u = b( | ||
(i, s) => { | ||
s.length !== 0 && r(i ? [.../* @__PURE__ */ new Set([...t, ...s])] : t.filter((o) => !s.includes(o))); | ||
), g = k( | ||
(i, o) => { | ||
o.length !== 0 && r(i ? [.../* @__PURE__ */ new Set([...t, ...o])] : t.filter((c) => !o.includes(c))); | ||
}, | ||
[t, r] | ||
), c = b( | ||
), s = k( | ||
(i) => { | ||
if (t.find( | ||
(o) => i.id === o | ||
(c) => i.id === c | ||
) === void 0) { | ||
@@ -201,8 +201,8 @@ r([...t, i.id]); | ||
} | ||
r([...t.filter((o) => o !== i.id)]); | ||
r([...t.filter((c) => c !== i.id)]); | ||
}, | ||
[t, r] | ||
), h = b( | ||
), h = k( | ||
(i) => t.find( | ||
(o) => i.id === o | ||
(c) => i.id === c | ||
) !== void 0, | ||
@@ -215,26 +215,26 @@ [t] | ||
toggleAllRowsSelected: n, | ||
toggleRowSelected: c, | ||
changeSelected: u | ||
toggleRowSelected: s, | ||
changeSelected: g | ||
}; | ||
}, O = (e, t) => { | ||
const [r, n] = R(null), [u, c] = R(!1), [h, i] = R(null); | ||
return b( | ||
(o, p) => { | ||
if (p.nativeEvent.shiftKey) { | ||
const y = e.findIndex((v) => v === o), g = e.findIndex((v) => v === r), C = e.findIndex( | ||
(v) => v === h | ||
), k = Math.min(y, g), L = Math.max(y, g); | ||
if (k > -1 && L > -1) { | ||
t(u, e.slice(k, L + 1)), C > L && t( | ||
!u, | ||
e.slice(L + 1, C + 1) | ||
), C < k && t( | ||
!u, | ||
e.slice(C, k) | ||
), i(o); | ||
}, re = (e, t) => { | ||
const [r, n] = R(null), [g, s] = R(!1), [h, i] = R(null); | ||
return k( | ||
(c, u) => { | ||
if (u.nativeEvent.shiftKey) { | ||
const p = e.findIndex((E) => E === c), b = e.findIndex((E) => E === r), y = e.findIndex( | ||
(E) => E === h | ||
), x = Math.min(p, b), L = Math.max(p, b); | ||
if (x > -1 && L > -1) { | ||
t(g, e.slice(x, L + 1)), y > L && t( | ||
!g, | ||
e.slice(L + 1, y + 1) | ||
), y < x && t( | ||
!g, | ||
e.slice(y, x) | ||
), i(c); | ||
return; | ||
} | ||
} else | ||
n(o), i(null), c(p.target.checked); | ||
t(p.target.checked, [o]); | ||
n(c), i(null), s(u.target.checked); | ||
t(u.target.checked, [c]); | ||
}, | ||
@@ -246,4 +246,4 @@ [ | ||
n, | ||
u, | ||
c, | ||
g, | ||
s, | ||
h, | ||
@@ -253,14 +253,14 @@ i | ||
); | ||
}, ee = (e) => { | ||
const [t, r] = R(e), n = b( | ||
(c) => { | ||
if (t && c === t.id) | ||
}, ne = (e) => { | ||
const [t, r] = R(e), n = k( | ||
(s) => { | ||
if (t && s === t.id) | ||
return t; | ||
}, | ||
[t] | ||
), u = b( | ||
(c) => { | ||
), g = k( | ||
(s) => { | ||
if (!t) { | ||
r({ | ||
id: c, | ||
id: s, | ||
desc: !1 | ||
@@ -270,5 +270,5 @@ }); | ||
} | ||
if (t.id !== c) { | ||
if (t.id !== s) { | ||
r({ | ||
id: c, | ||
id: s, | ||
desc: !1 | ||
@@ -280,3 +280,3 @@ }); | ||
r({ | ||
id: c, | ||
id: s, | ||
desc: !0 | ||
@@ -293,9 +293,9 @@ }); | ||
getColumnSorter: n, | ||
handleColumnClick: u | ||
handleColumnClick: g | ||
}; | ||
}, te = Y.div` | ||
}, ie = O.div` | ||
overflow-x: auto; | ||
height: ${({ height: e }) => `${e}px` || "auto"}; | ||
border-bottom: 1px solid #f0f0f0; | ||
${(e) => X(e.containerStyle ?? {})} | ||
${(e) => U(e.containerStyle ?? {})} | ||
@@ -385,3 +385,3 @@ table { | ||
} | ||
`, P = ({ | ||
`, N = ({ | ||
value: e, | ||
@@ -406,3 +406,3 @@ onChange: t | ||
); | ||
}, re = ({ | ||
}, se = ({ | ||
onRowSelectionChange: e, | ||
@@ -412,11 +412,11 @@ allRowsAreSelected: t, | ||
toggleAllRowsSelected: n, | ||
selectedRowKeys: u, | ||
handleColumnClick: c, | ||
selectedRowKeys: g, | ||
handleColumnClick: s, | ||
getColumnSorter: h, | ||
sortEnabled: i, | ||
readonly: s, | ||
status: o = !1, | ||
headerStyle: p | ||
readonly: o, | ||
status: c = !1, | ||
headerStyle: u | ||
}) => /* @__PURE__ */ w(D, { children: [ | ||
e && !s && /* @__PURE__ */ a( | ||
e && !o && /* @__PURE__ */ a( | ||
"th", | ||
@@ -429,3 +429,3 @@ { | ||
backgroundColor: "#f2f2f2", | ||
...p, | ||
...u, | ||
cursor: "auto" | ||
@@ -443,5 +443,5 @@ }, | ||
children: /* @__PURE__ */ a( | ||
P, | ||
N, | ||
{ | ||
value: t ? !0 : u.length === 0 ? !1 : null, | ||
value: t ? !0 : g.length === 0 ? !1 : null, | ||
onChange: n | ||
@@ -455,9 +455,9 @@ } | ||
), | ||
o && /* @__PURE__ */ a("th", { style: { ...p } }, "th-status"), | ||
r.map((y) => /* @__PURE__ */ a( | ||
c && /* @__PURE__ */ a("th", { style: { ...u } }, "th-status"), | ||
r.map((p) => /* @__PURE__ */ a( | ||
"th", | ||
{ | ||
style: { ...p }, | ||
style: { ...u }, | ||
onClick: i ? () => { | ||
c(y.key); | ||
s(p.key); | ||
} : void 0, | ||
@@ -472,5 +472,5 @@ children: /* @__PURE__ */ w("div", { className: "ctx", children: [ | ||
justifyContent: "space-between", | ||
...p == null ? void 0 : p.rftLabel | ||
...u == null ? void 0 : u.rftLabel | ||
}, | ||
children: y.title | ||
children: p.title | ||
} | ||
@@ -483,12 +483,12 @@ ), | ||
style: { | ||
visibility: h(y.key) !== void 0 ? void 0 : "hidden", | ||
visibility: h(p.key) !== void 0 ? void 0 : "hidden", | ||
marginLeft: "auto" | ||
}, | ||
children: h(y.key) !== void 0 && h(y.key).desc ? " ▼" : " ▲" | ||
children: h(p.key) !== void 0 && h(p.key).desc ? " ▼" : " ▲" | ||
}, | ||
y.key | ||
p.key | ||
) }) | ||
] }) | ||
}, | ||
y.key | ||
p.key | ||
)) | ||
@@ -500,17 +500,17 @@ ] }), S = ({ | ||
level: n, | ||
getColumnSorter: u, | ||
expandableOpts: c, | ||
getColumnSorter: g, | ||
expandableOpts: s, | ||
getExpandableStatusForRow: h, | ||
onExpandableIconClicked: i, | ||
onCellRender: s, | ||
rowIsSelected: o, | ||
cellStyle: p | ||
onCellRender: o, | ||
rowIsSelected: c, | ||
cellStyle: u | ||
}) => { | ||
const y = u(e.key) !== void 0 ? { | ||
backgroundColor: o ? "#E6F7FF" : "#fafafa" | ||
} : o ? { | ||
backgroundColor: o ? "#E6F7FF" : void 0 | ||
const p = g(e.key) !== void 0 ? { | ||
backgroundColor: c ? "#E6F7FF" : "#fafafa" | ||
} : c ? { | ||
backgroundColor: c ? "#E6F7FF" : void 0 | ||
} : {}; | ||
let g; | ||
return s ? g = s({ | ||
let b; | ||
return o ? b = o({ | ||
column: e, | ||
@@ -520,9 +520,9 @@ columnIdx: r, | ||
value: t[e.key] | ||
}) : e.render ? g = e.render(t[e.key]) : g = t[e.key], /* @__PURE__ */ w("td", { style: y, children: [ | ||
}) : e.render ? b = e.render(t[e.key]) : b = t[e.key], /* @__PURE__ */ w("td", { style: p, children: [ | ||
/* @__PURE__ */ a( | ||
ne, | ||
oe, | ||
{ | ||
row: t, | ||
columnIdx: r, | ||
expandableOpts: c, | ||
expandableOpts: s, | ||
getExpandableStatusForRow: h, | ||
@@ -533,3 +533,3 @@ onExpandableIconClicked: i, | ||
), | ||
/* @__PURE__ */ w("div", { style: { display: "inline-block", width: "100%", ...p }, children: [ | ||
/* @__PURE__ */ w("div", { style: { display: "inline-block", width: "100%", ...u }, children: [ | ||
/* @__PURE__ */ a( | ||
@@ -539,11 +539,11 @@ "div", | ||
className: "rft-label", | ||
style: { display: "none", ...p == null ? void 0 : p.rftLabel }, | ||
style: { display: "none", ...u == null ? void 0 : u.rftLabel }, | ||
children: e.title | ||
} | ||
), | ||
g | ||
b | ||
] }) | ||
] }); | ||
}; | ||
function ne({ | ||
function oe({ | ||
row: e, | ||
@@ -553,4 +553,4 @@ columnIdx: t, | ||
getExpandableStatusForRow: n, | ||
onExpandableIconClicked: u, | ||
level: c | ||
onExpandableIconClicked: g, | ||
level: s | ||
}) { | ||
@@ -561,3 +561,3 @@ if (!r) | ||
if (h === "none" || t !== 0) | ||
return /* @__PURE__ */ a("div", { style: { display: "inline-block", width: 19 + c * 25 } }); | ||
return /* @__PURE__ */ a("div", { style: { display: "inline-block", width: 19 + s * 25 } }); | ||
let i; | ||
@@ -567,5 +567,5 @@ return h === "expand" ? i = r.expandIcon : h === "collapse" ? i = r.collapseIcon : h === "loading" && (i = r.loadingIcon), /* @__PURE__ */ a("div", { style: { display: "inline-block" }, children: /* @__PURE__ */ a( | ||
{ | ||
style: { marginRight: 5, marginLeft: c * 25 }, | ||
style: { marginRight: 5, marginLeft: s * 25 }, | ||
onClick: () => { | ||
u(e); | ||
g(e); | ||
} | ||
@@ -607,3 +607,3 @@ } | ||
} | ||
const ie = ({ | ||
const de = ({ | ||
onRowSelectionChange: e, | ||
@@ -613,35 +613,35 @@ dataSource: t, | ||
getColumnSorter: n, | ||
onRowStyle: u, | ||
onRowStatus: c, | ||
onRowStyle: g, | ||
onRowStatus: s, | ||
onRowDoubleClick: h, | ||
isRowSelected: i, | ||
toggleRowSelected: s, | ||
expandableOpts: o, | ||
onExpandableIconClicked: p, | ||
getExpandableStatusForRow: y, | ||
keyIsOpened: g, | ||
getChildsForParent: C, | ||
getLevelForKey: k, | ||
toggleRowSelected: o, | ||
expandableOpts: c, | ||
onExpandableIconClicked: u, | ||
getExpandableStatusForRow: p, | ||
keyIsOpened: b, | ||
getChildsForParent: y, | ||
getLevelForKey: x, | ||
onCellRender: L, | ||
cellStyle: v, | ||
readonly: x | ||
}) => /* @__PURE__ */ a(D, { children: t.filter((E) => k(E.id) === 0).map((E) => N({ | ||
row: E, | ||
cellStyle: E, | ||
readonly: v | ||
}) => /* @__PURE__ */ a(D, { children: t.filter((C) => x(C.id) === 0).map((C) => P({ | ||
row: C, | ||
columns: r, | ||
onRowStyle: u, | ||
onRowStatus: c, | ||
onRowStyle: g, | ||
onRowStatus: s, | ||
onRowDoubleClick: h, | ||
onRowSelectionChange: e, | ||
isRowSelected: i, | ||
toggleRowSelected: s, | ||
expandableOpts: o, | ||
getExpandableStatusForRow: y, | ||
onExpandableIconClicked: p, | ||
toggleRowSelected: o, | ||
expandableOpts: c, | ||
getExpandableStatusForRow: p, | ||
onExpandableIconClicked: u, | ||
getColumnSorter: n, | ||
keyIsOpened: g, | ||
getChildsForParent: C, | ||
cellStyle: v, | ||
readonly: x | ||
keyIsOpened: b, | ||
getChildsForParent: y, | ||
cellStyle: E, | ||
readonly: v | ||
})) }); | ||
function N({ | ||
function P({ | ||
row: e, | ||
@@ -651,19 +651,19 @@ columns: t, | ||
onRowSelectionChange: n, | ||
isRowSelected: u, | ||
toggleRowSelected: c, | ||
isRowSelected: g, | ||
toggleRowSelected: s, | ||
expandableOpts: h, | ||
getExpandableStatusForRow: i, | ||
onExpandableIconClicked: s, | ||
getColumnSorter: o, | ||
keyIsOpened: p, | ||
getChildsForParent: y, | ||
onRowStyle: g, | ||
onRowStatus: C, | ||
level: k = 0, | ||
onExpandableIconClicked: o, | ||
getColumnSorter: c, | ||
keyIsOpened: u, | ||
getChildsForParent: p, | ||
onRowStyle: b, | ||
onRowStatus: y, | ||
level: x = 0, | ||
onCellRender: L, | ||
cellStyle: v, | ||
readonly: x | ||
cellStyle: E, | ||
readonly: v | ||
}) { | ||
var f; | ||
const E = g ? g(e) : "", I = u(e); | ||
const C = b ? b(e) : "", I = g(e); | ||
let d = [ | ||
@@ -673,3 +673,3 @@ /* @__PURE__ */ w( | ||
{ | ||
style: E, | ||
style: C, | ||
onDoubleClick: () => { | ||
@@ -679,3 +679,3 @@ r == null || r(e); | ||
children: [ | ||
n && !x && /* @__PURE__ */ a( | ||
n && !v && /* @__PURE__ */ a( | ||
"td", | ||
@@ -701,8 +701,8 @@ { | ||
}, | ||
children: !x && /* @__PURE__ */ a( | ||
P, | ||
children: !v && /* @__PURE__ */ a( | ||
N, | ||
{ | ||
value: I, | ||
onChange: (l) => { | ||
c(e.id, l); | ||
s(e.id, l); | ||
} | ||
@@ -716,3 +716,3 @@ } | ||
), | ||
C && /* @__PURE__ */ a(j, { children: /* @__PURE__ */ a( | ||
y && /* @__PURE__ */ a(j, { children: /* @__PURE__ */ a( | ||
S, | ||
@@ -725,9 +725,9 @@ { | ||
columnIdx: -1, | ||
onCellRender: () => C(e), | ||
onCellRender: () => y(e), | ||
expandableOpts: h, | ||
getExpandableStatusForRow: i, | ||
onExpandableIconClicked: s, | ||
level: k, | ||
onExpandableIconClicked: o, | ||
level: x, | ||
rowIsSelected: I, | ||
cellStyle: v | ||
cellStyle: E | ||
} | ||
@@ -741,9 +741,9 @@ ) }, `status-${e.id}`), | ||
row: e, | ||
getColumnSorter: o, | ||
getColumnSorter: c, | ||
expandableOpts: h, | ||
getExpandableStatusForRow: i, | ||
onExpandableIconClicked: s, | ||
level: k, | ||
onExpandableIconClicked: o, | ||
level: x, | ||
rowIsSelected: I, | ||
cellStyle: v | ||
cellStyle: E | ||
} | ||
@@ -756,92 +756,98 @@ ) }, `${l.key}-${e.id}`)) | ||
]; | ||
return h !== void 0 && p(e.id) && (d = d.concat( | ||
(f = y(e.id)) == null ? void 0 : f.map((l) => N({ | ||
return h !== void 0 && u(e.id) && (d = d.concat( | ||
(f = p(e.id)) == null ? void 0 : f.map((l) => P({ | ||
row: l.data, | ||
columns: t, | ||
onRowStyle: g, | ||
onRowStyle: b, | ||
onRowDoubleClick: r, | ||
onRowSelectionChange: n, | ||
isRowSelected: u, | ||
toggleRowSelected: c, | ||
isRowSelected: g, | ||
toggleRowSelected: s, | ||
expandableOpts: h, | ||
getExpandableStatusForRow: i, | ||
onExpandableIconClicked: s, | ||
getColumnSorter: o, | ||
keyIsOpened: p, | ||
getChildsForParent: y, | ||
onExpandableIconClicked: o, | ||
getColumnSorter: c, | ||
keyIsOpened: u, | ||
getChildsForParent: p, | ||
level: l.level, | ||
onCellRender: L, | ||
onRowStatus: C | ||
onRowStatus: y | ||
})) | ||
)), d; | ||
} | ||
const ae = (e) => { | ||
const le = X((e, t) => { | ||
const { | ||
height: t, | ||
loading: r, | ||
loadingComponent: n, | ||
dataSource: u, | ||
columns: c, | ||
onRowDoubleClick: h, | ||
onRowStyle: i, | ||
onRowStatus: s, | ||
onRowSelectionChange: o, | ||
height: r, | ||
loading: n, | ||
loadingComponent: g, | ||
dataSource: s, | ||
columns: h, | ||
onRowDoubleClick: i, | ||
onRowStyle: o, | ||
onRowStatus: c, | ||
onRowSelectionChange: u, | ||
onChangeSort: p, | ||
sorter: y, | ||
expandableOpts: g, | ||
onCellRender: C, | ||
readonly: k, | ||
selectionRowKeys: L, | ||
sorter: b, | ||
expandableOpts: y, | ||
onCellRender: x, | ||
readonly: L, | ||
selectionRowKeys: E, | ||
customStyle: v | ||
} = e, { | ||
selectedRowKeys: x, | ||
toggleAllRowsSelected: E, | ||
isRowSelected: I, | ||
changeSelected: d | ||
} = U({ | ||
selectionRowKeysProps: L | ||
}), f = O( | ||
u.map((J) => J.id), | ||
d | ||
), { localSorter: l, getColumnSorter: m, handleColumnClick: K } = ee(y), { | ||
keyIsOpened: z, | ||
onExpandableIconClicked: B, | ||
getExpandableStatusForRow: H, | ||
getChildsForParent: T, | ||
selectedRowKeys: C, | ||
toggleAllRowsSelected: I, | ||
isRowSelected: d, | ||
changeSelected: f | ||
} = te({ | ||
selectionRowKeysProps: E | ||
}); | ||
Y(t, () => ({ | ||
unselectAll: () => { | ||
I([]); | ||
} | ||
})); | ||
const l = re( | ||
s.map((Q) => Q.id), | ||
f | ||
), { localSorter: m, getColumnSorter: K, handleColumnClick: H } = ne(b), { | ||
keyIsOpened: T, | ||
onExpandableIconClicked: z, | ||
getExpandableStatusForRow: B, | ||
getChildsForParent: V, | ||
getAllVisibleKeys: $, | ||
getLevelForKey: V | ||
} = Z({ | ||
dataSource: u, | ||
onFetchChildrenForRecord: g == null ? void 0 : g.onFetchChildrenForRecord, | ||
childField: g == null ? void 0 : g.childField | ||
getLevelForKey: q | ||
} = ee({ | ||
dataSource: s, | ||
onFetchChildrenForRecord: y == null ? void 0 : y.onFetchChildrenForRecord, | ||
childField: y == null ? void 0 : y.childField | ||
}); | ||
M(() => { | ||
o == null || o(x); | ||
}, [x]), M(() => { | ||
p == null || p(l); | ||
}, [l]); | ||
const q = b(() => x.length === 0 ? !1 : g ? $().length === x.length : u.length === x.length, [u.length, g, x.length]), G = b(() => { | ||
E($()); | ||
}, [E, $]); | ||
return r ? n : /* @__PURE__ */ a( | ||
te, | ||
u == null || u(C); | ||
}, [C]), M(() => { | ||
p == null || p(m); | ||
}, [m]); | ||
const G = k(() => C.length === 0 ? !1 : y ? $().length === C.length : s.length === C.length, [s.length, y, C.length]), J = k(() => { | ||
I($()); | ||
}, [I, $]); | ||
return n ? g : /* @__PURE__ */ a( | ||
ie, | ||
{ | ||
height: t, | ||
canClick: h !== void 0, | ||
readonly: k, | ||
height: r, | ||
canClick: i !== void 0, | ||
readonly: L, | ||
containerStyle: v == null ? void 0 : v.containerStyle, | ||
children: /* @__PURE__ */ w("table", { style: v == null ? void 0 : v.tableStyle, children: [ | ||
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a( | ||
re, | ||
se, | ||
{ | ||
allRowsAreSelected: q(), | ||
columns: c, | ||
onRowSelectionChange: o, | ||
selectedRowKeys: x, | ||
toggleAllRowsSelected: G, | ||
handleColumnClick: K, | ||
getColumnSorter: m, | ||
sortEnabled: g === void 0, | ||
readonly: k, | ||
status: !!s, | ||
allRowsAreSelected: G(), | ||
columns: h, | ||
onRowSelectionChange: u, | ||
selectedRowKeys: C, | ||
toggleAllRowsSelected: J, | ||
handleColumnClick: H, | ||
getColumnSorter: K, | ||
sortEnabled: y === void 0, | ||
readonly: L, | ||
status: !!c, | ||
headerStyle: v == null ? void 0 : v.headerStyle | ||
@@ -851,22 +857,22 @@ } | ||
/* @__PURE__ */ a("tbody", { children: /* @__PURE__ */ a( | ||
ie, | ||
de, | ||
{ | ||
dataSource: u, | ||
columns: c, | ||
onRowSelectionChange: o, | ||
getColumnSorter: m, | ||
onRowDoubleClick: h, | ||
onRowStyle: i, | ||
onRowStatus: s, | ||
isRowSelected: I, | ||
toggleRowSelected: f, | ||
expandableOpts: g, | ||
onExpandableIconClicked: B, | ||
getExpandableStatusForRow: H, | ||
keyIsOpened: z, | ||
getChildsForParent: T, | ||
getLevelForKey: V, | ||
onCellRender: C, | ||
dataSource: s, | ||
columns: h, | ||
onRowSelectionChange: u, | ||
getColumnSorter: K, | ||
onRowDoubleClick: i, | ||
onRowStyle: o, | ||
onRowStatus: c, | ||
isRowSelected: d, | ||
toggleRowSelected: l, | ||
expandableOpts: y, | ||
onExpandableIconClicked: z, | ||
getExpandableStatusForRow: B, | ||
keyIsOpened: T, | ||
getChildsForParent: V, | ||
getLevelForKey: q, | ||
onCellRender: x, | ||
cellStyle: v == null ? void 0 : v.cellStyle, | ||
readonly: k | ||
readonly: L | ||
} | ||
@@ -877,6 +883,7 @@ ) }) | ||
); | ||
}; | ||
}); | ||
le.displayName = "Table"; | ||
export { | ||
ae as Table | ||
le as Table | ||
}; | ||
//# sourceMappingURL=react-formiga-table.es.js.map |
@@ -55,2 +55,5 @@ import { CSSProperties } from "react"; | ||
}; | ||
export interface TableRef { | ||
unselectAll: () => void; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@gisce/react-formiga-table", | ||
"version": "1.0.0-alpha.12", | ||
"version": "1.0.0-rc.1", | ||
"engines": { | ||
@@ -90,3 +90,3 @@ "node": "20.5.0" | ||
"lint-staged": { | ||
"src/**/*.{js,jsx,ts,tsx}": "eslint --max-warnings=0", | ||
"src/**/*.{js,jsx,ts,tsx}": "eslint", | ||
"src/**/*.{js,jsx,ts,tsx,json,css,md}": "prettier --write" | ||
@@ -96,5 +96,5 @@ }, | ||
"branches": [ | ||
"main", | ||
"v2", | ||
{ | ||
"name": "develop", | ||
"name": "v2-develop", | ||
"prerelease": "rc" | ||
@@ -101,0 +101,0 @@ }, |
@@ -63,1 +63,5 @@ import { CSSProperties } from "react"; | ||
}; | ||
export interface TableRef { | ||
unselectAll: () => void; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
156547
3638