cloudmr-ux 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +31 -1
- package/dist/index.js +104 -2
- package/dist/index.mjs +103 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -238,6 +238,36 @@ interface CmrInputNumberProps {
|
|
|
238
238
|
}
|
|
239
239
|
declare const CmrInputNumber: (props: CmrInputNumberProps) => react_jsx_runtime.JSX.Element;
|
|
240
240
|
|
|
241
|
+
interface CMRSelectUploadProps extends CMRUploadProps {
|
|
242
|
+
/**
|
|
243
|
+
* A selection of currently uploaded files
|
|
244
|
+
*/
|
|
245
|
+
fileSelection: UploadedFile[];
|
|
246
|
+
onSelected: (file?: UploadedFile) => void;
|
|
247
|
+
chosenFile?: string;
|
|
248
|
+
buttonText?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Enforces the extension of selected files
|
|
251
|
+
*/
|
|
252
|
+
fileExtension?: string;
|
|
253
|
+
}
|
|
254
|
+
interface UploadedFile {
|
|
255
|
+
id: number;
|
|
256
|
+
fileName: string;
|
|
257
|
+
link: string;
|
|
258
|
+
md5?: string;
|
|
259
|
+
size: string;
|
|
260
|
+
status: string;
|
|
261
|
+
createdAt: string;
|
|
262
|
+
updatedAt: string;
|
|
263
|
+
database: string;
|
|
264
|
+
location: string;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Select from a set of uploaded files or upload new
|
|
268
|
+
*/
|
|
269
|
+
declare const CMRSelectUpload: (props: CMRSelectUploadProps) => react_jsx_runtime.JSX.Element;
|
|
270
|
+
|
|
241
271
|
interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
|
|
242
272
|
dataSource: any[];
|
|
243
273
|
idAlias?: string;
|
|
@@ -248,4 +278,4 @@ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
|
|
|
248
278
|
|
|
249
279
|
declare const CmrTable: FC<CmrTableProps>;
|
|
250
280
|
|
|
251
|
-
export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrDeletionDialog, CmrEditConfirmation, CmrInput, CmrInputNumber, CmrLabel, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, LambdaFile };
|
|
281
|
+
export { CMRSelectUpload, CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrDeletionDialog, CmrEditConfirmation, CmrInput, CmrInputNumber, CmrLabel, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, 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,
|
|
@@ -1081,9 +1082,109 @@ var CmrInputNumber = (props) => {
|
|
|
1081
1082
|
};
|
|
1082
1083
|
var InputNumber_default = CmrInputNumber;
|
|
1083
1084
|
|
|
1085
|
+
// src/CmrComponents/select-upload/SelectUpload.tsx
|
|
1086
|
+
var import_react8 = __toESM(require("react"));
|
|
1087
|
+
var import_material12 = require("@mui/material");
|
|
1088
|
+
var import_Select = __toESM(require("@mui/material/Select"));
|
|
1089
|
+
var import_Dialog6 = __toESM(require("@mui/material/Dialog"));
|
|
1090
|
+
var import_DialogTitle6 = __toESM(require("@mui/material/DialogTitle"));
|
|
1091
|
+
var import_DialogContent6 = __toESM(require("@mui/material/DialogContent"));
|
|
1092
|
+
var import_DialogContentText5 = __toESM(require("@mui/material/DialogContentText"));
|
|
1093
|
+
var import_Box3 = __toESM(require("@mui/material/Box"));
|
|
1094
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1095
|
+
var CMRSelectUpload = (props) => {
|
|
1096
|
+
let [open, setOpen] = import_react8.default.useState(false);
|
|
1097
|
+
let [fileIndex, selectFileIndex] = import_react8.default.useState(-1);
|
|
1098
|
+
let [uploading, setUploading] = import_react8.default.useState(false);
|
|
1099
|
+
const [progress, setProgress] = import_react8.default.useState(0);
|
|
1100
|
+
const handleClickOpen = () => {
|
|
1101
|
+
selectFileIndex(-1);
|
|
1102
|
+
setOpen(true);
|
|
1103
|
+
};
|
|
1104
|
+
const handleClose = () => {
|
|
1105
|
+
setOpen(false);
|
|
1106
|
+
};
|
|
1107
|
+
const handleChange = (event) => {
|
|
1108
|
+
selectFileIndex(event.target.value);
|
|
1109
|
+
};
|
|
1110
|
+
const onSet = () => {
|
|
1111
|
+
props.onSelected(props.fileSelection[fileIndex]);
|
|
1112
|
+
setOpen(false);
|
|
1113
|
+
};
|
|
1114
|
+
const selectionDialog = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_Dialog6.default, { open, onClose: handleClose, children: [
|
|
1115
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogTitle6.default, { children: "Select or Upload" }),
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_DialogContent6.default, { sx: { width: 520 }, children: [
|
|
1117
|
+
/* @__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." : "" }),
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogContent6.default, { sx: { p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1119
|
+
import_Select.default,
|
|
1120
|
+
{
|
|
1121
|
+
value: fileIndex,
|
|
1122
|
+
onChange: handleChange,
|
|
1123
|
+
disabled: uploading,
|
|
1124
|
+
inputProps: { "aria-label": "Without label" },
|
|
1125
|
+
sx: { width: "100%" },
|
|
1126
|
+
children: [
|
|
1127
|
+
/* @__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" }) }),
|
|
1128
|
+
(props.fileSelection != void 0 ? props.fileSelection : []).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.MenuItem, { value: index, children: option.fileName }, index))
|
|
1129
|
+
]
|
|
1130
|
+
}
|
|
1131
|
+
) }),
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_Box3.default, { sx: { pt: 2, justifyContent: "center", display: "flex", padding: "8px" }, children: [
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.Button, { fullWidth: true, variant: "outlined", sx: { marginRight: "8px" }, onClick: handleClose, children: " Cancel" }),
|
|
1134
|
+
fileIndex !== -1 && !uploading && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.Button, { fullWidth: true, sx: { marginLeft: "8px" }, variant: "contained", onClick: onSet, children: "OK" }),
|
|
1135
|
+
fileIndex == -1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1136
|
+
Upload_default,
|
|
1137
|
+
{
|
|
1138
|
+
...props,
|
|
1139
|
+
color: "info",
|
|
1140
|
+
fullWidth: true,
|
|
1141
|
+
onUploaded: (res, file) => {
|
|
1142
|
+
console.log("calling Setup level on uploaded");
|
|
1143
|
+
console.log(props.onUploaded);
|
|
1144
|
+
selectFileIndex(props.fileSelection.length);
|
|
1145
|
+
props.onUploaded(res, file);
|
|
1146
|
+
setOpen(false);
|
|
1147
|
+
},
|
|
1148
|
+
fileExtension: props.fileExtension,
|
|
1149
|
+
uploadHandler: props.uploadHandler,
|
|
1150
|
+
uploadStarted: () => {
|
|
1151
|
+
setUploading(true);
|
|
1152
|
+
props.onSelected(void 0);
|
|
1153
|
+
},
|
|
1154
|
+
uploadProgressed: (progress2) => {
|
|
1155
|
+
setOpen(false);
|
|
1156
|
+
setProgress(progress2);
|
|
1157
|
+
},
|
|
1158
|
+
uploadEnded: () => setUploading(false)
|
|
1159
|
+
}
|
|
1160
|
+
)
|
|
1161
|
+
] })
|
|
1162
|
+
] })
|
|
1163
|
+
] });
|
|
1164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react8.Fragment, { children: [
|
|
1165
|
+
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: [
|
|
1166
|
+
"Uploading ",
|
|
1167
|
+
progress,
|
|
1168
|
+
"%"
|
|
1169
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1170
|
+
import_material12.Button,
|
|
1171
|
+
{
|
|
1172
|
+
variant: props.chosenFile == void 0 ? "contained" : "outlined",
|
|
1173
|
+
color: "info",
|
|
1174
|
+
onClick: handleClickOpen,
|
|
1175
|
+
sx: { marginRight: "10pt" },
|
|
1176
|
+
style: { ...props.style, textTransform: "none" },
|
|
1177
|
+
children: props.chosenFile == void 0 ? props.buttonText ? props.buttonText : "Choose" : props.chosenFile
|
|
1178
|
+
}
|
|
1179
|
+
),
|
|
1180
|
+
selectionDialog
|
|
1181
|
+
] });
|
|
1182
|
+
};
|
|
1183
|
+
var SelectUpload_default = CMRSelectUpload;
|
|
1184
|
+
|
|
1084
1185
|
// src/CmrTable/CmrTable.tsx
|
|
1085
1186
|
var import_x_data_grid = require("@mui/x-data-grid");
|
|
1086
|
-
var
|
|
1187
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1087
1188
|
var CmrTable = (props) => {
|
|
1088
1189
|
const {
|
|
1089
1190
|
dataSource,
|
|
@@ -1095,7 +1196,7 @@ var CmrTable = (props) => {
|
|
|
1095
1196
|
showCheckbox = true,
|
|
1096
1197
|
...rest
|
|
1097
1198
|
} = props;
|
|
1098
|
-
return /* @__PURE__ */ (0,
|
|
1199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1099
1200
|
import_x_data_grid.DataGrid,
|
|
1100
1201
|
{
|
|
1101
1202
|
rows: dataSource ? dataSource.map((row) => ({
|
|
@@ -1121,6 +1222,7 @@ var CmrTable_default = CmrTable;
|
|
|
1121
1222
|
var CmrTable2 = CmrTable_default;
|
|
1122
1223
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1123
1224
|
0 && (module.exports = {
|
|
1225
|
+
CMRSelectUpload,
|
|
1124
1226
|
CMRUpload,
|
|
1125
1227
|
CmrButton,
|
|
1126
1228
|
CmrCheckbox,
|
package/dist/index.mjs
CHANGED
|
@@ -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,
|