@conboai/storybook.components 0.4.1 → 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.
@@ -21,6 +21,7 @@ export interface CustomDataGridProps {
21
21
  onRowIdSelect?: (value: number | null | string) => void;
22
22
  csvFileName?: string;
23
23
  csvHeaders?: string[];
24
+ csvDataFormatter?: (value: any, column: GridColDef) => string;
24
25
  }
25
26
  declare const CustomDataGrid: FC<CustomDataGridProps>;
26
27
  export default CustomDataGrid;
@@ -97137,34 +97137,37 @@ const A3e = $me, D3e = (e, t) => ({
97137
97137
  selectedRowId: p,
97138
97138
  onRowIdSelect: m,
97139
97139
  csvFileName: v = "table_data.csv",
97140
- csvHeaders: y
97140
+ csvHeaders: y,
97141
+ csvDataFormatter: C = (E) => E.toString()
97141
97142
  }) => {
97142
- const [C, E] = $e({
97143
+ const [E, w] = $e({
97143
97144
  page: 0,
97144
97145
  pageSize: i[0]
97145
- }), [w, k] = $e([]), L = A3e(), _ = Tr(
97146
- (M) => {
97147
- k(M), u && u(M);
97146
+ }), [k, L] = $e([]), _ = A3e(), B = Tr(
97147
+ (x) => {
97148
+ L(x), u && u(x);
97148
97149
  },
97149
97150
  [u]
97150
- ), B = Tr(
97151
- (M) => {
97152
- if (E(M), d) {
97153
- const x = {
97154
- previousPage: C.page
97151
+ ), O = Tr(
97152
+ (x) => {
97153
+ if (w(x), d) {
97154
+ const T = {
97155
+ previousPage: E.page
97155
97156
  };
97156
- d(M, x);
97157
+ d(x, T);
97157
97158
  }
97158
97159
  },
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(
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(
97168
97171
  ey,
97169
97172
  {
97170
97173
  sx: {
@@ -97178,7 +97181,7 @@ const A3e = $me, D3e = (e, t) => ({
97178
97181
  Rr,
97179
97182
  {
97180
97183
  variant: "text",
97181
- onClick: O,
97184
+ onClick: D,
97182
97185
  disabled: !t.length,
97183
97186
  children: /* @__PURE__ */ H.jsxs(
97184
97187
  en,
@@ -97217,12 +97220,12 @@ const A3e = $me, D3e = (e, t) => ({
97217
97220
  {
97218
97221
  rowsPerPageOptions: i,
97219
97222
  count: c,
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)
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)
97226
97229
  }))
97227
97230
  }
97228
97231
  ) : /* @__PURE__ */ H.jsxs(
@@ -97245,10 +97248,10 @@ const A3e = $me, D3e = (e, t) => ({
97245
97248
  );
97246
97249
  return Pe(() => {
97247
97250
  if (p) {
97248
- const M = t.findIndex((x) => x.id === p);
97249
- M >= 0 && L.current.scrollToIndexes({ rowIndex: M });
97251
+ const x = t.findIndex((T) => T.id === p);
97252
+ x >= 0 && _.current.scrollToIndexes({ rowIndex: x });
97250
97253
  }
97251
- }, [p, t, L]), /* @__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(
97252
97255
  R3e,
97253
97256
  {
97254
97257
  rows: t,
@@ -97257,22 +97260,22 @@ const A3e = $me, D3e = (e, t) => ({
97257
97260
  columns: e,
97258
97261
  paginationMode: r ? "server" : void 0,
97259
97262
  sortingMode: "server",
97260
- paginationModel: C,
97263
+ paginationModel: E,
97261
97264
  rowCount: c,
97262
97265
  pagination: r,
97263
- onPaginationModelChange: r ? B : void 0,
97264
- sortModel: w,
97266
+ onPaginationModelChange: r ? O : void 0,
97267
+ sortModel: k,
97265
97268
  disableRowSelectionOnClick: !0,
97266
- onSortModelChange: _,
97267
- onRowClick: D,
97269
+ onSortModelChange: B,
97270
+ onRowClick: I,
97268
97271
  slots: {
97269
- footer: I
97272
+ footer: M
97270
97273
  },
97271
97274
  loading: n,
97272
97275
  sx: O3e(a, l),
97273
97276
  onRowsScrollEnd: r ? void 0 : f,
97274
- getRowClassName: (M) => M.id === p ? "Mui-selected" : "",
97275
- apiRef: L
97277
+ getRowClassName: (x) => x.id === p ? "Mui-selected" : "",
97278
+ apiRef: _
97276
97279
  }
97277
97280
  ) });
97278
97281
  }, Oye = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conboai/storybook.components",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "main": "dist/storybook.components.mjs",
5
5
  "types": "dist/build/index.d.ts",
6
6
  "files": [