cloudmr-ux 1.0.4 → 1.0.6
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 +5 -0
- package/dist/index.d.ts +79 -51
- package/dist/index.js +138 -5
- package/dist/index.mjs +126 -5
- package/package.json +2 -2
package/dist/index.css
CHANGED
|
@@ -141,6 +141,11 @@
|
|
|
141
141
|
background-color: #dcbfea !important;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/* src/CmrComponents/collapse/Collapse.css */
|
|
145
|
+
.collapse-bar {
|
|
146
|
+
margin-bottom: 4px;
|
|
147
|
+
}
|
|
148
|
+
|
|
144
149
|
/* src/CmrTable/CmrTable.css */
|
|
145
150
|
.css-1lymaxv-MuiDataGrid-root .MuiDataGrid-columnHeader:focus-within,
|
|
146
151
|
.css-1lymaxv-MuiDataGrid-root .MuiDataGrid-cell:focus-within {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,68 +1,96 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ButtonProps } from '@mui/material';
|
|
3
|
-
import React, { ChangeEvent, CSSProperties } from 'react';
|
|
3
|
+
import React, { ChangeEvent, ReactNode, CSSProperties, FC } from 'react';
|
|
4
4
|
import { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
5
|
+
import { CollapsibleType } from 'antd/es/collapse/CollapsePanel';
|
|
6
|
+
import { ExpandIconPosition } from 'antd/es/collapse/Collapse';
|
|
5
7
|
import { DataGridProps } from '@mui/x-data-grid';
|
|
6
8
|
|
|
7
9
|
declare const CmrButton: (props: ButtonProps) => react_jsx_runtime.JSX.Element;
|
|
8
10
|
|
|
9
|
-
interface CmrCheckboxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
-
autoFocus?: boolean;
|
|
11
|
-
checked?: boolean;
|
|
12
|
-
defaultChecked?: boolean;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
indeterminate?: boolean;
|
|
15
|
-
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
-
children?: any;
|
|
17
|
-
style?: any;
|
|
18
|
-
}
|
|
11
|
+
interface CmrCheckboxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
autoFocus?: boolean;
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
defaultChecked?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
indeterminate?: boolean;
|
|
17
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
18
|
+
children?: any;
|
|
19
|
+
style?: any;
|
|
20
|
+
}
|
|
19
21
|
declare const CmrCheckbox: (props: CmrCheckboxProps) => react_jsx_runtime.JSX.Element;
|
|
20
22
|
|
|
21
|
-
interface CmrInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
|
22
|
-
defaultValue?: string;
|
|
23
|
-
id?: string;
|
|
24
|
-
maxLength?: number;
|
|
25
|
-
size?: SizeType;
|
|
26
|
-
value?: string;
|
|
27
|
-
type?: any;
|
|
28
|
-
prefix?: React.ReactNode;
|
|
29
|
-
bordered?: boolean;
|
|
30
|
-
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
-
onPressEnter?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
32
|
-
}
|
|
23
|
+
interface CmrInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
|
24
|
+
defaultValue?: string;
|
|
25
|
+
id?: string;
|
|
26
|
+
maxLength?: number;
|
|
27
|
+
size?: SizeType;
|
|
28
|
+
value?: string;
|
|
29
|
+
type?: any;
|
|
30
|
+
prefix?: React.ReactNode;
|
|
31
|
+
bordered?: boolean;
|
|
32
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
33
|
+
onPressEnter?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
34
|
+
}
|
|
33
35
|
declare const CmrInput: (props: CmrInputProps) => react_jsx_runtime.JSX.Element;
|
|
34
36
|
|
|
35
|
-
interface CmrRadioOption {
|
|
36
|
-
label: string;
|
|
37
|
-
value: string;
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
}
|
|
40
|
-
interface CmrRadioProps {
|
|
41
|
-
options: CmrRadioOption[];
|
|
42
|
-
groupLabel?: string;
|
|
43
|
-
defaultValue?: string;
|
|
44
|
-
onChange?: (value: string) => void;
|
|
45
|
-
}
|
|
37
|
+
interface CmrRadioOption {
|
|
38
|
+
label: string;
|
|
39
|
+
value: string;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface CmrRadioProps {
|
|
43
|
+
options: CmrRadioOption[];
|
|
44
|
+
groupLabel?: string;
|
|
45
|
+
defaultValue?: string;
|
|
46
|
+
onChange?: (value: string) => void;
|
|
47
|
+
}
|
|
46
48
|
declare const CmrRadioGroup: React.FC<CmrRadioProps>;
|
|
47
49
|
|
|
48
|
-
interface Option {
|
|
49
|
-
label: string;
|
|
50
|
-
value: string;
|
|
51
|
-
}
|
|
52
|
-
interface CmrSelectProps {
|
|
53
|
-
options: Option[];
|
|
54
|
-
label: string;
|
|
55
|
-
disabled?: boolean;
|
|
56
|
-
}
|
|
50
|
+
interface Option {
|
|
51
|
+
label: string;
|
|
52
|
+
value: string;
|
|
53
|
+
}
|
|
54
|
+
interface CmrSelectProps {
|
|
55
|
+
options: Option[];
|
|
56
|
+
label: string;
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
}
|
|
57
59
|
declare const CmrSelect: React.FC<CmrSelectProps>;
|
|
58
60
|
|
|
59
|
-
interface
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
interface CmrCollapseProps {
|
|
62
|
+
accordion?: boolean;
|
|
63
|
+
activeKey?: Array<string | number> | number;
|
|
64
|
+
bordered?: boolean;
|
|
65
|
+
collapsible?: CollapsibleType;
|
|
66
|
+
defaultActiveKey?: Array<string | number>;
|
|
67
|
+
destroyInactivePanel?: boolean;
|
|
68
|
+
expandIconPosition?: ExpandIconPosition;
|
|
69
|
+
ghost?: boolean;
|
|
70
|
+
onChange?: (key: Array<string | number> | number) => void;
|
|
71
|
+
children?: JSX.Element[] | JSX.Element;
|
|
72
|
+
}
|
|
73
|
+
declare const CmrCollapse: (props: CmrCollapseProps) => react_jsx_runtime.JSX.Element;
|
|
74
|
+
|
|
75
|
+
interface CmrPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
76
|
+
activeKey?: string | string[];
|
|
77
|
+
header: string | undefined;
|
|
78
|
+
children: ReactNode;
|
|
79
|
+
panelKey?: number;
|
|
80
|
+
onToggle?: (key: number | undefined) => void;
|
|
81
|
+
expanded?: boolean;
|
|
82
|
+
cardProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
83
|
+
}
|
|
84
|
+
declare const CmrPanel: (props: CmrPanelProps) => react_jsx_runtime.JSX.Element;
|
|
85
|
+
|
|
86
|
+
interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
|
|
87
|
+
dataSource: any[];
|
|
88
|
+
idAlias?: string;
|
|
89
|
+
name?: string;
|
|
90
|
+
style?: CSSProperties;
|
|
91
|
+
showCheckbox?: boolean;
|
|
65
92
|
}
|
|
66
|
-
declare const CmrTable: (props: CmrTableProps) => react_jsx_runtime.JSX.Element;
|
|
67
93
|
|
|
68
|
-
|
|
94
|
+
declare const CmrTable: FC<CmrTableProps>;
|
|
95
|
+
|
|
96
|
+
export { CmrButton, CmrCheckbox, CmrCollapse, CmrInput, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -22,10 +32,12 @@ var src_exports = {};
|
|
|
22
32
|
__export(src_exports, {
|
|
23
33
|
CmrButton: () => CmrButton,
|
|
24
34
|
CmrCheckbox: () => CmrCheckbox,
|
|
35
|
+
CmrCollapse: () => Collapse_default,
|
|
25
36
|
CmrInput: () => CmrInput,
|
|
37
|
+
CmrPanel: () => Panel_default,
|
|
26
38
|
CmrRadioGroup: () => CmrRadioGroup_default,
|
|
27
39
|
CmrSelect: () => CmrSelect_default,
|
|
28
|
-
CmrTable: () =>
|
|
40
|
+
CmrTable: () => CmrTable2
|
|
29
41
|
});
|
|
30
42
|
module.exports = __toCommonJS(src_exports);
|
|
31
43
|
|
|
@@ -174,15 +186,131 @@ var CmrSelect = ({ options, label, disabled }) => {
|
|
|
174
186
|
};
|
|
175
187
|
var CmrSelect_default = CmrSelect;
|
|
176
188
|
|
|
189
|
+
// src/CmrComponents/collapse/Collapse.tsx
|
|
190
|
+
var import_react3 = __toESM(require("react"));
|
|
191
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
192
|
+
var CmrCollapse = (props) => {
|
|
193
|
+
let { activeKey, defaultActiveKey, onChange, children } = props;
|
|
194
|
+
defaultActiveKey = defaultActiveKey || [];
|
|
195
|
+
const [activeKeys, setActiveKeys] = import_react3.default.useState(defaultActiveKey);
|
|
196
|
+
import_react3.default.useEffect(() => {
|
|
197
|
+
if (activeKey !== void 0 && activeKey !== activeKeys) {
|
|
198
|
+
if (Array.isArray(activeKey)) {
|
|
199
|
+
setActiveKeys(activeKey);
|
|
200
|
+
} else {
|
|
201
|
+
setActiveKeys([activeKey]);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, [activeKey]);
|
|
205
|
+
const onToggle = (key) => {
|
|
206
|
+
const newKeys = [...activeKeys];
|
|
207
|
+
const keyIndex = newKeys.indexOf(key);
|
|
208
|
+
if (keyIndex === -1) {
|
|
209
|
+
newKeys.push(key);
|
|
210
|
+
} else {
|
|
211
|
+
newKeys.splice(keyIndex, 1);
|
|
212
|
+
}
|
|
213
|
+
setActiveKeys(newKeys);
|
|
214
|
+
if (onChange)
|
|
215
|
+
onChange(newKeys);
|
|
216
|
+
};
|
|
217
|
+
const renderChildren = () => {
|
|
218
|
+
if (!children)
|
|
219
|
+
return null;
|
|
220
|
+
if (Array.isArray(children)) {
|
|
221
|
+
return children.map((child, index) => {
|
|
222
|
+
const panelKey = index;
|
|
223
|
+
const expanded = activeKeys.includes(panelKey);
|
|
224
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { onClick: () => onToggle(panelKey), style: { cursor: "pointer" }, children: child.props.header });
|
|
225
|
+
return (0, import_react3.cloneElement)(child, {
|
|
226
|
+
expanded,
|
|
227
|
+
panelKey,
|
|
228
|
+
onToggle,
|
|
229
|
+
header
|
|
230
|
+
// Override header with clickable version
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
} else {
|
|
234
|
+
const panelKey = 0;
|
|
235
|
+
const expanded = activeKeys.includes(panelKey);
|
|
236
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { onClick: () => onToggle(panelKey), style: { cursor: "pointer" }, children: children.props.header });
|
|
237
|
+
return (0, import_react3.cloneElement)(children, {
|
|
238
|
+
expanded,
|
|
239
|
+
panelKey,
|
|
240
|
+
onToggle,
|
|
241
|
+
header
|
|
242
|
+
// Override header with clickable version
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cmr-collapse", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: renderChildren() }) });
|
|
247
|
+
};
|
|
248
|
+
var Collapse_default = CmrCollapse;
|
|
249
|
+
|
|
250
|
+
// src/CmrComponents/panel/Panel.tsx
|
|
251
|
+
var import_ArrowDropUp = __toESM(require("@mui/icons-material/ArrowDropUp"));
|
|
252
|
+
var import_ArrowDropDown = __toESM(require("@mui/icons-material/ArrowDropDown"));
|
|
253
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
254
|
+
var CmrPanel = function(props) {
|
|
255
|
+
var _a, _b;
|
|
256
|
+
let { expanded, onToggle } = props;
|
|
257
|
+
const toggle = () => {
|
|
258
|
+
if (onToggle)
|
|
259
|
+
onToggle(props.panelKey);
|
|
260
|
+
};
|
|
261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `card ${props.className}`, children: [
|
|
262
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "card-header", style: { background: "white", display: props.header == void 0 ? "none" : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "row align-items-center", children: [
|
|
263
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "col", children: props.header }),
|
|
264
|
+
onToggle && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "col text-end", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
265
|
+
"span",
|
|
266
|
+
{
|
|
267
|
+
className: "react-collapse float-end btn",
|
|
268
|
+
onClick: (e) => {
|
|
269
|
+
toggle();
|
|
270
|
+
},
|
|
271
|
+
children: !expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ArrowDropDown.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ArrowDropUp.default, {})
|
|
272
|
+
}
|
|
273
|
+
) })
|
|
274
|
+
] }) }),
|
|
275
|
+
!expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `card-body m-0 ${(_a = props.cardProps) == null ? void 0 : _a.className}`, style: {
|
|
276
|
+
maxHeight: "0",
|
|
277
|
+
padding: 0,
|
|
278
|
+
opacity: "0",
|
|
279
|
+
overflow: "hidden",
|
|
280
|
+
visibility: "collapse",
|
|
281
|
+
transition: "all 0.5s"
|
|
282
|
+
}, children: props.children }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `card-body m-4 ${(_b = props.cardProps) == null ? void 0 : _b.className}`, style: {
|
|
283
|
+
maxHeight: void 0,
|
|
284
|
+
padding: 0,
|
|
285
|
+
opacity: "1",
|
|
286
|
+
visibility: "visible",
|
|
287
|
+
transition: "all 0.5s"
|
|
288
|
+
}, children: props.children })
|
|
289
|
+
] });
|
|
290
|
+
};
|
|
291
|
+
var Panel_default = CmrPanel;
|
|
292
|
+
|
|
177
293
|
// src/CmrTable/CmrTable.tsx
|
|
178
294
|
var import_x_data_grid = require("@mui/x-data-grid");
|
|
179
|
-
var
|
|
295
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
180
296
|
var CmrTable = (props) => {
|
|
181
|
-
const {
|
|
182
|
-
|
|
297
|
+
const {
|
|
298
|
+
dataSource,
|
|
299
|
+
columns,
|
|
300
|
+
idAlias,
|
|
301
|
+
className,
|
|
302
|
+
onRowSelectionModelChange,
|
|
303
|
+
style,
|
|
304
|
+
showCheckbox = true,
|
|
305
|
+
...rest
|
|
306
|
+
} = props;
|
|
307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
183
308
|
import_x_data_grid.DataGrid,
|
|
184
309
|
{
|
|
185
|
-
rows: dataSource ? dataSource.map((row) => ({
|
|
310
|
+
rows: dataSource ? dataSource.map((row) => ({
|
|
311
|
+
id: idAlias ? row[idAlias] : row["id"],
|
|
312
|
+
...row
|
|
313
|
+
})) : [],
|
|
186
314
|
columns,
|
|
187
315
|
checkboxSelection: showCheckbox,
|
|
188
316
|
onRowSelectionModelChange,
|
|
@@ -197,11 +325,16 @@ var CmrTable = (props) => {
|
|
|
197
325
|
) });
|
|
198
326
|
};
|
|
199
327
|
var CmrTable_default = CmrTable;
|
|
328
|
+
|
|
329
|
+
// src/index.ts
|
|
330
|
+
var CmrTable2 = CmrTable_default;
|
|
200
331
|
// Annotate the CommonJS export names for ESM import in node:
|
|
201
332
|
0 && (module.exports = {
|
|
202
333
|
CmrButton,
|
|
203
334
|
CmrCheckbox,
|
|
335
|
+
CmrCollapse,
|
|
204
336
|
CmrInput,
|
|
337
|
+
CmrPanel,
|
|
205
338
|
CmrRadioGroup,
|
|
206
339
|
CmrSelect,
|
|
207
340
|
CmrTable
|
package/dist/index.mjs
CHANGED
|
@@ -149,15 +149,131 @@ var CmrSelect = ({ options, label, disabled }) => {
|
|
|
149
149
|
};
|
|
150
150
|
var CmrSelect_default = CmrSelect;
|
|
151
151
|
|
|
152
|
+
// src/CmrComponents/collapse/Collapse.tsx
|
|
153
|
+
import React3, { cloneElement } from "react";
|
|
154
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
155
|
+
var CmrCollapse = (props) => {
|
|
156
|
+
let { activeKey, defaultActiveKey, onChange, children } = props;
|
|
157
|
+
defaultActiveKey = defaultActiveKey || [];
|
|
158
|
+
const [activeKeys, setActiveKeys] = React3.useState(defaultActiveKey);
|
|
159
|
+
React3.useEffect(() => {
|
|
160
|
+
if (activeKey !== void 0 && activeKey !== activeKeys) {
|
|
161
|
+
if (Array.isArray(activeKey)) {
|
|
162
|
+
setActiveKeys(activeKey);
|
|
163
|
+
} else {
|
|
164
|
+
setActiveKeys([activeKey]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}, [activeKey]);
|
|
168
|
+
const onToggle = (key) => {
|
|
169
|
+
const newKeys = [...activeKeys];
|
|
170
|
+
const keyIndex = newKeys.indexOf(key);
|
|
171
|
+
if (keyIndex === -1) {
|
|
172
|
+
newKeys.push(key);
|
|
173
|
+
} else {
|
|
174
|
+
newKeys.splice(keyIndex, 1);
|
|
175
|
+
}
|
|
176
|
+
setActiveKeys(newKeys);
|
|
177
|
+
if (onChange)
|
|
178
|
+
onChange(newKeys);
|
|
179
|
+
};
|
|
180
|
+
const renderChildren = () => {
|
|
181
|
+
if (!children)
|
|
182
|
+
return null;
|
|
183
|
+
if (Array.isArray(children)) {
|
|
184
|
+
return children.map((child, index) => {
|
|
185
|
+
const panelKey = index;
|
|
186
|
+
const expanded = activeKeys.includes(panelKey);
|
|
187
|
+
const header = /* @__PURE__ */ jsx6("div", { onClick: () => onToggle(panelKey), style: { cursor: "pointer" }, children: child.props.header });
|
|
188
|
+
return cloneElement(child, {
|
|
189
|
+
expanded,
|
|
190
|
+
panelKey,
|
|
191
|
+
onToggle,
|
|
192
|
+
header
|
|
193
|
+
// Override header with clickable version
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
} else {
|
|
197
|
+
const panelKey = 0;
|
|
198
|
+
const expanded = activeKeys.includes(panelKey);
|
|
199
|
+
const header = /* @__PURE__ */ jsx6("div", { onClick: () => onToggle(panelKey), style: { cursor: "pointer" }, children: children.props.header });
|
|
200
|
+
return cloneElement(children, {
|
|
201
|
+
expanded,
|
|
202
|
+
panelKey,
|
|
203
|
+
onToggle,
|
|
204
|
+
header
|
|
205
|
+
// Override header with clickable version
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
return /* @__PURE__ */ jsx6("div", { className: "cmr-collapse", children: /* @__PURE__ */ jsx6("div", { children: renderChildren() }) });
|
|
210
|
+
};
|
|
211
|
+
var Collapse_default = CmrCollapse;
|
|
212
|
+
|
|
213
|
+
// src/CmrComponents/panel/Panel.tsx
|
|
214
|
+
import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp";
|
|
215
|
+
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
216
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
217
|
+
var CmrPanel = function(props) {
|
|
218
|
+
var _a, _b;
|
|
219
|
+
let { expanded, onToggle } = props;
|
|
220
|
+
const toggle = () => {
|
|
221
|
+
if (onToggle)
|
|
222
|
+
onToggle(props.panelKey);
|
|
223
|
+
};
|
|
224
|
+
return /* @__PURE__ */ jsxs3("div", { className: `card ${props.className}`, children: [
|
|
225
|
+
/* @__PURE__ */ jsx7("div", { className: "card-header", style: { background: "white", display: props.header == void 0 ? "none" : void 0 }, children: /* @__PURE__ */ jsxs3("div", { className: "row align-items-center", children: [
|
|
226
|
+
/* @__PURE__ */ jsx7("div", { className: "col", children: props.header }),
|
|
227
|
+
onToggle && /* @__PURE__ */ jsx7("div", { className: "col text-end", children: /* @__PURE__ */ jsx7(
|
|
228
|
+
"span",
|
|
229
|
+
{
|
|
230
|
+
className: "react-collapse float-end btn",
|
|
231
|
+
onClick: (e) => {
|
|
232
|
+
toggle();
|
|
233
|
+
},
|
|
234
|
+
children: !expanded ? /* @__PURE__ */ jsx7(ArrowDropDownIcon, {}) : /* @__PURE__ */ jsx7(ArrowDropUpIcon, {})
|
|
235
|
+
}
|
|
236
|
+
) })
|
|
237
|
+
] }) }),
|
|
238
|
+
!expanded ? /* @__PURE__ */ jsx7("div", { className: `card-body m-0 ${(_a = props.cardProps) == null ? void 0 : _a.className}`, style: {
|
|
239
|
+
maxHeight: "0",
|
|
240
|
+
padding: 0,
|
|
241
|
+
opacity: "0",
|
|
242
|
+
overflow: "hidden",
|
|
243
|
+
visibility: "collapse",
|
|
244
|
+
transition: "all 0.5s"
|
|
245
|
+
}, children: props.children }) : /* @__PURE__ */ jsx7("div", { className: `card-body m-4 ${(_b = props.cardProps) == null ? void 0 : _b.className}`, style: {
|
|
246
|
+
maxHeight: void 0,
|
|
247
|
+
padding: 0,
|
|
248
|
+
opacity: "1",
|
|
249
|
+
visibility: "visible",
|
|
250
|
+
transition: "all 0.5s"
|
|
251
|
+
}, children: props.children })
|
|
252
|
+
] });
|
|
253
|
+
};
|
|
254
|
+
var Panel_default = CmrPanel;
|
|
255
|
+
|
|
152
256
|
// src/CmrTable/CmrTable.tsx
|
|
153
257
|
import { DataGrid } from "@mui/x-data-grid";
|
|
154
|
-
import { jsx as
|
|
258
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
155
259
|
var CmrTable = (props) => {
|
|
156
|
-
const {
|
|
157
|
-
|
|
260
|
+
const {
|
|
261
|
+
dataSource,
|
|
262
|
+
columns,
|
|
263
|
+
idAlias,
|
|
264
|
+
className,
|
|
265
|
+
onRowSelectionModelChange,
|
|
266
|
+
style,
|
|
267
|
+
showCheckbox = true,
|
|
268
|
+
...rest
|
|
269
|
+
} = props;
|
|
270
|
+
return /* @__PURE__ */ jsx8("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx8(
|
|
158
271
|
DataGrid,
|
|
159
272
|
{
|
|
160
|
-
rows: dataSource ? dataSource.map((row) => ({
|
|
273
|
+
rows: dataSource ? dataSource.map((row) => ({
|
|
274
|
+
id: idAlias ? row[idAlias] : row["id"],
|
|
275
|
+
...row
|
|
276
|
+
})) : [],
|
|
161
277
|
columns,
|
|
162
278
|
checkboxSelection: showCheckbox,
|
|
163
279
|
onRowSelectionModelChange,
|
|
@@ -172,11 +288,16 @@ var CmrTable = (props) => {
|
|
|
172
288
|
) });
|
|
173
289
|
};
|
|
174
290
|
var CmrTable_default = CmrTable;
|
|
291
|
+
|
|
292
|
+
// src/index.ts
|
|
293
|
+
var CmrTable2 = CmrTable_default;
|
|
175
294
|
export {
|
|
176
295
|
CmrButton,
|
|
177
296
|
CmrCheckbox,
|
|
297
|
+
Collapse_default as CmrCollapse,
|
|
178
298
|
CmrInput,
|
|
299
|
+
Panel_default as CmrPanel,
|
|
179
300
|
CmrRadioGroup_default as CmrRadioGroup,
|
|
180
301
|
CmrSelect_default as CmrSelect,
|
|
181
|
-
|
|
302
|
+
CmrTable2 as CmrTable
|
|
182
303
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudmr-ux",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"author": "erosmontin@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "erosmontin/cloudmr-ux",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"react": "^18.0.0",
|
|
23
23
|
"react-dom": "^18.0.0",
|
|
24
24
|
"tsup": "^6.7.0",
|
|
25
|
-
"typescript": "^
|
|
25
|
+
"typescript": "^4.9.5"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@emotion/react": "^11.14.0",
|