cloudmr-ux 1.1.7 → 1.1.9

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 CHANGED
@@ -146,6 +146,8 @@
146
146
 
147
147
  /* src/CmrComponents/input-number/InputNumber.css */
148
148
 
149
+ /* src/CmrComponents/tooltip/Tooltip.css */
150
+
149
151
  /* src/CmrTable/CmrTable.css */
150
152
  .css-1lymaxv-MuiDataGrid-root .MuiDataGrid-columnHeader:focus-within,
151
153
  .css-1lymaxv-MuiDataGrid-root .MuiDataGrid-cell:focus-within {
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { SizeType } from 'antd/lib/config-provider/SizeContext';
5
5
  import { CollapsibleType } from 'antd/es/collapse/CollapsePanel';
6
6
  import { ExpandIconPosition } from 'antd/es/collapse/Collapse';
7
7
  import { AxiosRequestConfig, AxiosResponse } from 'axios';
8
+ import { TooltipPlacement } from 'antd/lib/tooltip';
8
9
  import { DataGridProps } from '@mui/x-data-grid';
9
10
 
10
11
  declare const CmrButton: (props: ButtonProps) => react_jsx_runtime.JSX.Element;
@@ -238,6 +239,51 @@ interface CmrInputNumberProps {
238
239
  }
239
240
  declare const CmrInputNumber: (props: CmrInputNumberProps) => react_jsx_runtime.JSX.Element;
240
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
+
241
287
  interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
242
288
  dataSource: any[];
243
289
  idAlias?: string;
@@ -248,4 +294,4 @@ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
248
294
 
249
295
  declare const CmrTable: FC<CmrTableProps>;
250
296
 
251
- 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,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
+ CmrTooltip: () => Tooltip_default
49
51
  });
50
52
  module.exports = __toCommonJS(src_exports);
51
53
 
@@ -1081,9 +1083,143 @@ var CmrInputNumber = (props) => {
1081
1083
  };
1082
1084
  var InputNumber_default = CmrInputNumber;
1083
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", 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
+
1084
1220
  // src/CmrTable/CmrTable.tsx
1085
1221
  var import_x_data_grid = require("@mui/x-data-grid");
1086
- var import_jsx_runtime18 = require("react/jsx-runtime");
1222
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1087
1223
  var CmrTable = (props) => {
1088
1224
  const {
1089
1225
  dataSource,
@@ -1095,7 +1231,7 @@ var CmrTable = (props) => {
1095
1231
  showCheckbox = true,
1096
1232
  ...rest
1097
1233
  } = props;
1098
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1234
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1099
1235
  import_x_data_grid.DataGrid,
1100
1236
  {
1101
1237
  rows: dataSource ? dataSource.map((row) => ({
@@ -1121,6 +1257,7 @@ var CmrTable_default = CmrTable;
1121
1257
  var CmrTable2 = CmrTable_default;
1122
1258
  // Annotate the CommonJS export names for ESM import in node:
1123
1259
  0 && (module.exports = {
1260
+ CMRSelectUpload,
1124
1261
  CMRUpload,
1125
1262
  CmrButton,
1126
1263
  CmrCheckbox,
@@ -1136,5 +1273,6 @@ var CmrTable2 = CmrTable_default;
1136
1273
  CmrRadioGroup,
1137
1274
  CmrSelect,
1138
1275
  CmrTable,
1139
- CmrTabs
1276
+ CmrTabs,
1277
+ CmrTooltip
1140
1278
  });
package/dist/index.mjs CHANGED
@@ -1036,9 +1036,143 @@ var CmrInputNumber = (props) => {
1036
1036
  };
1037
1037
  var InputNumber_default = CmrInputNumber;
1038
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", 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
+
1039
1173
  // src/CmrTable/CmrTable.tsx
1040
1174
  import { DataGrid } from "@mui/x-data-grid";
1041
- import { jsx as jsx18 } from "react/jsx-runtime";
1175
+ import { jsx as jsx20 } from "react/jsx-runtime";
1042
1176
  var CmrTable = (props) => {
1043
1177
  const {
1044
1178
  dataSource,
@@ -1050,7 +1184,7 @@ var CmrTable = (props) => {
1050
1184
  showCheckbox = true,
1051
1185
  ...rest
1052
1186
  } = props;
1053
- return /* @__PURE__ */ jsx18("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx18(
1187
+ return /* @__PURE__ */ jsx20("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx20(
1054
1188
  DataGrid,
1055
1189
  {
1056
1190
  rows: dataSource ? dataSource.map((row) => ({
@@ -1075,6 +1209,7 @@ var CmrTable_default = CmrTable;
1075
1209
  // src/index.ts
1076
1210
  var CmrTable2 = CmrTable_default;
1077
1211
  export {
1212
+ SelectUpload_default as CMRSelectUpload,
1078
1213
  Upload_default as CMRUpload,
1079
1214
  CmrButton_default as CmrButton,
1080
1215
  Checkbox_default as CmrCheckbox,
@@ -1090,5 +1225,6 @@ export {
1090
1225
  CmrRadioGroup_default as CmrRadioGroup,
1091
1226
  CmrSelect_default as CmrSelect,
1092
1227
  CmrTable2 as CmrTable,
1093
- CmrTabs
1228
+ CmrTabs,
1229
+ Tooltip_default as CmrTooltip
1094
1230
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",