sevago-library 1.3.16 → 1.3.18

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.esm.js CHANGED
@@ -33417,7 +33417,10 @@ const TypographyGridInfoRow = ({
33417
33417
  ...sx
33418
33418
  },
33419
33419
  children: [
33420
- /* @__PURE__ */ jsx(Typography$1, { sx: { ...TYPOGRAPHY.textSm.semiBold, color: GRAY[500], ...sxLabel }, children: label }),
33420
+ /* @__PURE__ */ jsxs(Typography$1, { sx: { ...TYPOGRAPHY.textSm.regular, color: GRAY[500], ...sxLabel }, children: [
33421
+ label,
33422
+ ":"
33423
+ ] }),
33421
33424
  /* @__PURE__ */ jsx(
33422
33425
  Typography$1,
33423
33426
  {
@@ -74666,23 +74669,11 @@ const buttonRootSx = {
74666
74669
  minWidth: 100,
74667
74670
  textTransform: "none",
74668
74671
  borderRadius: BORDER_RADIUS_ELEMENT_SMALL,
74669
- width: "fit-content",
74670
- [TABLET_MEDIA]: {
74671
- minWidth: 120,
74672
- minHeight: 44,
74673
- px: 2.5,
74674
- py: 1,
74675
- "& .MuiButton-startIcon .material-symbols-rounded, & .MuiButton-endIcon .material-symbols-rounded": {
74676
- fontSize: 22
74677
- }
74678
- }
74672
+ width: "fit-content"
74679
74673
  };
74680
74674
  const buttonContentSx = {
74681
74675
  ...TYPOGRAPHY.textSm.regular,
74682
- whiteSpace: "nowrap",
74683
- [TABLET_MEDIA]: {
74684
- ...TYPOGRAPHY.textMd.medium
74685
- }
74676
+ whiteSpace: "nowrap"
74686
74677
  };
74687
74678
  const ButtonElement = ({
74688
74679
  content,
@@ -76254,21 +76245,31 @@ const DISABLED_DEFAULT = Object.keys(TableActions).reduce(
76254
76245
  },
76255
76246
  {}
76256
76247
  );
76248
+ const getSxArray = (sx) => {
76249
+ if (!sx) return [];
76250
+ return Array.isArray(sx) ? [...sx] : [sx];
76251
+ };
76252
+ const mergeSxProps = (...sxList) => {
76253
+ return sxList.flatMap((sx) => getSxArray(sx));
76254
+ };
76257
76255
  const getStyleCell = (column, palette, disableRow) => {
76258
- return {
76259
- width: `${column.width}px !important`,
76260
- minWidth: `${column.width}px !important`,
76261
- maxWidth: `${column.width}px !important`,
76262
- padding: PADDING_GAP_ITEM,
76263
- borderRadius: "0 !important",
76264
- color: disableRow ? palette.divider : "none",
76265
- ...column.stickyCss ? {
76266
- position: "sticky",
76267
- backgroundColor: palette.background.default,
76268
- ...column.stickyCss
76269
- } : {},
76270
- ...column.sx ? column.sx : {}
76271
- };
76256
+ return mergeSxProps(
76257
+ {
76258
+ width: `${column.width}px !important`,
76259
+ minWidth: `${column.width}px !important`,
76260
+ maxWidth: `${column.width}px !important`,
76261
+ padding: PADDING_GAP_ITEM,
76262
+ borderRadius: "0 !important",
76263
+ color: disableRow ? palette.divider : "none",
76264
+ ...column.stickyCss ? {
76265
+ position: "sticky",
76266
+ backgroundColor: palette.background.default,
76267
+ ...column.stickyCss
76268
+ } : {}
76269
+ },
76270
+ column.sx,
76271
+ column.cellSx
76272
+ );
76272
76273
  };
76273
76274
  const getStyleRow = (hasOnClick, palette, index, rowSx, indexLoadingRow) => {
76274
76275
  return {
@@ -76362,10 +76363,10 @@ function TableRowPart({
76362
76363
  TableCell,
76363
76364
  {
76364
76365
  align: column.align,
76365
- sx: {
76366
- ...getStyleCell(column, palette, disabled.DISABLED_ROW),
76367
- ...isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : {}
76368
- },
76366
+ sx: mergeSxProps(
76367
+ getStyleCell(column, palette, disabled.DISABLED_ROW),
76368
+ isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : void 0
76369
+ ),
76369
76370
  onClick: column.id === "actions" || column.id === "selectCheckbox" ? (e) => {
76370
76371
  e.stopPropagation();
76371
76372
  } : void 0,
@@ -76490,45 +76491,104 @@ const TreeToggleCell = ({
76490
76491
  const TableContainerPart = ({ children }) => {
76491
76492
  return /* @__PURE__ */ jsx(Box, { sx: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ jsx(TableContainer, { sx: { maxHeight: "100%", overflow: "auto" }, children }) });
76492
76493
  };
76493
- const TableHeadPart = ({ columns }) => {
76494
+ const GROUPED_HEADER_ROW_HEIGHT = 44;
76495
+ const toHeaderCell = (column, rowSpan) => ({
76496
+ id: column.id,
76497
+ label: column.label,
76498
+ width: column.width,
76499
+ align: column.align,
76500
+ alignHead: column.alignHead,
76501
+ sx: mergeSxProps(column.sx, column.headSx),
76502
+ stickyCss: column.stickyCss,
76503
+ rowSpan
76504
+ });
76505
+ function TableHeadPart({ columns, headerGroups }) {
76494
76506
  const { palette } = useTheme$4();
76495
- return /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: columns.map((column) => {
76507
+ const headerRows = useMemo(() => {
76508
+ var _a;
76509
+ if (!(headerGroups == null ? void 0 : headerGroups.length)) return [columns.map((column) => toHeaderCell(column))];
76510
+ const groupByColumnId = /* @__PURE__ */ new Map();
76511
+ headerGroups.forEach((group) => {
76512
+ group.columnIds.forEach((columnId) => {
76513
+ groupByColumnId.set(columnId, group);
76514
+ });
76515
+ });
76516
+ const topCells = [];
76517
+ const bottomCells = [];
76518
+ let columnIndex = 0;
76519
+ while (columnIndex < columns.length) {
76520
+ const column = columns[columnIndex];
76521
+ const group = groupByColumnId.get(column.id);
76522
+ if (!group) {
76523
+ topCells.push(toHeaderCell(column, 2));
76524
+ columnIndex += 1;
76525
+ continue;
76526
+ }
76527
+ let colSpan = 1;
76528
+ while (columnIndex + colSpan < columns.length && ((_a = groupByColumnId.get(columns[columnIndex + colSpan].id)) == null ? void 0 : _a.id) === group.id) {
76529
+ colSpan += 1;
76530
+ }
76531
+ topCells.push({
76532
+ id: `${group.id}-${columnIndex}`,
76533
+ label: group.label,
76534
+ alignHead: group.align ?? "center",
76535
+ sx: group.sx,
76536
+ colSpan
76537
+ });
76538
+ for (let subColumnIndex = 0; subColumnIndex < colSpan; subColumnIndex += 1) {
76539
+ bottomCells.push(toHeaderCell(columns[columnIndex + subColumnIndex]));
76540
+ }
76541
+ columnIndex += colSpan;
76542
+ }
76543
+ if (!bottomCells.length) return [columns.map((column) => toHeaderCell(column))];
76544
+ return [topCells, bottomCells];
76545
+ }, [columns, headerGroups]);
76546
+ const isGroupedHeader = headerRows.length > 1;
76547
+ return /* @__PURE__ */ jsx(TableHead, { children: headerRows.map((headerRow, rowIndex) => /* @__PURE__ */ jsx(TableRow, { children: headerRow.map((cell) => {
76496
76548
  var _a;
76497
76549
  return /* @__PURE__ */ jsx(
76498
76550
  TableCell,
76499
76551
  {
76500
- align: column.align,
76501
- sx: {
76502
- width: `${column.width}px !important`,
76503
- minWidth: `${column.width}px !important`,
76504
- maxWidth: `${column.width}px !important`,
76505
- fontWeight: 550,
76506
- padding: PADDING_GAP_ITEM,
76507
- borderRadius: "0 !important",
76508
- backgroundColor: "#F9FAFB",
76509
- verticalAlign: "top",
76510
- textAlign: column.alignHead ? column.alignHead : "center",
76511
- borderTop: BORDER_TABLE,
76512
- ...column.stickyCss ? {
76513
- ...column.stickyCss,
76552
+ align: cell.align,
76553
+ colSpan: cell.colSpan,
76554
+ rowSpan: cell.rowSpan,
76555
+ sx: mergeSxProps(
76556
+ {
76557
+ ...cell.width != null ? {
76558
+ width: `${cell.width}px !important`,
76559
+ minWidth: `${cell.width}px !important`,
76560
+ maxWidth: `${cell.width}px !important`
76561
+ } : {},
76562
+ height: isGroupedHeader ? GROUPED_HEADER_ROW_HEIGHT : void 0,
76563
+ fontWeight: 550,
76564
+ padding: PADDING_GAP_ITEM,
76565
+ borderRadius: "0 !important",
76566
+ backgroundColor: "#F9FAFB",
76567
+ verticalAlign: isGroupedHeader && cell.rowSpan ? "middle" : "top",
76568
+ textAlign: cell.alignHead ? cell.alignHead : "center",
76569
+ borderTop: rowIndex === 0 ? BORDER_TABLE : "none",
76570
+ top: isGroupedHeader ? rowIndex * GROUPED_HEADER_ROW_HEIGHT : 0
76571
+ },
76572
+ cell.stickyCss ? {
76573
+ ...cell.stickyCss,
76514
76574
  position: "sticky",
76515
76575
  backgroundColor: palette.background.paper,
76516
76576
  zIndex: 4,
76517
- borderRight: ((_a = column.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
76577
+ borderRight: ((_a = cell.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
76518
76578
  } : {},
76519
- ...column.sx ? column.sx : {}
76520
- },
76521
- children: /* @__PURE__ */ jsx(Typography$1, { variant: "subtitle1", children: column.label })
76579
+ cell.sx
76580
+ ),
76581
+ children: /* @__PURE__ */ jsx(Typography$1, { variant: "subtitle1", children: cell.label })
76522
76582
  },
76523
- column.id
76583
+ cell.id
76524
76584
  );
76525
- }) }) });
76526
- };
76585
+ }) }, rowIndex)) });
76586
+ }
76527
76587
  const TableBaseComponent = ({
76528
76588
  columns,
76589
+ headerGroups,
76529
76590
  rows = [],
76530
76591
  loading = false,
76531
- indexLoadingRow,
76532
76592
  stickyHeader = true,
76533
76593
  tableSx,
76534
76594
  tableRef,
@@ -76556,7 +76616,7 @@ const TableBaseComponent = ({
76556
76616
  ...Array.isArray(tableSx) ? tableSx : [tableSx]
76557
76617
  ],
76558
76618
  children: [
76559
- /* @__PURE__ */ jsx(TableHeadPart, { columns }),
76619
+ /* @__PURE__ */ jsx(TableHeadPart, { columns, headerGroups }),
76560
76620
  /* @__PURE__ */ jsx(TableBody, { children: loading ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, children: renderLoading() }) }) : rows.length ? rows.map((row, index) => /* @__PURE__ */ jsx(React__default.Fragment, { children: renderRow(row, index) }, index)) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, children: renderEmpty() }) }) })
76561
76621
  ]
76562
76622
  }
@@ -76567,6 +76627,7 @@ function TableRendererComponent({
76567
76627
  loading = false,
76568
76628
  rows,
76569
76629
  columns: initialColumns,
76630
+ headerGroups,
76570
76631
  indexLoadingRow,
76571
76632
  isStickyActions = false,
76572
76633
  rowSx = {},
@@ -76866,9 +76927,25 @@ function TableRendererComponent({
76866
76927
  render: (row, index) => /* @__PURE__ */ jsx(StackRowAlignJustCenter, { gap: 1, onClick: (e) => e.stopPropagation(), children: renderActionsContent(row, index) })
76867
76928
  });
76868
76929
  }
76869
- return updateColumns;
76930
+ if (!(headerGroups == null ? void 0 : headerGroups.length)) return updateColumns;
76931
+ const groupByColumnId = /* @__PURE__ */ new Map();
76932
+ headerGroups.forEach((group) => {
76933
+ group.columnIds.forEach((columnId) => {
76934
+ groupByColumnId.set(columnId, group);
76935
+ });
76936
+ });
76937
+ return updateColumns.map((column) => {
76938
+ const group = groupByColumnId.get(column.id);
76939
+ if (!group || !group.childrenHeadSx && !group.childrenCellSx) return column;
76940
+ return {
76941
+ ...column,
76942
+ ...group.childrenHeadSx ? { headSx: mergeSxProps(group.childrenHeadSx, column.headSx) } : {},
76943
+ ...group.childrenCellSx ? { cellSx: mergeSxProps(group.childrenCellSx, column.cellSx) } : {}
76944
+ };
76945
+ });
76870
76946
  }, [
76871
76947
  initialColumns,
76948
+ headerGroups,
76872
76949
  enableTree,
76873
76950
  onSelectRows,
76874
76951
  lengthActions,
@@ -76923,6 +77000,7 @@ function TableRendererComponent({
76923
77000
  TableBaseComponent,
76924
77001
  {
76925
77002
  columns,
77003
+ headerGroups,
76926
77004
  rows: visibleRows,
76927
77005
  loading,
76928
77006
  indexLoadingRow,
@@ -76947,7 +77025,6 @@ function TableRendererComponent({
76947
77025
  function RowCollapsePart({
76948
77026
  columns,
76949
77027
  row,
76950
- indexRow,
76951
77028
  collapse,
76952
77029
  collapseTableWidth,
76953
77030
  renderDefaultRow,
@@ -77083,6 +77160,10 @@ const tableArgTypes = {
77083
77160
  control: false,
77084
77161
  table: { type: { summary: "Column<R>[]" } }
77085
77162
  },
77163
+ headerGroups: {
77164
+ control: false,
77165
+ table: { type: { summary: "TableHeaderGroup[]" } }
77166
+ },
77086
77167
  rows: {
77087
77168
  control: false,
77088
77169
  table: { type: { summary: "R[]" } }
@@ -79193,8 +79274,10 @@ export {
79193
79274
  getPopperProps,
79194
79275
  getStyleCell,
79195
79276
  getStyleRow,
79277
+ getSxArray,
79196
79278
  highlightText,
79197
79279
  highlightYellow,
79280
+ mergeSxProps,
79198
79281
  number_util as numberUtil,
79199
79282
  object_util as objectUtil,
79200
79283
  other_util as otherUtil,