componentes-sinco 1.0.34-rc.0 → 1.0.35

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
@@ -2064,7 +2064,6 @@ var SCDateRange = ({
2064
2064
  const isStartEmpty = required && !state[0];
2065
2065
  const isEndEmpty = required && !state[1];
2066
2066
  const hasError = isStartEmpty || isEndEmpty;
2067
- const minDate = new Date(2013, 0, 1);
2068
2067
  const [notification, setNotification] = import_react16.default.useState(false);
2069
2068
  const handleDateChange = (newValue) => {
2070
2069
  const minDateDayjs = (0, import_dayjs.default)("2013-01-01");
@@ -2084,7 +2083,30 @@ var SCDateRange = ({
2084
2083
  return;
2085
2084
  }
2086
2085
  }
2087
- setState(convertedValue);
2086
+ const startDateChanged = convertedValue[0] && state[0] && !convertedValue[0].isSame(state[0], "day");
2087
+ const hasEndDate = convertedValue[1] !== null;
2088
+ if (startDateChanged && convertedValue[0]) {
2089
+ if (!hasEndDate || hasEndDate && convertedValue[0].isAfter(convertedValue[1])) {
2090
+ const correctedValue = [
2091
+ convertedValue[0],
2092
+ convertedValue[0]
2093
+ // Establecer fecha final igual a la inicial
2094
+ ];
2095
+ setState(correctedValue);
2096
+ return;
2097
+ }
2098
+ }
2099
+ const isInvalidRange = convertedValue[0] && convertedValue[1] && convertedValue[0].isAfter(convertedValue[1]);
2100
+ if (isInvalidRange) {
2101
+ const correctedValue = [
2102
+ convertedValue[0],
2103
+ convertedValue[0]
2104
+ // Establecer fecha final igual a la inicial
2105
+ ];
2106
+ setState(correctedValue);
2107
+ } else {
2108
+ setState(convertedValue);
2109
+ }
2088
2110
  };
2089
2111
  return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_LocalizationProvider.LocalizationProvider, { dateAdapter: import_AdapterDayjs.AdapterDayjs, adapterLocale: "es" }, /* @__PURE__ */ import_react16.default.createElement(import_material10.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react16.default.createElement(
2090
2112
  import_DateRangePicker.DateRangePicker,
@@ -2096,44 +2118,38 @@ var SCDateRange = ({
2096
2118
  field: import_MultiInputDateRangeField.MultiInputDateRangeField
2097
2119
  },
2098
2120
  slotProps: {
2099
- field: {
2100
- slotProps: {
2101
- textField: ({ position }) => ({
2102
- label: position === "start" ? labelDateInitial : labelDateFinal,
2103
- size: "small",
2104
- variant: "outlined",
2105
- required,
2106
- error: position === "start" ? isStartEmpty : isEndEmpty,
2107
- InputProps: {
2108
- endAdornment: /* @__PURE__ */ import_react16.default.createElement(import_material10.InputAdornment, { position: "end" }, /* @__PURE__ */ import_react16.default.createElement(
2109
- import_Event.default,
2110
- {
2111
- color: hasError ? "error" : "action",
2112
- fontSize: "small"
2113
- }
2114
- ))
2121
+ textField: ({ position }) => {
2122
+ const isStart = position === "start";
2123
+ return {
2124
+ label: isStart ? labelDateInitial : labelDateFinal,
2125
+ size: "small",
2126
+ variant: "outlined",
2127
+ required,
2128
+ error: isStart ? isStartEmpty : isEndEmpty,
2129
+ InputProps: {
2130
+ endAdornment: /* @__PURE__ */ import_react16.default.createElement(import_material10.InputAdornment, { position: "end" }, /* @__PURE__ */ import_react16.default.createElement(
2131
+ import_Event.default,
2132
+ {
2133
+ color: hasError ? "error" : "action",
2134
+ fontSize: "small"
2135
+ }
2136
+ ))
2137
+ },
2138
+ sx: {
2139
+ flex: 1,
2140
+ "& .MuiOutlinedInput-root": {
2141
+ backgroundColor: background === "transparent" ? "transparent" : background
2115
2142
  },
2116
- sx: {
2117
- mr: position === "start" ? 1 : 0,
2118
- "& .MuiOutlinedInput-root": {
2119
- backgroundColor: background === "transparent" ? "transparent" : background
2120
- },
2121
- "& .MuiInputLabel-asterisk": {
2122
- color: "error.main"
2123
- },
2124
- background: background != null ? background : "transparent"
2125
- }
2126
- })
2127
- }
2143
+ "& .MuiInputLabel-asterisk": {
2144
+ color: "error.main"
2145
+ },
2146
+ background: background != null ? background : "transparent"
2147
+ }
2148
+ };
2128
2149
  }
2129
- },
2130
- sx: {
2131
- display: "flex",
2132
- gap: 1,
2133
- width: "100%"
2134
2150
  }
2135
2151
  }
2136
- ))), notification && /* @__PURE__ */ import_react16.default.createElement(SCToastNotification, { title: "El Formato de la fecha no es v\xE1lido", type: "error" }));
2152
+ ))));
2137
2153
  };
2138
2154
 
2139
2155
  // src/Components/Drawer/components/DrawerContent.tsx
@@ -2342,6 +2358,7 @@ function SCDrawer({
2342
2358
  setOpen,
2343
2359
  chipFilters
2344
2360
  }) {
2361
+ const drawerBleeding = 56;
2345
2362
  const { drawerOpen, handleDrawerClose, toggleDrawer } = useDrawerState({ open, setOpen });
2346
2363
  const { toast, setToastWithDelay } = useToast();
2347
2364
  const {
@@ -2404,12 +2421,12 @@ function SCDrawer({
2404
2421
  onToggle: toggleDrawer(true)
2405
2422
  }
2406
2423
  )
2407
- ), /* @__PURE__ */ import_react20.default.createElement(
2424
+ ), anchor != "bottom" ? /* @__PURE__ */ import_react20.default.createElement(
2408
2425
  import_material14.Drawer,
2409
2426
  {
2410
2427
  open: drawerOpen,
2411
2428
  onClose: toggleDrawer(false),
2412
- anchor,
2429
+ anchor: anchor != null ? anchor : "left",
2413
2430
  sx: {
2414
2431
  "& .MuiDrawer-paper": {
2415
2432
  width: width != null ? width : "450px",
@@ -2426,6 +2443,45 @@ function SCDrawer({
2426
2443
  onClose: handleDrawerClose
2427
2444
  }
2428
2445
  ), /* @__PURE__ */ import_react20.default.createElement(DrawerContent, { arrayElements }), /* @__PURE__ */ import_react20.default.createElement(DrawerActions, { actions: drawerActions, anchor }))
2446
+ ) : /* @__PURE__ */ import_react20.default.createElement(
2447
+ import_material14.SwipeableDrawer,
2448
+ {
2449
+ open: drawerOpen,
2450
+ onClose: toggleDrawer(false),
2451
+ onOpen: toggleDrawer(true),
2452
+ anchor: "bottom",
2453
+ swipeAreaWidth: drawerBleeding,
2454
+ sx: {
2455
+ "& .MuiDrawer-paper": {
2456
+ width: "auto",
2457
+ height: `calc(50% - ${drawerBleeding}px)`,
2458
+ boxSizing: "border-box",
2459
+ borderRadius: "4px 4px 0px 0px"
2460
+ }
2461
+ }
2462
+ },
2463
+ /* @__PURE__ */ import_react20.default.createElement(
2464
+ import_material14.Box,
2465
+ {
2466
+ sx: {
2467
+ width: 30,
2468
+ height: 6,
2469
+ backgroundColor: "#ccc",
2470
+ borderRadius: 3,
2471
+ position: "absolute",
2472
+ top: 8,
2473
+ left: "calc(50% - 15px)"
2474
+ }
2475
+ }
2476
+ ),
2477
+ /* @__PURE__ */ import_react20.default.createElement(import_material14.Stack, { flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react20.default.createElement(
2478
+ DrawerHeader,
2479
+ {
2480
+ title,
2481
+ colorTitle,
2482
+ onClose: handleDrawerClose
2483
+ }
2484
+ ), /* @__PURE__ */ import_react20.default.createElement(DrawerContent, { arrayElements }), /* @__PURE__ */ import_react20.default.createElement(DrawerActions, { actions: drawerActions, anchor }))
2429
2485
  ));
2430
2486
  }
2431
2487
 
@@ -2759,20 +2815,6 @@ function SCDataGridInitial({ data, columns, groupColumns, rowsTable, checkboxSel
2759
2815
  import_x_license2.LicenseInfo.setLicenseKey(
2760
2816
  "77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
2761
2817
  );
2762
- const columnsWidthConfig = import_react27.default.useMemo(() => {
2763
- var _a, _b;
2764
- if (!columns || columns.length === 0) return columns;
2765
- const cols = [...columns];
2766
- const lastIndex = cols.length - 1;
2767
- if (!cols[lastIndex].flex) {
2768
- cols[lastIndex] = __spreadProps(__spreadValues({}, cols[lastIndex]), {
2769
- flex: 1,
2770
- minWidth: (_b = (_a = cols[lastIndex].minWidth) != null ? _a : cols[lastIndex].width) != null ? _b : 120
2771
- });
2772
- delete cols[lastIndex].width;
2773
- }
2774
- return cols;
2775
- }, [columns]);
2776
2818
  const theme = (0, import_styles.useTheme)();
2777
2819
  const apiRef = (0, import_x_data_grid_pro.useGridApiRef)();
2778
2820
  const isRowSelectable = (params) => params.row.bloqueoChecked == false ? false : true;
@@ -2793,6 +2835,7 @@ function SCDataGridInitial({ data, columns, groupColumns, rowsTable, checkboxSel
2793
2835
  const groupingColDefs = {
2794
2836
  field: "grouping",
2795
2837
  headerName: groupColumns ? groupColumns(data[0]).headerNameFirstColumn : "Agrupador",
2838
+ flex: 1,
2796
2839
  renderCell: (params) => {
2797
2840
  var _a, _b;
2798
2841
  let label = params.value.toString().includes("/") ? params.value.split("/")[0].toString() : params.value.toString();
@@ -2862,7 +2905,7 @@ function SCDataGridInitial({ data, columns, groupColumns, rowsTable, checkboxSel
2862
2905
  overflow: "hidden",
2863
2906
  textOverflow: "ellipsis",
2864
2907
  whiteSpace: "nowrap",
2865
- color: "text.primary",
2908
+ color: "#101840DE",
2866
2909
  display: "flex",
2867
2910
  alignItems: "center",
2868
2911
  paddingLeft: params.rowNode.depth == 0 ? "5px" : params.rowNode.depth == 1 ? "15px" : "25px",
@@ -2985,13 +3028,24 @@ function SCDataGridInitial({ data, columns, groupColumns, rowsTable, checkboxSel
2985
3028
  setSelectionModel([...newSelection]);
2986
3029
  }
2987
3030
  };
3031
+ const processedColumns = columns.map((col) => {
3032
+ if (col.width !== void 0) {
3033
+ return col;
3034
+ }
3035
+ if (col.flex !== void 0) {
3036
+ return col;
3037
+ }
3038
+ return __spreadProps(__spreadValues({}, col), {
3039
+ flex: 1
3040
+ });
3041
+ });
2988
3042
  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(
2989
3043
  import_x_data_grid_pro.DataGridPro,
2990
3044
  {
2991
3045
  apiRef,
2992
3046
  rowHeight: styleRowHeight,
2993
3047
  rows: arrayRows,
2994
- columns: columnsWidthConfig,
3048
+ columns: processedColumns,
2995
3049
  density: styleDensity,
2996
3050
  treeData: validationTreeData,
2997
3051
  getTreeDataPath: validationTreeData == true ? getTreeDataPaths : void 0,
@@ -3000,12 +3054,14 @@ function SCDataGridInitial({ data, columns, groupColumns, rowsTable, checkboxSel
3000
3054
  initialState: {
3001
3055
  pagination: { paginationModel: { pageSize: rows } }
3002
3056
  },
3057
+ scrollbarSize: 0,
3003
3058
  checkboxSelection: validationCheckboxSelection,
3004
3059
  rowSelectionModel: selectionModel,
3005
3060
  onRowSelectionModelChange: (newSelection) => handleSelectionChange(newSelection),
3006
3061
  isRowSelectable,
3007
3062
  disableRowSelectionOnClick: true,
3008
3063
  hideFooter: validationTreeData == true ? true : false,
3064
+ disableColumnResize: false,
3009
3065
  localeText: {
3010
3066
  noRowsLabel: "No hay filas",
3011
3067
  columnMenuLabel: "Men\xFA de columna",
@@ -3036,7 +3092,7 @@ function SCDataGridInitial({ data, columns, groupColumns, rowsTable, checkboxSel
3036
3092
  "&.MuiDataGrid-root": {
3037
3093
  [`--DataGrid-topContainerHeight`]: `${styleTopContainerHeight} !important`
3038
3094
  },
3039
- "& .MuiDataGrid-root .MuiDataGrid-virtualScrollerContent .MuiDataGrid-row": {
3095
+ "MuiDataGrid-root .MuiDataGrid-virtualScrollerContent .MuiDataGrid-row": {
3040
3096
  "--height": "0px !important",
3041
3097
  "minHeight": "0px !important",
3042
3098
  "maxHeight": "0px !important"
@@ -3045,22 +3101,82 @@ function SCDataGridInitial({ data, columns, groupColumns, rowsTable, checkboxSel
3045
3101
  padding: "0 !important",
3046
3102
  background: "white"
3047
3103
  },
3048
- "& .MuiDataGrid-cell .MuiDataGrid-cellEmpty": {
3049
- display: "none",
3050
- width: "0px"
3104
+ // Ocultar celdas vacías completamente
3105
+ "& .MuiDataGrid-cellEmpty": {
3106
+ display: "none !important",
3107
+ width: "0 !important",
3108
+ minWidth: "0 !important",
3109
+ maxWidth: "0 !important"
3110
+ },
3111
+ // Forzar que las columnas ocupen todo el ancho
3112
+ "& .MuiDataGrid-row": {
3113
+ maxWidth: "100% !important"
3114
+ },
3115
+ // Ocultar scrollbars personalizados de MUI completamente en todos los estados
3116
+ "& .MuiDataGrid-scrollbar": {
3117
+ display: "none !important",
3118
+ visibility: "hidden !important",
3119
+ width: "0 !important",
3120
+ opacity: "0 !important"
3121
+ },
3122
+ "& .MuiDataGrid-scrollbar--vertical": {
3123
+ display: "none !important",
3124
+ visibility: "hidden !important",
3125
+ width: "0 !important",
3126
+ opacity: "0 !important"
3127
+ },
3128
+ "& .MuiDataGrid-scrollbar--horizontal": {
3129
+ display: "none !important",
3130
+ visibility: "hidden !important",
3131
+ height: "0 !important",
3132
+ opacity: "0 !important"
3133
+ },
3134
+ "& .MuiDataGrid-scrollbar.MuiDataGrid-scrollbar--scrollable": {
3135
+ display: "none !important",
3136
+ visibility: "hidden !important"
3051
3137
  },
3138
+ // Prevenir aparición de scrollbar en hover sobre row
3139
+ "& .MuiDataGrid-row:hover ~ .MuiDataGrid-scrollbar": {
3140
+ display: "none !important",
3141
+ visibility: "hidden !important"
3142
+ },
3143
+ // Scrollbar filler y content siempre ocultos
3144
+ "& .MuiDataGrid-scrollbarFiller": {
3145
+ backgroundColor: "transparent !important",
3146
+ display: "none !important"
3147
+ },
3148
+ "& .MuiDataGrid-scrollbarContent": {
3149
+ backgroundColor: "transparent !important",
3150
+ display: "none !important"
3151
+ },
3152
+ // Scrollbar nativo visible solo cuando hay overflow
3052
3153
  "& .MuiDataGrid-virtualScroller": {
3053
3154
  overflowY: "auto !important",
3155
+ scrollbarWidth: "thin",
3156
+ scrollbarColor: "#888 transparent",
3054
3157
  "&::-webkit-scrollbar": {
3055
- width: "0px"
3158
+ width: "8px",
3159
+ height: "8px"
3056
3160
  },
3057
- "&:hover::-webkit-scrollbar": {
3058
- width: "8px"
3161
+ "&::-webkit-scrollbar-track": {
3162
+ background: "transparent"
3059
3163
  },
3060
3164
  "&::-webkit-scrollbar-thumb": {
3061
- backgroundColor: "rgba(0,0,0,.2)",
3165
+ background: "#888",
3062
3166
  borderRadius: "4px"
3167
+ },
3168
+ "&::-webkit-scrollbar-thumb:hover": {
3169
+ background: "#555"
3063
3170
  }
3171
+ },
3172
+ // Prevenir que aparezca scrollbar en hover
3173
+ "&:hover .MuiDataGrid-scrollbar": {
3174
+ display: "none !important",
3175
+ visibility: "hidden !important"
3176
+ },
3177
+ "&:hover .MuiDataGrid-scrollbar--vertical": {
3178
+ display: "none !important",
3179
+ visibility: "hidden !important"
3064
3180
  }
3065
3181
  }
3066
3182
  }
@@ -3910,7 +4026,7 @@ var CALENDAR_CONSTANTS = {
3910
4026
  GRID_TEMPLATE: "repeat(7, minmax(150px, 1fr))",
3911
4027
  DAY_HEIGHT: 60,
3912
4028
  SIDEBAR_WIDTH: 47,
3913
- MIN_CELL_HEIGHT: 90,
4029
+ MIN_CELL_HEIGHT: 99,
3914
4030
  DEFAULT_START_HOUR: 0,
3915
4031
  DEFAULT_END_HOUR: 23,
3916
4032
  DRAWER_WIDTH: "350px",