@conboai/storybook.components 0.3.99 → 0.4.2

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,9 @@ 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[];
24
+ csvDataFormatter?: (value: any, column: GridColDef) => string;
22
25
  }
23
26
  declare const CustomDataGrid: FC<CustomDataGridProps>;
24
27
  export default CustomDataGrid;
@@ -97135,34 +97135,39 @@ 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,
97141
+ csvDataFormatter: C = (E) => E.toString()
97139
97142
  }) => {
97140
- const [v, y] = $e({
97143
+ const [E, w] = $e({
97141
97144
  page: 0,
97142
97145
  pageSize: i[0]
97143
- }), [C, E] = $e([]), w = A3e(), k = Tr(
97144
- (D) => {
97145
- E(D), u && u(D);
97146
+ }), [k, L] = $e([]), _ = A3e(), B = Tr(
97147
+ (x) => {
97148
+ L(x), u && u(x);
97146
97149
  },
97147
97150
  [u]
97148
- ), L = Tr(
97149
- (D) => {
97150
- if (y(D), d) {
97151
- const I = {
97152
- previousPage: v.page
97151
+ ), O = Tr(
97152
+ (x) => {
97153
+ if (w(x), d) {
97154
+ const T = {
97155
+ previousPage: E.page
97153
97156
  };
97154
- d(D, I);
97157
+ d(x, T);
97155
97158
  }
97156
97159
  },
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(
97160
+ [d, E.page]
97161
+ ), D = () => {
97162
+ const T = "data:text/csv;charset=utf-8," + (y || e.map((V) => V.headerName)).join(",") + `
97163
+ ` + t.map(
97164
+ (V) => e.map((j) => C(V[j.field], j)).join(",")
97165
+ ).join(`
97166
+ `), R = encodeURI(T), P = document.createElement("a");
97167
+ P.setAttribute("href", R), P.setAttribute("download", v), document.body.appendChild(P), P.click();
97168
+ }, I = (x) => {
97169
+ m && m(null), h && h(x, event);
97170
+ }, M = () => !g && /* @__PURE__ */ H.jsxs(
97166
97171
  ey,
97167
97172
  {
97168
97173
  sx: {
@@ -97176,7 +97181,7 @@ const A3e = $me, D3e = (e, t) => ({
97176
97181
  Rr,
97177
97182
  {
97178
97183
  variant: "text",
97179
- onClick: _,
97184
+ onClick: D,
97180
97185
  disabled: !t.length,
97181
97186
  children: /* @__PURE__ */ H.jsxs(
97182
97187
  en,
@@ -97215,12 +97220,12 @@ const A3e = $me, D3e = (e, t) => ({
97215
97220
  {
97216
97221
  rowsPerPageOptions: i,
97217
97222
  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)
97223
+ page: E.page,
97224
+ onPageChange: (x, T) => w((R) => ({ ...R, page: T })),
97225
+ rowsPerPage: E.pageSize,
97226
+ onRowsPerPageChange: (x) => w((T) => ({
97227
+ ...T,
97228
+ pageSize: parseInt(x.target.value, 10)
97224
97229
  }))
97225
97230
  }
97226
97231
  ) : /* @__PURE__ */ H.jsxs(
@@ -97243,10 +97248,10 @@ const A3e = $me, D3e = (e, t) => ({
97243
97248
  );
97244
97249
  return Pe(() => {
97245
97250
  if (p) {
97246
- const D = t.findIndex((I) => I.id === p);
97247
- D >= 0 && w.current.scrollToIndexes({ rowIndex: D });
97251
+ const x = t.findIndex((T) => T.id === p);
97252
+ x >= 0 && _.current.scrollToIndexes({ rowIndex: x });
97248
97253
  }
97249
- }, [p, t, w]), /* @__PURE__ */ H.jsx(bo, { sx: D3e(a, l), children: /* @__PURE__ */ H.jsx(
97254
+ }, [p, t, _]), /* @__PURE__ */ H.jsx(bo, { sx: D3e(a, l), children: /* @__PURE__ */ H.jsx(
97250
97255
  R3e,
97251
97256
  {
97252
97257
  rows: t,
@@ -97255,22 +97260,22 @@ const A3e = $me, D3e = (e, t) => ({
97255
97260
  columns: e,
97256
97261
  paginationMode: r ? "server" : void 0,
97257
97262
  sortingMode: "server",
97258
- paginationModel: v,
97263
+ paginationModel: E,
97259
97264
  rowCount: c,
97260
97265
  pagination: r,
97261
- onPaginationModelChange: r ? L : void 0,
97262
- sortModel: C,
97266
+ onPaginationModelChange: r ? O : void 0,
97267
+ sortModel: k,
97263
97268
  disableRowSelectionOnClick: !0,
97264
- onSortModelChange: k,
97265
- onRowClick: B,
97269
+ onSortModelChange: B,
97270
+ onRowClick: I,
97266
97271
  slots: {
97267
- footer: O
97272
+ footer: M
97268
97273
  },
97269
97274
  loading: n,
97270
97275
  sx: O3e(a, l),
97271
97276
  onRowsScrollEnd: r ? void 0 : f,
97272
- getRowClassName: (D) => D.id === p ? "Mui-selected" : "",
97273
- apiRef: w
97277
+ getRowClassName: (x) => x.id === p ? "Mui-selected" : "",
97278
+ apiRef: _
97274
97279
  }
97275
97280
  ) });
97276
97281
  }, Oye = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conboai/storybook.components",
3
- "version": "0.3.99",
3
+ "version": "0.4.2",
4
4
  "main": "dist/storybook.components.mjs",
5
5
  "types": "dist/build/index.d.ts",
6
6
  "files": [