componentes-sinco 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1622 -1562
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1599 -1539
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -846,7 +846,7 @@ var Attachment = ({
|
|
|
846
846
|
};
|
|
847
847
|
|
|
848
848
|
// src/Components/Adjuntar/mobile/AdjuntarMobile.tsx
|
|
849
|
-
var
|
|
849
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
850
850
|
var import_react_webcam = __toESM(require("react-webcam"), 1);
|
|
851
851
|
|
|
852
852
|
// src/Components/Adjuntar/mobile/components/button.tsx
|
|
@@ -897,1214 +897,616 @@ var AttachmentButton = ({ buttonAttachment, open, setOpen }) => {
|
|
|
897
897
|
};
|
|
898
898
|
|
|
899
899
|
// src/Components/Adjuntar/mobile/AdjuntarMobile.tsx
|
|
900
|
-
var
|
|
900
|
+
var import_material16 = require("@mui/material");
|
|
901
901
|
var import_CssBaseline = __toESM(require("@mui/material/CssBaseline"), 1);
|
|
902
902
|
var import_system = require("@mui/system");
|
|
903
|
-
var
|
|
903
|
+
var import_icons_material10 = require("@mui/icons-material");
|
|
904
904
|
var import_PhotoCamera = __toESM(require("@mui/icons-material/PhotoCamera"), 1);
|
|
905
905
|
var import_CancelOutlined = __toESM(require("@mui/icons-material/CancelOutlined"), 1);
|
|
906
906
|
var import_ImageOutlined = __toESM(require("@mui/icons-material/ImageOutlined"), 1);
|
|
907
907
|
var import_FileDownloadOutlined = __toESM(require("@mui/icons-material/FileDownloadOutlined"), 1);
|
|
908
|
+
var Muicon6 = __toESM(require("@mui/icons-material"), 1);
|
|
909
|
+
|
|
910
|
+
// src/Components/Drawer/SCDrawer.tsx
|
|
911
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
912
|
+
var import_material15 = require("@mui/material");
|
|
913
|
+
var import_Grid4 = __toESM(require("@mui/material/Grid"), 1);
|
|
914
|
+
|
|
915
|
+
// src/Components/Drawer/Helpers/Utils.tsx
|
|
908
916
|
var Muicon2 = __toESM(require("@mui/icons-material"), 1);
|
|
909
|
-
var
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
917
|
+
var getIcon = (iconName) => {
|
|
918
|
+
if (iconName && iconName in Muicon2) {
|
|
919
|
+
return Muicon2[iconName];
|
|
920
|
+
}
|
|
921
|
+
return null;
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
// src/Components/Drawer/Helpers/validateInput.tsx
|
|
925
|
+
var validateInputs = (arrayElements, onError, onSuccess, setChipFilters, setTextFilters) => {
|
|
926
|
+
var _a, _b;
|
|
927
|
+
let requiredValues = 0;
|
|
928
|
+
let filledValues = 0;
|
|
929
|
+
for (let i = 0; i < arrayElements.length; i++) {
|
|
930
|
+
const element = arrayElements[i];
|
|
931
|
+
const { validation, element: typeElement } = validateTypeElements(element);
|
|
932
|
+
const textValue = ((_a = typeElement.state) == null ? void 0 : _a.textValue) !== void 0 ? String((_b = typeElement.state) == null ? void 0 : _b.textValue) : String(typeElement.state);
|
|
933
|
+
if (typeElement == null ? void 0 : typeElement.required) {
|
|
934
|
+
requiredValues++;
|
|
935
|
+
if (textValue.trim() !== "" && textValue.trim() !== ",") {
|
|
936
|
+
filledValues++;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
if (requiredValues === filledValues) {
|
|
941
|
+
onSuccess();
|
|
942
|
+
setChipFilters(true);
|
|
943
|
+
} else {
|
|
944
|
+
onError({
|
|
945
|
+
type: "error",
|
|
946
|
+
title: "Algunos campos son requeridos",
|
|
947
|
+
time: 10
|
|
948
|
+
});
|
|
949
|
+
setChipFilters(false);
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
// src/Components/Drawer/Helpers/validateTypeElement.tsx
|
|
954
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
955
|
+
var COMPONENT_NAME_MAP = {
|
|
956
|
+
SCtextField: "textField",
|
|
957
|
+
SCtextArea: "textArea",
|
|
958
|
+
SCDateRange: "dateRange",
|
|
959
|
+
SCDatePicker: "datePicker",
|
|
960
|
+
SCTime: "time",
|
|
961
|
+
SCAutocomplete: "autocomplete",
|
|
962
|
+
SCSelect: "select"
|
|
963
|
+
};
|
|
964
|
+
var getComponentName = (node) => {
|
|
965
|
+
const type = node.type;
|
|
966
|
+
return typeof type === "function" ? type.displayName || type.name || "" : "";
|
|
967
|
+
};
|
|
968
|
+
var isKnownComponent = (node) => {
|
|
969
|
+
var _a;
|
|
970
|
+
const name = getComponentName(node);
|
|
971
|
+
if (COMPONENT_NAME_MAP[name]) return true;
|
|
972
|
+
if (((_a = node.props) == null ? void 0 : _a.typeFormat) === "multiselect") return true;
|
|
973
|
+
return false;
|
|
974
|
+
};
|
|
975
|
+
var findInTree = (node) => {
|
|
976
|
+
var _a;
|
|
977
|
+
if (!import_react7.default.isValidElement(node)) return null;
|
|
978
|
+
if (isKnownComponent(node)) return node;
|
|
979
|
+
const children = (_a = node.props) == null ? void 0 : _a.children;
|
|
980
|
+
if (!children) return null;
|
|
981
|
+
for (const child of import_react7.default.Children.toArray(children)) {
|
|
982
|
+
if (import_react7.default.isValidElement(child)) {
|
|
983
|
+
const found = findInTree(child);
|
|
984
|
+
if (found) return found;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
return null;
|
|
988
|
+
};
|
|
989
|
+
var resolveValidation = (node) => {
|
|
990
|
+
var _a;
|
|
991
|
+
const name = getComponentName(node);
|
|
992
|
+
if (((_a = node.props) == null ? void 0 : _a.typeFormat) === "multiselect") return "multiselect";
|
|
993
|
+
return COMPONENT_NAME_MAP[name] || "";
|
|
994
|
+
};
|
|
995
|
+
var validateTypeElements = (element) => {
|
|
996
|
+
var _a;
|
|
997
|
+
let validation = "";
|
|
998
|
+
let typeElement = element;
|
|
999
|
+
if (element.type && COMPONENT_NAME_MAP[(_a = Object.keys(COMPONENT_NAME_MAP).find((k) => COMPONENT_NAME_MAP[k] === element.type)) != null ? _a : ""]) {
|
|
1000
|
+
validation = element.type;
|
|
1001
|
+
typeElement = element;
|
|
1002
|
+
} else if (element.typeFormat === "multiselect") {
|
|
1003
|
+
validation = "multiselect";
|
|
1004
|
+
typeElement = element;
|
|
1005
|
+
} else if (import_react7.default.isValidElement(element == null ? void 0 : element.component) && isKnownComponent(element.component)) {
|
|
1006
|
+
const node = element.component;
|
|
1007
|
+
validation = resolveValidation(node);
|
|
1008
|
+
typeElement = node.props;
|
|
1009
|
+
} else if (import_react7.default.isValidElement(element == null ? void 0 : element.component)) {
|
|
1010
|
+
const found = findInTree(element.component);
|
|
1011
|
+
if (found) {
|
|
1012
|
+
validation = resolveValidation(found);
|
|
1013
|
+
typeElement = found.props;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
return { validation, element: typeElement };
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
// src/Components/Drawer/hooks/useDrawerState.ts
|
|
1020
|
+
var import_react8 = require("react");
|
|
1021
|
+
var useDrawerState = ({ open, setOpen }) => {
|
|
1022
|
+
const [drawerOpen, setDrawerOpen] = (0, import_react8.useState)(open || false);
|
|
1023
|
+
(0, import_react8.useEffect)(() => {
|
|
1024
|
+
if (open !== void 0) {
|
|
1025
|
+
setDrawerOpen(open);
|
|
1026
|
+
}
|
|
1027
|
+
}, [open]);
|
|
1028
|
+
const handleDrawerClose = () => {
|
|
1029
|
+
setDrawerOpen(false);
|
|
1030
|
+
setOpen == null ? void 0 : setOpen(false);
|
|
931
1031
|
};
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1032
|
+
const handleDrawerOpen = () => {
|
|
1033
|
+
setDrawerOpen(true);
|
|
1034
|
+
setOpen == null ? void 0 : setOpen(true);
|
|
1035
|
+
};
|
|
1036
|
+
const toggleDrawer = (newOpen) => () => {
|
|
1037
|
+
if (newOpen) {
|
|
1038
|
+
handleDrawerOpen();
|
|
936
1039
|
} else {
|
|
937
|
-
|
|
1040
|
+
handleDrawerClose();
|
|
938
1041
|
}
|
|
939
|
-
}
|
|
940
|
-
const closeCam = () => {
|
|
941
|
-
setAbrirCamara(false);
|
|
942
1042
|
};
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1043
|
+
return {
|
|
1044
|
+
drawerOpen,
|
|
1045
|
+
handleDrawerClose,
|
|
1046
|
+
handleDrawerOpen,
|
|
1047
|
+
toggleDrawer
|
|
946
1048
|
};
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
// src/Components/Drawer/hooks/useChipFilters.ts
|
|
1052
|
+
var import_react9 = require("react");
|
|
1053
|
+
var useChipFilters = (arrayElements, chipFilters) => {
|
|
1054
|
+
const [stateChipFilters, setChipFilters] = (0, import_react9.useState)(false);
|
|
1055
|
+
const [textFilters, setTextFilters] = (0, import_react9.useState)([]);
|
|
1056
|
+
(0, import_react9.useEffect)(() => {
|
|
1057
|
+
if (chipFilters == null ? void 0 : chipFilters.length) {
|
|
1058
|
+
setTextFilters([]);
|
|
1059
|
+
processChipFilters();
|
|
957
1060
|
}
|
|
958
|
-
}, [
|
|
959
|
-
const
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
if (capturedImage || capturedImage2) {
|
|
964
|
-
const image = capturedImage || capturedImage2;
|
|
965
|
-
if (!image) return;
|
|
966
|
-
const arr = image.split(",");
|
|
967
|
-
const mime = ((_a = arr[0].match(/:(.*?);/)) == null ? void 0 : _a[1]) || "image/jpeg";
|
|
968
|
-
const bstr = atob(arr[1]);
|
|
969
|
-
let n = bstr.length;
|
|
970
|
-
const u8arr = new Uint8Array(n);
|
|
971
|
-
while (n--) {
|
|
972
|
-
u8arr[n] = bstr.charCodeAt(n);
|
|
973
|
-
}
|
|
974
|
-
const fechaActual = new Date(Date.now());
|
|
975
|
-
const fechaConFormato = fechaActual.getFullYear() + "" + (fechaActual.getMonth() + 1) + fechaActual.getDate() + fechaActual.getHours() + fechaActual.getMinutes() + fechaActual.getSeconds();
|
|
976
|
-
const capturedFile = new File([u8arr], `photo_${fechaConFormato}.jpg`, { type: mime });
|
|
977
|
-
newFiles = [capturedFile];
|
|
978
|
-
setCapturedImage(null);
|
|
979
|
-
capturedImage2 = null;
|
|
1061
|
+
}, [chipFilters]);
|
|
1062
|
+
const processChipFilters = () => {
|
|
1063
|
+
if (!(chipFilters == null ? void 0 : chipFilters.length)) {
|
|
1064
|
+
processManualFilters();
|
|
1065
|
+
return;
|
|
980
1066
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
|
-
if (sizeMB > maxSize) {
|
|
1000
|
-
nuevosArchivos.push({
|
|
1001
|
-
name: file.name,
|
|
1002
|
-
size: file.size,
|
|
1003
|
-
type: file.type,
|
|
1004
|
-
progress: 0,
|
|
1005
|
-
uploadError: true
|
|
1006
|
-
});
|
|
1007
|
-
setToast({
|
|
1008
|
-
type: "error",
|
|
1009
|
-
title: "Carga fallida",
|
|
1010
|
-
seeMore: true,
|
|
1011
|
-
listITems: [`El archivo "${file.name}" supera el l\xEDmite de ${maxSize}MB.`],
|
|
1012
|
-
time: 5
|
|
1067
|
+
arrayElements.forEach((arrayElement) => {
|
|
1068
|
+
var _a;
|
|
1069
|
+
const { validation, element: typeElement } = validateTypeElements(arrayElement);
|
|
1070
|
+
if (Array.isArray((_a = typeElement.state) == null ? void 0 : _a.textValue)) {
|
|
1071
|
+
chipFilters.forEach((chipFilter) => {
|
|
1072
|
+
const chipValue = String(chipFilter).trim();
|
|
1073
|
+
const isInArray = typeElement.state.textValue.some(
|
|
1074
|
+
(v) => String(v).trim() === chipValue
|
|
1075
|
+
);
|
|
1076
|
+
if (isInArray && chipValue !== "" && chipValue !== ",") {
|
|
1077
|
+
setTextFilters((prev) => {
|
|
1078
|
+
const exists = prev.findIndex((f) => f.value === chipValue) !== -1;
|
|
1079
|
+
if (exists) return prev;
|
|
1080
|
+
return [...prev, { value: chipValue, arrayElement: typeElement }];
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1013
1083
|
});
|
|
1014
1084
|
return;
|
|
1015
1085
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
setToast({
|
|
1023
|
-
type: "error",
|
|
1024
|
-
title: "Tipo de archivo no permitido",
|
|
1025
|
-
listITems: [`El archivo "${file.name}" no es un tipo permitido.`],
|
|
1026
|
-
seeMore: true,
|
|
1027
|
-
time: 5
|
|
1028
|
-
});
|
|
1029
|
-
return;
|
|
1030
|
-
}
|
|
1031
|
-
nuevosArchivos.push({
|
|
1032
|
-
name: file.name,
|
|
1033
|
-
size: file.size,
|
|
1034
|
-
type: file.type,
|
|
1035
|
-
progress: 0,
|
|
1036
|
-
uploadError: false
|
|
1086
|
+
const currentValue = getCurrentValue(validation, typeElement);
|
|
1087
|
+
chipFilters.forEach((chipFilter) => {
|
|
1088
|
+
const chipValue = String(chipFilter).trim();
|
|
1089
|
+
if (currentValue === chipValue && currentValue !== "" && currentValue !== ",") {
|
|
1090
|
+
updateFilter(currentValue, typeElement, arrayElement.label);
|
|
1091
|
+
}
|
|
1037
1092
|
});
|
|
1038
|
-
archivosValidos.push(file);
|
|
1039
1093
|
});
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1094
|
+
};
|
|
1095
|
+
const processManualFilters = () => {
|
|
1096
|
+
const newFiltersToAdd = [];
|
|
1097
|
+
arrayElements.forEach((element) => {
|
|
1098
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1099
|
+
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1100
|
+
const textValue = ((_a = typeElement.state) == null ? void 0 : _a.textValue) !== void 0 ? String((_b = typeElement.state) == null ? void 0 : _b.textValue) : String(typeElement.state);
|
|
1101
|
+
if (textValue.trim() !== "" && textValue.trim() !== "," && textValue.trim() !== "undefined") {
|
|
1102
|
+
const value = validation === "dateRange" ? `${(_c = typeElement.state[0]) == null ? void 0 : _c.format("DD/MM/YYYY")} - ${(_d = typeElement.state[1]) == null ? void 0 : _d.format("DD/MM/YYYY")}` : validation === "datePicker" ? (_f = (_e = typeElement.state) == null ? void 0 : _e.format("DD/MM/YYYY")) != null ? _f : "" : validation === "time" ? (_h = (_g = typeElement.state) == null ? void 0 : _g.format("HH:mm")) != null ? _h : "" : textValue;
|
|
1103
|
+
const existingFilterIndex = newFiltersToAdd.findIndex(
|
|
1104
|
+
(filter) => filter.arrayElement.label === element.label
|
|
1105
|
+
);
|
|
1106
|
+
const newFilter = { value, arrayElement: typeElement };
|
|
1107
|
+
if (existingFilterIndex !== -1) {
|
|
1108
|
+
newFiltersToAdd[existingFilterIndex] = newFilter;
|
|
1109
|
+
} else {
|
|
1110
|
+
newFiltersToAdd.push(newFilter);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
setTextFilters((prevFilters) => {
|
|
1115
|
+
let updatedFilters = [...prevFilters];
|
|
1116
|
+
newFiltersToAdd.forEach((newFilter) => {
|
|
1117
|
+
const existingFilterIndex = updatedFilters.findIndex(
|
|
1118
|
+
(filter) => filter.arrayElement.label === newFilter.arrayElement.label
|
|
1119
|
+
);
|
|
1120
|
+
if (existingFilterIndex !== -1) {
|
|
1121
|
+
updatedFilters[existingFilterIndex] = newFilter;
|
|
1122
|
+
} else {
|
|
1123
|
+
updatedFilters.push(newFilter);
|
|
1048
1124
|
}
|
|
1049
|
-
return updatedFiles;
|
|
1050
1125
|
});
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
event2.target.value = "";
|
|
1126
|
+
return updatedFilters;
|
|
1127
|
+
});
|
|
1054
1128
|
};
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
const updatedFiles = files.filter(
|
|
1061
|
-
(file) => !(file.name === fileToRemove.name && file.size === fileToRemove.size)
|
|
1062
|
-
);
|
|
1063
|
-
setFiles(updatedFiles);
|
|
1064
|
-
if (onChange) {
|
|
1065
|
-
const remainingValidFiles = updatedFiles.filter((f) => !f.uploadError).map((f) => new File([], f.name, { type: f.type }));
|
|
1066
|
-
onChange(remainingValidFiles);
|
|
1129
|
+
const getCurrentValue = (validation, typeElement) => {
|
|
1130
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1131
|
+
if (validation === "dateRange") {
|
|
1132
|
+
if (((_a = typeElement.state) == null ? void 0 : _a[0]) && ((_b = typeElement.state) == null ? void 0 : _b[1])) {
|
|
1133
|
+
return `${(_c = typeElement.state[0]) == null ? void 0 : _c.format("DD/MM/YYYY")} - ${(_d = typeElement.state[1]) == null ? void 0 : _d.format("DD/MM/YYYY")}`;
|
|
1067
1134
|
}
|
|
1068
|
-
|
|
1069
|
-
type: "success",
|
|
1070
|
-
title: "Archivo eliminado",
|
|
1071
|
-
listITems: [`El archivo "${fileToRemove.name}" ha sido eliminado exitosamente.`],
|
|
1072
|
-
seeMore: true,
|
|
1073
|
-
time: 3
|
|
1074
|
-
});
|
|
1075
|
-
} catch (error) {
|
|
1076
|
-
setToast({
|
|
1077
|
-
type: "error",
|
|
1078
|
-
title: "Error al eliminar",
|
|
1079
|
-
listITems: [`No se pudo eliminar el archivo "${fileToRemove.name}".`],
|
|
1080
|
-
seeMore: true,
|
|
1081
|
-
time: 5
|
|
1082
|
-
});
|
|
1135
|
+
return "";
|
|
1083
1136
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
{ icon: /* @__PURE__ */ import_react7.default.createElement(import_ImageOutlined.default, { type: "file", color: "primary" }), color: "primary", label: "Galer\xEDa", onClick: () => {
|
|
1087
|
-
var _a;
|
|
1088
|
-
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
1089
|
-
} },
|
|
1090
|
-
{ icon: /* @__PURE__ */ import_react7.default.createElement(import_icons_material7.PhotoCameraOutlined, { type: "file", color: "success" }), color: "success", label: "C\xE1mara", onClick: () => openCam() },
|
|
1091
|
-
{ icon: /* @__PURE__ */ import_react7.default.createElement(import_icons_material7.FolderOpenOutlined, { type: "file", color: "warning" }), color: "warning", label: "Archivos", onClick: () => {
|
|
1092
|
-
var _a;
|
|
1093
|
-
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
1094
|
-
} }
|
|
1095
|
-
];
|
|
1096
|
-
(0, import_react7.useEffect)(() => {
|
|
1097
|
-
if (initialFiles && initialFiles.length > 0) {
|
|
1098
|
-
setFiles(initialFiles);
|
|
1137
|
+
if (validation === "datePicker") {
|
|
1138
|
+
return ((_f = (_e = typeElement.state) == null ? void 0 : _e.isValid) == null ? void 0 : _f.call(_e)) ? typeElement.state.format("DD/MM/YYYY") : "";
|
|
1099
1139
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
AttachmentButton,
|
|
1103
|
-
{
|
|
1104
|
-
buttonAttachment,
|
|
1105
|
-
open,
|
|
1106
|
-
setOpen
|
|
1140
|
+
if (validation === "time") {
|
|
1141
|
+
return ((_h = (_g = typeElement.state) == null ? void 0 : _g.isValid) == null ? void 0 : _h.call(_g)) ? typeElement.state.format("HH:mm") : "";
|
|
1107
1142
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
},
|
|
1123
|
-
BackdropProps: { timeout: 400 }
|
|
1124
|
-
},
|
|
1125
|
-
transitionDuration: { enter: 500, exit: 400 },
|
|
1126
|
-
hysteresis: 0.2,
|
|
1127
|
-
anchor: "bottom",
|
|
1128
|
-
swipeAreaWidth: 56,
|
|
1129
|
-
open,
|
|
1130
|
-
onClose: toggleAttachment(false),
|
|
1131
|
-
onOpen: toggleAttachment(true)
|
|
1132
|
-
},
|
|
1133
|
-
toast && /* @__PURE__ */ import_react7.default.createElement(SCToastNotification, __spreadValues({}, toast)),
|
|
1134
|
-
/* @__PURE__ */ import_react7.default.createElement(import_system.Box, { display: "flex", flexDirection: "column", alignItems: "center", p: 2, gap: 2 }, /* @__PURE__ */ import_react7.default.createElement(import_system.Box, { display: "flex", width: "100%", justifyContent: "space-between", alignItems: "center", gap: 1, p: 1 }, /* @__PURE__ */ import_react7.default.createElement(import_material5.Typography, { variant: "h6", color: "text.primary" }, "Agrega adjuntos"), /* @__PURE__ */ import_react7.default.createElement(import_material5.IconButton, { size: "medium", onClick: toggleAttachment(false) }, /* @__PURE__ */ import_react7.default.createElement(import_icons_material7.CloseOutlined, { color: "action" }))), /* @__PURE__ */ import_react7.default.createElement(
|
|
1135
|
-
"input",
|
|
1136
|
-
{
|
|
1137
|
-
type: "file",
|
|
1138
|
-
multiple: true,
|
|
1139
|
-
hidden: true,
|
|
1140
|
-
ref: inputRef,
|
|
1141
|
-
onChange: handleUpload
|
|
1143
|
+
return ((_i = typeElement.state) == null ? void 0 : _i.textValue) !== void 0 ? String(typeElement.state.textValue).trim() : String(typeElement.state).trim();
|
|
1144
|
+
};
|
|
1145
|
+
const updateFilter = (value, typeElement, label) => {
|
|
1146
|
+
setTextFilters((prevFilters) => {
|
|
1147
|
+
const newFilter = { value, arrayElement: typeElement };
|
|
1148
|
+
const existingFilterIndex = prevFilters.findIndex(
|
|
1149
|
+
(filter) => label !== void 0 ? filter.arrayElement.label === label : filter.value === value
|
|
1150
|
+
);
|
|
1151
|
+
if (existingFilterIndex !== -1) {
|
|
1152
|
+
const updatedFilters = [...prevFilters];
|
|
1153
|
+
updatedFilters[existingFilterIndex] = newFilter;
|
|
1154
|
+
return updatedFilters;
|
|
1155
|
+
} else {
|
|
1156
|
+
return [...prevFilters, newFilter];
|
|
1142
1157
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
p: 1,
|
|
1157
|
-
gap: 0.5,
|
|
1158
|
-
onClick: option.onClick,
|
|
1159
|
-
sx: {
|
|
1160
|
-
cursor: "pointer"
|
|
1161
|
-
}
|
|
1162
|
-
},
|
|
1163
|
-
/* @__PURE__ */ import_react7.default.createElement(
|
|
1164
|
-
import_material5.IconButton,
|
|
1165
|
-
{
|
|
1166
|
-
sx: {
|
|
1167
|
-
bgcolor: getAttachmentColor(option.color)
|
|
1168
|
-
},
|
|
1169
|
-
size: "large"
|
|
1170
|
-
},
|
|
1171
|
-
option.icon
|
|
1172
|
-
),
|
|
1173
|
-
/* @__PURE__ */ import_react7.default.createElement(import_material5.Typography, { variant: "body2", color: "text.secondary" }, option.label)
|
|
1174
|
-
))))
|
|
1175
|
-
), abrirCamara && /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement(import_CancelOutlined.default, { onClick: closeCam, sx: { borderRadius: "50px", height: "35px", width: "35px", zIndex: 1700, background: "white", position: "absolute", left: `calc(100% - 50px)`, bottom: `calc(100% - 50px)` } }), /* @__PURE__ */ import_react7.default.createElement(import_material5.Stack, { className: "camras" }, /* @__PURE__ */ import_react7.default.createElement(
|
|
1176
|
-
import_react_webcam.default,
|
|
1177
|
-
{
|
|
1178
|
-
audio: false,
|
|
1179
|
-
ref: webcamRef,
|
|
1180
|
-
width: "100%",
|
|
1181
|
-
height: "100%",
|
|
1182
|
-
screenshotFormat: "image/jpeg",
|
|
1183
|
-
videoConstraints: {
|
|
1184
|
-
//facingMode: { exact: "environment" }
|
|
1185
|
-
facingMode: "environment"
|
|
1186
|
-
//facingMode: "environment" // cámara trasera
|
|
1187
|
-
},
|
|
1188
|
-
style: {
|
|
1189
|
-
position: "fixed",
|
|
1190
|
-
// Fijo para cubrir toda la ventana
|
|
1191
|
-
top: 0,
|
|
1192
|
-
left: 0,
|
|
1193
|
-
objectFit: "cover",
|
|
1194
|
-
backgroundColor: "black",
|
|
1195
|
-
zIndex: 1600
|
|
1196
|
-
// Encima de todo
|
|
1158
|
+
});
|
|
1159
|
+
};
|
|
1160
|
+
const hasActiveFilters = () => {
|
|
1161
|
+
return arrayElements.some((arrayElement) => {
|
|
1162
|
+
var _a, _b, _c;
|
|
1163
|
+
const { validation, element: typeElement } = validateTypeElements(arrayElement);
|
|
1164
|
+
if (((_a = typeElement.state) == null ? void 0 : _a.textValue) !== void 0) {
|
|
1165
|
+
return String(typeElement.state.textValue).trim() !== "";
|
|
1166
|
+
} else if (validation === "dateRange") {
|
|
1167
|
+
return ((_b = typeElement.state) == null ? void 0 : _b[0]) !== null && ((_c = typeElement.state) == null ? void 0 : _c[1]) !== null;
|
|
1168
|
+
} else {
|
|
1169
|
+
const stateValue = String(typeElement.state).trim();
|
|
1170
|
+
return stateValue !== "" && stateValue !== "," && stateValue !== "undefined";
|
|
1197
1171
|
}
|
|
1198
|
-
}
|
|
1199
|
-
), /* @__PURE__ */ import_react7.default.createElement(
|
|
1200
|
-
import_PhotoCamera.default,
|
|
1201
|
-
{
|
|
1202
|
-
onClick: capture,
|
|
1203
|
-
sx: {
|
|
1204
|
-
height: "45px",
|
|
1205
|
-
width: "45px",
|
|
1206
|
-
padding: "6px",
|
|
1207
|
-
backgroundColor: "white",
|
|
1208
|
-
color: "#1E62A1",
|
|
1209
|
-
borderRadius: "50px",
|
|
1210
|
-
zIndex: 1700,
|
|
1211
|
-
position: "absolute",
|
|
1212
|
-
bottom: "10px",
|
|
1213
|
-
left: "50%"
|
|
1214
|
-
},
|
|
1215
|
-
fontSize: "medium"
|
|
1216
|
-
}
|
|
1217
|
-
))), files.length > 0 && /* @__PURE__ */ import_react7.default.createElement(
|
|
1218
|
-
import_material5.Stack,
|
|
1219
|
-
{
|
|
1220
|
-
"data-testid": "ContenedorArchivosAdjuntos",
|
|
1221
|
-
id: "ContenedorArchivosAdjuntos",
|
|
1222
|
-
width: "100%",
|
|
1223
|
-
sx: __spreadValues({
|
|
1224
|
-
overflowY: "auto"
|
|
1225
|
-
}, files.length > 5 && {
|
|
1226
|
-
maxHeight: 250
|
|
1227
|
-
}),
|
|
1228
|
-
spacing: 1
|
|
1229
|
-
},
|
|
1230
|
-
files.map((file) => /* @__PURE__ */ import_react7.default.createElement(
|
|
1231
|
-
import_material5.Stack,
|
|
1232
|
-
{
|
|
1233
|
-
height: 46,
|
|
1234
|
-
key: file.name + (file.uploadError ? "_error" : ""),
|
|
1235
|
-
direction: "row",
|
|
1236
|
-
alignItems: "center",
|
|
1237
|
-
justifyContent: "space-between",
|
|
1238
|
-
gap: 2,
|
|
1239
|
-
padding: 1,
|
|
1240
|
-
borderRadius: 1,
|
|
1241
|
-
sx: {
|
|
1242
|
-
backgroundColor: file.uploadError ? "error.50" : "transparent",
|
|
1243
|
-
":hover": {
|
|
1244
|
-
backgroundColor: file.uploadError ? "error.100" : "primary.50"
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
},
|
|
1248
|
-
/* @__PURE__ */ import_react7.default.createElement(
|
|
1249
|
-
import_material5.Stack,
|
|
1250
|
-
{
|
|
1251
|
-
direction: "row",
|
|
1252
|
-
alignItems: "center",
|
|
1253
|
-
gap: 1,
|
|
1254
|
-
width: "100%",
|
|
1255
|
-
onClick: () => onFileClick == null ? void 0 : onFileClick(file),
|
|
1256
|
-
sx: { cursor: onFileClick ? "pointer" : "default" }
|
|
1257
|
-
},
|
|
1258
|
-
iconFileItem ? /* @__PURE__ */ import_react7.default.createElement(import_material5.SvgIcon, { color: file.uploadError ? "error" : "primary", fontSize: "small", component: IconFileItem }) : /* @__PURE__ */ import_react7.default.createElement(
|
|
1259
|
-
import_icons_material7.UploadFileOutlined,
|
|
1260
|
-
{
|
|
1261
|
-
color: file.uploadError ? "error" : "primary",
|
|
1262
|
-
fontSize: "small"
|
|
1263
|
-
}
|
|
1264
|
-
),
|
|
1265
|
-
/* @__PURE__ */ import_react7.default.createElement(import_material5.Stack, { width: "100%" }, /* @__PURE__ */ import_react7.default.createElement(
|
|
1266
|
-
import_material5.Typography,
|
|
1267
|
-
{
|
|
1268
|
-
variant: "body2",
|
|
1269
|
-
color: "text.primary",
|
|
1270
|
-
whiteSpace: "nowrap",
|
|
1271
|
-
overflow: "hidden",
|
|
1272
|
-
textOverflow: "ellipsis",
|
|
1273
|
-
maxWidth: "310px"
|
|
1274
|
-
},
|
|
1275
|
-
file.name
|
|
1276
|
-
), /* @__PURE__ */ import_react7.default.createElement(
|
|
1277
|
-
import_material5.Typography,
|
|
1278
|
-
{
|
|
1279
|
-
variant: "caption",
|
|
1280
|
-
color: file.uploadError ? "error" : "text.secondary"
|
|
1281
|
-
},
|
|
1282
|
-
file.uploadError && file.size / (1024 * 1024) > maxSize ? "Archivo super\xF3 el l\xEDmite \u2022 Carga fallida" : file.uploadError ? "Archivo duplicado o inv\xE1lido \u2022 Carga fallida" : `${(file.size / (1024 * 1024)).toFixed(2)}MB \u2022 ${file.type}`
|
|
1283
|
-
))
|
|
1284
|
-
),
|
|
1285
|
-
view == "file" ? /* @__PURE__ */ import_react7.default.createElement(import_material5.Tooltip, { title: "Descargar" }, /* @__PURE__ */ import_react7.default.createElement(
|
|
1286
|
-
import_material5.IconButton,
|
|
1287
|
-
{
|
|
1288
|
-
size: "small",
|
|
1289
|
-
onClick: () => downloadAction == null ? void 0 : downloadAction(file),
|
|
1290
|
-
disabled: file.uploadError,
|
|
1291
|
-
"aria-label": `Descargar ${file.name}`
|
|
1292
|
-
},
|
|
1293
|
-
/* @__PURE__ */ import_react7.default.createElement(import_FileDownloadOutlined.default, { fontSize: "small", color: "action" })
|
|
1294
|
-
)) : "",
|
|
1295
|
-
view == "button" ? /* @__PURE__ */ import_react7.default.createElement(import_material5.Tooltip, { title: "Eliminar" }, /* @__PURE__ */ import_react7.default.createElement(
|
|
1296
|
-
import_material5.IconButton,
|
|
1297
|
-
{
|
|
1298
|
-
size: "small",
|
|
1299
|
-
onClick: () => handleDeleteFile(file),
|
|
1300
|
-
"aria-label": `Eliminar ${file.name}`
|
|
1301
|
-
},
|
|
1302
|
-
/* @__PURE__ */ import_react7.default.createElement(import_icons_material7.DeleteOutline, { fontSize: "small", color: "action" })
|
|
1303
|
-
)) : ""
|
|
1304
|
-
))
|
|
1305
|
-
));
|
|
1306
|
-
};
|
|
1307
|
-
|
|
1308
|
-
// src/Components/Calendario/Calendar.tsx
|
|
1309
|
-
var import_react36 = __toESM(require("react"), 1);
|
|
1310
|
-
var import_material24 = require("@mui/material");
|
|
1311
|
-
|
|
1312
|
-
// src/Components/Calendario/CalendarToolbar.tsx
|
|
1313
|
-
var import_react8 = __toESM(require("react"), 1);
|
|
1314
|
-
var import_icons_material8 = require("@mui/icons-material");
|
|
1315
|
-
var import_material6 = require("@mui/material");
|
|
1316
|
-
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
1317
|
-
var import_updateLocale = __toESM(require("dayjs/plugin/updateLocale"), 1);
|
|
1318
|
-
var import_es = require("dayjs/locale/es");
|
|
1319
|
-
import_dayjs.default.locale("es");
|
|
1320
|
-
import_dayjs.default.extend(import_updateLocale.default);
|
|
1321
|
-
import_dayjs.default.updateLocale("en", {
|
|
1322
|
-
weekStart: 0
|
|
1323
|
-
// 0 = domingo
|
|
1324
|
-
});
|
|
1325
|
-
var CalendarToolbar = ({
|
|
1326
|
-
labelDate,
|
|
1327
|
-
view,
|
|
1328
|
-
onView,
|
|
1329
|
-
onNavigate,
|
|
1330
|
-
children
|
|
1331
|
-
}) => {
|
|
1332
|
-
const [anchorEl, setAnchorEl] = (0, import_react8.useState)(null);
|
|
1333
|
-
const open = Boolean(anchorEl);
|
|
1334
|
-
const handleMenuOpen = (event2) => {
|
|
1335
|
-
setAnchorEl(event2.currentTarget);
|
|
1172
|
+
});
|
|
1336
1173
|
};
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1174
|
+
const shouldShowChips = (chipFilters == null ? void 0 : chipFilters.length) ? true : stateChipFilters && hasActiveFilters();
|
|
1175
|
+
return {
|
|
1176
|
+
stateChipFilters,
|
|
1177
|
+
setChipFilters,
|
|
1178
|
+
textFilters,
|
|
1179
|
+
setTextFilters,
|
|
1180
|
+
shouldShowChips,
|
|
1181
|
+
processChipFilters,
|
|
1182
|
+
hasActiveFilters
|
|
1339
1183
|
};
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1186
|
+
// src/Components/Drawer/hooks/useToast.ts
|
|
1187
|
+
var import_react10 = require("react");
|
|
1188
|
+
var useToast = () => {
|
|
1189
|
+
const [toast, setToast] = (0, import_react10.useState)(null);
|
|
1190
|
+
const setToastWithDelay = (toastContent) => {
|
|
1191
|
+
setToast(null);
|
|
1192
|
+
setTimeout(() => {
|
|
1193
|
+
setToast(toastContent);
|
|
1194
|
+
}, 10);
|
|
1343
1195
|
};
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
}
|
|
1350
|
-
if (view === "week") {
|
|
1351
|
-
return `${labelDate.startOf("week").format("DD MMM")} - ${labelDate.endOf("week").format("DD MMM YYYY")}`;
|
|
1352
|
-
}
|
|
1353
|
-
return labelDate.format(" DD MMMM YYYY");
|
|
1196
|
+
const clearToast = () => setToast(null);
|
|
1197
|
+
return {
|
|
1198
|
+
toast,
|
|
1199
|
+
setToastWithDelay,
|
|
1200
|
+
clearToast
|
|
1354
1201
|
};
|
|
1355
|
-
return /* @__PURE__ */ import_react8.default.createElement(import_material6.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 1.5, sx: { paddingBottom: "16px" } }, /* @__PURE__ */ import_react8.default.createElement(import_material6.Stack, { direction: "row", alignItems: "center", justifyContent: "flex-start", gap: 1.5 }, /* @__PURE__ */ import_react8.default.createElement(import_material6.Box, null, /* @__PURE__ */ import_react8.default.createElement(
|
|
1356
|
-
import_material6.Chip,
|
|
1357
|
-
{
|
|
1358
|
-
size: "medium",
|
|
1359
|
-
label: "Hoy",
|
|
1360
|
-
icon: /* @__PURE__ */ import_react8.default.createElement(import_icons_material8.EventOutlined, { fontSize: "small" }),
|
|
1361
|
-
color: "primary",
|
|
1362
|
-
onClick: () => onNavigate("TODAY"),
|
|
1363
|
-
variant: "standard"
|
|
1364
|
-
}
|
|
1365
|
-
)), /* @__PURE__ */ import_react8.default.createElement(import_material6.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ import_react8.default.createElement(import_material6.IconButton, { "aria-label": "Anterior", onClick: () => onNavigate("PREV"), size: "small", color: "primary" }, /* @__PURE__ */ import_react8.default.createElement(import_icons_material8.ChevronLeft, { fontSize: "small" })), /* @__PURE__ */ import_react8.default.createElement(import_material6.IconButton, { "aria-label": "Siguiente", onClick: () => onNavigate("NEXT"), size: "small", color: "primary" }, /* @__PURE__ */ import_react8.default.createElement(import_icons_material8.ChevronRight, { fontSize: "small" })), /* @__PURE__ */ import_react8.default.createElement(import_material6.Typography, { variant: "h6", color: "primary", "data-testid": "currentDate" }, getFormattedDate()), /* @__PURE__ */ import_react8.default.createElement(import_material6.IconButton, { onClick: handleMenuOpen, size: "small", color: "primary", "aria-label": "Cambiar vista" }, /* @__PURE__ */ import_react8.default.createElement(import_icons_material8.KeyboardArrowDown, { fontSize: "small" })), /* @__PURE__ */ import_react8.default.createElement(
|
|
1366
|
-
import_material6.Menu,
|
|
1367
|
-
{
|
|
1368
|
-
anchorEl,
|
|
1369
|
-
open,
|
|
1370
|
-
onClose: handleMenuClose,
|
|
1371
|
-
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
1372
|
-
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
1373
|
-
},
|
|
1374
|
-
/* @__PURE__ */ import_react8.default.createElement(import_material6.MenuItem, { onClick: () => handleViewChange("month") }, "Mes"),
|
|
1375
|
-
/* @__PURE__ */ import_react8.default.createElement(import_material6.MenuItem, { onClick: () => handleViewChange("week") }, "Semana"),
|
|
1376
|
-
/* @__PURE__ */ import_react8.default.createElement(import_material6.MenuItem, { onClick: () => handleViewChange("day") }, "D\xEDa")
|
|
1377
|
-
))), children ? /* @__PURE__ */ import_react8.default.createElement(import_material6.Box, null, children) : /* @__PURE__ */ import_react8.default.createElement(import_material6.Box, { width: "24px" }), " ");
|
|
1378
1202
|
};
|
|
1379
1203
|
|
|
1380
|
-
// src/Components/
|
|
1381
|
-
var
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1204
|
+
// src/Components/Drawer/utils/filterUtils.ts
|
|
1205
|
+
var resetElementByType = (originalElement, validation, typeElement) => {
|
|
1206
|
+
let defaultValue;
|
|
1207
|
+
switch (validation) {
|
|
1208
|
+
case "textField":
|
|
1209
|
+
case "textArea":
|
|
1210
|
+
defaultValue = "";
|
|
1211
|
+
break;
|
|
1212
|
+
case "dateRange":
|
|
1213
|
+
defaultValue = [null, null];
|
|
1214
|
+
break;
|
|
1215
|
+
case "datePicker":
|
|
1216
|
+
case "time":
|
|
1217
|
+
defaultValue = null;
|
|
1218
|
+
break;
|
|
1219
|
+
case "multiselect":
|
|
1220
|
+
defaultValue = { hiddenValue: [], textValue: [] };
|
|
1221
|
+
break;
|
|
1222
|
+
default:
|
|
1223
|
+
defaultValue = { hiddenValue: "-1", textValue: "" };
|
|
1224
|
+
}
|
|
1225
|
+
if (typeElement.setState) {
|
|
1226
|
+
typeElement.setState(defaultValue);
|
|
1397
1227
|
}
|
|
1398
|
-
return days;
|
|
1399
|
-
}
|
|
1400
|
-
var isToday = (date) => {
|
|
1401
|
-
return date.isSame((0, import_dayjs2.default)(), "day");
|
|
1402
1228
|
};
|
|
1403
|
-
var
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1229
|
+
var cleanAllFilters = (arrayElements, setTextFilters) => {
|
|
1230
|
+
arrayElements.forEach((element) => {
|
|
1231
|
+
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1232
|
+
if (typeElement.setState) {
|
|
1233
|
+
resetElementByType(element, validation, typeElement);
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
setTextFilters([]);
|
|
1237
|
+
};
|
|
1238
|
+
var deleteFilter = (element, shouldShowChips, setTextFilters) => {
|
|
1239
|
+
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1240
|
+
if (typeElement.setState && shouldShowChips) {
|
|
1241
|
+
resetElementByType(element, validation, typeElement);
|
|
1242
|
+
setTextFilters(
|
|
1243
|
+
(prevFilters) => prevFilters.filter((filter) => filter.arrayElement.label !== element.label)
|
|
1244
|
+
);
|
|
1245
|
+
}
|
|
1411
1246
|
};
|
|
1412
1247
|
|
|
1413
|
-
// src/Components/
|
|
1414
|
-
var
|
|
1415
|
-
var
|
|
1416
|
-
var
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
e.stopPropagation();
|
|
1436
|
-
onClick == null ? void 0 : onClick(event2);
|
|
1437
|
-
},
|
|
1438
|
-
sx: (theme) => __spreadValues({
|
|
1439
|
-
backgroundColor: theme.palette.common.white,
|
|
1440
|
-
boxShadow: theme.shadows[2],
|
|
1441
|
-
color: theme.palette.text.secondary,
|
|
1442
|
-
overflow: "hidden",
|
|
1443
|
-
cursor: onClick ? "pointer" : "default"
|
|
1444
|
-
}, sx)
|
|
1445
|
-
},
|
|
1446
|
-
/* @__PURE__ */ import_react9.default.createElement(
|
|
1447
|
-
import_material7.Divider,
|
|
1448
|
-
{
|
|
1449
|
-
orientation: "vertical",
|
|
1450
|
-
flexItem: true,
|
|
1248
|
+
// src/Components/Drawer/components/DrawerButton.tsx
|
|
1249
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
1250
|
+
var import_material5 = require("@mui/material");
|
|
1251
|
+
var DrawerButton = ({
|
|
1252
|
+
buttonDrawer,
|
|
1253
|
+
onToggle
|
|
1254
|
+
}) => {
|
|
1255
|
+
var _a, _b, _c;
|
|
1256
|
+
const ButtonIcon = getIcon(buttonDrawer == null ? void 0 : buttonDrawer.icon);
|
|
1257
|
+
if ((buttonDrawer == null ? void 0 : buttonDrawer.type) === "chip") {
|
|
1258
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
1259
|
+
import_material5.Chip,
|
|
1260
|
+
__spreadProps(__spreadValues({
|
|
1261
|
+
onClick: onToggle,
|
|
1262
|
+
size: "medium",
|
|
1263
|
+
color: buttonDrawer == null ? void 0 : buttonDrawer.color,
|
|
1264
|
+
variant: (buttonDrawer == null ? void 0 : buttonDrawer.variant) === "contained" ? "filled" : "outlined",
|
|
1265
|
+
label: (_a = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _a : "",
|
|
1266
|
+
icon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" && ButtonIcon ? /* @__PURE__ */ import_react11.default.createElement(ButtonIcon, { fontSize: "small" }) : void 0,
|
|
1267
|
+
deleteIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */ import_react11.default.createElement(ButtonIcon, { fontSize: "small" }) : void 0
|
|
1268
|
+
}, (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? { onDelete: () => {
|
|
1269
|
+
} } : {}), {
|
|
1451
1270
|
sx: {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1271
|
+
"& .MuiChip-icon": {
|
|
1272
|
+
color: "inherit"
|
|
1273
|
+
},
|
|
1274
|
+
textTransform: "capitalize"
|
|
1455
1275
|
}
|
|
1456
|
-
}
|
|
1457
|
-
)
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
/* @__PURE__ */
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
variant: "caption",
|
|
1473
|
-
noWrap: true,
|
|
1474
|
-
sx: {
|
|
1475
|
-
overflow: "hidden",
|
|
1476
|
-
textOverflow: "ellipsis",
|
|
1477
|
-
whiteSpace: "nowrap"
|
|
1478
|
-
},
|
|
1479
|
-
onMouseEnter: handlePopoverOpen,
|
|
1480
|
-
onMouseLeave: handlePopoverClose
|
|
1481
|
-
},
|
|
1482
|
-
event2.title.charAt(0).toUpperCase() + event2.title.slice(1).toLowerCase()
|
|
1483
|
-
),
|
|
1484
|
-
/* @__PURE__ */ import_react9.default.createElement(
|
|
1485
|
-
import_material7.Popover,
|
|
1486
|
-
{
|
|
1487
|
-
id: "mouse-over-popover",
|
|
1488
|
-
sx: { pointerEvents: "none" },
|
|
1489
|
-
open,
|
|
1490
|
-
anchorEl,
|
|
1491
|
-
anchorOrigin: {
|
|
1492
|
-
vertical: "top",
|
|
1493
|
-
horizontal: "right"
|
|
1494
|
-
},
|
|
1495
|
-
transformOrigin: {
|
|
1496
|
-
vertical: "bottom",
|
|
1497
|
-
horizontal: "right"
|
|
1498
|
-
},
|
|
1499
|
-
onClose: handlePopoverClose,
|
|
1500
|
-
disableRestoreFocus: true
|
|
1501
|
-
},
|
|
1502
|
-
onHover ? onHover(event2) : " "
|
|
1503
|
-
)
|
|
1504
|
-
)
|
|
1276
|
+
})
|
|
1277
|
+
);
|
|
1278
|
+
}
|
|
1279
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
1280
|
+
import_material5.Button,
|
|
1281
|
+
{
|
|
1282
|
+
"data-testid": "test-buttonDrawer",
|
|
1283
|
+
sx: { textTransform: "capitalize" },
|
|
1284
|
+
color: buttonDrawer == null ? void 0 : buttonDrawer.color,
|
|
1285
|
+
onClick: onToggle,
|
|
1286
|
+
size: "small",
|
|
1287
|
+
variant: (_b = buttonDrawer == null ? void 0 : buttonDrawer.variant) != null ? _b : "text",
|
|
1288
|
+
startIcon: ((buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" || !(buttonDrawer == null ? void 0 : buttonDrawer.iconPosition)) && ButtonIcon ? /* @__PURE__ */ import_react11.default.createElement(ButtonIcon, { fontSize: "small" }) : null,
|
|
1289
|
+
endIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */ import_react11.default.createElement(ButtonIcon, { fontSize: "small" }) : null
|
|
1290
|
+
},
|
|
1291
|
+
(_c = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _c : ""
|
|
1505
1292
|
);
|
|
1506
1293
|
};
|
|
1507
1294
|
|
|
1508
|
-
// src/Components/Drawer/
|
|
1509
|
-
var
|
|
1510
|
-
var
|
|
1511
|
-
var
|
|
1295
|
+
// src/Components/Drawer/components/ChipFiltersDisplay.tsx
|
|
1296
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
1297
|
+
var import_material6 = require("@mui/material");
|
|
1298
|
+
var import_ChevronLeft = __toESM(require("@mui/icons-material/ChevronLeft"), 1);
|
|
1299
|
+
var import_ChevronRight = __toESM(require("@mui/icons-material/ChevronRight"), 1);
|
|
1300
|
+
var ChipFiltersDisplay = ({
|
|
1301
|
+
textFilters,
|
|
1302
|
+
onDeleteFilter
|
|
1303
|
+
}) => {
|
|
1304
|
+
const scrollRef = (0, import_react12.useRef)(null);
|
|
1305
|
+
const [hasOverflow, setHasOverflow] = (0, import_react12.useState)(false);
|
|
1306
|
+
(0, import_react12.useEffect)(() => {
|
|
1307
|
+
const el = scrollRef.current;
|
|
1308
|
+
if (!el) return;
|
|
1309
|
+
const checkOverflow = () => setHasOverflow(el.scrollWidth > el.clientWidth);
|
|
1310
|
+
checkOverflow();
|
|
1311
|
+
const observer = new ResizeObserver(checkOverflow);
|
|
1312
|
+
observer.observe(el);
|
|
1313
|
+
return () => observer.disconnect();
|
|
1314
|
+
}, [textFilters]);
|
|
1315
|
+
const scroll = (offset) => {
|
|
1316
|
+
if (scrollRef.current) {
|
|
1317
|
+
scrollRef.current.scrollLeft += offset;
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, (textFilters == null ? void 0 : textFilters.length) > 0 && /* @__PURE__ */ import_react12.default.createElement(import_material6.Box, { display: "flex", alignItems: "center", sx: { maxWidth: "78%" } }, hasOverflow && /* @__PURE__ */ import_react12.default.createElement(import_material6.IconButton, { onClick: () => scroll(-150), size: "small" }, /* @__PURE__ */ import_react12.default.createElement(import_ChevronLeft.default, { fontSize: "small", color: "action" })), /* @__PURE__ */ import_react12.default.createElement(
|
|
1321
|
+
import_material6.Box,
|
|
1322
|
+
{
|
|
1323
|
+
ref: scrollRef,
|
|
1324
|
+
gap: 0.3,
|
|
1325
|
+
sx: {
|
|
1326
|
+
display: "flex",
|
|
1327
|
+
overflowX: "auto",
|
|
1328
|
+
scrollBehavior: "smooth",
|
|
1329
|
+
"&::-webkit-scrollbar": { display: "none" }
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1332
|
+
textFilters == null ? void 0 : textFilters.map((chipData, index) => /* @__PURE__ */ import_react12.default.createElement(
|
|
1333
|
+
import_material6.Chip,
|
|
1334
|
+
__spreadProps(__spreadValues({
|
|
1335
|
+
key: index,
|
|
1336
|
+
label: chipData.value
|
|
1337
|
+
}, chipData.arrayElement.required === false || chipData.arrayElement.required === void 0 ? { onDelete: () => onDeleteFilter(chipData.arrayElement) } : {}), {
|
|
1338
|
+
color: "default",
|
|
1339
|
+
variant: "filled",
|
|
1340
|
+
size: "small",
|
|
1341
|
+
sx: {
|
|
1342
|
+
flexShrink: 0,
|
|
1343
|
+
minWidth: "auto"
|
|
1344
|
+
}
|
|
1345
|
+
})
|
|
1346
|
+
))
|
|
1347
|
+
), hasOverflow && /* @__PURE__ */ import_react12.default.createElement(import_material6.IconButton, { onClick: () => scroll(150), size: "small" }, /* @__PURE__ */ import_react12.default.createElement(import_ChevronRight.default, { fontSize: "small", color: "action" }))));
|
|
1348
|
+
};
|
|
1512
1349
|
|
|
1513
|
-
// src/Components/Drawer/
|
|
1350
|
+
// src/Components/Drawer/components/DrawerContent.tsx
|
|
1351
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
1352
|
+
var import_material12 = require("@mui/material");
|
|
1353
|
+
|
|
1354
|
+
// src/Components/Textfield/SCTextField.tsx
|
|
1355
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
1356
|
+
var import_material7 = require("@mui/material");
|
|
1357
|
+
var import_Grid = __toESM(require("@mui/material/Grid"), 1);
|
|
1358
|
+
var import_icons_material7 = require("@mui/icons-material");
|
|
1359
|
+
|
|
1360
|
+
// src/Components/Textfield/Helpers/validateIcon.tsx
|
|
1514
1361
|
var Muicon3 = __toESM(require("@mui/icons-material"), 1);
|
|
1515
|
-
|
|
1516
|
-
if (
|
|
1517
|
-
|
|
1362
|
+
function getIconComponent2(name) {
|
|
1363
|
+
if (typeof name !== "string") return name;
|
|
1364
|
+
return name in Muicon3 ? Muicon3[name] : void 0;
|
|
1365
|
+
}
|
|
1366
|
+
function getIconValidation(name) {
|
|
1367
|
+
if (typeof name !== "string") {
|
|
1368
|
+
return (name == null ? void 0 : name.type) ? "icon" : "text";
|
|
1518
1369
|
}
|
|
1519
|
-
return
|
|
1520
|
-
}
|
|
1370
|
+
return name in Muicon3 ? "icon" : "text";
|
|
1371
|
+
}
|
|
1521
1372
|
|
|
1522
|
-
// src/Components/
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
const element = arrayElements[i];
|
|
1529
|
-
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1530
|
-
const textValue = ((_a = typeElement.state) == null ? void 0 : _a.textValue) !== void 0 ? String((_b = typeElement.state) == null ? void 0 : _b.textValue) : String(typeElement.state);
|
|
1531
|
-
if (typeElement == null ? void 0 : typeElement.required) {
|
|
1532
|
-
requiredValues++;
|
|
1533
|
-
if (textValue.trim() !== "" && textValue.trim() !== ",") {
|
|
1534
|
-
filledValues++;
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1373
|
+
// src/Components/Textfield/Helpers/validateKeyDown.tsx
|
|
1374
|
+
function validateKeyDown(event2, format3) {
|
|
1375
|
+
const key = event2.key;
|
|
1376
|
+
const target = event2.target;
|
|
1377
|
+
if (format3 === "int" && !/^[0-9]$/.test(key)) {
|
|
1378
|
+
event2.preventDefault();
|
|
1537
1379
|
}
|
|
1538
|
-
if (
|
|
1539
|
-
|
|
1540
|
-
setChipFilters(true);
|
|
1541
|
-
} else {
|
|
1542
|
-
onError({
|
|
1543
|
-
type: "error",
|
|
1544
|
-
title: "Algunos campos son requeridos",
|
|
1545
|
-
time: 10
|
|
1546
|
-
});
|
|
1547
|
-
setChipFilters(false);
|
|
1380
|
+
if (format3 === "decimal" && (target.value === "" && key === "." || key === "-" || key === "+")) {
|
|
1381
|
+
event2.preventDefault();
|
|
1548
1382
|
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
var COMPONENT_NAME_MAP = {
|
|
1554
|
-
SCtextField: "textField",
|
|
1555
|
-
SCtextArea: "textArea",
|
|
1556
|
-
SCDateRange: "dateRange",
|
|
1557
|
-
SCDatePicker: "datePicker",
|
|
1558
|
-
SCTime: "time",
|
|
1559
|
-
SCAutocomplete: "autocomplete",
|
|
1560
|
-
SCSelect: "select"
|
|
1561
|
-
};
|
|
1562
|
-
var getComponentName = (node) => {
|
|
1563
|
-
const type = node.type;
|
|
1564
|
-
return typeof type === "function" ? type.displayName || type.name || "" : "";
|
|
1565
|
-
};
|
|
1566
|
-
var isKnownComponent = (node) => {
|
|
1567
|
-
var _a;
|
|
1568
|
-
const name = getComponentName(node);
|
|
1569
|
-
if (COMPONENT_NAME_MAP[name]) return true;
|
|
1570
|
-
if (((_a = node.props) == null ? void 0 : _a.typeFormat) === "multiselect") return true;
|
|
1571
|
-
return false;
|
|
1572
|
-
};
|
|
1573
|
-
var findInTree = (node) => {
|
|
1574
|
-
var _a;
|
|
1575
|
-
if (!import_react10.default.isValidElement(node)) return null;
|
|
1576
|
-
if (isKnownComponent(node)) return node;
|
|
1577
|
-
const children = (_a = node.props) == null ? void 0 : _a.children;
|
|
1578
|
-
if (!children) return null;
|
|
1579
|
-
for (const child of import_react10.default.Children.toArray(children)) {
|
|
1580
|
-
if (import_react10.default.isValidElement(child)) {
|
|
1581
|
-
const found = findInTree(child);
|
|
1582
|
-
if (found) return found;
|
|
1383
|
+
if (target.type === "text") {
|
|
1384
|
+
const regex = /^[a-zA-ZáéíóúÁÉÍÓÚñÑ0-9\s_\-.,@]+$/;
|
|
1385
|
+
if (!regex.test(key)) {
|
|
1386
|
+
event2.preventDefault();
|
|
1583
1387
|
}
|
|
1584
1388
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
validation = element.type;
|
|
1599
|
-
typeElement = element;
|
|
1600
|
-
} else if (element.typeFormat === "multiselect") {
|
|
1601
|
-
validation = "multiselect";
|
|
1602
|
-
typeElement = element;
|
|
1603
|
-
} else if (import_react10.default.isValidElement(element == null ? void 0 : element.component) && isKnownComponent(element.component)) {
|
|
1604
|
-
const node = element.component;
|
|
1605
|
-
validation = resolveValidation(node);
|
|
1606
|
-
typeElement = node.props;
|
|
1607
|
-
} else if (import_react10.default.isValidElement(element == null ? void 0 : element.component)) {
|
|
1608
|
-
const found = findInTree(element.component);
|
|
1609
|
-
if (found) {
|
|
1610
|
-
validation = resolveValidation(found);
|
|
1611
|
-
typeElement = found.props;
|
|
1612
|
-
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
// src/Components/Textfield/Helpers/validateOnBlur.tsx
|
|
1392
|
+
var validateOnBlurField = ({
|
|
1393
|
+
state,
|
|
1394
|
+
required = false,
|
|
1395
|
+
setError,
|
|
1396
|
+
onBlur
|
|
1397
|
+
}) => (event2) => {
|
|
1398
|
+
const isError = !state.trim() && required;
|
|
1399
|
+
setError(isError);
|
|
1400
|
+
if (onBlur) {
|
|
1401
|
+
onBlur(event2);
|
|
1613
1402
|
}
|
|
1614
|
-
return { validation, element: typeElement };
|
|
1615
1403
|
};
|
|
1616
1404
|
|
|
1617
|
-
// src/Components/
|
|
1618
|
-
var
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1405
|
+
// src/Components/Textfield/SCTextField.tsx
|
|
1406
|
+
var SCTextField = ({
|
|
1407
|
+
//informativas
|
|
1408
|
+
title,
|
|
1409
|
+
iconTitle,
|
|
1410
|
+
infoTitle,
|
|
1411
|
+
label = "",
|
|
1412
|
+
placeholder = "",
|
|
1413
|
+
infoElement,
|
|
1414
|
+
iconInputStart,
|
|
1415
|
+
iconInputEnd,
|
|
1416
|
+
maxLength,
|
|
1417
|
+
//Apariencia
|
|
1418
|
+
variant = "outlined",
|
|
1419
|
+
format: format3,
|
|
1420
|
+
disabled,
|
|
1421
|
+
required,
|
|
1422
|
+
size,
|
|
1423
|
+
width = "100%",
|
|
1424
|
+
color,
|
|
1425
|
+
background,
|
|
1426
|
+
//Funcionales
|
|
1427
|
+
setState,
|
|
1428
|
+
state,
|
|
1429
|
+
onChange,
|
|
1430
|
+
onBlur,
|
|
1431
|
+
onKeyDown
|
|
1432
|
+
}) => {
|
|
1433
|
+
const inputComponents = {
|
|
1434
|
+
outlined: import_material7.OutlinedInput,
|
|
1435
|
+
filled: import_material7.FilledInput,
|
|
1436
|
+
standard: import_material7.Input
|
|
1646
1437
|
};
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
const [
|
|
1654
|
-
(0,
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1438
|
+
const InputComponent = inputComponents[variant] || import_material7.OutlinedInput;
|
|
1439
|
+
let IconInputStartValidation;
|
|
1440
|
+
let IconInputEndValidation;
|
|
1441
|
+
let IconInputStart;
|
|
1442
|
+
let IconInputEnd;
|
|
1443
|
+
let IconTitle;
|
|
1444
|
+
const [showPassword, setShowPassword] = (0, import_react13.useState)(false);
|
|
1445
|
+
const [error, setError] = (0, import_react13.useState)(false);
|
|
1446
|
+
const [anchorInfoTitle, setAnchorInfoTitle] = (0, import_react13.useState)(null);
|
|
1447
|
+
const openInfoTitle = Boolean(anchorInfoTitle);
|
|
1448
|
+
const [anchorInfoElement, setAnchorInfoElement] = (0, import_react13.useState)(null);
|
|
1449
|
+
const openInfoElement = Boolean(anchorInfoElement);
|
|
1450
|
+
(0, import_react13.useEffect)(() => {
|
|
1451
|
+
if (error) {
|
|
1452
|
+
setTimeout(() => {
|
|
1453
|
+
setError(false);
|
|
1454
|
+
}, 1e3);
|
|
1664
1455
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
}
|
|
1681
|
-
});
|
|
1682
|
-
return;
|
|
1683
|
-
}
|
|
1684
|
-
const currentValue = getCurrentValue(validation, typeElement);
|
|
1685
|
-
chipFilters.forEach((chipFilter) => {
|
|
1686
|
-
const chipValue = String(chipFilter).trim();
|
|
1687
|
-
if (currentValue === chipValue && currentValue !== "" && currentValue !== ",") {
|
|
1688
|
-
updateFilter(currentValue, typeElement, arrayElement.label);
|
|
1689
|
-
}
|
|
1690
|
-
});
|
|
1691
|
-
});
|
|
1456
|
+
}, [error]);
|
|
1457
|
+
if (iconInputStart) {
|
|
1458
|
+
IconInputStartValidation = getIconValidation(iconInputStart);
|
|
1459
|
+
IconInputStart = getIconComponent2(iconInputStart);
|
|
1460
|
+
}
|
|
1461
|
+
if (iconInputEnd) {
|
|
1462
|
+
IconInputEndValidation = getIconValidation(iconInputEnd);
|
|
1463
|
+
IconInputEnd = getIconComponent2(iconInputEnd);
|
|
1464
|
+
}
|
|
1465
|
+
if (iconTitle) {
|
|
1466
|
+
IconTitle = getIconComponent2(iconTitle);
|
|
1467
|
+
}
|
|
1468
|
+
const handleClickShowPassword = () => setShowPassword((show) => !show);
|
|
1469
|
+
const handleMouseDownPassword = (event2) => {
|
|
1470
|
+
event2.preventDefault();
|
|
1692
1471
|
};
|
|
1693
|
-
const
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1697
|
-
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1698
|
-
const textValue = ((_a = typeElement.state) == null ? void 0 : _a.textValue) !== void 0 ? String((_b = typeElement.state) == null ? void 0 : _b.textValue) : String(typeElement.state);
|
|
1699
|
-
if (textValue.trim() !== "" && textValue.trim() !== "," && textValue.trim() !== "undefined") {
|
|
1700
|
-
const value = validation === "dateRange" ? `${(_c = typeElement.state[0]) == null ? void 0 : _c.format("DD/MM/YYYY")} - ${(_d = typeElement.state[1]) == null ? void 0 : _d.format("DD/MM/YYYY")}` : validation === "datePicker" ? (_f = (_e = typeElement.state) == null ? void 0 : _e.format("DD/MM/YYYY")) != null ? _f : "" : validation === "time" ? (_h = (_g = typeElement.state) == null ? void 0 : _g.format("HH:mm")) != null ? _h : "" : textValue;
|
|
1701
|
-
const existingFilterIndex = newFiltersToAdd.findIndex(
|
|
1702
|
-
(filter) => filter.arrayElement.label === element.label
|
|
1703
|
-
);
|
|
1704
|
-
const newFilter = { value, arrayElement: typeElement };
|
|
1705
|
-
if (existingFilterIndex !== -1) {
|
|
1706
|
-
newFiltersToAdd[existingFilterIndex] = newFilter;
|
|
1707
|
-
} else {
|
|
1708
|
-
newFiltersToAdd.push(newFilter);
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
});
|
|
1712
|
-
setTextFilters((prevFilters) => {
|
|
1713
|
-
let updatedFilters = [...prevFilters];
|
|
1714
|
-
newFiltersToAdd.forEach((newFilter) => {
|
|
1715
|
-
const existingFilterIndex = updatedFilters.findIndex(
|
|
1716
|
-
(filter) => filter.arrayElement.label === newFilter.arrayElement.label
|
|
1717
|
-
);
|
|
1718
|
-
if (existingFilterIndex !== -1) {
|
|
1719
|
-
updatedFilters[existingFilterIndex] = newFilter;
|
|
1720
|
-
} else {
|
|
1721
|
-
updatedFilters.push(newFilter);
|
|
1722
|
-
}
|
|
1723
|
-
});
|
|
1724
|
-
return updatedFilters;
|
|
1725
|
-
});
|
|
1472
|
+
const handleKeyDown = (event2) => {
|
|
1473
|
+
validateKeyDown(event2, format3);
|
|
1474
|
+
if (onKeyDown) onKeyDown(event2);
|
|
1726
1475
|
};
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1729
|
-
if (
|
|
1730
|
-
if (
|
|
1731
|
-
|
|
1476
|
+
const handleInputChange = (event2) => {
|
|
1477
|
+
let valueMax = maxLength ? maxLength + 1 : 50;
|
|
1478
|
+
if (event2.target.value.length < valueMax) {
|
|
1479
|
+
if (setState) {
|
|
1480
|
+
setState(event2.target.value);
|
|
1732
1481
|
}
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
if (validation === "datePicker") {
|
|
1736
|
-
return ((_f = (_e = typeElement.state) == null ? void 0 : _e.isValid) == null ? void 0 : _f.call(_e)) ? typeElement.state.format("DD/MM/YYYY") : "";
|
|
1737
|
-
}
|
|
1738
|
-
if (validation === "time") {
|
|
1739
|
-
return ((_h = (_g = typeElement.state) == null ? void 0 : _g.isValid) == null ? void 0 : _h.call(_g)) ? typeElement.state.format("HH:mm") : "";
|
|
1740
|
-
}
|
|
1741
|
-
return ((_i = typeElement.state) == null ? void 0 : _i.textValue) !== void 0 ? String(typeElement.state.textValue).trim() : String(typeElement.state).trim();
|
|
1742
|
-
};
|
|
1743
|
-
const updateFilter = (value, typeElement, label) => {
|
|
1744
|
-
setTextFilters((prevFilters) => {
|
|
1745
|
-
const newFilter = { value, arrayElement: typeElement };
|
|
1746
|
-
const existingFilterIndex = prevFilters.findIndex(
|
|
1747
|
-
(filter) => label !== void 0 ? filter.arrayElement.label === label : filter.value === value
|
|
1748
|
-
);
|
|
1749
|
-
if (existingFilterIndex !== -1) {
|
|
1750
|
-
const updatedFilters = [...prevFilters];
|
|
1751
|
-
updatedFilters[existingFilterIndex] = newFilter;
|
|
1752
|
-
return updatedFilters;
|
|
1753
|
-
} else {
|
|
1754
|
-
return [...prevFilters, newFilter];
|
|
1482
|
+
if (onChange) {
|
|
1483
|
+
onChange(event2);
|
|
1755
1484
|
}
|
|
1756
|
-
}
|
|
1485
|
+
}
|
|
1757
1486
|
};
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
const { validation, element: typeElement } = validateTypeElements(arrayElement);
|
|
1762
|
-
if (((_a = typeElement.state) == null ? void 0 : _a.textValue) !== void 0) {
|
|
1763
|
-
return String(typeElement.state.textValue).trim() !== "";
|
|
1764
|
-
} else if (validation === "dateRange") {
|
|
1765
|
-
return ((_b = typeElement.state) == null ? void 0 : _b[0]) !== null && ((_c = typeElement.state) == null ? void 0 : _c[1]) !== null;
|
|
1766
|
-
} else {
|
|
1767
|
-
const stateValue = String(typeElement.state).trim();
|
|
1768
|
-
return stateValue !== "" && stateValue !== "," && stateValue !== "undefined";
|
|
1769
|
-
}
|
|
1770
|
-
});
|
|
1487
|
+
const handleBlur = validateOnBlurField({ state, required, setError, onBlur });
|
|
1488
|
+
const handleOpenInfoTitle = (event2) => {
|
|
1489
|
+
setAnchorInfoTitle(event2.currentTarget);
|
|
1771
1490
|
};
|
|
1772
|
-
const
|
|
1773
|
-
|
|
1774
|
-
stateChipFilters,
|
|
1775
|
-
setChipFilters,
|
|
1776
|
-
textFilters,
|
|
1777
|
-
setTextFilters,
|
|
1778
|
-
shouldShowChips,
|
|
1779
|
-
processChipFilters,
|
|
1780
|
-
hasActiveFilters
|
|
1491
|
+
const handleCloseInfoTitle = () => {
|
|
1492
|
+
setAnchorInfoTitle(null);
|
|
1781
1493
|
};
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
// src/Components/Drawer/hooks/useToast.ts
|
|
1785
|
-
var import_react13 = require("react");
|
|
1786
|
-
var useToast = () => {
|
|
1787
|
-
const [toast, setToast] = (0, import_react13.useState)(null);
|
|
1788
|
-
const setToastWithDelay = (toastContent) => {
|
|
1789
|
-
setToast(null);
|
|
1790
|
-
setTimeout(() => {
|
|
1791
|
-
setToast(toastContent);
|
|
1792
|
-
}, 10);
|
|
1494
|
+
const handleOpenInfoElement = (event2) => {
|
|
1495
|
+
setAnchorInfoElement(event2.currentTarget);
|
|
1793
1496
|
};
|
|
1794
|
-
const
|
|
1795
|
-
|
|
1796
|
-
toast,
|
|
1797
|
-
setToastWithDelay,
|
|
1798
|
-
clearToast
|
|
1497
|
+
const handleCloseInfoElement = () => {
|
|
1498
|
+
setAnchorInfoElement(null);
|
|
1799
1499
|
};
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
case "textArea":
|
|
1808
|
-
defaultValue = "";
|
|
1809
|
-
break;
|
|
1810
|
-
case "dateRange":
|
|
1811
|
-
defaultValue = [null, null];
|
|
1812
|
-
break;
|
|
1813
|
-
case "datePicker":
|
|
1814
|
-
case "time":
|
|
1815
|
-
defaultValue = null;
|
|
1816
|
-
break;
|
|
1817
|
-
case "multiselect":
|
|
1818
|
-
defaultValue = { hiddenValue: [], textValue: [] };
|
|
1819
|
-
break;
|
|
1820
|
-
default:
|
|
1821
|
-
defaultValue = { hiddenValue: "-1", textValue: "" };
|
|
1822
|
-
}
|
|
1823
|
-
if (typeElement.setState) {
|
|
1824
|
-
typeElement.setState(defaultValue);
|
|
1825
|
-
}
|
|
1826
|
-
};
|
|
1827
|
-
var cleanAllFilters = (arrayElements, setTextFilters) => {
|
|
1828
|
-
arrayElements.forEach((element) => {
|
|
1829
|
-
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1830
|
-
if (typeElement.setState) {
|
|
1831
|
-
resetElementByType(element, validation, typeElement);
|
|
1500
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_material7.Box, { sx: { width } }, /* @__PURE__ */ import_react13.default.createElement(import_Grid.default, { container: true, alignItems: "center", mb: 1.25, gap: 0.5 }, iconTitle && IconTitle ? /* @__PURE__ */ import_react13.default.createElement(import_material7.SvgIcon, { color: "action", fontSize: "small", component: IconTitle }) : "", title ? /* @__PURE__ */ import_react13.default.createElement(import_material7.Typography, { mx: 0.5, variant: "subtitle2", color: "text.secondary" }, title) : "", infoTitle ? /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, infoTitle.component === "popover" ? /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
|
|
1501
|
+
import_icons_material7.InfoOutlined,
|
|
1502
|
+
{
|
|
1503
|
+
color: "action",
|
|
1504
|
+
fontSize: "small",
|
|
1505
|
+
onMouseEnter: (event2) => handleOpenInfoTitle(event2),
|
|
1506
|
+
onMouseLeave: () => handleCloseInfoTitle()
|
|
1832
1507
|
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
};
|
|
1836
|
-
var deleteFilter = (element, shouldShowChips, setTextFilters) => {
|
|
1837
|
-
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1838
|
-
if (typeElement.setState && shouldShowChips) {
|
|
1839
|
-
resetElementByType(element, validation, typeElement);
|
|
1840
|
-
setTextFilters(
|
|
1841
|
-
(prevFilters) => prevFilters.filter((filter) => filter.arrayElement.label !== element.label)
|
|
1842
|
-
);
|
|
1843
|
-
}
|
|
1844
|
-
};
|
|
1845
|
-
|
|
1846
|
-
// src/Components/Drawer/components/DrawerButton.tsx
|
|
1847
|
-
var import_react14 = __toESM(require("react"), 1);
|
|
1848
|
-
var import_material8 = require("@mui/material");
|
|
1849
|
-
var DrawerButton = ({
|
|
1850
|
-
buttonDrawer,
|
|
1851
|
-
onToggle
|
|
1852
|
-
}) => {
|
|
1853
|
-
var _a, _b, _c;
|
|
1854
|
-
const ButtonIcon = getIcon(buttonDrawer == null ? void 0 : buttonDrawer.icon);
|
|
1855
|
-
if ((buttonDrawer == null ? void 0 : buttonDrawer.type) === "chip") {
|
|
1856
|
-
return /* @__PURE__ */ import_react14.default.createElement(
|
|
1857
|
-
import_material8.Chip,
|
|
1858
|
-
__spreadProps(__spreadValues({
|
|
1859
|
-
onClick: onToggle,
|
|
1860
|
-
size: "medium",
|
|
1861
|
-
color: buttonDrawer == null ? void 0 : buttonDrawer.color,
|
|
1862
|
-
variant: (buttonDrawer == null ? void 0 : buttonDrawer.variant) === "contained" ? "filled" : "outlined",
|
|
1863
|
-
label: (_a = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _a : "",
|
|
1864
|
-
icon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" && ButtonIcon ? /* @__PURE__ */ import_react14.default.createElement(ButtonIcon, { fontSize: "small" }) : void 0,
|
|
1865
|
-
deleteIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */ import_react14.default.createElement(ButtonIcon, { fontSize: "small" }) : void 0
|
|
1866
|
-
}, (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? { onDelete: () => {
|
|
1867
|
-
} } : {}), {
|
|
1868
|
-
sx: {
|
|
1869
|
-
"& .MuiChip-icon": {
|
|
1870
|
-
color: "inherit"
|
|
1871
|
-
},
|
|
1872
|
-
textTransform: "capitalize"
|
|
1873
|
-
}
|
|
1874
|
-
})
|
|
1875
|
-
);
|
|
1876
|
-
}
|
|
1877
|
-
return /* @__PURE__ */ import_react14.default.createElement(
|
|
1878
|
-
import_material8.Button,
|
|
1879
|
-
{
|
|
1880
|
-
"data-testid": "test-buttonDrawer",
|
|
1881
|
-
sx: { textTransform: "capitalize" },
|
|
1882
|
-
color: buttonDrawer == null ? void 0 : buttonDrawer.color,
|
|
1883
|
-
onClick: onToggle,
|
|
1884
|
-
size: "small",
|
|
1885
|
-
variant: (_b = buttonDrawer == null ? void 0 : buttonDrawer.variant) != null ? _b : "text",
|
|
1886
|
-
startIcon: ((buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" || !(buttonDrawer == null ? void 0 : buttonDrawer.iconPosition)) && ButtonIcon ? /* @__PURE__ */ import_react14.default.createElement(ButtonIcon, { fontSize: "small" }) : null,
|
|
1887
|
-
endIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */ import_react14.default.createElement(ButtonIcon, { fontSize: "small" }) : null
|
|
1888
|
-
},
|
|
1889
|
-
(_c = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _c : ""
|
|
1890
|
-
);
|
|
1891
|
-
};
|
|
1892
|
-
|
|
1893
|
-
// src/Components/Drawer/components/ChipFiltersDisplay.tsx
|
|
1894
|
-
var import_react15 = __toESM(require("react"), 1);
|
|
1895
|
-
var import_material9 = require("@mui/material");
|
|
1896
|
-
var import_ChevronLeft = __toESM(require("@mui/icons-material/ChevronLeft"), 1);
|
|
1897
|
-
var import_ChevronRight = __toESM(require("@mui/icons-material/ChevronRight"), 1);
|
|
1898
|
-
var ChipFiltersDisplay = ({
|
|
1899
|
-
textFilters,
|
|
1900
|
-
onDeleteFilter
|
|
1901
|
-
}) => {
|
|
1902
|
-
const scrollRef = (0, import_react15.useRef)(null);
|
|
1903
|
-
const [hasOverflow, setHasOverflow] = (0, import_react15.useState)(false);
|
|
1904
|
-
(0, import_react15.useEffect)(() => {
|
|
1905
|
-
const el = scrollRef.current;
|
|
1906
|
-
if (!el) return;
|
|
1907
|
-
const checkOverflow = () => setHasOverflow(el.scrollWidth > el.clientWidth);
|
|
1908
|
-
checkOverflow();
|
|
1909
|
-
const observer = new ResizeObserver(checkOverflow);
|
|
1910
|
-
observer.observe(el);
|
|
1911
|
-
return () => observer.disconnect();
|
|
1912
|
-
}, [textFilters]);
|
|
1913
|
-
const scroll = (offset) => {
|
|
1914
|
-
if (scrollRef.current) {
|
|
1915
|
-
scrollRef.current.scrollLeft += offset;
|
|
1916
|
-
}
|
|
1917
|
-
};
|
|
1918
|
-
return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, (textFilters == null ? void 0 : textFilters.length) > 0 && /* @__PURE__ */ import_react15.default.createElement(import_material9.Box, { display: "flex", alignItems: "center", sx: { maxWidth: "78%" } }, hasOverflow && /* @__PURE__ */ import_react15.default.createElement(import_material9.IconButton, { onClick: () => scroll(-150), size: "small" }, /* @__PURE__ */ import_react15.default.createElement(import_ChevronLeft.default, { fontSize: "small", color: "action" })), /* @__PURE__ */ import_react15.default.createElement(
|
|
1919
|
-
import_material9.Box,
|
|
1920
|
-
{
|
|
1921
|
-
ref: scrollRef,
|
|
1922
|
-
gap: 0.3,
|
|
1923
|
-
sx: {
|
|
1924
|
-
display: "flex",
|
|
1925
|
-
overflowX: "auto",
|
|
1926
|
-
scrollBehavior: "smooth",
|
|
1927
|
-
"&::-webkit-scrollbar": { display: "none" }
|
|
1928
|
-
}
|
|
1929
|
-
},
|
|
1930
|
-
textFilters == null ? void 0 : textFilters.map((chipData, index) => /* @__PURE__ */ import_react15.default.createElement(
|
|
1931
|
-
import_material9.Chip,
|
|
1932
|
-
__spreadProps(__spreadValues({
|
|
1933
|
-
key: index,
|
|
1934
|
-
label: chipData.value
|
|
1935
|
-
}, chipData.arrayElement.required === false || chipData.arrayElement.required === void 0 ? { onDelete: () => onDeleteFilter(chipData.arrayElement) } : {}), {
|
|
1936
|
-
color: "default",
|
|
1937
|
-
variant: "filled",
|
|
1938
|
-
size: "small",
|
|
1939
|
-
sx: {
|
|
1940
|
-
flexShrink: 0,
|
|
1941
|
-
minWidth: "auto"
|
|
1942
|
-
}
|
|
1943
|
-
})
|
|
1944
|
-
))
|
|
1945
|
-
), hasOverflow && /* @__PURE__ */ import_react15.default.createElement(import_material9.IconButton, { onClick: () => scroll(150), size: "small" }, /* @__PURE__ */ import_react15.default.createElement(import_ChevronRight.default, { fontSize: "small", color: "action" }))));
|
|
1946
|
-
};
|
|
1947
|
-
|
|
1948
|
-
// src/Components/Drawer/components/DrawerContent.tsx
|
|
1949
|
-
var import_react21 = __toESM(require("react"), 1);
|
|
1950
|
-
var import_material15 = require("@mui/material");
|
|
1951
|
-
|
|
1952
|
-
// src/Components/Textfield/SCTextField.tsx
|
|
1953
|
-
var import_react16 = __toESM(require("react"), 1);
|
|
1954
|
-
var import_material10 = require("@mui/material");
|
|
1955
|
-
var import_Grid = __toESM(require("@mui/material/Grid"), 1);
|
|
1956
|
-
var import_icons_material9 = require("@mui/icons-material");
|
|
1957
|
-
|
|
1958
|
-
// src/Components/Textfield/Helpers/validateIcon.tsx
|
|
1959
|
-
var Muicon4 = __toESM(require("@mui/icons-material"), 1);
|
|
1960
|
-
function getIconComponent2(name) {
|
|
1961
|
-
if (typeof name !== "string") return name;
|
|
1962
|
-
return name in Muicon4 ? Muicon4[name] : void 0;
|
|
1963
|
-
}
|
|
1964
|
-
function getIconValidation(name) {
|
|
1965
|
-
if (typeof name !== "string") {
|
|
1966
|
-
return (name == null ? void 0 : name.type) ? "icon" : "text";
|
|
1967
|
-
}
|
|
1968
|
-
return name in Muicon4 ? "icon" : "text";
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
// src/Components/Textfield/Helpers/validateKeyDown.tsx
|
|
1972
|
-
function validateKeyDown(event2, format3) {
|
|
1973
|
-
const key = event2.key;
|
|
1974
|
-
const target = event2.target;
|
|
1975
|
-
if (format3 === "int" && !/^[0-9]$/.test(key)) {
|
|
1976
|
-
event2.preventDefault();
|
|
1977
|
-
}
|
|
1978
|
-
if (format3 === "decimal" && (target.value === "" && key === "." || key === "-" || key === "+")) {
|
|
1979
|
-
event2.preventDefault();
|
|
1980
|
-
}
|
|
1981
|
-
if (target.type === "text") {
|
|
1982
|
-
const regex = /^[a-zA-ZáéíóúÁÉÍÓÚñÑ0-9\s_\-.,@]+$/;
|
|
1983
|
-
if (!regex.test(key)) {
|
|
1984
|
-
event2.preventDefault();
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
|
|
1989
|
-
// src/Components/Textfield/Helpers/validateOnBlur.tsx
|
|
1990
|
-
var validateOnBlurField = ({
|
|
1991
|
-
state,
|
|
1992
|
-
required = false,
|
|
1993
|
-
setError,
|
|
1994
|
-
onBlur
|
|
1995
|
-
}) => (event2) => {
|
|
1996
|
-
const isError = !state.trim() && required;
|
|
1997
|
-
setError(isError);
|
|
1998
|
-
if (onBlur) {
|
|
1999
|
-
onBlur(event2);
|
|
2000
|
-
}
|
|
2001
|
-
};
|
|
2002
|
-
|
|
2003
|
-
// src/Components/Textfield/SCTextField.tsx
|
|
2004
|
-
var SCTextField = ({
|
|
2005
|
-
//informativas
|
|
2006
|
-
title,
|
|
2007
|
-
iconTitle,
|
|
2008
|
-
infoTitle,
|
|
2009
|
-
label = "",
|
|
2010
|
-
placeholder = "",
|
|
2011
|
-
infoElement,
|
|
2012
|
-
iconInputStart,
|
|
2013
|
-
iconInputEnd,
|
|
2014
|
-
maxLength,
|
|
2015
|
-
//Apariencia
|
|
2016
|
-
variant = "outlined",
|
|
2017
|
-
format: format3,
|
|
2018
|
-
disabled,
|
|
2019
|
-
required,
|
|
2020
|
-
size,
|
|
2021
|
-
width = "100%",
|
|
2022
|
-
color,
|
|
2023
|
-
background,
|
|
2024
|
-
//Funcionales
|
|
2025
|
-
setState,
|
|
2026
|
-
state,
|
|
2027
|
-
onChange,
|
|
2028
|
-
onBlur,
|
|
2029
|
-
onKeyDown
|
|
2030
|
-
}) => {
|
|
2031
|
-
const inputComponents = {
|
|
2032
|
-
outlined: import_material10.OutlinedInput,
|
|
2033
|
-
filled: import_material10.FilledInput,
|
|
2034
|
-
standard: import_material10.Input
|
|
2035
|
-
};
|
|
2036
|
-
const InputComponent = inputComponents[variant] || import_material10.OutlinedInput;
|
|
2037
|
-
let IconInputStartValidation;
|
|
2038
|
-
let IconInputEndValidation;
|
|
2039
|
-
let IconInputStart;
|
|
2040
|
-
let IconInputEnd;
|
|
2041
|
-
let IconTitle;
|
|
2042
|
-
const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
|
|
2043
|
-
const [error, setError] = (0, import_react16.useState)(false);
|
|
2044
|
-
const [anchorInfoTitle, setAnchorInfoTitle] = (0, import_react16.useState)(null);
|
|
2045
|
-
const openInfoTitle = Boolean(anchorInfoTitle);
|
|
2046
|
-
const [anchorInfoElement, setAnchorInfoElement] = (0, import_react16.useState)(null);
|
|
2047
|
-
const openInfoElement = Boolean(anchorInfoElement);
|
|
2048
|
-
(0, import_react16.useEffect)(() => {
|
|
2049
|
-
if (error) {
|
|
2050
|
-
setTimeout(() => {
|
|
2051
|
-
setError(false);
|
|
2052
|
-
}, 1e3);
|
|
2053
|
-
}
|
|
2054
|
-
}, [error]);
|
|
2055
|
-
if (iconInputStart) {
|
|
2056
|
-
IconInputStartValidation = getIconValidation(iconInputStart);
|
|
2057
|
-
IconInputStart = getIconComponent2(iconInputStart);
|
|
2058
|
-
}
|
|
2059
|
-
if (iconInputEnd) {
|
|
2060
|
-
IconInputEndValidation = getIconValidation(iconInputEnd);
|
|
2061
|
-
IconInputEnd = getIconComponent2(iconInputEnd);
|
|
2062
|
-
}
|
|
2063
|
-
if (iconTitle) {
|
|
2064
|
-
IconTitle = getIconComponent2(iconTitle);
|
|
2065
|
-
}
|
|
2066
|
-
const handleClickShowPassword = () => setShowPassword((show) => !show);
|
|
2067
|
-
const handleMouseDownPassword = (event2) => {
|
|
2068
|
-
event2.preventDefault();
|
|
2069
|
-
};
|
|
2070
|
-
const handleKeyDown = (event2) => {
|
|
2071
|
-
validateKeyDown(event2, format3);
|
|
2072
|
-
if (onKeyDown) onKeyDown(event2);
|
|
2073
|
-
};
|
|
2074
|
-
const handleInputChange = (event2) => {
|
|
2075
|
-
let valueMax = maxLength ? maxLength + 1 : 50;
|
|
2076
|
-
if (event2.target.value.length < valueMax) {
|
|
2077
|
-
if (setState) {
|
|
2078
|
-
setState(event2.target.value);
|
|
2079
|
-
}
|
|
2080
|
-
if (onChange) {
|
|
2081
|
-
onChange(event2);
|
|
2082
|
-
}
|
|
2083
|
-
}
|
|
2084
|
-
};
|
|
2085
|
-
const handleBlur = validateOnBlurField({ state, required, setError, onBlur });
|
|
2086
|
-
const handleOpenInfoTitle = (event2) => {
|
|
2087
|
-
setAnchorInfoTitle(event2.currentTarget);
|
|
2088
|
-
};
|
|
2089
|
-
const handleCloseInfoTitle = () => {
|
|
2090
|
-
setAnchorInfoTitle(null);
|
|
2091
|
-
};
|
|
2092
|
-
const handleOpenInfoElement = (event2) => {
|
|
2093
|
-
setAnchorInfoElement(event2.currentTarget);
|
|
2094
|
-
};
|
|
2095
|
-
const handleCloseInfoElement = () => {
|
|
2096
|
-
setAnchorInfoElement(null);
|
|
2097
|
-
};
|
|
2098
|
-
return /* @__PURE__ */ import_react16.default.createElement(import_material10.Box, { sx: { width } }, /* @__PURE__ */ import_react16.default.createElement(import_Grid.default, { container: true, alignItems: "center", mb: 1.25, gap: 0.5 }, iconTitle && IconTitle ? /* @__PURE__ */ import_react16.default.createElement(import_material10.SvgIcon, { color: "action", fontSize: "small", component: IconTitle }) : "", title ? /* @__PURE__ */ import_react16.default.createElement(import_material10.Typography, { mx: 0.5, variant: "subtitle2", color: "text.secondary" }, title) : "", infoTitle ? /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, infoTitle.component === "popover" ? /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(
|
|
2099
|
-
import_icons_material9.InfoOutlined,
|
|
2100
|
-
{
|
|
2101
|
-
color: "action",
|
|
2102
|
-
fontSize: "small",
|
|
2103
|
-
onMouseEnter: (event2) => handleOpenInfoTitle(event2),
|
|
2104
|
-
onMouseLeave: () => handleCloseInfoTitle()
|
|
2105
|
-
}
|
|
2106
|
-
), /* @__PURE__ */ import_react16.default.createElement(
|
|
2107
|
-
import_material10.Popover,
|
|
1508
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
1509
|
+
import_material7.Popover,
|
|
2108
1510
|
{
|
|
2109
1511
|
sx: {
|
|
2110
1512
|
pointerEvents: "none",
|
|
@@ -2125,15 +1527,15 @@ var SCTextField = ({
|
|
|
2125
1527
|
},
|
|
2126
1528
|
disableRestoreFocus: true
|
|
2127
1529
|
},
|
|
2128
|
-
/* @__PURE__ */
|
|
2129
|
-
)) : /* @__PURE__ */
|
|
2130
|
-
|
|
1530
|
+
/* @__PURE__ */ import_react13.default.createElement(import_material7.Typography, { p: 2 }, infoTitle.text)
|
|
1531
|
+
)) : /* @__PURE__ */ import_react13.default.createElement(import_material7.Tooltip, { title: infoTitle.text, "data-testid": "test-infoTitle", placement: "bottom-start", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1532
|
+
import_icons_material7.InfoOutlined,
|
|
2131
1533
|
{
|
|
2132
1534
|
color: "action",
|
|
2133
1535
|
fontSize: "small"
|
|
2134
1536
|
}
|
|
2135
|
-
))) : ""), /* @__PURE__ */
|
|
2136
|
-
|
|
1537
|
+
))) : ""), /* @__PURE__ */ import_react13.default.createElement(import_Grid.default, { container: true, sx: { flexWrap: "nowrap", alignItems: "center" } }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1538
|
+
import_material7.FormControl,
|
|
2137
1539
|
{
|
|
2138
1540
|
color,
|
|
2139
1541
|
fullWidth: true,
|
|
@@ -2147,8 +1549,8 @@ var SCTextField = ({
|
|
|
2147
1549
|
}
|
|
2148
1550
|
}
|
|
2149
1551
|
},
|
|
2150
|
-
/* @__PURE__ */
|
|
2151
|
-
|
|
1552
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
1553
|
+
import_material7.InputLabel,
|
|
2152
1554
|
{
|
|
2153
1555
|
"data-testid": "test-label",
|
|
2154
1556
|
htmlFor: "",
|
|
@@ -2164,7 +1566,7 @@ var SCTextField = ({
|
|
|
2164
1566
|
},
|
|
2165
1567
|
label ? label : ""
|
|
2166
1568
|
),
|
|
2167
|
-
/* @__PURE__ */
|
|
1569
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
2168
1570
|
InputComponent,
|
|
2169
1571
|
{
|
|
2170
1572
|
size: size ? size : "medium",
|
|
@@ -2180,18 +1582,18 @@ var SCTextField = ({
|
|
|
2180
1582
|
type: !showPassword && format3 === "password" ? "password" : (format3 || "text").toUpperCase() === "INT" || (format3 || "text").toUpperCase() === "DECIMAL" ? "number" : "text",
|
|
2181
1583
|
className: format3 === "password" && !showPassword ? "" : "",
|
|
2182
1584
|
placeholder,
|
|
2183
|
-
startAdornment: iconInputStart ? /* @__PURE__ */
|
|
2184
|
-
endAdornment: /* @__PURE__ */
|
|
2185
|
-
|
|
1585
|
+
startAdornment: iconInputStart ? /* @__PURE__ */ import_react13.default.createElement(import_material7.InputAdornment, { position: "start" }, IconInputStartValidation === "text" ? iconInputStart : IconInputStart ? /* @__PURE__ */ import_react13.default.createElement(IconInputStart, { fontSize: "small" }) : null) : "",
|
|
1586
|
+
endAdornment: /* @__PURE__ */ import_react13.default.createElement(import_material7.InputAdornment, { position: "end" }, format3 === "password" ? /* @__PURE__ */ import_react13.default.createElement(
|
|
1587
|
+
import_material7.IconButton,
|
|
2186
1588
|
{
|
|
2187
1589
|
"aria-label": "toggle password visibility",
|
|
2188
1590
|
onClick: handleClickShowPassword,
|
|
2189
1591
|
onMouseDown: handleMouseDownPassword,
|
|
2190
1592
|
edge: "end"
|
|
2191
1593
|
},
|
|
2192
|
-
showPassword ? /* @__PURE__ */
|
|
2193
|
-
) : iconInputEnd === void 0 && infoElement !== void 0 ? /* @__PURE__ */
|
|
2194
|
-
|
|
1594
|
+
showPassword ? /* @__PURE__ */ import_react13.default.createElement(import_icons_material7.VisibilityOff, null) : /* @__PURE__ */ import_react13.default.createElement(import_icons_material7.Visibility, null)
|
|
1595
|
+
) : iconInputEnd === void 0 && infoElement !== void 0 ? /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, infoElement.component === "popover" ? /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
|
|
1596
|
+
import_icons_material7.InfoOutlined,
|
|
2195
1597
|
{
|
|
2196
1598
|
"data-testid": "test-infoElement",
|
|
2197
1599
|
sx: { ml: 0.5 },
|
|
@@ -2201,8 +1603,8 @@ var SCTextField = ({
|
|
|
2201
1603
|
onMouseEnter: (event2) => handleOpenInfoElement(event2),
|
|
2202
1604
|
onMouseLeave: () => handleCloseInfoElement()
|
|
2203
1605
|
}
|
|
2204
|
-
), /* @__PURE__ */
|
|
2205
|
-
|
|
1606
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
1607
|
+
import_material7.Popover,
|
|
2206
1608
|
{
|
|
2207
1609
|
sx: {
|
|
2208
1610
|
pointerEvents: "none",
|
|
@@ -2223,20 +1625,20 @@ var SCTextField = ({
|
|
|
2223
1625
|
},
|
|
2224
1626
|
disableRestoreFocus: true
|
|
2225
1627
|
},
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
)) : /* @__PURE__ */
|
|
2228
|
-
|
|
1628
|
+
/* @__PURE__ */ import_react13.default.createElement(import_material7.Typography, { "data-testid": "test-popover-text", p: 2 }, infoElement.text)
|
|
1629
|
+
)) : /* @__PURE__ */ import_react13.default.createElement(import_material7.Tooltip, { title: infoElement.text, placement: "bottom-end", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1630
|
+
import_icons_material7.InfoOutlined,
|
|
2229
1631
|
{
|
|
2230
1632
|
color: "action",
|
|
2231
1633
|
fontSize: "small"
|
|
2232
1634
|
}
|
|
2233
|
-
))) : iconInputEnd !== void 0 ? IconInputEndValidation === "text" ? iconInputEnd : IconInputEnd ? /* @__PURE__ */
|
|
1635
|
+
))) : iconInputEnd !== void 0 ? IconInputEndValidation === "text" ? iconInputEnd : IconInputEnd ? /* @__PURE__ */ import_react13.default.createElement(IconInputEnd, { fontSize: "small" }) : null : ""),
|
|
2234
1636
|
label: label ? label + (format3 === "password" && !showPassword ? "" : "") : "",
|
|
2235
1637
|
autoComplete: format3 === "password" ? "new-password" : "off"
|
|
2236
1638
|
}
|
|
2237
1639
|
)
|
|
2238
|
-
), (iconInputEnd !== void 0 || format3 === "password") && infoElement ? /* @__PURE__ */
|
|
2239
|
-
|
|
1640
|
+
), (iconInputEnd !== void 0 || format3 === "password") && infoElement ? /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, infoElement.component === "popover" ? /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
|
|
1641
|
+
import_icons_material7.InfoOutlined,
|
|
2240
1642
|
{
|
|
2241
1643
|
"data-testid": "test-infoElement",
|
|
2242
1644
|
component: "svg",
|
|
@@ -2246,8 +1648,8 @@ var SCTextField = ({
|
|
|
2246
1648
|
onMouseEnter: (event2) => handleOpenInfoElement(event2),
|
|
2247
1649
|
onMouseLeave: handleCloseInfoElement
|
|
2248
1650
|
}
|
|
2249
|
-
), /* @__PURE__ */
|
|
2250
|
-
|
|
1651
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
|
1652
|
+
import_material7.Popover,
|
|
2251
1653
|
{
|
|
2252
1654
|
sx: { pointerEvents: "none" },
|
|
2253
1655
|
open: openInfoElement,
|
|
@@ -2263,9 +1665,9 @@ var SCTextField = ({
|
|
|
2263
1665
|
},
|
|
2264
1666
|
disableRestoreFocus: true
|
|
2265
1667
|
},
|
|
2266
|
-
/* @__PURE__ */
|
|
2267
|
-
)) : /* @__PURE__ */
|
|
2268
|
-
|
|
1668
|
+
/* @__PURE__ */ import_react13.default.createElement(import_material7.Typography, { "data-testid": "test-popover-text", p: 2 }, infoElement.text)
|
|
1669
|
+
)) : /* @__PURE__ */ import_react13.default.createElement(import_material7.Tooltip, { title: infoElement.text, placement: "bottom-end", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1670
|
+
import_icons_material7.InfoOutlined,
|
|
2269
1671
|
{
|
|
2270
1672
|
sx: { marginLeft: "4px" },
|
|
2271
1673
|
color: "action",
|
|
@@ -2284,9 +1686,9 @@ function getIcon2(name) {
|
|
|
2284
1686
|
}
|
|
2285
1687
|
|
|
2286
1688
|
// src/Components/TextArea/SCTextArea.tsx
|
|
2287
|
-
var
|
|
2288
|
-
var
|
|
2289
|
-
var
|
|
1689
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
1690
|
+
var import_material8 = require("@mui/material");
|
|
1691
|
+
var import_icons_material8 = require("@mui/icons-material");
|
|
2290
1692
|
var SCTextArea = ({
|
|
2291
1693
|
//informativas
|
|
2292
1694
|
title,
|
|
@@ -2308,11 +1710,11 @@ var SCTextArea = ({
|
|
|
2308
1710
|
state,
|
|
2309
1711
|
onBlur
|
|
2310
1712
|
}) => {
|
|
2311
|
-
const [helperCount, setHelperCount] = (0,
|
|
2312
|
-
const [stateError, setStateError] = (0,
|
|
2313
|
-
const [anchorInfoTitle, setAnchorInfoTitle] =
|
|
1713
|
+
const [helperCount, setHelperCount] = (0, import_react14.useState)(0);
|
|
1714
|
+
const [stateError, setStateError] = (0, import_react14.useState)(false);
|
|
1715
|
+
const [anchorInfoTitle, setAnchorInfoTitle] = import_react14.default.useState(null);
|
|
2314
1716
|
const openInfoTitle = Boolean(anchorInfoTitle);
|
|
2315
|
-
(0,
|
|
1717
|
+
(0, import_react14.useEffect)(() => {
|
|
2316
1718
|
setHelperCount(state == null ? void 0 : state.length);
|
|
2317
1719
|
}, [state]);
|
|
2318
1720
|
const IconTitle = getIcon2(iconTitle);
|
|
@@ -2334,16 +1736,16 @@ var SCTextArea = ({
|
|
|
2334
1736
|
const handleCloseInfoTitle = () => {
|
|
2335
1737
|
setAnchorInfoTitle(null);
|
|
2336
1738
|
};
|
|
2337
|
-
return /* @__PURE__ */
|
|
2338
|
-
|
|
1739
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement(import_material8.Box, { sx: { width } }, /* @__PURE__ */ import_react14.default.createElement(import_material8.Grid, { container: true, sx: { alignItems: "center" }, gap: 0.5 }, iconTitle && IconTitle && /* @__PURE__ */ import_react14.default.createElement(import_material8.SvgIcon, { color: "action", fontSize: "small", component: IconTitle }), title && /* @__PURE__ */ import_react14.default.createElement(import_material8.Typography, { color: colorTitle || "text.secondary", variant: "subtitle2" }, title), infoTitle ? /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, infoTitle.component === "popover" ? /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement(
|
|
1740
|
+
import_icons_material8.InfoOutlined,
|
|
2339
1741
|
{
|
|
2340
1742
|
color: "action",
|
|
2341
1743
|
fontSize: "small",
|
|
2342
1744
|
onMouseEnter: (event2) => handleOpenInfoTitle(event2),
|
|
2343
1745
|
onMouseLeave: () => handleCloseInfoTitle()
|
|
2344
1746
|
}
|
|
2345
|
-
), /* @__PURE__ */
|
|
2346
|
-
|
|
1747
|
+
), /* @__PURE__ */ import_react14.default.createElement(
|
|
1748
|
+
import_material8.Popover,
|
|
2347
1749
|
{
|
|
2348
1750
|
sx: { pointerEvents: "none" },
|
|
2349
1751
|
open: openInfoTitle,
|
|
@@ -2359,15 +1761,15 @@ var SCTextArea = ({
|
|
|
2359
1761
|
},
|
|
2360
1762
|
disableRestoreFocus: true
|
|
2361
1763
|
},
|
|
2362
|
-
/* @__PURE__ */
|
|
2363
|
-
)) : /* @__PURE__ */
|
|
2364
|
-
|
|
1764
|
+
/* @__PURE__ */ import_react14.default.createElement(import_material8.Typography, { sx: { p: 2 } }, infoTitle.text)
|
|
1765
|
+
)) : /* @__PURE__ */ import_react14.default.createElement(import_material8.Tooltip, { title: infoTitle.text, placement: "bottom-start", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ import_react14.default.createElement(
|
|
1766
|
+
import_icons_material8.InfoOutlined,
|
|
2365
1767
|
{
|
|
2366
1768
|
color: "action",
|
|
2367
1769
|
fontSize: "small"
|
|
2368
1770
|
}
|
|
2369
|
-
))) : ""), /* @__PURE__ */
|
|
2370
|
-
|
|
1771
|
+
))) : ""), /* @__PURE__ */ import_react14.default.createElement(import_material8.Stack, null, /* @__PURE__ */ import_react14.default.createElement(
|
|
1772
|
+
import_material8.TextField,
|
|
2371
1773
|
{
|
|
2372
1774
|
required,
|
|
2373
1775
|
placeholder,
|
|
@@ -2391,8 +1793,8 @@ var SCTextArea = ({
|
|
|
2391
1793
|
shrink: true
|
|
2392
1794
|
}
|
|
2393
1795
|
}
|
|
2394
|
-
)), /* @__PURE__ */
|
|
2395
|
-
|
|
1796
|
+
)), /* @__PURE__ */ import_react14.default.createElement(import_material8.Stack, null, /* @__PURE__ */ import_react14.default.createElement(
|
|
1797
|
+
import_material8.Typography,
|
|
2396
1798
|
{
|
|
2397
1799
|
variant: "caption",
|
|
2398
1800
|
color: "text.secondary",
|
|
@@ -2405,10 +1807,10 @@ var SCTextArea = ({
|
|
|
2405
1807
|
};
|
|
2406
1808
|
|
|
2407
1809
|
// src/Components/SCSelect.tsx
|
|
2408
|
-
var
|
|
2409
|
-
var
|
|
1810
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
1811
|
+
var import_material9 = require("@mui/material");
|
|
2410
1812
|
var import_Select = __toESM(require("@mui/material/Select"), 1);
|
|
2411
|
-
var
|
|
1813
|
+
var Muicon4 = __toESM(require("@mui/icons-material"), 1);
|
|
2412
1814
|
function SCSelect({
|
|
2413
1815
|
label = "",
|
|
2414
1816
|
data,
|
|
@@ -2423,16 +1825,16 @@ function SCSelect({
|
|
|
2423
1825
|
state
|
|
2424
1826
|
}) {
|
|
2425
1827
|
const labelContent = `<span style="color: red;">* </span>` + label;
|
|
2426
|
-
const [prevData, setPrevData] =
|
|
2427
|
-
const [error, setError] =
|
|
2428
|
-
(0,
|
|
1828
|
+
const [prevData, setPrevData] = import_react15.default.useState(data);
|
|
1829
|
+
const [error, setError] = import_react15.default.useState(false);
|
|
1830
|
+
(0, import_react15.useEffect)(() => {
|
|
2429
1831
|
if (error) {
|
|
2430
1832
|
setTimeout(() => {
|
|
2431
1833
|
setError(false);
|
|
2432
1834
|
}, 1e3);
|
|
2433
1835
|
}
|
|
2434
1836
|
}, [error]);
|
|
2435
|
-
(0,
|
|
1837
|
+
(0, import_react15.useEffect)(() => {
|
|
2436
1838
|
let dataChangeValidation = JSON.stringify(prevData) === JSON.stringify(data);
|
|
2437
1839
|
if (dataChangeValidation == false) {
|
|
2438
1840
|
setState({ hiddenValue: "", textValue: "" });
|
|
@@ -2442,7 +1844,7 @@ function SCSelect({
|
|
|
2442
1844
|
data.map(function(option, index, array) {
|
|
2443
1845
|
if (option == null ? void 0 : option.icon) {
|
|
2444
1846
|
if ((option == null ? void 0 : option.icon.type) == void 0) {
|
|
2445
|
-
option.icon =
|
|
1847
|
+
option.icon = Muicon4[option == null ? void 0 : option.icon];
|
|
2446
1848
|
} else {
|
|
2447
1849
|
option;
|
|
2448
1850
|
}
|
|
@@ -2466,26 +1868,26 @@ function SCSelect({
|
|
|
2466
1868
|
}
|
|
2467
1869
|
}
|
|
2468
1870
|
};
|
|
2469
|
-
return /* @__PURE__ */
|
|
2470
|
-
|
|
1871
|
+
return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, data && /* @__PURE__ */ import_react15.default.createElement(import_material9.Box, { sx: { width } }, /* @__PURE__ */ import_react15.default.createElement(
|
|
1872
|
+
import_material9.FormControl,
|
|
2471
1873
|
{
|
|
2472
1874
|
fullWidth: true,
|
|
2473
1875
|
size: size ? size : "medium",
|
|
2474
1876
|
variant,
|
|
2475
1877
|
sx: { background: background ? background : "transparent" }
|
|
2476
1878
|
},
|
|
2477
|
-
/* @__PURE__ */
|
|
2478
|
-
|
|
1879
|
+
/* @__PURE__ */ import_react15.default.createElement(
|
|
1880
|
+
import_material9.InputLabel,
|
|
2479
1881
|
{
|
|
2480
1882
|
error
|
|
2481
1883
|
},
|
|
2482
|
-
required ? /* @__PURE__ */
|
|
1884
|
+
required ? /* @__PURE__ */ import_react15.default.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label
|
|
2483
1885
|
),
|
|
2484
|
-
/* @__PURE__ */
|
|
1886
|
+
/* @__PURE__ */ import_react15.default.createElement(
|
|
2485
1887
|
import_Select.default,
|
|
2486
1888
|
{
|
|
2487
1889
|
value: Array.isArray(state.hiddenValue) ? state.hiddenValue[0] || "" : state.hiddenValue != "-1" ? state.hiddenValue : "",
|
|
2488
|
-
label: required ? /* @__PURE__ */
|
|
1890
|
+
label: required ? /* @__PURE__ */ import_react15.default.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label,
|
|
2489
1891
|
onChange: handleChange,
|
|
2490
1892
|
onBlur: handleBlur,
|
|
2491
1893
|
variant,
|
|
@@ -2516,20 +1918,20 @@ function SCSelect({
|
|
|
2516
1918
|
}
|
|
2517
1919
|
},
|
|
2518
1920
|
data.map((option, index) => {
|
|
2519
|
-
return /* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ import_react15.default.createElement(import_material9.MenuItem, { key: index, value: getItemValue(option).value }, getItemValue(option).icon != void 0 ? /* @__PURE__ */ import_react15.default.createElement(import_material9.ListItemIcon, { sx: { minWidth: "10px !important" } }, /* @__PURE__ */ import_react15.default.createElement(import_material9.SvgIcon, { fontSize: "small", color: "action", component: getItemValue(option).icon })) : "", /* @__PURE__ */ import_react15.default.createElement(import_material9.ListItemText, { primary: getItemValue(option).text, color: "text.primary" }));
|
|
2520
1922
|
})
|
|
2521
1923
|
)
|
|
2522
1924
|
)));
|
|
2523
1925
|
}
|
|
2524
1926
|
|
|
2525
1927
|
// src/Components/SCAutocomplete.tsx
|
|
2526
|
-
var
|
|
2527
|
-
var
|
|
2528
|
-
var
|
|
2529
|
-
var
|
|
1928
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
1929
|
+
var import_material10 = require("@mui/material");
|
|
1930
|
+
var import_icons_material9 = require("@mui/icons-material");
|
|
1931
|
+
var Muicon5 = __toESM(require("@mui/icons-material"), 1);
|
|
2530
1932
|
var StopEvent = ({ children }) => {
|
|
2531
|
-
return /* @__PURE__ */
|
|
2532
|
-
|
|
1933
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
1934
|
+
import_material10.Box,
|
|
2533
1935
|
{
|
|
2534
1936
|
onMouseDown: (e) => {
|
|
2535
1937
|
e.preventDefault();
|
|
@@ -2567,12 +1969,12 @@ function SCAutocomplete({
|
|
|
2567
1969
|
const labelContent = `<span style="color: red;">* </span>` + label;
|
|
2568
1970
|
let group = "";
|
|
2569
1971
|
let isSelected = false;
|
|
2570
|
-
const [selectedOptions, setSelectedOptions] =
|
|
2571
|
-
const [prevData, setPrevData] =
|
|
2572
|
-
const [originalData, setOriginalData] =
|
|
2573
|
-
const [inputValue, setInputValue] =
|
|
2574
|
-
const [isUserTyping, setIsUserTyping] =
|
|
2575
|
-
(0,
|
|
1972
|
+
const [selectedOptions, setSelectedOptions] = import_react16.default.useState([]);
|
|
1973
|
+
const [prevData, setPrevData] = import_react16.default.useState(data);
|
|
1974
|
+
const [originalData, setOriginalData] = import_react16.default.useState(data);
|
|
1975
|
+
const [inputValue, setInputValue] = import_react16.default.useState("");
|
|
1976
|
+
const [isUserTyping, setIsUserTyping] = import_react16.default.useState(false);
|
|
1977
|
+
(0, import_react16.useEffect)(() => {
|
|
2576
1978
|
const dataChangeValidation = JSON.stringify(prevData) === JSON.stringify(data);
|
|
2577
1979
|
if (!dataChangeValidation && !isUserTyping) {
|
|
2578
1980
|
setState({ hiddenValue: "-1", textValue: "" });
|
|
@@ -2583,7 +1985,7 @@ function SCAutocomplete({
|
|
|
2583
1985
|
}
|
|
2584
1986
|
setPrevData(data);
|
|
2585
1987
|
}, [data, isUserTyping]);
|
|
2586
|
-
(0,
|
|
1988
|
+
(0, import_react16.useEffect)(() => {
|
|
2587
1989
|
if (typeFormat == "multiselect") {
|
|
2588
1990
|
if (state.hiddenValue != "-1" && Array.isArray(state.hiddenValue)) {
|
|
2589
1991
|
const newSelectedOptions = originalData.filter(
|
|
@@ -2593,7 +1995,7 @@ function SCAutocomplete({
|
|
|
2593
1995
|
}
|
|
2594
1996
|
}
|
|
2595
1997
|
}, [state.hiddenValue, originalData, typeFormat]);
|
|
2596
|
-
(0,
|
|
1998
|
+
(0, import_react16.useEffect)(() => {
|
|
2597
1999
|
if (inputValue === "") {
|
|
2598
2000
|
setIsUserTyping(false);
|
|
2599
2001
|
}
|
|
@@ -2608,11 +2010,11 @@ function SCAutocomplete({
|
|
|
2608
2010
|
textValue: newSelected.length > 0 ? newSelected.map((item) => getItemValue(item).text) : ""
|
|
2609
2011
|
});
|
|
2610
2012
|
};
|
|
2611
|
-
const normalizedData = (0,
|
|
2013
|
+
const normalizedData = (0, import_react16.useMemo)(() => {
|
|
2612
2014
|
return data.map((option) => {
|
|
2613
2015
|
if ((option == null ? void 0 : option.icon) && option.icon.type === void 0) {
|
|
2614
2016
|
return __spreadProps(__spreadValues({}, option), {
|
|
2615
|
-
icon:
|
|
2017
|
+
icon: Muicon5[option.icon]
|
|
2616
2018
|
});
|
|
2617
2019
|
}
|
|
2618
2020
|
return option;
|
|
@@ -2662,16 +2064,16 @@ function SCAutocomplete({
|
|
|
2662
2064
|
const selectedValue = typeFormat === "multiselect" ? selectedOptions : originalData.find(
|
|
2663
2065
|
(item) => getItemValue(item).value === state.hiddenValue
|
|
2664
2066
|
) || null;
|
|
2665
|
-
const [open, setOpen] =
|
|
2666
|
-
const componentClickActiveRef =
|
|
2667
|
-
const listboxScrollRef =
|
|
2668
|
-
const containerRef =
|
|
2669
|
-
const [chipLimit, setChipLimit] =
|
|
2670
|
-
const outsideChipsMeasureRef =
|
|
2671
|
-
const [visibleChipCount, setVisibleChipCount] =
|
|
2672
|
-
const [popoverAnchor, setPopoverAnchor] =
|
|
2673
|
-
const popoverTimerRef =
|
|
2674
|
-
(0,
|
|
2067
|
+
const [open, setOpen] = import_react16.default.useState(false);
|
|
2068
|
+
const componentClickActiveRef = import_react16.default.useRef(false);
|
|
2069
|
+
const listboxScrollRef = import_react16.default.useRef(null);
|
|
2070
|
+
const containerRef = import_react16.default.useRef(null);
|
|
2071
|
+
const [chipLimit, setChipLimit] = import_react16.default.useState(2);
|
|
2072
|
+
const outsideChipsMeasureRef = import_react16.default.useRef(null);
|
|
2073
|
+
const [visibleChipCount, setVisibleChipCount] = import_react16.default.useState(Number.MAX_SAFE_INTEGER);
|
|
2074
|
+
const [popoverAnchor, setPopoverAnchor] = import_react16.default.useState(null);
|
|
2075
|
+
const popoverTimerRef = import_react16.default.useRef(null);
|
|
2076
|
+
(0, import_react16.useEffect)(() => {
|
|
2675
2077
|
const el = containerRef.current;
|
|
2676
2078
|
if (!el) return;
|
|
2677
2079
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -2682,7 +2084,7 @@ function SCAutocomplete({
|
|
|
2682
2084
|
observer.observe(el);
|
|
2683
2085
|
return () => observer.disconnect();
|
|
2684
2086
|
}, []);
|
|
2685
|
-
(0,
|
|
2087
|
+
(0, import_react16.useEffect)(() => {
|
|
2686
2088
|
if (!chipOutside || typeFormat !== "multiselect") return;
|
|
2687
2089
|
const box = outsideChipsMeasureRef.current;
|
|
2688
2090
|
if (!box) return;
|
|
@@ -2702,7 +2104,7 @@ function SCAutocomplete({
|
|
|
2702
2104
|
observer.observe(box);
|
|
2703
2105
|
return () => observer.disconnect();
|
|
2704
2106
|
}, [selectedOptions, chipOutside, typeFormat]);
|
|
2705
|
-
(0,
|
|
2107
|
+
(0, import_react16.useEffect)(() => {
|
|
2706
2108
|
const displayCount = Math.min(visibleChipCount, selectedOptions.length);
|
|
2707
2109
|
if (selectedOptions.length - displayCount === 0) {
|
|
2708
2110
|
setPopoverAnchor(null);
|
|
@@ -2726,14 +2128,14 @@ function SCAutocomplete({
|
|
|
2726
2128
|
if (!(chipOutside == null ? void 0 : chipOutside.textSeccion)) return optionText.charAt(0).toUpperCase();
|
|
2727
2129
|
return chipOutside.textSeccion.split(",").map((p) => optionText.charAt(Number(p.trim())).toUpperCase()).join("");
|
|
2728
2130
|
};
|
|
2729
|
-
const hayOnComponentClickGlobal = (0,
|
|
2131
|
+
const hayOnComponentClickGlobal = (0, import_react16.useMemo)(() => {
|
|
2730
2132
|
return data.some((opt) => {
|
|
2731
2133
|
const item = getItemValue(opt);
|
|
2732
2134
|
return Boolean(item.onComponentClick);
|
|
2733
2135
|
});
|
|
2734
2136
|
}, [data, getItemValue]);
|
|
2735
|
-
return /* @__PURE__ */
|
|
2736
|
-
|
|
2137
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, data && /* @__PURE__ */ import_react16.default.createElement(import_material10.Box, { ref: containerRef, sx: { width } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
2138
|
+
import_material10.Autocomplete,
|
|
2737
2139
|
__spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, hayOnComponentClickGlobal ? { disableCloseOnSelect: true } : {}), hayOnComponentClickGlobal ? { blurOnSelect: false } : {}), hayOnComponentClickGlobal ? { open } : {}), hayOnComponentClickGlobal ? { onOpen: () => setOpen(true) } : {}), hayOnComponentClickGlobal ? {
|
|
2738
2140
|
onClose: (event2, reason) => {
|
|
2739
2141
|
if (componentClickActiveRef.current) return;
|
|
@@ -2765,10 +2167,10 @@ function SCAutocomplete({
|
|
|
2765
2167
|
limitTags: chipLimit,
|
|
2766
2168
|
renderTags: chipOutside ? () => null : (value, getTagProps) => {
|
|
2767
2169
|
const limit = chipLimit;
|
|
2768
|
-
return /* @__PURE__ */
|
|
2170
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, value.slice(0, limit).map((option, index) => {
|
|
2769
2171
|
const _a = getTagProps({ index }), { key } = _a, chipProps = __objRest(_a, ["key"]);
|
|
2770
|
-
return /* @__PURE__ */
|
|
2771
|
-
|
|
2172
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
2173
|
+
import_material10.Chip,
|
|
2772
2174
|
__spreadProps(__spreadValues({
|
|
2773
2175
|
key,
|
|
2774
2176
|
color: "default",
|
|
@@ -2779,7 +2181,7 @@ function SCAutocomplete({
|
|
|
2779
2181
|
style: { maxWidth: 120, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
|
|
2780
2182
|
})
|
|
2781
2183
|
);
|
|
2782
|
-
}), value.length > limit && /* @__PURE__ */
|
|
2184
|
+
}), value.length > limit && /* @__PURE__ */ import_react16.default.createElement(import_material10.Box, { sx: { ml: 0.5, fontSize: 13, color: "#666", display: "flex", alignItems: "center" } }, `+${value.length - limit}`));
|
|
2783
2185
|
},
|
|
2784
2186
|
renderOption: (props, option) => {
|
|
2785
2187
|
const _a = props, { key } = _a, optionProps = __objRest(_a, ["key"]);
|
|
@@ -2798,8 +2200,8 @@ function SCAutocomplete({
|
|
|
2798
2200
|
group = option[columnGroup];
|
|
2799
2201
|
}
|
|
2800
2202
|
const item = getItemValue(option);
|
|
2801
|
-
return /* @__PURE__ */
|
|
2802
|
-
|
|
2203
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, { key }, columnGroup ? !isValid ? /* @__PURE__ */ import_react16.default.createElement(import_material10.Typography, { color: "text.secondary", sx: { margin: "7px 16px !important", fontSize: "13px !important" } }, option[columnGroup]) : "" : "", /* @__PURE__ */ import_react16.default.createElement(
|
|
2204
|
+
import_material10.MenuItem,
|
|
2803
2205
|
__spreadProps(__spreadValues({}, optionProps), {
|
|
2804
2206
|
component: "li",
|
|
2805
2207
|
disabled: isDisabled,
|
|
@@ -2809,9 +2211,9 @@ function SCAutocomplete({
|
|
|
2809
2211
|
opacity: isDisabled ? 0.5 : 1
|
|
2810
2212
|
}
|
|
2811
2213
|
}),
|
|
2812
|
-
typeFormat != "multiselect" && getItemValue(option).icon != void 0 ? /* @__PURE__ */
|
|
2813
|
-
typeFormat == "multiselect" ? /* @__PURE__ */
|
|
2814
|
-
|
|
2214
|
+
typeFormat != "multiselect" && getItemValue(option).icon != void 0 ? /* @__PURE__ */ import_react16.default.createElement(import_material10.ListItemIcon, { sx: { minWidth: "10px !important" } }, /* @__PURE__ */ import_react16.default.createElement(import_material10.SvgIcon, { fontSize: "small", color: "action", component: getItemValue(option).icon })) : "",
|
|
2215
|
+
typeFormat == "multiselect" ? /* @__PURE__ */ import_react16.default.createElement(
|
|
2216
|
+
import_material10.Checkbox,
|
|
2815
2217
|
{
|
|
2816
2218
|
checked: isSelected,
|
|
2817
2219
|
disabled: isDisabled,
|
|
@@ -2819,8 +2221,8 @@ function SCAutocomplete({
|
|
|
2819
2221
|
color: "primary"
|
|
2820
2222
|
}
|
|
2821
2223
|
) : "",
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
item.component != null ? /* @__PURE__ */
|
|
2224
|
+
/* @__PURE__ */ import_react16.default.createElement(import_material10.ListItemText, { primary: getItemValue(option).text, color: "text.primary" }),
|
|
2225
|
+
item.component != null ? /* @__PURE__ */ import_react16.default.createElement(StopEvent, null, /* @__PURE__ */ import_react16.default.createElement(
|
|
2824
2226
|
"span",
|
|
2825
2227
|
{
|
|
2826
2228
|
onMouseDown: (event2) => {
|
|
@@ -2851,8 +2253,8 @@ function SCAutocomplete({
|
|
|
2851
2253
|
)) : null
|
|
2852
2254
|
)));
|
|
2853
2255
|
},
|
|
2854
|
-
renderInput: (params) => /* @__PURE__ */
|
|
2855
|
-
|
|
2256
|
+
renderInput: (params) => /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(
|
|
2257
|
+
import_material10.TextField,
|
|
2856
2258
|
__spreadProps(__spreadValues({
|
|
2857
2259
|
sx: {
|
|
2858
2260
|
"& .MuiOutlinedInput-input": {
|
|
@@ -2863,10 +2265,10 @@ function SCAutocomplete({
|
|
|
2863
2265
|
}
|
|
2864
2266
|
}
|
|
2865
2267
|
}, params), {
|
|
2866
|
-
label: required ? /* @__PURE__ */
|
|
2268
|
+
label: required ? /* @__PURE__ */ import_react16.default.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label,
|
|
2867
2269
|
placeholder: selectedOptions.length == 0 ? "B\xFAsqueda" : "",
|
|
2868
2270
|
InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
|
|
2869
|
-
endAdornment: /* @__PURE__ */
|
|
2271
|
+
endAdornment: /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, deleteType == "icon" && (state.hiddenValue.toString() != "-1" && state.hiddenValue.toString() != "") ? /* @__PURE__ */ import_react16.default.createElement(import_material10.IconButton, { size: "small", onClick: cleanOptions, sx: { marginLeft: "auto", textAlign: "right", padding: "0px" } }, /* @__PURE__ */ import_react16.default.createElement(import_icons_material9.Clear, { fontSize: "small" })) : "", /* @__PURE__ */ import_react16.default.createElement(import_material10.InputAdornment, { style: { zIndex: 1, position: "relative" }, position: "end" }, /* @__PURE__ */ import_react16.default.createElement(import_icons_material9.Search, { fontSize: "small", color: "action", style: { cursor: "pointer" } })))
|
|
2870
2272
|
})
|
|
2871
2273
|
})
|
|
2872
2274
|
)),
|
|
@@ -2878,9 +2280,9 @@ function SCAutocomplete({
|
|
|
2878
2280
|
}
|
|
2879
2281
|
},
|
|
2880
2282
|
listbox: {
|
|
2881
|
-
component:
|
|
2882
|
-
return /* @__PURE__ */
|
|
2883
|
-
|
|
2283
|
+
component: import_react16.default.forwardRef(function ListboxComponent(props, ref) {
|
|
2284
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(
|
|
2285
|
+
import_material10.Box,
|
|
2884
2286
|
__spreadProps(__spreadValues({
|
|
2885
2287
|
ref: (node) => {
|
|
2886
2288
|
listboxScrollRef.current = node;
|
|
@@ -2894,10 +2296,10 @@ function SCAutocomplete({
|
|
|
2894
2296
|
backgroundColor: "white"
|
|
2895
2297
|
}, props.sx)
|
|
2896
2298
|
}),
|
|
2897
|
-
checkMassive && typeFormat == "multiselect" ? /* @__PURE__ */
|
|
2299
|
+
checkMassive && typeFormat == "multiselect" ? /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_material10.FormControlLabel, { control: /* @__PURE__ */ import_react16.default.createElement(import_material10.Checkbox, { checked: allSelected, indeterminate: selectedOptions.length > 0 && selectedOptions.length < data.length, onChange: handleCheckAll, color: "primary" }), label: "Todos los items", sx: { marginLeft: "0px !important", marginRight: "0px !important", padding: "7px 16px" } }), /* @__PURE__ */ import_react16.default.createElement(import_material10.Divider, null)) : "",
|
|
2898
2300
|
props.children,
|
|
2899
|
-
deleteType == "button" || fnAplicar ? /* @__PURE__ */
|
|
2900
|
-
|
|
2301
|
+
deleteType == "button" || fnAplicar ? /* @__PURE__ */ import_react16.default.createElement(
|
|
2302
|
+
import_material10.Grid,
|
|
2901
2303
|
{
|
|
2902
2304
|
container: true,
|
|
2903
2305
|
sx: {
|
|
@@ -2911,8 +2313,8 @@ function SCAutocomplete({
|
|
|
2911
2313
|
justifyContent: "space-between"
|
|
2912
2314
|
}
|
|
2913
2315
|
},
|
|
2914
|
-
deleteType == "button" ? /* @__PURE__ */
|
|
2915
|
-
|
|
2316
|
+
deleteType == "button" ? /* @__PURE__ */ import_react16.default.createElement(
|
|
2317
|
+
import_material10.Button,
|
|
2916
2318
|
{
|
|
2917
2319
|
variant: "text",
|
|
2918
2320
|
color: "primary",
|
|
@@ -2925,8 +2327,8 @@ function SCAutocomplete({
|
|
|
2925
2327
|
},
|
|
2926
2328
|
"Limpiar"
|
|
2927
2329
|
) : "",
|
|
2928
|
-
fnAplicar && /* @__PURE__ */
|
|
2929
|
-
|
|
2330
|
+
fnAplicar && /* @__PURE__ */ import_react16.default.createElement(
|
|
2331
|
+
import_material10.Button,
|
|
2930
2332
|
{
|
|
2931
2333
|
variant: "contained",
|
|
2932
2334
|
color: "primary",
|
|
@@ -2944,8 +2346,8 @@ function SCAutocomplete({
|
|
|
2944
2346
|
), chipOutside && typeFormat === "multiselect" && selectedOptions.length > 0 && (() => {
|
|
2945
2347
|
const displayCount = Math.min(visibleChipCount, selectedOptions.length);
|
|
2946
2348
|
const hiddenCount = selectedOptions.length - displayCount;
|
|
2947
|
-
return /* @__PURE__ */
|
|
2948
|
-
|
|
2349
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_material10.Box, { sx: { position: "relative", mt: 0.5 } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
2350
|
+
import_material10.Box,
|
|
2949
2351
|
{
|
|
2950
2352
|
ref: outsideChipsMeasureRef,
|
|
2951
2353
|
"aria-hidden": "true",
|
|
@@ -2963,18 +2365,18 @@ function SCAutocomplete({
|
|
|
2963
2365
|
},
|
|
2964
2366
|
selectedOptions.map((option) => {
|
|
2965
2367
|
const avatarText = resolveAvatarText(option);
|
|
2966
|
-
return /* @__PURE__ */
|
|
2967
|
-
|
|
2368
|
+
return /* @__PURE__ */ import_react16.default.createElement("div", { key: getItemValue(option).value, "data-outside-chip": true, style: { display: "inline-flex" } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
2369
|
+
import_material10.Chip,
|
|
2968
2370
|
__spreadValues({
|
|
2969
2371
|
size: "medium",
|
|
2970
2372
|
label: getItemValue(option).text
|
|
2971
|
-
}, chipOutside.type === "avatar" ? { avatar: /* @__PURE__ */
|
|
2373
|
+
}, chipOutside.type === "avatar" ? { avatar: /* @__PURE__ */ import_react16.default.createElement(import_material10.Avatar, null, avatarText) } : {})
|
|
2972
2374
|
));
|
|
2973
2375
|
})
|
|
2974
|
-
), /* @__PURE__ */
|
|
2376
|
+
), /* @__PURE__ */ import_react16.default.createElement(import_material10.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5, maxHeight: 36, overflow: "hidden" } }, selectedOptions.slice(0, displayCount).map((option) => {
|
|
2975
2377
|
const avatarText = resolveAvatarText(option);
|
|
2976
|
-
return /* @__PURE__ */
|
|
2977
|
-
|
|
2378
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
2379
|
+
import_material10.Chip,
|
|
2978
2380
|
__spreadValues({
|
|
2979
2381
|
key: getItemValue(option).value,
|
|
2980
2382
|
color: "default",
|
|
@@ -2982,26 +2384,26 @@ function SCAutocomplete({
|
|
|
2982
2384
|
variant: "filled",
|
|
2983
2385
|
label: getItemValue(option).text,
|
|
2984
2386
|
onDelete: () => handleDeleteChip(option)
|
|
2985
|
-
}, chipOutside.type === "avatar" ? { avatar: /* @__PURE__ */
|
|
2387
|
+
}, chipOutside.type === "avatar" ? { avatar: /* @__PURE__ */ import_react16.default.createElement(import_material10.Avatar, null, avatarText) } : {})
|
|
2986
2388
|
);
|
|
2987
|
-
}), hiddenCount > 0 && /* @__PURE__ */
|
|
2988
|
-
|
|
2389
|
+
}), hiddenCount > 0 && /* @__PURE__ */ import_react16.default.createElement(
|
|
2390
|
+
import_material10.Box,
|
|
2989
2391
|
{
|
|
2990
2392
|
onMouseEnter: handlePlusEnter,
|
|
2991
2393
|
onMouseLeave: handlePlusLeave,
|
|
2992
2394
|
sx: { ml: 0.5, fontSize: 13, color: "#666", display: "flex", alignItems: "center", cursor: "default" }
|
|
2993
2395
|
},
|
|
2994
2396
|
`+${hiddenCount}`
|
|
2995
|
-
)), /* @__PURE__ */
|
|
2996
|
-
|
|
2397
|
+
)), /* @__PURE__ */ import_react16.default.createElement(
|
|
2398
|
+
import_material10.Popper,
|
|
2997
2399
|
{
|
|
2998
2400
|
open: Boolean(popoverAnchor),
|
|
2999
2401
|
anchorEl: popoverAnchor,
|
|
3000
2402
|
placement: "bottom-start",
|
|
3001
2403
|
sx: { zIndex: 1500 }
|
|
3002
2404
|
},
|
|
3003
|
-
/* @__PURE__ */
|
|
3004
|
-
|
|
2405
|
+
/* @__PURE__ */ import_react16.default.createElement(
|
|
2406
|
+
import_material10.Paper,
|
|
3005
2407
|
{
|
|
3006
2408
|
elevation: 3,
|
|
3007
2409
|
onMouseEnter: handlePopperEnter,
|
|
@@ -3010,8 +2412,8 @@ function SCAutocomplete({
|
|
|
3010
2412
|
},
|
|
3011
2413
|
selectedOptions.slice(displayCount).map((option) => {
|
|
3012
2414
|
const avatarText = resolveAvatarText(option);
|
|
3013
|
-
return /* @__PURE__ */
|
|
3014
|
-
|
|
2415
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
2416
|
+
import_material10.Chip,
|
|
3015
2417
|
__spreadValues({
|
|
3016
2418
|
key: getItemValue(option).value,
|
|
3017
2419
|
color: "default",
|
|
@@ -3019,7 +2421,7 @@ function SCAutocomplete({
|
|
|
3019
2421
|
variant: "filled",
|
|
3020
2422
|
label: getItemValue(option).text,
|
|
3021
2423
|
onDelete: () => handleDeleteChip(option)
|
|
3022
|
-
}, chipOutside.type === "avatar" ? { avatar: /* @__PURE__ */
|
|
2424
|
+
}, chipOutside.type === "avatar" ? { avatar: /* @__PURE__ */ import_react16.default.createElement(import_material10.Avatar, { sx: { fontSize: avatarText.length > 1 ? "0.55rem" : "0.75rem" } }, avatarText) } : {})
|
|
3023
2425
|
);
|
|
3024
2426
|
})
|
|
3025
2427
|
)
|
|
@@ -3028,14 +2430,14 @@ function SCAutocomplete({
|
|
|
3028
2430
|
}
|
|
3029
2431
|
|
|
3030
2432
|
// src/Components/SCDateRange.tsx
|
|
3031
|
-
var
|
|
3032
|
-
var
|
|
2433
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
2434
|
+
var import_material11 = require("@mui/material");
|
|
3033
2435
|
var import_LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
|
|
3034
2436
|
var import_AdapterDayjs = require("@mui/x-date-pickers/AdapterDayjs");
|
|
3035
2437
|
var import_DateRangePicker = require("@mui/x-date-pickers-pro/DateRangePicker");
|
|
3036
2438
|
var import_MultiInputDateRangeField = require("@mui/x-date-pickers-pro/MultiInputDateRangeField");
|
|
3037
|
-
var
|
|
3038
|
-
var
|
|
2439
|
+
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
2440
|
+
var import_es = require("dayjs/locale/es");
|
|
3039
2441
|
var import_x_license = require("@mui/x-license");
|
|
3040
2442
|
var import_InsertInvitationOutlined = __toESM(require("@mui/icons-material/InsertInvitationOutlined"), 1);
|
|
3041
2443
|
var SCDateRange = ({
|
|
@@ -3053,12 +2455,12 @@ var SCDateRange = ({
|
|
|
3053
2455
|
const isStartEmpty = required && !state[0];
|
|
3054
2456
|
const isEndEmpty = required && !state[1];
|
|
3055
2457
|
const hasError = isStartEmpty || isEndEmpty;
|
|
3056
|
-
const [notification, setNotification] =
|
|
2458
|
+
const [notification, setNotification] = import_react17.default.useState(false);
|
|
3057
2459
|
const handleDateChange = (newValue) => {
|
|
3058
|
-
const minDateDayjs = (0,
|
|
2460
|
+
const minDateDayjs = (0, import_dayjs.default)("2013-01-01");
|
|
3059
2461
|
const convertedValue = [
|
|
3060
|
-
newValue[0] ? (0,
|
|
3061
|
-
newValue[1] ? (0,
|
|
2462
|
+
newValue[0] ? (0, import_dayjs.default)(newValue[0]) : null,
|
|
2463
|
+
newValue[1] ? (0, import_dayjs.default)(newValue[1]) : null
|
|
3062
2464
|
];
|
|
3063
2465
|
if (convertedValue[0] != null) {
|
|
3064
2466
|
if ((!convertedValue[0].isValid() || !convertedValue[0].isAfter(minDateDayjs)) == true) {
|
|
@@ -3097,7 +2499,7 @@ var SCDateRange = ({
|
|
|
3097
2499
|
setState(convertedValue);
|
|
3098
2500
|
}
|
|
3099
2501
|
};
|
|
3100
|
-
return /* @__PURE__ */
|
|
2502
|
+
return /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, /* @__PURE__ */ import_react17.default.createElement(import_LocalizationProvider.LocalizationProvider, { dateAdapter: import_AdapterDayjs.AdapterDayjs, adapterLocale: "es" }, /* @__PURE__ */ import_react17.default.createElement(import_material11.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react17.default.createElement(
|
|
3101
2503
|
import_DateRangePicker.DateRangePicker,
|
|
3102
2504
|
{
|
|
3103
2505
|
value: state,
|
|
@@ -3121,7 +2523,7 @@ var SCDateRange = ({
|
|
|
3121
2523
|
required,
|
|
3122
2524
|
error: isStart ? isStartEmpty : isEndEmpty,
|
|
3123
2525
|
InputProps: {
|
|
3124
|
-
endAdornment: /* @__PURE__ */
|
|
2526
|
+
endAdornment: /* @__PURE__ */ import_react17.default.createElement(import_material11.InputAdornment, { position: "end" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
3125
2527
|
import_InsertInvitationOutlined.default,
|
|
3126
2528
|
{
|
|
3127
2529
|
color: hasError ? "error" : "action",
|
|
@@ -3157,11 +2559,11 @@ var DrawerContent = ({ arrayElements }) => {
|
|
|
3157
2559
|
var _a, _b, _c, _d, _e, _f;
|
|
3158
2560
|
const key = `Stack_${(_a = arrayElement.type) != null ? _a : ""} ${(_b = arrayElement.label) != null ? _b : ""}${index}`;
|
|
3159
2561
|
if (arrayElement.component) {
|
|
3160
|
-
return /* @__PURE__ */
|
|
2562
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_material12.Stack, { direction: "row", alignItems: "left", gap: 1 }, arrayElement.component);
|
|
3161
2563
|
}
|
|
3162
2564
|
switch (arrayElement.type) {
|
|
3163
2565
|
case "textField":
|
|
3164
|
-
return /* @__PURE__ */
|
|
2566
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
3165
2567
|
SCTextField,
|
|
3166
2568
|
{
|
|
3167
2569
|
title: arrayElement.title,
|
|
@@ -3189,7 +2591,7 @@ var DrawerContent = ({ arrayElements }) => {
|
|
|
3189
2591
|
}
|
|
3190
2592
|
);
|
|
3191
2593
|
case "textArea":
|
|
3192
|
-
return /* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
3193
2595
|
SCTextArea,
|
|
3194
2596
|
{
|
|
3195
2597
|
title: arrayElement.title,
|
|
@@ -3210,7 +2612,7 @@ var DrawerContent = ({ arrayElements }) => {
|
|
|
3210
2612
|
}
|
|
3211
2613
|
);
|
|
3212
2614
|
case "autocomplete":
|
|
3213
|
-
return /* @__PURE__ */
|
|
2615
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
3214
2616
|
SCAutocomplete,
|
|
3215
2617
|
{
|
|
3216
2618
|
label: arrayElement.label,
|
|
@@ -3230,7 +2632,7 @@ var DrawerContent = ({ arrayElements }) => {
|
|
|
3230
2632
|
}
|
|
3231
2633
|
);
|
|
3232
2634
|
case "select":
|
|
3233
|
-
return /* @__PURE__ */
|
|
2635
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
3234
2636
|
SCSelect,
|
|
3235
2637
|
{
|
|
3236
2638
|
label: arrayElement.label,
|
|
@@ -3248,7 +2650,7 @@ var DrawerContent = ({ arrayElements }) => {
|
|
|
3248
2650
|
}
|
|
3249
2651
|
);
|
|
3250
2652
|
case "dateRange":
|
|
3251
|
-
return /* @__PURE__ */
|
|
2653
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
3252
2654
|
SCDateRange,
|
|
3253
2655
|
{
|
|
3254
2656
|
labelDateInitial: arrayElement.labelDateInitial,
|
|
@@ -3264,299 +2666,959 @@ var DrawerContent = ({ arrayElements }) => {
|
|
|
3264
2666
|
return null;
|
|
3265
2667
|
}
|
|
3266
2668
|
};
|
|
3267
|
-
return /* @__PURE__ */
|
|
2669
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_material12.Stack, { alignItems: "flex-start", height: "100%", gap: "16px", flex: 1, overflow: "auto", padding: "16px" }, arrayElements == null ? void 0 : arrayElements.map((arrayElement, index) => {
|
|
3268
2670
|
var _a, _b;
|
|
3269
|
-
return /* @__PURE__ */
|
|
3270
|
-
|
|
2671
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
2672
|
+
import_material12.Box,
|
|
3271
2673
|
{
|
|
3272
2674
|
key: `Stack_${(_a = arrayElement.type) != null ? _a : ""} ${(_b = arrayElement.label) != null ? _b : ""}${index}`,
|
|
3273
2675
|
sx: { width: "100%" }
|
|
3274
2676
|
},
|
|
3275
|
-
renderElement(arrayElement, index)
|
|
3276
|
-
);
|
|
3277
|
-
}));
|
|
3278
|
-
};
|
|
3279
|
-
|
|
3280
|
-
// src/Components/Drawer/components/DrawerActions.tsx
|
|
3281
|
-
var
|
|
3282
|
-
var
|
|
3283
|
-
var import_Grid2 = __toESM(require("@mui/material/Grid"), 1);
|
|
3284
|
-
var DrawerActions = ({ actions, anchor }) => {
|
|
3285
|
-
if (actions === false || actions === void 0) {
|
|
3286
|
-
return null;
|
|
3287
|
-
}
|
|
3288
|
-
if (!Array.isArray(actions) || actions.length === 0) {
|
|
3289
|
-
return null;
|
|
3290
|
-
}
|
|
3291
|
-
return /* @__PURE__ */
|
|
3292
|
-
import_Grid2.default,
|
|
2677
|
+
renderElement(arrayElement, index)
|
|
2678
|
+
);
|
|
2679
|
+
}));
|
|
2680
|
+
};
|
|
2681
|
+
|
|
2682
|
+
// src/Components/Drawer/components/DrawerActions.tsx
|
|
2683
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
2684
|
+
var import_material13 = require("@mui/material");
|
|
2685
|
+
var import_Grid2 = __toESM(require("@mui/material/Grid"), 1);
|
|
2686
|
+
var DrawerActions = ({ actions, anchor }) => {
|
|
2687
|
+
if (actions === false || actions === void 0) {
|
|
2688
|
+
return null;
|
|
2689
|
+
}
|
|
2690
|
+
if (!Array.isArray(actions) || actions.length === 0) {
|
|
2691
|
+
return null;
|
|
2692
|
+
}
|
|
2693
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
2694
|
+
import_Grid2.default,
|
|
2695
|
+
{
|
|
2696
|
+
sx: { borderTop: 1, borderColor: "#1018403B", zIndex: 1500 },
|
|
2697
|
+
container: true,
|
|
2698
|
+
gap: 2,
|
|
2699
|
+
padding: "8px 16px",
|
|
2700
|
+
height: "42px",
|
|
2701
|
+
alignItems: "center",
|
|
2702
|
+
flexWrap: "nowrap",
|
|
2703
|
+
justifyContent: actions.length > 1 ? "space-between" : "flex-start",
|
|
2704
|
+
flexDirection: "row-reverse"
|
|
2705
|
+
},
|
|
2706
|
+
actions.map((btn, index) => /* @__PURE__ */ import_react19.default.createElement(
|
|
2707
|
+
import_material13.Button,
|
|
2708
|
+
{
|
|
2709
|
+
key: index,
|
|
2710
|
+
variant: index === 0 || actions.length < 2 ? "contained" : "text",
|
|
2711
|
+
color: btn.color ? btn.color : "primary",
|
|
2712
|
+
onClick: btn.fn,
|
|
2713
|
+
disabled: btn.disabled || false,
|
|
2714
|
+
size: "small",
|
|
2715
|
+
fullWidth: anchor === "bottom" ? true : false
|
|
2716
|
+
},
|
|
2717
|
+
btn.text
|
|
2718
|
+
))
|
|
2719
|
+
);
|
|
2720
|
+
};
|
|
2721
|
+
|
|
2722
|
+
// src/Components/Drawer/components/DrawerHeader.tsx
|
|
2723
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
2724
|
+
var import_material14 = require("@mui/material");
|
|
2725
|
+
var import_Grid3 = __toESM(require("@mui/material/Grid"), 1);
|
|
2726
|
+
var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
|
|
2727
|
+
var DrawerHeader = ({
|
|
2728
|
+
title,
|
|
2729
|
+
colorTitle,
|
|
2730
|
+
onClose,
|
|
2731
|
+
filterSideCard,
|
|
2732
|
+
type = "Drawer"
|
|
2733
|
+
}) => {
|
|
2734
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
2735
|
+
import_Grid3.default,
|
|
2736
|
+
{
|
|
2737
|
+
container: true,
|
|
2738
|
+
sx: {
|
|
2739
|
+
marginTop: type == "Swipeable" ? "16px" : "0px",
|
|
2740
|
+
backgroundColor: type == "Swipeable" ? "white" : type == "Sidecar" ? "#EAEBEC" : "primary.50",
|
|
2741
|
+
alignItems: "center",
|
|
2742
|
+
height: filterSideCard ? "38px" : "42px",
|
|
2743
|
+
textAlign: "left",
|
|
2744
|
+
padding: "8px 12px",
|
|
2745
|
+
justifyContent: "space-between",
|
|
2746
|
+
alignContent: "center"
|
|
2747
|
+
}
|
|
2748
|
+
},
|
|
2749
|
+
/* @__PURE__ */ import_react20.default.createElement(import_material14.Typography, { variant: filterSideCard ? "body2" : "h6", color: colorTitle || "text.primary" }, title != null ? title : "Personaliza tu b\xFAsqueda aqui"),
|
|
2750
|
+
filterSideCard ? /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, filterSideCard) : /* @__PURE__ */ import_react20.default.createElement(import_material14.IconButton, { onClick: onClose }, /* @__PURE__ */ import_react20.default.createElement(import_Close.default, { "data-testid": "test-button-close", sx: { color: "text.primary" } }))
|
|
2751
|
+
);
|
|
2752
|
+
};
|
|
2753
|
+
|
|
2754
|
+
// src/Components/Drawer/SCDrawer.tsx
|
|
2755
|
+
function SCDrawer({
|
|
2756
|
+
title,
|
|
2757
|
+
arrayElements = [],
|
|
2758
|
+
actions,
|
|
2759
|
+
buttonDrawer,
|
|
2760
|
+
colorTitle,
|
|
2761
|
+
anchor = "left",
|
|
2762
|
+
width,
|
|
2763
|
+
open,
|
|
2764
|
+
setOpen,
|
|
2765
|
+
chipFilters,
|
|
2766
|
+
heightDrawer = 456,
|
|
2767
|
+
filterSideCard,
|
|
2768
|
+
type = "Drawer",
|
|
2769
|
+
onChipDelete
|
|
2770
|
+
}) {
|
|
2771
|
+
const drawerBleeding = heightDrawer;
|
|
2772
|
+
const { drawerOpen, handleDrawerClose, toggleDrawer } = useDrawerState({ open, setOpen });
|
|
2773
|
+
const { toast, setToastWithDelay } = useToast();
|
|
2774
|
+
const {
|
|
2775
|
+
stateChipFilters,
|
|
2776
|
+
setChipFilters,
|
|
2777
|
+
textFilters,
|
|
2778
|
+
setTextFilters,
|
|
2779
|
+
shouldShowChips,
|
|
2780
|
+
processChipFilters
|
|
2781
|
+
} = useChipFilters(arrayElements, chipFilters);
|
|
2782
|
+
const handleInputValidation = () => {
|
|
2783
|
+
if (chipFilters == null ? void 0 : chipFilters.length) {
|
|
2784
|
+
processChipFilters();
|
|
2785
|
+
} else {
|
|
2786
|
+
processChipFilters();
|
|
2787
|
+
validateInputs(
|
|
2788
|
+
arrayElements,
|
|
2789
|
+
setToastWithDelay,
|
|
2790
|
+
handleDrawerClose,
|
|
2791
|
+
setChipFilters,
|
|
2792
|
+
setTextFilters
|
|
2793
|
+
);
|
|
2794
|
+
}
|
|
2795
|
+
};
|
|
2796
|
+
const handleCleanFilters = () => {
|
|
2797
|
+
cleanAllFilters(arrayElements, setTextFilters);
|
|
2798
|
+
};
|
|
2799
|
+
const handleDeleteFilter = (element) => {
|
|
2800
|
+
deleteFilter(element, shouldShowChips, setTextFilters);
|
|
2801
|
+
onChipDelete == null ? void 0 : onChipDelete(element);
|
|
2802
|
+
};
|
|
2803
|
+
const getActions = () => {
|
|
2804
|
+
if (actions === false) return false;
|
|
2805
|
+
if (actions !== void 0) return actions;
|
|
2806
|
+
return [
|
|
2807
|
+
{ text: "Aplicar filtros", fn: handleInputValidation },
|
|
2808
|
+
{ text: "Limpiar filtros", fn: handleCleanFilters }
|
|
2809
|
+
];
|
|
2810
|
+
};
|
|
2811
|
+
const drawerActions = getActions();
|
|
2812
|
+
return /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, toast && /* @__PURE__ */ import_react21.default.createElement(SCToastNotification, __spreadValues({}, toast)), /* @__PURE__ */ import_react21.default.createElement(
|
|
2813
|
+
import_Grid4.default,
|
|
2814
|
+
{
|
|
2815
|
+
container: true,
|
|
2816
|
+
justifyContent: "flex-start",
|
|
2817
|
+
flexWrap: "nowrap",
|
|
2818
|
+
alignItems: "center",
|
|
2819
|
+
sx: { width: "100%" }
|
|
2820
|
+
},
|
|
2821
|
+
shouldShowChips && /* @__PURE__ */ import_react21.default.createElement(
|
|
2822
|
+
ChipFiltersDisplay,
|
|
2823
|
+
{
|
|
2824
|
+
textFilters,
|
|
2825
|
+
onDeleteFilter: handleDeleteFilter
|
|
2826
|
+
}
|
|
2827
|
+
),
|
|
2828
|
+
buttonDrawer && /* @__PURE__ */ import_react21.default.createElement(
|
|
2829
|
+
DrawerButton,
|
|
2830
|
+
{
|
|
2831
|
+
buttonDrawer,
|
|
2832
|
+
onToggle: toggleDrawer(true)
|
|
2833
|
+
}
|
|
2834
|
+
)
|
|
2835
|
+
), type != "Swipeable" ? /* @__PURE__ */ import_react21.default.createElement(
|
|
2836
|
+
import_material15.Drawer,
|
|
2837
|
+
{
|
|
2838
|
+
open: drawerOpen,
|
|
2839
|
+
onClose: type == "Sidecar" ? void 0 : toggleDrawer(false),
|
|
2840
|
+
anchor: anchor != null ? anchor : "left",
|
|
2841
|
+
sx: {
|
|
2842
|
+
"& .MuiDrawer-paper": {
|
|
2843
|
+
width: type == "Sidecar" ? "100%" : width != null ? width : "450px",
|
|
2844
|
+
boxSizing: "border-box",
|
|
2845
|
+
borderRadius: anchor !== "right" ? "0px 4px 4px 0px" : "4px 0px 0px 4px",
|
|
2846
|
+
boxShadow: type == "Sidecar" ? "none !important" : "0px 8px 10px -5px rgba(24, 39, 75, 0.2), 0px 16px 24px 2px rgba(24, 39, 75, 0.14), 0px 6px 30px 5px rgba(24, 39, 75, 0.12)"
|
|
2847
|
+
},
|
|
2848
|
+
"&.MuiDrawer-root": {
|
|
2849
|
+
boxShadow: type == "Sidecar" ? "none !important" : "0px 3px 1px -2px rgba(24, 39, 75, 0.20),0px 2px 2px 0px rgba(24, 39, 75, 0.14),0px 1px 5px 0px rgba(24, 39, 75, 0.12)"
|
|
2850
|
+
}
|
|
2851
|
+
},
|
|
2852
|
+
ModalProps: {
|
|
2853
|
+
keepMounted: true,
|
|
2854
|
+
disablePortal: type == "Sidecar" ? true : false,
|
|
2855
|
+
slotProps: {
|
|
2856
|
+
root: {
|
|
2857
|
+
style: {
|
|
2858
|
+
position: "absolute"
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
},
|
|
2863
|
+
hideBackdrop: true,
|
|
2864
|
+
PaperProps: {
|
|
2865
|
+
sx: {
|
|
2866
|
+
position: "absolute !important",
|
|
2867
|
+
height: "100%",
|
|
2868
|
+
width: 300,
|
|
2869
|
+
right: 0
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
},
|
|
2873
|
+
/* @__PURE__ */ import_react21.default.createElement(import_material15.Stack, { flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
2874
|
+
DrawerHeader,
|
|
2875
|
+
{
|
|
2876
|
+
title,
|
|
2877
|
+
colorTitle,
|
|
2878
|
+
onClose: handleDrawerClose,
|
|
2879
|
+
filterSideCard,
|
|
2880
|
+
type
|
|
2881
|
+
}
|
|
2882
|
+
), /* @__PURE__ */ import_react21.default.createElement(DrawerContent, { arrayElements }), /* @__PURE__ */ import_react21.default.createElement(DrawerActions, { actions: drawerActions, anchor }))
|
|
2883
|
+
) : /* @__PURE__ */ import_react21.default.createElement(
|
|
2884
|
+
import_material15.SwipeableDrawer,
|
|
2885
|
+
{
|
|
2886
|
+
open: drawerOpen,
|
|
2887
|
+
onClose: toggleDrawer(false),
|
|
2888
|
+
onOpen: toggleDrawer(true),
|
|
2889
|
+
anchor: "bottom",
|
|
2890
|
+
swipeAreaWidth: drawerBleeding,
|
|
2891
|
+
transitionDuration: { enter: 500, exit: 400 },
|
|
2892
|
+
ModalProps: {
|
|
2893
|
+
BackdropProps: { timeout: 400 }
|
|
2894
|
+
},
|
|
2895
|
+
hysteresis: 0.2,
|
|
2896
|
+
sx: {
|
|
2897
|
+
zIndex: 1400,
|
|
2898
|
+
"& .MuiDrawer-paper": {
|
|
2899
|
+
width: "auto",
|
|
2900
|
+
height: `calc(50% - ${drawerBleeding}px)`,
|
|
2901
|
+
boxSizing: "border-box",
|
|
2902
|
+
borderRadius: "4px 4px 0px 0px"
|
|
2903
|
+
}
|
|
2904
|
+
},
|
|
2905
|
+
slotProps: {
|
|
2906
|
+
backdrop: {
|
|
2907
|
+
sx: { backgroundColor: "#00000038" }
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
},
|
|
2911
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
2912
|
+
import_material15.Box,
|
|
2913
|
+
{
|
|
2914
|
+
sx: {
|
|
2915
|
+
width: 30,
|
|
2916
|
+
height: 6,
|
|
2917
|
+
backgroundColor: "#ccc",
|
|
2918
|
+
borderRadius: 3,
|
|
2919
|
+
position: "absolute",
|
|
2920
|
+
top: 8,
|
|
2921
|
+
left: "calc(50% - 15px)"
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
),
|
|
2925
|
+
/* @__PURE__ */ import_react21.default.createElement(import_material15.Stack, { flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react21.default.createElement(
|
|
2926
|
+
DrawerHeader,
|
|
2927
|
+
{
|
|
2928
|
+
title,
|
|
2929
|
+
colorTitle,
|
|
2930
|
+
onClose: handleDrawerClose,
|
|
2931
|
+
type
|
|
2932
|
+
}
|
|
2933
|
+
), /* @__PURE__ */ import_react21.default.createElement(DrawerContent, { arrayElements }), /* @__PURE__ */ import_react21.default.createElement(
|
|
2934
|
+
import_Grid4.default,
|
|
2935
|
+
{
|
|
2936
|
+
sx: { zIndex: 1500 },
|
|
2937
|
+
container: true,
|
|
2938
|
+
gap: 2,
|
|
2939
|
+
padding: "8px 16px 40px 16px",
|
|
2940
|
+
height: "86px",
|
|
2941
|
+
alignItems: "center",
|
|
2942
|
+
flexWrap: "nowrap",
|
|
2943
|
+
justifyContent: Array.isArray(drawerActions) && drawerActions.length > 1 ? "space-between" : "flex-end",
|
|
2944
|
+
flexDirection: "row-reverse"
|
|
2945
|
+
},
|
|
2946
|
+
Array.isArray(drawerActions) && drawerActions.map((btn, index) => /* @__PURE__ */ import_react21.default.createElement(
|
|
2947
|
+
import_material15.Button,
|
|
2948
|
+
{
|
|
2949
|
+
key: index,
|
|
2950
|
+
variant: index === 0 || drawerActions.length < 2 ? "contained" : "text",
|
|
2951
|
+
color: "primary",
|
|
2952
|
+
onClick: btn.fn,
|
|
2953
|
+
disabled: btn.disabled || false,
|
|
2954
|
+
size: "small",
|
|
2955
|
+
fullWidth: type == "Swipeable" ? true : false
|
|
2956
|
+
},
|
|
2957
|
+
btn.text
|
|
2958
|
+
))
|
|
2959
|
+
))
|
|
2960
|
+
));
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
// src/Components/Adjuntar/mobile/AdjuntarMobile.tsx
|
|
2964
|
+
var AttachmentMobile = ({
|
|
2965
|
+
buttonAttachment,
|
|
2966
|
+
maxSize = 400,
|
|
2967
|
+
fileAccepted = "",
|
|
2968
|
+
initialFiles,
|
|
2969
|
+
deleteAction,
|
|
2970
|
+
downloadAction,
|
|
2971
|
+
onChange,
|
|
2972
|
+
children,
|
|
2973
|
+
sx,
|
|
2974
|
+
view = "button",
|
|
2975
|
+
iconFileItem,
|
|
2976
|
+
onFileClick
|
|
2977
|
+
}) => {
|
|
2978
|
+
const webcamRef = (0, import_react22.useRef)(null);
|
|
2979
|
+
const [abrirCamara, setAbrirCamara] = (0, import_react22.useState)(false);
|
|
2980
|
+
const [capturedImage, setCapturedImage] = (0, import_react22.useState)(null);
|
|
2981
|
+
const [files, setFiles] = (0, import_react22.useState)([]);
|
|
2982
|
+
const [fileToDelete, setFileToDelete] = (0, import_react22.useState)(null);
|
|
2983
|
+
const [openDrawerDelete, setOpenDrawerDelete] = (0, import_react22.useState)(false);
|
|
2984
|
+
const [toast, setToast] = (0, import_react22.useState)(null);
|
|
2985
|
+
const [open, setOpen] = import_react22.default.useState(false);
|
|
2986
|
+
const toggleAttachment = (newOpen) => () => {
|
|
2987
|
+
setOpen(newOpen);
|
|
2988
|
+
};
|
|
2989
|
+
let IconFileItem;
|
|
2990
|
+
if (iconFileItem) {
|
|
2991
|
+
if (Muicon6[iconFileItem] == void 0) {
|
|
2992
|
+
IconFileItem = iconFileItem;
|
|
2993
|
+
} else {
|
|
2994
|
+
IconFileItem = Muicon6[iconFileItem];
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
const closeCam = () => {
|
|
2998
|
+
setAbrirCamara(false);
|
|
2999
|
+
};
|
|
3000
|
+
const openCam = () => {
|
|
3001
|
+
setOpen(false);
|
|
3002
|
+
setAbrirCamara(true);
|
|
3003
|
+
};
|
|
3004
|
+
let capturedImage2 = null;
|
|
3005
|
+
const capture = (0, import_react22.useCallback)((e) => {
|
|
3006
|
+
if (webcamRef.current) {
|
|
3007
|
+
const imageSrc = webcamRef.current.getScreenshot();
|
|
3008
|
+
setCapturedImage(imageSrc);
|
|
3009
|
+
capturedImage2 = imageSrc;
|
|
3010
|
+
setOpen(false);
|
|
3011
|
+
toggleAttachment(false);
|
|
3012
|
+
setAbrirCamara(false);
|
|
3013
|
+
handleUpload(e);
|
|
3014
|
+
}
|
|
3015
|
+
}, [webcamRef, setCapturedImage]);
|
|
3016
|
+
const inputRef = (0, import_react22.useRef)(null);
|
|
3017
|
+
const handleUpload = (event2) => {
|
|
3018
|
+
var _a;
|
|
3019
|
+
let newFiles = event2.target.files;
|
|
3020
|
+
if (capturedImage || capturedImage2) {
|
|
3021
|
+
const image = capturedImage || capturedImage2;
|
|
3022
|
+
if (!image) return;
|
|
3023
|
+
const arr = image.split(",");
|
|
3024
|
+
const mime = ((_a = arr[0].match(/:(.*?);/)) == null ? void 0 : _a[1]) || "image/jpeg";
|
|
3025
|
+
const bstr = atob(arr[1]);
|
|
3026
|
+
let n = bstr.length;
|
|
3027
|
+
const u8arr = new Uint8Array(n);
|
|
3028
|
+
while (n--) {
|
|
3029
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
3030
|
+
}
|
|
3031
|
+
const fechaActual = new Date(Date.now());
|
|
3032
|
+
const fechaConFormato = fechaActual.getFullYear() + "" + (fechaActual.getMonth() + 1) + fechaActual.getDate() + fechaActual.getHours() + fechaActual.getMinutes() + fechaActual.getSeconds();
|
|
3033
|
+
const capturedFile = new File([u8arr], `photo_${fechaConFormato}.jpg`, { type: mime });
|
|
3034
|
+
newFiles = [capturedFile];
|
|
3035
|
+
setCapturedImage(null);
|
|
3036
|
+
capturedImage2 = null;
|
|
3037
|
+
}
|
|
3038
|
+
if (!newFiles) return;
|
|
3039
|
+
const nuevosArchivos = [];
|
|
3040
|
+
const archivosValidos = [];
|
|
3041
|
+
Array.from(newFiles).forEach((file) => {
|
|
3042
|
+
const isDuplicateFile = files.some(
|
|
3043
|
+
(existingFile) => existingFile.name === file.name && existingFile.size === file.size
|
|
3044
|
+
);
|
|
3045
|
+
const sizeMB = file.size / (1024 * 1024);
|
|
3046
|
+
if (isDuplicateFile) {
|
|
3047
|
+
setToast({
|
|
3048
|
+
type: "error",
|
|
3049
|
+
title: "Archivo duplicado",
|
|
3050
|
+
listITems: [`El archivo "${file.name}" ya existe.`],
|
|
3051
|
+
seeMore: true,
|
|
3052
|
+
time: 5
|
|
3053
|
+
});
|
|
3054
|
+
return;
|
|
3055
|
+
}
|
|
3056
|
+
if (sizeMB > maxSize) {
|
|
3057
|
+
nuevosArchivos.push({
|
|
3058
|
+
name: file.name,
|
|
3059
|
+
size: file.size,
|
|
3060
|
+
type: file.type,
|
|
3061
|
+
progress: 0,
|
|
3062
|
+
uploadError: true
|
|
3063
|
+
});
|
|
3064
|
+
setToast({
|
|
3065
|
+
type: "error",
|
|
3066
|
+
title: "Carga fallida",
|
|
3067
|
+
seeMore: true,
|
|
3068
|
+
listITems: [`El archivo "${file.name}" supera el l\xEDmite de ${maxSize}MB.`],
|
|
3069
|
+
time: 5
|
|
3070
|
+
});
|
|
3071
|
+
return;
|
|
3072
|
+
}
|
|
3073
|
+
if (fileAccepted && !file.name.match(
|
|
3074
|
+
new RegExp(
|
|
3075
|
+
`(${fileAccepted.replace(/\./g, "\\.").replace(/,/g, "|")})$`,
|
|
3076
|
+
"i"
|
|
3077
|
+
)
|
|
3078
|
+
)) {
|
|
3079
|
+
setToast({
|
|
3080
|
+
type: "error",
|
|
3081
|
+
title: "Tipo de archivo no permitido",
|
|
3082
|
+
listITems: [`El archivo "${file.name}" no es un tipo permitido.`],
|
|
3083
|
+
seeMore: true,
|
|
3084
|
+
time: 5
|
|
3085
|
+
});
|
|
3086
|
+
return;
|
|
3087
|
+
}
|
|
3088
|
+
nuevosArchivos.push({
|
|
3089
|
+
name: file.name,
|
|
3090
|
+
size: file.size,
|
|
3091
|
+
type: file.type,
|
|
3092
|
+
progress: 0,
|
|
3093
|
+
uploadError: false
|
|
3094
|
+
});
|
|
3095
|
+
archivosValidos.push(file);
|
|
3096
|
+
});
|
|
3097
|
+
if (nuevosArchivos.length > 0) {
|
|
3098
|
+
setFiles((prevFiles) => {
|
|
3099
|
+
const updatedFiles = [...prevFiles, ...nuevosArchivos];
|
|
3100
|
+
if (archivosValidos.length > 0) {
|
|
3101
|
+
onChange == null ? void 0 : onChange([
|
|
3102
|
+
...archivosValidos,
|
|
3103
|
+
...prevFiles.map((f) => new File([], f.name, { type: f.type }))
|
|
3104
|
+
]);
|
|
3105
|
+
}
|
|
3106
|
+
return updatedFiles;
|
|
3107
|
+
});
|
|
3108
|
+
}
|
|
3109
|
+
setOpen(false);
|
|
3110
|
+
event2.target.value = "";
|
|
3111
|
+
};
|
|
3112
|
+
const handleDeleteFile = (fileToRemove) => __async(null, null, function* () {
|
|
3113
|
+
try {
|
|
3114
|
+
if (deleteAction) {
|
|
3115
|
+
yield deleteAction(fileToRemove.name);
|
|
3116
|
+
}
|
|
3117
|
+
const updatedFiles = files.filter(
|
|
3118
|
+
(file) => !(file.name === fileToRemove.name && file.size === fileToRemove.size)
|
|
3119
|
+
);
|
|
3120
|
+
setFiles(updatedFiles);
|
|
3121
|
+
if (onChange) {
|
|
3122
|
+
const remainingValidFiles = updatedFiles.filter((f) => !f.uploadError).map((f) => new File([], f.name, { type: f.type }));
|
|
3123
|
+
onChange(remainingValidFiles);
|
|
3124
|
+
}
|
|
3125
|
+
setToast({
|
|
3126
|
+
type: "success",
|
|
3127
|
+
title: "Archivo eliminado",
|
|
3128
|
+
listITems: [`El archivo "${fileToRemove.name}" ha sido eliminado exitosamente.`],
|
|
3129
|
+
seeMore: true,
|
|
3130
|
+
time: 3
|
|
3131
|
+
});
|
|
3132
|
+
} catch (error) {
|
|
3133
|
+
setToast({
|
|
3134
|
+
type: "error",
|
|
3135
|
+
title: "Error al eliminar",
|
|
3136
|
+
listITems: [`No se pudo eliminar el archivo "${fileToRemove.name}".`],
|
|
3137
|
+
seeMore: true,
|
|
3138
|
+
time: 5
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
});
|
|
3142
|
+
const deleteFiles = (fileName) => {
|
|
3143
|
+
setFiles((prevFiles) => {
|
|
3144
|
+
const filteredFiles = prevFiles.filter((file) => file.name !== fileName);
|
|
3145
|
+
onChange == null ? void 0 : onChange(
|
|
3146
|
+
filteredFiles.map((f) => new File([], f.name, { type: f.type }))
|
|
3147
|
+
);
|
|
3148
|
+
return filteredFiles;
|
|
3149
|
+
});
|
|
3150
|
+
};
|
|
3151
|
+
const AttachtmentActions = [
|
|
3152
|
+
{ icon: /* @__PURE__ */ import_react22.default.createElement(import_ImageOutlined.default, { type: "file", color: "primary" }), color: "primary", label: "Galer\xEDa", onClick: () => {
|
|
3153
|
+
var _a;
|
|
3154
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
3155
|
+
} },
|
|
3156
|
+
{ icon: /* @__PURE__ */ import_react22.default.createElement(import_icons_material10.PhotoCameraOutlined, { type: "file", color: "success" }), color: "success", label: "C\xE1mara", onClick: () => openCam() },
|
|
3157
|
+
{ icon: /* @__PURE__ */ import_react22.default.createElement(import_icons_material10.FolderOpenOutlined, { type: "file", color: "warning" }), color: "warning", label: "Archivos", onClick: () => {
|
|
3158
|
+
var _a;
|
|
3159
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
3160
|
+
} }
|
|
3161
|
+
];
|
|
3162
|
+
(0, import_react22.useEffect)(() => {
|
|
3163
|
+
if (initialFiles && initialFiles.length > 0) {
|
|
3164
|
+
setFiles(initialFiles);
|
|
3165
|
+
}
|
|
3166
|
+
}, []);
|
|
3167
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_system.Box, { display: "flex", flexDirection: "column", gap: 1 }, view == "button" ? /* @__PURE__ */ import_react22.default.createElement(import_system.Box, { display: "flex", width: "100%", justifyContent: "space-between", alignItems: "center", sx }, children, /* @__PURE__ */ import_react22.default.createElement(
|
|
3168
|
+
AttachmentButton,
|
|
3169
|
+
{
|
|
3170
|
+
buttonAttachment,
|
|
3171
|
+
open,
|
|
3172
|
+
setOpen
|
|
3173
|
+
}
|
|
3174
|
+
)) : "", /* @__PURE__ */ import_react22.default.createElement(import_CssBaseline.default, null), /* @__PURE__ */ import_react22.default.createElement(
|
|
3175
|
+
import_material16.SwipeableDrawer,
|
|
3176
|
+
{
|
|
3177
|
+
slotProps: {
|
|
3178
|
+
backdrop: {
|
|
3179
|
+
sx: { backgroundColor: "#00000038" }
|
|
3180
|
+
}
|
|
3181
|
+
},
|
|
3182
|
+
ModalProps: {
|
|
3183
|
+
sx: {
|
|
3184
|
+
zIndex: 1400,
|
|
3185
|
+
"& .MuiPaper-root": {
|
|
3186
|
+
borderRadius: "16px 16px 0 0"
|
|
3187
|
+
}
|
|
3188
|
+
},
|
|
3189
|
+
BackdropProps: { timeout: 400 }
|
|
3190
|
+
},
|
|
3191
|
+
transitionDuration: { enter: 500, exit: 400 },
|
|
3192
|
+
hysteresis: 0.2,
|
|
3193
|
+
anchor: "bottom",
|
|
3194
|
+
swipeAreaWidth: 56,
|
|
3195
|
+
open,
|
|
3196
|
+
onClose: toggleAttachment(false),
|
|
3197
|
+
onOpen: toggleAttachment(true)
|
|
3198
|
+
},
|
|
3199
|
+
toast && /* @__PURE__ */ import_react22.default.createElement(SCToastNotification, __spreadValues({}, toast)),
|
|
3200
|
+
/* @__PURE__ */ import_react22.default.createElement(import_system.Box, { display: "flex", flexDirection: "column", alignItems: "center", p: 2, gap: 2 }, /* @__PURE__ */ import_react22.default.createElement(import_system.Box, { display: "flex", width: "100%", justifyContent: "space-between", alignItems: "center", gap: 1, p: 1 }, /* @__PURE__ */ import_react22.default.createElement(import_material16.Typography, { variant: "h6", color: "text.primary" }, "Agrega adjuntos"), /* @__PURE__ */ import_react22.default.createElement(import_material16.IconButton, { size: "medium", onClick: toggleAttachment(false) }, /* @__PURE__ */ import_react22.default.createElement(import_icons_material10.CloseOutlined, { color: "action" }))), /* @__PURE__ */ import_react22.default.createElement(
|
|
3201
|
+
"input",
|
|
3202
|
+
{
|
|
3203
|
+
type: "file",
|
|
3204
|
+
multiple: true,
|
|
3205
|
+
hidden: true,
|
|
3206
|
+
ref: inputRef,
|
|
3207
|
+
onChange: handleUpload
|
|
3208
|
+
}
|
|
3209
|
+
), /* @__PURE__ */ import_react22.default.createElement(import_system.Box, { display: "flex", justifyContent: "space-around", alignItems: "center", width: "100%", gap: 2, sx: { padding: "0px 0px 52px 0px !important" } }, AttachtmentActions.map((option, index) => /* @__PURE__ */ import_react22.default.createElement(
|
|
3210
|
+
import_system.Box,
|
|
3211
|
+
{
|
|
3212
|
+
display: "flex",
|
|
3213
|
+
flexDirection: "column",
|
|
3214
|
+
alignItems: "center",
|
|
3215
|
+
width: "100%",
|
|
3216
|
+
height: 80,
|
|
3217
|
+
borderRadius: 1,
|
|
3218
|
+
bgcolor: "grey.50",
|
|
3219
|
+
border: "1px solid",
|
|
3220
|
+
borderColor: "grey.100",
|
|
3221
|
+
justifyContent: "center",
|
|
3222
|
+
p: 1,
|
|
3223
|
+
gap: 0.5,
|
|
3224
|
+
onClick: option.onClick,
|
|
3225
|
+
sx: {
|
|
3226
|
+
cursor: "pointer"
|
|
3227
|
+
}
|
|
3228
|
+
},
|
|
3229
|
+
/* @__PURE__ */ import_react22.default.createElement(
|
|
3230
|
+
import_material16.IconButton,
|
|
3231
|
+
{
|
|
3232
|
+
sx: {
|
|
3233
|
+
bgcolor: getAttachmentColor(option.color)
|
|
3234
|
+
},
|
|
3235
|
+
size: "large"
|
|
3236
|
+
},
|
|
3237
|
+
option.icon
|
|
3238
|
+
),
|
|
3239
|
+
/* @__PURE__ */ import_react22.default.createElement(import_material16.Typography, { variant: "body2", color: "text.secondary" }, option.label)
|
|
3240
|
+
))))
|
|
3241
|
+
), abrirCamara && /* @__PURE__ */ import_react22.default.createElement(import_react22.default.Fragment, null, /* @__PURE__ */ import_react22.default.createElement(import_CancelOutlined.default, { onClick: closeCam, sx: { borderRadius: "50px", height: "35px", width: "35px", zIndex: 1700, background: "white", position: "absolute", left: `calc(100% - 50px)`, bottom: `calc(100% - 50px)` } }), /* @__PURE__ */ import_react22.default.createElement(import_material16.Stack, { className: "camras" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3242
|
+
import_react_webcam.default,
|
|
3243
|
+
{
|
|
3244
|
+
audio: false,
|
|
3245
|
+
ref: webcamRef,
|
|
3246
|
+
width: "100%",
|
|
3247
|
+
height: "100%",
|
|
3248
|
+
screenshotFormat: "image/jpeg",
|
|
3249
|
+
videoConstraints: {
|
|
3250
|
+
//facingMode: { exact: "environment" }
|
|
3251
|
+
facingMode: "environment"
|
|
3252
|
+
//facingMode: "environment" // cámara trasera
|
|
3253
|
+
},
|
|
3254
|
+
style: {
|
|
3255
|
+
position: "fixed",
|
|
3256
|
+
// Fijo para cubrir toda la ventana
|
|
3257
|
+
top: 0,
|
|
3258
|
+
left: 0,
|
|
3259
|
+
objectFit: "cover",
|
|
3260
|
+
backgroundColor: "black",
|
|
3261
|
+
zIndex: 1600
|
|
3262
|
+
// Encima de todo
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
3266
|
+
import_PhotoCamera.default,
|
|
3267
|
+
{
|
|
3268
|
+
onClick: capture,
|
|
3269
|
+
sx: {
|
|
3270
|
+
height: "45px",
|
|
3271
|
+
width: "45px",
|
|
3272
|
+
padding: "6px",
|
|
3273
|
+
backgroundColor: "white",
|
|
3274
|
+
color: "#1E62A1",
|
|
3275
|
+
borderRadius: "50px",
|
|
3276
|
+
zIndex: 1700,
|
|
3277
|
+
position: "absolute",
|
|
3278
|
+
bottom: "10px",
|
|
3279
|
+
left: "50%"
|
|
3280
|
+
},
|
|
3281
|
+
fontSize: "medium"
|
|
3282
|
+
}
|
|
3283
|
+
))), files.length > 0 && /* @__PURE__ */ import_react22.default.createElement(
|
|
3284
|
+
import_material16.Stack,
|
|
3293
3285
|
{
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3286
|
+
"data-testid": "ContenedorArchivosAdjuntos",
|
|
3287
|
+
id: "ContenedorArchivosAdjuntos",
|
|
3288
|
+
width: "100%",
|
|
3289
|
+
sx: __spreadValues({
|
|
3290
|
+
overflowY: "auto"
|
|
3291
|
+
}, files.length > 5 && {
|
|
3292
|
+
maxHeight: 250
|
|
3293
|
+
}),
|
|
3294
|
+
spacing: 1
|
|
3303
3295
|
},
|
|
3304
|
-
|
|
3305
|
-
import_material16.
|
|
3296
|
+
files.map((file) => /* @__PURE__ */ import_react22.default.createElement(
|
|
3297
|
+
import_material16.Stack,
|
|
3306
3298
|
{
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3299
|
+
height: 46,
|
|
3300
|
+
key: file.name + (file.uploadError ? "_error" : ""),
|
|
3301
|
+
direction: "row",
|
|
3302
|
+
alignItems: "center",
|
|
3303
|
+
justifyContent: "space-between",
|
|
3304
|
+
gap: 2,
|
|
3305
|
+
padding: 1,
|
|
3306
|
+
borderRadius: 1,
|
|
3307
|
+
sx: {
|
|
3308
|
+
backgroundColor: file.uploadError ? "error.50" : "transparent",
|
|
3309
|
+
":hover": {
|
|
3310
|
+
backgroundColor: file.uploadError ? "error.100" : "primary.50"
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3314
3313
|
},
|
|
3315
|
-
|
|
3314
|
+
/* @__PURE__ */ import_react22.default.createElement(
|
|
3315
|
+
import_material16.Stack,
|
|
3316
|
+
{
|
|
3317
|
+
direction: "row",
|
|
3318
|
+
alignItems: "center",
|
|
3319
|
+
gap: 1,
|
|
3320
|
+
width: "100%",
|
|
3321
|
+
onClick: () => onFileClick == null ? void 0 : onFileClick(file),
|
|
3322
|
+
sx: { cursor: onFileClick ? "pointer" : "default" }
|
|
3323
|
+
},
|
|
3324
|
+
iconFileItem ? /* @__PURE__ */ import_react22.default.createElement(import_material16.SvgIcon, { color: file.uploadError ? "error" : "primary", fontSize: "small", component: IconFileItem }) : /* @__PURE__ */ import_react22.default.createElement(
|
|
3325
|
+
import_icons_material10.UploadFileOutlined,
|
|
3326
|
+
{
|
|
3327
|
+
color: file.uploadError ? "error" : "primary",
|
|
3328
|
+
fontSize: "small"
|
|
3329
|
+
}
|
|
3330
|
+
),
|
|
3331
|
+
/* @__PURE__ */ import_react22.default.createElement(import_material16.Stack, { width: "100%" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3332
|
+
import_material16.Typography,
|
|
3333
|
+
{
|
|
3334
|
+
variant: "body2",
|
|
3335
|
+
color: "text.primary",
|
|
3336
|
+
whiteSpace: "nowrap",
|
|
3337
|
+
overflow: "hidden",
|
|
3338
|
+
textOverflow: "ellipsis",
|
|
3339
|
+
maxWidth: "310px"
|
|
3340
|
+
},
|
|
3341
|
+
file.name
|
|
3342
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
3343
|
+
import_material16.Typography,
|
|
3344
|
+
{
|
|
3345
|
+
variant: "caption",
|
|
3346
|
+
color: file.uploadError ? "error" : "text.secondary"
|
|
3347
|
+
},
|
|
3348
|
+
file.uploadError && file.size / (1024 * 1024) > maxSize ? "Archivo super\xF3 el l\xEDmite \u2022 Carga fallida" : file.uploadError ? "Archivo duplicado o inv\xE1lido \u2022 Carga fallida" : `${(file.size / (1024 * 1024)).toFixed(2)}MB \u2022 ${file.type}`
|
|
3349
|
+
))
|
|
3350
|
+
),
|
|
3351
|
+
view == "file" ? /* @__PURE__ */ import_react22.default.createElement(import_material16.Tooltip, { title: "Descargar" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3352
|
+
import_material16.IconButton,
|
|
3353
|
+
{
|
|
3354
|
+
size: "small",
|
|
3355
|
+
onClick: () => downloadAction == null ? void 0 : downloadAction(file),
|
|
3356
|
+
disabled: file.uploadError,
|
|
3357
|
+
"aria-label": `Descargar ${file.name}`
|
|
3358
|
+
},
|
|
3359
|
+
/* @__PURE__ */ import_react22.default.createElement(import_FileDownloadOutlined.default, { fontSize: "small", color: "action" })
|
|
3360
|
+
)) : "",
|
|
3361
|
+
view == "button" ? /* @__PURE__ */ import_react22.default.createElement(import_material16.Tooltip, { title: "Eliminar" }, /* @__PURE__ */ import_react22.default.createElement(
|
|
3362
|
+
import_material16.IconButton,
|
|
3363
|
+
{
|
|
3364
|
+
size: "small",
|
|
3365
|
+
onClick: () => {
|
|
3366
|
+
setFileToDelete(file);
|
|
3367
|
+
setOpenDrawerDelete(true);
|
|
3368
|
+
},
|
|
3369
|
+
"aria-label": `Eliminar ${file.name}`
|
|
3370
|
+
},
|
|
3371
|
+
/* @__PURE__ */ import_react22.default.createElement(import_icons_material10.DeleteOutline, { fontSize: "small", color: "action" })
|
|
3372
|
+
)) : ""
|
|
3316
3373
|
))
|
|
3317
|
-
)
|
|
3374
|
+
), openDrawerDelete && /* @__PURE__ */ import_react22.default.createElement(
|
|
3375
|
+
SCDrawer,
|
|
3376
|
+
{
|
|
3377
|
+
open: openDrawerDelete,
|
|
3378
|
+
setOpen: setOpenDrawerDelete,
|
|
3379
|
+
title: "\xBFEliminar adjunto?",
|
|
3380
|
+
type: "Swipeable",
|
|
3381
|
+
heightDrawer: 150,
|
|
3382
|
+
arrayElements: [
|
|
3383
|
+
{
|
|
3384
|
+
component: /* @__PURE__ */ import_react22.default.createElement(import_material16.Typography, null, "Esta seguro de eliminar el adjunto ", /* @__PURE__ */ import_react22.default.createElement("strong", null, '"', fileToDelete == null ? void 0 : fileToDelete.name, '"'), " ")
|
|
3385
|
+
}
|
|
3386
|
+
],
|
|
3387
|
+
actions: [
|
|
3388
|
+
{
|
|
3389
|
+
text: "Eliminar",
|
|
3390
|
+
fn: () => __async(null, null, function* () {
|
|
3391
|
+
if (fileToDelete) {
|
|
3392
|
+
try {
|
|
3393
|
+
if (deleteAction) {
|
|
3394
|
+
yield deleteAction(fileToDelete.name);
|
|
3395
|
+
}
|
|
3396
|
+
deleteFiles(fileToDelete.name);
|
|
3397
|
+
setToast({
|
|
3398
|
+
title: "Archivo eliminado",
|
|
3399
|
+
type: "success",
|
|
3400
|
+
listITems: [`El archivo "${fileToDelete.name}" fue eliminado exitosamente.`],
|
|
3401
|
+
time: 3
|
|
3402
|
+
});
|
|
3403
|
+
} catch (error) {
|
|
3404
|
+
setToast({
|
|
3405
|
+
title: "Error al eliminar archivo",
|
|
3406
|
+
type: "error",
|
|
3407
|
+
listITems: [`No se pudo eliminar el archivo "${fileToDelete.name}".`],
|
|
3408
|
+
time: 5
|
|
3409
|
+
});
|
|
3410
|
+
} finally {
|
|
3411
|
+
setFileToDelete(null);
|
|
3412
|
+
setOpenDrawerDelete(false);
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
})
|
|
3416
|
+
},
|
|
3417
|
+
{ text: "Cancelar", fn: () => setOpenDrawerDelete(false) }
|
|
3418
|
+
]
|
|
3419
|
+
}
|
|
3420
|
+
));
|
|
3318
3421
|
};
|
|
3319
3422
|
|
|
3320
|
-
// src/Components/
|
|
3423
|
+
// src/Components/Calendario/Calendar.tsx
|
|
3424
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
3425
|
+
var import_material24 = require("@mui/material");
|
|
3426
|
+
|
|
3427
|
+
// src/Components/Calendario/CalendarToolbar.tsx
|
|
3321
3428
|
var import_react23 = __toESM(require("react"), 1);
|
|
3429
|
+
var import_icons_material11 = require("@mui/icons-material");
|
|
3322
3430
|
var import_material17 = require("@mui/material");
|
|
3323
|
-
var
|
|
3324
|
-
var
|
|
3325
|
-
var
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3431
|
+
var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
3432
|
+
var import_updateLocale = __toESM(require("dayjs/plugin/updateLocale"), 1);
|
|
3433
|
+
var import_es2 = require("dayjs/locale/es");
|
|
3434
|
+
import_dayjs2.default.locale("es");
|
|
3435
|
+
import_dayjs2.default.extend(import_updateLocale.default);
|
|
3436
|
+
import_dayjs2.default.updateLocale("en", {
|
|
3437
|
+
weekStart: 0
|
|
3438
|
+
// 0 = domingo
|
|
3439
|
+
});
|
|
3440
|
+
var CalendarToolbar = ({
|
|
3441
|
+
labelDate,
|
|
3442
|
+
view,
|
|
3443
|
+
onView,
|
|
3444
|
+
onNavigate,
|
|
3445
|
+
children
|
|
3331
3446
|
}) => {
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
sx: {
|
|
3337
|
-
marginTop: anchor == "bottom" ? "16px" : "0px",
|
|
3338
|
-
backgroundColor: anchor == "bottom" ? "white" : filterSideCard ? "#EAEBEC" : "primary.50",
|
|
3339
|
-
alignItems: "center",
|
|
3340
|
-
height: filterSideCard ? "38px" : "42px",
|
|
3341
|
-
textAlign: "left",
|
|
3342
|
-
padding: "8px 12px",
|
|
3343
|
-
justifyContent: "space-between",
|
|
3344
|
-
alignContent: "center"
|
|
3345
|
-
}
|
|
3346
|
-
},
|
|
3347
|
-
/* @__PURE__ */ import_react23.default.createElement(import_material17.Typography, { variant: filterSideCard ? "body2" : "h6", color: colorTitle || "text.primary" }, title != null ? title : "Personaliza tu b\xFAsqueda aqui"),
|
|
3348
|
-
filterSideCard ? /* @__PURE__ */ import_react23.default.createElement(import_react23.default.Fragment, null, filterSideCard) : /* @__PURE__ */ import_react23.default.createElement(import_material17.IconButton, { onClick: onClose }, /* @__PURE__ */ import_react23.default.createElement(import_Close.default, { "data-testid": "test-button-close", sx: { color: "text.primary" } }))
|
|
3349
|
-
);
|
|
3350
|
-
};
|
|
3351
|
-
|
|
3352
|
-
// src/Components/Drawer/SCDrawer.tsx
|
|
3353
|
-
function SCDrawer({
|
|
3354
|
-
title,
|
|
3355
|
-
arrayElements = [],
|
|
3356
|
-
actions,
|
|
3357
|
-
buttonDrawer,
|
|
3358
|
-
colorTitle,
|
|
3359
|
-
anchor = "left",
|
|
3360
|
-
width,
|
|
3361
|
-
open,
|
|
3362
|
-
setOpen,
|
|
3363
|
-
chipFilters,
|
|
3364
|
-
heightDrawer = 456,
|
|
3365
|
-
filterSideCard,
|
|
3366
|
-
type = "Drawer",
|
|
3367
|
-
onChipDelete
|
|
3368
|
-
}) {
|
|
3369
|
-
const drawerBleeding = heightDrawer;
|
|
3370
|
-
const { drawerOpen, handleDrawerClose, toggleDrawer } = useDrawerState({ open, setOpen });
|
|
3371
|
-
const { toast, setToastWithDelay } = useToast();
|
|
3372
|
-
const {
|
|
3373
|
-
stateChipFilters,
|
|
3374
|
-
setChipFilters,
|
|
3375
|
-
textFilters,
|
|
3376
|
-
setTextFilters,
|
|
3377
|
-
shouldShowChips,
|
|
3378
|
-
processChipFilters
|
|
3379
|
-
} = useChipFilters(arrayElements, chipFilters);
|
|
3380
|
-
const handleInputValidation = () => {
|
|
3381
|
-
if (chipFilters == null ? void 0 : chipFilters.length) {
|
|
3382
|
-
processChipFilters();
|
|
3383
|
-
} else {
|
|
3384
|
-
processChipFilters();
|
|
3385
|
-
validateInputs(
|
|
3386
|
-
arrayElements,
|
|
3387
|
-
setToastWithDelay,
|
|
3388
|
-
handleDrawerClose,
|
|
3389
|
-
setChipFilters,
|
|
3390
|
-
setTextFilters
|
|
3391
|
-
);
|
|
3392
|
-
}
|
|
3393
|
-
};
|
|
3394
|
-
const handleCleanFilters = () => {
|
|
3395
|
-
cleanAllFilters(arrayElements, setTextFilters);
|
|
3447
|
+
const [anchorEl, setAnchorEl] = (0, import_react23.useState)(null);
|
|
3448
|
+
const open = Boolean(anchorEl);
|
|
3449
|
+
const handleMenuOpen = (event2) => {
|
|
3450
|
+
setAnchorEl(event2.currentTarget);
|
|
3396
3451
|
};
|
|
3397
|
-
const
|
|
3398
|
-
|
|
3399
|
-
onChipDelete == null ? void 0 : onChipDelete(element);
|
|
3452
|
+
const handleMenuClose = () => {
|
|
3453
|
+
setAnchorEl(null);
|
|
3400
3454
|
};
|
|
3401
|
-
const
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
return [
|
|
3405
|
-
{ text: "Aplicar filtros", fn: handleInputValidation },
|
|
3406
|
-
{ text: "Limpiar filtros", fn: handleCleanFilters }
|
|
3407
|
-
];
|
|
3455
|
+
const handleViewChange = (newView) => {
|
|
3456
|
+
onView(newView);
|
|
3457
|
+
handleMenuClose();
|
|
3408
3458
|
};
|
|
3409
|
-
const
|
|
3410
|
-
|
|
3411
|
-
|
|
3459
|
+
const getFormattedDate = () => {
|
|
3460
|
+
const sunday = labelDate.day(0);
|
|
3461
|
+
if (view === "month") {
|
|
3462
|
+
const textMonth = labelDate.format("MMMM YYYY");
|
|
3463
|
+
return textMonth.charAt(0).toUpperCase() + textMonth.slice(1);
|
|
3464
|
+
}
|
|
3465
|
+
if (view === "week") {
|
|
3466
|
+
return `${labelDate.startOf("week").format("DD MMM")} - ${labelDate.endOf("week").format("DD MMM YYYY")}`;
|
|
3467
|
+
}
|
|
3468
|
+
return labelDate.format(" DD MMMM YYYY");
|
|
3469
|
+
};
|
|
3470
|
+
return /* @__PURE__ */ import_react23.default.createElement(import_material17.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 1.5, sx: { paddingBottom: "16px" } }, /* @__PURE__ */ import_react23.default.createElement(import_material17.Stack, { direction: "row", alignItems: "center", justifyContent: "flex-start", gap: 1.5 }, /* @__PURE__ */ import_react23.default.createElement(import_material17.Box, null, /* @__PURE__ */ import_react23.default.createElement(
|
|
3471
|
+
import_material17.Chip,
|
|
3412
3472
|
{
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
textFilters,
|
|
3423
|
-
onDeleteFilter: handleDeleteFilter
|
|
3424
|
-
}
|
|
3425
|
-
),
|
|
3426
|
-
buttonDrawer && /* @__PURE__ */ import_react24.default.createElement(
|
|
3427
|
-
DrawerButton,
|
|
3428
|
-
{
|
|
3429
|
-
buttonDrawer,
|
|
3430
|
-
onToggle: toggleDrawer(true)
|
|
3431
|
-
}
|
|
3432
|
-
)
|
|
3433
|
-
), type != "Swipeable" ? /* @__PURE__ */ import_react24.default.createElement(
|
|
3434
|
-
import_material18.Drawer,
|
|
3473
|
+
size: "medium",
|
|
3474
|
+
label: "Hoy",
|
|
3475
|
+
icon: /* @__PURE__ */ import_react23.default.createElement(import_icons_material11.EventOutlined, { fontSize: "small" }),
|
|
3476
|
+
color: "primary",
|
|
3477
|
+
onClick: () => onNavigate("TODAY"),
|
|
3478
|
+
variant: "standard"
|
|
3479
|
+
}
|
|
3480
|
+
)), /* @__PURE__ */ import_react23.default.createElement(import_material17.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ import_react23.default.createElement(import_material17.IconButton, { "aria-label": "Anterior", onClick: () => onNavigate("PREV"), size: "small", color: "primary" }, /* @__PURE__ */ import_react23.default.createElement(import_icons_material11.ChevronLeft, { fontSize: "small" })), /* @__PURE__ */ import_react23.default.createElement(import_material17.IconButton, { "aria-label": "Siguiente", onClick: () => onNavigate("NEXT"), size: "small", color: "primary" }, /* @__PURE__ */ import_react23.default.createElement(import_icons_material11.ChevronRight, { fontSize: "small" })), /* @__PURE__ */ import_react23.default.createElement(import_material17.Typography, { variant: "h6", color: "primary", "data-testid": "currentDate" }, getFormattedDate()), /* @__PURE__ */ import_react23.default.createElement(import_material17.IconButton, { onClick: handleMenuOpen, size: "small", color: "primary", "aria-label": "Cambiar vista" }, /* @__PURE__ */ import_react23.default.createElement(import_icons_material11.KeyboardArrowDown, { fontSize: "small" })), /* @__PURE__ */ import_react23.default.createElement(
|
|
3481
|
+
import_material17.Menu,
|
|
3435
3482
|
{
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
width: type == "Sidecar" ? "100%" : width != null ? width : "450px",
|
|
3442
|
-
boxSizing: "border-box",
|
|
3443
|
-
borderRadius: anchor !== "right" ? "0px 4px 4px 0px" : "4px 0px 0px 4px",
|
|
3444
|
-
boxShadow: type == "Sidecar" ? "none !important" : "0px 8px 10px -5px rgba(24, 39, 75, 0.2), 0px 16px 24px 2px rgba(24, 39, 75, 0.14), 0px 6px 30px 5px rgba(24, 39, 75, 0.12)"
|
|
3445
|
-
},
|
|
3446
|
-
"&.MuiDrawer-root": {
|
|
3447
|
-
boxShadow: type == "Sidecar" ? "none !important" : "0px 3px 1px -2px rgba(24, 39, 75, 0.20),0px 2px 2px 0px rgba(24, 39, 75, 0.14),0px 1px 5px 0px rgba(24, 39, 75, 0.12)"
|
|
3448
|
-
}
|
|
3449
|
-
},
|
|
3450
|
-
ModalProps: {
|
|
3451
|
-
keepMounted: true,
|
|
3452
|
-
disablePortal: type == "Sidecar" ? true : false,
|
|
3453
|
-
slotProps: {
|
|
3454
|
-
root: {
|
|
3455
|
-
style: {
|
|
3456
|
-
position: "absolute"
|
|
3457
|
-
}
|
|
3458
|
-
}
|
|
3459
|
-
}
|
|
3460
|
-
},
|
|
3461
|
-
hideBackdrop: true,
|
|
3462
|
-
PaperProps: {
|
|
3463
|
-
sx: {
|
|
3464
|
-
position: "absolute !important",
|
|
3465
|
-
height: "100%",
|
|
3466
|
-
width: 300,
|
|
3467
|
-
right: 0
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3483
|
+
anchorEl,
|
|
3484
|
+
open,
|
|
3485
|
+
onClose: handleMenuClose,
|
|
3486
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
3487
|
+
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
3470
3488
|
},
|
|
3471
|
-
/* @__PURE__ */
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3489
|
+
/* @__PURE__ */ import_react23.default.createElement(import_material17.MenuItem, { onClick: () => handleViewChange("month") }, "Mes"),
|
|
3490
|
+
/* @__PURE__ */ import_react23.default.createElement(import_material17.MenuItem, { onClick: () => handleViewChange("week") }, "Semana"),
|
|
3491
|
+
/* @__PURE__ */ import_react23.default.createElement(import_material17.MenuItem, { onClick: () => handleViewChange("day") }, "D\xEDa")
|
|
3492
|
+
))), children ? /* @__PURE__ */ import_react23.default.createElement(import_material17.Box, null, children) : /* @__PURE__ */ import_react23.default.createElement(import_material17.Box, { width: "24px" }), " ");
|
|
3493
|
+
};
|
|
3494
|
+
|
|
3495
|
+
// src/Components/Calendario/Views/MonthView.tsx
|
|
3496
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
3497
|
+
var import_material21 = require("@mui/material");
|
|
3498
|
+
var import_Add = __toESM(require("@mui/icons-material/Add"), 1);
|
|
3499
|
+
var import_dayjs5 = __toESM(require("dayjs"), 1);
|
|
3500
|
+
var import_localeData = __toESM(require("dayjs/plugin/localeData"), 1);
|
|
3501
|
+
|
|
3502
|
+
// src/Components/Calendario/Utils.tsx
|
|
3503
|
+
var import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
3504
|
+
function getMonthDays(date) {
|
|
3505
|
+
const start = date.startOf("month").day(0);
|
|
3506
|
+
const end = date.endOf("month").day(6);
|
|
3507
|
+
const days = [];
|
|
3508
|
+
let current = start;
|
|
3509
|
+
while (current.isBefore(end) || current.isSame(end, "day")) {
|
|
3510
|
+
days.push(current);
|
|
3511
|
+
current = current.add(1, "day");
|
|
3512
|
+
}
|
|
3513
|
+
return days;
|
|
3514
|
+
}
|
|
3515
|
+
var isToday = (date) => {
|
|
3516
|
+
return date.isSame((0, import_dayjs3.default)(), "day");
|
|
3517
|
+
};
|
|
3518
|
+
var stateColors = {
|
|
3519
|
+
Asignada: "warning.200",
|
|
3520
|
+
Generada: "default.main",
|
|
3521
|
+
EnProgreso: "primary.200",
|
|
3522
|
+
Aplazada: "secondary.A400",
|
|
3523
|
+
Vencida: "error.200",
|
|
3524
|
+
Finalizada: "success.200"
|
|
3525
|
+
//#FCE4C0
|
|
3526
|
+
};
|
|
3527
|
+
|
|
3528
|
+
// src/Components/Calendario/Event.tsx
|
|
3529
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
3530
|
+
var import_material18 = require("@mui/material");
|
|
3531
|
+
var CalendarEventCard = ({ event: event2, color, sx, onClick, onHover }) => {
|
|
3532
|
+
const [anchorEl, setAnchorEl] = import_react24.default.useState(null);
|
|
3533
|
+
const handlePopoverOpen = (event3) => {
|
|
3534
|
+
setAnchorEl(event3.currentTarget);
|
|
3535
|
+
};
|
|
3536
|
+
const handlePopoverClose = () => {
|
|
3537
|
+
setAnchorEl(null);
|
|
3538
|
+
};
|
|
3539
|
+
const open = Boolean(anchorEl);
|
|
3540
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
3541
|
+
import_material18.Stack,
|
|
3483
3542
|
{
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
hysteresis: 0.2,
|
|
3494
|
-
sx: {
|
|
3495
|
-
zIndex: 1400,
|
|
3496
|
-
"& .MuiDrawer-paper": {
|
|
3497
|
-
width: "auto",
|
|
3498
|
-
height: `calc(50% - ${drawerBleeding}px)`,
|
|
3499
|
-
boxSizing: "border-box",
|
|
3500
|
-
borderRadius: "4px 4px 0px 0px"
|
|
3501
|
-
}
|
|
3543
|
+
direction: "row",
|
|
3544
|
+
padding: 0.5,
|
|
3545
|
+
borderRadius: 0.5,
|
|
3546
|
+
alignItems: "flex-start",
|
|
3547
|
+
minHeight: "20px",
|
|
3548
|
+
onMouseOver: () => onHover == null ? void 0 : onHover(event2),
|
|
3549
|
+
onClick: (e) => {
|
|
3550
|
+
e.stopPropagation();
|
|
3551
|
+
onClick == null ? void 0 : onClick(event2);
|
|
3502
3552
|
},
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3553
|
+
sx: (theme) => __spreadValues({
|
|
3554
|
+
backgroundColor: theme.palette.common.white,
|
|
3555
|
+
boxShadow: theme.shadows[2],
|
|
3556
|
+
color: theme.palette.text.secondary,
|
|
3557
|
+
overflow: "hidden",
|
|
3558
|
+
cursor: onClick ? "pointer" : "default"
|
|
3559
|
+
}, sx)
|
|
3508
3560
|
},
|
|
3509
3561
|
/* @__PURE__ */ import_react24.default.createElement(
|
|
3510
|
-
import_material18.
|
|
3562
|
+
import_material18.Divider,
|
|
3511
3563
|
{
|
|
3564
|
+
orientation: "vertical",
|
|
3565
|
+
flexItem: true,
|
|
3512
3566
|
sx: {
|
|
3513
|
-
width:
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
borderRadius: 3,
|
|
3517
|
-
position: "absolute",
|
|
3518
|
-
top: 8,
|
|
3519
|
-
left: "calc(50% - 15px)"
|
|
3567
|
+
width: "2px",
|
|
3568
|
+
backgroundColor: color != null ? color : "primary.main",
|
|
3569
|
+
borderRadius: "2px"
|
|
3520
3570
|
}
|
|
3521
3571
|
}
|
|
3522
3572
|
),
|
|
3523
|
-
/* @__PURE__ */ import_react24.default.createElement(
|
|
3524
|
-
|
|
3525
|
-
{
|
|
3526
|
-
title,
|
|
3527
|
-
colorTitle,
|
|
3528
|
-
onClose: handleDrawerClose,
|
|
3529
|
-
anchor
|
|
3530
|
-
}
|
|
3531
|
-
), /* @__PURE__ */ import_react24.default.createElement(DrawerContent, { arrayElements }), /* @__PURE__ */ import_react24.default.createElement(
|
|
3532
|
-
import_Grid4.default,
|
|
3573
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
3574
|
+
import_material18.Box,
|
|
3533
3575
|
{
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
alignItems: "center"
|
|
3540
|
-
flexWrap: "nowrap",
|
|
3541
|
-
justifyContent: Array.isArray(drawerActions) && drawerActions.length > 1 ? "space-between" : "flex-end",
|
|
3542
|
-
flexDirection: "row-reverse"
|
|
3576
|
+
px: 1,
|
|
3577
|
+
py: 0.5,
|
|
3578
|
+
flex: "1",
|
|
3579
|
+
minWidth: 0,
|
|
3580
|
+
display: "flex",
|
|
3581
|
+
alignItems: "center"
|
|
3543
3582
|
},
|
|
3544
|
-
|
|
3545
|
-
import_material18.
|
|
3583
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
3584
|
+
import_material18.Typography,
|
|
3546
3585
|
{
|
|
3547
|
-
|
|
3548
|
-
variant:
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3586
|
+
color: "text.primary",
|
|
3587
|
+
variant: "caption",
|
|
3588
|
+
noWrap: true,
|
|
3589
|
+
sx: {
|
|
3590
|
+
overflow: "hidden",
|
|
3591
|
+
textOverflow: "ellipsis",
|
|
3592
|
+
whiteSpace: "nowrap"
|
|
3593
|
+
},
|
|
3594
|
+
onMouseEnter: handlePopoverOpen,
|
|
3595
|
+
onMouseLeave: handlePopoverClose
|
|
3554
3596
|
},
|
|
3555
|
-
|
|
3556
|
-
)
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3597
|
+
event2.title.charAt(0).toUpperCase() + event2.title.slice(1).toLowerCase()
|
|
3598
|
+
),
|
|
3599
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
3600
|
+
import_material18.Popover,
|
|
3601
|
+
{
|
|
3602
|
+
id: "mouse-over-popover",
|
|
3603
|
+
sx: { pointerEvents: "none" },
|
|
3604
|
+
open,
|
|
3605
|
+
anchorEl,
|
|
3606
|
+
anchorOrigin: {
|
|
3607
|
+
vertical: "top",
|
|
3608
|
+
horizontal: "right"
|
|
3609
|
+
},
|
|
3610
|
+
transformOrigin: {
|
|
3611
|
+
vertical: "bottom",
|
|
3612
|
+
horizontal: "right"
|
|
3613
|
+
},
|
|
3614
|
+
onClose: handlePopoverClose,
|
|
3615
|
+
disableRestoreFocus: true
|
|
3616
|
+
},
|
|
3617
|
+
onHover ? onHover(event2) : " "
|
|
3618
|
+
)
|
|
3619
|
+
)
|
|
3620
|
+
);
|
|
3621
|
+
};
|
|
3560
3622
|
|
|
3561
3623
|
// src/Components/EmptyState/EmptyState.tsx
|
|
3562
3624
|
var import_react29 = __toESM(require("react"), 1);
|
|
@@ -5084,17 +5146,15 @@ var SCCard = ({ width, title, image, iconTitle, actionsTitle, subtitle, dividerH
|
|
|
5084
5146
|
let IconTitle;
|
|
5085
5147
|
const [expanded, setExpanded] = import_react49.default.useState(false);
|
|
5086
5148
|
if (iconTitle) {
|
|
5087
|
-
if (
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
} else {
|
|
5092
|
-
iconTitleValidation = "icon";
|
|
5093
|
-
IconTitle = iconTitle;
|
|
5094
|
-
}
|
|
5095
|
-
} else {
|
|
5149
|
+
if (typeof iconTitle === "string" && /\.(png|jpg|jpeg|gif|svg|webp)$/i.test(iconTitle)) {
|
|
5150
|
+
iconTitleValidation = "image";
|
|
5151
|
+
IconTitle = iconTitle;
|
|
5152
|
+
} else if (Muicon8[iconTitle] != void 0) {
|
|
5096
5153
|
iconTitleValidation = "icon";
|
|
5097
5154
|
IconTitle = Muicon8[iconTitle];
|
|
5155
|
+
} else {
|
|
5156
|
+
iconTitleValidation = "icon";
|
|
5157
|
+
IconTitle = iconTitle;
|
|
5098
5158
|
}
|
|
5099
5159
|
}
|
|
5100
5160
|
const handleExpandClick = () => {
|