componentes-sinco 1.0.36 → 1.0.38
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 +129 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +130 -19
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -94,7 +94,7 @@ interface DrawerProps<T> {
|
|
|
94
94
|
fn: () => void;
|
|
95
95
|
disabled?: boolean;
|
|
96
96
|
}[] | boolean;
|
|
97
|
-
buttonDrawer?: {
|
|
97
|
+
buttonDrawer?: false | {
|
|
98
98
|
type?: 'chip' | 'button';
|
|
99
99
|
icon?: keyof typeof Muicon | any;
|
|
100
100
|
text?: string;
|
|
@@ -108,6 +108,7 @@ interface DrawerProps<T> {
|
|
|
108
108
|
open?: boolean;
|
|
109
109
|
setOpen?: any;
|
|
110
110
|
chipFilters?: any[];
|
|
111
|
+
heightDrawer?: number;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
@@ -134,7 +135,7 @@ declare const ToastProgress: (timeProgress: number) => {
|
|
|
134
135
|
progressToast: number;
|
|
135
136
|
};
|
|
136
137
|
|
|
137
|
-
declare function SCDrawer<T>({ title, arrayElements, actions, buttonDrawer, colorTitle, anchor, width, open, setOpen, chipFilters, }: DrawerProps<T>): React__default.JSX.Element;
|
|
138
|
+
declare function SCDrawer<T>({ title, arrayElements, actions, buttonDrawer, colorTitle, anchor, width, open, setOpen, chipFilters, heightDrawer, }: DrawerProps<T>): React__default.JSX.Element;
|
|
138
139
|
|
|
139
140
|
interface FooterActionsProperties {
|
|
140
141
|
label?: React.ReactNode;
|
|
@@ -432,12 +433,13 @@ interface Option$2 {
|
|
|
432
433
|
title?: string;
|
|
433
434
|
subtitle?: any;
|
|
434
435
|
description?: any;
|
|
435
|
-
iconLeftColor?: 'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
436
|
+
iconLeftColor?: 'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | any;
|
|
436
437
|
iconLeft?: any | React__default.ReactNode | React__default.ReactElement | React__default.ElementType | null;
|
|
437
438
|
iconRightColor?: 'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
438
439
|
iconRight?: any | React__default.ReactNode | React__default.ReactElement | React__default.ElementType | null;
|
|
439
440
|
divider?: boolean;
|
|
440
441
|
disable?: boolean;
|
|
442
|
+
colorDisabled?: boolean;
|
|
441
443
|
fn?: any;
|
|
442
444
|
}
|
|
443
445
|
interface SCListContentProps {
|
|
@@ -600,9 +602,10 @@ interface SCTimeProps {
|
|
|
600
602
|
timeStep?: number;
|
|
601
603
|
state: Dayjs | null;
|
|
602
604
|
setState: (value: Dayjs | null) => void;
|
|
605
|
+
width?: string;
|
|
603
606
|
error?: boolean;
|
|
604
607
|
}
|
|
605
|
-
declare const SCTime: ({ label, required, disabled, background, timeStep, state, setState, error }: SCTimeProps) => React__default.JSX.Element;
|
|
608
|
+
declare const SCTime: ({ label, required, disabled, background, timeStep, state, setState, width, error, }: SCTimeProps) => React__default.JSX.Element;
|
|
606
609
|
|
|
607
610
|
interface SCCardProps {
|
|
608
611
|
title?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ interface DrawerProps<T> {
|
|
|
94
94
|
fn: () => void;
|
|
95
95
|
disabled?: boolean;
|
|
96
96
|
}[] | boolean;
|
|
97
|
-
buttonDrawer?: {
|
|
97
|
+
buttonDrawer?: false | {
|
|
98
98
|
type?: 'chip' | 'button';
|
|
99
99
|
icon?: keyof typeof Muicon | any;
|
|
100
100
|
text?: string;
|
|
@@ -108,6 +108,7 @@ interface DrawerProps<T> {
|
|
|
108
108
|
open?: boolean;
|
|
109
109
|
setOpen?: any;
|
|
110
110
|
chipFilters?: any[];
|
|
111
|
+
heightDrawer?: number;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
@@ -134,7 +135,7 @@ declare const ToastProgress: (timeProgress: number) => {
|
|
|
134
135
|
progressToast: number;
|
|
135
136
|
};
|
|
136
137
|
|
|
137
|
-
declare function SCDrawer<T>({ title, arrayElements, actions, buttonDrawer, colorTitle, anchor, width, open, setOpen, chipFilters, }: DrawerProps<T>): React__default.JSX.Element;
|
|
138
|
+
declare function SCDrawer<T>({ title, arrayElements, actions, buttonDrawer, colorTitle, anchor, width, open, setOpen, chipFilters, heightDrawer, }: DrawerProps<T>): React__default.JSX.Element;
|
|
138
139
|
|
|
139
140
|
interface FooterActionsProperties {
|
|
140
141
|
label?: React.ReactNode;
|
|
@@ -432,12 +433,13 @@ interface Option$2 {
|
|
|
432
433
|
title?: string;
|
|
433
434
|
subtitle?: any;
|
|
434
435
|
description?: any;
|
|
435
|
-
iconLeftColor?: 'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
436
|
+
iconLeftColor?: 'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | any;
|
|
436
437
|
iconLeft?: any | React__default.ReactNode | React__default.ReactElement | React__default.ElementType | null;
|
|
437
438
|
iconRightColor?: 'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
438
439
|
iconRight?: any | React__default.ReactNode | React__default.ReactElement | React__default.ElementType | null;
|
|
439
440
|
divider?: boolean;
|
|
440
441
|
disable?: boolean;
|
|
442
|
+
colorDisabled?: boolean;
|
|
441
443
|
fn?: any;
|
|
442
444
|
}
|
|
443
445
|
interface SCListContentProps {
|
|
@@ -600,9 +602,10 @@ interface SCTimeProps {
|
|
|
600
602
|
timeStep?: number;
|
|
601
603
|
state: Dayjs | null;
|
|
602
604
|
setState: (value: Dayjs | null) => void;
|
|
605
|
+
width?: string;
|
|
603
606
|
error?: boolean;
|
|
604
607
|
}
|
|
605
|
-
declare const SCTime: ({ label, required, disabled, background, timeStep, state, setState, error }: SCTimeProps) => React__default.JSX.Element;
|
|
608
|
+
declare const SCTime: ({ label, required, disabled, background, timeStep, state, setState, width, error, }: SCTimeProps) => React__default.JSX.Element;
|
|
606
609
|
|
|
607
610
|
interface SCCardProps {
|
|
608
611
|
title?: string;
|
package/dist/index.js
CHANGED
|
@@ -1662,6 +1662,10 @@ function SCSelect({
|
|
|
1662
1662
|
disabled: disabled || false,
|
|
1663
1663
|
error,
|
|
1664
1664
|
MenuProps: {
|
|
1665
|
+
sx: {
|
|
1666
|
+
zIndex: 1400
|
|
1667
|
+
// muy alto para que quede encima
|
|
1668
|
+
},
|
|
1665
1669
|
PaperProps: {
|
|
1666
1670
|
sx: {
|
|
1667
1671
|
maxHeight: "300px",
|
|
@@ -1890,6 +1894,12 @@ function SCAutocomplete({
|
|
|
1890
1894
|
})
|
|
1891
1895
|
)),
|
|
1892
1896
|
slotProps: {
|
|
1897
|
+
popper: {
|
|
1898
|
+
sx: {
|
|
1899
|
+
zIndex: 1400
|
|
1900
|
+
// controla el contenedor flotante
|
|
1901
|
+
}
|
|
1902
|
+
},
|
|
1893
1903
|
listbox: {
|
|
1894
1904
|
component: React11.forwardRef(function ListboxComponent(props, ref) {
|
|
1895
1905
|
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
@@ -2033,6 +2043,12 @@ var SCDateRange = ({
|
|
|
2033
2043
|
field: MultiInputDateRangeField
|
|
2034
2044
|
},
|
|
2035
2045
|
slotProps: {
|
|
2046
|
+
popper: {
|
|
2047
|
+
sx: {
|
|
2048
|
+
zIndex: 1400
|
|
2049
|
+
// muy alto para que quede encima
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2036
2052
|
textField: ({ position }) => {
|
|
2037
2053
|
const isStart = position === "start";
|
|
2038
2054
|
return {
|
|
@@ -2207,7 +2223,7 @@ var DrawerActions = ({ actions, anchor }) => {
|
|
|
2207
2223
|
return /* @__PURE__ */ React14.createElement(
|
|
2208
2224
|
Grid4,
|
|
2209
2225
|
{
|
|
2210
|
-
sx: { borderTop: 1, borderColor: "#1018403B" },
|
|
2226
|
+
sx: { borderTop: 1, borderColor: "#1018403B", zIndex: 1500 },
|
|
2211
2227
|
container: true,
|
|
2212
2228
|
gap: 2,
|
|
2213
2229
|
padding: "8px 12px",
|
|
@@ -2275,9 +2291,10 @@ function SCDrawer({
|
|
|
2275
2291
|
width,
|
|
2276
2292
|
open,
|
|
2277
2293
|
setOpen,
|
|
2278
|
-
chipFilters
|
|
2294
|
+
chipFilters,
|
|
2295
|
+
heightDrawer = 456
|
|
2279
2296
|
}) {
|
|
2280
|
-
const drawerBleeding =
|
|
2297
|
+
const drawerBleeding = heightDrawer;
|
|
2281
2298
|
const { drawerOpen, handleDrawerClose, toggleDrawer } = useDrawerState({ open, setOpen });
|
|
2282
2299
|
const { toast, setToastWithDelay } = useToast();
|
|
2283
2300
|
const {
|
|
@@ -2333,7 +2350,7 @@ function SCDrawer({
|
|
|
2333
2350
|
onDeleteFilter: handleDeleteFilter
|
|
2334
2351
|
}
|
|
2335
2352
|
),
|
|
2336
|
-
/* @__PURE__ */ React16.createElement(
|
|
2353
|
+
buttonDrawer && /* @__PURE__ */ React16.createElement(
|
|
2337
2354
|
DrawerButton,
|
|
2338
2355
|
{
|
|
2339
2356
|
buttonDrawer,
|
|
@@ -2371,6 +2388,7 @@ function SCDrawer({
|
|
|
2371
2388
|
anchor: "bottom",
|
|
2372
2389
|
swipeAreaWidth: drawerBleeding,
|
|
2373
2390
|
sx: {
|
|
2391
|
+
zIndex: 1400,
|
|
2374
2392
|
"& .MuiDrawer-paper": {
|
|
2375
2393
|
width: "auto",
|
|
2376
2394
|
height: `calc(50% - ${drawerBleeding}px)`,
|
|
@@ -3328,7 +3346,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
3328
3346
|
}
|
|
3329
3347
|
) : content.component
|
|
3330
3348
|
),
|
|
3331
|
-
dialogActions != void 0 && dialogActions != false ? Array.isArray(dialogActions) && (dialogActions == null ? void 0 : dialogActions.length) > 0 ? /* @__PURE__ */ React27.createElement(DialogActions, { sx: { gap: 1, m: 0, padding: "12px 16px 12px 16px", justifyContent: dialogActions.length >= 3 ? "space-between" : "flex-end" } }, typeView !== "mobile" ? /* @__PURE__ */ React27.createElement(React27.Fragment, null, dialogActions.length >= 3 ? /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(
|
|
3349
|
+
dialogActions != void 0 && dialogActions != false ? Array.isArray(dialogActions) && (dialogActions == null ? void 0 : dialogActions.length) > 0 ? /* @__PURE__ */ React27.createElement(DialogActions, { sx: { zIndex: 1200, gap: 1, m: 0, padding: "12px 16px 12px 16px", justifyContent: dialogActions.length >= 3 ? "space-between" : "flex-end" } }, typeView !== "mobile" ? /* @__PURE__ */ React27.createElement(React27.Fragment, null, dialogActions.length >= 3 ? /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(
|
|
3332
3350
|
Button11,
|
|
3333
3351
|
{
|
|
3334
3352
|
variant: "text",
|
|
@@ -3407,17 +3425,19 @@ var SCListContent = ({ options, iconLeftType = "Icon", iconRightType = "Icon" })
|
|
|
3407
3425
|
ListItemButton,
|
|
3408
3426
|
{
|
|
3409
3427
|
disabled: option.disable,
|
|
3410
|
-
onClick: option.fn
|
|
3428
|
+
onClick: option.fn,
|
|
3429
|
+
sx: { gap: 1 }
|
|
3411
3430
|
},
|
|
3412
|
-
option.iconLeft ? iconLeftType == "Icon" ? /* @__PURE__ */ React28.createElement(ListItemIcon4, { sx: { minWidth: "0px !important"
|
|
3431
|
+
option.iconLeft ? iconLeftType == "Icon" ? /* @__PURE__ */ React28.createElement(ListItemIcon4, { sx: { minWidth: "0px !important" } }, /* @__PURE__ */ React28.createElement(SvgIcon6, { fontSize: "small", sx: { color: option.iconLeftColor || "action" }, component: option.iconLeft })) : /* @__PURE__ */ React28.createElement(Avatar, { sx: { width: 25, height: 25, fontSize: "11px", bgcolor: option.iconLeftColor ? `${option.iconLeftColor}.main` : "default" } }, ((_a = option.iconLeft) == null ? void 0 : _a.type) != void 0 ? /* @__PURE__ */ React28.createElement(SvgIcon6, { fontSize: "small", component: option.iconLeft }) : option.iconLeft) : "",
|
|
3413
3432
|
/* @__PURE__ */ React28.createElement(
|
|
3414
3433
|
ListItemText3,
|
|
3415
3434
|
{
|
|
3435
|
+
sx: { color: option.colorDisabled == true ? "text.disabled" : "default" },
|
|
3416
3436
|
primary: option.title,
|
|
3417
|
-
secondary: /* @__PURE__ */ React28.createElement(Grid9, { gap: 0.5 }, /* @__PURE__ */ React28.createElement(Grid9, { container: true, gap: 0.5 }, option.subtitle), /* @__PURE__ */ React28.createElement(Grid9, { container: true, gap: 0.5 }, option.description))
|
|
3437
|
+
secondary: /* @__PURE__ */ React28.createElement(Grid9, { gap: 0.5 }, /* @__PURE__ */ React28.createElement(Grid9, { container: true, gap: 0.5, sx: { color: option.colorDisabled == true ? "text.disabled" : "default" } }, option.subtitle), /* @__PURE__ */ React28.createElement(Grid9, { container: true, gap: 0.5, sx: { color: option.colorDisabled == true ? "text.disabled" : "default" } }, option.description))
|
|
3418
3438
|
}
|
|
3419
3439
|
),
|
|
3420
|
-
option.iconRight ? iconRightType == "Icon" ? /* @__PURE__ */ React28.createElement(ListItemIcon4, { sx: { minWidth: "0px !important", marginRight: "8px" } }, /* @__PURE__ */ React28.createElement(SvgIcon6, { fontSize: "small", color: option.iconRightColor || "action", component: option.iconRight })) : /* @__PURE__ */ React28.createElement(Avatar,
|
|
3440
|
+
option.iconRight ? iconRightType == "Icon" ? /* @__PURE__ */ React28.createElement(ListItemIcon4, { sx: { minWidth: "0px !important", marginRight: "8px" } }, /* @__PURE__ */ React28.createElement(SvgIcon6, { fontSize: "small", sx: { color: option.iconRightColor || "action" }, component: option.iconRight })) : /* @__PURE__ */ React28.createElement(Avatar, { variant: "circular", sx: { width: 20, height: 20 } }, ((_b = option.iconRight) == null ? void 0 : _b.type) != void 0 ? /* @__PURE__ */ React28.createElement(SvgIcon6, { fontSize: "small", color: option.iconRightColor || "action", component: option.iconRight }) : option.iconRight) : ""
|
|
3421
3441
|
), option.divider == true ? /* @__PURE__ */ React28.createElement(Divider4, null) : "");
|
|
3422
3442
|
})));
|
|
3423
3443
|
};
|
|
@@ -4491,7 +4511,8 @@ var SCTime = ({
|
|
|
4491
4511
|
timeStep = 5,
|
|
4492
4512
|
state,
|
|
4493
4513
|
setState,
|
|
4494
|
-
|
|
4514
|
+
width,
|
|
4515
|
+
error = false
|
|
4495
4516
|
}) => {
|
|
4496
4517
|
LicenseInfo3.setLicenseKey(
|
|
4497
4518
|
"77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
|
|
@@ -4531,7 +4552,7 @@ var SCTime = ({
|
|
|
4531
4552
|
setIsOpenPopover(false);
|
|
4532
4553
|
setAnchorEl(null);
|
|
4533
4554
|
};
|
|
4534
|
-
return /* @__PURE__ */ React40.createElement(LocalizationProvider3, { dateAdapter: AdapterDayjs2 }, /* @__PURE__ */ React40.createElement(Box25, { sx: { position: "relative", width: "
|
|
4555
|
+
return /* @__PURE__ */ React40.createElement(LocalizationProvider3, { dateAdapter: AdapterDayjs2 }, /* @__PURE__ */ React40.createElement(Box25, { sx: { position: "relative", width: width != null ? width : "99%" } }, /* @__PURE__ */ React40.createElement(
|
|
4535
4556
|
TimeField,
|
|
4536
4557
|
{
|
|
4537
4558
|
label,
|
|
@@ -4588,6 +4609,7 @@ var SCTime = ({
|
|
|
4588
4609
|
},
|
|
4589
4610
|
marginThreshold: 0,
|
|
4590
4611
|
disableScrollLock: true,
|
|
4612
|
+
sx: { zIndex: "1400" },
|
|
4591
4613
|
slotProps: {
|
|
4592
4614
|
paper: {
|
|
4593
4615
|
sx: {
|
|
@@ -4595,7 +4617,8 @@ var SCTime = ({
|
|
|
4595
4617
|
borderRadius: 1,
|
|
4596
4618
|
border: "1px solid #e0e0e0",
|
|
4597
4619
|
maxHeight: "300px",
|
|
4598
|
-
overflow: "visible"
|
|
4620
|
+
overflow: "visible",
|
|
4621
|
+
width: width != null ? width : "100%"
|
|
4599
4622
|
}
|
|
4600
4623
|
}
|
|
4601
4624
|
}
|
|
@@ -4806,11 +4829,11 @@ var SCActivityCalendar = ({
|
|
|
4806
4829
|
options: [{
|
|
4807
4830
|
title: event2.activityDescription,
|
|
4808
4831
|
subtitle: /* @__PURE__ */ React42.createElement(React42.Fragment, null, configRangeHour && new Date(event2.date.replace("00:00:00", event2.startTime)).getHours() === new Date(event2.date.replace("00:00:00", configRangeHour.split("-")[0])).getHours() && new Date(event2.date.replace("00:00:00", event2.finalTime)).getHours() === new Date(event2.date.replace("00:00:00", configRangeHour.split("-")[1])).getHours() && new Date(event2.date.replace("00:00:00", event2.startTime)).getMinutes() === new Date(event2.date.replace("00:00:00", configRangeHour.split("-")[0])).getMinutes() && new Date(event2.date.replace("00:00:00", event2.finalTime)).getMinutes() === new Date(event2.date.replace("00:00:00", configRangeHour.split("-")[1])).getMinutes() ? /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(Typography25, null, "Todo el dia"), /* @__PURE__ */ React42.createElement(LightModeOutlinedIcon, { fontSize: "small" })) : /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(Typography25, null, new Date(event2.date.replace("00:00:00", event2.startTime)).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: true })), /* @__PURE__ */ React42.createElement(ArrowForwardIcon, { fontSize: "small" }), /* @__PURE__ */ React42.createElement(Typography25, null, new Date(event2.date.replace("00:00:00", event2.finalTime)).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: true })))),
|
|
4809
|
-
iconLeftColor: event2.state === "Finalizada" ? "
|
|
4832
|
+
iconLeftColor: event2.state === "Finalizada" ? "#C7E49D" : "action",
|
|
4810
4833
|
iconLeft: event2.state === "Finalizada" ? "CheckCircle" : event2.state === "Aplazada" ? "EventBusyOutlined" : event2.state === "En progreso" ? "PendingOutlined" : "RadioButtonUnchecked",
|
|
4811
4834
|
description: /* @__PURE__ */ React42.createElement(React42.Fragment, null, event2.state === "Aplazada" || event2.state === "En progreso" || event2.state === "Auto asignada" ? /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(Badge2, { variant: "dot", badgeContent: "", sx: { display: "flex", alignItems: "center", "& .MuiBadge-badge": { top: "50%", transform: "translateY(-50%)" }, color: "action" } }), /* @__PURE__ */ React42.createElement(Typography25, null, event2.state == "Auto asignada" ? "Adicional" : event2.state)) : null),
|
|
4812
4835
|
divider: eventosDelDia.length === idx + 1 ? false : true,
|
|
4813
|
-
|
|
4836
|
+
colorDisabled: event2.state === "Finalizada" || event2.state === "Aplazada" || event2.state === "En progreso" ? true : false,
|
|
4814
4837
|
fn: fn ? () => fn(event2) : void 0
|
|
4815
4838
|
}]
|
|
4816
4839
|
}
|
|
@@ -4832,7 +4855,8 @@ var SCActivityCalendar = ({
|
|
|
4832
4855
|
};
|
|
4833
4856
|
|
|
4834
4857
|
// src/Components/Adjuntar/mobile/AdjuntarMobile.tsx
|
|
4835
|
-
import React44, { useEffect as useEffect21, useRef as useRef8, useState as useState24 } from "react";
|
|
4858
|
+
import React44, { useEffect as useEffect21, useRef as useRef8, useState as useState24, useCallback as useCallback5 } from "react";
|
|
4859
|
+
import Webcam from "react-webcam";
|
|
4836
4860
|
|
|
4837
4861
|
// src/Components/Adjuntar/mobile/components/button.tsx
|
|
4838
4862
|
import React43, { useMemo as useMemo5 } from "react";
|
|
@@ -4886,6 +4910,8 @@ import { IconButton as IconButton16, Stack as Stack14, SwipeableDrawer as Swipea
|
|
|
4886
4910
|
import CssBaseline from "@mui/material/CssBaseline";
|
|
4887
4911
|
import { Box as Box28 } from "@mui/system";
|
|
4888
4912
|
import { CloseOutlined, DeleteOutline as DeleteOutline2, FolderOpenOutlined, PhotoCameraOutlined, UploadFileOutlined as UploadFileOutlined2 } from "@mui/icons-material";
|
|
4913
|
+
import PhotoCameraIcon from "@mui/icons-material/PhotoCamera";
|
|
4914
|
+
import CancelOutlinedIcon from "@mui/icons-material/CancelOutlined";
|
|
4889
4915
|
var AttachmentMobile = ({
|
|
4890
4916
|
buttonAttachment,
|
|
4891
4917
|
maxSize = 400,
|
|
@@ -4896,15 +4922,54 @@ var AttachmentMobile = ({
|
|
|
4896
4922
|
onChange,
|
|
4897
4923
|
sx
|
|
4898
4924
|
}) => {
|
|
4925
|
+
const webcamRef = useRef8(null);
|
|
4926
|
+
const [abrirCamara, setAbrirCamara] = useState24(false);
|
|
4927
|
+
const [capturedImage, setCapturedImage] = useState24(null);
|
|
4899
4928
|
const [files, setFiles] = useState24([]);
|
|
4900
4929
|
const [toast, setToast] = useState24(null);
|
|
4901
4930
|
const [open, setOpen] = React44.useState(false);
|
|
4902
4931
|
const toggleAttachment = (newOpen) => () => {
|
|
4903
4932
|
setOpen(newOpen);
|
|
4904
4933
|
};
|
|
4934
|
+
const closeCam = () => {
|
|
4935
|
+
setAbrirCamara(false);
|
|
4936
|
+
};
|
|
4937
|
+
const openCam = () => {
|
|
4938
|
+
setOpen(false);
|
|
4939
|
+
setAbrirCamara(true);
|
|
4940
|
+
};
|
|
4941
|
+
let capturedImage2 = null;
|
|
4942
|
+
const capture = useCallback5((e) => {
|
|
4943
|
+
if (webcamRef.current) {
|
|
4944
|
+
const imageSrc = webcamRef.current.getScreenshot();
|
|
4945
|
+
setCapturedImage(imageSrc);
|
|
4946
|
+
capturedImage2 = imageSrc;
|
|
4947
|
+
setOpen(false);
|
|
4948
|
+
toggleAttachment(false);
|
|
4949
|
+
setAbrirCamara(false);
|
|
4950
|
+
handleUpload(e);
|
|
4951
|
+
}
|
|
4952
|
+
}, [webcamRef, setCapturedImage]);
|
|
4905
4953
|
const inputRef = useRef8(null);
|
|
4906
4954
|
const handleUpload = (event2) => {
|
|
4907
|
-
|
|
4955
|
+
var _a;
|
|
4956
|
+
let newFiles = event2.target.files;
|
|
4957
|
+
if (capturedImage || capturedImage2) {
|
|
4958
|
+
const image = capturedImage || capturedImage2;
|
|
4959
|
+
if (!image) return;
|
|
4960
|
+
const arr = image.split(",");
|
|
4961
|
+
const mime = ((_a = arr[0].match(/:(.*?);/)) == null ? void 0 : _a[1]) || "image/jpeg";
|
|
4962
|
+
const bstr = atob(arr[1]);
|
|
4963
|
+
let n = bstr.length;
|
|
4964
|
+
const u8arr = new Uint8Array(n);
|
|
4965
|
+
while (n--) {
|
|
4966
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
4967
|
+
}
|
|
4968
|
+
const fechaActual = new Date(Date.now());
|
|
4969
|
+
const fechaConFormato = fechaActual.getFullYear() + "" + (fechaActual.getMonth() + 1) + fechaActual.getDate();
|
|
4970
|
+
const capturedFile = new File([u8arr], `photo_${fechaConFormato}.jpg`, { type: mime });
|
|
4971
|
+
newFiles = [capturedFile];
|
|
4972
|
+
}
|
|
4908
4973
|
if (!newFiles) return;
|
|
4909
4974
|
const nuevosArchivos = [];
|
|
4910
4975
|
const archivosValidos = [];
|
|
@@ -5010,8 +5075,11 @@ var AttachmentMobile = ({
|
|
|
5010
5075
|
}
|
|
5011
5076
|
});
|
|
5012
5077
|
const AttachtmentActions = [
|
|
5013
|
-
{ icon: /* @__PURE__ */ React44.createElement(FolderOpenOutlined, { type: "file", color: "primary" }), color: "primary", label: "Galer\xEDa", onClick: () =>
|
|
5014
|
-
|
|
5078
|
+
{ icon: /* @__PURE__ */ React44.createElement(FolderOpenOutlined, { type: "file", color: "primary" }), color: "primary", label: "Galer\xEDa", onClick: () => {
|
|
5079
|
+
var _a;
|
|
5080
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
5081
|
+
} },
|
|
5082
|
+
{ icon: /* @__PURE__ */ React44.createElement(PhotoCameraOutlined, { type: "file", color: "success" }), color: "success", label: "C\xE1mara", onClick: () => openCam() },
|
|
5015
5083
|
{ icon: /* @__PURE__ */ React44.createElement(FolderOpenOutlined, { type: "file", color: "warning" }), color: "warning", label: "Archivos", onClick: () => {
|
|
5016
5084
|
var _a;
|
|
5017
5085
|
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
@@ -5034,6 +5102,7 @@ var AttachmentMobile = ({
|
|
|
5034
5102
|
{
|
|
5035
5103
|
ModalProps: {
|
|
5036
5104
|
sx: {
|
|
5105
|
+
zIndex: 1400,
|
|
5037
5106
|
"& .MuiPaper-root": {
|
|
5038
5107
|
borderRadius: "16px 16px 0 0"
|
|
5039
5108
|
}
|
|
@@ -5088,7 +5157,49 @@ var AttachmentMobile = ({
|
|
|
5088
5157
|
),
|
|
5089
5158
|
/* @__PURE__ */ React44.createElement(Typography26, { variant: "body2", color: "text.primary" }, option.label)
|
|
5090
5159
|
))))
|
|
5091
|
-
),
|
|
5160
|
+
), abrirCamara && /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.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__ */ React44.createElement(Stack14, { className: "camras" }, /* @__PURE__ */ React44.createElement(
|
|
5161
|
+
Webcam,
|
|
5162
|
+
{
|
|
5163
|
+
audio: false,
|
|
5164
|
+
ref: webcamRef,
|
|
5165
|
+
width: "100%",
|
|
5166
|
+
height: "100%",
|
|
5167
|
+
screenshotFormat: "image/jpeg",
|
|
5168
|
+
videoConstraints: {
|
|
5169
|
+
//facingMode: { exact: "environment" }
|
|
5170
|
+
facingMode: "user"
|
|
5171
|
+
//facingMode: "environment" // cámara trasera
|
|
5172
|
+
},
|
|
5173
|
+
style: {
|
|
5174
|
+
position: "fixed",
|
|
5175
|
+
// Fijo para cubrir toda la ventana
|
|
5176
|
+
top: 0,
|
|
5177
|
+
left: 0,
|
|
5178
|
+
objectFit: "cover",
|
|
5179
|
+
backgroundColor: "black",
|
|
5180
|
+
zIndex: 1600
|
|
5181
|
+
// Encima de todo
|
|
5182
|
+
}
|
|
5183
|
+
}
|
|
5184
|
+
), /* @__PURE__ */ React44.createElement(
|
|
5185
|
+
PhotoCameraIcon,
|
|
5186
|
+
{
|
|
5187
|
+
onClick: capture,
|
|
5188
|
+
sx: {
|
|
5189
|
+
height: "45px",
|
|
5190
|
+
width: "45px",
|
|
5191
|
+
padding: "6px",
|
|
5192
|
+
backgroundColor: "white",
|
|
5193
|
+
color: "#1E62A1",
|
|
5194
|
+
borderRadius: "50px",
|
|
5195
|
+
zIndex: 1700,
|
|
5196
|
+
position: "absolute",
|
|
5197
|
+
bottom: "10px",
|
|
5198
|
+
left: "50%"
|
|
5199
|
+
},
|
|
5200
|
+
fontSize: "medium"
|
|
5201
|
+
}
|
|
5202
|
+
))), files.length > 0 && /* @__PURE__ */ React44.createElement(
|
|
5092
5203
|
Stack14,
|
|
5093
5204
|
{
|
|
5094
5205
|
"data-testid": "ContenedorArchivosAdjuntos",
|