componentes-sinco 1.3.1 → 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.cjs CHANGED
@@ -691,6 +691,7 @@ var Attachment = ({
691
691
 
692
692
  // src/Components/Adjuntar/mobile/AdjuntarMobile.tsx
693
693
  var import_react23 = __toESM(require("react"), 1);
694
+ var import_react_dom = require("react-dom");
694
695
  var import_react_webcam = __toESM(require("react-webcam"), 1);
695
696
 
696
697
  // src/Components/Adjuntar/mobile/components/button.tsx
@@ -3011,6 +3012,7 @@ var AttachmentMobile = ({
3011
3012
  }) => {
3012
3013
  const webcamRef = (0, import_react23.useRef)(null);
3013
3014
  const [abrirCamara, setAbrirCamara] = (0, import_react23.useState)(false);
3015
+ const [camReady, setCamReady] = (0, import_react23.useState)(false);
3014
3016
  const [capturedImage, setCapturedImage] = (0, import_react23.useState)(null);
3015
3017
  const [files, setFiles] = (0, import_react23.useState)([]);
3016
3018
  const [fileToDelete, setFileToDelete] = (0, import_react23.useState)(null);
@@ -3030,15 +3032,21 @@ var AttachmentMobile = ({
3030
3032
  }
3031
3033
  const closeCam = () => {
3032
3034
  setAbrirCamara(false);
3035
+ setCamReady(false);
3033
3036
  };
3034
3037
  const openCam = () => {
3035
3038
  setOpen(false);
3039
+ setCamReady(false);
3036
3040
  setAbrirCamara(true);
3037
3041
  };
3038
3042
  let capturedImage2 = null;
3039
3043
  const capture = (0, import_react23.useCallback)((e) => {
3040
3044
  if (webcamRef.current) {
3041
3045
  const imageSrc = webcamRef.current.getScreenshot();
3046
+ if (!imageSrc) {
3047
+ setToast({ open: true, type: "error", mensaje: "La c\xE1mara a\xFAn no est\xE1 lista, intenta de nuevo." });
3048
+ return;
3049
+ }
3042
3050
  setCapturedImage(imageSrc);
3043
3051
  capturedImage2 = imageSrc;
3044
3052
  setOpen(false);
@@ -3251,49 +3259,56 @@ var AttachmentMobile = ({
3251
3259
  ),
3252
3260
  /* @__PURE__ */ import_react23.default.createElement(import_material16.Typography, { variant: "body2", color: "text.secondary" }, option.label)
3253
3261
  ))))
3254
- ), abrirCamara && /* @__PURE__ */ import_react23.default.createElement(import_react23.default.Fragment, null, /* @__PURE__ */ import_react23.default.createElement(import_CancelOutlined.default, { onClick: closeCam, sx: { borderRadius: "50px", height: "35px", width: "35px", zIndex: 1700, background: "white", position: "absolute", left: `calc(100% - 50px)`, bottom: `calc(100% - 50px)` } }), /* @__PURE__ */ import_react23.default.createElement(import_material16.Stack, { className: "camras" }, /* @__PURE__ */ import_react23.default.createElement(
3255
- import_react_webcam.default,
3256
- {
3257
- audio: false,
3258
- ref: webcamRef,
3259
- width: "100%",
3260
- height: "100%",
3261
- screenshotFormat: "image/jpeg",
3262
- videoConstraints: {
3263
- //facingMode: { exact: "environment" }
3264
- facingMode: "environment"
3265
- //facingMode: "environment" // cámara trasera
3266
- },
3267
- style: {
3268
- position: "fixed",
3269
- // Fijo para cubrir toda la ventana
3270
- top: 0,
3271
- left: 0,
3272
- objectFit: "cover",
3273
- backgroundColor: "black",
3274
- zIndex: 1600
3275
- // Encima de todo
3276
- }
3277
- }
3278
- ), /* @__PURE__ */ import_react23.default.createElement(
3279
- import_PhotoCamera.default,
3280
- {
3281
- onClick: capture,
3282
- sx: {
3283
- height: "45px",
3284
- width: "45px",
3285
- padding: "6px",
3286
- backgroundColor: "white",
3287
- color: "#1E62A1",
3288
- borderRadius: "50px",
3289
- zIndex: 1700,
3290
- position: "absolute",
3291
- bottom: "10px",
3292
- left: "50%"
3293
- },
3294
- fontSize: "medium"
3295
- }
3296
- ))), files.length > 0 && /* @__PURE__ */ import_react23.default.createElement(
3262
+ ), abrirCamara && (0, import_react_dom.createPortal)(
3263
+ /* @__PURE__ */ import_react23.default.createElement(import_system.Box, { sx: { position: "fixed", inset: 0, zIndex: 2e3 } }, /* @__PURE__ */ import_react23.default.createElement(import_CancelOutlined.default, { 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__ */ import_react23.default.createElement(import_material16.Stack, { className: "camras" }, /* @__PURE__ */ import_react23.default.createElement(
3264
+ import_react_webcam.default,
3265
+ {
3266
+ audio: false,
3267
+ ref: webcamRef,
3268
+ width: "100%",
3269
+ height: "100%",
3270
+ screenshotFormat: "image/jpeg",
3271
+ onUserMedia: () => setCamReady(true),
3272
+ videoConstraints: {
3273
+ //facingMode: { exact: "environment" }
3274
+ facingMode: "environment"
3275
+ //facingMode: "environment" // cámara trasera
3276
+ },
3277
+ style: {
3278
+ position: "fixed",
3279
+ // Fijo para cubrir toda la ventana
3280
+ top: 0,
3281
+ left: 0,
3282
+ objectFit: "cover",
3283
+ backgroundColor: "black",
3284
+ zIndex: 2e3
3285
+ // Encima de todo
3286
+ }
3287
+ }
3288
+ ), /* @__PURE__ */ import_react23.default.createElement(
3289
+ import_PhotoCamera.default,
3290
+ {
3291
+ onClick: camReady ? capture : void 0,
3292
+ sx: {
3293
+ height: "45px",
3294
+ width: "45px",
3295
+ padding: "6px",
3296
+ backgroundColor: "white",
3297
+ color: "#1E62A1",
3298
+ borderRadius: "50px",
3299
+ zIndex: 2100,
3300
+ position: "absolute",
3301
+ bottom: "10px",
3302
+ left: "50%",
3303
+ opacity: camReady ? 1 : 0.5,
3304
+ pointerEvents: camReady ? "auto" : "none",
3305
+ cursor: camReady ? "pointer" : "not-allowed"
3306
+ },
3307
+ fontSize: "medium"
3308
+ }
3309
+ ))),
3310
+ document.body
3311
+ ), files.length > 0 && /* @__PURE__ */ import_react23.default.createElement(
3297
3312
  import_material16.Stack,
3298
3313
  {
3299
3314
  "data-testid": "ContenedorArchivosAdjuntos",
@@ -5878,7 +5893,8 @@ var SCDownloadExcelTable = ({
5878
5893
  downloadButton,
5879
5894
  fileName = "archivo excel",
5880
5895
  data = [],
5881
- columns = []
5896
+ columns = [],
5897
+ extraRowsHeader = []
5882
5898
  }) => {
5883
5899
  const formatValue = (value, type) => {
5884
5900
  if (value === null || value === void 0) return "";
@@ -5898,7 +5914,7 @@ var SCDownloadExcelTable = ({
5898
5914
  return formatValue(resolved, col.type);
5899
5915
  })
5900
5916
  );
5901
- const worksheet = XLSX.utils.aoa_to_sheet([headers, ...rows]);
5917
+ const worksheet = XLSX.utils.aoa_to_sheet([...extraRowsHeader, headers, ...rows]);
5902
5918
  const workbook = XLSX.utils.book_new();
5903
5919
  XLSX.utils.book_append_sheet(workbook, worksheet, "Hoja1");
5904
5920
  XLSX.writeFile(workbook, `${fileName}.xlsx`);