componentes-sinco 1.3.2 → 1.3.3

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.d.cts CHANGED
@@ -666,8 +666,9 @@ interface SCDownloadExcelTableProps {
666
666
  fileName?: string;
667
667
  data?: Record<string, any>[];
668
668
  columns?: ColumnDef[];
669
+ extraRowsHeader?: (string | number | null | undefined | any)[][];
669
670
  }
670
- declare const SCDownloadExcelTable: ({ downloadButton, fileName, data, columns, }: SCDownloadExcelTableProps) => React__default.JSX.Element;
671
+ declare const SCDownloadExcelTable: ({ downloadButton, fileName, data, columns, extraRowsHeader, }: SCDownloadExcelTableProps) => React__default.JSX.Element;
671
672
 
672
673
  interface Option$2 {
673
674
  title?: string;
package/dist/index.d.ts CHANGED
@@ -666,8 +666,9 @@ interface SCDownloadExcelTableProps {
666
666
  fileName?: string;
667
667
  data?: Record<string, any>[];
668
668
  columns?: ColumnDef[];
669
+ extraRowsHeader?: (string | number | null | undefined | any)[][];
669
670
  }
670
- declare const SCDownloadExcelTable: ({ downloadButton, fileName, data, columns, }: SCDownloadExcelTableProps) => React__default.JSX.Element;
671
+ declare const SCDownloadExcelTable: ({ downloadButton, fileName, data, columns, extraRowsHeader, }: SCDownloadExcelTableProps) => React__default.JSX.Element;
671
672
 
672
673
  interface Option$2 {
673
674
  title?: string;
package/dist/index.js CHANGED
@@ -605,6 +605,7 @@ var Attachment = ({
605
605
 
606
606
  // src/Components/Adjuntar/mobile/AdjuntarMobile.tsx
607
607
  import React19, { useEffect as useEffect11, useRef as useRef3, useState as useState13, useCallback as useCallback2 } from "react";
608
+ import { createPortal } from "react-dom";
608
609
  import Webcam from "react-webcam";
609
610
 
610
611
  // src/Components/Adjuntar/mobile/components/button.tsx
@@ -2925,6 +2926,7 @@ var AttachmentMobile = ({
2925
2926
  }) => {
2926
2927
  const webcamRef = useRef3(null);
2927
2928
  const [abrirCamara, setAbrirCamara] = useState13(false);
2929
+ const [camReady, setCamReady] = useState13(false);
2928
2930
  const [capturedImage, setCapturedImage] = useState13(null);
2929
2931
  const [files, setFiles] = useState13([]);
2930
2932
  const [fileToDelete, setFileToDelete] = useState13(null);
@@ -2944,15 +2946,21 @@ var AttachmentMobile = ({
2944
2946
  }
2945
2947
  const closeCam = () => {
2946
2948
  setAbrirCamara(false);
2949
+ setCamReady(false);
2947
2950
  };
2948
2951
  const openCam = () => {
2949
2952
  setOpen(false);
2953
+ setCamReady(false);
2950
2954
  setAbrirCamara(true);
2951
2955
  };
2952
2956
  let capturedImage2 = null;
2953
2957
  const capture = useCallback2((e) => {
2954
2958
  if (webcamRef.current) {
2955
2959
  const imageSrc = webcamRef.current.getScreenshot();
2960
+ if (!imageSrc) {
2961
+ setToast({ open: true, type: "error", mensaje: "La c\xE1mara a\xFAn no est\xE1 lista, intenta de nuevo." });
2962
+ return;
2963
+ }
2956
2964
  setCapturedImage(imageSrc);
2957
2965
  capturedImage2 = imageSrc;
2958
2966
  setOpen(false);
@@ -3165,49 +3173,56 @@ var AttachmentMobile = ({
3165
3173
  ),
3166
3174
  /* @__PURE__ */ React19.createElement(Typography9, { variant: "body2", color: "text.secondary" }, option.label)
3167
3175
  ))))
3168
- ), abrirCamara && /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(CancelOutlinedIcon, { onClick: closeCam, sx: { borderRadius: "50px", height: "35px", width: "35px", zIndex: 2e3, background: "white", position: "absolute", left: `calc(100% - 50px)`, bottom: `calc(100% - 50px)` } }), /* @__PURE__ */ React19.createElement(Stack7, { className: "camras" }, /* @__PURE__ */ React19.createElement(
3169
- Webcam,
3170
- {
3171
- audio: false,
3172
- ref: webcamRef,
3173
- width: "100%",
3174
- height: "100%",
3175
- screenshotFormat: "image/jpeg",
3176
- videoConstraints: {
3177
- //facingMode: { exact: "environment" }
3178
- facingMode: "environment"
3179
- //facingMode: "environment" // cámara trasera
3180
- },
3181
- style: {
3182
- position: "fixed",
3183
- // Fijo para cubrir toda la ventana
3184
- top: 0,
3185
- left: 0,
3186
- objectFit: "cover",
3187
- backgroundColor: "black",
3188
- zIndex: 2e3
3189
- // Encima de todo
3190
- }
3191
- }
3192
- ), /* @__PURE__ */ React19.createElement(
3193
- PhotoCameraIcon,
3194
- {
3195
- onClick: capture,
3196
- sx: {
3197
- height: "45px",
3198
- width: "45px",
3199
- padding: "6px",
3200
- backgroundColor: "white",
3201
- color: "#1E62A1",
3202
- borderRadius: "50px",
3203
- zIndex: 2100,
3204
- position: "absolute",
3205
- bottom: "10px",
3206
- left: "50%"
3207
- },
3208
- fontSize: "medium"
3209
- }
3210
- ))), files.length > 0 && /* @__PURE__ */ React19.createElement(
3176
+ ), abrirCamara && createPortal(
3177
+ /* @__PURE__ */ React19.createElement(Box12, { sx: { position: "fixed", inset: 0, zIndex: 2e3 } }, /* @__PURE__ */ React19.createElement(CancelOutlinedIcon, { onClick: closeCam, sx: { borderRadius: "50px", height: "35px", width: "35px", zIndex: 2100, background: "white", position: "absolute", left: `calc(100% - 50px)`, bottom: `calc(100% - 50px)`, cursor: "pointer" } }), /* @__PURE__ */ React19.createElement(Stack7, { className: "camras" }, /* @__PURE__ */ React19.createElement(
3178
+ Webcam,
3179
+ {
3180
+ audio: false,
3181
+ ref: webcamRef,
3182
+ width: "100%",
3183
+ height: "100%",
3184
+ screenshotFormat: "image/jpeg",
3185
+ onUserMedia: () => setCamReady(true),
3186
+ videoConstraints: {
3187
+ //facingMode: { exact: "environment" }
3188
+ facingMode: "environment"
3189
+ //facingMode: "environment" // cámara trasera
3190
+ },
3191
+ style: {
3192
+ position: "fixed",
3193
+ // Fijo para cubrir toda la ventana
3194
+ top: 0,
3195
+ left: 0,
3196
+ objectFit: "cover",
3197
+ backgroundColor: "black",
3198
+ zIndex: 2e3
3199
+ // Encima de todo
3200
+ }
3201
+ }
3202
+ ), /* @__PURE__ */ React19.createElement(
3203
+ PhotoCameraIcon,
3204
+ {
3205
+ onClick: camReady ? capture : void 0,
3206
+ sx: {
3207
+ height: "45px",
3208
+ width: "45px",
3209
+ padding: "6px",
3210
+ backgroundColor: "white",
3211
+ color: "#1E62A1",
3212
+ borderRadius: "50px",
3213
+ zIndex: 2100,
3214
+ position: "absolute",
3215
+ bottom: "10px",
3216
+ left: "50%",
3217
+ opacity: camReady ? 1 : 0.5,
3218
+ pointerEvents: camReady ? "auto" : "none",
3219
+ cursor: camReady ? "pointer" : "not-allowed"
3220
+ },
3221
+ fontSize: "medium"
3222
+ }
3223
+ ))),
3224
+ document.body
3225
+ ), files.length > 0 && /* @__PURE__ */ React19.createElement(
3211
3226
  Stack7,
3212
3227
  {
3213
3228
  "data-testid": "ContenedorArchivosAdjuntos",
@@ -5792,7 +5807,8 @@ var SCDownloadExcelTable = ({
5792
5807
  downloadButton,
5793
5808
  fileName = "archivo excel",
5794
5809
  data = [],
5795
- columns = []
5810
+ columns = [],
5811
+ extraRowsHeader = []
5796
5812
  }) => {
5797
5813
  const formatValue = (value, type) => {
5798
5814
  if (value === null || value === void 0) return "";
@@ -5812,7 +5828,7 @@ var SCDownloadExcelTable = ({
5812
5828
  return formatValue(resolved, col.type);
5813
5829
  })
5814
5830
  );
5815
- const worksheet = XLSX.utils.aoa_to_sheet([headers, ...rows]);
5831
+ const worksheet = XLSX.utils.aoa_to_sheet([...extraRowsHeader, headers, ...rows]);
5816
5832
  const workbook = XLSX.utils.book_new();
5817
5833
  XLSX.utils.book_append_sheet(workbook, worksheet, "Hoja1");
5818
5834
  XLSX.writeFile(workbook, `${fileName}.xlsx`);