@conboai/storybook.components 0.5.55 → 0.5.56

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.
@@ -25,6 +25,7 @@ export interface CustomDataGridProps {
25
25
  useClientSorting?: boolean;
26
26
  isShapeSelection?: boolean;
27
27
  infoText?: string;
28
+ totalText?: string;
28
29
  }
29
30
  declare const CustomDataGrid: FC<CustomDataGridProps>;
30
31
  export default CustomDataGrid;
@@ -98783,49 +98783,50 @@ const lye = r1e, cye = (e, t) => ({
98783
98783
  onRowIdSelect: m,
98784
98784
  csvFileName: v = "table_data.csv",
98785
98785
  csvHeaders: y,
98786
- csvDataFormatter: C = (M) => M.toString(),
98786
+ csvDataFormatter: C = (O) => O.toString(),
98787
98787
  useClientSorting: S = !1,
98788
98788
  isShapeSelection: w = !1,
98789
- infoText: E = "No rows"
98789
+ infoText: E = "No rows",
98790
+ totalText: M = ""
98790
98791
  }) => {
98791
- const [M, O] = Be({
98792
+ const [O, F] = Be({
98792
98793
  page: 0,
98793
98794
  pageSize: i[0]
98794
- }), [F, D] = Be([]), A = lye(), P = Ao(() => S && F.length > 0 ? [...t].sort((H, B) => {
98795
- for (const N of F) {
98796
- const { field: U, sort: Y } = N;
98797
- if (H[U] < B[U]) return Y === "asc" ? -1 : 1;
98798
- if (H[U] > B[U]) return Y === "asc" ? 1 : -1;
98795
+ }), [D, A] = Be([]), P = lye(), L = Ao(() => S && D.length > 0 ? [...t].sort((B, N) => {
98796
+ for (const U of D) {
98797
+ const { field: Y, sort: X } = U;
98798
+ if (B[Y] < N[Y]) return X === "asc" ? -1 : 1;
98799
+ if (B[Y] > N[Y]) return X === "asc" ? 1 : -1;
98799
98800
  }
98800
98801
  return 0;
98801
- }) : t, [t, F, S]), L = In(
98802
- (H) => {
98803
- D(H), u && u(H);
98802
+ }) : t, [t, D, S]), x = In(
98803
+ (B) => {
98804
+ A(B), u && u(B);
98804
98805
  },
98805
98806
  [u]
98806
- ), x = In(
98807
- (H) => {
98808
- if (O(H), d) {
98809
- const B = {
98810
- previousPage: M.page
98807
+ ), k = In(
98808
+ (B) => {
98809
+ if (F(B), d) {
98810
+ const N = {
98811
+ previousPage: O.page
98811
98812
  };
98812
- d(H, B);
98813
+ d(B, N);
98813
98814
  }
98814
98815
  },
98815
- [d, M.page]
98816
- ), k = In(
98817
- (H) => {
98818
- m == null || m(null), h == null || h(H);
98816
+ [d, O.page]
98817
+ ), R = In(
98818
+ (B) => {
98819
+ m == null || m(null), h == null || h(B);
98819
98820
  },
98820
98821
  [h, m]
98821
- ), R = () => {
98822
- const B = "data:text/csv;charset=utf-8," + (y || e.map((Y) => Y.headerName)).join(",") + `
98823
- ` + P.map(
98824
- (Y) => e.map((X) => C(Y[X.field], X)).join(",")
98822
+ ), I = () => {
98823
+ const N = "data:text/csv;charset=utf-8," + (y || e.map((X) => X.headerName)).join(",") + `
98824
+ ` + L.map(
98825
+ (X) => e.map((Z) => C(X[Z.field], Z)).join(",")
98825
98826
  ).join(`
98826
- `), N = encodeURI(B), U = document.createElement("a");
98827
- U.setAttribute("href", N), U.setAttribute("download", v), document.body.appendChild(U), U.click(), document.body.removeChild(U);
98828
- }, I = () => !p && /* @__PURE__ */ V.jsxs(
98827
+ `), U = encodeURI(N), Y = document.createElement("a");
98828
+ Y.setAttribute("href", U), Y.setAttribute("download", v), document.body.appendChild(Y), Y.click(), document.body.removeChild(Y);
98829
+ }, H = () => !p && /* @__PURE__ */ V.jsxs(
98829
98830
  j5,
98830
98831
  {
98831
98832
  sx: {
@@ -98839,7 +98840,7 @@ const lye = r1e, cye = (e, t) => ({
98839
98840
  Ir,
98840
98841
  {
98841
98842
  variant: "text",
98842
- onClick: R,
98843
+ onClick: I,
98843
98844
  disabled: !t.length,
98844
98845
  children: /* @__PURE__ */ V.jsxs(
98845
98846
  nn,
@@ -98878,15 +98879,15 @@ const lye = r1e, cye = (e, t) => ({
98878
98879
  {
98879
98880
  rowsPerPageOptions: i,
98880
98881
  count: c,
98881
- page: M.page,
98882
- onPageChange: (H, B) => O((N) => ({ ...N, page: B })),
98883
- rowsPerPage: M.pageSize,
98884
- onRowsPerPageChange: (H) => O((B) => ({
98885
- ...B,
98886
- pageSize: parseInt(H.target.value, 10)
98882
+ page: O.page,
98883
+ onPageChange: (B, N) => F((U) => ({ ...U, page: N })),
98884
+ rowsPerPage: O.pageSize,
98885
+ onRowsPerPageChange: (B) => F((N) => ({
98886
+ ...N,
98887
+ pageSize: parseInt(B.target.value, 10)
98887
98888
  }))
98888
98889
  }
98889
- ) : /* @__PURE__ */ V.jsxs(
98890
+ ) : /* @__PURE__ */ V.jsx(
98890
98891
  Ot,
98891
98892
  {
98892
98893
  sx: {
@@ -98894,46 +98895,42 @@ const lye = r1e, cye = (e, t) => ({
98894
98895
  color: l === "light" ? "#000000" : "rgba(255, 255, 255, 0.5)",
98895
98896
  fontSize: "14px"
98896
98897
  },
98897
- children: [
98898
- t.length,
98899
- " rows from ",
98900
- b || "Unknown"
98901
- ]
98898
+ children: M || `${t.length} rows from ${b || "Unknown"}`
98902
98899
  }
98903
98900
  )
98904
98901
  ]
98905
98902
  }
98906
98903
  );
98907
98904
  return Ie(() => {
98908
- if (w && A.current) {
98909
- const H = A.current.getRowIndexRelativeToVisibleRows(g);
98910
- H != null && H >= 0 && A.current.scrollToIndexes({ rowIndex: H });
98905
+ if (w && P.current) {
98906
+ const B = P.current.getRowIndexRelativeToVisibleRows(g);
98907
+ B != null && B >= 0 && P.current.scrollToIndexes({ rowIndex: B });
98911
98908
  }
98912
- }, [g, A, w]), /* @__PURE__ */ V.jsx(ci, { sx: cye(s, l), children: /* @__PURE__ */ V.jsx(
98909
+ }, [g, P, w]), /* @__PURE__ */ V.jsx(ci, { sx: cye(s, l), children: /* @__PURE__ */ V.jsx(
98913
98910
  aye,
98914
98911
  {
98915
- rows: P,
98912
+ rows: L,
98916
98913
  rowSelection: !0,
98917
98914
  rowHeight: 35,
98918
98915
  columns: e,
98919
98916
  paginationMode: r ? "server" : void 0,
98920
98917
  sortingMode: S ? "client" : "server",
98921
- paginationModel: M,
98918
+ paginationModel: O,
98922
98919
  rowCount: c,
98923
98920
  pagination: r,
98924
- onPaginationModelChange: r ? x : void 0,
98925
- sortModel: F,
98921
+ onPaginationModelChange: r ? k : void 0,
98922
+ sortModel: D,
98926
98923
  disableRowSelectionOnClick: !0,
98927
- onSortModelChange: L,
98928
- onRowClick: k,
98924
+ onSortModelChange: x,
98925
+ onRowClick: R,
98929
98926
  slots: {
98930
- footer: I
98927
+ footer: H
98931
98928
  },
98932
98929
  loading: n,
98933
98930
  sx: uye(s, l),
98934
98931
  onRowsScrollEnd: r ? void 0 : f,
98935
- getRowClassName: (H) => H.id === g ? "Mui-selected" : "",
98936
- apiRef: A,
98932
+ getRowClassName: (B) => B.id === g ? "Mui-selected" : "",
98933
+ apiRef: P,
98937
98934
  localeText: {
98938
98935
  noRowsLabel: E
98939
98936
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conboai/storybook.components",
3
- "version": "0.5.55",
3
+ "version": "0.5.56",
4
4
  "main": "dist/storybook.components.mjs",
5
5
  "types": "dist/build/index.d.ts",
6
6
  "files": [