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