cloudmr-ux 1.0.0 → 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.css CHANGED
@@ -140,3 +140,27 @@
140
140
  .custom-dropdown .MuiMenuItem-root.Mui-selected:hover {
141
141
  background-color: #dcbfea !important;
142
142
  }
143
+
144
+ /* src/CmrTable/CmrTable.css */
145
+ .css-1lymaxv-MuiDataGrid-root .MuiDataGrid-columnHeader:focus-within,
146
+ .css-1lymaxv-MuiDataGrid-root .MuiDataGrid-cell:focus-within {
147
+ outline: none !important;
148
+ }
149
+ .MuiTablePagination-selectLabel,
150
+ .MuiTablePagination-displayedRows {
151
+ margin-bottom: 0;
152
+ }
153
+ .MuiDataGrid-columnHeaders {
154
+ background: rgba(88, 15, 139, 0.08);
155
+ color: #333;
156
+ }
157
+ .MuiDataGrid-columnHeaders .MuiSvgIcon-root {
158
+ color: #580f8b;
159
+ }
160
+ // Religning MUI checkbox in the header .MuiDataGrid-columnHeaderCheckbox .MuiDataGrid-columnHeaderTitleContainerContent {
161
+ padding: 0 !important;
162
+ margin: 0 !important;
163
+ display: flex;
164
+ justify-content: center;
165
+ align-items: center;
166
+ }
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
 
@@ -172,11 +173,36 @@ var CmrSelect = ({ options, label, disabled }) => {
172
173
  ] });
173
174
  };
174
175
  var CmrSelect_default = CmrSelect;
176
+
177
+ // src/CmrTable/CmrTable.tsx
178
+ var import_x_data_grid = require("@mui/x-data-grid");
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;
175
200
  // Annotate the CommonJS export names for ESM import in node:
176
201
  0 && (module.exports = {
177
202
  CmrButton,
178
203
  CmrCheckbox,
179
204
  CmrInput,
180
205
  CmrRadioGroup,
181
- CmrSelect
206
+ CmrSelect,
207
+ CmrTable
182
208
  });
package/dist/index.mjs CHANGED
@@ -148,10 +148,35 @@ var CmrSelect = ({ options, label, disabled }) => {
148
148
  ] });
149
149
  };
150
150
  var CmrSelect_default = CmrSelect;
151
+
152
+ // src/CmrTable/CmrTable.tsx
153
+ import { DataGrid } from "@mui/x-data-grid";
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;
151
175
  export {
152
176
  CmrButton,
153
177
  CmrCheckbox,
154
178
  CmrInput,
155
179
  CmrRadioGroup_default as CmrRadioGroup,
156
- CmrSelect_default as CmrSelect
180
+ CmrSelect_default as CmrSelect,
181
+ CmrTable_default as CmrTable
157
182
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",