cloudmr-ux 1.1.6 → 1.1.8
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 +2 -38
- package/dist/index.d.ts +50 -7
- package/dist/index.js +152 -47
- package/dist/index.mjs +149 -46
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1,42 +1,4 @@
|
|
|
1
1
|
/* src/CmrComponents/CmrButton/CmrButton.css */
|
|
2
|
-
.cmr-button {
|
|
3
|
-
background-color: #580F8B !important;
|
|
4
|
-
color: white !important;
|
|
5
|
-
padding-top: 0.375rem !important;
|
|
6
|
-
padding-bottom: 0.375rem !important;
|
|
7
|
-
padding-right: 0.75rem !important;
|
|
8
|
-
padding-left: 0.75rem !important;
|
|
9
|
-
border: 2px solid #580F8B !important;
|
|
10
|
-
border-radius: 4px !important;
|
|
11
|
-
text-align: center !important;
|
|
12
|
-
font-family: "Source Sans 3", sans-serif !important;
|
|
13
|
-
font-size: 14.4px !important;
|
|
14
|
-
line-height: 1.5 !important;
|
|
15
|
-
font-weight: 400 !important;
|
|
16
|
-
}
|
|
17
|
-
.cmr-button:hover {
|
|
18
|
-
background-color: #390063 !important;
|
|
19
|
-
}
|
|
20
|
-
.cmr-button.outlined {
|
|
21
|
-
background-color: transparent !important;
|
|
22
|
-
border: 2px solid #580F8B !important;
|
|
23
|
-
color: #580F8B !important;
|
|
24
|
-
}
|
|
25
|
-
.cmr-button.outlined:hover {
|
|
26
|
-
background-color: #580F8B !important;
|
|
27
|
-
color: white !important;
|
|
28
|
-
}
|
|
29
|
-
.cmr-button.Mui-disabled {
|
|
30
|
-
background-color: #ced4da !important;
|
|
31
|
-
color: #999 !important;
|
|
32
|
-
border: 2px solid #ced4da !important;
|
|
33
|
-
cursor: not-allowed !important;
|
|
34
|
-
}
|
|
35
|
-
.cmr-button.Mui-disabled:hover {
|
|
36
|
-
background-color: #ced4da !important;
|
|
37
|
-
color: #999 !important;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
2
|
/* src/CmrComponents/CmrCheckbox/CmrCheckbox.css */
|
|
41
3
|
.cmr-label {
|
|
42
4
|
font-size: 14.4px;
|
|
@@ -184,6 +146,8 @@
|
|
|
184
146
|
|
|
185
147
|
/* src/CmrComponents/input-number/InputNumber.css */
|
|
186
148
|
|
|
149
|
+
/* src/CmrComponents/tooltip/Tooltip.css */
|
|
150
|
+
|
|
187
151
|
/* src/CmrTable/CmrTable.css */
|
|
188
152
|
.css-1lymaxv-MuiDataGrid-root .MuiDataGrid-columnHeader:focus-within,
|
|
189
153
|
.css-1lymaxv-MuiDataGrid-root .MuiDataGrid-cell:focus-within {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ButtonProps, SxProps
|
|
3
|
-
import { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
+
import { ButtonProps, SxProps, Theme } from '@mui/material';
|
|
4
3
|
import React, { ReactNode, ChangeEvent, CSSProperties, FC } from 'react';
|
|
5
4
|
import { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
6
5
|
import { CollapsibleType } from 'antd/es/collapse/CollapsePanel';
|
|
7
6
|
import { ExpandIconPosition } from 'antd/es/collapse/Collapse';
|
|
8
7
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
8
|
+
import { TooltipPlacement } from 'antd/lib/tooltip';
|
|
9
9
|
import { DataGridProps } from '@mui/x-data-grid';
|
|
10
10
|
|
|
11
|
-
declare const CmrButton: (props: ButtonProps
|
|
12
|
-
sx?: SxProps<Theme>;
|
|
13
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
declare const CmrButton: (props: ButtonProps) => react_jsx_runtime.JSX.Element;
|
|
14
12
|
|
|
15
13
|
interface CmrInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
|
16
14
|
defaultValue?: string;
|
|
@@ -114,7 +112,7 @@ interface CMRUploadProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
114
112
|
} | undefined>);
|
|
115
113
|
onUploadProgressUpdate?: (loaded: number, total: number) => void | undefined;
|
|
116
114
|
onUploaded: (res: AxiosResponse, file: File) => Promise<void> | void;
|
|
117
|
-
sx?: SxProps
|
|
115
|
+
sx?: SxProps<Theme> | undefined;
|
|
118
116
|
rest?: any;
|
|
119
117
|
fileExtension?: string;
|
|
120
118
|
uploadStarted?: () => void;
|
|
@@ -241,6 +239,51 @@ interface CmrInputNumberProps {
|
|
|
241
239
|
}
|
|
242
240
|
declare const CmrInputNumber: (props: CmrInputNumberProps) => react_jsx_runtime.JSX.Element;
|
|
243
241
|
|
|
242
|
+
interface CmrTooltipProps {
|
|
243
|
+
arrowPointAtCenter?: boolean;
|
|
244
|
+
autoAdjustOverflow?: boolean;
|
|
245
|
+
color?: string;
|
|
246
|
+
defaultVisible?: boolean;
|
|
247
|
+
mouseEnterDelay?: number;
|
|
248
|
+
mouseLeaveDelay?: number;
|
|
249
|
+
overlayClassName?: string;
|
|
250
|
+
placement?: TooltipPlacement;
|
|
251
|
+
visible?: boolean;
|
|
252
|
+
title: React.ReactNode;
|
|
253
|
+
overlay?: React.ReactNode;
|
|
254
|
+
}
|
|
255
|
+
declare const CmrTooltip: (props: CmrTooltipProps) => react_jsx_runtime.JSX.Element;
|
|
256
|
+
|
|
257
|
+
interface CMRSelectUploadProps extends CMRUploadProps {
|
|
258
|
+
/**
|
|
259
|
+
* A selection of currently uploaded files
|
|
260
|
+
*/
|
|
261
|
+
fileSelection: UploadedFile[];
|
|
262
|
+
onSelected: (file?: UploadedFile) => void;
|
|
263
|
+
chosenFile?: string;
|
|
264
|
+
buttonText?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Enforces the extension of selected files
|
|
267
|
+
*/
|
|
268
|
+
fileExtension?: string;
|
|
269
|
+
}
|
|
270
|
+
interface UploadedFile {
|
|
271
|
+
id: number;
|
|
272
|
+
fileName: string;
|
|
273
|
+
link: string;
|
|
274
|
+
md5?: string;
|
|
275
|
+
size: string;
|
|
276
|
+
status: string;
|
|
277
|
+
createdAt: string;
|
|
278
|
+
updatedAt: string;
|
|
279
|
+
database: string;
|
|
280
|
+
location: string;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Select from a set of uploaded files or upload new
|
|
284
|
+
*/
|
|
285
|
+
declare const CMRSelectUpload: (props: CMRSelectUploadProps) => react_jsx_runtime.JSX.Element;
|
|
286
|
+
|
|
244
287
|
interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
|
|
245
288
|
dataSource: any[];
|
|
246
289
|
idAlias?: string;
|
|
@@ -251,4 +294,4 @@ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
|
|
|
251
294
|
|
|
252
295
|
declare const CmrTable: FC<CmrTableProps>;
|
|
253
296
|
|
|
254
|
-
export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrDeletionDialog, CmrEditConfirmation, CmrInput, CmrInputNumber, CmrLabel, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, LambdaFile };
|
|
297
|
+
export { CMRSelectUpload, CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrDeletionDialog, CmrEditConfirmation, CmrInput, CmrInputNumber, CmrLabel, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, CmrTooltip, LambdaFile };
|
package/dist/index.js
CHANGED
|
@@ -30,8 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
CMRSelectUpload: () => SelectUpload_default,
|
|
33
34
|
CMRUpload: () => Upload_default,
|
|
34
|
-
CmrButton: () =>
|
|
35
|
+
CmrButton: () => CmrButton_default,
|
|
35
36
|
CmrCheckbox: () => Checkbox_default,
|
|
36
37
|
CmrCollapse: () => Collapse_default,
|
|
37
38
|
CmrConfirmation: () => CmrConfirmation,
|
|
@@ -45,7 +46,8 @@ __export(src_exports, {
|
|
|
45
46
|
CmrRadioGroup: () => CmrRadioGroup_default,
|
|
46
47
|
CmrSelect: () => CmrSelect_default,
|
|
47
48
|
CmrTable: () => CmrTable2,
|
|
48
|
-
CmrTabs: () => CmrTabs
|
|
49
|
+
CmrTabs: () => CmrTabs,
|
|
50
|
+
CmrTooltip: () => Tooltip_default
|
|
49
51
|
});
|
|
50
52
|
module.exports = __toCommonJS(src_exports);
|
|
51
53
|
|
|
@@ -53,43 +55,10 @@ module.exports = __toCommonJS(src_exports);
|
|
|
53
55
|
var import_material = require("@mui/material");
|
|
54
56
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
55
57
|
var CmrButton = (props) => {
|
|
56
|
-
const { children, onClick,
|
|
57
|
-
|
|
58
|
-
boxShadow: "none",
|
|
59
|
-
"&:hover": {
|
|
60
|
-
boxShadow: "none"
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
let combinedSx;
|
|
64
|
-
if (Array.isArray(sx)) {
|
|
65
|
-
combinedSx = [baseSx, ...sx];
|
|
66
|
-
} else if (typeof sx === "function") {
|
|
67
|
-
combinedSx = (theme) => ({
|
|
68
|
-
...baseSx,
|
|
69
|
-
...sx(theme)
|
|
70
|
-
});
|
|
71
|
-
} else if (typeof sx === "object" && sx !== null) {
|
|
72
|
-
combinedSx = {
|
|
73
|
-
...baseSx,
|
|
74
|
-
...sx
|
|
75
|
-
};
|
|
76
|
-
} else {
|
|
77
|
-
combinedSx = baseSx;
|
|
78
|
-
}
|
|
79
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
-
import_material.Button,
|
|
81
|
-
{
|
|
82
|
-
onClick,
|
|
83
|
-
...rest,
|
|
84
|
-
className: `cmr-button ${variant}`,
|
|
85
|
-
style: { textTransform: "none" },
|
|
86
|
-
variant,
|
|
87
|
-
disabled,
|
|
88
|
-
sx: combinedSx,
|
|
89
|
-
children
|
|
90
|
-
}
|
|
91
|
-
);
|
|
58
|
+
const { children, onClick, ...rest } = props;
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { onClick, ...rest, style: { ...props.style, textTransform: "none" }, children });
|
|
92
60
|
};
|
|
61
|
+
var CmrButton_default = CmrButton;
|
|
93
62
|
|
|
94
63
|
// src/CmrComponents/CmrCheckbox/CmrCheckbox.tsx
|
|
95
64
|
var import_material2 = require("@mui/material");
|
|
@@ -839,8 +808,8 @@ function CmrNameDialog(props) {
|
|
|
839
808
|
}
|
|
840
809
|
) }),
|
|
841
810
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_DialogActions2.default, { children: [
|
|
842
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
843
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CmrButton_default, { variant: "outlined", onClick: handleClose, children: "Cancel" }),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CmrButton_default, { variant: "contained", color: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
844
813
|
] })
|
|
845
814
|
]
|
|
846
815
|
}
|
|
@@ -887,8 +856,8 @@ function CmrConfirmation({
|
|
|
887
856
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_DialogContent3.default, { sx: { width }, children: [
|
|
888
857
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_DialogContentText2.default, { alignContent: "center", children: message }),
|
|
889
858
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_DialogActions3.default, { className: "mt-4", children: [
|
|
890
|
-
cancellable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
891
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
859
|
+
cancellable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CmrButton_default, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: cancelText }),
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: confirmText })
|
|
892
861
|
] })
|
|
893
862
|
] })
|
|
894
863
|
] });
|
|
@@ -1005,8 +974,8 @@ function CmrEditConfirmation({
|
|
|
1005
974
|
}
|
|
1006
975
|
) }),
|
|
1007
976
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_DialogActions5.default, { children: [
|
|
1008
|
-
cancellable && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1009
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
977
|
+
cancellable && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CmrButton_default, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: "Cancel" }),
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: "Confirm" })
|
|
1010
979
|
] })
|
|
1011
980
|
] })
|
|
1012
981
|
] });
|
|
@@ -1114,9 +1083,143 @@ var CmrInputNumber = (props) => {
|
|
|
1114
1083
|
};
|
|
1115
1084
|
var InputNumber_default = CmrInputNumber;
|
|
1116
1085
|
|
|
1086
|
+
// src/CmrComponents/tooltip/Tooltip.tsx
|
|
1087
|
+
var import_antd3 = require("antd");
|
|
1088
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1089
|
+
var CmrTooltip = (props) => {
|
|
1090
|
+
const {
|
|
1091
|
+
arrowPointAtCenter,
|
|
1092
|
+
autoAdjustOverflow,
|
|
1093
|
+
color,
|
|
1094
|
+
defaultVisible,
|
|
1095
|
+
mouseEnterDelay,
|
|
1096
|
+
mouseLeaveDelay,
|
|
1097
|
+
overlayClassName,
|
|
1098
|
+
placement,
|
|
1099
|
+
visible,
|
|
1100
|
+
...rest
|
|
1101
|
+
} = props;
|
|
1102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1103
|
+
import_antd3.Tooltip,
|
|
1104
|
+
{
|
|
1105
|
+
arrowPointAtCenter,
|
|
1106
|
+
autoAdjustOverflow,
|
|
1107
|
+
color,
|
|
1108
|
+
defaultVisible,
|
|
1109
|
+
mouseEnterDelay,
|
|
1110
|
+
mouseLeaveDelay,
|
|
1111
|
+
overlayClassName,
|
|
1112
|
+
placement,
|
|
1113
|
+
visible,
|
|
1114
|
+
...rest
|
|
1115
|
+
}
|
|
1116
|
+
);
|
|
1117
|
+
};
|
|
1118
|
+
var Tooltip_default = CmrTooltip;
|
|
1119
|
+
|
|
1120
|
+
// src/CmrComponents/select-upload/SelectUpload.tsx
|
|
1121
|
+
var import_react8 = __toESM(require("react"));
|
|
1122
|
+
var import_material12 = require("@mui/material");
|
|
1123
|
+
var import_Select = __toESM(require("@mui/material/Select"));
|
|
1124
|
+
var import_Dialog6 = __toESM(require("@mui/material/Dialog"));
|
|
1125
|
+
var import_DialogTitle6 = __toESM(require("@mui/material/DialogTitle"));
|
|
1126
|
+
var import_DialogContent6 = __toESM(require("@mui/material/DialogContent"));
|
|
1127
|
+
var import_DialogContentText5 = __toESM(require("@mui/material/DialogContentText"));
|
|
1128
|
+
var import_Box3 = __toESM(require("@mui/material/Box"));
|
|
1129
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1130
|
+
var CMRSelectUpload = (props) => {
|
|
1131
|
+
let [open, setOpen] = import_react8.default.useState(false);
|
|
1132
|
+
let [fileIndex, selectFileIndex] = import_react8.default.useState(-1);
|
|
1133
|
+
let [uploading, setUploading] = import_react8.default.useState(false);
|
|
1134
|
+
const [progress, setProgress] = import_react8.default.useState(0);
|
|
1135
|
+
const handleClickOpen = () => {
|
|
1136
|
+
selectFileIndex(-1);
|
|
1137
|
+
setOpen(true);
|
|
1138
|
+
};
|
|
1139
|
+
const handleClose = () => {
|
|
1140
|
+
setOpen(false);
|
|
1141
|
+
};
|
|
1142
|
+
const handleChange = (event) => {
|
|
1143
|
+
selectFileIndex(event.target.value);
|
|
1144
|
+
};
|
|
1145
|
+
const onSet = () => {
|
|
1146
|
+
props.onSelected(props.fileSelection[fileIndex]);
|
|
1147
|
+
setOpen(false);
|
|
1148
|
+
};
|
|
1149
|
+
const selectionDialog = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_Dialog6.default, { open, onClose: handleClose, children: [
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_DialogTitle6.default, { children: "Select or Upload" }),
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_DialogContent6.default, { sx: { width: 520 }, children: [
|
|
1152
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_DialogContentText5.default, { sx: { pl: 1, pr: 1, pb: 0 }, children: uploading ? "Please wait for the upload to finish." : "" }),
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_DialogContent6.default, { sx: { p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1154
|
+
import_Select.default,
|
|
1155
|
+
{
|
|
1156
|
+
value: fileIndex,
|
|
1157
|
+
onChange: handleChange,
|
|
1158
|
+
disabled: uploading,
|
|
1159
|
+
inputProps: { "aria-label": "Without label" },
|
|
1160
|
+
sx: { width: "100%" },
|
|
1161
|
+
children: [
|
|
1162
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material12.MenuItem, { value: -1, children: props.fileSelection.length < 1 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("em", { children: "No Stored Files" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("em", { children: "Select a Stored File" }) }),
|
|
1163
|
+
(props.fileSelection != void 0 ? props.fileSelection : []).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material12.MenuItem, { value: index, children: option.fileName }, index))
|
|
1164
|
+
]
|
|
1165
|
+
}
|
|
1166
|
+
) }),
|
|
1167
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_Box3.default, { sx: { pt: 2, justifyContent: "center", display: "flex", padding: "8px" }, children: [
|
|
1168
|
+
fileIndex !== -1 && !uploading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material12.Button, { fullWidth: true, sx: { marginRight: "8px" }, variant: "contained", color: "success", onClick: onSet, children: "Ok" }),
|
|
1169
|
+
fileIndex == -1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1170
|
+
Upload_default,
|
|
1171
|
+
{
|
|
1172
|
+
...props,
|
|
1173
|
+
color: "info",
|
|
1174
|
+
fullWidth: true,
|
|
1175
|
+
onUploaded: (res, file) => {
|
|
1176
|
+
console.log("calling Setup level on uploaded");
|
|
1177
|
+
console.log(props.onUploaded);
|
|
1178
|
+
selectFileIndex(props.fileSelection.length);
|
|
1179
|
+
props.onUploaded(res, file);
|
|
1180
|
+
setOpen(false);
|
|
1181
|
+
},
|
|
1182
|
+
fileExtension: props.fileExtension,
|
|
1183
|
+
uploadHandler: props.uploadHandler,
|
|
1184
|
+
uploadStarted: () => {
|
|
1185
|
+
setUploading(true);
|
|
1186
|
+
props.onSelected(void 0);
|
|
1187
|
+
},
|
|
1188
|
+
uploadProgressed: (progress2) => {
|
|
1189
|
+
setOpen(false);
|
|
1190
|
+
setProgress(progress2);
|
|
1191
|
+
},
|
|
1192
|
+
uploadEnded: () => setUploading(false)
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material12.Button, { fullWidth: true, variant: "outlined", color: "inherit", sx: { color: "#333", marginLeft: "8px" }, onClick: handleClose, children: " Cancel" })
|
|
1196
|
+
] })
|
|
1197
|
+
] })
|
|
1198
|
+
] });
|
|
1199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react8.Fragment, { children: [
|
|
1200
|
+
uploading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material12.Button, { variant: "contained", style: { ...props.style, textTransform: "none" }, sx: { overflowWrap: "inherit" }, color: "primary", disabled: uploading, children: [
|
|
1201
|
+
"Uploading ",
|
|
1202
|
+
progress,
|
|
1203
|
+
"%"
|
|
1204
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1205
|
+
import_material12.Button,
|
|
1206
|
+
{
|
|
1207
|
+
variant: props.chosenFile == void 0 ? "contained" : "outlined",
|
|
1208
|
+
color: "info",
|
|
1209
|
+
onClick: handleClickOpen,
|
|
1210
|
+
sx: { marginRight: "10pt" },
|
|
1211
|
+
style: { ...props.style, textTransform: "none" },
|
|
1212
|
+
children: props.chosenFile == void 0 ? props.buttonText ? props.buttonText : "Choose" : props.chosenFile
|
|
1213
|
+
}
|
|
1214
|
+
),
|
|
1215
|
+
selectionDialog
|
|
1216
|
+
] });
|
|
1217
|
+
};
|
|
1218
|
+
var SelectUpload_default = CMRSelectUpload;
|
|
1219
|
+
|
|
1117
1220
|
// src/CmrTable/CmrTable.tsx
|
|
1118
1221
|
var import_x_data_grid = require("@mui/x-data-grid");
|
|
1119
|
-
var
|
|
1222
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1120
1223
|
var CmrTable = (props) => {
|
|
1121
1224
|
const {
|
|
1122
1225
|
dataSource,
|
|
@@ -1128,7 +1231,7 @@ var CmrTable = (props) => {
|
|
|
1128
1231
|
showCheckbox = true,
|
|
1129
1232
|
...rest
|
|
1130
1233
|
} = props;
|
|
1131
|
-
return /* @__PURE__ */ (0,
|
|
1234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1132
1235
|
import_x_data_grid.DataGrid,
|
|
1133
1236
|
{
|
|
1134
1237
|
rows: dataSource ? dataSource.map((row) => ({
|
|
@@ -1154,6 +1257,7 @@ var CmrTable_default = CmrTable;
|
|
|
1154
1257
|
var CmrTable2 = CmrTable_default;
|
|
1155
1258
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1156
1259
|
0 && (module.exports = {
|
|
1260
|
+
CMRSelectUpload,
|
|
1157
1261
|
CMRUpload,
|
|
1158
1262
|
CmrButton,
|
|
1159
1263
|
CmrCheckbox,
|
|
@@ -1169,5 +1273,6 @@ var CmrTable2 = CmrTable_default;
|
|
|
1169
1273
|
CmrRadioGroup,
|
|
1170
1274
|
CmrSelect,
|
|
1171
1275
|
CmrTable,
|
|
1172
|
-
CmrTabs
|
|
1276
|
+
CmrTabs,
|
|
1277
|
+
CmrTooltip
|
|
1173
1278
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -2,43 +2,10 @@
|
|
|
2
2
|
import { Button } from "@mui/material";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
var CmrButton = (props) => {
|
|
5
|
-
const { children, onClick,
|
|
6
|
-
|
|
7
|
-
boxShadow: "none",
|
|
8
|
-
"&:hover": {
|
|
9
|
-
boxShadow: "none"
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
let combinedSx;
|
|
13
|
-
if (Array.isArray(sx)) {
|
|
14
|
-
combinedSx = [baseSx, ...sx];
|
|
15
|
-
} else if (typeof sx === "function") {
|
|
16
|
-
combinedSx = (theme) => ({
|
|
17
|
-
...baseSx,
|
|
18
|
-
...sx(theme)
|
|
19
|
-
});
|
|
20
|
-
} else if (typeof sx === "object" && sx !== null) {
|
|
21
|
-
combinedSx = {
|
|
22
|
-
...baseSx,
|
|
23
|
-
...sx
|
|
24
|
-
};
|
|
25
|
-
} else {
|
|
26
|
-
combinedSx = baseSx;
|
|
27
|
-
}
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
-
Button,
|
|
30
|
-
{
|
|
31
|
-
onClick,
|
|
32
|
-
...rest,
|
|
33
|
-
className: `cmr-button ${variant}`,
|
|
34
|
-
style: { textTransform: "none" },
|
|
35
|
-
variant,
|
|
36
|
-
disabled,
|
|
37
|
-
sx: combinedSx,
|
|
38
|
-
children
|
|
39
|
-
}
|
|
40
|
-
);
|
|
5
|
+
const { children, onClick, ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(Button, { onClick, ...rest, style: { ...props.style, textTransform: "none" }, children });
|
|
41
7
|
};
|
|
8
|
+
var CmrButton_default = CmrButton;
|
|
42
9
|
|
|
43
10
|
// src/CmrComponents/CmrCheckbox/CmrCheckbox.tsx
|
|
44
11
|
import { Checkbox } from "@mui/material";
|
|
@@ -794,8 +761,8 @@ function CmrNameDialog(props) {
|
|
|
794
761
|
}
|
|
795
762
|
) }),
|
|
796
763
|
/* @__PURE__ */ jsxs7(DialogActions2, { children: [
|
|
797
|
-
/* @__PURE__ */ jsx11(
|
|
798
|
-
/* @__PURE__ */ jsx11(
|
|
764
|
+
/* @__PURE__ */ jsx11(CmrButton_default, { variant: "outlined", onClick: handleClose, children: "Cancel" }),
|
|
765
|
+
/* @__PURE__ */ jsx11(CmrButton_default, { variant: "contained", color: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
799
766
|
] })
|
|
800
767
|
]
|
|
801
768
|
}
|
|
@@ -842,8 +809,8 @@ function CmrConfirmation({
|
|
|
842
809
|
/* @__PURE__ */ jsxs8(DialogContent3, { sx: { width }, children: [
|
|
843
810
|
/* @__PURE__ */ jsx12(DialogContentText2, { alignContent: "center", children: message }),
|
|
844
811
|
/* @__PURE__ */ jsxs8(DialogActions3, { className: "mt-4", children: [
|
|
845
|
-
cancellable && /* @__PURE__ */ jsx12(
|
|
846
|
-
/* @__PURE__ */ jsx12(
|
|
812
|
+
cancellable && /* @__PURE__ */ jsx12(CmrButton_default, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: cancelText }),
|
|
813
|
+
/* @__PURE__ */ jsx12(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: confirmText })
|
|
847
814
|
] })
|
|
848
815
|
] })
|
|
849
816
|
] });
|
|
@@ -960,8 +927,8 @@ function CmrEditConfirmation({
|
|
|
960
927
|
}
|
|
961
928
|
) }),
|
|
962
929
|
/* @__PURE__ */ jsxs10(DialogActions5, { children: [
|
|
963
|
-
cancellable && /* @__PURE__ */ jsx14(
|
|
964
|
-
/* @__PURE__ */ jsx14(
|
|
930
|
+
cancellable && /* @__PURE__ */ jsx14(CmrButton_default, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: "Cancel" }),
|
|
931
|
+
/* @__PURE__ */ jsx14(CmrButton_default, { variant: "contained", color, onClick: handleConfirm, children: "Confirm" })
|
|
965
932
|
] })
|
|
966
933
|
] })
|
|
967
934
|
] });
|
|
@@ -1069,9 +1036,143 @@ var CmrInputNumber = (props) => {
|
|
|
1069
1036
|
};
|
|
1070
1037
|
var InputNumber_default = CmrInputNumber;
|
|
1071
1038
|
|
|
1039
|
+
// src/CmrComponents/tooltip/Tooltip.tsx
|
|
1040
|
+
import { Tooltip } from "antd";
|
|
1041
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1042
|
+
var CmrTooltip = (props) => {
|
|
1043
|
+
const {
|
|
1044
|
+
arrowPointAtCenter,
|
|
1045
|
+
autoAdjustOverflow,
|
|
1046
|
+
color,
|
|
1047
|
+
defaultVisible,
|
|
1048
|
+
mouseEnterDelay,
|
|
1049
|
+
mouseLeaveDelay,
|
|
1050
|
+
overlayClassName,
|
|
1051
|
+
placement,
|
|
1052
|
+
visible,
|
|
1053
|
+
...rest
|
|
1054
|
+
} = props;
|
|
1055
|
+
return /* @__PURE__ */ jsx18(
|
|
1056
|
+
Tooltip,
|
|
1057
|
+
{
|
|
1058
|
+
arrowPointAtCenter,
|
|
1059
|
+
autoAdjustOverflow,
|
|
1060
|
+
color,
|
|
1061
|
+
defaultVisible,
|
|
1062
|
+
mouseEnterDelay,
|
|
1063
|
+
mouseLeaveDelay,
|
|
1064
|
+
overlayClassName,
|
|
1065
|
+
placement,
|
|
1066
|
+
visible,
|
|
1067
|
+
...rest
|
|
1068
|
+
}
|
|
1069
|
+
);
|
|
1070
|
+
};
|
|
1071
|
+
var Tooltip_default = CmrTooltip;
|
|
1072
|
+
|
|
1073
|
+
// src/CmrComponents/select-upload/SelectUpload.tsx
|
|
1074
|
+
import React11, { Fragment } from "react";
|
|
1075
|
+
import { Button as Button4, MenuItem as MenuItem3 } from "@mui/material";
|
|
1076
|
+
import Select2 from "@mui/material/Select";
|
|
1077
|
+
import Dialog6 from "@mui/material/Dialog";
|
|
1078
|
+
import DialogTitle6 from "@mui/material/DialogTitle";
|
|
1079
|
+
import DialogContent6 from "@mui/material/DialogContent";
|
|
1080
|
+
import DialogContentText5 from "@mui/material/DialogContentText";
|
|
1081
|
+
import Box4 from "@mui/material/Box";
|
|
1082
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1083
|
+
var CMRSelectUpload = (props) => {
|
|
1084
|
+
let [open, setOpen] = React11.useState(false);
|
|
1085
|
+
let [fileIndex, selectFileIndex] = React11.useState(-1);
|
|
1086
|
+
let [uploading, setUploading] = React11.useState(false);
|
|
1087
|
+
const [progress, setProgress] = React11.useState(0);
|
|
1088
|
+
const handleClickOpen = () => {
|
|
1089
|
+
selectFileIndex(-1);
|
|
1090
|
+
setOpen(true);
|
|
1091
|
+
};
|
|
1092
|
+
const handleClose = () => {
|
|
1093
|
+
setOpen(false);
|
|
1094
|
+
};
|
|
1095
|
+
const handleChange = (event) => {
|
|
1096
|
+
selectFileIndex(event.target.value);
|
|
1097
|
+
};
|
|
1098
|
+
const onSet = () => {
|
|
1099
|
+
props.onSelected(props.fileSelection[fileIndex]);
|
|
1100
|
+
setOpen(false);
|
|
1101
|
+
};
|
|
1102
|
+
const selectionDialog = /* @__PURE__ */ jsxs12(Dialog6, { open, onClose: handleClose, children: [
|
|
1103
|
+
/* @__PURE__ */ jsx19(DialogTitle6, { children: "Select or Upload" }),
|
|
1104
|
+
/* @__PURE__ */ jsxs12(DialogContent6, { sx: { width: 520 }, children: [
|
|
1105
|
+
/* @__PURE__ */ jsx19(DialogContentText5, { sx: { pl: 1, pr: 1, pb: 0 }, children: uploading ? "Please wait for the upload to finish." : "" }),
|
|
1106
|
+
/* @__PURE__ */ jsx19(DialogContent6, { sx: { p: 1 }, children: /* @__PURE__ */ jsxs12(
|
|
1107
|
+
Select2,
|
|
1108
|
+
{
|
|
1109
|
+
value: fileIndex,
|
|
1110
|
+
onChange: handleChange,
|
|
1111
|
+
disabled: uploading,
|
|
1112
|
+
inputProps: { "aria-label": "Without label" },
|
|
1113
|
+
sx: { width: "100%" },
|
|
1114
|
+
children: [
|
|
1115
|
+
/* @__PURE__ */ jsx19(MenuItem3, { value: -1, children: props.fileSelection.length < 1 ? /* @__PURE__ */ jsx19("em", { children: "No Stored Files" }) : /* @__PURE__ */ jsx19("em", { children: "Select a Stored File" }) }),
|
|
1116
|
+
(props.fileSelection != void 0 ? props.fileSelection : []).map((option, index) => /* @__PURE__ */ jsx19(MenuItem3, { value: index, children: option.fileName }, index))
|
|
1117
|
+
]
|
|
1118
|
+
}
|
|
1119
|
+
) }),
|
|
1120
|
+
/* @__PURE__ */ jsxs12(Box4, { sx: { pt: 2, justifyContent: "center", display: "flex", padding: "8px" }, children: [
|
|
1121
|
+
fileIndex !== -1 && !uploading && /* @__PURE__ */ jsx19(Button4, { fullWidth: true, sx: { marginRight: "8px" }, variant: "contained", color: "success", onClick: onSet, children: "Ok" }),
|
|
1122
|
+
fileIndex == -1 && /* @__PURE__ */ jsx19(
|
|
1123
|
+
Upload_default,
|
|
1124
|
+
{
|
|
1125
|
+
...props,
|
|
1126
|
+
color: "info",
|
|
1127
|
+
fullWidth: true,
|
|
1128
|
+
onUploaded: (res, file) => {
|
|
1129
|
+
console.log("calling Setup level on uploaded");
|
|
1130
|
+
console.log(props.onUploaded);
|
|
1131
|
+
selectFileIndex(props.fileSelection.length);
|
|
1132
|
+
props.onUploaded(res, file);
|
|
1133
|
+
setOpen(false);
|
|
1134
|
+
},
|
|
1135
|
+
fileExtension: props.fileExtension,
|
|
1136
|
+
uploadHandler: props.uploadHandler,
|
|
1137
|
+
uploadStarted: () => {
|
|
1138
|
+
setUploading(true);
|
|
1139
|
+
props.onSelected(void 0);
|
|
1140
|
+
},
|
|
1141
|
+
uploadProgressed: (progress2) => {
|
|
1142
|
+
setOpen(false);
|
|
1143
|
+
setProgress(progress2);
|
|
1144
|
+
},
|
|
1145
|
+
uploadEnded: () => setUploading(false)
|
|
1146
|
+
}
|
|
1147
|
+
),
|
|
1148
|
+
/* @__PURE__ */ jsx19(Button4, { fullWidth: true, variant: "outlined", color: "inherit", sx: { color: "#333", marginLeft: "8px" }, onClick: handleClose, children: " Cancel" })
|
|
1149
|
+
] })
|
|
1150
|
+
] })
|
|
1151
|
+
] });
|
|
1152
|
+
return /* @__PURE__ */ jsxs12(Fragment, { children: [
|
|
1153
|
+
uploading ? /* @__PURE__ */ jsxs12(Button4, { variant: "contained", style: { ...props.style, textTransform: "none" }, sx: { overflowWrap: "inherit" }, color: "primary", disabled: uploading, children: [
|
|
1154
|
+
"Uploading ",
|
|
1155
|
+
progress,
|
|
1156
|
+
"%"
|
|
1157
|
+
] }) : /* @__PURE__ */ jsx19(
|
|
1158
|
+
Button4,
|
|
1159
|
+
{
|
|
1160
|
+
variant: props.chosenFile == void 0 ? "contained" : "outlined",
|
|
1161
|
+
color: "info",
|
|
1162
|
+
onClick: handleClickOpen,
|
|
1163
|
+
sx: { marginRight: "10pt" },
|
|
1164
|
+
style: { ...props.style, textTransform: "none" },
|
|
1165
|
+
children: props.chosenFile == void 0 ? props.buttonText ? props.buttonText : "Choose" : props.chosenFile
|
|
1166
|
+
}
|
|
1167
|
+
),
|
|
1168
|
+
selectionDialog
|
|
1169
|
+
] });
|
|
1170
|
+
};
|
|
1171
|
+
var SelectUpload_default = CMRSelectUpload;
|
|
1172
|
+
|
|
1072
1173
|
// src/CmrTable/CmrTable.tsx
|
|
1073
1174
|
import { DataGrid } from "@mui/x-data-grid";
|
|
1074
|
-
import { jsx as
|
|
1175
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1075
1176
|
var CmrTable = (props) => {
|
|
1076
1177
|
const {
|
|
1077
1178
|
dataSource,
|
|
@@ -1083,7 +1184,7 @@ var CmrTable = (props) => {
|
|
|
1083
1184
|
showCheckbox = true,
|
|
1084
1185
|
...rest
|
|
1085
1186
|
} = props;
|
|
1086
|
-
return /* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */ jsx20("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx20(
|
|
1087
1188
|
DataGrid,
|
|
1088
1189
|
{
|
|
1089
1190
|
rows: dataSource ? dataSource.map((row) => ({
|
|
@@ -1108,8 +1209,9 @@ var CmrTable_default = CmrTable;
|
|
|
1108
1209
|
// src/index.ts
|
|
1109
1210
|
var CmrTable2 = CmrTable_default;
|
|
1110
1211
|
export {
|
|
1212
|
+
SelectUpload_default as CMRSelectUpload,
|
|
1111
1213
|
Upload_default as CMRUpload,
|
|
1112
|
-
CmrButton,
|
|
1214
|
+
CmrButton_default as CmrButton,
|
|
1113
1215
|
Checkbox_default as CmrCheckbox,
|
|
1114
1216
|
Collapse_default as CmrCollapse,
|
|
1115
1217
|
CmrConfirmation,
|
|
@@ -1123,5 +1225,6 @@ export {
|
|
|
1123
1225
|
CmrRadioGroup_default as CmrRadioGroup,
|
|
1124
1226
|
CmrSelect_default as CmrSelect,
|
|
1125
1227
|
CmrTable2 as CmrTable,
|
|
1126
|
-
CmrTabs
|
|
1228
|
+
CmrTabs,
|
|
1229
|
+
Tooltip_default as CmrTooltip
|
|
1127
1230
|
};
|