@af-utils/react-mobx-table
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -1,4 +0,4 @@ | ||
export const raw = 14534; | ||
export const min = 8426; | ||
export const minGz = 3196; | ||
export const minBrotli = 2911; | ||
export const raw = 14572; | ||
export const min = 8444; | ||
export const minGz = 3205; | ||
export const minBrotli = 2913; |
131
lib/index.js
@@ -13,5 +13,5 @@ import { Fragment as e, memo as t, useEffect as r, useMemo as o } from "react"; | ||
import { css as w, cx as v } from "@af-utils/styled"; | ||
import { css as w, cx as y } from "@af-utils/styled"; | ||
import { jsxs as G, jsx as y, Fragment as C } from "react/jsx-runtime"; | ||
import { jsxs as v, jsx as G, Fragment as C } from "react/jsx-runtime"; | ||
@@ -200,3 +200,3 @@ const b = new Intl.Collator(void 0, { | ||
const F = [], A = w("cursor: pointer", "user-select: none"), T = v(A, w("font-size: 1.2em", "font-weight: 100", "padding-right: 0.3em")), k = n((e => { | ||
const F = [], A = w("cursor: pointer", "user-select: none"), T = y(A, w("font-size: 1.2em", "font-weight: 100", "padding-right: 0.3em")), k = n((e => { | ||
let {m: t, column: r, i: o} = e; | ||
@@ -210,7 +210,7 @@ const {label: n, key: s} = r, [, i] = f((() => ({ | ||
/*#__PURE__*/ | ||
return G("div", { | ||
return v("div", { | ||
ref: i, | ||
className: A, | ||
onClick: () => t.setSorting(s), | ||
children: [ 0 === o ? /*#__PURE__*/ y("span", { | ||
children: [ 0 === o ? /*#__PURE__*/ G("span", { | ||
onClick: () => t.toggleCompact(), | ||
@@ -221,5 +221,5 @@ className: T, | ||
}); | ||
})), z = w("outline: none", "box-sizing: border-box", "width: 100%", "min-width: 0", "margin-top: 0.3em"), M = n((e => { | ||
})), z = w("outline: none", "box-sizing: border-box", "width: 100%", "min-width: 0", "margin-top: 0.3em"), K = n((e => { | ||
let {m: t, column: r} = e; | ||
return t.compact ? null : /*#__PURE__*/ y("input", { | ||
return t.compact ? null : /*#__PURE__*/ G("input", { | ||
className: z, | ||
@@ -229,7 +229,7 @@ value: t.filtersMap.get(r.key) || "", | ||
}); | ||
})), q = e => { | ||
})), M = e => { | ||
let t = 0; | ||
if (Array.isArray(e)) t += e.length; else for (let r of e.values()) r && (t += q(r)); | ||
if (Array.isArray(e)) t += e.length; else for (let r of e.values()) r && (t += M(r)); | ||
return t; | ||
}, H = (e, t, r) => { | ||
}, q = (e, t, r) => { | ||
let o = 0; | ||
@@ -239,9 +239,9 @@ if (Array.isArray(e)) { | ||
for (const s of e) n = r(s), n && (o += n[t]); | ||
} else for (const n of e.values()) n && (o += H(n, t, r)); | ||
} else for (const n of e.values()) n && (o += q(n, t, r)); | ||
return o; | ||
}, L = n((e => { | ||
}, H = n((e => { | ||
let {m: t, column: r, rowIndexes: o} = e; | ||
if ("count" === r.totals) return q(o); | ||
if ("count" === r.totals) return M(o); | ||
if ("sum" === r.totals) { | ||
const e = H(o, r.key, t.getRowData); | ||
const e = q(o, r.key, t.getRowData); | ||
if (r.formatTotal) { | ||
@@ -254,3 +254,3 @@ const o = t.getTotalsFormattingHelper ? t.getTotalsFormattingHelper() : null; | ||
return null; | ||
})), K = w("user-select: none", "cursor: pointer", "padding-right: 0.3em"), V = w("margin-left: 1em"), W = n((t => { | ||
})), L = w("user-select: none", "cursor: pointer", "padding-right: 0.3em"), V = w("margin-left: 1em"), W = n((t => { | ||
let {m: r, columns: o, i: n} = t; | ||
@@ -263,5 +263,5 @@ const s = r.collapsedGroups.has(n); | ||
/*#__PURE__*/ | ||
return G(C, { | ||
children: [ /*#__PURE__*/ y("span", { | ||
className: K, | ||
return v(C, { | ||
children: [ /*#__PURE__*/ G("span", { | ||
className: L, | ||
onClick: () => r.toggleCollapsedGroup(n), | ||
@@ -273,10 +273,10 @@ "data-collapsed": s ? "" : void 0, | ||
children: s ? "▸" : "▾" | ||
}), " ", u ? u(m) : /*#__PURE__*/ G(C, { | ||
}), " ", u ? u(m) : /*#__PURE__*/ v(C, { | ||
children: [ a, ": ", c ? c(m) : "" + m ] | ||
}), h.length ? /*#__PURE__*/ y("span", { | ||
}), h.length ? /*#__PURE__*/ G("span", { | ||
className: V, | ||
children: h.map(((o, n, s) => { | ||
/*#__PURE__*/ return G(e, { | ||
children: [ /*#__PURE__*/ G("span", { | ||
children: [ o.label, ": ", /*#__PURE__*/ y(L, { | ||
/*#__PURE__*/ return v(e, { | ||
children: [ /*#__PURE__*/ v("span", { | ||
children: [ o.label, ": ", /*#__PURE__*/ G(H, { | ||
m: r, | ||
@@ -303,6 +303,6 @@ column: o, | ||
})), [ t ]); | ||
return t.compact ? null : /*#__PURE__*/ y("div", { | ||
return t.compact ? null : /*#__PURE__*/ G("div", { | ||
className: j, | ||
ref: n, | ||
children: t.groupKeys.length ? t.groupKeys.map((e => /*#__PURE__*/ y(r, { | ||
children: t.groupKeys.length ? t.groupKeys.map((e => /*#__PURE__*/ G(r, { | ||
groupKey: e, | ||
@@ -316,3 +316,3 @@ columns: t.columns, | ||
/*#__PURE__*/ | ||
return y("div", { | ||
return G("div", { | ||
className: O, | ||
@@ -323,8 +323,8 @@ onDoubleClick: o, | ||
}, _ = w("display: flex", "flex-flow: column nowrap", "flex: 1 1 auto"), B = /*#__PURE__*/ t((e => { | ||
let {itemCount: i, estimatedItemSize: l, overscanCount: u, estimatedWidgetSize: a, getRowData: f, getTotalsFormattingHelper: x, columns: w, GroupLabel: b = P, className: I, components: S, footer: D, ...N} = e; | ||
const A = m({ | ||
let {itemCount: i, estimatedItemSize: l, overscanCount: u, estimatedWidgetSize: a, getRowData: f, getKey: x, getTotalsFormattingHelper: w, columns: b, GroupLabel: I = P, className: S, components: D, footer: N, ...A} = e; | ||
const T = m({ | ||
estimatedItemSize: l, | ||
estimatedWidgetSize: a, | ||
overscanCount: u | ||
}), T = h((() => { | ||
}), z = h((() => { | ||
const e = new R; | ||
@@ -334,25 +334,25 @@ e.merge({ | ||
getRowData: f, | ||
getTotalsFormattingHelper: x, | ||
columns: w | ||
getTotalsFormattingHelper: w, | ||
columns: b | ||
}); | ||
const t = e.visibleColumns.filter((e => "number" == typeof e.initialGroupingIndex && e.initialGroupingIndex > 0)).sort(((e, t) => e.initialGroupingIndex - t.initialGroupingIndex)).map((e => e.key)); | ||
return e.setGrouping(t), A.setItemCount(e.finalIndexesCount), e; | ||
return e.setGrouping(t), T.setItemCount(e.finalIndexesCount), e; | ||
})); | ||
r((() => c((() => A.setItemCount(T.finalIndexesCount)))), F), r((() => { | ||
T.merge({ | ||
r((() => c((() => T.setItemCount(z.finalIndexesCount)))), F), r((() => { | ||
z.merge({ | ||
itemCount: i, | ||
getRowData: f, | ||
getTotalsFormattingHelper: x, | ||
columns: w | ||
getTotalsFormattingHelper: w, | ||
columns: b | ||
}); | ||
})); | ||
const z = null == S ? void 0 : S.Row, q = o((() => { | ||
const e = z || g.Row, r = /*#__PURE__*/ t((e => { | ||
const M = null == D ? void 0 : D.Row, q = o((() => { | ||
const e = M || g.Row, r = /*#__PURE__*/ t((e => { | ||
let {i: t, data: r} = e; | ||
/*#__PURE__*/ | ||
return y(r.components.Tr, { | ||
children: /*#__PURE__*/ y(r.components.Td, { | ||
return G(r.components.Tr, { | ||
children: /*#__PURE__*/ G(r.components.Td, { | ||
colSpan: r.columns.length, | ||
children: /*#__PURE__*/ y(W, { | ||
m: T, | ||
children: /*#__PURE__*/ G(W, { | ||
m: z, | ||
i: t, | ||
@@ -365,5 +365,5 @@ columns: r.columns | ||
let {i: t, data: o} = e; | ||
const n = T.finalIndexes[t], s = n < 0 ? r : o.components.PASSED_ROW; | ||
const n = z.finalIndexes[t], s = n < 0 ? r : o.components.PASSED_ROW; | ||
/*#__PURE__*/ | ||
return y(s, { | ||
return G(s, { | ||
i: n, | ||
@@ -375,10 +375,10 @@ data: o | ||
/*#__PURE__*/ | ||
return y(L, { | ||
m: T, | ||
return G(H, { | ||
m: z, | ||
column: t, | ||
rowIndexes: T.filteredIndexes | ||
rowIndexes: z.filteredIndexes | ||
}); | ||
})); | ||
return { | ||
...S, | ||
...D, | ||
PASSED_ROW: e, | ||
@@ -389,9 +389,9 @@ Row: o, | ||
/*#__PURE__*/ | ||
return G(C, { | ||
children: [ /*#__PURE__*/ y(k, { | ||
m: T, | ||
return v(C, { | ||
children: [ /*#__PURE__*/ G(k, { | ||
m: z, | ||
column: t, | ||
i: r | ||
}), /*#__PURE__*/ y(M, { | ||
m: T, | ||
}), /*#__PURE__*/ G(K, { | ||
m: z, | ||
column: t, | ||
@@ -404,17 +404,18 @@ i: r | ||
}; | ||
}), [ z ]); | ||
}), [ M ]); | ||
/*#__PURE__*/ | ||
return G("div", { | ||
className: v(_, I), | ||
children: [ /*#__PURE__*/ y(E, { | ||
aggregatorModel: T, | ||
GroupLabel: b | ||
}), /*#__PURE__*/ y(s, { | ||
children: () => /*#__PURE__*/ y(p, { | ||
model: A, | ||
columns: T.visibleColumns, | ||
return v("div", { | ||
className: y(_, S), | ||
children: [ /*#__PURE__*/ G(E, { | ||
aggregatorModel: z, | ||
GroupLabel: I | ||
}), /*#__PURE__*/ G(s, { | ||
children: () => /*#__PURE__*/ G(p, { | ||
model: T, | ||
columns: z.visibleColumns, | ||
getRowData: f, | ||
getKey: x, | ||
components: q, | ||
footer: T.hasTotals, | ||
...N | ||
footer: z.hasTotals, | ||
...A | ||
}) | ||
@@ -421,0 +422,0 @@ }) ] |
{ | ||
"name": "@af-utils/react-mobx-table", | ||
"private": false, | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "React components for rendering tables", | ||
@@ -55,3 +55,3 @@ "repository": "https://github.com/nowaalex/af-virtual-scroll.git", | ||
"peerDependencies": { | ||
"@af-utils/react-table": "^0.0.5", | ||
"@af-utils/react-table": "^0.0.6", | ||
"@af-utils/react-virtual-headless": "^0.0.5", | ||
@@ -58,0 +58,0 @@ "@af-utils/styled": "^0.0.2", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52322
402