cloudmr-ux 1.5.0 → 1.5.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.
@@ -0,0 +1,311 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ButtonProps, SxProps, Theme } from '@mui/material';
3
+ import * as React from 'react';
4
+ import React__default, { ReactNode, ChangeEvent, CSSProperties, FC } from 'react';
5
+ import { SizeType } from 'antd/lib/config-provider/SizeContext';
6
+ import { CollapsibleType } from 'antd/es/collapse/CollapsePanel';
7
+ import { ExpandIconPosition } from 'antd/es/collapse/Collapse';
8
+ import { AxiosRequestConfig, AxiosResponse } from 'axios';
9
+ import { TooltipPlacement } from 'antd/lib/tooltip';
10
+ import { DataGridProps } from '@mui/x-data-grid';
11
+
12
+ declare const CmrButton: (props: ButtonProps) => react_jsx_runtime.JSX.Element;
13
+
14
+ interface CmrInputProps extends Omit<React__default.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
15
+ defaultValue?: string;
16
+ id?: string;
17
+ maxLength?: number;
18
+ size?: SizeType;
19
+ value?: string;
20
+ type?: any;
21
+ prefix?: React__default.ReactNode;
22
+ bordered?: boolean;
23
+ onChange?: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
24
+ onPressEnter?: (e: React__default.KeyboardEvent<HTMLInputElement>) => void;
25
+ }
26
+ declare const CmrInput: (props: CmrInputProps) => react_jsx_runtime.JSX.Element;
27
+
28
+ interface CmrRadioOption {
29
+ label: string;
30
+ value: string;
31
+ disabled?: boolean;
32
+ }
33
+ interface CmrRadioProps {
34
+ options: CmrRadioOption[];
35
+ groupLabel?: string;
36
+ defaultValue?: string;
37
+ onChange?: (value: string) => void;
38
+ }
39
+ declare const CmrRadioGroup: React__default.FC<CmrRadioProps>;
40
+
41
+ interface Option {
42
+ label: string;
43
+ value: string;
44
+ }
45
+ interface CmrSelectProps {
46
+ options: Option[];
47
+ label: string;
48
+ disabled?: boolean;
49
+ }
50
+ declare const CmrSelect: React__default.FC<CmrSelectProps>;
51
+
52
+ interface CmrCollapseProps {
53
+ accordion?: boolean;
54
+ activeKey?: Array<string | number> | number;
55
+ bordered?: boolean;
56
+ collapsible?: CollapsibleType;
57
+ defaultActiveKey?: Array<string | number>;
58
+ destroyInactivePanel?: boolean;
59
+ expandIconPosition?: ExpandIconPosition;
60
+ ghost?: boolean;
61
+ onChange?: (key: Array<string | number> | number) => void;
62
+ children?: JSX.Element[] | JSX.Element;
63
+ }
64
+ declare const CmrCollapse: (props: CmrCollapseProps) => react_jsx_runtime.JSX.Element;
65
+
66
+ interface CmrPanelProps extends React__default.HTMLAttributes<HTMLDivElement> {
67
+ activeKey?: string | string[];
68
+ header: string | undefined;
69
+ children: ReactNode;
70
+ panelKey?: number;
71
+ onToggle?: (key: number | undefined) => void;
72
+ expanded?: boolean;
73
+ cardProps?: React__default.HTMLAttributes<HTMLDivElement>;
74
+ }
75
+ declare const CmrPanel: (props: CmrPanelProps) => react_jsx_runtime.JSX.Element;
76
+
77
+ interface LambdaFile {
78
+ "filename": string;
79
+ "filetype": string;
80
+ "filesize": string;
81
+ "filemd5": string;
82
+ "file": File;
83
+ }
84
+ /**
85
+ * Consists of general settings for upload component
86
+ * functionalities and call back methods evoked
87
+ * for specific interactions
88
+ */
89
+ interface CMRUploadProps extends React__default.HTMLAttributes<HTMLDivElement> {
90
+ retains?: boolean;
91
+ maxCount: number;
92
+ changeNameAfterUpload?: boolean;
93
+ onRemove?: (removedFile: File) => void;
94
+ /**
95
+ * Allows access to file content prior to uploading.
96
+ * If returned value from the method is false,
97
+ * prevents the file upload process. Called before
98
+ * create payload.
99
+ * @param file
100
+ */
101
+ beforeUpload?: (file: File) => Promise<boolean>;
102
+ /**
103
+ * This or uploadHandler must be specified
104
+ * @param file
105
+ * @param fileAlias
106
+ * @param fileDatabase
107
+ */
108
+ createPayload?: (file: File, fileAlias: string, fileDatabase: string) => (Promise<{
109
+ destination: string;
110
+ lambdaFile: LambdaFile;
111
+ file: File;
112
+ config: AxiosRequestConfig;
113
+ } | undefined>);
114
+ onUploadProgressUpdate?: (loaded: number, total: number) => void | undefined;
115
+ onUploaded: (res: AxiosResponse, file: File) => Promise<void> | void;
116
+ sx?: SxProps<Theme> | undefined;
117
+ rest?: any;
118
+ fileExtension?: string;
119
+ uploadStarted?: () => void;
120
+ uploadEnded?: () => void;
121
+ uploadFailed?: () => void;
122
+ uploadProgressed?: (progress: number) => void;
123
+ /**
124
+ * Override this to replace the default behavior of uploading
125
+ * @param file
126
+ * @param fileAlias
127
+ * @param fileDatabase
128
+ * @param onProgress
129
+ * @param onUploaded
130
+ */
131
+ uploadHandler?: (file: File, fileAlias: string, fileDatabase: string, onProgress?: (progress: number) => void, onUploaded?: (res: AxiosResponse, file: File) => void) => Promise<number>;
132
+ fullWidth?: boolean;
133
+ style?: any;
134
+ /**
135
+ * Displays upload button instead of uploaded file after upload
136
+ * if set to reusable
137
+ */
138
+ reusable?: boolean;
139
+ uploadButtonName?: string;
140
+ /**
141
+ * Processes the uploaded file before performing the upload;
142
+ * @return file/undefined/statuscode undefined to fail the upload, return File
143
+ * to pass the processed file, return number to indicate error code
144
+ * and return to upload window.
145
+ * @param file
146
+ */
147
+ preprocess?: (file: File) => Promise<File | undefined | number>;
148
+ color?: "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning";
149
+ }
150
+ declare const CmrUpload: {
151
+ (props: CMRUploadProps): react_jsx_runtime.JSX.Element;
152
+ defaultProps: {
153
+ changeNameAfterUpload: boolean;
154
+ };
155
+ };
156
+
157
+ declare function CmrNameDialog(props: {
158
+ originalName: string;
159
+ renamingCallback: (alias: string) => Promise<boolean>;
160
+ open: boolean;
161
+ setOpen: (open: boolean) => void;
162
+ }): react_jsx_runtime.JSX.Element;
163
+
164
+ declare function CmrConfirmation({ name, message, cancelText, color, open, setOpen, confirmCallback, confirmText, cancellable, cancelCallback, width }: {
165
+ name: string | undefined;
166
+ cancelText?: string;
167
+ message: string | undefined;
168
+ color?: "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning" | undefined;
169
+ open: boolean;
170
+ setOpen: (open: boolean) => void;
171
+ confirmCallback?: () => void;
172
+ cancellable?: boolean;
173
+ cancelCallback?: () => void;
174
+ width?: number;
175
+ confirmText?: string;
176
+ }): react_jsx_runtime.JSX.Element;
177
+
178
+ declare function CmrDeletionDialog(props: {
179
+ name: string | undefined;
180
+ deletionCallback: () => void;
181
+ }): react_jsx_runtime.JSX.Element;
182
+
183
+ interface EditConfirmationProps {
184
+ name?: string;
185
+ defaultText?: string;
186
+ message?: string;
187
+ color?: "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning";
188
+ open: boolean;
189
+ setOpen: (open: boolean) => void;
190
+ confirmCallback?: (text: string) => void;
191
+ cancellable?: boolean;
192
+ cancelCallback?: (edit: string) => void;
193
+ suffix?: string;
194
+ }
195
+ declare function CmrEditConfirmation({ name, message, defaultText, color, open, setOpen, confirmCallback, cancellable, cancelCallback, suffix }: EditConfirmationProps): react_jsx_runtime.JSX.Element;
196
+
197
+ interface TabInfo {
198
+ id: number;
199
+ text: string;
200
+ disable?: boolean;
201
+ children: JSX.Element;
202
+ }
203
+
204
+ interface CmrTabsProps {
205
+ tabList: TabInfo[];
206
+ onTabSelected?: (tabId: number) => void;
207
+ }
208
+ declare function CmrTabs(props: CmrTabsProps): react_jsx_runtime.JSX.Element;
209
+
210
+ interface CmrCheckboxProps extends React__default.HTMLAttributes<HTMLDivElement> {
211
+ autoFocus?: boolean;
212
+ checked?: boolean;
213
+ defaultChecked?: boolean;
214
+ disabled?: boolean;
215
+ indeterminate?: boolean;
216
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
217
+ children?: any;
218
+ style?: any;
219
+ sx?: any;
220
+ }
221
+ declare const CmrCheckbox: (props: CmrCheckboxProps) => react_jsx_runtime.JSX.Element;
222
+
223
+ interface CmrLabelProps extends React__default.HTMLAttributes<HTMLDivElement> {
224
+ required?: boolean;
225
+ children?: any;
226
+ }
227
+ declare const CmrLabel: (props: CmrLabelProps) => react_jsx_runtime.JSX.Element;
228
+
229
+ interface CmrInputNumberProps {
230
+ defaultValue?: number;
231
+ disabled?: boolean;
232
+ keyboard?: boolean;
233
+ max?: number;
234
+ min?: number;
235
+ size?: SizeType;
236
+ value?: number;
237
+ onChange?: (value: number | null) => void;
238
+ children?: React__default.ReactNode;
239
+ style?: CSSProperties;
240
+ }
241
+ declare const CmrInputNumber: (props: CmrInputNumberProps) => react_jsx_runtime.JSX.Element;
242
+
243
+ interface CMRSelectUploadProps extends CMRUploadProps {
244
+ /**
245
+ * A selection of currently uploaded files
246
+ */
247
+ fileSelection: UploadedFile[];
248
+ onSelected: (file?: UploadedFile) => void;
249
+ chosenFile?: string;
250
+ buttonText?: string;
251
+ /**
252
+ * Enforces the extension of selected files
253
+ */
254
+ fileExtension?: string;
255
+ }
256
+ interface UploadedFile {
257
+ id: number;
258
+ fileName: string;
259
+ link: string;
260
+ md5?: string;
261
+ size: string;
262
+ status: string;
263
+ createdAt: string;
264
+ updatedAt: string;
265
+ database: string;
266
+ location: string;
267
+ }
268
+ /**
269
+ * Select from a set of uploaded files or upload new
270
+ */
271
+ declare const CMRSelectUpload: (props: CMRSelectUploadProps) => react_jsx_runtime.JSX.Element;
272
+
273
+ interface UploadWindowProps {
274
+ upload: (file: File, fileAlias: string, fileDatabase: string) => Promise<number>;
275
+ open: boolean;
276
+ setOpen: React.Dispatch<React.SetStateAction<boolean>>;
277
+ fileExtension?: string;
278
+ template?: {
279
+ showFileName?: boolean;
280
+ showDatabase?: boolean;
281
+ showFileSize?: boolean;
282
+ };
283
+ }
284
+ declare function CmrUploadWindow({ upload, open, setOpen, fileExtension, template, }: UploadWindowProps): react_jsx_runtime.JSX.Element;
285
+
286
+ interface CmrTooltipProps {
287
+ arrowPointAtCenter?: boolean;
288
+ autoAdjustOverflow?: boolean;
289
+ color?: string;
290
+ defaultVisible?: boolean;
291
+ mouseEnterDelay?: number;
292
+ mouseLeaveDelay?: number;
293
+ overlayClassName?: string;
294
+ placement?: TooltipPlacement;
295
+ visible?: boolean;
296
+ title: React__default.ReactNode;
297
+ overlay?: React__default.ReactNode;
298
+ }
299
+ declare const CmrTooltip: (props: CmrTooltipProps) => react_jsx_runtime.JSX.Element;
300
+
301
+ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
302
+ dataSource: any[];
303
+ idAlias?: string;
304
+ name?: string;
305
+ style?: CSSProperties;
306
+ showCheckbox?: boolean;
307
+ }
308
+
309
+ declare const CmrTable: FC<CmrTableProps>;
310
+
311
+ export { CMRSelectUpload, CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrDeletionDialog, CmrEditConfirmation, CmrInput, CmrInputNumber, CmrLabel, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, CmrTooltip, CmrUploadWindow, LambdaFile };
package/dist/index.js CHANGED
@@ -1,39 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __objRest = (source, exclude) => {
26
- var target = {};
27
- for (var prop in source)
28
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
- target[prop] = source[prop];
30
- if (source != null && __getOwnPropSymbols)
31
- for (var prop of __getOwnPropSymbols(source)) {
32
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
- target[prop] = source[prop];
34
- }
35
- return target;
36
- };
37
8
  var __export = (target, all) => {
38
9
  for (var name in all)
39
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -85,8 +56,8 @@ module.exports = __toCommonJS(src_exports);
85
56
  var import_material = require("@mui/material");
86
57
  var import_jsx_runtime = require("react/jsx-runtime");
87
58
  var CmrButton = (props) => {
88
- const _a = props, { children, onClick } = _a, rest = __objRest(_a, ["children", "onClick"]);
89
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, __spreadProps(__spreadValues({ onClick }, rest), { style: __spreadProps(__spreadValues({}, props.style), { textTransform: "none" }), children }));
59
+ const { children, onClick, ...rest } = props;
60
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { onClick, ...rest, style: { ...props.style, textTransform: "none" }, children });
90
61
  };
91
62
  var CmrButton_default = CmrButton;
92
63
 
@@ -99,10 +70,10 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
99
70
  var import_antd = require("antd");
100
71
  var import_jsx_runtime3 = require("react/jsx-runtime");
101
72
  var CmrInput = (props) => {
102
- const _a = props, { defaultValue, id, maxLength, size, value, type, prefix, bordered, onChange, onPressEnter } = _a, rest = __objRest(_a, ["defaultValue", "id", "maxLength", "size", "value", "type", "prefix", "bordered", "onChange", "onPressEnter"]);
73
+ const { defaultValue, id, maxLength, size, value, type, prefix, bordered, onChange, onPressEnter, ...rest } = props;
103
74
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
104
75
  import_antd.Input,
105
- __spreadProps(__spreadValues({
76
+ {
106
77
  defaultValue,
107
78
  id,
108
79
  maxLength,
@@ -111,10 +82,10 @@ var CmrInput = (props) => {
111
82
  type,
112
83
  prefix,
113
84
  onChange,
114
- onPressEnter
115
- }, rest), {
85
+ onPressEnter,
86
+ ...rest,
116
87
  className: "cmr-input"
117
- })
88
+ }
118
89
  );
119
90
  };
120
91
 
@@ -311,7 +282,7 @@ var import_material6 = require("@mui/material");
311
282
  var import_jsx_runtime8 = require("react/jsx-runtime");
312
283
  var CmrLabel = (props) => {
313
284
  const { children, required = false } = props;
314
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "cmr-label", style: __spreadValues({ fontSize: "16px" }, props.style), children: [
285
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "cmr-label", style: { fontSize: "16px", ...props.style }, children: [
315
286
  children,
316
287
  required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "asterik", children: "*" })
317
288
  ] });
@@ -1028,17 +999,17 @@ var import_Box2 = __toESM(require("@mui/material/Box"));
1028
999
  var import_react7 = require("react");
1029
1000
  var import_jsx_runtime15 = require("react/jsx-runtime");
1030
1001
  function CustomTabPanel(props) {
1031
- const _a = props, { children, value, index } = _a, other = __objRest(_a, ["children", "value", "index"]);
1002
+ const { children, value, index, ...other } = props;
1032
1003
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1033
1004
  "div",
1034
- __spreadProps(__spreadValues({
1005
+ {
1035
1006
  role: "tabpanel",
1036
1007
  hidden: value !== index,
1037
1008
  id: `simple-tabpanel-${index}`,
1038
- "aria-labelledby": `simple-tab-${index}`
1039
- }, other), {
1009
+ "aria-labelledby": `simple-tab-${index}`,
1010
+ ...other,
1040
1011
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Box2.default, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Typography2.default, { children }) })
1041
- })
1012
+ }
1042
1013
  );
1043
1014
  }
1044
1015
  function a11yProps(index) {
@@ -1077,7 +1048,7 @@ function CmrTabs(props) {
1077
1048
  backgroundColor: "#580F8B"
1078
1049
  }
1079
1050
  },
1080
- children: props.tabList.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Tab.default, __spreadValues({ sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text }, a11yProps(index))))
1051
+ children: props.tabList.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Tab.default, { sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text, ...a11yProps(index) }))
1081
1052
  }
1082
1053
  ) }),
1083
1054
  props.tabList.map(
@@ -1095,7 +1066,7 @@ var import_material10 = require("@mui/material");
1095
1066
  var import_material11 = require("@mui/material");
1096
1067
  var import_jsx_runtime16 = require("react/jsx-runtime");
1097
1068
  var CmrCheckbox = (props) => {
1098
- const _a = props, { defaultChecked, onChange, children } = _a, rest = __objRest(_a, ["defaultChecked", "onChange", "children"]);
1069
+ const { defaultChecked, onChange, children, ...rest } = props;
1099
1070
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1100
1071
  import_material11.FormControlLabel,
1101
1072
  {
@@ -1115,8 +1086,8 @@ var Checkbox_default = CmrCheckbox;
1115
1086
  var import_antd2 = require("antd");
1116
1087
  var import_jsx_runtime17 = require("react/jsx-runtime");
1117
1088
  var CmrInputNumber = (props) => {
1118
- const _a = props, { defaultValue, style, max, min, value, onChange, children } = _a, rest = __objRest(_a, ["defaultValue", "style", "max", "min", "value", "onChange", "children"]);
1119
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd2.InputNumber, __spreadProps(__spreadValues({ defaultValue, max, style, min, value, onChange }, rest), { children }));
1089
+ const { defaultValue, style, max, min, value, onChange, children, ...rest } = props;
1090
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_antd2.InputNumber, { defaultValue, max, style, min, value, onChange, ...rest, children });
1120
1091
  };
1121
1092
  var InputNumber_default = CmrInputNumber;
1122
1093
 
@@ -1172,7 +1143,8 @@ var CMRSelectUpload = (props) => {
1172
1143
  fileIndex !== -1 && !uploading && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.Button, { fullWidth: true, sx: { marginLeft: "8px" }, variant: "contained", onClick: onSet, children: "OK" }),
1173
1144
  fileIndex == -1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1174
1145
  Upload_default,
1175
- __spreadProps(__spreadValues({}, props), {
1146
+ {
1147
+ ...props,
1176
1148
  color: "info",
1177
1149
  fullWidth: true,
1178
1150
  onUploaded: (res, file) => {
@@ -1193,13 +1165,13 @@ var CMRSelectUpload = (props) => {
1193
1165
  setProgress(progress2);
1194
1166
  },
1195
1167
  uploadEnded: () => setUploading(false)
1196
- })
1168
+ }
1197
1169
  )
1198
1170
  ] })
1199
1171
  ] })
1200
1172
  ] });
1201
1173
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react8.Fragment, { children: [
1202
- uploading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material12.Button, { variant: "contained", style: __spreadProps(__spreadValues({}, props.style), { textTransform: "none" }), sx: { overflowWrap: "inherit" }, color: "primary", disabled: uploading, children: [
1174
+ uploading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material12.Button, { variant: "contained", style: { ...props.style, textTransform: "none" }, sx: { overflowWrap: "inherit" }, color: "primary", disabled: uploading, children: [
1203
1175
  "Uploading ",
1204
1176
  progress,
1205
1177
  "%"
@@ -1210,7 +1182,7 @@ var CMRSelectUpload = (props) => {
1210
1182
  color: "info",
1211
1183
  onClick: handleClickOpen,
1212
1184
  sx: { marginRight: "10pt" },
1213
- style: __spreadProps(__spreadValues({}, props.style), { textTransform: "none" }),
1185
+ style: { ...props.style, textTransform: "none" },
1214
1186
  children: props.chosenFile == void 0 ? props.buttonText ? props.buttonText : "Choose" : props.chosenFile
1215
1187
  }
1216
1188
  ),
@@ -1223,7 +1195,7 @@ var SelectUpload_default = CMRSelectUpload;
1223
1195
  var import_antd3 = require("antd");
1224
1196
  var import_jsx_runtime19 = require("react/jsx-runtime");
1225
1197
  var CmrTooltip = (props) => {
1226
- const _a = props, {
1198
+ const {
1227
1199
  arrowPointAtCenter,
1228
1200
  autoAdjustOverflow,
1229
1201
  color,
@@ -1232,21 +1204,12 @@ var CmrTooltip = (props) => {
1232
1204
  mouseLeaveDelay,
1233
1205
  overlayClassName,
1234
1206
  placement,
1235
- visible
1236
- } = _a, rest = __objRest(_a, [
1237
- "arrowPointAtCenter",
1238
- "autoAdjustOverflow",
1239
- "color",
1240
- "defaultVisible",
1241
- "mouseEnterDelay",
1242
- "mouseLeaveDelay",
1243
- "overlayClassName",
1244
- "placement",
1245
- "visible"
1246
- ]);
1207
+ visible,
1208
+ ...rest
1209
+ } = props;
1247
1210
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1248
1211
  import_antd3.Tooltip,
1249
- __spreadValues({
1212
+ {
1250
1213
  arrowPointAtCenter,
1251
1214
  autoAdjustOverflow,
1252
1215
  color,
@@ -1255,8 +1218,9 @@ var CmrTooltip = (props) => {
1255
1218
  mouseLeaveDelay,
1256
1219
  overlayClassName,
1257
1220
  placement,
1258
- visible
1259
- }, rest)
1221
+ visible,
1222
+ ...rest
1223
+ }
1260
1224
  );
1261
1225
  };
1262
1226
  var Tooltip_default = CmrTooltip;
@@ -1265,29 +1229,23 @@ var Tooltip_default = CmrTooltip;
1265
1229
  var import_x_data_grid = require("@mui/x-data-grid");
1266
1230
  var import_jsx_runtime20 = require("react/jsx-runtime");
1267
1231
  var CmrTable = (props) => {
1268
- const _a = props, {
1232
+ const {
1269
1233
  dataSource,
1270
1234
  columns,
1271
1235
  idAlias,
1272
1236
  className,
1273
1237
  onRowSelectionModelChange,
1274
1238
  style,
1275
- showCheckbox = true
1276
- } = _a, rest = __objRest(_a, [
1277
- "dataSource",
1278
- "columns",
1279
- "idAlias",
1280
- "className",
1281
- "onRowSelectionModelChange",
1282
- "style",
1283
- "showCheckbox"
1284
- ]);
1285
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: style != null ? style : { height: "400px", width: "100%" }, className: className != null ? className : "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1239
+ showCheckbox = true,
1240
+ ...rest
1241
+ } = props;
1242
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1286
1243
  import_x_data_grid.DataGrid,
1287
- __spreadValues({
1288
- rows: dataSource ? dataSource.map((row) => __spreadValues({
1289
- id: idAlias ? row[idAlias] : row["id"]
1290
- }, row)) : [],
1244
+ {
1245
+ rows: dataSource ? dataSource.map((row) => ({
1246
+ id: idAlias ? row[idAlias] : row["id"],
1247
+ ...row
1248
+ })) : [],
1291
1249
  columns,
1292
1250
  checkboxSelection: showCheckbox,
1293
1251
  onRowSelectionModelChange,
@@ -1296,8 +1254,9 @@ var CmrTable = (props) => {
1296
1254
  paginationModel: { pageSize: 50, page: 0 }
1297
1255
  }
1298
1256
  },
1299
- localeText: { noRowsLabel: "" }
1300
- }, rest)
1257
+ localeText: { noRowsLabel: "" },
1258
+ ...rest
1259
+ }
1301
1260
  ) });
1302
1261
  };
1303
1262
  var CmrTable_default = CmrTable;
package/dist/index.mjs CHANGED
@@ -1,41 +1,9 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
-
33
1
  // src/CmrComponents/CmrButton/CmrButton.tsx
34
2
  import { Button } from "@mui/material";
35
3
  import { jsx } from "react/jsx-runtime";
36
4
  var CmrButton = (props) => {
37
- const _a = props, { children, onClick } = _a, rest = __objRest(_a, ["children", "onClick"]);
38
- return /* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ onClick }, rest), { style: __spreadProps(__spreadValues({}, props.style), { textTransform: "none" }), children }));
5
+ const { children, onClick, ...rest } = props;
6
+ return /* @__PURE__ */ jsx(Button, { onClick, ...rest, style: { ...props.style, textTransform: "none" }, children });
39
7
  };
40
8
  var CmrButton_default = CmrButton;
41
9
 
@@ -48,10 +16,10 @@ import { jsx as jsx2 } from "react/jsx-runtime";
48
16
  import { Input } from "antd";
49
17
  import { jsx as jsx3 } from "react/jsx-runtime";
50
18
  var CmrInput = (props) => {
51
- const _a = props, { defaultValue, id, maxLength, size, value, type, prefix, bordered, onChange, onPressEnter } = _a, rest = __objRest(_a, ["defaultValue", "id", "maxLength", "size", "value", "type", "prefix", "bordered", "onChange", "onPressEnter"]);
19
+ const { defaultValue, id, maxLength, size, value, type, prefix, bordered, onChange, onPressEnter, ...rest } = props;
52
20
  return /* @__PURE__ */ jsx3(
53
21
  Input,
54
- __spreadProps(__spreadValues({
22
+ {
55
23
  defaultValue,
56
24
  id,
57
25
  maxLength,
@@ -60,10 +28,10 @@ var CmrInput = (props) => {
60
28
  type,
61
29
  prefix,
62
30
  onChange,
63
- onPressEnter
64
- }, rest), {
31
+ onPressEnter,
32
+ ...rest,
65
33
  className: "cmr-input"
66
- })
34
+ }
67
35
  );
68
36
  };
69
37
 
@@ -266,7 +234,7 @@ import { Alert, Collapse, MenuItem as MenuItem2 } from "@mui/material";
266
234
  import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
267
235
  var CmrLabel = (props) => {
268
236
  const { children, required = false } = props;
269
- return /* @__PURE__ */ jsxs4("label", { className: "cmr-label", style: __spreadValues({ fontSize: "16px" }, props.style), children: [
237
+ return /* @__PURE__ */ jsxs4("label", { className: "cmr-label", style: { fontSize: "16px", ...props.style }, children: [
270
238
  children,
271
239
  required && /* @__PURE__ */ jsx8("span", { className: "asterik", children: "*" })
272
240
  ] });
@@ -983,17 +951,17 @@ import Box3 from "@mui/material/Box";
983
951
  import { cloneElement as cloneElement2 } from "react";
984
952
  import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
985
953
  function CustomTabPanel(props) {
986
- const _a = props, { children, value, index } = _a, other = __objRest(_a, ["children", "value", "index"]);
954
+ const { children, value, index, ...other } = props;
987
955
  return /* @__PURE__ */ jsx15(
988
956
  "div",
989
- __spreadProps(__spreadValues({
957
+ {
990
958
  role: "tabpanel",
991
959
  hidden: value !== index,
992
960
  id: `simple-tabpanel-${index}`,
993
- "aria-labelledby": `simple-tab-${index}`
994
- }, other), {
961
+ "aria-labelledby": `simple-tab-${index}`,
962
+ ...other,
995
963
  children: /* @__PURE__ */ jsx15(Box3, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ jsx15(Typography3, { children }) })
996
- })
964
+ }
997
965
  );
998
966
  }
999
967
  function a11yProps(index) {
@@ -1032,7 +1000,7 @@ function CmrTabs(props) {
1032
1000
  backgroundColor: "#580F8B"
1033
1001
  }
1034
1002
  },
1035
- children: props.tabList.map((tab, index) => /* @__PURE__ */ jsx15(Tab, __spreadValues({ sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text }, a11yProps(index))))
1003
+ children: props.tabList.map((tab, index) => /* @__PURE__ */ jsx15(Tab, { sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text, ...a11yProps(index) }))
1036
1004
  }
1037
1005
  ) }),
1038
1006
  props.tabList.map(
@@ -1050,7 +1018,7 @@ import { Checkbox as Checkbox2 } from "@mui/material";
1050
1018
  import { FormControlLabel as FormControlLabel3 } from "@mui/material";
1051
1019
  import { jsx as jsx16 } from "react/jsx-runtime";
1052
1020
  var CmrCheckbox = (props) => {
1053
- const _a = props, { defaultChecked, onChange, children } = _a, rest = __objRest(_a, ["defaultChecked", "onChange", "children"]);
1021
+ const { defaultChecked, onChange, children, ...rest } = props;
1054
1022
  return /* @__PURE__ */ jsx16(
1055
1023
  FormControlLabel3,
1056
1024
  {
@@ -1070,8 +1038,8 @@ var Checkbox_default = CmrCheckbox;
1070
1038
  import { InputNumber } from "antd";
1071
1039
  import { jsx as jsx17 } from "react/jsx-runtime";
1072
1040
  var CmrInputNumber = (props) => {
1073
- const _a = props, { defaultValue, style, max, min, value, onChange, children } = _a, rest = __objRest(_a, ["defaultValue", "style", "max", "min", "value", "onChange", "children"]);
1074
- return /* @__PURE__ */ jsx17(InputNumber, __spreadProps(__spreadValues({ defaultValue, max, style, min, value, onChange }, rest), { children }));
1041
+ const { defaultValue, style, max, min, value, onChange, children, ...rest } = props;
1042
+ return /* @__PURE__ */ jsx17(InputNumber, { defaultValue, max, style, min, value, onChange, ...rest, children });
1075
1043
  };
1076
1044
  var InputNumber_default = CmrInputNumber;
1077
1045
 
@@ -1127,7 +1095,8 @@ var CMRSelectUpload = (props) => {
1127
1095
  fileIndex !== -1 && !uploading && /* @__PURE__ */ jsx18(Button4, { fullWidth: true, sx: { marginLeft: "8px" }, variant: "contained", onClick: onSet, children: "OK" }),
1128
1096
  fileIndex == -1 && /* @__PURE__ */ jsx18(
1129
1097
  Upload_default,
1130
- __spreadProps(__spreadValues({}, props), {
1098
+ {
1099
+ ...props,
1131
1100
  color: "info",
1132
1101
  fullWidth: true,
1133
1102
  onUploaded: (res, file) => {
@@ -1148,13 +1117,13 @@ var CMRSelectUpload = (props) => {
1148
1117
  setProgress(progress2);
1149
1118
  },
1150
1119
  uploadEnded: () => setUploading(false)
1151
- })
1120
+ }
1152
1121
  )
1153
1122
  ] })
1154
1123
  ] })
1155
1124
  ] });
1156
1125
  return /* @__PURE__ */ jsxs12(Fragment, { children: [
1157
- uploading ? /* @__PURE__ */ jsxs12(Button4, { variant: "contained", style: __spreadProps(__spreadValues({}, props.style), { textTransform: "none" }), sx: { overflowWrap: "inherit" }, color: "primary", disabled: uploading, children: [
1126
+ uploading ? /* @__PURE__ */ jsxs12(Button4, { variant: "contained", style: { ...props.style, textTransform: "none" }, sx: { overflowWrap: "inherit" }, color: "primary", disabled: uploading, children: [
1158
1127
  "Uploading ",
1159
1128
  progress,
1160
1129
  "%"
@@ -1165,7 +1134,7 @@ var CMRSelectUpload = (props) => {
1165
1134
  color: "info",
1166
1135
  onClick: handleClickOpen,
1167
1136
  sx: { marginRight: "10pt" },
1168
- style: __spreadProps(__spreadValues({}, props.style), { textTransform: "none" }),
1137
+ style: { ...props.style, textTransform: "none" },
1169
1138
  children: props.chosenFile == void 0 ? props.buttonText ? props.buttonText : "Choose" : props.chosenFile
1170
1139
  }
1171
1140
  ),
@@ -1178,7 +1147,7 @@ var SelectUpload_default = CMRSelectUpload;
1178
1147
  import { Tooltip } from "antd";
1179
1148
  import { jsx as jsx19 } from "react/jsx-runtime";
1180
1149
  var CmrTooltip = (props) => {
1181
- const _a = props, {
1150
+ const {
1182
1151
  arrowPointAtCenter,
1183
1152
  autoAdjustOverflow,
1184
1153
  color,
@@ -1187,21 +1156,12 @@ var CmrTooltip = (props) => {
1187
1156
  mouseLeaveDelay,
1188
1157
  overlayClassName,
1189
1158
  placement,
1190
- visible
1191
- } = _a, rest = __objRest(_a, [
1192
- "arrowPointAtCenter",
1193
- "autoAdjustOverflow",
1194
- "color",
1195
- "defaultVisible",
1196
- "mouseEnterDelay",
1197
- "mouseLeaveDelay",
1198
- "overlayClassName",
1199
- "placement",
1200
- "visible"
1201
- ]);
1159
+ visible,
1160
+ ...rest
1161
+ } = props;
1202
1162
  return /* @__PURE__ */ jsx19(
1203
1163
  Tooltip,
1204
- __spreadValues({
1164
+ {
1205
1165
  arrowPointAtCenter,
1206
1166
  autoAdjustOverflow,
1207
1167
  color,
@@ -1210,8 +1170,9 @@ var CmrTooltip = (props) => {
1210
1170
  mouseLeaveDelay,
1211
1171
  overlayClassName,
1212
1172
  placement,
1213
- visible
1214
- }, rest)
1173
+ visible,
1174
+ ...rest
1175
+ }
1215
1176
  );
1216
1177
  };
1217
1178
  var Tooltip_default = CmrTooltip;
@@ -1220,29 +1181,23 @@ var Tooltip_default = CmrTooltip;
1220
1181
  import { DataGrid } from "@mui/x-data-grid";
1221
1182
  import { jsx as jsx20 } from "react/jsx-runtime";
1222
1183
  var CmrTable = (props) => {
1223
- const _a = props, {
1184
+ const {
1224
1185
  dataSource,
1225
1186
  columns,
1226
1187
  idAlias,
1227
1188
  className,
1228
1189
  onRowSelectionModelChange,
1229
1190
  style,
1230
- showCheckbox = true
1231
- } = _a, rest = __objRest(_a, [
1232
- "dataSource",
1233
- "columns",
1234
- "idAlias",
1235
- "className",
1236
- "onRowSelectionModelChange",
1237
- "style",
1238
- "showCheckbox"
1239
- ]);
1240
- return /* @__PURE__ */ jsx20("div", { style: style != null ? style : { height: "400px", width: "100%" }, className: className != null ? className : "", children: /* @__PURE__ */ jsx20(
1191
+ showCheckbox = true,
1192
+ ...rest
1193
+ } = props;
1194
+ return /* @__PURE__ */ jsx20("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx20(
1241
1195
  DataGrid,
1242
- __spreadValues({
1243
- rows: dataSource ? dataSource.map((row) => __spreadValues({
1244
- id: idAlias ? row[idAlias] : row["id"]
1245
- }, row)) : [],
1196
+ {
1197
+ rows: dataSource ? dataSource.map((row) => ({
1198
+ id: idAlias ? row[idAlias] : row["id"],
1199
+ ...row
1200
+ })) : [],
1246
1201
  columns,
1247
1202
  checkboxSelection: showCheckbox,
1248
1203
  onRowSelectionModelChange,
@@ -1251,8 +1206,9 @@ var CmrTable = (props) => {
1251
1206
  paginationModel: { pageSize: 50, page: 0 }
1252
1207
  }
1253
1208
  },
1254
- localeText: { noRowsLabel: "" }
1255
- }, rest)
1209
+ localeText: { noRowsLabel: "" },
1210
+ ...rest
1211
+ }
1256
1212
  ) });
1257
1213
  };
1258
1214
  var CmrTable_default = CmrTable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",
@@ -11,16 +11,13 @@
11
11
  "dist"
12
12
  ],
13
13
  "scripts": {
14
- "build": "tsup src/index.ts --format cjs,esm --external react,react-dom",
15
- "build:typed": "tsup src/index.ts --format cjs,esm --dts --external react,react-dom,axios"
14
+ "build": "tsup src/index.ts --format cjs,esm --dts --external react,react-dom"
16
15
  },
17
16
  "peerDependencies": {
18
17
  "react": "^18.0.0",
19
- "react-dom": "^18.0.0",
20
- "axios": "^1.4.0"
18
+ "react-dom": "^18.0.0"
21
19
  },
22
20
  "devDependencies": {
23
- "axios": "^1.4.0",
24
21
  "process": "^0.11.10",
25
22
  "react": "^18.0.0",
26
23
  "react-dom": "^18.0.0",
@@ -34,9 +31,10 @@
34
31
  "@mui/material": "^5.14.2",
35
32
  "@mui/x-data-grid": "^6.10.1",
36
33
  "antd": "^5.22.1",
34
+ "axios": "^1.4.0",
37
35
  "css-loader": "^7.1.2",
38
36
  "sass": "^1.81.0",
39
37
  "sass-loader": "^16.0.3",
40
38
  "style-loader": "^4.0.0"
41
39
  }
42
- }
40
+ }