componentes-sinco 1.1.13 → 1.1.15

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
@@ -2885,7 +2885,7 @@ var import_x_license2 = require("@mui/x-license");
2885
2885
  var import_KeyboardArrowDown = __toESM(require("@mui/icons-material/KeyboardArrowDown"), 1);
2886
2886
  var import_KeyboardArrowUp = __toESM(require("@mui/icons-material/KeyboardArrowUp"), 1);
2887
2887
  var import_styles = require("@mui/material/styles");
2888
- function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, checkboxSelection, width, maxHeight, density }) {
2888
+ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, checkboxSelection, width, maxHeight, disableColumnMenu, disableColumnSorting }) {
2889
2889
  import_x_license2.LicenseInfo.setLicenseKey(
2890
2890
  "77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
2891
2891
  );
@@ -3036,11 +3036,12 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3036
3036
  }
3037
3037
  }
3038
3038
  };
3039
+ let densityC = "compact";
3039
3040
  let validationTreeData = groupColumns ? true : false;
3040
3041
  let validationCheckboxSelection = checkboxSelection || false;
3041
- let styleDensity = density || "compact";
3042
+ let styleDensity = densityC || "compact";
3042
3043
  let styleTopContainerHeight = styleDensity === "compact" ? "26px" : styleDensity === "standard" ? "38px" : styleDensity === "comfortable" ? "60px" : "27px";
3043
- let styleRowHeight = density == "compact" ? 32 : density == "standard" ? 28 : density == "comfortable" ? 36 : 32;
3044
+ let styleRowHeight = densityC == "compact" ? 32 : densityC == "standard" ? 28 : densityC == "comfortable" ? 36 : 32;
3044
3045
  let rows = rowsTable ? rowsTable : validationTreeData != false ? parseInt(data.length.toString()) : data.length < 10 ? parseInt(data.length.toString()) : 10;
3045
3046
  let validationGroupingColDef = groupingColDefs || {};
3046
3047
  const [groupDataLenght, setGroupDataLengh] = (0, import_react27.useState)(0);
@@ -3114,6 +3115,24 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3114
3115
  flex: 1
3115
3116
  });
3116
3117
  });
3118
+ const columnVisibilityModel = {};
3119
+ processedColumns.forEach((col) => {
3120
+ if (col.hide === true) {
3121
+ columnVisibilityModel[col.field] = false;
3122
+ }
3123
+ });
3124
+ console.log("columnVisibilityModel:", columnVisibilityModel);
3125
+ const initialState = {
3126
+ pagination: { paginationModel: { pageSize: rows } }
3127
+ };
3128
+ if (Object.keys(columnVisibilityModel).length > 0) {
3129
+ initialState.columns = { columnVisibilityModel };
3130
+ }
3131
+ (0, import_react27.useEffect)(() => {
3132
+ if (apiRef.current && Object.keys(columnVisibilityModel).length > 0) {
3133
+ apiRef.current.setColumnVisibilityModel(columnVisibilityModel);
3134
+ }
3135
+ }, [columnVisibilityModel, apiRef]);
3117
3136
  return /* @__PURE__ */ import_react27.default.createElement(import_react27.default.Fragment, null, data && /* @__PURE__ */ import_react27.default.createElement(import_react27.default.Fragment, null, /* @__PURE__ */ import_react27.default.createElement("div", { style: { width: width || "100%", maxHeight: maxHeight ? `${maxHeight}px` : "none" } }, /* @__PURE__ */ import_react27.default.createElement(
3118
3137
  import_x_data_grid_pro.DataGridPro,
3119
3138
  {
@@ -3131,6 +3150,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3131
3150
  pagination: { paginationModel: { pageSize: rows } }
3132
3151
  },
3133
3152
  scrollbarSize: 0,
3153
+ disableColumnMenu: disableColumnMenu ? disableColumnMenu : false,
3154
+ disableColumnSorting: disableColumnSorting ? disableColumnSorting : false,
3134
3155
  checkboxSelection: validationCheckboxSelection,
3135
3156
  rowSelectionModel: selectionModel,
3136
3157
  onRowSelectionModelChange: (newSelection) => handleSelectionChange(newSelection),
@@ -3259,7 +3280,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3259
3280
  ))));
3260
3281
  }
3261
3282
  var SCDataGrid = import_react27.default.memo(SCDataGridInitial, (prevProps, nextProps) => {
3262
- const isEqual = prevProps.rowsTable === nextProps.rowsTable && prevProps.checkboxSelection === nextProps.checkboxSelection && prevProps.width === nextProps.width && prevProps.maxHeight === nextProps.maxHeight && prevProps.density === nextProps.density;
3283
+ const isEqual = prevProps.rowsTable === nextProps.rowsTable && prevProps.checkboxSelection === nextProps.checkboxSelection && prevProps.width === nextProps.width && prevProps.maxHeight === nextProps.maxHeight;
3263
3284
  return isEqual;
3264
3285
  });
3265
3286
 
@@ -3526,7 +3547,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
3526
3547
  );
3527
3548
  })) : /* @__PURE__ */ import_react33.default.createElement(import_material20.Box, { sx: { width: "100%", display: "flex", flexDirection: "row", justifyContent: "center" } }, /* @__PURE__ */ import_react33.default.createElement(import_ToggleButtonGroup.default, { size: "large", fullWidth: true }, dialogActions.map((boton, index) => {
3528
3549
  var _a;
3529
- return /* @__PURE__ */ import_react33.default.createElement(import_ToggleButton.default, { disabled: boton.disabled || false, fullWidth: boton.text ? true : false, size: "medium", value: "text", onClick: boton.fn }, (_a = boton.text) != null ? _a : /* @__PURE__ */ import_react33.default.createElement(import_material20.SvgIcon, { fontSize: "small", component: boton.icon }));
3550
+ return /* @__PURE__ */ import_react33.default.createElement(import_ToggleButton.default, { sx: { color: "primary.main" }, disabled: boton.disabled || false, fullWidth: boton.text ? true : false, size: "medium", value: "text", onClick: boton.fn }, (_a = boton.text) != null ? _a : /* @__PURE__ */ import_react33.default.createElement(import_material20.SvgIcon, { fontSize: "small", component: boton.icon }));
3530
3551
  })))) : "" : ""
3531
3552
  )));
3532
3553
  };
@@ -4661,6 +4682,7 @@ var SCTime = ({
4661
4682
  const [anchorEl, setAnchorEl] = (0, import_react48.useState)(null);
4662
4683
  const [isOpenPopover, setIsOpenPopover] = (0, import_react48.useState)(false);
4663
4684
  const [popoverPlacement, setPopoverPlacement] = (0, import_react48.useState)("bottom");
4685
+ const [popoverWidth, setPopoverWidth] = (0, import_react48.useState)(void 0);
4664
4686
  const detectPlacement = (element) => {
4665
4687
  const rect = element.getBoundingClientRect();
4666
4688
  const windowHeight = window.innerHeight;
@@ -4677,6 +4699,7 @@ var SCTime = ({
4677
4699
  if (!disabled) {
4678
4700
  const target = event2.currentTarget;
4679
4701
  setAnchorEl(target);
4702
+ setPopoverWidth(target.offsetWidth);
4680
4703
  detectPlacement(target);
4681
4704
  setIsOpenPopover(true);
4682
4705
  }
@@ -4757,7 +4780,8 @@ var SCTime = ({
4757
4780
  border: "1px solid #e0e0e0",
4758
4781
  maxHeight: "300px",
4759
4782
  overflow: "visible",
4760
- width: width ? `calc(${width}% - 15px)` : "97%"
4783
+ width: popoverWidth ? `${popoverWidth}px` : "100%",
4784
+ maxWidth: "none"
4761
4785
  }
4762
4786
  }
4763
4787
  }
@@ -4874,11 +4898,6 @@ var import_KeyboardDoubleArrowDown2 = __toESM(require("@mui/icons-material/Keybo
4874
4898
  var import_KeyboardDoubleArrowUp2 = __toESM(require("@mui/icons-material/KeyboardDoubleArrowUp"), 1);
4875
4899
  var import_ArrowForward = __toESM(require("@mui/icons-material/ArrowForward"), 1);
4876
4900
  var import_LightModeOutlined = __toESM(require("@mui/icons-material/LightModeOutlined"), 1);
4877
- var import_FilterList = __toESM(require("@mui/icons-material/FilterList"), 1);
4878
- var import_CalendarMonthOutlined = __toESM(require("@mui/icons-material/CalendarMonthOutlined"), 1);
4879
- var import_CheckCircleOutlineOutlined = __toESM(require("@mui/icons-material/CheckCircleOutlineOutlined"), 1);
4880
- var import_EventBusyOutlined = __toESM(require("@mui/icons-material/EventBusyOutlined"), 1);
4881
- var import_PendingOutlined = __toESM(require("@mui/icons-material/PendingOutlined"), 1);
4882
4901
  var SCActivityCalendar = ({
4883
4902
  //informativas
4884
4903
  //apariencia
@@ -4895,9 +4914,6 @@ var SCActivityCalendar = ({
4895
4914
  const [fechaSeleccionada, setFechaSeleccionada] = (0, import_react50.useState)();
4896
4915
  const [stateVal, setstateVal] = import_react50.default.useState(/* @__PURE__ */ new Date());
4897
4916
  const [openCalendar, setOpenCalendar] = import_react50.default.useState(false);
4898
- const [anchorPopoverFiltro, setAnchorPopoverFiltro] = (0, import_react50.useState)(null);
4899
- const [datosEventos, setDatosEventos] = import_react50.default.useState(events);
4900
- const openPopoverFiltro = Boolean(anchorPopoverFiltro);
4901
4917
  const hoy = /* @__PURE__ */ new Date();
4902
4918
  const inicioSemana = (0, import_date_fns2.startOfWeek)(fecha, { weekStartsOn: 0 });
4903
4919
  const diasSemana = Array.from({ length: 7 }, (_, i) => (0, import_date_fns2.addDays)(inicioSemana, i));
@@ -4925,22 +4941,6 @@ var SCActivityCalendar = ({
4925
4941
  // 0 = domingo, 1 = lunes
4926
4942
  })
4927
4943
  });
4928
- const handleClickPopoverFiltro = (event2) => {
4929
- setAnchorPopoverFiltro(event2.currentTarget);
4930
- };
4931
- const handleClosePopoverFiltro = () => {
4932
- setAnchorPopoverFiltro(null);
4933
- };
4934
- const filtrarActividad = (event2, filtro) => {
4935
- if (filtro === "Todo") {
4936
- setDatosEventos(events);
4937
- } else {
4938
- const resultado = events.filter(
4939
- (item) => item.state === filtro
4940
- );
4941
- setDatosEventos(resultado);
4942
- }
4943
- };
4944
4944
  return /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_LocalizationProvider4.LocalizationProvider, { dateAdapter: import_AdapterDateFns2.AdapterDateFns, adapterLocale: locale }, openCalendar == false ? /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { "data-testid": "calendar-mobile", sx: { width: "100%", background: background ? background : "white", display: "flex", flexDirection: "column", alignItems: "center" } }, /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { sx: { width: "100%", padding: "0px", background: "transparent" } }, /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { container: true, gap: 0.5, sx: { justifyContent: "space-between", padding: "12px 16px", background: "transparent" } }, diasSemana.map((dia) => /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { sx: { width: "36px" }, key: dia.toString() }, /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { sx: { width: "36px", height: "40px", display: "flex", alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { sx: { fontSize: "12px !important", color: "#10184099" } }, (0, import_date_fns2.format)(dia, "EEEE", { locale: import_locale2.es }).charAt(0).toUpperCase())), /* @__PURE__ */ import_react50.default.createElement(
4945
4945
  import_material34.Box,
4946
4946
  {
@@ -4980,36 +4980,7 @@ var SCActivityCalendar = ({
4980
4980
  },
4981
4981
  onChange: (newValue) => setFecha(newValue)
4982
4982
  }
4983
- ), /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { container: true, justifyContent: "center" }, /* @__PURE__ */ import_react50.default.createElement(import_material34.IconButton, { "data-testid": "close-calendar-button", onClick: toggleCalendar(false) }, /* @__PURE__ */ import_react50.default.createElement(import_KeyboardDoubleArrowUp2.default, { color: "action" }))))), /* @__PURE__ */ import_react50.default.createElement(import_material34.IconButton, { onClick: handleClickPopoverFiltro, sx: { position: "fixed", right: "calc(100% - 96%)", top: openCalendar == false ? "220px" : "380px" } }, /* @__PURE__ */ import_react50.default.createElement(import_FilterList.default, { color: "action" })), /* @__PURE__ */ import_react50.default.createElement(
4984
- import_material34.Popover,
4985
- {
4986
- open: openPopoverFiltro,
4987
- anchorEl: anchorPopoverFiltro,
4988
- onClose: handleClosePopoverFiltro,
4989
- anchorOrigin: {
4990
- vertical: "bottom",
4991
- horizontal: "right"
4992
- }
4993
- },
4994
- /* @__PURE__ */ import_react50.default.createElement(
4995
- import_material34.Menu,
4996
- {
4997
- id: "basic-menu",
4998
- anchorEl: anchorPopoverFiltro,
4999
- open: openPopoverFiltro,
5000
- onClose: handleClosePopoverFiltro,
5001
- slotProps: {
5002
- list: {
5003
- "aria-labelledby": "basic-button"
5004
- }
5005
- }
5006
- },
5007
- /* @__PURE__ */ import_react50.default.createElement(import_material34.MenuItem, { onClick: (event2) => filtrarActividad(event2, "Todo") }, /* @__PURE__ */ import_react50.default.createElement(import_material34.ListItemIcon, null, /* @__PURE__ */ import_react50.default.createElement(import_CalendarMonthOutlined.default, { fontSize: "small" })), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "inherit" }, "Ver todo")),
5008
- /* @__PURE__ */ import_react50.default.createElement(import_material34.MenuItem, { onClick: (event2) => filtrarActividad(event2, "Finalizada") }, /* @__PURE__ */ import_react50.default.createElement(import_material34.ListItemIcon, null, /* @__PURE__ */ import_react50.default.createElement(import_CheckCircleOutlineOutlined.default, { fontSize: "small" })), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "inherit" }, "Ver finalizadas")),
5009
- /* @__PURE__ */ import_react50.default.createElement(import_material34.MenuItem, { onClick: (event2) => filtrarActividad(event2, "Aplazada") }, /* @__PURE__ */ import_react50.default.createElement(import_material34.ListItemIcon, null, /* @__PURE__ */ import_react50.default.createElement(import_EventBusyOutlined.default, { fontSize: "small" })), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "inherit" }, "Ver aplazadas")),
5010
- /* @__PURE__ */ import_react50.default.createElement(import_material34.MenuItem, { onClick: (event2) => filtrarActividad(event2, "En progreso") }, /* @__PURE__ */ import_react50.default.createElement(import_material34.ListItemIcon, null, /* @__PURE__ */ import_react50.default.createElement(import_PendingOutlined.default, { fontSize: "small" })), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "inherit" }, "Ver en progreso"))
5011
- )
5012
- ), /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { sx: { boxSizing: "border-box", padding: "0px 16px", width: "100%", height: openCalendar ? "calc(91% - 260px)" : "calc(91% - 100px)", background: "white", display: "flex", flexDirection: "column", overflowY: "auto", gap: "8px", scrollSnapType: "x mandatory", paddingBottom: "10px" } }, diasSemana.map((day, dayIndex) => /* @__PURE__ */ import_react50.default.createElement(
4983
+ ), /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { container: true, justifyContent: "center" }, /* @__PURE__ */ import_react50.default.createElement(import_material34.IconButton, { "data-testid": "close-calendar-button", onClick: toggleCalendar(false) }, /* @__PURE__ */ import_react50.default.createElement(import_KeyboardDoubleArrowUp2.default, { color: "action" }))))), /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { sx: { boxSizing: "border-box", padding: "0px 16px", width: "100%", height: openCalendar ? "calc(91% - 260px)" : "calc(91% - 100px)", background: "white", display: "flex", flexDirection: "column", overflowY: "auto", gap: "8px", scrollSnapType: "x mandatory", paddingBottom: "10px" } }, diasSemana.map((day, dayIndex) => /* @__PURE__ */ import_react50.default.createElement(
5013
4984
  import_material34.Box,
5014
4985
  {
5015
4986
  key: dayIndex
@@ -5026,7 +4997,7 @@ var SCActivityCalendar = ({
5026
4997
  flexDirection: "column"
5027
4998
  } }, (() => {
5028
4999
  const esDomingo = day.getDay() === 0;
5029
- const eventosDelDia = datosEventos.filter(
5000
+ const eventosDelDia = events.filter(
5030
5001
  (event2) => new Date(event2.date).toDateString() === day.toDateString()
5031
5002
  );
5032
5003
  if (eventosDelDia.length > 0) {
@@ -5388,7 +5359,7 @@ var AttachmentMobile = ({
5388
5359
  screenshotFormat: "image/jpeg",
5389
5360
  videoConstraints: {
5390
5361
  //facingMode: { exact: "environment" }
5391
- facingMode: "user"
5362
+ facingMode: "environment"
5392
5363
  //facingMode: "environment" // cámara trasera
5393
5364
  },
5394
5365
  style: {
@@ -5653,7 +5624,6 @@ var SCDatePicker = ({ label, required, disabled, background, state, setState, wi
5653
5624
  maxDate: (0, import_dayjs11.default)().add(3, "month"),
5654
5625
  sx: {
5655
5626
  minWidth: 140,
5656
- padding: "13px 0px",
5657
5627
  width: width || "100%",
5658
5628
  "& .MuiPickersInputBase-sectionsContainer": {
5659
5629
  padding: "8px 0px"
@@ -5668,13 +5638,7 @@ var SCDatePicker = ({ label, required, disabled, background, state, setState, wi
5668
5638
  },
5669
5639
  textField: {
5670
5640
  required: required || false,
5671
- InputLabelProps: {
5672
- sx: {
5673
- "&.MuiInputLabel-shrink": {
5674
- transform: "translate(10px, 5px) scale(0.9) !important"
5675
- }
5676
- }
5677
- }
5641
+ size: "small"
5678
5642
  }
5679
5643
  },
5680
5644
  slots: {