@conboai/storybook.components 0.3.98 → 0.4.1

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.
@@ -19,6 +19,8 @@ export interface CustomDataGridProps {
19
19
  hideFooter?: boolean;
20
20
  selectedRowId?: string | number;
21
21
  onRowIdSelect?: (value: number | null | string) => void;
22
+ csvFileName?: string;
23
+ csvHeaders?: string[];
22
24
  }
23
25
  declare const CustomDataGrid: FC<CustomDataGridProps>;
24
26
  export default CustomDataGrid;
@@ -74870,7 +74870,7 @@ const hce = (e = []) => wl.isEqual(e[0], e.at(-1)) && e.length !== 1 ? e.slice(0
74870
74870
  {
74871
74871
  x: o.x,
74872
74872
  y: o.y - 2.5,
74873
- fill: "black",
74873
+ fill: (r == null ? void 0 : r.textColor) || "black",
74874
74874
  fontSize: a,
74875
74875
  fontWeight: "bold",
74876
74876
  children: e.text
@@ -97135,34 +97135,36 @@ const A3e = $me, D3e = (e, t) => ({
97135
97135
  total: b,
97136
97136
  hideFooter: g = !1,
97137
97137
  selectedRowId: p,
97138
- onRowIdSelect: m
97138
+ onRowIdSelect: m,
97139
+ csvFileName: v = "table_data.csv",
97140
+ csvHeaders: y
97139
97141
  }) => {
97140
- const [v, y] = $e({
97142
+ const [C, E] = $e({
97141
97143
  page: 0,
97142
97144
  pageSize: i[0]
97143
- }), [C, E] = $e([]), w = A3e(), k = Tr(
97144
- (D) => {
97145
- E(D), u && u(D);
97145
+ }), [w, k] = $e([]), L = A3e(), _ = Tr(
97146
+ (M) => {
97147
+ k(M), u && u(M);
97146
97148
  },
97147
97149
  [u]
97148
- ), L = Tr(
97149
- (D) => {
97150
- if (y(D), d) {
97151
- const I = {
97152
- previousPage: v.page
97150
+ ), B = Tr(
97151
+ (M) => {
97152
+ if (E(M), d) {
97153
+ const x = {
97154
+ previousPage: C.page
97153
97155
  };
97154
- d(D, I);
97156
+ d(M, x);
97155
97157
  }
97156
97158
  },
97157
- [d, v.page]
97158
- ), _ = () => {
97159
- const D = "data:text/csv;charset=utf-8," + e.map((x) => x.headerName).join(",") + `
97160
- ` + t.map((x) => e.map((T) => x[T.field]).join(",")).join(`
97161
- `), I = encodeURI(D), M = document.createElement("a");
97162
- M.setAttribute("href", I), M.setAttribute("download", "table_data.csv"), document.body.appendChild(M), M.click();
97163
- }, B = (D) => {
97164
- m && m(null), h && h(D, event);
97165
- }, O = () => !g && /* @__PURE__ */ H.jsxs(
97159
+ [d, C.page]
97160
+ ), O = () => {
97161
+ const x = "data:text/csv;charset=utf-8," + (y || e.map((P) => P.headerName)).join(",") + `
97162
+ ` + t.map((P) => e.map((V) => P[V.field]).join(",")).join(`
97163
+ `), T = encodeURI(x), R = document.createElement("a");
97164
+ R.setAttribute("href", T), R.setAttribute("download", v), document.body.appendChild(R), R.click();
97165
+ }, D = (M) => {
97166
+ m && m(null), h && h(M, event);
97167
+ }, I = () => !g && /* @__PURE__ */ H.jsxs(
97166
97168
  ey,
97167
97169
  {
97168
97170
  sx: {
@@ -97176,7 +97178,7 @@ const A3e = $me, D3e = (e, t) => ({
97176
97178
  Rr,
97177
97179
  {
97178
97180
  variant: "text",
97179
- onClick: _,
97181
+ onClick: O,
97180
97182
  disabled: !t.length,
97181
97183
  children: /* @__PURE__ */ H.jsxs(
97182
97184
  en,
@@ -97215,12 +97217,12 @@ const A3e = $me, D3e = (e, t) => ({
97215
97217
  {
97216
97218
  rowsPerPageOptions: i,
97217
97219
  count: c,
97218
- page: v.page,
97219
- onPageChange: (D, I) => y((M) => ({ ...M, page: I })),
97220
- rowsPerPage: v.pageSize,
97221
- onRowsPerPageChange: (D) => y((I) => ({
97222
- ...I,
97223
- pageSize: parseInt(D.target.value, 10)
97220
+ page: C.page,
97221
+ onPageChange: (M, x) => E((T) => ({ ...T, page: x })),
97222
+ rowsPerPage: C.pageSize,
97223
+ onRowsPerPageChange: (M) => E((x) => ({
97224
+ ...x,
97225
+ pageSize: parseInt(M.target.value, 10)
97224
97226
  }))
97225
97227
  }
97226
97228
  ) : /* @__PURE__ */ H.jsxs(
@@ -97243,10 +97245,10 @@ const A3e = $me, D3e = (e, t) => ({
97243
97245
  );
97244
97246
  return Pe(() => {
97245
97247
  if (p) {
97246
- const D = t.findIndex((I) => I.id === p);
97247
- D >= 0 && w.current.scrollToIndexes({ rowIndex: D });
97248
+ const M = t.findIndex((x) => x.id === p);
97249
+ M >= 0 && L.current.scrollToIndexes({ rowIndex: M });
97248
97250
  }
97249
- }, [p, t, w]), /* @__PURE__ */ H.jsx(bo, { sx: D3e(a, l), children: /* @__PURE__ */ H.jsx(
97251
+ }, [p, t, L]), /* @__PURE__ */ H.jsx(bo, { sx: D3e(a, l), children: /* @__PURE__ */ H.jsx(
97250
97252
  R3e,
97251
97253
  {
97252
97254
  rows: t,
@@ -97255,22 +97257,22 @@ const A3e = $me, D3e = (e, t) => ({
97255
97257
  columns: e,
97256
97258
  paginationMode: r ? "server" : void 0,
97257
97259
  sortingMode: "server",
97258
- paginationModel: v,
97260
+ paginationModel: C,
97259
97261
  rowCount: c,
97260
97262
  pagination: r,
97261
- onPaginationModelChange: r ? L : void 0,
97262
- sortModel: C,
97263
+ onPaginationModelChange: r ? B : void 0,
97264
+ sortModel: w,
97263
97265
  disableRowSelectionOnClick: !0,
97264
- onSortModelChange: k,
97265
- onRowClick: B,
97266
+ onSortModelChange: _,
97267
+ onRowClick: D,
97266
97268
  slots: {
97267
- footer: O
97269
+ footer: I
97268
97270
  },
97269
97271
  loading: n,
97270
97272
  sx: O3e(a, l),
97271
97273
  onRowsScrollEnd: r ? void 0 : f,
97272
- getRowClassName: (D) => D.id === p ? "Mui-selected" : "",
97273
- apiRef: w
97274
+ getRowClassName: (M) => M.id === p ? "Mui-selected" : "",
97275
+ apiRef: L
97274
97276
  }
97275
97277
  ) });
97276
97278
  }, Oye = ({
@@ -97398,7 +97400,10 @@ const A3e = $me, D3e = (e, t) => ({
97398
97400
  ..._3e,
97399
97401
  ...l
97400
97402
  }, x = Tr(
97401
- (P, V) => u && u(P, V),
97403
+ (P, V) => {
97404
+ if (!P) return null;
97405
+ u && u(P, V);
97406
+ },
97402
97407
  [u]
97403
97408
  ), T = () => C((P) => (v(!1), !P)), R = () => v((P) => (C(!1), !P));
97404
97409
  return /* @__PURE__ */ H.jsxs(Et, { sx: M, children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conboai/storybook.components",
3
- "version": "0.3.98",
3
+ "version": "0.4.1",
4
4
  "main": "dist/storybook.components.mjs",
5
5
  "types": "dist/build/index.d.ts",
6
6
  "files": [