cloudmr-ux 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +58 -14
- package/dist/index.js +110 -6
- package/dist/index.mjs +107 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ButtonProps, SxProps, Theme } from '@mui/material';
|
|
3
|
-
import
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import React__default, { ReactNode, ChangeEvent, CSSProperties, FC } from 'react';
|
|
4
5
|
import { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
5
6
|
import { CollapsibleType } from 'antd/es/collapse/CollapsePanel';
|
|
6
7
|
import { ExpandIconPosition } from 'antd/es/collapse/Collapse';
|
|
@@ -9,17 +10,17 @@ import { DataGridProps } from '@mui/x-data-grid';
|
|
|
9
10
|
|
|
10
11
|
declare const CmrButton: (props: ButtonProps) => react_jsx_runtime.JSX.Element;
|
|
11
12
|
|
|
12
|
-
interface CmrInputProps extends Omit<
|
|
13
|
+
interface CmrInputProps extends Omit<React__default.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
|
13
14
|
defaultValue?: string;
|
|
14
15
|
id?: string;
|
|
15
16
|
maxLength?: number;
|
|
16
17
|
size?: SizeType;
|
|
17
18
|
value?: string;
|
|
18
19
|
type?: any;
|
|
19
|
-
prefix?:
|
|
20
|
+
prefix?: React__default.ReactNode;
|
|
20
21
|
bordered?: boolean;
|
|
21
|
-
onChange?: (e:
|
|
22
|
-
onPressEnter?: (e:
|
|
22
|
+
onChange?: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
|
|
23
|
+
onPressEnter?: (e: React__default.KeyboardEvent<HTMLInputElement>) => void;
|
|
23
24
|
}
|
|
24
25
|
declare const CmrInput: (props: CmrInputProps) => react_jsx_runtime.JSX.Element;
|
|
25
26
|
|
|
@@ -34,7 +35,7 @@ interface CmrRadioProps {
|
|
|
34
35
|
defaultValue?: string;
|
|
35
36
|
onChange?: (value: string) => void;
|
|
36
37
|
}
|
|
37
|
-
declare const CmrRadioGroup:
|
|
38
|
+
declare const CmrRadioGroup: React__default.FC<CmrRadioProps>;
|
|
38
39
|
|
|
39
40
|
interface Option {
|
|
40
41
|
label: string;
|
|
@@ -45,7 +46,7 @@ interface CmrSelectProps {
|
|
|
45
46
|
label: string;
|
|
46
47
|
disabled?: boolean;
|
|
47
48
|
}
|
|
48
|
-
declare const CmrSelect:
|
|
49
|
+
declare const CmrSelect: React__default.FC<CmrSelectProps>;
|
|
49
50
|
|
|
50
51
|
interface CmrCollapseProps {
|
|
51
52
|
accordion?: boolean;
|
|
@@ -61,14 +62,14 @@ interface CmrCollapseProps {
|
|
|
61
62
|
}
|
|
62
63
|
declare const CmrCollapse: (props: CmrCollapseProps) => react_jsx_runtime.JSX.Element;
|
|
63
64
|
|
|
64
|
-
interface CmrPanelProps extends
|
|
65
|
+
interface CmrPanelProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
65
66
|
activeKey?: string | string[];
|
|
66
67
|
header: string | undefined;
|
|
67
68
|
children: ReactNode;
|
|
68
69
|
panelKey?: number;
|
|
69
70
|
onToggle?: (key: number | undefined) => void;
|
|
70
71
|
expanded?: boolean;
|
|
71
|
-
cardProps?:
|
|
72
|
+
cardProps?: React__default.HTMLAttributes<HTMLDivElement>;
|
|
72
73
|
}
|
|
73
74
|
declare const CmrPanel: (props: CmrPanelProps) => react_jsx_runtime.JSX.Element;
|
|
74
75
|
|
|
@@ -84,7 +85,7 @@ interface LambdaFile {
|
|
|
84
85
|
* functionalities and call back methods evoked
|
|
85
86
|
* for specific interactions
|
|
86
87
|
*/
|
|
87
|
-
interface CMRUploadProps extends
|
|
88
|
+
interface CMRUploadProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
88
89
|
retains?: boolean;
|
|
89
90
|
maxCount: number;
|
|
90
91
|
changeNameAfterUpload?: boolean;
|
|
@@ -205,7 +206,7 @@ interface CmrTabsProps {
|
|
|
205
206
|
}
|
|
206
207
|
declare function CmrTabs(props: CmrTabsProps): react_jsx_runtime.JSX.Element;
|
|
207
208
|
|
|
208
|
-
interface CmrCheckboxProps extends
|
|
209
|
+
interface CmrCheckboxProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
209
210
|
autoFocus?: boolean;
|
|
210
211
|
checked?: boolean;
|
|
211
212
|
defaultChecked?: boolean;
|
|
@@ -218,7 +219,7 @@ interface CmrCheckboxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
218
219
|
}
|
|
219
220
|
declare const CmrCheckbox: (props: CmrCheckboxProps) => react_jsx_runtime.JSX.Element;
|
|
220
221
|
|
|
221
|
-
interface CmrLabelProps extends
|
|
222
|
+
interface CmrLabelProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
222
223
|
required?: boolean;
|
|
223
224
|
children?: any;
|
|
224
225
|
}
|
|
@@ -233,11 +234,54 @@ interface CmrInputNumberProps {
|
|
|
233
234
|
size?: SizeType;
|
|
234
235
|
value?: number;
|
|
235
236
|
onChange?: (value: number | null) => void;
|
|
236
|
-
children?:
|
|
237
|
+
children?: React__default.ReactNode;
|
|
237
238
|
style?: CSSProperties;
|
|
238
239
|
}
|
|
239
240
|
declare const CmrInputNumber: (props: CmrInputNumberProps) => react_jsx_runtime.JSX.Element;
|
|
240
241
|
|
|
242
|
+
interface CMRSelectUploadProps extends CMRUploadProps {
|
|
243
|
+
/**
|
|
244
|
+
* A selection of currently uploaded files
|
|
245
|
+
*/
|
|
246
|
+
fileSelection: UploadedFile[];
|
|
247
|
+
onSelected: (file?: UploadedFile) => void;
|
|
248
|
+
chosenFile?: string;
|
|
249
|
+
buttonText?: string;
|
|
250
|
+
/**
|
|
251
|
+
* Enforces the extension of selected files
|
|
252
|
+
*/
|
|
253
|
+
fileExtension?: string;
|
|
254
|
+
}
|
|
255
|
+
interface UploadedFile {
|
|
256
|
+
id: number;
|
|
257
|
+
fileName: string;
|
|
258
|
+
link: string;
|
|
259
|
+
md5?: string;
|
|
260
|
+
size: string;
|
|
261
|
+
status: string;
|
|
262
|
+
createdAt: string;
|
|
263
|
+
updatedAt: string;
|
|
264
|
+
database: string;
|
|
265
|
+
location: string;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Select from a set of uploaded files or upload new
|
|
269
|
+
*/
|
|
270
|
+
declare const CMRSelectUpload: (props: CMRSelectUploadProps) => react_jsx_runtime.JSX.Element;
|
|
271
|
+
|
|
272
|
+
interface UploadWindowProps {
|
|
273
|
+
upload: (file: File, fileAlias: string, fileDatabase: string) => Promise<number>;
|
|
274
|
+
open: boolean;
|
|
275
|
+
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
276
|
+
fileExtension?: string;
|
|
277
|
+
template?: {
|
|
278
|
+
showFileName?: boolean;
|
|
279
|
+
showDatabase?: boolean;
|
|
280
|
+
showFileSize?: boolean;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
declare function CmrUploadWindow({ upload, open, setOpen, fileExtension, template, }: UploadWindowProps): react_jsx_runtime.JSX.Element;
|
|
284
|
+
|
|
241
285
|
interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
|
|
242
286
|
dataSource: any[];
|
|
243
287
|
idAlias?: string;
|
|
@@ -248,4 +292,4 @@ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
|
|
|
248
292
|
|
|
249
293
|
declare const CmrTable: FC<CmrTableProps>;
|
|
250
294
|
|
|
251
|
-
export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrDeletionDialog, CmrEditConfirmation, CmrInput, CmrInputNumber, CmrLabel, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, LambdaFile };
|
|
295
|
+
export { CMRSelectUpload, CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrDeletionDialog, CmrEditConfirmation, CmrInput, CmrInputNumber, CmrLabel, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, CmrUploadWindow, LambdaFile };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ 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
35
|
CmrButton: () => CmrButton_default,
|
|
35
36
|
CmrCheckbox: () => Checkbox_default,
|
|
@@ -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
|
+
CmrUploadWindow: () => CmrUploadWindow
|
|
49
51
|
});
|
|
50
52
|
module.exports = __toCommonJS(src_exports);
|
|
51
53
|
|
|
@@ -288,7 +290,7 @@ var Label_default = CmrLabel;
|
|
|
288
290
|
|
|
289
291
|
// src/CmrComponents/upload/UploadWindow.tsx
|
|
290
292
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
291
|
-
function
|
|
293
|
+
function CmrUploadWindow({
|
|
292
294
|
upload,
|
|
293
295
|
open,
|
|
294
296
|
setOpen,
|
|
@@ -709,7 +711,7 @@ var CmrUpload = (props) => {
|
|
|
709
711
|
"%"
|
|
710
712
|
] }),
|
|
711
713
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
712
|
-
|
|
714
|
+
CmrUploadWindow,
|
|
713
715
|
{
|
|
714
716
|
open,
|
|
715
717
|
setOpen,
|
|
@@ -1081,9 +1083,109 @@ var CmrInputNumber = (props) => {
|
|
|
1081
1083
|
};
|
|
1082
1084
|
var InputNumber_default = CmrInputNumber;
|
|
1083
1085
|
|
|
1086
|
+
// src/CmrComponents/select-upload/SelectUpload.tsx
|
|
1087
|
+
var import_react8 = __toESM(require("react"));
|
|
1088
|
+
var import_material12 = require("@mui/material");
|
|
1089
|
+
var import_Select = __toESM(require("@mui/material/Select"));
|
|
1090
|
+
var import_Dialog6 = __toESM(require("@mui/material/Dialog"));
|
|
1091
|
+
var import_DialogTitle6 = __toESM(require("@mui/material/DialogTitle"));
|
|
1092
|
+
var import_DialogContent6 = __toESM(require("@mui/material/DialogContent"));
|
|
1093
|
+
var import_DialogContentText5 = __toESM(require("@mui/material/DialogContentText"));
|
|
1094
|
+
var import_Box3 = __toESM(require("@mui/material/Box"));
|
|
1095
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1096
|
+
var CMRSelectUpload = (props) => {
|
|
1097
|
+
let [open, setOpen] = import_react8.default.useState(false);
|
|
1098
|
+
let [fileIndex, selectFileIndex] = import_react8.default.useState(-1);
|
|
1099
|
+
let [uploading, setUploading] = import_react8.default.useState(false);
|
|
1100
|
+
const [progress, setProgress] = import_react8.default.useState(0);
|
|
1101
|
+
const handleClickOpen = () => {
|
|
1102
|
+
selectFileIndex(-1);
|
|
1103
|
+
setOpen(true);
|
|
1104
|
+
};
|
|
1105
|
+
const handleClose = () => {
|
|
1106
|
+
setOpen(false);
|
|
1107
|
+
};
|
|
1108
|
+
const handleChange = (event) => {
|
|
1109
|
+
selectFileIndex(event.target.value);
|
|
1110
|
+
};
|
|
1111
|
+
const onSet = () => {
|
|
1112
|
+
props.onSelected(props.fileSelection[fileIndex]);
|
|
1113
|
+
setOpen(false);
|
|
1114
|
+
};
|
|
1115
|
+
const selectionDialog = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_Dialog6.default, { open, onClose: handleClose, children: [
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogTitle6.default, { children: "Select or Upload" }),
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_DialogContent6.default, { sx: { width: 520 }, children: [
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogContentText5.default, { sx: { pl: 1, pr: 1, pb: 0 }, children: uploading ? "Please wait for the upload to finish." : "" }),
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogContent6.default, { sx: { p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1120
|
+
import_Select.default,
|
|
1121
|
+
{
|
|
1122
|
+
value: fileIndex,
|
|
1123
|
+
onChange: handleChange,
|
|
1124
|
+
disabled: uploading,
|
|
1125
|
+
inputProps: { "aria-label": "Without label" },
|
|
1126
|
+
sx: { width: "100%" },
|
|
1127
|
+
children: [
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.MenuItem, { value: -1, children: props.fileSelection.length < 1 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("em", { children: "No Stored Files" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("em", { children: "Select a Stored File" }) }),
|
|
1129
|
+
(props.fileSelection != void 0 ? props.fileSelection : []).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.MenuItem, { value: index, children: option.fileName }, index))
|
|
1130
|
+
]
|
|
1131
|
+
}
|
|
1132
|
+
) }),
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_Box3.default, { sx: { pt: 2, justifyContent: "center", display: "flex", padding: "8px" }, children: [
|
|
1134
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.Button, { fullWidth: true, variant: "outlined", sx: { marginRight: "8px" }, onClick: handleClose, children: " Cancel" }),
|
|
1135
|
+
fileIndex !== -1 && !uploading && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.Button, { fullWidth: true, sx: { marginLeft: "8px" }, variant: "contained", onClick: onSet, children: "OK" }),
|
|
1136
|
+
fileIndex == -1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1137
|
+
Upload_default,
|
|
1138
|
+
{
|
|
1139
|
+
...props,
|
|
1140
|
+
color: "info",
|
|
1141
|
+
fullWidth: true,
|
|
1142
|
+
onUploaded: (res, file) => {
|
|
1143
|
+
console.log("calling Setup level on uploaded");
|
|
1144
|
+
console.log(props.onUploaded);
|
|
1145
|
+
selectFileIndex(props.fileSelection.length);
|
|
1146
|
+
props.onUploaded(res, file);
|
|
1147
|
+
setOpen(false);
|
|
1148
|
+
},
|
|
1149
|
+
fileExtension: props.fileExtension,
|
|
1150
|
+
uploadHandler: props.uploadHandler,
|
|
1151
|
+
uploadStarted: () => {
|
|
1152
|
+
setUploading(true);
|
|
1153
|
+
props.onSelected(void 0);
|
|
1154
|
+
},
|
|
1155
|
+
uploadProgressed: (progress2) => {
|
|
1156
|
+
setOpen(false);
|
|
1157
|
+
setProgress(progress2);
|
|
1158
|
+
},
|
|
1159
|
+
uploadEnded: () => setUploading(false)
|
|
1160
|
+
}
|
|
1161
|
+
)
|
|
1162
|
+
] })
|
|
1163
|
+
] })
|
|
1164
|
+
] });
|
|
1165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react8.Fragment, { children: [
|
|
1166
|
+
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: [
|
|
1167
|
+
"Uploading ",
|
|
1168
|
+
progress,
|
|
1169
|
+
"%"
|
|
1170
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1171
|
+
import_material12.Button,
|
|
1172
|
+
{
|
|
1173
|
+
variant: props.chosenFile == void 0 ? "contained" : "outlined",
|
|
1174
|
+
color: "info",
|
|
1175
|
+
onClick: handleClickOpen,
|
|
1176
|
+
sx: { marginRight: "10pt" },
|
|
1177
|
+
style: { ...props.style, textTransform: "none" },
|
|
1178
|
+
children: props.chosenFile == void 0 ? props.buttonText ? props.buttonText : "Choose" : props.chosenFile
|
|
1179
|
+
}
|
|
1180
|
+
),
|
|
1181
|
+
selectionDialog
|
|
1182
|
+
] });
|
|
1183
|
+
};
|
|
1184
|
+
var SelectUpload_default = CMRSelectUpload;
|
|
1185
|
+
|
|
1084
1186
|
// src/CmrTable/CmrTable.tsx
|
|
1085
1187
|
var import_x_data_grid = require("@mui/x-data-grid");
|
|
1086
|
-
var
|
|
1188
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1087
1189
|
var CmrTable = (props) => {
|
|
1088
1190
|
const {
|
|
1089
1191
|
dataSource,
|
|
@@ -1095,7 +1197,7 @@ var CmrTable = (props) => {
|
|
|
1095
1197
|
showCheckbox = true,
|
|
1096
1198
|
...rest
|
|
1097
1199
|
} = props;
|
|
1098
|
-
return /* @__PURE__ */ (0,
|
|
1200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1099
1201
|
import_x_data_grid.DataGrid,
|
|
1100
1202
|
{
|
|
1101
1203
|
rows: dataSource ? dataSource.map((row) => ({
|
|
@@ -1121,6 +1223,7 @@ var CmrTable_default = CmrTable;
|
|
|
1121
1223
|
var CmrTable2 = CmrTable_default;
|
|
1122
1224
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1123
1225
|
0 && (module.exports = {
|
|
1226
|
+
CMRSelectUpload,
|
|
1124
1227
|
CMRUpload,
|
|
1125
1228
|
CmrButton,
|
|
1126
1229
|
CmrCheckbox,
|
|
@@ -1136,5 +1239,6 @@ var CmrTable2 = CmrTable_default;
|
|
|
1136
1239
|
CmrRadioGroup,
|
|
1137
1240
|
CmrSelect,
|
|
1138
1241
|
CmrTable,
|
|
1139
|
-
CmrTabs
|
|
1242
|
+
CmrTabs,
|
|
1243
|
+
CmrUploadWindow
|
|
1140
1244
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -243,7 +243,7 @@ var Label_default = CmrLabel;
|
|
|
243
243
|
|
|
244
244
|
// src/CmrComponents/upload/UploadWindow.tsx
|
|
245
245
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
246
|
-
function
|
|
246
|
+
function CmrUploadWindow({
|
|
247
247
|
upload,
|
|
248
248
|
open,
|
|
249
249
|
setOpen,
|
|
@@ -664,7 +664,7 @@ var CmrUpload = (props) => {
|
|
|
664
664
|
"%"
|
|
665
665
|
] }),
|
|
666
666
|
/* @__PURE__ */ jsx10(
|
|
667
|
-
|
|
667
|
+
CmrUploadWindow,
|
|
668
668
|
{
|
|
669
669
|
open,
|
|
670
670
|
setOpen,
|
|
@@ -1036,9 +1036,109 @@ var CmrInputNumber = (props) => {
|
|
|
1036
1036
|
};
|
|
1037
1037
|
var InputNumber_default = CmrInputNumber;
|
|
1038
1038
|
|
|
1039
|
+
// src/CmrComponents/select-upload/SelectUpload.tsx
|
|
1040
|
+
import React11, { Fragment } from "react";
|
|
1041
|
+
import { Button as Button4, MenuItem as MenuItem3 } from "@mui/material";
|
|
1042
|
+
import Select2 from "@mui/material/Select";
|
|
1043
|
+
import Dialog6 from "@mui/material/Dialog";
|
|
1044
|
+
import DialogTitle6 from "@mui/material/DialogTitle";
|
|
1045
|
+
import DialogContent6 from "@mui/material/DialogContent";
|
|
1046
|
+
import DialogContentText5 from "@mui/material/DialogContentText";
|
|
1047
|
+
import Box4 from "@mui/material/Box";
|
|
1048
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1049
|
+
var CMRSelectUpload = (props) => {
|
|
1050
|
+
let [open, setOpen] = React11.useState(false);
|
|
1051
|
+
let [fileIndex, selectFileIndex] = React11.useState(-1);
|
|
1052
|
+
let [uploading, setUploading] = React11.useState(false);
|
|
1053
|
+
const [progress, setProgress] = React11.useState(0);
|
|
1054
|
+
const handleClickOpen = () => {
|
|
1055
|
+
selectFileIndex(-1);
|
|
1056
|
+
setOpen(true);
|
|
1057
|
+
};
|
|
1058
|
+
const handleClose = () => {
|
|
1059
|
+
setOpen(false);
|
|
1060
|
+
};
|
|
1061
|
+
const handleChange = (event) => {
|
|
1062
|
+
selectFileIndex(event.target.value);
|
|
1063
|
+
};
|
|
1064
|
+
const onSet = () => {
|
|
1065
|
+
props.onSelected(props.fileSelection[fileIndex]);
|
|
1066
|
+
setOpen(false);
|
|
1067
|
+
};
|
|
1068
|
+
const selectionDialog = /* @__PURE__ */ jsxs12(Dialog6, { open, onClose: handleClose, children: [
|
|
1069
|
+
/* @__PURE__ */ jsx18(DialogTitle6, { children: "Select or Upload" }),
|
|
1070
|
+
/* @__PURE__ */ jsxs12(DialogContent6, { sx: { width: 520 }, children: [
|
|
1071
|
+
/* @__PURE__ */ jsx18(DialogContentText5, { sx: { pl: 1, pr: 1, pb: 0 }, children: uploading ? "Please wait for the upload to finish." : "" }),
|
|
1072
|
+
/* @__PURE__ */ jsx18(DialogContent6, { sx: { p: 1 }, children: /* @__PURE__ */ jsxs12(
|
|
1073
|
+
Select2,
|
|
1074
|
+
{
|
|
1075
|
+
value: fileIndex,
|
|
1076
|
+
onChange: handleChange,
|
|
1077
|
+
disabled: uploading,
|
|
1078
|
+
inputProps: { "aria-label": "Without label" },
|
|
1079
|
+
sx: { width: "100%" },
|
|
1080
|
+
children: [
|
|
1081
|
+
/* @__PURE__ */ jsx18(MenuItem3, { value: -1, children: props.fileSelection.length < 1 ? /* @__PURE__ */ jsx18("em", { children: "No Stored Files" }) : /* @__PURE__ */ jsx18("em", { children: "Select a Stored File" }) }),
|
|
1082
|
+
(props.fileSelection != void 0 ? props.fileSelection : []).map((option, index) => /* @__PURE__ */ jsx18(MenuItem3, { value: index, children: option.fileName }, index))
|
|
1083
|
+
]
|
|
1084
|
+
}
|
|
1085
|
+
) }),
|
|
1086
|
+
/* @__PURE__ */ jsxs12(Box4, { sx: { pt: 2, justifyContent: "center", display: "flex", padding: "8px" }, children: [
|
|
1087
|
+
/* @__PURE__ */ jsx18(Button4, { fullWidth: true, variant: "outlined", sx: { marginRight: "8px" }, onClick: handleClose, children: " Cancel" }),
|
|
1088
|
+
fileIndex !== -1 && !uploading && /* @__PURE__ */ jsx18(Button4, { fullWidth: true, sx: { marginLeft: "8px" }, variant: "contained", onClick: onSet, children: "OK" }),
|
|
1089
|
+
fileIndex == -1 && /* @__PURE__ */ jsx18(
|
|
1090
|
+
Upload_default,
|
|
1091
|
+
{
|
|
1092
|
+
...props,
|
|
1093
|
+
color: "info",
|
|
1094
|
+
fullWidth: true,
|
|
1095
|
+
onUploaded: (res, file) => {
|
|
1096
|
+
console.log("calling Setup level on uploaded");
|
|
1097
|
+
console.log(props.onUploaded);
|
|
1098
|
+
selectFileIndex(props.fileSelection.length);
|
|
1099
|
+
props.onUploaded(res, file);
|
|
1100
|
+
setOpen(false);
|
|
1101
|
+
},
|
|
1102
|
+
fileExtension: props.fileExtension,
|
|
1103
|
+
uploadHandler: props.uploadHandler,
|
|
1104
|
+
uploadStarted: () => {
|
|
1105
|
+
setUploading(true);
|
|
1106
|
+
props.onSelected(void 0);
|
|
1107
|
+
},
|
|
1108
|
+
uploadProgressed: (progress2) => {
|
|
1109
|
+
setOpen(false);
|
|
1110
|
+
setProgress(progress2);
|
|
1111
|
+
},
|
|
1112
|
+
uploadEnded: () => setUploading(false)
|
|
1113
|
+
}
|
|
1114
|
+
)
|
|
1115
|
+
] })
|
|
1116
|
+
] })
|
|
1117
|
+
] });
|
|
1118
|
+
return /* @__PURE__ */ jsxs12(Fragment, { children: [
|
|
1119
|
+
uploading ? /* @__PURE__ */ jsxs12(Button4, { variant: "contained", style: { ...props.style, textTransform: "none" }, sx: { overflowWrap: "inherit" }, color: "primary", disabled: uploading, children: [
|
|
1120
|
+
"Uploading ",
|
|
1121
|
+
progress,
|
|
1122
|
+
"%"
|
|
1123
|
+
] }) : /* @__PURE__ */ jsx18(
|
|
1124
|
+
Button4,
|
|
1125
|
+
{
|
|
1126
|
+
variant: props.chosenFile == void 0 ? "contained" : "outlined",
|
|
1127
|
+
color: "info",
|
|
1128
|
+
onClick: handleClickOpen,
|
|
1129
|
+
sx: { marginRight: "10pt" },
|
|
1130
|
+
style: { ...props.style, textTransform: "none" },
|
|
1131
|
+
children: props.chosenFile == void 0 ? props.buttonText ? props.buttonText : "Choose" : props.chosenFile
|
|
1132
|
+
}
|
|
1133
|
+
),
|
|
1134
|
+
selectionDialog
|
|
1135
|
+
] });
|
|
1136
|
+
};
|
|
1137
|
+
var SelectUpload_default = CMRSelectUpload;
|
|
1138
|
+
|
|
1039
1139
|
// src/CmrTable/CmrTable.tsx
|
|
1040
1140
|
import { DataGrid } from "@mui/x-data-grid";
|
|
1041
|
-
import { jsx as
|
|
1141
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1042
1142
|
var CmrTable = (props) => {
|
|
1043
1143
|
const {
|
|
1044
1144
|
dataSource,
|
|
@@ -1050,7 +1150,7 @@ var CmrTable = (props) => {
|
|
|
1050
1150
|
showCheckbox = true,
|
|
1051
1151
|
...rest
|
|
1052
1152
|
} = props;
|
|
1053
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ jsx19("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx19(
|
|
1054
1154
|
DataGrid,
|
|
1055
1155
|
{
|
|
1056
1156
|
rows: dataSource ? dataSource.map((row) => ({
|
|
@@ -1075,6 +1175,7 @@ var CmrTable_default = CmrTable;
|
|
|
1075
1175
|
// src/index.ts
|
|
1076
1176
|
var CmrTable2 = CmrTable_default;
|
|
1077
1177
|
export {
|
|
1178
|
+
SelectUpload_default as CMRSelectUpload,
|
|
1078
1179
|
Upload_default as CMRUpload,
|
|
1079
1180
|
CmrButton_default as CmrButton,
|
|
1080
1181
|
Checkbox_default as CmrCheckbox,
|
|
@@ -1090,5 +1191,6 @@ export {
|
|
|
1090
1191
|
CmrRadioGroup_default as CmrRadioGroup,
|
|
1091
1192
|
CmrSelect_default as CmrSelect,
|
|
1092
1193
|
CmrTable2 as CmrTable,
|
|
1093
|
-
CmrTabs
|
|
1194
|
+
CmrTabs,
|
|
1195
|
+
CmrUploadWindow
|
|
1094
1196
|
};
|