componentes-sinco 1.0.6 → 1.0.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/Icon Scheduler-WX62PISD.svg +17 -0
- package/dist/index.cjs +1303 -223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -11
- package/dist/index.d.ts +55 -11
- package/dist/index.js +1287 -209
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,10 +31,12 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// src/Components/Drawer/SCDrawer.tsx
|
|
34
|
-
import
|
|
34
|
+
import React8, { useEffect as useEffect8, useRef as useRef2 } from "react";
|
|
35
35
|
import { Box as Box7, Drawer, Typography as Typography7, IconButton as IconButton5, Button as Button4, Stack as Stack3, Chip as Chip2 } from "@mui/material";
|
|
36
36
|
import Grid4 from "@mui/material/Grid2";
|
|
37
37
|
import CloseIcon from "@mui/icons-material/Close";
|
|
38
|
+
import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos";
|
|
39
|
+
import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
|
|
38
40
|
|
|
39
41
|
// src/Components/Textfield/SCTextField.tsx
|
|
40
42
|
import React, { useEffect, useState } from "react";
|
|
@@ -668,11 +670,9 @@ function SCSelect({
|
|
|
668
670
|
width = "100%",
|
|
669
671
|
size = "small",
|
|
670
672
|
variant = "outlined",
|
|
671
|
-
|
|
673
|
+
background = "white",
|
|
672
674
|
required,
|
|
673
675
|
disabled,
|
|
674
|
-
background,
|
|
675
|
-
fnAplicar,
|
|
676
676
|
setState,
|
|
677
677
|
state
|
|
678
678
|
}) {
|
|
@@ -747,14 +747,20 @@ function SCSelect({
|
|
|
747
747
|
MenuProps: {
|
|
748
748
|
PaperProps: {
|
|
749
749
|
sx: {
|
|
750
|
-
|
|
750
|
+
maxHeight: "300px",
|
|
751
|
+
minWidth: "100%"
|
|
751
752
|
}
|
|
752
753
|
},
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
754
|
+
anchorOrigin: {
|
|
755
|
+
vertical: "bottom",
|
|
756
|
+
horizontal: "left"
|
|
757
|
+
},
|
|
758
|
+
transformOrigin: {
|
|
759
|
+
vertical: "top",
|
|
760
|
+
horizontal: "left"
|
|
761
|
+
},
|
|
762
|
+
disableAutoFocusItem: true,
|
|
763
|
+
marginThreshold: 0
|
|
758
764
|
}
|
|
759
765
|
},
|
|
760
766
|
data.map((option, index) => {
|
|
@@ -786,7 +792,6 @@ function SCAutocomplete({
|
|
|
786
792
|
state,
|
|
787
793
|
inputChange,
|
|
788
794
|
maxCheck
|
|
789
|
-
// Agregar el parámetro maxCheck
|
|
790
795
|
}) {
|
|
791
796
|
const labelContent = `<span style="color: red;">* </span>` + label;
|
|
792
797
|
let group = "";
|
|
@@ -880,6 +885,7 @@ function SCAutocomplete({
|
|
|
880
885
|
{
|
|
881
886
|
multiple: typeFormat === "multiselect",
|
|
882
887
|
clearOnEscape: true,
|
|
888
|
+
noOptionsText: "No se encuentra",
|
|
883
889
|
disabled,
|
|
884
890
|
options: data,
|
|
885
891
|
isOptionEqualToValue: (option, value) => getItemValue(option).value === getItemValue(value).value,
|
|
@@ -1123,29 +1129,81 @@ var getIcon2 = (iconName) => {
|
|
|
1123
1129
|
};
|
|
1124
1130
|
|
|
1125
1131
|
// src/Components/Drawer/Helpers/validateInput.tsx
|
|
1126
|
-
var validateInputs = (arrayElements, onError, onSuccess) => {
|
|
1127
|
-
var _a;
|
|
1132
|
+
var validateInputs = (arrayElements, onError, onSuccess, setChipFilters, setTextFilters) => {
|
|
1133
|
+
var _a, _b;
|
|
1128
1134
|
let requiredValues = 0;
|
|
1129
1135
|
let filledValues = 0;
|
|
1130
1136
|
for (let i = 0; i < arrayElements.length; i++) {
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1137
|
+
const element = arrayElements[i];
|
|
1138
|
+
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1139
|
+
const textValue = ((_a = typeElement.state) == null ? void 0 : _a.textValue) !== void 0 ? String((_b = typeElement.state) == null ? void 0 : _b.textValue) : String(typeElement.state);
|
|
1140
|
+
if (typeElement == null ? void 0 : typeElement.required) {
|
|
1141
|
+
requiredValues++;
|
|
1142
|
+
if (textValue.trim() !== "" && textValue.trim() !== ",") {
|
|
1136
1143
|
filledValues++;
|
|
1137
1144
|
}
|
|
1138
1145
|
}
|
|
1139
1146
|
}
|
|
1140
1147
|
if (requiredValues === filledValues) {
|
|
1141
1148
|
onSuccess();
|
|
1149
|
+
setChipFilters(true);
|
|
1142
1150
|
} else {
|
|
1143
1151
|
onError({
|
|
1144
1152
|
type: "error",
|
|
1145
1153
|
title: "Algunos campos son requeridos",
|
|
1146
1154
|
time: 10
|
|
1147
1155
|
});
|
|
1156
|
+
setChipFilters(false);
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
// src/Components/Drawer/Helpers/validateTypeElement.tsx
|
|
1161
|
+
import React7 from "react";
|
|
1162
|
+
var validateTypeElements = (element) => {
|
|
1163
|
+
var _a;
|
|
1164
|
+
let validation = "";
|
|
1165
|
+
let typeElement = element;
|
|
1166
|
+
if (element.type == "textField") {
|
|
1167
|
+
validation = "textField";
|
|
1168
|
+
typeElement = element;
|
|
1169
|
+
} else if (React7.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name == "SCtextField") {
|
|
1170
|
+
validation = "textField";
|
|
1171
|
+
typeElement = element == null ? void 0 : element.component.props;
|
|
1172
|
+
} else if (element.type == "textArea") {
|
|
1173
|
+
validation = "textArea";
|
|
1174
|
+
typeElement = element;
|
|
1175
|
+
} else if (React7.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name == "SCtextArea") {
|
|
1176
|
+
validation = "textArea";
|
|
1177
|
+
typeElement = element == null ? void 0 : element.component.props;
|
|
1178
|
+
} else if (element.type == "dateRange") {
|
|
1179
|
+
validation = "dateRange";
|
|
1180
|
+
typeElement = element;
|
|
1181
|
+
} else if (React7.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name == "SCDateRange") {
|
|
1182
|
+
validation = "dateRange";
|
|
1183
|
+
typeElement = element == null ? void 0 : element.component.props;
|
|
1184
|
+
} else if (element.type == "autocomplete") {
|
|
1185
|
+
validation = "autocomplete";
|
|
1186
|
+
typeElement = element;
|
|
1187
|
+
} else if (React7.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name == "SCAutocomplete") {
|
|
1188
|
+
validation = "autocomplete";
|
|
1189
|
+
typeElement = element == null ? void 0 : element.component.props;
|
|
1190
|
+
} else if (element.typeFormat == "multiselect") {
|
|
1191
|
+
validation = "multiselect";
|
|
1192
|
+
typeElement = element;
|
|
1193
|
+
} else if (React7.isValidElement(element == null ? void 0 : element.component) && element.component.props && ((_a = element == null ? void 0 : element.component) == null ? void 0 : _a.props).typeFormat == "multiselect") {
|
|
1194
|
+
validation = "multiselect";
|
|
1195
|
+
typeElement = element == null ? void 0 : element.component.props;
|
|
1196
|
+
} else if (element.type == "select") {
|
|
1197
|
+
validation = "select";
|
|
1198
|
+
typeElement = element;
|
|
1199
|
+
} else if (React7.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name == "SCSelect") {
|
|
1200
|
+
validation = "select";
|
|
1201
|
+
typeElement = element == null ? void 0 : element.component.props;
|
|
1148
1202
|
}
|
|
1203
|
+
return {
|
|
1204
|
+
validation,
|
|
1205
|
+
element: typeElement
|
|
1206
|
+
};
|
|
1149
1207
|
};
|
|
1150
1208
|
|
|
1151
1209
|
// src/Components/Drawer/SCDrawer.tsx
|
|
@@ -1160,16 +1218,42 @@ function SCDrawer({
|
|
|
1160
1218
|
anchor = "left",
|
|
1161
1219
|
width,
|
|
1162
1220
|
//Funcionales
|
|
1163
|
-
open
|
|
1221
|
+
open,
|
|
1222
|
+
setOpen,
|
|
1223
|
+
chipFilters
|
|
1164
1224
|
}) {
|
|
1165
1225
|
var _a, _b;
|
|
1166
|
-
const
|
|
1167
|
-
const [
|
|
1226
|
+
const scrollRef = useRef2(null);
|
|
1227
|
+
const [drawerOpen, setDrawerOpen] = React8.useState(open);
|
|
1228
|
+
const [toast, setToast] = React8.useState(null);
|
|
1229
|
+
const [stateChipFilters, setChipFilters] = React8.useState(false);
|
|
1230
|
+
const [textFilters, setTextFilters] = React8.useState([]);
|
|
1231
|
+
useEffect8(() => {
|
|
1232
|
+
if (chipFilters != void 0) {
|
|
1233
|
+
if (chipFilters.length > 0) {
|
|
1234
|
+
setTextFilters([]);
|
|
1235
|
+
inputValidation();
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}, [chipFilters]);
|
|
1239
|
+
useEffect8(() => {
|
|
1240
|
+
if (open) {
|
|
1241
|
+
toggleDrawer(true);
|
|
1242
|
+
} else {
|
|
1243
|
+
handleDrawerClose();
|
|
1244
|
+
}
|
|
1245
|
+
}, [open]);
|
|
1168
1246
|
const handleDrawerClose = () => {
|
|
1169
1247
|
setDrawerOpen(false);
|
|
1248
|
+
if (setOpen) {
|
|
1249
|
+
setOpen(false);
|
|
1250
|
+
}
|
|
1170
1251
|
};
|
|
1171
1252
|
const toggleDrawer = (newOpen) => () => {
|
|
1172
1253
|
setDrawerOpen(newOpen);
|
|
1254
|
+
if (setOpen) {
|
|
1255
|
+
setOpen(true);
|
|
1256
|
+
}
|
|
1173
1257
|
};
|
|
1174
1258
|
const ButtonIcon = getIcon2(buttonDrawer == null ? void 0 : buttonDrawer.icon);
|
|
1175
1259
|
const setToastWithDelay = (toastContent) => {
|
|
@@ -1178,39 +1262,179 @@ function SCDrawer({
|
|
|
1178
1262
|
setToast(toastContent);
|
|
1179
1263
|
}, 10);
|
|
1180
1264
|
};
|
|
1181
|
-
const inputValidation = () =>
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
element
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
if (element.type == "autocomplete" || React7.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name === "SCAutocomplete" || (element.typeFormat == "multiselect" || React7.isValidElement(element == null ? void 0 : element.component) && element.component.props && ((_f = element == null ? void 0 : element.component) == null ? void 0 : _f.props).typeFormat == "multiselect")) {
|
|
1194
|
-
element.setState != void 0 ? element.setState({ hiddenValue: [], textValue: [] }) : null;
|
|
1195
|
-
React7.isValidElement(element == null ? void 0 : element.component) && typeof ((_g = element.component.props) == null ? void 0 : _g.setState) === "function" && element.component.props.setState({ hiddenValue: [], textValue: [] });
|
|
1265
|
+
const inputValidation = () => {
|
|
1266
|
+
var _a2, _b2, _c, _d;
|
|
1267
|
+
if (chipFilters != void 0 && chipFilters.length > 0) {
|
|
1268
|
+
if (chipFilters && chipFilters.length > 0) {
|
|
1269
|
+
arrayElements.forEach((arrayElement) => {
|
|
1270
|
+
var _a3, _b3, _c2;
|
|
1271
|
+
const { validation, element: typeElement } = validateTypeElements(arrayElement);
|
|
1272
|
+
let currentValue = "";
|
|
1273
|
+
if (validation === "dateRange") {
|
|
1274
|
+
if (typeElement.state && typeElement.state[0] && typeElement.state[1]) {
|
|
1275
|
+
currentValue = `${(_a3 = typeElement.state[0]) == null ? void 0 : _a3.format("DD/MM/YYYY")} - ${(_b3 = typeElement.state[1]) == null ? void 0 : _b3.format("DD/MM/YYYY")}`;
|
|
1276
|
+
}
|
|
1196
1277
|
} else {
|
|
1197
|
-
|
|
1198
|
-
|
|
1278
|
+
currentValue = ((_c2 = typeElement.state) == null ? void 0 : _c2.textValue) !== void 0 ? String(typeElement.state.textValue).trim() : String(typeElement.state).trim();
|
|
1279
|
+
}
|
|
1280
|
+
chipFilters.forEach((chipFilter) => {
|
|
1281
|
+
const chipValue = String(chipFilter).trim();
|
|
1282
|
+
if (currentValue === chipValue && currentValue !== "" && currentValue !== ",") {
|
|
1283
|
+
setTextFilters((prevFilters) => {
|
|
1284
|
+
const newFilter = { value: currentValue, arrayElement: typeElement };
|
|
1285
|
+
const existingFilterIndex = prevFilters.findIndex(
|
|
1286
|
+
(filter) => filter.arrayElement.label === arrayElement.label
|
|
1287
|
+
);
|
|
1288
|
+
if (existingFilterIndex !== -1) {
|
|
1289
|
+
const updatedFilters = [...prevFilters];
|
|
1290
|
+
updatedFilters[existingFilterIndex] = newFilter;
|
|
1291
|
+
return updatedFilters;
|
|
1292
|
+
} else {
|
|
1293
|
+
return [...prevFilters, newFilter];
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
} else {
|
|
1301
|
+
const newFiltersToAdd = [];
|
|
1302
|
+
for (let i = 0; i < arrayElements.length; i++) {
|
|
1303
|
+
const element = arrayElements[i];
|
|
1304
|
+
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1305
|
+
const textValue = ((_a2 = typeElement.state) == null ? void 0 : _a2.textValue) !== void 0 ? String((_b2 = typeElement.state) == null ? void 0 : _b2.textValue) : String(typeElement.state);
|
|
1306
|
+
if (textValue.trim() !== "" && textValue.trim() !== ",") {
|
|
1307
|
+
let newFilter;
|
|
1308
|
+
switch (validation) {
|
|
1309
|
+
case "dateRange":
|
|
1310
|
+
const values = `${(_c = typeElement.state[0]) == null ? void 0 : _c.format("DD/MM/YYYY")} - ${(_d = typeElement.state[1]) == null ? void 0 : _d.format("DD/MM/YYYY")}`;
|
|
1311
|
+
newFilter = { value: values, arrayElement: typeElement };
|
|
1312
|
+
break;
|
|
1313
|
+
default:
|
|
1314
|
+
newFilter = { value: textValue, arrayElement: typeElement };
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1317
|
+
const existingFilterByLabel = newFiltersToAdd.find(
|
|
1318
|
+
(filter) => filter.arrayElement.label === element.label
|
|
1319
|
+
);
|
|
1320
|
+
if (existingFilterByLabel) {
|
|
1321
|
+
existingFilterByLabel.value = newFilter.value;
|
|
1322
|
+
existingFilterByLabel.arrayElement = newFilter.arrayElement;
|
|
1323
|
+
} else {
|
|
1324
|
+
newFiltersToAdd.push(newFilter);
|
|
1199
1325
|
}
|
|
1200
1326
|
}
|
|
1201
1327
|
}
|
|
1328
|
+
setTextFilters((prevFilters) => {
|
|
1329
|
+
let updatedFilters = [...prevFilters];
|
|
1330
|
+
newFiltersToAdd.forEach((newFilter) => {
|
|
1331
|
+
const existingFilterIndex = updatedFilters.findIndex(
|
|
1332
|
+
(filter) => filter.arrayElement.label === newFilter.arrayElement.label
|
|
1333
|
+
);
|
|
1334
|
+
if (existingFilterIndex !== -1) {
|
|
1335
|
+
updatedFilters[existingFilterIndex] = newFilter;
|
|
1336
|
+
} else {
|
|
1337
|
+
updatedFilters.push(newFilter);
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1340
|
+
return updatedFilters;
|
|
1341
|
+
});
|
|
1342
|
+
validateInputs(arrayElements, setToastWithDelay, handleDrawerClose, setChipFilters, setTextFilters);
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
const resetElementByType = (originalElement, validation, typeElement) => {
|
|
1346
|
+
let defaultValue;
|
|
1347
|
+
switch (validation) {
|
|
1348
|
+
case "textField":
|
|
1349
|
+
case "textArea":
|
|
1350
|
+
defaultValue = "";
|
|
1351
|
+
break;
|
|
1352
|
+
case "dateRange":
|
|
1353
|
+
defaultValue = [null, null];
|
|
1354
|
+
break;
|
|
1355
|
+
case "multiselect":
|
|
1356
|
+
defaultValue = { hiddenValue: [], textValue: [] };
|
|
1357
|
+
break;
|
|
1358
|
+
default:
|
|
1359
|
+
defaultValue = { hiddenValue: "-1", textValue: "" };
|
|
1360
|
+
}
|
|
1361
|
+
if (typeElement.setState) {
|
|
1362
|
+
typeElement.setState(defaultValue);
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
const cleanFilters = () => {
|
|
1366
|
+
arrayElements.forEach((element) => {
|
|
1367
|
+
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1368
|
+
if (typeElement.setState) {
|
|
1369
|
+
resetElementByType(element, validation, typeElement);
|
|
1370
|
+
}
|
|
1202
1371
|
});
|
|
1372
|
+
setTextFilters([]);
|
|
1373
|
+
};
|
|
1374
|
+
const deleteFilter = (element) => {
|
|
1375
|
+
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1376
|
+
if (typeElement.setState && shouldShowChips == true) {
|
|
1377
|
+
resetElementByType(element, validation, typeElement);
|
|
1378
|
+
setTextFilters(
|
|
1379
|
+
(prevFilters) => prevFilters.filter((filter) => filter.arrayElement.label !== element.label)
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1203
1382
|
};
|
|
1204
|
-
const
|
|
1205
|
-
|
|
1383
|
+
const scroll = (offset) => {
|
|
1384
|
+
if (scrollRef.current) {
|
|
1385
|
+
scrollRef.current.scrollLeft += offset;
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
const hasActiveFilters = () => {
|
|
1389
|
+
return arrayElements.some((arrayElement) => {
|
|
1390
|
+
const { validation, element: typeElement } = validateTypeElements(arrayElement);
|
|
1391
|
+
if (typeElement.state.textValue !== void 0) {
|
|
1392
|
+
return String(typeElement.state.textValue).trim() !== "";
|
|
1393
|
+
} else if (validation === "dateRange") {
|
|
1394
|
+
return typeElement.state && typeElement.state[0] !== null && typeElement.state[1] !== null;
|
|
1395
|
+
} else {
|
|
1396
|
+
return String(typeElement.state).trim() !== "" && String(typeElement.state).trim() !== ",";
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
};
|
|
1400
|
+
const shouldShowChips = chipFilters != void 0 && chipFilters.length > 0 ? true : stateChipFilters === true && hasActiveFilters();
|
|
1401
|
+
const actionsA = actions == false ? false : actions != void 0 ? actions : [{ text: "Aplicar filtros", fn: inputValidation }, { text: "Limpiar filtros", fn: cleanFilters }];
|
|
1402
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, toast && /* @__PURE__ */ React8.createElement(SCToastNotification, __spreadValues({}, toast)), /* @__PURE__ */ React8.createElement(Grid4, { container: true, justifyContent: "flex-start", flexWrap: "nowrap", alignItems: "center", sx: { width: "100%" } }, shouldShowChips && /* @__PURE__ */ React8.createElement(Box7, { display: "flex", alignItems: "center", sx: { maxWidth: "78%" } }, /* @__PURE__ */ React8.createElement(IconButton5, { onClick: () => scroll(-150), size: "small" }, /* @__PURE__ */ React8.createElement(ArrowBackIosIcon, { fontSize: "small" })), /* @__PURE__ */ React8.createElement(
|
|
1403
|
+
Box7,
|
|
1404
|
+
{
|
|
1405
|
+
ref: scrollRef,
|
|
1406
|
+
gap: 0.3,
|
|
1407
|
+
sx: {
|
|
1408
|
+
display: "flex",
|
|
1409
|
+
overflowX: "auto",
|
|
1410
|
+
scrollBehavior: "smooth",
|
|
1411
|
+
"&::-webkit-scrollbar": { display: "none" }
|
|
1412
|
+
}
|
|
1413
|
+
},
|
|
1414
|
+
textFilters == null ? void 0 : textFilters.map((chipData, index) => /* @__PURE__ */ React8.createElement(
|
|
1415
|
+
Chip2,
|
|
1416
|
+
__spreadProps(__spreadValues({
|
|
1417
|
+
key: index,
|
|
1418
|
+
label: chipData.value
|
|
1419
|
+
}, chipData.arrayElement.required == false || chipData.arrayElement.required == void 0 ? { onDelete: () => deleteFilter(chipData.arrayElement) } : {}), {
|
|
1420
|
+
color: "default",
|
|
1421
|
+
variant: "filled",
|
|
1422
|
+
size: "small",
|
|
1423
|
+
sx: {
|
|
1424
|
+
flexShrink: 0,
|
|
1425
|
+
minWidth: "auto"
|
|
1426
|
+
}
|
|
1427
|
+
})
|
|
1428
|
+
))
|
|
1429
|
+
), /* @__PURE__ */ React8.createElement(IconButton5, { onClick: () => scroll(150), size: "small" }, /* @__PURE__ */ React8.createElement(ArrowForwardIosIcon, { fontSize: "small" }))), (buttonDrawer == null ? void 0 : buttonDrawer.type) == "chip" ? /* @__PURE__ */ React8.createElement(
|
|
1206
1430
|
Chip2,
|
|
1207
1431
|
__spreadProps(__spreadValues({
|
|
1208
1432
|
onClick: toggleDrawer(true),
|
|
1209
1433
|
color: buttonDrawer == null ? void 0 : buttonDrawer.color,
|
|
1210
1434
|
variant: (buttonDrawer == null ? void 0 : buttonDrawer.variant) == "contained" ? "filled" : "outlined",
|
|
1211
1435
|
label: (_a = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _a : "",
|
|
1212
|
-
icon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" && ButtonIcon ? /* @__PURE__ */
|
|
1213
|
-
deleteIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */
|
|
1436
|
+
icon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" && ButtonIcon ? /* @__PURE__ */ React8.createElement(ButtonIcon, { fontSize: "small" }) : void 0,
|
|
1437
|
+
deleteIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */ React8.createElement(ButtonIcon, { fontSize: "small" }) : void 0
|
|
1214
1438
|
}, (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? { onDelete: () => {
|
|
1215
1439
|
} } : {}), {
|
|
1216
1440
|
sx: {
|
|
@@ -1220,7 +1444,7 @@ function SCDrawer({
|
|
|
1220
1444
|
textTransform: "capitalize"
|
|
1221
1445
|
}
|
|
1222
1446
|
})
|
|
1223
|
-
) : /* @__PURE__ */
|
|
1447
|
+
) : /* @__PURE__ */ React8.createElement(
|
|
1224
1448
|
Button4,
|
|
1225
1449
|
{
|
|
1226
1450
|
"data-testid": "test-buttonDrawer",
|
|
@@ -1229,11 +1453,11 @@ function SCDrawer({
|
|
|
1229
1453
|
onClick: toggleDrawer(true),
|
|
1230
1454
|
size: "small",
|
|
1231
1455
|
variant: (buttonDrawer == null ? void 0 : buttonDrawer.variant) != void 0 ? buttonDrawer == null ? void 0 : buttonDrawer.variant : "text",
|
|
1232
|
-
startIcon: ((buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" || !(buttonDrawer == null ? void 0 : buttonDrawer.iconPosition)) && ButtonIcon ? /* @__PURE__ */
|
|
1233
|
-
endIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */
|
|
1456
|
+
startIcon: ((buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" || !(buttonDrawer == null ? void 0 : buttonDrawer.iconPosition)) && ButtonIcon ? /* @__PURE__ */ React8.createElement(ButtonIcon, { fontSize: "small" }) : null,
|
|
1457
|
+
endIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */ React8.createElement(ButtonIcon, { fontSize: "small" }) : null
|
|
1234
1458
|
},
|
|
1235
1459
|
(_b = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _b : ""
|
|
1236
|
-
), /* @__PURE__ */
|
|
1460
|
+
)), /* @__PURE__ */ React8.createElement(
|
|
1237
1461
|
Drawer,
|
|
1238
1462
|
{
|
|
1239
1463
|
open: drawerOpen,
|
|
@@ -1247,15 +1471,15 @@ function SCDrawer({
|
|
|
1247
1471
|
}
|
|
1248
1472
|
}
|
|
1249
1473
|
},
|
|
1250
|
-
/* @__PURE__ */
|
|
1474
|
+
/* @__PURE__ */ React8.createElement(Stack3, { flexDirection: "column", height: "100%" }, /* @__PURE__ */ React8.createElement(Grid4, { container: true, sx: { backgroundColor: "primary.50", alignItems: "center", height: "42px", textAlign: "left", padding: "8px 12px", justifyContent: "space-between", alignContent: "center" } }, /* @__PURE__ */ React8.createElement(Typography7, { variant: "h6", color: colorTitle || "text.primary" }, title != null ? title : "Personaliza tu b\xFAsqueda"), /* @__PURE__ */ React8.createElement(IconButton5, { onClick: handleDrawerClose }, /* @__PURE__ */ React8.createElement(CloseIcon, { "data-testid": "test-button-close", sx: { color: "text.primary" } }))), /* @__PURE__ */ React8.createElement(Stack3, { alignItems: "flex-start", height: "100%", gap: "16px", flex: 1, overflow: "auto", padding: "16px" }, arrayElements == null ? void 0 : arrayElements.map((arrayElement, index) => {
|
|
1251
1475
|
var _a2, _b2, _c, _d, _e, _f;
|
|
1252
|
-
return /* @__PURE__ */
|
|
1476
|
+
return /* @__PURE__ */ React8.createElement(
|
|
1253
1477
|
Box7,
|
|
1254
1478
|
{
|
|
1255
1479
|
key: `Stack_${(_a2 = arrayElement.type) != null ? _a2 : ""} ${(_b2 = arrayElement.label) != null ? _b2 : ""}${index}`,
|
|
1256
1480
|
sx: { width: "100%" }
|
|
1257
1481
|
},
|
|
1258
|
-
arrayElement.component ? /* @__PURE__ */
|
|
1482
|
+
arrayElement.component ? /* @__PURE__ */ React8.createElement(Stack3, { direction: "row", alignItems: "left", gap: 1 }, arrayElement.component) : arrayElement.type === "textField" ? /* @__PURE__ */ React8.createElement(
|
|
1259
1483
|
SCTextField,
|
|
1260
1484
|
{
|
|
1261
1485
|
title: arrayElement.title,
|
|
@@ -1281,7 +1505,7 @@ function SCDrawer({
|
|
|
1281
1505
|
onBlur: arrayElement.onBlur,
|
|
1282
1506
|
onKeyDown: arrayElement.onKeyDown
|
|
1283
1507
|
}
|
|
1284
|
-
) : arrayElement.type === "textArea" ? /* @__PURE__ */
|
|
1508
|
+
) : arrayElement.type === "textArea" ? /* @__PURE__ */ React8.createElement(
|
|
1285
1509
|
SCTextArea,
|
|
1286
1510
|
{
|
|
1287
1511
|
title: arrayElement.title,
|
|
@@ -1300,7 +1524,7 @@ function SCDrawer({
|
|
|
1300
1524
|
state: arrayElement.state || "",
|
|
1301
1525
|
onBlur: arrayElement.onBlur
|
|
1302
1526
|
}
|
|
1303
|
-
) : arrayElement.type === "autocomplete" ? /* @__PURE__ */
|
|
1527
|
+
) : arrayElement.type === "autocomplete" ? /* @__PURE__ */ React8.createElement(
|
|
1304
1528
|
SCAutocomplete,
|
|
1305
1529
|
{
|
|
1306
1530
|
label: arrayElement.label,
|
|
@@ -1318,7 +1542,7 @@ function SCDrawer({
|
|
|
1318
1542
|
state: arrayElement.state || "",
|
|
1319
1543
|
inputChange: arrayElement.inputChange
|
|
1320
1544
|
}
|
|
1321
|
-
) : arrayElement.type === "select" ? /* @__PURE__ */
|
|
1545
|
+
) : arrayElement.type === "select" ? /* @__PURE__ */ React8.createElement(
|
|
1322
1546
|
SCSelect,
|
|
1323
1547
|
{
|
|
1324
1548
|
label: arrayElement.label,
|
|
@@ -1327,7 +1551,6 @@ function SCDrawer({
|
|
|
1327
1551
|
width: arrayElement.width,
|
|
1328
1552
|
size: arrayElement.size,
|
|
1329
1553
|
variant: arrayElement.variant,
|
|
1330
|
-
deleteType: arrayElement.deleteType,
|
|
1331
1554
|
required: arrayElement.required,
|
|
1332
1555
|
disabled: arrayElement.disabled,
|
|
1333
1556
|
background: arrayElement.background,
|
|
@@ -1335,7 +1558,7 @@ function SCDrawer({
|
|
|
1335
1558
|
setState: arrayElement.setState,
|
|
1336
1559
|
state: arrayElement.state || ""
|
|
1337
1560
|
}
|
|
1338
|
-
) : arrayElement.type === "dateRange" ? /* @__PURE__ */
|
|
1561
|
+
) : arrayElement.type === "dateRange" ? /* @__PURE__ */ React8.createElement(
|
|
1339
1562
|
SCDateRange,
|
|
1340
1563
|
{
|
|
1341
1564
|
labelDateInitial: arrayElement.labelDateInitial,
|
|
@@ -1348,7 +1571,7 @@ function SCDrawer({
|
|
|
1348
1571
|
}
|
|
1349
1572
|
) : null
|
|
1350
1573
|
);
|
|
1351
|
-
})), actionsA != void 0 && actionsA != false ? Array.isArray(actionsA) && (actionsA == null ? void 0 : actionsA.length) > 0 ? /* @__PURE__ */
|
|
1574
|
+
})), actionsA != void 0 && actionsA != false ? Array.isArray(actionsA) && (actionsA == null ? void 0 : actionsA.length) > 0 ? /* @__PURE__ */ React8.createElement(
|
|
1352
1575
|
Grid4,
|
|
1353
1576
|
{
|
|
1354
1577
|
sx: { borderTop: 1, borderColor: "#1018403B" },
|
|
@@ -1360,7 +1583,7 @@ function SCDrawer({
|
|
|
1360
1583
|
justifyContent: actionsA.length > 1 ? "space-between" : !anchor && anchor != "right" ? "flex-end" : "flex-start",
|
|
1361
1584
|
flexDirection: anchor != "right" ? "row-reverse" : "row"
|
|
1362
1585
|
},
|
|
1363
|
-
actionsA.map((btn, index) => /* @__PURE__ */
|
|
1586
|
+
actionsA.map((btn, index) => /* @__PURE__ */ React8.createElement(
|
|
1364
1587
|
Button4,
|
|
1365
1588
|
{
|
|
1366
1589
|
key: index,
|
|
@@ -1377,7 +1600,7 @@ function SCDrawer({
|
|
|
1377
1600
|
}
|
|
1378
1601
|
|
|
1379
1602
|
// src/Components/FooterAction/FooterAction.tsx
|
|
1380
|
-
import
|
|
1603
|
+
import React9 from "react";
|
|
1381
1604
|
import { AppBar, Toolbar, Box as Box8, Typography as Typography8 } from "@mui/material";
|
|
1382
1605
|
var FooterAction = ({
|
|
1383
1606
|
leftContent,
|
|
@@ -1385,44 +1608,44 @@ var FooterAction = ({
|
|
|
1385
1608
|
label,
|
|
1386
1609
|
variant
|
|
1387
1610
|
}) => {
|
|
1388
|
-
return /* @__PURE__ */
|
|
1611
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1389
1612
|
AppBar,
|
|
1390
1613
|
{
|
|
1391
1614
|
color: "inherit",
|
|
1392
1615
|
sx: { position: variant == "float" ? "relative" : "fixed", left: 0, right: "auto", width: "100%", top: "auto", bottom: 0 }
|
|
1393
1616
|
},
|
|
1394
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ React9.createElement(
|
|
1395
1618
|
Toolbar,
|
|
1396
1619
|
{
|
|
1397
1620
|
id: "footer-toolbar",
|
|
1398
1621
|
sx: { gap: 1.5, minHeight: "50px !important" }
|
|
1399
1622
|
},
|
|
1400
1623
|
leftContent,
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
label && /* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ React9.createElement(Box8, { flexGrow: 1 }),
|
|
1625
|
+
label && /* @__PURE__ */ React9.createElement(Typography8, { variant: "body2", color: "text.secondary" }, label),
|
|
1403
1626
|
rightContent
|
|
1404
1627
|
)
|
|
1405
1628
|
);
|
|
1406
1629
|
};
|
|
1407
1630
|
|
|
1408
1631
|
// src/Components/Modal/Helpers/Data.tsx
|
|
1409
|
-
import
|
|
1632
|
+
import React10 from "react";
|
|
1410
1633
|
import { Info, Warning } from "@mui/icons-material";
|
|
1411
1634
|
var modalStateConfig = {
|
|
1412
1635
|
info: {
|
|
1413
1636
|
color: "info",
|
|
1414
1637
|
defaultDescription: "Se [sincronizar\xE1n] los datos trabajados en modo offline y se [subir\xE1n] a los servidores.",
|
|
1415
|
-
icon: /* @__PURE__ */
|
|
1638
|
+
icon: /* @__PURE__ */ React10.createElement(Info, { color: "info", fontSize: "medium" })
|
|
1416
1639
|
},
|
|
1417
1640
|
delete: {
|
|
1418
1641
|
color: "delete",
|
|
1419
1642
|
defaultDescription: "[Elemento espec\xEDfico] [dejar\xE1 de existir en todos los lugares donde est\xE9 en uso]. Esta acci\xF3n es irreversible.",
|
|
1420
|
-
icon: /* @__PURE__ */
|
|
1643
|
+
icon: /* @__PURE__ */ React10.createElement(Info, { color: "error", fontSize: "medium" })
|
|
1421
1644
|
},
|
|
1422
1645
|
warning: {
|
|
1423
1646
|
color: "warning",
|
|
1424
1647
|
defaultDescription: "Se descartar\xE1 la [creaci\xF3n] y los cambios se perder\xE1n.",
|
|
1425
|
-
icon: /* @__PURE__ */
|
|
1648
|
+
icon: /* @__PURE__ */ React10.createElement(Warning, { color: "warning", fontSize: "medium" })
|
|
1426
1649
|
}
|
|
1427
1650
|
};
|
|
1428
1651
|
|
|
@@ -1452,7 +1675,7 @@ var getButtonColor = (state) => {
|
|
|
1452
1675
|
};
|
|
1453
1676
|
|
|
1454
1677
|
// src/Components/Modal/SCModal.tsx
|
|
1455
|
-
import
|
|
1678
|
+
import React11, { useCallback as useCallback3, useMemo as useMemo3, useState as useState5 } from "react";
|
|
1456
1679
|
import { Modal, Box as Box9, Typography as Typography9, IconButton as IconButton6, Button as Button5, Stack as Stack4 } from "@mui/material";
|
|
1457
1680
|
import { Close as Close2 } from "@mui/icons-material";
|
|
1458
1681
|
|
|
@@ -1472,33 +1695,30 @@ var SCModal = ({
|
|
|
1472
1695
|
}) => {
|
|
1473
1696
|
var _a, _b, _c, _d, _e;
|
|
1474
1697
|
const [openModal, setOpenModal] = useState5(open != null ? open : false);
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
const
|
|
1481
|
-
const handleClose = useCallback(() => setOpenModal(false), []);
|
|
1482
|
-
const toggleModal = (newOpen) => () => setOpenModal(newOpen);
|
|
1483
|
-
const prevAction = useMemo(
|
|
1698
|
+
const handleOpen = React11.useCallback(() => {
|
|
1699
|
+
setOpenModal((prev) => !prev);
|
|
1700
|
+
}, []);
|
|
1701
|
+
const Icon = useMemo3(() => getIconComponent2(buttonModal == null ? void 0 : buttonModal.icon), [buttonModal == null ? void 0 : buttonModal.icon]);
|
|
1702
|
+
const handleClose = useCallback3(() => setOpenModal(false), []);
|
|
1703
|
+
const prevAction = useMemo3(
|
|
1484
1704
|
() => action != null ? action : [{ text: "Cancelar", fn: handleClose }, { text: "Consultar", fn: () => {
|
|
1485
1705
|
} }],
|
|
1486
1706
|
[action, handleClose]
|
|
1487
1707
|
);
|
|
1488
1708
|
const { icon, defaultDescription } = modalStateConfig[state];
|
|
1489
|
-
return /* @__PURE__ */
|
|
1709
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1490
1710
|
Button5,
|
|
1491
1711
|
{
|
|
1492
1712
|
"data-testid": "test-buttonModal",
|
|
1493
1713
|
color: (_a = buttonModal == null ? void 0 : buttonModal.color) != null ? _a : "primary",
|
|
1494
|
-
onClick:
|
|
1714
|
+
onClick: handleOpen,
|
|
1495
1715
|
variant: (_b = buttonModal == null ? void 0 : buttonModal.variant) != null ? _b : "text",
|
|
1496
1716
|
size: (_c = buttonModal == null ? void 0 : buttonModal.size) != null ? _c : "small",
|
|
1497
|
-
startIcon: (buttonModal == null ? void 0 : buttonModal.iconPosition) === "left" && /* @__PURE__ */
|
|
1498
|
-
endIcon: (buttonModal == null ? void 0 : buttonModal.iconPosition) === "right" && /* @__PURE__ */
|
|
1717
|
+
startIcon: (buttonModal == null ? void 0 : buttonModal.iconPosition) === "left" && /* @__PURE__ */ React11.createElement(Icon, null),
|
|
1718
|
+
endIcon: (buttonModal == null ? void 0 : buttonModal.iconPosition) === "right" && /* @__PURE__ */ React11.createElement(Icon, null)
|
|
1499
1719
|
},
|
|
1500
1720
|
capitalize((_d = buttonModal == null ? void 0 : buttonModal.text) != null ? _d : "filtrar")
|
|
1501
|
-
), /* @__PURE__ */
|
|
1721
|
+
), /* @__PURE__ */ React11.createElement(Modal, { open: openModal, onClose: handleOpen, sx: { boxShadow: 8 } }, /* @__PURE__ */ React11.createElement(
|
|
1502
1722
|
Box9,
|
|
1503
1723
|
{
|
|
1504
1724
|
sx: {
|
|
@@ -1512,9 +1732,9 @@ var SCModal = ({
|
|
|
1512
1732
|
boxShadow: 24
|
|
1513
1733
|
}
|
|
1514
1734
|
},
|
|
1515
|
-
/* @__PURE__ */
|
|
1516
|
-
/* @__PURE__ */
|
|
1517
|
-
action && /* @__PURE__ */
|
|
1735
|
+
/* @__PURE__ */ React11.createElement(Stack4, { direction: "row", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React11.createElement(Stack4, { direction: "row", alignItems: "center", p: 1, gap: 1.5 }, /* @__PURE__ */ React11.createElement(Box9, { display: "flex", justifyContent: "center", alignItems: "center", borderRadius: "50%", height: 36, width: 36, bgcolor: getModalColor(state) }, icon), /* @__PURE__ */ React11.createElement(Typography9, { variant: "h6", color: "text.primary" }, title)), /* @__PURE__ */ React11.createElement(IconButton6, { onClick: handleOpen, "data-testid": "test-buttonClose" }, /* @__PURE__ */ React11.createElement(Close2, { color: "action" }))),
|
|
1736
|
+
/* @__PURE__ */ React11.createElement(Stack4, { py: 1, px: 3, gap: 1.5 }, /* @__PURE__ */ React11.createElement(Typography9, { variant: "body1" }, description || defaultDescription)),
|
|
1737
|
+
action && /* @__PURE__ */ React11.createElement(
|
|
1518
1738
|
Stack4,
|
|
1519
1739
|
{
|
|
1520
1740
|
id: "Action",
|
|
@@ -1525,7 +1745,7 @@ var SCModal = ({
|
|
|
1525
1745
|
bgcolor: "grey.50",
|
|
1526
1746
|
sx: { borderRadius: 1 }
|
|
1527
1747
|
},
|
|
1528
|
-
/* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ React11.createElement(
|
|
1529
1749
|
Button5,
|
|
1530
1750
|
{
|
|
1531
1751
|
color: "inherit",
|
|
@@ -1535,7 +1755,7 @@ var SCModal = ({
|
|
|
1535
1755
|
},
|
|
1536
1756
|
capitalize("cancelar")
|
|
1537
1757
|
),
|
|
1538
|
-
/* @__PURE__ */
|
|
1758
|
+
/* @__PURE__ */ React11.createElement(
|
|
1539
1759
|
Button5,
|
|
1540
1760
|
{
|
|
1541
1761
|
"data-testid": "test-aceptar",
|
|
@@ -1552,32 +1772,32 @@ var SCModal = ({
|
|
|
1552
1772
|
};
|
|
1553
1773
|
|
|
1554
1774
|
// src/Components/MultiSelect/MultiSelect.tsx
|
|
1555
|
-
import
|
|
1775
|
+
import React12, { useEffect as useEffect10, useMemo as useMemo5 } from "react";
|
|
1556
1776
|
import { Button as Button6, Checkbox as Checkbox2, FormControl as FormControl3, InputAdornment as InputAdornment5, ListItemIcon as ListItemIcon3, MenuItem as MenuItem3, Popover as Popover3, Stack as Stack5, TextField as TextField4 } from "@mui/material";
|
|
1557
1777
|
import { SearchOutlined } from "@mui/icons-material";
|
|
1558
1778
|
|
|
1559
1779
|
// src/Components/MultiSelect/helpers/useHandlers.tsx
|
|
1560
|
-
import { useCallback as
|
|
1780
|
+
import { useCallback as useCallback4, useState as useState6 } from "react";
|
|
1561
1781
|
function useMultiSelectHandlers() {
|
|
1562
1782
|
const [anchorEl, setAnchorEl] = useState6(null);
|
|
1563
1783
|
const [open, setOpen] = useState6(false);
|
|
1564
1784
|
const [selectedItems, setSelectedItems] = useState6([]);
|
|
1565
1785
|
const [filterValue, setFilterValue] = useState6("");
|
|
1566
|
-
const handleOpen =
|
|
1786
|
+
const handleOpen = useCallback4((e) => {
|
|
1567
1787
|
setAnchorEl(e.currentTarget);
|
|
1568
1788
|
setOpen(true);
|
|
1569
1789
|
}, []);
|
|
1570
|
-
const handleClose =
|
|
1790
|
+
const handleClose = useCallback4(() => {
|
|
1571
1791
|
setAnchorEl(null);
|
|
1572
1792
|
setOpen(false);
|
|
1573
1793
|
}, []);
|
|
1574
|
-
const handleFilterChange =
|
|
1794
|
+
const handleFilterChange = useCallback4(
|
|
1575
1795
|
(e) => {
|
|
1576
1796
|
setFilterValue(e.target.value);
|
|
1577
1797
|
},
|
|
1578
1798
|
[]
|
|
1579
1799
|
);
|
|
1580
|
-
const handleCheckboxToggle =
|
|
1800
|
+
const handleCheckboxToggle = useCallback4((item) => {
|
|
1581
1801
|
setSelectedItems(
|
|
1582
1802
|
(prev) => prev.includes(item) ? prev.filter((i) => i !== item) : [...prev, item]
|
|
1583
1803
|
);
|
|
@@ -1604,15 +1824,15 @@ function getIconMultiSelect(name) {
|
|
|
1604
1824
|
}
|
|
1605
1825
|
|
|
1606
1826
|
// src/Components/MultiSelect/helpers/useFilteredItems.tsx
|
|
1607
|
-
import { useMemo as
|
|
1827
|
+
import { useMemo as useMemo4 } from "react";
|
|
1608
1828
|
function useFilteredItems(items, filterValue, getItemLabel, selectedItems) {
|
|
1609
|
-
const filteredItems =
|
|
1829
|
+
const filteredItems = useMemo4(
|
|
1610
1830
|
() => items.filter(
|
|
1611
1831
|
(item) => getItemLabel(item).toLowerCase().includes(filterValue.toLowerCase())
|
|
1612
1832
|
),
|
|
1613
1833
|
[items, filterValue, getItemLabel]
|
|
1614
1834
|
);
|
|
1615
|
-
const sortedItems =
|
|
1835
|
+
const sortedItems = useMemo4(() => {
|
|
1616
1836
|
return [
|
|
1617
1837
|
...filteredItems.filter((item) => selectedItems.includes(item)),
|
|
1618
1838
|
...filteredItems.filter((item) => !selectedItems.includes(item))
|
|
@@ -1646,16 +1866,16 @@ function MultiSelect({
|
|
|
1646
1866
|
handleCheckboxToggle,
|
|
1647
1867
|
setOpen
|
|
1648
1868
|
} = useMultiSelectHandlers();
|
|
1649
|
-
|
|
1869
|
+
useEffect10(() => {
|
|
1650
1870
|
if (open !== void 0) {
|
|
1651
1871
|
setOpen(open);
|
|
1652
1872
|
}
|
|
1653
1873
|
}, [open, setOpen]);
|
|
1654
|
-
|
|
1874
|
+
useEffect10(() => {
|
|
1655
1875
|
setSelectedItems([]);
|
|
1656
1876
|
}, [items, setSelectedItems]);
|
|
1657
1877
|
const { filteredItems, sortedItems } = useFilteredItems(items, filterValue, getItemLabel, selectedItems);
|
|
1658
|
-
const Icon =
|
|
1878
|
+
const Icon = useMemo5(() => {
|
|
1659
1879
|
var _a2;
|
|
1660
1880
|
return getIconMultiSelect((_a2 = button == null ? void 0 : button.icon) != null ? _a2 : "FilterListOutlined");
|
|
1661
1881
|
}, [button == null ? void 0 : button.icon]);
|
|
@@ -1669,7 +1889,7 @@ function MultiSelect({
|
|
|
1669
1889
|
{ text: "Aplicar", fn: () => {
|
|
1670
1890
|
} }
|
|
1671
1891
|
];
|
|
1672
|
-
return /* @__PURE__ */
|
|
1892
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
|
|
1673
1893
|
Button6,
|
|
1674
1894
|
{
|
|
1675
1895
|
"test-id": "multiselect-button",
|
|
@@ -1677,11 +1897,11 @@ function MultiSelect({
|
|
|
1677
1897
|
onClick: handleOpen,
|
|
1678
1898
|
variant: (_b = button == null ? void 0 : button.variant) != null ? _b : "text",
|
|
1679
1899
|
size: "small",
|
|
1680
|
-
startIcon: (button == null ? void 0 : button.iconPosition) === "left" || !(button == null ? void 0 : button.iconPosition) ? /* @__PURE__ */
|
|
1681
|
-
endIcon: (button == null ? void 0 : button.iconPosition) === "right" ? /* @__PURE__ */
|
|
1900
|
+
startIcon: (button == null ? void 0 : button.iconPosition) === "left" || !(button == null ? void 0 : button.iconPosition) ? /* @__PURE__ */ React12.createElement(Icon, null) : null,
|
|
1901
|
+
endIcon: (button == null ? void 0 : button.iconPosition) === "right" ? /* @__PURE__ */ React12.createElement(Icon, null) : null
|
|
1682
1902
|
},
|
|
1683
1903
|
capitalize(textButton != null ? textButton : "MultiSelect")
|
|
1684
|
-
), /* @__PURE__ */
|
|
1904
|
+
), /* @__PURE__ */ React12.createElement(
|
|
1685
1905
|
Popover3,
|
|
1686
1906
|
{
|
|
1687
1907
|
elevation: 8,
|
|
@@ -1690,7 +1910,7 @@ function MultiSelect({
|
|
|
1690
1910
|
open: openMultiselect,
|
|
1691
1911
|
onClose: () => setOpen(false)
|
|
1692
1912
|
},
|
|
1693
|
-
/* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ React12.createElement(Stack5, { minWidth: "320px", "data-testid": "multiselect-container", bgcolor: "white", boxShadow: 3, borderRadius: 1 }, /* @__PURE__ */ React12.createElement(Stack5, { py: 1, px: 2 }, topPanel != null ? topPanel : /* @__PURE__ */ React12.createElement(FormControl3, { fullWidth: true, size: "small" }, /* @__PURE__ */ React12.createElement(
|
|
1694
1914
|
TextField4,
|
|
1695
1915
|
{
|
|
1696
1916
|
"data-testid": "multiselect-input",
|
|
@@ -1702,18 +1922,18 @@ function MultiSelect({
|
|
|
1702
1922
|
onChange: handleFilterChange,
|
|
1703
1923
|
slotProps: {
|
|
1704
1924
|
input: {
|
|
1705
|
-
endAdornment: /* @__PURE__ */
|
|
1925
|
+
endAdornment: /* @__PURE__ */ React12.createElement(InputAdornment5, { position: "end" }, /* @__PURE__ */ React12.createElement(SearchOutlined, { fontSize: "small" }))
|
|
1706
1926
|
}
|
|
1707
1927
|
}
|
|
1708
1928
|
}
|
|
1709
|
-
))), /* @__PURE__ */
|
|
1929
|
+
))), /* @__PURE__ */ React12.createElement(Stack5, { maxHeight: "300px", overflow: "auto" }, selectAll && /* @__PURE__ */ React12.createElement(MenuItem3, { dense, onClick: handleSelectAll }, /* @__PURE__ */ React12.createElement(ListItemIcon3, null, /* @__PURE__ */ React12.createElement(Checkbox2, { checked: allSelected, color: "primary" })), "Todos los items"), sortedItems.length > 0 ? sortedItems.map((item) => /* @__PURE__ */ React12.createElement(
|
|
1710
1930
|
MenuItem3,
|
|
1711
1931
|
{
|
|
1712
1932
|
key: getItemLabel(item),
|
|
1713
1933
|
dense,
|
|
1714
1934
|
onClick: () => handleCheckboxToggle(item)
|
|
1715
1935
|
},
|
|
1716
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ React12.createElement(ListItemIcon3, null, /* @__PURE__ */ React12.createElement(
|
|
1717
1937
|
Checkbox2,
|
|
1718
1938
|
{
|
|
1719
1939
|
checked: selectedItems.includes(item),
|
|
@@ -1721,9 +1941,9 @@ function MultiSelect({
|
|
|
1721
1941
|
}
|
|
1722
1942
|
)),
|
|
1723
1943
|
getItemLabel(item)
|
|
1724
|
-
)) : /* @__PURE__ */
|
|
1944
|
+
)) : /* @__PURE__ */ React12.createElement(MenuItem3, { disabled: true }, "No se encontraron resultados")), /* @__PURE__ */ React12.createElement(Stack5, { direction: "row", gap: 1, p: 1, justifyContent: "space-between", bgcolor: "grey.50" }, resolvedActions.map((button2, index) => {
|
|
1725
1945
|
var _a2;
|
|
1726
|
-
return /* @__PURE__ */
|
|
1946
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1727
1947
|
Button6,
|
|
1728
1948
|
{
|
|
1729
1949
|
key: index,
|
|
@@ -1739,7 +1959,7 @@ function MultiSelect({
|
|
|
1739
1959
|
}
|
|
1740
1960
|
|
|
1741
1961
|
// src/Components/PageHeader/PageHeader.tsx
|
|
1742
|
-
import
|
|
1962
|
+
import React13 from "react";
|
|
1743
1963
|
import { Stack as Stack6, Typography as Typography10 } from "@mui/material";
|
|
1744
1964
|
var PageHeader = ({
|
|
1745
1965
|
title,
|
|
@@ -1749,7 +1969,7 @@ var PageHeader = ({
|
|
|
1749
1969
|
fixed,
|
|
1750
1970
|
shadow = true
|
|
1751
1971
|
}) => {
|
|
1752
|
-
return /* @__PURE__ */
|
|
1972
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1753
1973
|
Stack6,
|
|
1754
1974
|
{
|
|
1755
1975
|
"data-testid": "main-container",
|
|
@@ -1761,12 +1981,12 @@ var PageHeader = ({
|
|
|
1761
1981
|
zIndex: 10,
|
|
1762
1982
|
sx: { boxShadow: shadow ? (theme) => theme.shadows[1] : "none" }
|
|
1763
1983
|
},
|
|
1764
|
-
/* @__PURE__ */
|
|
1984
|
+
/* @__PURE__ */ React13.createElement(Stack6, { "data-testid": "page-header-content", height: 40, px: 3, pl: buttonBack ? 1 : 3, direction: "row", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React13.createElement(Stack6, { id: "left-section", direction: "row", alignItems: "center", gap: 1 }, buttonBack, /* @__PURE__ */ React13.createElement(Stack6, { id: "text-section", gap: 0.5 }, /* @__PURE__ */ React13.createElement(Typography10, { "data-testid": "page-header-title", variant: "h6", color: "text.primary" }, title), subtitle && /* @__PURE__ */ React13.createElement(Typography10, { "data-testid": "page-header-subtitle", variant: "caption", color: "text.primary" }, subtitle))), actions && /* @__PURE__ */ React13.createElement(Stack6, { id: "right-actions", direction: "row", alignItems: "center", gap: 1 }, actions))
|
|
1765
1985
|
);
|
|
1766
1986
|
};
|
|
1767
1987
|
|
|
1768
1988
|
// src/Components/SCCalendarSwipeable.tsx
|
|
1769
|
-
import
|
|
1989
|
+
import React14, { useState as useState7 } from "react";
|
|
1770
1990
|
import { Typography as Typography11, IconButton as IconButton7, Box as Box10 } from "@mui/material";
|
|
1771
1991
|
import Grid5 from "@mui/material/Grid2";
|
|
1772
1992
|
import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
|
|
@@ -1787,12 +2007,12 @@ var SCCalendarSwipeable = ({
|
|
|
1787
2007
|
let convertFecha;
|
|
1788
2008
|
const [fecha, setFecha] = useState7(/* @__PURE__ */ new Date());
|
|
1789
2009
|
const [fechaSeleccionada, setFechaSeleccionada] = useState7();
|
|
1790
|
-
const [stateVal, setstateVal] =
|
|
1791
|
-
const [openCalendar, setOpenCalendar] =
|
|
2010
|
+
const [stateVal, setstateVal] = React14.useState(/* @__PURE__ */ new Date());
|
|
2011
|
+
const [openCalendar, setOpenCalendar] = React14.useState(false);
|
|
1792
2012
|
const hoy = /* @__PURE__ */ new Date();
|
|
1793
2013
|
const inicioSemana = startOfWeek(fecha, { weekStartsOn: 0 });
|
|
1794
2014
|
const diasSemana = Array.from({ length: 7 }, (_, i) => addDays(inicioSemana, i));
|
|
1795
|
-
|
|
2015
|
+
React14.useEffect(() => {
|
|
1796
2016
|
if (fecha != null) {
|
|
1797
2017
|
handleConvertFecha(fecha);
|
|
1798
2018
|
}
|
|
@@ -1811,11 +2031,11 @@ var SCCalendarSwipeable = ({
|
|
|
1811
2031
|
setOpenCalendar(newOpen);
|
|
1812
2032
|
};
|
|
1813
2033
|
const locale = __spreadValues({}, es);
|
|
1814
|
-
return /* @__PURE__ */
|
|
2034
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(LocalizationProvider2, { dateAdapter: AdapterDateFns, adapterLocale: locale }, openCalendar == false ? /* @__PURE__ */ React14.createElement(Box10, { "data-testid": "calendar-mobile", sx: { width: "100%", background: background ? background : "white", display: "flex", flexDirection: "column", alignItems: "center" } }, /* @__PURE__ */ React14.createElement(Box10, { sx: { width: "100%", maxWidth: "320px", background: "transparent" } }, /* @__PURE__ */ React14.createElement(Grid5, { container: true, gap: 0.5, sx: {
|
|
1815
2035
|
justifyContent: "space-between",
|
|
1816
2036
|
padding: "12px 0px",
|
|
1817
2037
|
background: "transparent"
|
|
1818
|
-
} }, diasSemana.map((dia) => /* @__PURE__ */
|
|
2038
|
+
} }, diasSemana.map((dia) => /* @__PURE__ */ React14.createElement(Grid5, { sx: { width: "36px" }, key: dia.toString() }, /* @__PURE__ */ React14.createElement(Box10, { sx: { width: "36px", height: "40px", display: "flex", alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ React14.createElement(Typography11, { sx: { fontSize: "12px !important", color: "#10184099" } }, format(dia, "EEEE", { locale: es }).charAt(0).toUpperCase())), /* @__PURE__ */ React14.createElement(
|
|
1819
2039
|
Box10,
|
|
1820
2040
|
{
|
|
1821
2041
|
onClick: () => setFecha(dia),
|
|
@@ -1831,8 +2051,8 @@ var SCCalendarSwipeable = ({
|
|
|
1831
2051
|
//height: '36px',
|
|
1832
2052
|
}
|
|
1833
2053
|
},
|
|
1834
|
-
/* @__PURE__ */
|
|
1835
|
-
)))), /* @__PURE__ */
|
|
2054
|
+
/* @__PURE__ */ React14.createElement(Typography11, { sx: { fontSize: "12px !important", color: isSameDay(dia, fecha) ? "white" : "#101840DE" } }, format(dia, "d"))
|
|
2055
|
+
)))), /* @__PURE__ */ React14.createElement(Grid5, { container: true, justifyContent: "center" }, /* @__PURE__ */ React14.createElement(IconButton7, { "data-testid": "open-calendar-button", onClick: toggleCalendar(true) }, /* @__PURE__ */ React14.createElement(KeyboardDoubleArrowDownIcon, null))))) : /* @__PURE__ */ React14.createElement(Box10, { sx: { width: "100%", background: "white" } }, /* @__PURE__ */ React14.createElement(
|
|
1836
2056
|
StaticDatePicker,
|
|
1837
2057
|
{
|
|
1838
2058
|
orientation: "landscape",
|
|
@@ -1842,17 +2062,17 @@ var SCCalendarSwipeable = ({
|
|
|
1842
2062
|
sx: { fontSize: "12px !important", height: "300px !important", background: background ? background : "white", "& .MuiDayCalendar-header": { justifyContent: "space-between" }, "& .MuiDayCalendar-weekContainer": { justifyContent: "space-between" }, "& .MuiPickersCalendarHeader-root": { paddingLeft: "0px", paddingRight: "0px", color: "#10184099" }, "& .MuiPickersDay-root": { fontSize: "12px !important" }, "& .MuiDayCalendar-weekDayLabel": { fontSize: "12px !important" } },
|
|
1843
2063
|
onChange: (newValue) => setFecha(newValue)
|
|
1844
2064
|
}
|
|
1845
|
-
), /* @__PURE__ */
|
|
2065
|
+
), /* @__PURE__ */ React14.createElement(Grid5, { container: true, justifyContent: "center" }, /* @__PURE__ */ React14.createElement(IconButton7, { "data-testid": "close-calendar-button", onClick: toggleCalendar(false) }, /* @__PURE__ */ React14.createElement(KeyboardDoubleArrowUpIcon, null))))));
|
|
1846
2066
|
};
|
|
1847
2067
|
|
|
1848
2068
|
// src/Components/SCDataGrid.tsx
|
|
1849
|
-
import
|
|
2069
|
+
import React15, { useEffect as useEffect12, useState as useState8 } from "react";
|
|
1850
2070
|
import { DataGridPro, useGridApiRef } from "@mui/x-data-grid-pro";
|
|
1851
2071
|
import { LicenseInfo as LicenseInfo2 } from "@mui/x-license-pro";
|
|
1852
2072
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
1853
2073
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
1854
2074
|
import { useTheme } from "@mui/material/styles";
|
|
1855
|
-
|
|
2075
|
+
function SCDataGridInitial({ data, columns, groupColumns, rowsTable, checkboxSelection, width, maxHeight, density }) {
|
|
1856
2076
|
LicenseInfo2.setLicenseKey(
|
|
1857
2077
|
"77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
|
|
1858
2078
|
);
|
|
@@ -1863,45 +2083,80 @@ var SCDataGridInitial = ({ data, columns, groupColumns, rowsTable, checkboxSelec
|
|
|
1863
2083
|
return Math.floor(Math.random() * 1e6);
|
|
1864
2084
|
}
|
|
1865
2085
|
const getTreeDataPaths = (row) => {
|
|
2086
|
+
var _a, _b, _c;
|
|
2087
|
+
const group1Value = groupColumns && ((_a = groupColumns(row)) == null ? void 0 : _a.valueGroup1);
|
|
2088
|
+
const group2Value = groupColumns && ((_b = groupColumns(row)) == null ? void 0 : _b.valueGroup2);
|
|
2089
|
+
const fieldValue = groupColumns && ((_c = groupColumns(row)) == null ? void 0 : _c.fieldFirstColumn);
|
|
1866
2090
|
return [
|
|
1867
|
-
|
|
1868
|
-
...
|
|
1869
|
-
`${
|
|
2091
|
+
String(group1Value || ""),
|
|
2092
|
+
...group2Value ? [String(group2Value)] : [],
|
|
2093
|
+
`${String(fieldValue || "")}/${generateRandomId()}`
|
|
1870
2094
|
];
|
|
1871
2095
|
};
|
|
1872
2096
|
const groupingColDefs = {
|
|
1873
2097
|
field: "grouping",
|
|
1874
|
-
headerName: groupColumns
|
|
2098
|
+
headerName: groupColumns ? groupColumns(data[0]).headerNameFirstColumn : "Agrupador",
|
|
1875
2099
|
renderCell: (params) => {
|
|
1876
|
-
var _a;
|
|
2100
|
+
var _a, _b;
|
|
1877
2101
|
let label = params.value.toString().includes("/") ? params.value.split("/")[0].toString() : params.value.toString();
|
|
1878
|
-
|
|
1879
|
-
if (groupColumns
|
|
2102
|
+
let maxDepth = 0;
|
|
2103
|
+
if (groupColumns && data.length > 0) {
|
|
2104
|
+
const sampleItem = groupColumns(data[0]);
|
|
2105
|
+
if (sampleItem.valueGroup1) maxDepth++;
|
|
2106
|
+
if (sampleItem.valueGroup2) maxDepth++;
|
|
2107
|
+
maxDepth = Math.max(0, maxDepth - 1);
|
|
2108
|
+
}
|
|
2109
|
+
if (groupColumns) {
|
|
1880
2110
|
if (params.rowNode.depth === 0) {
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
2111
|
+
let customLabel = label;
|
|
2112
|
+
if (groupColumns) {
|
|
2113
|
+
const originalItem = data.find(
|
|
2114
|
+
(item) => {
|
|
2115
|
+
var _a2;
|
|
2116
|
+
return String((_a2 = groupColumns(item)) == null ? void 0 : _a2.valueGroup1) === label;
|
|
2117
|
+
}
|
|
2118
|
+
);
|
|
2119
|
+
if (originalItem) {
|
|
2120
|
+
const itemValue = groupColumns(originalItem);
|
|
2121
|
+
customLabel = itemValue.textGroup1 || label;
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
const subgroup1 = arrayRows.filter((r) => {
|
|
2125
|
+
var _a2;
|
|
2126
|
+
return groupColumns && String((_a2 = groupColumns(r)) == null ? void 0 : _a2.valueGroup1) === label;
|
|
2127
|
+
}).map((r) => {
|
|
2128
|
+
var _a2;
|
|
2129
|
+
return groupColumns && String((_a2 = groupColumns(r)) == null ? void 0 : _a2.valueGroup2);
|
|
2130
|
+
});
|
|
1887
2131
|
const groupedDataLength1 = subgroup1.filter((valor, indiceActual, arreglo) => arreglo.indexOf(valor) === indiceActual);
|
|
1888
|
-
label = `${
|
|
1889
|
-
} else if (groupColumns
|
|
1890
|
-
const labelGrouping1 = (
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
2132
|
+
label = `${customLabel} (${groupedDataLength1.length})`;
|
|
2133
|
+
} else if (((_a = groupColumns(data[0])) == null ? void 0 : _a.valueGroup2) && params.rowNode.depth === 1) {
|
|
2134
|
+
const labelGrouping1 = (_b = params.api.getRowNode(params.rowNode.parent)) == null ? void 0 : _b.groupingKey.toString();
|
|
2135
|
+
let customLabel = label;
|
|
2136
|
+
if (groupColumns) {
|
|
2137
|
+
const originalItem = data.find(
|
|
2138
|
+
(item) => {
|
|
2139
|
+
var _a2;
|
|
2140
|
+
return String((_a2 = groupColumns(item)) == null ? void 0 : _a2.valueGroup2) === label;
|
|
2141
|
+
}
|
|
2142
|
+
);
|
|
2143
|
+
if (originalItem) {
|
|
2144
|
+
const itemValue = groupColumns(originalItem);
|
|
2145
|
+
customLabel = itemValue.textGroup2 || label;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
1896
2148
|
const groupedDataLength2 = arrayRows.filter(
|
|
1897
|
-
(r) =>
|
|
2149
|
+
(r) => {
|
|
2150
|
+
var _a2, _b2;
|
|
2151
|
+
return groupColumns && String((_a2 = groupColumns(r)) == null ? void 0 : _a2.valueGroup1) === labelGrouping1 && groupColumns && String((_b2 = groupColumns(r)) == null ? void 0 : _b2.valueGroup2) === label;
|
|
2152
|
+
}
|
|
1898
2153
|
).length;
|
|
1899
|
-
label = `${
|
|
2154
|
+
label = `${customLabel} (${groupedDataLength2})`;
|
|
1900
2155
|
} else {
|
|
1901
2156
|
label = label;
|
|
1902
2157
|
}
|
|
1903
2158
|
}
|
|
1904
|
-
return /* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1905
2160
|
"div",
|
|
1906
2161
|
{
|
|
1907
2162
|
style: {
|
|
@@ -1918,7 +2173,7 @@ var SCDataGridInitial = ({ data, columns, groupColumns, rowsTable, checkboxSelec
|
|
|
1918
2173
|
fontWeight: params.rowNode.type == "group" ? "400" : "300"
|
|
1919
2174
|
}
|
|
1920
2175
|
},
|
|
1921
|
-
params.rowNode.type === "group" && /* @__PURE__ */
|
|
2176
|
+
params.rowNode.type === "group" && /* @__PURE__ */ React15.createElement(
|
|
1922
2177
|
"span",
|
|
1923
2178
|
{
|
|
1924
2179
|
style: {
|
|
@@ -1931,25 +2186,32 @@ var SCDataGridInitial = ({ data, columns, groupColumns, rowsTable, checkboxSelec
|
|
|
1931
2186
|
params.api.setRowChildrenExpansion(params.id, !params.rowNode.childrenExpanded);
|
|
1932
2187
|
}
|
|
1933
2188
|
},
|
|
1934
|
-
params.rowNode.childrenExpanded ? /* @__PURE__ */
|
|
2189
|
+
params.rowNode.childrenExpanded ? /* @__PURE__ */ React15.createElement(KeyboardArrowUpIcon, { fontSize: "small", color: "action" }) : /* @__PURE__ */ React15.createElement(KeyboardArrowDownIcon, { fontSize: "small", color: "action" })
|
|
1935
2190
|
),
|
|
1936
2191
|
label
|
|
1937
2192
|
);
|
|
1938
2193
|
},
|
|
1939
2194
|
colSpan: (params) => {
|
|
2195
|
+
var _a, _b;
|
|
1940
2196
|
const value = String(params);
|
|
1941
|
-
const fieldGrouping1 = groupColumns[0]
|
|
1942
|
-
const fieldGrouping2 = groupColumns
|
|
2197
|
+
const fieldGrouping1 = groupColumns ? (_a = groupColumns(data[0])) == null ? void 0 : _a.valueGroup1 : void 0;
|
|
2198
|
+
const fieldGrouping2 = groupColumns ? (_b = groupColumns(data[0])) == null ? void 0 : _b.valueGroup2 : void 0;
|
|
1943
2199
|
let agrupado1 = false;
|
|
1944
2200
|
let agrupado2 = false;
|
|
1945
2201
|
if (fieldGrouping1 != void 0) {
|
|
1946
2202
|
agrupado1 = arrayRows.some(
|
|
1947
|
-
(row) =>
|
|
2203
|
+
(row) => {
|
|
2204
|
+
var _a2;
|
|
2205
|
+
return groupColumns && String((_a2 = groupColumns(row)) == null ? void 0 : _a2.valueGroup1) === value;
|
|
2206
|
+
}
|
|
1948
2207
|
);
|
|
1949
2208
|
}
|
|
1950
2209
|
if (fieldGrouping2 != void 0) {
|
|
1951
2210
|
agrupado2 = arrayRows.some(
|
|
1952
|
-
(row) =>
|
|
2211
|
+
(row) => {
|
|
2212
|
+
var _a2;
|
|
2213
|
+
return groupColumns && String((_a2 = groupColumns(row)) == null ? void 0 : _a2.valueGroup2) === value;
|
|
2214
|
+
}
|
|
1953
2215
|
);
|
|
1954
2216
|
}
|
|
1955
2217
|
if (agrupado1 || agrupado2) {
|
|
@@ -1970,7 +2232,7 @@ var SCDataGridInitial = ({ data, columns, groupColumns, rowsTable, checkboxSelec
|
|
|
1970
2232
|
const [pageSize, setPageSize] = useState8(rows);
|
|
1971
2233
|
const [arrayRows, setArrayRows] = useState8([]);
|
|
1972
2234
|
const [selectionModel, setSelectionModel] = useState8([]);
|
|
1973
|
-
|
|
2235
|
+
useEffect12(() => {
|
|
1974
2236
|
if ((data == null ? void 0 : data.length) > 0) {
|
|
1975
2237
|
dataConvertRows(data, void 0);
|
|
1976
2238
|
}
|
|
@@ -2026,7 +2288,7 @@ var SCDataGridInitial = ({ data, columns, groupColumns, rowsTable, checkboxSelec
|
|
|
2026
2288
|
setSelectionModel([...newSelection]);
|
|
2027
2289
|
}
|
|
2028
2290
|
};
|
|
2029
|
-
return /* @__PURE__ */
|
|
2291
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, data && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement("div", { style: { width: width || "100%", maxHeight: maxHeight ? `${maxHeight}px` : "none" } }, /* @__PURE__ */ React15.createElement(
|
|
2030
2292
|
DataGridPro,
|
|
2031
2293
|
{
|
|
2032
2294
|
apiRef,
|
|
@@ -2060,7 +2322,6 @@ var SCDataGridInitial = ({ data, columns, groupColumns, rowsTable, checkboxSelec
|
|
|
2060
2322
|
},
|
|
2061
2323
|
sx: {
|
|
2062
2324
|
maxHeight: maxHeight ? `${maxHeight}px` : "none",
|
|
2063
|
-
//overflow: 'auto',
|
|
2064
2325
|
"& .MuiDataGrid-filler": {
|
|
2065
2326
|
display: "none !important"
|
|
2066
2327
|
},
|
|
@@ -2090,14 +2351,14 @@ var SCDataGridInitial = ({ data, columns, groupColumns, rowsTable, checkboxSelec
|
|
|
2090
2351
|
}
|
|
2091
2352
|
}
|
|
2092
2353
|
))));
|
|
2093
|
-
}
|
|
2094
|
-
var SCDataGrid =
|
|
2095
|
-
const isEqual = prevProps.
|
|
2354
|
+
}
|
|
2355
|
+
var SCDataGrid = React15.memo(SCDataGridInitial, (prevProps, nextProps) => {
|
|
2356
|
+
const isEqual = prevProps.rowsTable === nextProps.rowsTable && prevProps.checkboxSelection === nextProps.checkboxSelection && prevProps.width === nextProps.width && prevProps.maxHeight === nextProps.maxHeight && prevProps.density === nextProps.density;
|
|
2096
2357
|
return isEqual;
|
|
2097
2358
|
});
|
|
2098
2359
|
|
|
2099
2360
|
// src/Components/EmptyState/EmptyState.tsx
|
|
2100
|
-
import
|
|
2361
|
+
import React16 from "react";
|
|
2101
2362
|
import { Button as Button8, Stack as Stack7, Typography as Typography12 } from "@mui/material";
|
|
2102
2363
|
|
|
2103
2364
|
// src/assets/ImgEmptyState/create.svg
|
|
@@ -2125,7 +2386,7 @@ var DefaultIcon = ({
|
|
|
2125
2386
|
}) => {
|
|
2126
2387
|
const imageUrl = EmptyStateImageUrls[state];
|
|
2127
2388
|
const iconSize = size === "small" ? { width: "40px", height: "40px" } : { width: "60px", height: "60px" };
|
|
2128
|
-
return /* @__PURE__ */
|
|
2389
|
+
return /* @__PURE__ */ React16.createElement("img", { src: imageUrl, alt: state, style: iconSize });
|
|
2129
2390
|
};
|
|
2130
2391
|
var EmptyState = ({
|
|
2131
2392
|
state = "create",
|
|
@@ -2134,11 +2395,11 @@ var EmptyState = ({
|
|
|
2134
2395
|
subtitle,
|
|
2135
2396
|
actions,
|
|
2136
2397
|
containerHeight = "100vh",
|
|
2137
|
-
icon = /* @__PURE__ */
|
|
2398
|
+
icon = /* @__PURE__ */ React16.createElement(DefaultIcon, { state, size })
|
|
2138
2399
|
}) => {
|
|
2139
2400
|
const titleVariant = size === "small" ? "subtitle2" : "h6";
|
|
2140
2401
|
const subtitleVariant = size === "small" ? "caption" : "body1";
|
|
2141
|
-
return /* @__PURE__ */
|
|
2402
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2142
2403
|
Stack7,
|
|
2143
2404
|
{
|
|
2144
2405
|
alignItems: "center",
|
|
@@ -2147,8 +2408,8 @@ var EmptyState = ({
|
|
|
2147
2408
|
height: containerHeight,
|
|
2148
2409
|
"data-testid": "empty-state-container"
|
|
2149
2410
|
},
|
|
2150
|
-
icon && /* @__PURE__ */
|
|
2151
|
-
/* @__PURE__ */
|
|
2411
|
+
icon && /* @__PURE__ */ React16.createElement(Stack7, null, icon),
|
|
2412
|
+
/* @__PURE__ */ React16.createElement(Stack7, { gap: 0.5 }, /* @__PURE__ */ React16.createElement(Typography12, { color: "text.primary", variant: titleVariant, textAlign: "center" }, title), subtitle && /* @__PURE__ */ React16.createElement(
|
|
2152
2413
|
Typography12,
|
|
2153
2414
|
{
|
|
2154
2415
|
variant: subtitleVariant,
|
|
@@ -2156,7 +2417,7 @@ var EmptyState = ({
|
|
|
2156
2417
|
color: "text.secondary"
|
|
2157
2418
|
},
|
|
2158
2419
|
subtitle
|
|
2159
|
-
), actions && (actions == null ? void 0 : actions.length) > 0 && /* @__PURE__ */
|
|
2420
|
+
), actions && (actions == null ? void 0 : actions.length) > 0 && /* @__PURE__ */ React16.createElement(
|
|
2160
2421
|
Stack7,
|
|
2161
2422
|
{
|
|
2162
2423
|
direction: "row",
|
|
@@ -2166,15 +2427,15 @@ var EmptyState = ({
|
|
|
2166
2427
|
},
|
|
2167
2428
|
actions.map((action, index) => {
|
|
2168
2429
|
var _a, _b, _c, _d;
|
|
2169
|
-
return /* @__PURE__ */
|
|
2430
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2170
2431
|
Button8,
|
|
2171
2432
|
{
|
|
2172
2433
|
key: index,
|
|
2173
2434
|
color: (_a = action.color) != null ? _a : "primary",
|
|
2174
2435
|
variant: (_b = action.variant) != null ? _b : "text",
|
|
2175
2436
|
size: (_c = action.size) != null ? _c : "small",
|
|
2176
|
-
startIcon: action.icon && action.iconPosition === "left" ? /* @__PURE__ */
|
|
2177
|
-
endIcon: action.icon && action.iconPosition === "right" ? /* @__PURE__ */
|
|
2437
|
+
startIcon: action.icon && action.iconPosition === "left" ? /* @__PURE__ */ React16.createElement("img", { src: action.icon, alt: "icon" }) : void 0,
|
|
2438
|
+
endIcon: action.icon && action.iconPosition === "right" ? /* @__PURE__ */ React16.createElement("img", { src: action.icon, alt: "icon" }) : void 0,
|
|
2178
2439
|
onClick: action.onClick
|
|
2179
2440
|
},
|
|
2180
2441
|
capitalize((_d = action.text) != null ? _d : "action")
|
|
@@ -2185,7 +2446,7 @@ var EmptyState = ({
|
|
|
2185
2446
|
};
|
|
2186
2447
|
|
|
2187
2448
|
// src/Components/SCDialog.tsx
|
|
2188
|
-
import
|
|
2449
|
+
import React17, { useEffect as useEffect13, useState as useState9 } from "react";
|
|
2189
2450
|
import { Button as Button9, Typography as Typography13, Modal as Modal2, Dialog, DialogActions, DialogContent, DialogTitle, IconButton as IconButton8, Tooltip as Tooltip3, Box as Box11, SvgIcon as SvgIcon5 } from "@mui/material";
|
|
2190
2451
|
import Grid6 from "@mui/material/Grid2";
|
|
2191
2452
|
import CloseIcon2 from "@mui/icons-material/Close";
|
|
@@ -2196,7 +2457,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2196
2457
|
let IconTitle;
|
|
2197
2458
|
let ButtonIcon;
|
|
2198
2459
|
const [open, setOpen] = useState9(show);
|
|
2199
|
-
|
|
2460
|
+
useEffect13(() => {
|
|
2200
2461
|
if (show) {
|
|
2201
2462
|
handleOpen();
|
|
2202
2463
|
} else {
|
|
@@ -2221,7 +2482,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2221
2482
|
});
|
|
2222
2483
|
if (iconTitle) {
|
|
2223
2484
|
if (Muicon5[iconTitle] == void 0) {
|
|
2224
|
-
if (iconTitle &&
|
|
2485
|
+
if (iconTitle && React17.isValidElement(iconTitle) && iconTitle.type == void 0) {
|
|
2225
2486
|
iconTitleValidation = "image";
|
|
2226
2487
|
IconTitle = iconTitle;
|
|
2227
2488
|
} else {
|
|
@@ -2246,8 +2507,8 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2246
2507
|
}
|
|
2247
2508
|
};
|
|
2248
2509
|
const dialogActions = actions != null ? actions : [{ text: "Cerrar", fn: handleClose }];
|
|
2249
|
-
content = content != null ? content : { component: /* @__PURE__ */
|
|
2250
|
-
return /* @__PURE__ */
|
|
2510
|
+
content = content != null ? content : { component: /* @__PURE__ */ React17.createElement(Box11, null, " Aqui va el contenido ") };
|
|
2511
|
+
return /* @__PURE__ */ React17.createElement("div", null, buttonDialog ? /* @__PURE__ */ React17.createElement(React17.Fragment, null, buttonDialog.text != void 0 ? /* @__PURE__ */ React17.createElement(Tooltip3, { placement: "bottom-start", title: buttonDialog.tooltip != void 0 ? buttonDialog.tooltip : "", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ React17.createElement(Button9, { size: "small", color: buttonDialog.color != void 0 ? buttonDialog.color : "primary", variant: (buttonDialog == null ? void 0 : buttonDialog.variant) != void 0 ? buttonDialog == null ? void 0 : buttonDialog.variant : "text", startIcon: (buttonDialog == null ? void 0 : buttonDialog.iconPosition) != void 0 ? (buttonDialog == null ? void 0 : buttonDialog.iconPosition) == "left" ? /* @__PURE__ */ React17.createElement(ButtonIcon, null) : "" : "", endIcon: (buttonDialog == null ? void 0 : buttonDialog.iconPosition) != void 0 ? (buttonDialog == null ? void 0 : buttonDialog.iconPosition) == "right" ? /* @__PURE__ */ React17.createElement(ButtonIcon, null) : "" : "", onClick: handleOpen }, " ", (buttonDialog == null ? void 0 : buttonDialog.text) != void 0 ? buttonDialog.text : "", " ")) : /* @__PURE__ */ React17.createElement(IconButton8, { style: { cursor: "pointer" }, onClick: handleOpen }, /* @__PURE__ */ React17.createElement(SvgIcon5, { fontSize: "small", color: (buttonDialog == null ? void 0 : buttonDialog.color) != void 0 ? buttonDialog == null ? void 0 : buttonDialog.color : "action", component: ButtonIcon }))) : "", /* @__PURE__ */ React17.createElement(Modal2, { open: open || false, onClose: handleClose }, /* @__PURE__ */ React17.createElement(
|
|
2251
2512
|
Dialog,
|
|
2252
2513
|
{
|
|
2253
2514
|
"data-testid": "dialog-element",
|
|
@@ -2261,8 +2522,8 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2261
2522
|
}
|
|
2262
2523
|
}
|
|
2263
2524
|
},
|
|
2264
|
-
title && /* @__PURE__ */
|
|
2265
|
-
/* @__PURE__ */
|
|
2525
|
+
title && /* @__PURE__ */ React17.createElement(DialogTitle, { sx: { m: 0, padding: "8px 16px 8px 16px" }, "data-testid": "dialog-icon-title" }, /* @__PURE__ */ React17.createElement(Grid6, { container: true, size: 12, sx: { justifyContent: "space-between", flexWrap: "nowrap" } }, /* @__PURE__ */ React17.createElement(Grid6, { container: true, size: 11, sx: { alignItems: "center" } }, iconTitle ? iconTitleValidation == "image" ? /* @__PURE__ */ React17.createElement(Box11, { sx: { marginRight: "16px", width: "44px", height: "44px", borderRadius: "1px" } }, /* @__PURE__ */ React17.createElement("img", { src: IconTitle, width: "44px", height: "44px" })) : /* @__PURE__ */ React17.createElement(SvgIcon5, { color: "action", fontSize: "small", component: IconTitle, sx: { marginRight: "16px" } }) : "", /* @__PURE__ */ React17.createElement(Grid6, null, /* @__PURE__ */ React17.createElement(Typography13, { color: "text.primary", variant: "h6", gutterBottom: true }, title ? title : ""), /* @__PURE__ */ React17.createElement(Typography13, { color: "text.secondary", variant: "body2", gutterBottom: true }, subtitle ? subtitle : ""))), disableClose != true ? /* @__PURE__ */ React17.createElement(IconButton8, { "data-testid": "close-dialog-button", onClick: handleClose, size: "small", color: "default", sx: { height: 22, width: 22 } }, /* @__PURE__ */ React17.createElement(CloseIcon2, null)) : "")),
|
|
2526
|
+
/* @__PURE__ */ React17.createElement(
|
|
2266
2527
|
DialogContent,
|
|
2267
2528
|
{
|
|
2268
2529
|
"data-testid": "dialog-content",
|
|
@@ -2290,7 +2551,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2290
2551
|
}
|
|
2291
2552
|
}
|
|
2292
2553
|
},
|
|
2293
|
-
content.url ? /* @__PURE__ */
|
|
2554
|
+
content.url ? /* @__PURE__ */ React17.createElement(
|
|
2294
2555
|
"iframe",
|
|
2295
2556
|
{
|
|
2296
2557
|
style: { border: "none", minWidth: "100%", minHeight: "100%" },
|
|
@@ -2300,7 +2561,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2300
2561
|
}
|
|
2301
2562
|
) : content.component
|
|
2302
2563
|
),
|
|
2303
|
-
dialogActions.length > 0 ? /* @__PURE__ */
|
|
2564
|
+
dialogActions.length > 0 ? /* @__PURE__ */ React17.createElement(DialogActions, { sx: { gap: 1, m: 0, padding: "12px 16px 12px 16px", justifyContent: dialogActions.length >= 3 ? "space-between" : "flex-end" } }, dialogActions.length >= 3 ? /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
2304
2565
|
Button9,
|
|
2305
2566
|
{
|
|
2306
2567
|
variant: "text",
|
|
@@ -2308,11 +2569,11 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2308
2569
|
size: "small",
|
|
2309
2570
|
onClick: dialogActions[0].fn,
|
|
2310
2571
|
disabled: dialogActions[0].disabled || false,
|
|
2311
|
-
startIcon: dialogActions[0].icon ? /* @__PURE__ */
|
|
2572
|
+
startIcon: dialogActions[0].icon ? /* @__PURE__ */ React17.createElement(SvgIcon5, { fontSize: "small", component: dialogActions[0].icon }) : void 0
|
|
2312
2573
|
},
|
|
2313
2574
|
dialogActions[0].text
|
|
2314
|
-
), /* @__PURE__ */
|
|
2315
|
-
return /* @__PURE__ */
|
|
2575
|
+
), /* @__PURE__ */ React17.createElement(Box11, { sx: { display: "flex", gap: 1 } }, dialogActions.slice(1).map((boton, index) => {
|
|
2576
|
+
return /* @__PURE__ */ React17.createElement(
|
|
2316
2577
|
Button9,
|
|
2317
2578
|
{
|
|
2318
2579
|
key: index + 1,
|
|
@@ -2321,12 +2582,12 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2321
2582
|
size: "small",
|
|
2322
2583
|
onClick: boton.fn,
|
|
2323
2584
|
disabled: boton.disabled || false,
|
|
2324
|
-
startIcon: boton.icon ? /* @__PURE__ */
|
|
2585
|
+
startIcon: boton.icon ? /* @__PURE__ */ React17.createElement(SvgIcon5, { fontSize: "small", component: boton.icon }) : void 0
|
|
2325
2586
|
},
|
|
2326
2587
|
boton.text
|
|
2327
2588
|
);
|
|
2328
2589
|
}))) : dialogActions.map((boton, index) => {
|
|
2329
|
-
return /* @__PURE__ */
|
|
2590
|
+
return /* @__PURE__ */ React17.createElement(
|
|
2330
2591
|
Button9,
|
|
2331
2592
|
{
|
|
2332
2593
|
key: index,
|
|
@@ -2335,7 +2596,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2335
2596
|
size: "small",
|
|
2336
2597
|
onClick: boton.fn,
|
|
2337
2598
|
disabled: boton.disabled || false,
|
|
2338
|
-
startIcon: boton.icon ? /* @__PURE__ */
|
|
2599
|
+
startIcon: boton.icon ? /* @__PURE__ */ React17.createElement(SvgIcon5, { fontSize: "small", component: boton.icon }) : void 0
|
|
2339
2600
|
},
|
|
2340
2601
|
boton.text
|
|
2341
2602
|
);
|
|
@@ -2344,12 +2605,12 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
2344
2605
|
};
|
|
2345
2606
|
|
|
2346
2607
|
// src/Components/SCMenu.tsx
|
|
2347
|
-
import
|
|
2608
|
+
import React18 from "react";
|
|
2348
2609
|
import { Box as Box12, Typography as Typography14, Paper, Divider as Divider4, MenuList, MenuItem as MenuItem4, ListItemIcon as ListItemIcon4, SvgIcon as SvgIcon6 } from "@mui/material";
|
|
2349
2610
|
import Grid7 from "@mui/material/Grid2";
|
|
2350
2611
|
|
|
2351
2612
|
// src/Components/Hooks/useWindowDimensions.ts
|
|
2352
|
-
import { useState as useState10, useEffect as
|
|
2613
|
+
import { useState as useState10, useEffect as useEffect14 } from "react";
|
|
2353
2614
|
function getWindowDimensions() {
|
|
2354
2615
|
const { innerWidth: width, innerHeight: height } = window;
|
|
2355
2616
|
return {
|
|
@@ -2359,7 +2620,7 @@ function getWindowDimensions() {
|
|
|
2359
2620
|
}
|
|
2360
2621
|
function useWindowDimensions() {
|
|
2361
2622
|
const [windowDimensions, setWindowDimensions] = useState10(getWindowDimensions());
|
|
2362
|
-
|
|
2623
|
+
useEffect14(() => {
|
|
2363
2624
|
function handleResize() {
|
|
2364
2625
|
setWindowDimensions(getWindowDimensions());
|
|
2365
2626
|
}
|
|
@@ -2377,12 +2638,12 @@ var SCMenu = ({ header, options, defaultOption, disable, widthMenu, heightMenu,
|
|
|
2377
2638
|
const pageSize = widthPage ? parseInt(widthPage) : width - menuSize;
|
|
2378
2639
|
const widthContainer = menuSize + pageSize;
|
|
2379
2640
|
let heightContainer = heightMenu ? parseInt(heightMenu) : height - 76;
|
|
2380
|
-
const [selectedIndex, setSelectedIndex] =
|
|
2381
|
-
const [value, setValue] =
|
|
2382
|
-
|
|
2641
|
+
const [selectedIndex, setSelectedIndex] = React18.useState("1");
|
|
2642
|
+
const [value, setValue] = React18.useState("1");
|
|
2643
|
+
React18.useEffect(() => {
|
|
2383
2644
|
heightContainer = heightMenu ? parseInt(heightMenu) : height - 76;
|
|
2384
2645
|
}, [height]);
|
|
2385
|
-
|
|
2646
|
+
React18.useEffect(() => {
|
|
2386
2647
|
if (defaultOption) {
|
|
2387
2648
|
handleClickMenusItem(event, void 0);
|
|
2388
2649
|
}
|
|
@@ -2412,7 +2673,7 @@ var SCMenu = ({ header, options, defaultOption, disable, widthMenu, heightMenu,
|
|
|
2412
2673
|
setValue(String(index + 1));
|
|
2413
2674
|
}
|
|
2414
2675
|
};
|
|
2415
|
-
return /* @__PURE__ */
|
|
2676
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(Grid7, { container: true, sx: { height: heightContainer, width: widthContainer, flexDirection: "column" } }, /* @__PURE__ */ React18.createElement(Paper, { "data-testid": "menu-content", sx: { width: menuSize, height: heightContainer, overflow: "auto" } }, header && header.component, /* @__PURE__ */ React18.createElement(MenuList, { sx: { height: options.length * 45, padding: "8px 0px" } }, options.map((option, index) => /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
|
|
2416
2677
|
MenuItem4,
|
|
2417
2678
|
{
|
|
2418
2679
|
disabled: disable == true ? true : false,
|
|
@@ -2420,26 +2681,26 @@ var SCMenu = ({ header, options, defaultOption, disable, widthMenu, heightMenu,
|
|
|
2420
2681
|
selected: String(index + 1) === selectedIndex,
|
|
2421
2682
|
onClick: (event2) => handleClickMenusItem(event2, index)
|
|
2422
2683
|
},
|
|
2423
|
-
option.iconLeft ? /* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
), option.divider == true ? /* @__PURE__ */
|
|
2684
|
+
option.iconLeft ? /* @__PURE__ */ React18.createElement(ListItemIcon4, { sx: { color: String(index + 1) === selectedIndex ? "primary" : "active" } }, /* @__PURE__ */ React18.createElement(SvgIcon6, { fontSize: "small", color: String(index + 1) === selectedIndex ? "primary" : "action", component: option.iconLeft })) : "",
|
|
2685
|
+
/* @__PURE__ */ React18.createElement(Grid7, { container: true, size: 12, sx: { maxWidth: 220, flexWrap: "noWrap", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(Typography14, { noWrap: true, variant: "caption", color: String(index + 1) === selectedIndex ? "primary" : "active" }, option.name), option.iconRight ? /* @__PURE__ */ React18.createElement(ListItemIcon4, { sx: { minWidth: "0px !important", color: String(index + 1) === selectedIndex ? "primary" : "active" } }, /* @__PURE__ */ React18.createElement(SvgIcon6, { fontSize: "small", color: String(index + 1) === selectedIndex ? "primary" : "action", component: option.iconRight })) : "")
|
|
2686
|
+
), option.divider == true ? /* @__PURE__ */ React18.createElement(Divider4, null) : "")))), /* @__PURE__ */ React18.createElement(Grid7, { container: true }, options.map((option, index) => option.page ? String(index + 1) == value ? /* @__PURE__ */ React18.createElement(Box12, { "data-testid": "menu-page-content", sx: { padding: "16px", width: pageSize, height: heightContainer }, key: index }, option.page) : "" : /* @__PURE__ */ React18.createElement(Typography14, { color: "error" }, "No se ha configurado el componente a visualizar")))));
|
|
2426
2687
|
};
|
|
2427
2688
|
|
|
2428
2689
|
// src/Components/SCTabs.tsx
|
|
2429
|
-
import
|
|
2690
|
+
import React19, { useEffect as useEffect15 } from "react";
|
|
2430
2691
|
import { Typography as Typography15, Box as Box13, SvgIcon as SvgIcon7, Tab, Tabs, Badge } from "@mui/material";
|
|
2431
2692
|
import TabPanel from "@mui/lab/TabPanel";
|
|
2432
2693
|
import TabContext from "@mui/lab/TabContext";
|
|
2433
2694
|
import * as Muicon7 from "@mui/icons-material";
|
|
2434
2695
|
var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colorTab, orientation, variant, scrollButtons, children }) => {
|
|
2435
|
-
const [toast, setToast] =
|
|
2696
|
+
const [toast, setToast] = React19.useState(null);
|
|
2436
2697
|
let i = 0;
|
|
2437
2698
|
let j = 0;
|
|
2438
2699
|
let k = 0;
|
|
2439
2700
|
let l = 0;
|
|
2440
2701
|
let validateTypeIcon = true;
|
|
2441
|
-
const [value, setValue] =
|
|
2442
|
-
|
|
2702
|
+
const [value, setValue] = React19.useState("1");
|
|
2703
|
+
useEffect15(() => {
|
|
2443
2704
|
if (defaultOption) {
|
|
2444
2705
|
handleChange(event, void 0);
|
|
2445
2706
|
}
|
|
@@ -2489,7 +2750,7 @@ var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colo
|
|
|
2489
2750
|
setValue(newValue);
|
|
2490
2751
|
}
|
|
2491
2752
|
};
|
|
2492
|
-
return /* @__PURE__ */
|
|
2753
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, validateTypeIcon == true ? /* @__PURE__ */ React19.createElement(Box13, { sx: { height: orientation == "vertical" ? "100%" : "auto", display: "flex", flexDirection: orientation == "vertical" ? "row" : "column" }, id: "tabsitos" }, /* @__PURE__ */ React19.createElement(TabContext, { value }, /* @__PURE__ */ React19.createElement(
|
|
2493
2754
|
Tabs,
|
|
2494
2755
|
{
|
|
2495
2756
|
"data-testid": "tab-container",
|
|
@@ -2503,7 +2764,7 @@ var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colo
|
|
|
2503
2764
|
orientation: orientation || "horizontal",
|
|
2504
2765
|
sx: { borderBottom: orientation == "vertical" ? 0 : 1, borderRight: orientation == "vertical" ? 1 : 0, borderColor: "divider", background: background || "" }
|
|
2505
2766
|
},
|
|
2506
|
-
options.map((option) => /* @__PURE__ */
|
|
2767
|
+
options.map((option) => /* @__PURE__ */ React19.createElement(
|
|
2507
2768
|
Tab,
|
|
2508
2769
|
{
|
|
2509
2770
|
"data-testid": "tab-item",
|
|
@@ -2512,7 +2773,7 @@ var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colo
|
|
|
2512
2773
|
label: option.name || "",
|
|
2513
2774
|
disabled: option.disabled || false,
|
|
2514
2775
|
iconPosition: iconPosition || "end",
|
|
2515
|
-
icon: typeIcon == "badge" ? /* @__PURE__ */
|
|
2776
|
+
icon: typeIcon == "badge" ? /* @__PURE__ */ React19.createElement(
|
|
2516
2777
|
Badge,
|
|
2517
2778
|
{
|
|
2518
2779
|
sx: {
|
|
@@ -2527,26 +2788,841 @@ var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colo
|
|
|
2527
2788
|
badgeContent: option.iconOrBadge,
|
|
2528
2789
|
color: value == String(i) ? colorTab ? colorTab : "primary" : "default"
|
|
2529
2790
|
}
|
|
2530
|
-
) : typeIcon == "icon" ? /* @__PURE__ */
|
|
2791
|
+
) : typeIcon == "icon" ? /* @__PURE__ */ React19.createElement(SvgIcon7, { fontSize: "small", component: option.iconOrBadge, color: value == String(i) ? colorTab ? colorTab : "primary" : "action", sx: { width: "20px", height: "20px" } }) : "",
|
|
2531
2792
|
sx: { "& .MuiTab-icon": { margin: "0px !important" }, padding: "10px 16px", gap: "4px" }
|
|
2532
2793
|
}
|
|
2533
2794
|
))
|
|
2534
|
-
), children, options.map((option) => /* @__PURE__ */
|
|
2795
|
+
), children, options.map((option) => /* @__PURE__ */ React19.createElement(
|
|
2535
2796
|
TabPanel,
|
|
2536
2797
|
{
|
|
2537
2798
|
key: k = k + 1,
|
|
2538
2799
|
value: String(l = l + 1),
|
|
2539
2800
|
sx: { padding: "16px" }
|
|
2540
2801
|
},
|
|
2541
|
-
option.page ? option.page : /* @__PURE__ */
|
|
2542
|
-
)))) : /* @__PURE__ */
|
|
2802
|
+
option.page ? option.page : /* @__PURE__ */ React19.createElement(Typography15, null, "No se ha configurado el componente a visualizar ")
|
|
2803
|
+
)))) : /* @__PURE__ */ React19.createElement(Box13, { sx: { height: "200px" } }, toast && /* @__PURE__ */ React19.createElement(SCToastNotification, __spreadValues({ "data-testid": "error-tab-message" }, toast))));
|
|
2804
|
+
};
|
|
2805
|
+
|
|
2806
|
+
// src/Components/Calendario/Calendar.tsx
|
|
2807
|
+
import React25, { useState as useState12 } from "react";
|
|
2808
|
+
import { Box as Box19, CircularProgress as CircularProgress4 } from "@mui/material";
|
|
2809
|
+
|
|
2810
|
+
// src/Components/Calendario/CalendarToolbar.tsx
|
|
2811
|
+
import React20, { useState as useState11 } from "react";
|
|
2812
|
+
import { ChevronLeft, ChevronRight, KeyboardArrowDown as KeyboardArrowDown2, LightModeOutlined } from "@mui/icons-material";
|
|
2813
|
+
import { Box as Box14, Chip as Chip3, IconButton as IconButton9, Menu, MenuItem as MenuItem5, Stack as Stack8, Typography as Typography16 } from "@mui/material";
|
|
2814
|
+
import dayjs2 from "dayjs";
|
|
2815
|
+
import updateLocale from "dayjs/plugin/updateLocale";
|
|
2816
|
+
import "dayjs/locale/es";
|
|
2817
|
+
dayjs2.locale("es");
|
|
2818
|
+
dayjs2.extend(updateLocale);
|
|
2819
|
+
dayjs2.updateLocale("en", {
|
|
2820
|
+
weekStart: 0
|
|
2821
|
+
// 0 = domingo
|
|
2822
|
+
});
|
|
2823
|
+
var CalendarToolbar = ({
|
|
2824
|
+
labelDate,
|
|
2825
|
+
view,
|
|
2826
|
+
onView,
|
|
2827
|
+
onNavigate,
|
|
2828
|
+
children
|
|
2829
|
+
}) => {
|
|
2830
|
+
const [anchorEl, setAnchorEl] = useState11(null);
|
|
2831
|
+
const open = Boolean(anchorEl);
|
|
2832
|
+
const handleMenuOpen = (event2) => {
|
|
2833
|
+
setAnchorEl(event2.currentTarget);
|
|
2834
|
+
};
|
|
2835
|
+
const handleMenuClose = () => {
|
|
2836
|
+
setAnchorEl(null);
|
|
2837
|
+
};
|
|
2838
|
+
const handleViewChange = (newView) => {
|
|
2839
|
+
onView(newView);
|
|
2840
|
+
handleMenuClose();
|
|
2841
|
+
};
|
|
2842
|
+
const getFormattedDate = () => {
|
|
2843
|
+
const sunday = labelDate.day(0);
|
|
2844
|
+
const saturday = sunday.add(6, "day");
|
|
2845
|
+
if (view === "month") {
|
|
2846
|
+
const textMonth = labelDate.format("MMMM YYYY");
|
|
2847
|
+
return textMonth.charAt(0).toUpperCase() + textMonth.slice(1);
|
|
2848
|
+
}
|
|
2849
|
+
if (view === "week") {
|
|
2850
|
+
return `${labelDate.startOf("week").format("DD MMM")} - ${labelDate.endOf("week").format("DD MMM YYYY")}`;
|
|
2851
|
+
}
|
|
2852
|
+
return labelDate.format(" DD MMMM YYYY");
|
|
2853
|
+
};
|
|
2854
|
+
return /* @__PURE__ */ React20.createElement(Stack8, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 0.5, px: 1, py: 0.5 }, /* @__PURE__ */ React20.createElement(Box14, null, /* @__PURE__ */ React20.createElement(
|
|
2855
|
+
Chip3,
|
|
2856
|
+
{
|
|
2857
|
+
label: "Hoy",
|
|
2858
|
+
icon: /* @__PURE__ */ React20.createElement(LightModeOutlined, { fontSize: "small" }),
|
|
2859
|
+
color: "primary",
|
|
2860
|
+
onClick: () => onNavigate("TODAY")
|
|
2861
|
+
}
|
|
2862
|
+
)), /* @__PURE__ */ React20.createElement(Stack8, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React20.createElement(IconButton9, { "aria-label": "Anterior", onClick: () => onNavigate("PREV"), size: "small", color: "primary" }, /* @__PURE__ */ React20.createElement(ChevronLeft, { fontSize: "small" })), /* @__PURE__ */ React20.createElement(IconButton9, { "aria-label": "Siguiente", onClick: () => onNavigate("NEXT"), size: "small", color: "primary" }, /* @__PURE__ */ React20.createElement(ChevronRight, { fontSize: "small" })), /* @__PURE__ */ React20.createElement(Typography16, { variant: "h6", color: "primary", "data-testid": "currentDate" }, getFormattedDate()), /* @__PURE__ */ React20.createElement(IconButton9, { onClick: handleMenuOpen, size: "small", color: "primary", "aria-label": "Cambiar vista" }, /* @__PURE__ */ React20.createElement(KeyboardArrowDown2, { fontSize: "small" })), /* @__PURE__ */ React20.createElement(
|
|
2863
|
+
Menu,
|
|
2864
|
+
{
|
|
2865
|
+
anchorEl,
|
|
2866
|
+
open,
|
|
2867
|
+
onClose: handleMenuClose,
|
|
2868
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
2869
|
+
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
2870
|
+
},
|
|
2871
|
+
/* @__PURE__ */ React20.createElement(MenuItem5, { onClick: () => handleViewChange("month") }, "Mes"),
|
|
2872
|
+
/* @__PURE__ */ React20.createElement(MenuItem5, { onClick: () => handleViewChange("week") }, "Semana"),
|
|
2873
|
+
/* @__PURE__ */ React20.createElement(MenuItem5, { onClick: () => handleViewChange("day") }, "D\xEDa")
|
|
2874
|
+
)), children ? /* @__PURE__ */ React20.createElement(Box14, null, children) : /* @__PURE__ */ React20.createElement(Box14, { width: "24px" }), " ");
|
|
2875
|
+
};
|
|
2876
|
+
|
|
2877
|
+
// src/Components/Calendario/Views/MonthView.tsx
|
|
2878
|
+
import React22 from "react";
|
|
2879
|
+
import { Box as Box16, Typography as Typography18, IconButton as IconButton10, Paper as Paper2, Tooltip as Tooltip5, Stack as Stack10, Divider as Divider6, CircularProgress } from "@mui/material";
|
|
2880
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
2881
|
+
import dayjs4 from "dayjs";
|
|
2882
|
+
import localeData from "dayjs/plugin/localeData";
|
|
2883
|
+
import isBetween from "dayjs/plugin/isBetween";
|
|
2884
|
+
|
|
2885
|
+
// src/Components/Calendario/Utils.tsx
|
|
2886
|
+
import dayjs3 from "dayjs";
|
|
2887
|
+
function getMonthDays(date) {
|
|
2888
|
+
const start = date.startOf("month").day(0);
|
|
2889
|
+
const end = date.endOf("month").day(6);
|
|
2890
|
+
const days = [];
|
|
2891
|
+
let current = start;
|
|
2892
|
+
while (current.isBefore(end) || current.isSame(end, "day")) {
|
|
2893
|
+
days.push(current);
|
|
2894
|
+
current = current.add(1, "day");
|
|
2895
|
+
}
|
|
2896
|
+
return days;
|
|
2897
|
+
}
|
|
2898
|
+
var isToday = (date) => {
|
|
2899
|
+
return date.isSame(dayjs3(), "day");
|
|
2900
|
+
};
|
|
2901
|
+
var stateColors = {
|
|
2902
|
+
Asignada: "warning.main",
|
|
2903
|
+
Finalizado: "primary.main",
|
|
2904
|
+
Vencida: "error.main",
|
|
2905
|
+
EnProgreso: "success.main",
|
|
2906
|
+
Aplazada: "grey.400",
|
|
2907
|
+
Generada: "secondary.main"
|
|
2908
|
+
};
|
|
2909
|
+
|
|
2910
|
+
// src/Components/Calendario/Event.tsx
|
|
2911
|
+
import React21 from "react";
|
|
2912
|
+
import { Box as Box15, Stack as Stack9, Typography as Typography17, Divider as Divider5, Popover as Popover4 } from "@mui/material";
|
|
2913
|
+
var CalendarEventCard = ({ event: event2, color, sx, onClick, onHover }) => {
|
|
2914
|
+
const [anchorEl, setAnchorEl] = React21.useState(null);
|
|
2915
|
+
const handlePopoverOpen = (event3) => {
|
|
2916
|
+
setAnchorEl(event3.currentTarget);
|
|
2917
|
+
};
|
|
2918
|
+
const handlePopoverClose = () => {
|
|
2919
|
+
setAnchorEl(null);
|
|
2920
|
+
};
|
|
2921
|
+
const open = Boolean(anchorEl);
|
|
2922
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2923
|
+
Stack9,
|
|
2924
|
+
{
|
|
2925
|
+
direction: "row",
|
|
2926
|
+
padding: 0.5,
|
|
2927
|
+
borderRadius: 0.5,
|
|
2928
|
+
alignItems: "flex-start",
|
|
2929
|
+
minHeight: "20px",
|
|
2930
|
+
onMouseOver: () => onHover == null ? void 0 : onHover(event2),
|
|
2931
|
+
onClick: (e) => {
|
|
2932
|
+
e.stopPropagation();
|
|
2933
|
+
onClick == null ? void 0 : onClick(event2);
|
|
2934
|
+
},
|
|
2935
|
+
sx: (theme) => __spreadValues({
|
|
2936
|
+
backgroundColor: theme.palette.common.white,
|
|
2937
|
+
boxShadow: theme.shadows[2],
|
|
2938
|
+
color: theme.palette.text.secondary,
|
|
2939
|
+
overflow: "hidden",
|
|
2940
|
+
cursor: onClick ? "pointer" : "default"
|
|
2941
|
+
}, sx)
|
|
2942
|
+
},
|
|
2943
|
+
/* @__PURE__ */ React21.createElement(
|
|
2944
|
+
Divider5,
|
|
2945
|
+
{
|
|
2946
|
+
orientation: "vertical",
|
|
2947
|
+
flexItem: true,
|
|
2948
|
+
sx: {
|
|
2949
|
+
width: "2px",
|
|
2950
|
+
backgroundColor: color != null ? color : "primary.main",
|
|
2951
|
+
borderRadius: "2px"
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
),
|
|
2955
|
+
/* @__PURE__ */ React21.createElement(
|
|
2956
|
+
Box15,
|
|
2957
|
+
{
|
|
2958
|
+
px: 1,
|
|
2959
|
+
py: 0.5,
|
|
2960
|
+
flex: "1",
|
|
2961
|
+
minWidth: 0,
|
|
2962
|
+
display: "flex",
|
|
2963
|
+
alignItems: "center"
|
|
2964
|
+
},
|
|
2965
|
+
/* @__PURE__ */ React21.createElement(
|
|
2966
|
+
Typography17,
|
|
2967
|
+
{
|
|
2968
|
+
color: "text.primary",
|
|
2969
|
+
variant: "caption",
|
|
2970
|
+
noWrap: true,
|
|
2971
|
+
sx: {
|
|
2972
|
+
overflow: "hidden",
|
|
2973
|
+
textOverflow: "ellipsis",
|
|
2974
|
+
whiteSpace: "nowrap"
|
|
2975
|
+
},
|
|
2976
|
+
onMouseEnter: handlePopoverOpen,
|
|
2977
|
+
onMouseLeave: handlePopoverClose
|
|
2978
|
+
},
|
|
2979
|
+
capitalize(event2.title)
|
|
2980
|
+
),
|
|
2981
|
+
/* @__PURE__ */ React21.createElement(
|
|
2982
|
+
Popover4,
|
|
2983
|
+
{
|
|
2984
|
+
id: "mouse-over-popover",
|
|
2985
|
+
sx: { pointerEvents: "none" },
|
|
2986
|
+
open,
|
|
2987
|
+
anchorEl,
|
|
2988
|
+
anchorOrigin: {
|
|
2989
|
+
vertical: "top",
|
|
2990
|
+
horizontal: "right"
|
|
2991
|
+
},
|
|
2992
|
+
transformOrigin: {
|
|
2993
|
+
vertical: "bottom",
|
|
2994
|
+
horizontal: "right"
|
|
2995
|
+
},
|
|
2996
|
+
onClose: handlePopoverClose,
|
|
2997
|
+
disableRestoreFocus: true
|
|
2998
|
+
},
|
|
2999
|
+
onHover ? onHover(event2) : /* @__PURE__ */ React21.createElement(Typography17, null, "Sin contenido")
|
|
3000
|
+
)
|
|
3001
|
+
)
|
|
3002
|
+
);
|
|
3003
|
+
};
|
|
3004
|
+
|
|
3005
|
+
// src/assets/Icon Scheduler.svg
|
|
3006
|
+
var Icon_Scheduler_default = "./Icon Scheduler-WX62PISD.svg";
|
|
3007
|
+
|
|
3008
|
+
// src/Components/Calendario/Views/MonthView.tsx
|
|
3009
|
+
dayjs4.extend(localeData);
|
|
3010
|
+
dayjs4.extend(isBetween);
|
|
3011
|
+
var MonthView = ({ events, isLoading, onDayClick, onMoreClick, currentDate, onEventClick, onEventHover }) => {
|
|
3012
|
+
const noEvents = events.length === 0;
|
|
3013
|
+
const days = getMonthDays(currentDate);
|
|
3014
|
+
const weekDays = Array.from({ length: 7 }, (_, i) => dayjs4().day(i));
|
|
3015
|
+
const [openDrawer, setOpenDrawer] = React22.useState(false);
|
|
3016
|
+
const [selectedDay, setSelectedDay] = React22.useState(null);
|
|
3017
|
+
const [selectedEvents, setSelectedEvents] = React22.useState([]);
|
|
3018
|
+
return /* @__PURE__ */ React22.createElement(Box16, { width: "100%", sx: { overflowX: "auto" } }, /* @__PURE__ */ React22.createElement(Box16, { minWidth: "1050px" }, /* @__PURE__ */ React22.createElement(Box16, { display: "grid", gridTemplateColumns: "repeat(7, minmax(150px, 1fr))", gap: 0.5, mb: 1 }, weekDays.map((day) => /* @__PURE__ */ React22.createElement(Box16, { key: day.day(), textAlign: "center", py: 0.5 }, /* @__PURE__ */ React22.createElement(Typography18, { variant: "caption", color: "text.secondary" }, day.format("dddd"))))), isLoading ? /* @__PURE__ */ React22.createElement(Box16, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "450px" }, /* @__PURE__ */ React22.createElement(CircularProgress, { sx: { width: "60px", height: "60px" }, variant: "indeterminate" })) : !isLoading && noEvents ? /* @__PURE__ */ React22.createElement(
|
|
3019
|
+
EmptyState,
|
|
3020
|
+
{
|
|
3021
|
+
title: "Inicia la gesti\xF3n de las actividades",
|
|
3022
|
+
subtitle: "Selecciona un mec\xE1nico y as\xEDgnale las actividades a realizar.",
|
|
3023
|
+
icon: /* @__PURE__ */ React22.createElement("img", { src: Icon_Scheduler_default, alt: "icon_calendario", style: { width: 60, height: 60 } })
|
|
3024
|
+
}
|
|
3025
|
+
) : /* @__PURE__ */ React22.createElement(Box16, { display: "grid", gridTemplateColumns: "repeat(7, minmax(150px, 1fr))", gap: 0.5 }, days.map((day) => {
|
|
3026
|
+
const dayEvents = events.filter(
|
|
3027
|
+
(e) => day.isBetween(e.start.startOf("day"), e.end.endOf("day"), null, "[]")
|
|
3028
|
+
);
|
|
3029
|
+
const isCurrentMonth = day.month() === currentDate.month();
|
|
3030
|
+
return /* @__PURE__ */ React22.createElement(
|
|
3031
|
+
Paper2,
|
|
3032
|
+
{
|
|
3033
|
+
key: day.toString(),
|
|
3034
|
+
onClick: () => onDayClick == null ? void 0 : onDayClick(day),
|
|
3035
|
+
sx: {
|
|
3036
|
+
minHeight: 120,
|
|
3037
|
+
display: "flex",
|
|
3038
|
+
flexDirection: "column",
|
|
3039
|
+
justifyContent: "space-between",
|
|
3040
|
+
boxShadow: "none",
|
|
3041
|
+
bgcolor: isCurrentMonth ? "grey.50" : "background.default",
|
|
3042
|
+
cursor: "pointer",
|
|
3043
|
+
"&:hover": { bgcolor: "primary.50" },
|
|
3044
|
+
overflow: "hidden"
|
|
3045
|
+
}
|
|
3046
|
+
},
|
|
3047
|
+
/* @__PURE__ */ React22.createElement(Box16, { p: 1, flexShrink: 0 }, /* @__PURE__ */ React22.createElement(Box16, { display: "flex", alignItems: "center", justifyContent: "flex-start" }, /* @__PURE__ */ React22.createElement(
|
|
3048
|
+
Box16,
|
|
3049
|
+
{
|
|
3050
|
+
sx: {
|
|
3051
|
+
width: 24,
|
|
3052
|
+
height: 24,
|
|
3053
|
+
borderRadius: "50%",
|
|
3054
|
+
backgroundColor: isToday(day) ? "primary.main" : void 0,
|
|
3055
|
+
display: "flex",
|
|
3056
|
+
alignItems: "center",
|
|
3057
|
+
justifyContent: "center"
|
|
3058
|
+
}
|
|
3059
|
+
},
|
|
3060
|
+
/* @__PURE__ */ React22.createElement(
|
|
3061
|
+
Typography18,
|
|
3062
|
+
{
|
|
3063
|
+
variant: "body2",
|
|
3064
|
+
sx: { color: isToday(day) ? "white" : "text.secondary" }
|
|
3065
|
+
},
|
|
3066
|
+
day.date()
|
|
3067
|
+
)
|
|
3068
|
+
), dayEvents.length > 2 && /* @__PURE__ */ React22.createElement(Tooltip5, { title: "M\xE1s eventos" }, /* @__PURE__ */ React22.createElement(
|
|
3069
|
+
IconButton10,
|
|
3070
|
+
{
|
|
3071
|
+
color: "primary",
|
|
3072
|
+
size: "small",
|
|
3073
|
+
onClick: (e) => {
|
|
3074
|
+
e.stopPropagation();
|
|
3075
|
+
onMoreClick == null ? void 0 : onMoreClick(day, dayEvents);
|
|
3076
|
+
setSelectedDay(day);
|
|
3077
|
+
setSelectedEvents(dayEvents);
|
|
3078
|
+
}
|
|
3079
|
+
},
|
|
3080
|
+
/* @__PURE__ */ React22.createElement(AddIcon, { fontSize: "small" })
|
|
3081
|
+
)))),
|
|
3082
|
+
/* @__PURE__ */ React22.createElement(Box16, { display: "flex", flexDirection: "column", gap: 0.5, p: 1, pt: 0, overflow: "hidden" }, dayEvents.slice(0, 2).map((event2) => /* @__PURE__ */ React22.createElement(
|
|
3083
|
+
CalendarEventCard,
|
|
3084
|
+
{
|
|
3085
|
+
key: `${event2.id}-${day.toString()}`,
|
|
3086
|
+
event: event2,
|
|
3087
|
+
color: stateColors[event2.state],
|
|
3088
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day),
|
|
3089
|
+
onHover: onEventHover
|
|
3090
|
+
}
|
|
3091
|
+
))),
|
|
3092
|
+
dayEvents.length > 2 && /* @__PURE__ */ React22.createElement(Stack10, { justifyContent: "flex-end", px: 1, pb: 0.5, onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React22.createElement(
|
|
3093
|
+
SCDrawer,
|
|
3094
|
+
{
|
|
3095
|
+
width: "350px",
|
|
3096
|
+
title: day.format("DD [de] MMMM YYYY"),
|
|
3097
|
+
open: openDrawer,
|
|
3098
|
+
buttonDrawer: { text: `+ ${dayEvents.length}` },
|
|
3099
|
+
anchor: "right",
|
|
3100
|
+
actions: false,
|
|
3101
|
+
arrayElements: [{
|
|
3102
|
+
component: (() => {
|
|
3103
|
+
const [first, ...rest] = dayEvents;
|
|
3104
|
+
return /* @__PURE__ */ React22.createElement(Box16, { display: "flex", width: "100%", flexDirection: "column", height: "100%", pr: 1.5 }, /* @__PURE__ */ React22.createElement(Typography18, { width: "100%", color: "text.secondary" }, " Proximo evento "), first && /* @__PURE__ */ React22.createElement(Box16, { p: 1, pb: 1, width: "100%" }, /* @__PURE__ */ React22.createElement(
|
|
3105
|
+
CalendarEventCard,
|
|
3106
|
+
{
|
|
3107
|
+
event: first,
|
|
3108
|
+
color: stateColors[first.state],
|
|
3109
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(first, day),
|
|
3110
|
+
sx: {
|
|
3111
|
+
whiteSpace: "normal",
|
|
3112
|
+
"& .MuiTypography-root": {
|
|
3113
|
+
whiteSpace: "normal",
|
|
3114
|
+
overflow: "visible",
|
|
3115
|
+
textOverflow: "unset"
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
)), /* @__PURE__ */ React22.createElement(Divider6, { flexItem: true, sx: { width: "100%" } }), /* @__PURE__ */ React22.createElement(Typography18, { width: "100%", py: 1, color: "text.secondary" }, " Eventos restantes "), /* @__PURE__ */ React22.createElement(
|
|
3120
|
+
Box16,
|
|
3121
|
+
{
|
|
3122
|
+
width: "100%",
|
|
3123
|
+
height: "100%",
|
|
3124
|
+
flex: 1,
|
|
3125
|
+
overflow: "auto",
|
|
3126
|
+
p: 1,
|
|
3127
|
+
pt: 1,
|
|
3128
|
+
display: "flex",
|
|
3129
|
+
flexDirection: "column",
|
|
3130
|
+
gap: 1.5
|
|
3131
|
+
},
|
|
3132
|
+
rest.map((event2) => /* @__PURE__ */ React22.createElement(
|
|
3133
|
+
CalendarEventCard,
|
|
3134
|
+
{
|
|
3135
|
+
key: `${event2.id}-${day.toString()}`,
|
|
3136
|
+
event: event2,
|
|
3137
|
+
color: stateColors[event2.state],
|
|
3138
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day),
|
|
3139
|
+
onHover: onEventHover,
|
|
3140
|
+
sx: {
|
|
3141
|
+
whiteSpace: "normal",
|
|
3142
|
+
"& .MuiTypography-root": {
|
|
3143
|
+
whiteSpace: "normal",
|
|
3144
|
+
overflow: "visible",
|
|
3145
|
+
textOverflow: "unset"
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
))
|
|
3150
|
+
));
|
|
3151
|
+
})()
|
|
3152
|
+
}]
|
|
3153
|
+
}
|
|
3154
|
+
))
|
|
3155
|
+
);
|
|
3156
|
+
}))));
|
|
3157
|
+
};
|
|
3158
|
+
|
|
3159
|
+
// src/Components/Calendario/Views/WeekView.tsx
|
|
3160
|
+
import React23 from "react";
|
|
3161
|
+
import { Box as Box17, CircularProgress as CircularProgress2, Typography as Typography19 } from "@mui/material";
|
|
3162
|
+
import dayjs5 from "dayjs";
|
|
3163
|
+
import localeData2 from "dayjs/plugin/localeData";
|
|
3164
|
+
dayjs5.extend(localeData2);
|
|
3165
|
+
var WeekView = ({
|
|
3166
|
+
events,
|
|
3167
|
+
currentDate,
|
|
3168
|
+
isLoading,
|
|
3169
|
+
onDayClick,
|
|
3170
|
+
onEventClick,
|
|
3171
|
+
onEventHover,
|
|
3172
|
+
startHour = 0,
|
|
3173
|
+
endHour = 23
|
|
3174
|
+
}) => {
|
|
3175
|
+
const noEvents = events.length === 0;
|
|
3176
|
+
const todayString = dayjs5().format("YYYY-MM-DD");
|
|
3177
|
+
const startOfWeek2 = currentDate.startOf("week");
|
|
3178
|
+
const days = Array.from({ length: 7 }, (_, i) => startOfWeek2.add(i, "day"));
|
|
3179
|
+
const hours = Array.from({ length: endHour - startHour + 1 }, (_, i) => startHour + i);
|
|
3180
|
+
const getCellBorderType = (cellHour, dayEvents) => {
|
|
3181
|
+
for (const event2 of dayEvents) {
|
|
3182
|
+
const start = event2.start.hour() + event2.start.minute() / 60;
|
|
3183
|
+
const end = event2.end.hour() + event2.end.minute() / 60;
|
|
3184
|
+
const cellStart = cellHour;
|
|
3185
|
+
const cellEnd = cellHour + 1;
|
|
3186
|
+
if (cellEnd > start && cellStart < end) {
|
|
3187
|
+
if (Math.abs(cellStart - start) < 0.01 && Math.abs(cellEnd - end) < 0.01) return "full";
|
|
3188
|
+
if (Math.abs(cellStart - start) < 0.01) return "start";
|
|
3189
|
+
if (Math.abs(cellEnd - end) < 0.01) return "end";
|
|
3190
|
+
return "middle";
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
return "none";
|
|
3194
|
+
};
|
|
3195
|
+
return /* @__PURE__ */ React23.createElement(Box17, { display: "flex", flexDirection: "column", height: "100%" }, /* @__PURE__ */ React23.createElement(Box17, { display: "flex", bgcolor: "transparent" }, /* @__PURE__ */ React23.createElement(Box17, { width: 45, bgcolor: "transparent" }), days.map((day) => {
|
|
3196
|
+
const isToday2 = day.format("YYYY-MM-DD") === todayString;
|
|
3197
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3198
|
+
Box17,
|
|
3199
|
+
{
|
|
3200
|
+
key: day.toString(),
|
|
3201
|
+
height: 40,
|
|
3202
|
+
flex: 1,
|
|
3203
|
+
pl: 0.5,
|
|
3204
|
+
textAlign: "center",
|
|
3205
|
+
display: "flex",
|
|
3206
|
+
flexDirection: "column",
|
|
3207
|
+
justifyContent: "center",
|
|
3208
|
+
alignItems: "flex-start",
|
|
3209
|
+
bgcolor: isToday2 ? "primary.100" : "transparent",
|
|
3210
|
+
borderRadius: isToday2 ? "6px 6px 0 0" : "0",
|
|
3211
|
+
borderBottom: isToday2 ? 2 : 0,
|
|
3212
|
+
borderColor: isToday2 ? "primary.main" : "transparent"
|
|
3213
|
+
},
|
|
3214
|
+
/* @__PURE__ */ React23.createElement(Typography19, { variant: "h6", color: "text.primary" }, day.format("D")),
|
|
3215
|
+
/* @__PURE__ */ React23.createElement(Typography19, { variant: "caption", color: "text.secondary" }, day.format("dddd"))
|
|
3216
|
+
);
|
|
3217
|
+
})), isLoading ? /* @__PURE__ */ React23.createElement(Box17, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "450px" }, /* @__PURE__ */ React23.createElement(CircularProgress2, { sx: { width: "60px", height: "60px" }, variant: "indeterminate" })) : !isLoading && noEvents ? /* @__PURE__ */ React23.createElement(
|
|
3218
|
+
EmptyState,
|
|
3219
|
+
{
|
|
3220
|
+
title: "Inicia la gesti\xF3n de las actividades",
|
|
3221
|
+
subtitle: "Selecciona un mec\xE1nico y as\xEDgnale las actividades a realizar.",
|
|
3222
|
+
icon: /* @__PURE__ */ React23.createElement("img", { src: Icon_Scheduler_default, alt: "icon_calendario", style: { width: 60, height: 60 } })
|
|
3223
|
+
}
|
|
3224
|
+
) : (
|
|
3225
|
+
// Grid de horas y eventos
|
|
3226
|
+
/* @__PURE__ */ React23.createElement(Box17, { display: "flex", flex: 1 }, /* @__PURE__ */ React23.createElement(Box17, { width: 45, bgcolor: "transparent" }, hours.map((h) => /* @__PURE__ */ React23.createElement(
|
|
3227
|
+
Box17,
|
|
3228
|
+
{
|
|
3229
|
+
key: h,
|
|
3230
|
+
height: 60,
|
|
3231
|
+
textAlign: "right",
|
|
3232
|
+
pr: 1,
|
|
3233
|
+
borderColor: "divider"
|
|
3234
|
+
},
|
|
3235
|
+
/* @__PURE__ */ React23.createElement(Typography19, { variant: "caption", color: "text.secondary" }, dayjs5().hour(h).format("h A"))
|
|
3236
|
+
))), days.map((day) => {
|
|
3237
|
+
const dayEvents = events.filter(
|
|
3238
|
+
(event2) => day.isBetween(event2.start.startOf("day"), event2.end.endOf("day"), null, "[]")
|
|
3239
|
+
).filter((event2) => {
|
|
3240
|
+
const startsInRange = event2.start.hour() >= startHour && event2.start.hour() <= endHour;
|
|
3241
|
+
const endsInRange = event2.end.hour() >= startHour && event2.end.hour() <= endHour;
|
|
3242
|
+
return startsInRange || endsInRange;
|
|
3243
|
+
}).sort((a, b) => a.start.valueOf() - b.start.valueOf());
|
|
3244
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3245
|
+
Box17,
|
|
3246
|
+
{
|
|
3247
|
+
key: day.toString(),
|
|
3248
|
+
flex: 1,
|
|
3249
|
+
borderLeft: "1px solid",
|
|
3250
|
+
borderColor: "divider",
|
|
3251
|
+
position: "relative",
|
|
3252
|
+
"data-testid": `week-day-column-${day.format("YYYY-MM-DD")}`,
|
|
3253
|
+
onClick: () => onDayClick == null ? void 0 : onDayClick(day)
|
|
3254
|
+
},
|
|
3255
|
+
hours.map((hourIdx) => {
|
|
3256
|
+
const borderType = getCellBorderType(hourIdx, dayEvents);
|
|
3257
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3258
|
+
Box17,
|
|
3259
|
+
{
|
|
3260
|
+
key: hourIdx,
|
|
3261
|
+
height: 60,
|
|
3262
|
+
borderTop: "1px solid",
|
|
3263
|
+
borderColor: borderType === "start" || borderType === "full" || borderType === "none" ? "divider" : "transparent",
|
|
3264
|
+
borderBottom: borderType === "end" || borderType === "full" ? "1px solid divider" : void 0
|
|
3265
|
+
}
|
|
3266
|
+
);
|
|
3267
|
+
}),
|
|
3268
|
+
dayEvents.map((event2) => {
|
|
3269
|
+
const eventStart = day.isSame(event2.start, "day") ? event2.start : day.startOf("day").hour(startHour).minute(0);
|
|
3270
|
+
const eventEnd = day.isSame(event2.end, "day") ? event2.end : day.endOf("day").hour(endHour).minute(59);
|
|
3271
|
+
const startMinutes = (eventStart.hour() - startHour) * 60 + eventStart.minute();
|
|
3272
|
+
const durationMinutes = eventEnd.diff(eventStart, "minute");
|
|
3273
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3274
|
+
CalendarEventCard,
|
|
3275
|
+
{
|
|
3276
|
+
key: `${event2.id}-${day.toString()}`,
|
|
3277
|
+
event: event2,
|
|
3278
|
+
color: stateColors[event2.state],
|
|
3279
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day),
|
|
3280
|
+
onHover: onEventHover,
|
|
3281
|
+
sx: {
|
|
3282
|
+
position: "absolute",
|
|
3283
|
+
top: `${startMinutes}px`,
|
|
3284
|
+
left: 4,
|
|
3285
|
+
right: 4,
|
|
3286
|
+
cursor: "pointer",
|
|
3287
|
+
height: `${durationMinutes}px`
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
3290
|
+
);
|
|
3291
|
+
})
|
|
3292
|
+
);
|
|
3293
|
+
}))
|
|
3294
|
+
));
|
|
3295
|
+
};
|
|
3296
|
+
|
|
3297
|
+
// src/Components/Calendario/Views/DayView.tsx
|
|
3298
|
+
import React24 from "react";
|
|
3299
|
+
import { Box as Box18, CircularProgress as CircularProgress3, Typography as Typography20 } from "@mui/material";
|
|
3300
|
+
import dayjs6 from "dayjs";
|
|
3301
|
+
var DayView = ({
|
|
3302
|
+
events,
|
|
3303
|
+
currentDate,
|
|
3304
|
+
isLoading,
|
|
3305
|
+
onEventClick,
|
|
3306
|
+
onEventHover,
|
|
3307
|
+
startHour = 0,
|
|
3308
|
+
endHour = 24
|
|
3309
|
+
}) => {
|
|
3310
|
+
const hours = Array.from({ length: endHour - startHour }, (_, i) => startHour + i);
|
|
3311
|
+
const getCellBorderType = (cellHour, dayEvents2) => {
|
|
3312
|
+
for (const event2 of dayEvents2) {
|
|
3313
|
+
const start = event2.start.hour() + event2.start.minute() / 60;
|
|
3314
|
+
const end = event2.end.hour() + event2.end.minute() / 60;
|
|
3315
|
+
const cellStart = cellHour;
|
|
3316
|
+
const cellEnd = cellHour + 1;
|
|
3317
|
+
if (cellEnd > start && cellStart < end) {
|
|
3318
|
+
if (Math.abs(cellStart - start) < 0.01 && Math.abs(cellEnd - end) < 0.01) return "full";
|
|
3319
|
+
if (Math.abs(cellStart - start) < 0.01) return "start";
|
|
3320
|
+
if (Math.abs(cellEnd - end) < 0.01) return "end";
|
|
3321
|
+
return "middle";
|
|
3322
|
+
}
|
|
3323
|
+
}
|
|
3324
|
+
return "none";
|
|
3325
|
+
};
|
|
3326
|
+
const dayEvents = events.filter(
|
|
3327
|
+
(event2) => currentDate.isBetween(event2.start.startOf("day"), event2.end.endOf("day"), null, "[]")
|
|
3328
|
+
);
|
|
3329
|
+
const noEvents = events.length === 0;
|
|
3330
|
+
return /* @__PURE__ */ React24.createElement(Box18, { display: "flex", flexDirection: "column", height: "100%" }, /* @__PURE__ */ React24.createElement(Box18, { display: "flex", borderBottom: "1px solid", borderColor: "primary.main", bgcolor: "background.paper" }, /* @__PURE__ */ React24.createElement(Box18, { width: 47, bgcolor: "background.default", borderBottom: "1px solid", borderColor: "transparent" }), /* @__PURE__ */ React24.createElement(Box18, { flex: 1, display: "flex", flexDirection: "column", textAlign: "start", gap: 0.5, py: 1, bgcolor: "primary.50" }, /* @__PURE__ */ React24.createElement(Typography20, { variant: "h6", color: "text.secondary" }, currentDate.format("D")), /* @__PURE__ */ React24.createElement(Typography20, { variant: "caption", color: "text.secondary" }, currentDate.format("dddd")))), isLoading ? /* @__PURE__ */ React24.createElement(Box18, { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "450px" }, /* @__PURE__ */ React24.createElement(CircularProgress3, { sx: { width: "60px", height: "60px" }, variant: "indeterminate" })) : noEvents ? /* @__PURE__ */ React24.createElement(
|
|
3331
|
+
EmptyState,
|
|
3332
|
+
{
|
|
3333
|
+
title: "Inicia la gesti\xF3n de las actividades",
|
|
3334
|
+
subtitle: "Selecciona un mec\xE1nico y as\xEDgnale las actividades a realizar.",
|
|
3335
|
+
icon: /* @__PURE__ */ React24.createElement("img", { src: Icon_Scheduler_default, alt: "icon_calendario", style: { width: 60, height: 60 } })
|
|
3336
|
+
}
|
|
3337
|
+
) : /* @__PURE__ */ React24.createElement(Box18, { display: "flex", flex: 1 }, /* @__PURE__ */ React24.createElement(Box18, { width: 47, bgcolor: "background.default" }, hours.map((h) => /* @__PURE__ */ React24.createElement(
|
|
3338
|
+
Box18,
|
|
3339
|
+
{
|
|
3340
|
+
key: h,
|
|
3341
|
+
height: 60,
|
|
3342
|
+
textAlign: "right",
|
|
3343
|
+
pr: 1,
|
|
3344
|
+
borderTop: "1px solid",
|
|
3345
|
+
borderRight: "1px solid",
|
|
3346
|
+
borderColor: "divider"
|
|
3347
|
+
},
|
|
3348
|
+
/* @__PURE__ */ React24.createElement(Typography20, { variant: "caption", color: "text.secondary" }, dayjs6().hour(h).format("h A"))
|
|
3349
|
+
))), /* @__PURE__ */ React24.createElement(Box18, { flex: 1, position: "relative" }, hours.map((hourIdx) => {
|
|
3350
|
+
const borderType = getCellBorderType(hourIdx, dayEvents);
|
|
3351
|
+
return /* @__PURE__ */ React24.createElement(
|
|
3352
|
+
Box18,
|
|
3353
|
+
{
|
|
3354
|
+
key: hourIdx,
|
|
3355
|
+
height: 60,
|
|
3356
|
+
borderTop: "1px solid",
|
|
3357
|
+
borderColor: borderType === "start" || borderType === "full" || borderType === "none" ? "divider" : "transparent",
|
|
3358
|
+
borderBottom: borderType === "end" || borderType === "full" ? "1px solid divider" : void 0
|
|
3359
|
+
}
|
|
3360
|
+
);
|
|
3361
|
+
}), dayEvents.map((event2) => {
|
|
3362
|
+
const eventStart = currentDate.isSame(event2.start, "day") ? event2.start : currentDate.startOf("day");
|
|
3363
|
+
const eventEnd = currentDate.isSame(event2.end, "day") ? event2.end : currentDate.endOf("day");
|
|
3364
|
+
const minStart = currentDate.hour(startHour).minute(0);
|
|
3365
|
+
const maxEnd = currentDate.hour(endHour).minute(0);
|
|
3366
|
+
const clampedStart = eventStart.isBefore(minStart) ? minStart : eventStart;
|
|
3367
|
+
const clampedEnd = eventEnd.isAfter(maxEnd) ? maxEnd : eventEnd;
|
|
3368
|
+
const startMinutes = (clampedStart.hour() - startHour) * 60 + clampedStart.minute();
|
|
3369
|
+
const durationMinutes = clampedEnd.diff(clampedStart, "minute");
|
|
3370
|
+
return /* @__PURE__ */ React24.createElement(
|
|
3371
|
+
CalendarEventCard,
|
|
3372
|
+
{
|
|
3373
|
+
key: `${event2.id}-${currentDate.toString()}`,
|
|
3374
|
+
event: event2,
|
|
3375
|
+
color: stateColors[event2.state],
|
|
3376
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(event2, currentDate),
|
|
3377
|
+
onHover: onEventHover,
|
|
3378
|
+
sx: {
|
|
3379
|
+
position: "absolute",
|
|
3380
|
+
top: `${startMinutes}px`,
|
|
3381
|
+
height: `${durationMinutes}px`,
|
|
3382
|
+
left: 4,
|
|
3383
|
+
right: 4
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
);
|
|
3387
|
+
}))));
|
|
3388
|
+
};
|
|
3389
|
+
|
|
3390
|
+
// src/Components/Calendario/Calendar.tsx
|
|
3391
|
+
import dayjs7 from "dayjs";
|
|
3392
|
+
var Calendar = ({
|
|
3393
|
+
events,
|
|
3394
|
+
onDayClick,
|
|
3395
|
+
onMoreClick,
|
|
3396
|
+
onEventClick,
|
|
3397
|
+
onEventHover,
|
|
3398
|
+
view: initialView = "month",
|
|
3399
|
+
onViewChange,
|
|
3400
|
+
toolbar,
|
|
3401
|
+
isLoading = false,
|
|
3402
|
+
startHour = 0,
|
|
3403
|
+
// <- valor por defecto
|
|
3404
|
+
endHour = 23
|
|
3405
|
+
}) => {
|
|
3406
|
+
const [view, setView] = useState12(initialView);
|
|
3407
|
+
const [currentDate, setCurrentDate] = useState12(dayjs7());
|
|
3408
|
+
const handleViewChange = (newView) => {
|
|
3409
|
+
setView(newView);
|
|
3410
|
+
onViewChange == null ? void 0 : onViewChange(newView);
|
|
3411
|
+
};
|
|
3412
|
+
const handleNavigate = (action) => {
|
|
3413
|
+
let newDate = currentDate;
|
|
3414
|
+
const unit = view === "month" ? "month" : "day";
|
|
3415
|
+
if (action === "PREV") newDate = currentDate.subtract(1, unit);
|
|
3416
|
+
else if (action === "NEXT") newDate = currentDate.add(1, unit);
|
|
3417
|
+
else if (action === "TODAY") newDate = dayjs7();
|
|
3418
|
+
setCurrentDate(newDate);
|
|
3419
|
+
};
|
|
3420
|
+
return /* @__PURE__ */ React25.createElement(Box19, null, /* @__PURE__ */ React25.createElement(
|
|
3421
|
+
CalendarToolbar,
|
|
3422
|
+
{
|
|
3423
|
+
labelDate: currentDate,
|
|
3424
|
+
view,
|
|
3425
|
+
onView: handleViewChange,
|
|
3426
|
+
onNavigate: handleNavigate
|
|
3427
|
+
},
|
|
3428
|
+
toolbar
|
|
3429
|
+
), isLoading ? /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(Box19, null, /* @__PURE__ */ React25.createElement(
|
|
3430
|
+
Box19,
|
|
3431
|
+
{
|
|
3432
|
+
display: "flex",
|
|
3433
|
+
justifyContent: "center",
|
|
3434
|
+
alignItems: "center",
|
|
3435
|
+
height: "400px"
|
|
3436
|
+
},
|
|
3437
|
+
/* @__PURE__ */ React25.createElement(CircularProgress4, { variant: "indeterminate" })
|
|
3438
|
+
))) : /* @__PURE__ */ React25.createElement(React25.Fragment, null, view === "month" && /* @__PURE__ */ React25.createElement(
|
|
3439
|
+
MonthView,
|
|
3440
|
+
{
|
|
3441
|
+
events,
|
|
3442
|
+
currentDate,
|
|
3443
|
+
onDayClick,
|
|
3444
|
+
onMoreClick,
|
|
3445
|
+
onEventClick,
|
|
3446
|
+
onEventHover
|
|
3447
|
+
}
|
|
3448
|
+
), view === "week" && /* @__PURE__ */ React25.createElement(
|
|
3449
|
+
WeekView,
|
|
3450
|
+
{
|
|
3451
|
+
events,
|
|
3452
|
+
currentDate,
|
|
3453
|
+
onDayClick,
|
|
3454
|
+
onMoreClick,
|
|
3455
|
+
onEventClick,
|
|
3456
|
+
onEventHover,
|
|
3457
|
+
startHour,
|
|
3458
|
+
endHour
|
|
3459
|
+
}
|
|
3460
|
+
), view === "day" && /* @__PURE__ */ React25.createElement(
|
|
3461
|
+
DayView,
|
|
3462
|
+
{
|
|
3463
|
+
events,
|
|
3464
|
+
currentDate,
|
|
3465
|
+
onEventClick,
|
|
3466
|
+
onEventHover,
|
|
3467
|
+
startHour,
|
|
3468
|
+
endHour
|
|
3469
|
+
}
|
|
3470
|
+
)));
|
|
3471
|
+
};
|
|
3472
|
+
|
|
3473
|
+
// src/Components/SCTime.tsx
|
|
3474
|
+
import React26, { useState as useState13 } from "react";
|
|
3475
|
+
import { Box as Box20, InputAdornment as InputAdornment6, Popover as Popover5, ClickAwayListener } from "@mui/material";
|
|
3476
|
+
import { LocalizationProvider as LocalizationProvider3 } from "@mui/x-date-pickers/LocalizationProvider";
|
|
3477
|
+
import { AdapterDayjs as AdapterDayjs2 } from "@mui/x-date-pickers/AdapterDayjs";
|
|
3478
|
+
import dayjs8 from "dayjs";
|
|
3479
|
+
import "dayjs/locale/es";
|
|
3480
|
+
import { LicenseInfo as LicenseInfo3 } from "@mui/x-license-pro";
|
|
3481
|
+
import AccessTimeIcon from "@mui/icons-material/AccessTime";
|
|
3482
|
+
import { TimeField } from "@mui/x-date-pickers/TimeField";
|
|
3483
|
+
import { DigitalClock } from "@mui/x-date-pickers/DigitalClock";
|
|
3484
|
+
var SCTime = ({
|
|
3485
|
+
label = "Hora",
|
|
3486
|
+
required = false,
|
|
3487
|
+
disabled = false,
|
|
3488
|
+
background = "transparent",
|
|
3489
|
+
timeStep = 5,
|
|
3490
|
+
state,
|
|
3491
|
+
setState
|
|
3492
|
+
}) => {
|
|
3493
|
+
LicenseInfo3.setLicenseKey(
|
|
3494
|
+
"77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
|
|
3495
|
+
);
|
|
3496
|
+
const isTimeEmpty = required && !state;
|
|
3497
|
+
const hasError = isTimeEmpty;
|
|
3498
|
+
const [anchorEl, setAnchorEl] = useState13(null);
|
|
3499
|
+
const [isOpenPopover, setIsOpenPopover] = useState13(false);
|
|
3500
|
+
const [popoverPlacement, setPopoverPlacement] = useState13("bottom");
|
|
3501
|
+
const detectPlacement = (element) => {
|
|
3502
|
+
const rect = element.getBoundingClientRect();
|
|
3503
|
+
const windowHeight = window.innerHeight;
|
|
3504
|
+
const spaceBelow = windowHeight - rect.bottom;
|
|
3505
|
+
const spaceAbove = rect.top;
|
|
3506
|
+
const popoverHeight = 300;
|
|
3507
|
+
if (spaceBelow < popoverHeight && spaceAbove > spaceBelow) {
|
|
3508
|
+
setPopoverPlacement("top");
|
|
3509
|
+
} else {
|
|
3510
|
+
setPopoverPlacement("bottom");
|
|
3511
|
+
}
|
|
3512
|
+
};
|
|
3513
|
+
const handleTimeFieldClick = (event2) => {
|
|
3514
|
+
if (!disabled) {
|
|
3515
|
+
const target = event2.currentTarget;
|
|
3516
|
+
setAnchorEl(target);
|
|
3517
|
+
detectPlacement(target);
|
|
3518
|
+
setIsOpenPopover(true);
|
|
3519
|
+
}
|
|
3520
|
+
};
|
|
3521
|
+
const handleTimeChange = (newValue) => {
|
|
3522
|
+
const dayjsValue = newValue ? dayjs8(newValue) : null;
|
|
3523
|
+
setState(dayjsValue);
|
|
3524
|
+
setIsOpenPopover(false);
|
|
3525
|
+
setAnchorEl(null);
|
|
3526
|
+
};
|
|
3527
|
+
const handleClose = () => {
|
|
3528
|
+
setIsOpenPopover(false);
|
|
3529
|
+
setAnchorEl(null);
|
|
3530
|
+
};
|
|
3531
|
+
return /* @__PURE__ */ React26.createElement(LocalizationProvider3, { dateAdapter: AdapterDayjs2 }, /* @__PURE__ */ React26.createElement(Box20, { sx: { position: "relative", width: "120px" } }, /* @__PURE__ */ React26.createElement(
|
|
3532
|
+
TimeField,
|
|
3533
|
+
{
|
|
3534
|
+
label,
|
|
3535
|
+
value: state,
|
|
3536
|
+
disabled,
|
|
3537
|
+
required,
|
|
3538
|
+
error: hasError,
|
|
3539
|
+
onClick: handleTimeFieldClick,
|
|
3540
|
+
slotProps: {
|
|
3541
|
+
textField: {
|
|
3542
|
+
InputProps: {
|
|
3543
|
+
endAdornment: /* @__PURE__ */ React26.createElement(InputAdornment6, { position: "end" }, /* @__PURE__ */ React26.createElement(
|
|
3544
|
+
AccessTimeIcon,
|
|
3545
|
+
{
|
|
3546
|
+
color: disabled ? "disabled" : "action",
|
|
3547
|
+
sx: { cursor: disabled ? "default" : "pointer" },
|
|
3548
|
+
fontSize: "small"
|
|
3549
|
+
}
|
|
3550
|
+
)),
|
|
3551
|
+
sx: {
|
|
3552
|
+
backgroundColor: background,
|
|
3553
|
+
padding: "8px 12px",
|
|
3554
|
+
cursor: disabled ? "default" : "pointer",
|
|
3555
|
+
"& input": {
|
|
3556
|
+
cursor: disabled ? "default" : "pointer"
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
},
|
|
3562
|
+
sx: {
|
|
3563
|
+
width: "100%",
|
|
3564
|
+
"& .MuiInputBase-input": {
|
|
3565
|
+
cursor: disabled ? "default" : "pointer"
|
|
3566
|
+
},
|
|
3567
|
+
"& .MuiPickersSectionList-root": {
|
|
3568
|
+
padding: "0px !important"
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
), /* @__PURE__ */ React26.createElement(
|
|
3573
|
+
Popover5,
|
|
3574
|
+
{
|
|
3575
|
+
open: isOpenPopover,
|
|
3576
|
+
anchorEl,
|
|
3577
|
+
onClose: handleClose,
|
|
3578
|
+
anchorOrigin: {
|
|
3579
|
+
vertical: popoverPlacement === "top" ? "top" : "bottom",
|
|
3580
|
+
horizontal: "left"
|
|
3581
|
+
},
|
|
3582
|
+
transformOrigin: {
|
|
3583
|
+
vertical: popoverPlacement === "top" ? "bottom" : "top",
|
|
3584
|
+
horizontal: "left"
|
|
3585
|
+
},
|
|
3586
|
+
marginThreshold: 0,
|
|
3587
|
+
disableScrollLock: true,
|
|
3588
|
+
slotProps: {
|
|
3589
|
+
paper: {
|
|
3590
|
+
sx: {
|
|
3591
|
+
boxShadow: "0px 4px 20px rgba(0, 0, 0, 0.1)",
|
|
3592
|
+
borderRadius: 1,
|
|
3593
|
+
border: "1px solid #e0e0e0",
|
|
3594
|
+
maxHeight: "300px",
|
|
3595
|
+
overflow: "visible"
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
},
|
|
3600
|
+
/* @__PURE__ */ React26.createElement(ClickAwayListener, { onClickAway: handleClose }, /* @__PURE__ */ React26.createElement(Box20, { sx: { p: 0 } }, /* @__PURE__ */ React26.createElement(
|
|
3601
|
+
DigitalClock,
|
|
3602
|
+
{
|
|
3603
|
+
value: state,
|
|
3604
|
+
onChange: handleTimeChange,
|
|
3605
|
+
timeStep,
|
|
3606
|
+
sx: {
|
|
3607
|
+
"& .MuiList-root": {
|
|
3608
|
+
maxHeight: "250px",
|
|
3609
|
+
overflow: "auto"
|
|
3610
|
+
},
|
|
3611
|
+
"& .MuiMenuItem-root": {
|
|
3612
|
+
fontSize: "0.875rem",
|
|
3613
|
+
py: 0.5
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
)))
|
|
3618
|
+
)));
|
|
2543
3619
|
};
|
|
2544
3620
|
|
|
2545
3621
|
// src/Theme/index.ts
|
|
2546
3622
|
import { createTheme } from "@mui/material/styles";
|
|
2547
3623
|
|
|
2548
3624
|
// src/Theme/components.ts
|
|
2549
|
-
import
|
|
3625
|
+
import React27 from "react";
|
|
2550
3626
|
import {
|
|
2551
3627
|
InfoRounded as InfoRounded2,
|
|
2552
3628
|
CheckCircleRounded as CheckCircleRounded2,
|
|
@@ -3249,10 +4325,10 @@ var components = {
|
|
|
3249
4325
|
MuiAlert: {
|
|
3250
4326
|
defaultProps: {
|
|
3251
4327
|
iconMapping: {
|
|
3252
|
-
success:
|
|
3253
|
-
error:
|
|
3254
|
-
warning:
|
|
3255
|
-
info:
|
|
4328
|
+
success: React27.createElement(CheckCircleRounded2),
|
|
4329
|
+
error: React27.createElement(ErrorRounded2),
|
|
4330
|
+
warning: React27.createElement(WarningRounded2),
|
|
4331
|
+
info: React27.createElement(InfoRounded2)
|
|
3256
4332
|
}
|
|
3257
4333
|
},
|
|
3258
4334
|
variants: [
|
|
@@ -4293,6 +5369,7 @@ var ADCSincoTheme = createTheme(__spreadValues({}, ADCTheme));
|
|
|
4293
5369
|
export {
|
|
4294
5370
|
ADCSincoTheme,
|
|
4295
5371
|
AdproSincoTheme,
|
|
5372
|
+
Calendar,
|
|
4296
5373
|
EmptyState,
|
|
4297
5374
|
FooterAction,
|
|
4298
5375
|
MultiSelect,
|
|
@@ -4310,6 +5387,7 @@ export {
|
|
|
4310
5387
|
SCTabs,
|
|
4311
5388
|
SCTextArea,
|
|
4312
5389
|
SCTextField,
|
|
5390
|
+
SCTime,
|
|
4313
5391
|
SCToastNotification,
|
|
4314
5392
|
SincoTheme,
|
|
4315
5393
|
ToastProgress,
|