componentes-sinco 1.1.15 → 1.1.16

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
@@ -1406,7 +1406,13 @@ var SCTextField = ({
1406
1406
  fullWidth: true,
1407
1407
  size: size ? size : "medium",
1408
1408
  variant,
1409
- sx: { background: background || "transparent", borderRadius: "4px" }
1409
+ sx: {
1410
+ background: background || "transparent",
1411
+ borderRadius: "4px",
1412
+ "& .MuiOutlinedInput-input": {
1413
+ padding: "6px 0px 6px 14px"
1414
+ }
1415
+ }
1410
1416
  },
1411
1417
  /* @__PURE__ */ import_react12.default.createElement(
1412
1418
  import_material6.InputLabel,
@@ -1415,7 +1421,13 @@ var SCTextField = ({
1415
1421
  htmlFor: "",
1416
1422
  required: required && label !== "" ? true : false,
1417
1423
  error,
1418
- disabled: disabled || false
1424
+ disabled: disabled || false,
1425
+ sx: {
1426
+ "&.MuiInputLabel-outlined": {
1427
+ transform: "translate(14px, 8px) scale(1)"
1428
+ // <-- tu transform
1429
+ }
1430
+ }
1419
1431
  },
1420
1432
  label ? label : ""
1421
1433
  ),
@@ -2154,6 +2166,9 @@ var SCDateRange = ({
2154
2166
  "& .MuiInputLabel-asterisk": {
2155
2167
  color: "error.main"
2156
2168
  },
2169
+ "& .MuiPickersOutlinedInput-sectionsContainer": {
2170
+ padding: "6px 0px"
2171
+ },
2157
2172
  background: background != null ? background : "transparent"
2158
2173
  }
2159
2174
  };
@@ -2310,15 +2325,15 @@ var DrawerActions = ({ actions, anchor }) => {
2310
2325
  height: "42px",
2311
2326
  alignItems: "center",
2312
2327
  flexWrap: "nowrap",
2313
- justifyContent: actions.length > 1 ? "space-between" : anchor !== "right" ? "flex-end" : "flex-start",
2314
- flexDirection: anchor !== "right" ? "row-reverse" : "row"
2328
+ justifyContent: actions.length > 1 ? "space-between" : "flex-start",
2329
+ flexDirection: "row-reverse"
2315
2330
  },
2316
2331
  actions.map((btn, index) => /* @__PURE__ */ import_react18.default.createElement(
2317
2332
  import_material12.Button,
2318
2333
  {
2319
2334
  key: index,
2320
2335
  variant: index === 0 || actions.length < 2 ? "contained" : "text",
2321
- color: "primary",
2336
+ color: btn.color ? btn.color : "primary",
2322
2337
  onClick: btn.fn,
2323
2338
  disabled: btn.disabled || false,
2324
2339
  size: "small",
@@ -2338,7 +2353,8 @@ var DrawerHeader = ({
2338
2353
  title,
2339
2354
  colorTitle,
2340
2355
  onClose,
2341
- anchor
2356
+ anchor,
2357
+ filterSideCard
2342
2358
  }) => {
2343
2359
  return /* @__PURE__ */ import_react19.default.createElement(
2344
2360
  import_Grid3.default,
@@ -2346,9 +2362,9 @@ var DrawerHeader = ({
2346
2362
  container: true,
2347
2363
  sx: {
2348
2364
  marginTop: anchor == "bottom" ? "16px" : "0px",
2349
- backgroundColor: anchor == "bottom" ? "white" : "primary.50",
2365
+ backgroundColor: anchor == "bottom" ? "white" : filterSideCard ? "#EAEBEC" : "primary.50",
2350
2366
  alignItems: "center",
2351
- height: "42px",
2367
+ height: filterSideCard ? "38px" : "42px",
2352
2368
  textAlign: "left",
2353
2369
  padding: "8px 12px",
2354
2370
  justifyContent: "space-between",
@@ -2356,7 +2372,7 @@ var DrawerHeader = ({
2356
2372
  }
2357
2373
  },
2358
2374
  /* @__PURE__ */ import_react19.default.createElement(import_material13.Typography, { variant: "h6", color: colorTitle || "text.primary" }, title != null ? title : "Personaliza tu b\xFAsqueda"),
2359
- /* @__PURE__ */ import_react19.default.createElement(import_material13.IconButton, { onClick: onClose }, /* @__PURE__ */ import_react19.default.createElement(import_Close.default, { "data-testid": "test-button-close", sx: { color: "text.primary" } }))
2375
+ filterSideCard ? /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, filterSideCard) : /* @__PURE__ */ import_react19.default.createElement(import_material13.IconButton, { onClick: onClose }, /* @__PURE__ */ import_react19.default.createElement(import_Close.default, { "data-testid": "test-button-close", sx: { color: "text.primary" } }))
2360
2376
  );
2361
2377
  };
2362
2378
 
@@ -2372,7 +2388,9 @@ function SCDrawer({
2372
2388
  open,
2373
2389
  setOpen,
2374
2390
  chipFilters,
2375
- heightDrawer = 456
2391
+ heightDrawer = 456,
2392
+ filterSideCard,
2393
+ ref
2376
2394
  }) {
2377
2395
  const drawerBleeding = heightDrawer;
2378
2396
  const { drawerOpen, handleDrawerClose, toggleDrawer } = useDrawerState({ open, setOpen });
@@ -2399,6 +2417,7 @@ function SCDrawer({
2399
2417
  );
2400
2418
  }
2401
2419
  };
2420
+ const containerRef = import_react20.default.useRef(null);
2402
2421
  const handleCleanFilters = () => {
2403
2422
  cleanAllFilters(arrayElements, setTextFilters);
2404
2423
  };
@@ -2441,7 +2460,7 @@ function SCDrawer({
2441
2460
  import_material14.Drawer,
2442
2461
  {
2443
2462
  open: drawerOpen,
2444
- onClose: toggleDrawer(false),
2463
+ onClose: filterSideCard ? void 0 : toggleDrawer(false),
2445
2464
  anchor: anchor != null ? anchor : "left",
2446
2465
  sx: {
2447
2466
  "& .MuiDrawer-paper": {
@@ -2449,6 +2468,30 @@ function SCDrawer({
2449
2468
  boxSizing: "border-box",
2450
2469
  borderRadius: anchor !== "right" ? "0px 4px 4px 0px" : "4px 0px 0px 4px"
2451
2470
  }
2471
+ },
2472
+ ModalProps: {
2473
+ container: ref == null ? void 0 : ref.current,
2474
+ keepMounted: true,
2475
+ slotProps: {
2476
+ root: {
2477
+ style: {
2478
+ position: "absolute"
2479
+ }
2480
+ }
2481
+ }
2482
+ },
2483
+ hideBackdrop: true,
2484
+ PaperProps: {
2485
+ sx: {
2486
+ // El Drawer (Paper) se posiciona relativo al contenedor
2487
+ position: "absolute !important",
2488
+ height: "100%",
2489
+ // para que ocupe toda la altura del contenedor
2490
+ width: 300,
2491
+ // ajusta el ancho como quieras
2492
+ right: 0
2493
+ // si usas 'top/bottom/left' cámbialos según tu anchor
2494
+ }
2452
2495
  }
2453
2496
  },
2454
2497
  /* @__PURE__ */ import_react20.default.createElement(import_material14.Stack, { flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react20.default.createElement(
@@ -2456,7 +2499,9 @@ function SCDrawer({
2456
2499
  {
2457
2500
  title,
2458
2501
  colorTitle,
2459
- onClose: handleDrawerClose
2502
+ onClose: handleDrawerClose,
2503
+ anchor,
2504
+ filterSideCard
2460
2505
  }
2461
2506
  ), /* @__PURE__ */ import_react20.default.createElement(DrawerContent, { arrayElements }), /* @__PURE__ */ import_react20.default.createElement(DrawerActions, { actions: drawerActions, anchor }))
2462
2507
  ) : /* @__PURE__ */ import_react20.default.createElement(
@@ -2885,7 +2930,7 @@ var import_x_license2 = require("@mui/x-license");
2885
2930
  var import_KeyboardArrowDown = __toESM(require("@mui/icons-material/KeyboardArrowDown"), 1);
2886
2931
  var import_KeyboardArrowUp = __toESM(require("@mui/icons-material/KeyboardArrowUp"), 1);
2887
2932
  var import_styles = require("@mui/material/styles");
2888
- function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, checkboxSelection, width, maxHeight, disableColumnMenu, disableColumnSorting }) {
2933
+ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, rowSelection, checkboxSelection, width, maxHeight, density, disableColumnMenu, disableColumnSorting, setSelectedIndex, selectedIndex = 0, setSelectedRow, selectedRow }) {
2889
2934
  import_x_license2.LicenseInfo.setLicenseKey(
2890
2935
  "77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
2891
2936
  );
@@ -2913,7 +2958,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
2913
2958
  renderCell: (params) => {
2914
2959
  var _a, _b;
2915
2960
  let label = params.value.toString().includes("/") ? params.value.split("/")[0].toString() : params.value.toString();
2916
- debugger;
2917
2961
  let maxDepth = 0;
2918
2962
  if (groupColumns && data.length > 0) {
2919
2963
  const sampleItem = groupColumns(data[0]);
@@ -3036,24 +3080,32 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3036
3080
  }
3037
3081
  }
3038
3082
  };
3039
- let densityC = "compact";
3040
3083
  let validationTreeData = groupColumns ? true : false;
3041
3084
  let validationCheckboxSelection = checkboxSelection || false;
3042
- let styleDensity = densityC || "compact";
3085
+ let styleDensity = density || "compact";
3043
3086
  let styleTopContainerHeight = styleDensity === "compact" ? "26px" : styleDensity === "standard" ? "38px" : styleDensity === "comfortable" ? "60px" : "27px";
3044
- let styleRowHeight = densityC == "compact" ? 32 : densityC == "standard" ? 28 : densityC == "comfortable" ? 36 : 32;
3087
+ let styleRowHeight = density == "compact" ? 32 : density == "standard" ? 28 : density == "comfortable" ? 36 : 32;
3045
3088
  let rows = rowsTable ? rowsTable : validationTreeData != false ? parseInt(data.length.toString()) : data.length < 10 ? parseInt(data.length.toString()) : 10;
3046
3089
  let validationGroupingColDef = groupingColDefs || {};
3047
3090
  const [groupDataLenght, setGroupDataLengh] = (0, import_react27.useState)(0);
3048
3091
  const [pageSize, setPageSize] = (0, import_react27.useState)(rows);
3049
3092
  const [arrayRows, setArrayRows] = (0, import_react27.useState)([]);
3050
3093
  const [selectionModel, setSelectionModel] = (0, import_react27.useState)([]);
3094
+ (0, import_react27.useEffect)(() => {
3095
+ var _a;
3096
+ debugger;
3097
+ if (setSelectedRow) {
3098
+ setSelectedRow(arrayRows[selectedIndex]);
3099
+ setSelectionModel(((_a = arrayRows[selectedIndex]) == null ? void 0 : _a.id) ? [arrayRows[selectedIndex].id] : []);
3100
+ }
3101
+ }, [selectedIndex]);
3051
3102
  (0, import_react27.useEffect)(() => {
3052
3103
  if ((data == null ? void 0 : data.length) > 0) {
3053
3104
  dataConvertRows(data, void 0);
3054
3105
  }
3055
3106
  }, [data]);
3056
3107
  const dataConvertRows = (data2, columnId) => {
3108
+ var _a;
3057
3109
  let dataConvert = [];
3058
3110
  if ((data2 == null ? void 0 : data2.length) > 0) {
3059
3111
  const dataKeys = Object.keys(data2[0]);
@@ -3068,9 +3120,15 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3068
3120
  dataConvert = [...dataConvert, newKeys];
3069
3121
  });
3070
3122
  }
3123
+ debugger;
3071
3124
  setArrayRows(dataConvert);
3125
+ if (arrayRows.length == 0 && (groupDataLenght < 1 && validationTreeData != true)) {
3126
+ setSelectedRow && setSelectedRow(dataConvert[selectedIndex]);
3127
+ setSelectionModel([(_a = dataConvert[0]) == null ? void 0 : _a.id]);
3128
+ }
3072
3129
  };
3073
3130
  const handleSelectionChange = (newSelection) => {
3131
+ debugger;
3074
3132
  if (groupDataLenght > 0 && validationTreeData == true) {
3075
3133
  let numberGrouped = 0;
3076
3134
  let idsRowSelectBefore = [];
@@ -3091,6 +3149,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3091
3149
  }
3092
3150
  }
3093
3151
  });
3152
+ debugger;
3094
3153
  if (idRowSelect !== null) {
3095
3154
  const soloEnArr1 = idsRowSelectBefore.filter((elemento) => !idRowSelect.includes(elemento));
3096
3155
  const hasCommonElements = idsRowSelectBefore.some((element) => idRowSelect.includes(element));
@@ -3101,7 +3160,13 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3101
3160
  }
3102
3161
  }
3103
3162
  } else {
3163
+ debugger;
3104
3164
  setSelectionModel([...newSelection]);
3165
+ const selectedId = newSelection[0];
3166
+ const index = arrayRows.findIndex((row) => row.id === selectedId);
3167
+ if (index !== -1 && setSelectedIndex) {
3168
+ setSelectedIndex(index);
3169
+ }
3105
3170
  }
3106
3171
  };
3107
3172
  const processedColumns = columns.map((col) => {
@@ -3135,7 +3200,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3135
3200
  }, [columnVisibilityModel, apiRef]);
3136
3201
  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(
3137
3202
  import_x_data_grid_pro.DataGridPro,
3138
- {
3203
+ __spreadProps(__spreadValues({
3139
3204
  getRowId,
3140
3205
  apiRef,
3141
3206
  rowHeight: styleRowHeight,
@@ -3155,8 +3220,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3155
3220
  checkboxSelection: validationCheckboxSelection,
3156
3221
  rowSelectionModel: selectionModel,
3157
3222
  onRowSelectionModelChange: (newSelection) => handleSelectionChange(newSelection),
3158
- isRowSelectable,
3159
- disableRowSelectionOnClick: true,
3223
+ isRowSelectable
3224
+ }, rowSelection != true ? { disableRowSelectionOnClick: true } : {}), {
3160
3225
  hideFooter: validationTreeData == true ? true : false,
3161
3226
  disableColumnResize: false,
3162
3227
  localeText: {
@@ -3175,9 +3240,16 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3175
3240
  "& .MuiDataGrid-filler": {
3176
3241
  display: "none !important"
3177
3242
  },
3243
+ "& .MuiDataGrid-columnHeader": {
3244
+ backgroundColor: "#FBFBFB"
3245
+ },
3246
+ "& .MuiDataGrid-columnSeparator": {
3247
+ display: "none"
3248
+ },
3178
3249
  "& .MuiDataGrid-footerContainer": {
3179
3250
  minHeight: "26px !important",
3180
- height: "26px !important"
3251
+ height: "26px !important",
3252
+ backgroundColor: "#FBFBFB"
3181
3253
  },
3182
3254
  "& .MuiTablePagination-toolbar": {
3183
3255
  minHeight: "25px !important",
@@ -3198,6 +3270,10 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3198
3270
  padding: "0 !important",
3199
3271
  background: "white"
3200
3272
  },
3273
+ // Fila seleccionada (cuando selectionModel selecciona filas)
3274
+ "& .MuiDataGrid-row.Mui-selected .MuiDataGrid-cell": {
3275
+ backgroundColor: "#2063A014"
3276
+ },
3201
3277
  // Ocultar celdas vacías completamente
3202
3278
  "& .MuiDataGrid-cellEmpty": {
3203
3279
  display: "none !important",
@@ -3276,7 +3352,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, c
3276
3352
  visibility: "hidden !important"
3277
3353
  }
3278
3354
  }
3279
- }
3355
+ })
3280
3356
  ))));
3281
3357
  }
3282
3358
  var SCDataGrid = import_react27.default.memo(SCDataGridInitial, (prevProps, nextProps) => {
@@ -4736,7 +4812,7 @@ var SCTime = ({
4736
4812
  )),
4737
4813
  sx: {
4738
4814
  backgroundColor: background,
4739
- padding: "8px 12px",
4815
+ padding: "6px 12px",
4740
4816
  cursor: disabled ? "default" : "pointer",
4741
4817
  "& input": {
4742
4818
  cursor: disabled ? "default" : "pointer"
@@ -5010,7 +5086,7 @@ var SCActivityCalendar = ({
5010
5086
  subtitle: /* @__PURE__ */ import_react50.default.createElement(import_react50.default.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__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, "Todo el dia"), /* @__PURE__ */ import_react50.default.createElement(import_LightModeOutlined.default, { fontSize: "small" })) : /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, new Date(event2.date.replace("00:00:00", event2.startTime)).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: true })), /* @__PURE__ */ import_react50.default.createElement(import_ArrowForward.default, { fontSize: "small" }), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, new Date(event2.date.replace("00:00:00", event2.finalTime)).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: true })))),
5011
5087
  iconLeftColor: event2.state === "Finalizada" ? "#C7E49D" : "action",
5012
5088
  iconLeft: event2.state === "Finalizada" ? "CheckCircle" : event2.state === "Aplazada" ? "EventBusyOutlined" : event2.state === "En progreso" ? "PendingOutlined" : "RadioButtonUnchecked",
5013
- description: /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, event2.state === "Aplazada" || event2.state === "En progreso" || event2.state === "Auto asignada" ? /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_material34.Badge, { variant: "dot", badgeContent: "", sx: { display: "flex", alignItems: "center", "& .MuiBadge-badge": { top: "50%", transform: "translateY(-50%)" }, color: "action" } }), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, event2.state == "Auto asignada" ? "Adicional" : event2.state)) : null),
5089
+ description: /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { display: "flex", flexDirection: "column", alignItems: "flex-start" }, event2.state === "Aplazada" || event2.state === "En progreso" || event2.state === "Auto asignada" ? /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { display: "flex", flexDirection: "row", alignItems: "center", gap: 0.5, sx: { marginLeft: "7px" } }, /* @__PURE__ */ import_react50.default.createElement(import_material34.Badge, { variant: "dot", badgeContent: "", sx: { display: "flex", alignItems: "center", "& .MuiBadge-badge": { top: "50%", transform: "translateY(-50%)" }, color: "action" } }), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, event2.state == "Auto asignada" ? "Adicional" : event2.state)) : null, /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "body2" }, event2.equipmentDescription)),
5014
5090
  divider: eventosDelDia.length === idx + 1 ? false : true,
5015
5091
  colorDisabled: event2.state === "Finalizada" || event2.state === "Aplazada" || event2.state === "En progreso" ? true : false,
5016
5092
  fn: fn ? () => fn(event2) : void 0
@@ -5625,10 +5701,11 @@ var SCDatePicker = ({ label, required, disabled, background, state, setState, wi
5625
5701
  sx: {
5626
5702
  minWidth: 140,
5627
5703
  width: width || "100%",
5704
+ background: background || "transparent",
5628
5705
  "& .MuiPickersInputBase-sectionsContainer": {
5629
- padding: "8px 0px"
5630
- },
5631
- background: background || "transparent"
5706
+ padding: "8px 0px",
5707
+ height: "32px"
5708
+ }
5632
5709
  },
5633
5710
  slotProps: {
5634
5711
  popper: {
@@ -6672,7 +6749,7 @@ var components = {
6672
6749
  styleOverrides: {
6673
6750
  root: {
6674
6751
  "&.MuiAutocomplete-root .MuiOutlinedInput-root": {
6675
- padding: "6px 14px 6px 10px !important"
6752
+ padding: "3px 14px 4px 10px !important"
6676
6753
  },
6677
6754
  "& .MuiAutocomplete-endAdornment": {
6678
6755
  top: "calc(50% - 12px)",