cloudmr-ux 1.0.1 → 1.0.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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ButtonProps } from '@mui/material';
3
- import React, { ChangeEvent } from 'react';
3
+ import React, { ChangeEvent, CSSProperties } from 'react';
4
4
  import { SizeType } from 'antd/lib/config-provider/SizeContext';
5
+ import { DataGridProps } from '@mui/x-data-grid';
5
6
 
6
7
  declare const CmrButton: (props: ButtonProps) => react_jsx_runtime.JSX.Element;
7
8
 
@@ -55,4 +56,13 @@ interface CmrSelectProps {
55
56
  }
56
57
  declare const CmrSelect: React.FC<CmrSelectProps>;
57
58
 
58
- export { CmrButton, CmrCheckbox, CmrInput, CmrRadioGroup, CmrSelect };
59
+ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
60
+ dataSource: any[];
61
+ idAlias?: string;
62
+ name?: string;
63
+ style?: CSSProperties;
64
+ showCheckbox?: boolean;
65
+ }
66
+ declare const CmrTable: (props: CmrTableProps) => react_jsx_runtime.JSX.Element;
67
+
68
+ export { CmrButton, CmrCheckbox, CmrInput, CmrRadioGroup, CmrSelect, CmrTable };
package/dist/index.js CHANGED
@@ -24,7 +24,8 @@ __export(src_exports, {
24
24
  CmrCheckbox: () => CmrCheckbox,
25
25
  CmrInput: () => CmrInput,
26
26
  CmrRadioGroup: () => CmrRadioGroup_default,
27
- CmrSelect: () => CmrSelect_default
27
+ CmrSelect: () => CmrSelect_default,
28
+ CmrTable: () => CmrTable_default
28
29
  });
29
30
  module.exports = __toCommonJS(src_exports);
30
31
 
@@ -176,11 +177,32 @@ var CmrSelect_default = CmrSelect;
176
177
  // src/CmrTable/CmrTable.tsx
177
178
  var import_x_data_grid = require("@mui/x-data-grid");
178
179
  var import_jsx_runtime6 = require("react/jsx-runtime");
180
+ var CmrTable = (props) => {
181
+ const { dataSource, columns, idAlias, className, onRowSelectionModelChange, style, showCheckbox = true, ...rest } = props;
182
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: style ? style : { height: "400px", width: "100%" }, className: `${className ? className : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
183
+ import_x_data_grid.DataGrid,
184
+ {
185
+ rows: dataSource ? dataSource.map((row) => ({ id: idAlias ? row[idAlias] : row["id"], ...row })) : [],
186
+ columns,
187
+ checkboxSelection: showCheckbox,
188
+ onRowSelectionModelChange,
189
+ initialState: {
190
+ pagination: {
191
+ paginationModel: { pageSize: 50, page: 0 }
192
+ }
193
+ },
194
+ localeText: { noRowsLabel: "" },
195
+ ...rest
196
+ }
197
+ ) });
198
+ };
199
+ var CmrTable_default = CmrTable;
179
200
  // Annotate the CommonJS export names for ESM import in node:
180
201
  0 && (module.exports = {
181
202
  CmrButton,
182
203
  CmrCheckbox,
183
204
  CmrInput,
184
205
  CmrRadioGroup,
185
- CmrSelect
206
+ CmrSelect,
207
+ CmrTable
186
208
  });
package/dist/index.mjs CHANGED
@@ -152,10 +152,31 @@ var CmrSelect_default = CmrSelect;
152
152
  // src/CmrTable/CmrTable.tsx
153
153
  import { DataGrid } from "@mui/x-data-grid";
154
154
  import { jsx as jsx6 } from "react/jsx-runtime";
155
+ var CmrTable = (props) => {
156
+ const { dataSource, columns, idAlias, className, onRowSelectionModelChange, style, showCheckbox = true, ...rest } = props;
157
+ return /* @__PURE__ */ jsx6("div", { style: style ? style : { height: "400px", width: "100%" }, className: `${className ? className : ""}`, children: /* @__PURE__ */ jsx6(
158
+ DataGrid,
159
+ {
160
+ rows: dataSource ? dataSource.map((row) => ({ id: idAlias ? row[idAlias] : row["id"], ...row })) : [],
161
+ columns,
162
+ checkboxSelection: showCheckbox,
163
+ onRowSelectionModelChange,
164
+ initialState: {
165
+ pagination: {
166
+ paginationModel: { pageSize: 50, page: 0 }
167
+ }
168
+ },
169
+ localeText: { noRowsLabel: "" },
170
+ ...rest
171
+ }
172
+ ) });
173
+ };
174
+ var CmrTable_default = CmrTable;
155
175
  export {
156
176
  CmrButton,
157
177
  CmrCheckbox,
158
178
  CmrInput,
159
179
  CmrRadioGroup_default as CmrRadioGroup,
160
- CmrSelect_default as CmrSelect
180
+ CmrSelect_default as CmrSelect,
181
+ CmrTable_default as CmrTable
161
182
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",