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/CHANGELOG.md +12 -0
- package/dist/index.cjs.js +143 -60
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +143 -60
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/elements/table/part/row-collapse.part.d.ts +1 -1
- package/dist/src/components/elements/table/part/table-head.part.d.ts +3 -4
- package/dist/src/components/elements/table/table-base.component.d.ts +3 -2
- package/dist/src/components/elements/table/table-renderer.component.d.ts +1 -1
- package/dist/src/components/elements/table/table.component.d.ts +1 -1
- package/dist/src/components/elements/table/table.component.stories.d.ts +16 -0
- package/dist/src/components/elements/table/table.constant.d.ts +2 -0
- package/dist/src/components/elements/table/table.interface.d.ts +18 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -33435,7 +33435,10 @@ const TypographyGridInfoRow = ({
|
|
|
33435
33435
|
...sx
|
|
33436
33436
|
},
|
|
33437
33437
|
children: [
|
|
33438
|
-
/* @__PURE__ */ jsxRuntime.
|
|
33438
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { sx: { ...TYPOGRAPHY.textSm.regular, color: GRAY[500], ...sxLabel }, children: [
|
|
33439
|
+
label,
|
|
33440
|
+
":"
|
|
33441
|
+
] }),
|
|
33439
33442
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
33440
33443
|
material.Typography,
|
|
33441
33444
|
{
|
|
@@ -74684,23 +74687,11 @@ const buttonRootSx = {
|
|
|
74684
74687
|
minWidth: 100,
|
|
74685
74688
|
textTransform: "none",
|
|
74686
74689
|
borderRadius: BORDER_RADIUS_ELEMENT_SMALL,
|
|
74687
|
-
width: "fit-content"
|
|
74688
|
-
[TABLET_MEDIA]: {
|
|
74689
|
-
minWidth: 120,
|
|
74690
|
-
minHeight: 44,
|
|
74691
|
-
px: 2.5,
|
|
74692
|
-
py: 1,
|
|
74693
|
-
"& .MuiButton-startIcon .material-symbols-rounded, & .MuiButton-endIcon .material-symbols-rounded": {
|
|
74694
|
-
fontSize: 22
|
|
74695
|
-
}
|
|
74696
|
-
}
|
|
74690
|
+
width: "fit-content"
|
|
74697
74691
|
};
|
|
74698
74692
|
const buttonContentSx = {
|
|
74699
74693
|
...TYPOGRAPHY.textSm.regular,
|
|
74700
|
-
whiteSpace: "nowrap"
|
|
74701
|
-
[TABLET_MEDIA]: {
|
|
74702
|
-
...TYPOGRAPHY.textMd.medium
|
|
74703
|
-
}
|
|
74694
|
+
whiteSpace: "nowrap"
|
|
74704
74695
|
};
|
|
74705
74696
|
const ButtonElement = ({
|
|
74706
74697
|
content,
|
|
@@ -76272,21 +76263,31 @@ const DISABLED_DEFAULT = Object.keys(TableActions).reduce(
|
|
|
76272
76263
|
},
|
|
76273
76264
|
{}
|
|
76274
76265
|
);
|
|
76266
|
+
const getSxArray = (sx) => {
|
|
76267
|
+
if (!sx) return [];
|
|
76268
|
+
return Array.isArray(sx) ? [...sx] : [sx];
|
|
76269
|
+
};
|
|
76270
|
+
const mergeSxProps = (...sxList) => {
|
|
76271
|
+
return sxList.flatMap((sx) => getSxArray(sx));
|
|
76272
|
+
};
|
|
76275
76273
|
const getStyleCell = (column, palette, disableRow) => {
|
|
76276
|
-
return
|
|
76277
|
-
|
|
76278
|
-
|
|
76279
|
-
|
|
76280
|
-
|
|
76281
|
-
|
|
76282
|
-
|
|
76283
|
-
|
|
76284
|
-
|
|
76285
|
-
|
|
76286
|
-
|
|
76287
|
-
|
|
76288
|
-
|
|
76289
|
-
|
|
76274
|
+
return mergeSxProps(
|
|
76275
|
+
{
|
|
76276
|
+
width: `${column.width}px !important`,
|
|
76277
|
+
minWidth: `${column.width}px !important`,
|
|
76278
|
+
maxWidth: `${column.width}px !important`,
|
|
76279
|
+
padding: PADDING_GAP_ITEM,
|
|
76280
|
+
borderRadius: "0 !important",
|
|
76281
|
+
color: disableRow ? palette.divider : "none",
|
|
76282
|
+
...column.stickyCss ? {
|
|
76283
|
+
position: "sticky",
|
|
76284
|
+
backgroundColor: palette.background.default,
|
|
76285
|
+
...column.stickyCss
|
|
76286
|
+
} : {}
|
|
76287
|
+
},
|
|
76288
|
+
column.sx,
|
|
76289
|
+
column.cellSx
|
|
76290
|
+
);
|
|
76290
76291
|
};
|
|
76291
76292
|
const getStyleRow = (hasOnClick, palette, index, rowSx, indexLoadingRow) => {
|
|
76292
76293
|
return {
|
|
@@ -76380,10 +76381,10 @@ function TableRowPart({
|
|
|
76380
76381
|
material.TableCell,
|
|
76381
76382
|
{
|
|
76382
76383
|
align: column.align,
|
|
76383
|
-
sx:
|
|
76384
|
-
|
|
76385
|
-
|
|
76386
|
-
|
|
76384
|
+
sx: mergeSxProps(
|
|
76385
|
+
getStyleCell(column, palette, disabled.DISABLED_ROW),
|
|
76386
|
+
isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : void 0
|
|
76387
|
+
),
|
|
76387
76388
|
onClick: column.id === "actions" || column.id === "selectCheckbox" ? (e) => {
|
|
76388
76389
|
e.stopPropagation();
|
|
76389
76390
|
} : void 0,
|
|
@@ -76508,45 +76509,104 @@ const TreeToggleCell = ({
|
|
|
76508
76509
|
const TableContainerPart = ({ children }) => {
|
|
76509
76510
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.TableContainer, { sx: { maxHeight: "100%", overflow: "auto" }, children }) });
|
|
76510
76511
|
};
|
|
76511
|
-
const
|
|
76512
|
+
const GROUPED_HEADER_ROW_HEIGHT = 44;
|
|
76513
|
+
const toHeaderCell = (column, rowSpan) => ({
|
|
76514
|
+
id: column.id,
|
|
76515
|
+
label: column.label,
|
|
76516
|
+
width: column.width,
|
|
76517
|
+
align: column.align,
|
|
76518
|
+
alignHead: column.alignHead,
|
|
76519
|
+
sx: mergeSxProps(column.sx, column.headSx),
|
|
76520
|
+
stickyCss: column.stickyCss,
|
|
76521
|
+
rowSpan
|
|
76522
|
+
});
|
|
76523
|
+
function TableHeadPart({ columns, headerGroups }) {
|
|
76512
76524
|
const { palette } = material.useTheme();
|
|
76513
|
-
|
|
76525
|
+
const headerRows = React.useMemo(() => {
|
|
76526
|
+
var _a;
|
|
76527
|
+
if (!(headerGroups == null ? void 0 : headerGroups.length)) return [columns.map((column) => toHeaderCell(column))];
|
|
76528
|
+
const groupByColumnId = /* @__PURE__ */ new Map();
|
|
76529
|
+
headerGroups.forEach((group) => {
|
|
76530
|
+
group.columnIds.forEach((columnId) => {
|
|
76531
|
+
groupByColumnId.set(columnId, group);
|
|
76532
|
+
});
|
|
76533
|
+
});
|
|
76534
|
+
const topCells = [];
|
|
76535
|
+
const bottomCells = [];
|
|
76536
|
+
let columnIndex = 0;
|
|
76537
|
+
while (columnIndex < columns.length) {
|
|
76538
|
+
const column = columns[columnIndex];
|
|
76539
|
+
const group = groupByColumnId.get(column.id);
|
|
76540
|
+
if (!group) {
|
|
76541
|
+
topCells.push(toHeaderCell(column, 2));
|
|
76542
|
+
columnIndex += 1;
|
|
76543
|
+
continue;
|
|
76544
|
+
}
|
|
76545
|
+
let colSpan = 1;
|
|
76546
|
+
while (columnIndex + colSpan < columns.length && ((_a = groupByColumnId.get(columns[columnIndex + colSpan].id)) == null ? void 0 : _a.id) === group.id) {
|
|
76547
|
+
colSpan += 1;
|
|
76548
|
+
}
|
|
76549
|
+
topCells.push({
|
|
76550
|
+
id: `${group.id}-${columnIndex}`,
|
|
76551
|
+
label: group.label,
|
|
76552
|
+
alignHead: group.align ?? "center",
|
|
76553
|
+
sx: group.sx,
|
|
76554
|
+
colSpan
|
|
76555
|
+
});
|
|
76556
|
+
for (let subColumnIndex = 0; subColumnIndex < colSpan; subColumnIndex += 1) {
|
|
76557
|
+
bottomCells.push(toHeaderCell(columns[columnIndex + subColumnIndex]));
|
|
76558
|
+
}
|
|
76559
|
+
columnIndex += colSpan;
|
|
76560
|
+
}
|
|
76561
|
+
if (!bottomCells.length) return [columns.map((column) => toHeaderCell(column))];
|
|
76562
|
+
return [topCells, bottomCells];
|
|
76563
|
+
}, [columns, headerGroups]);
|
|
76564
|
+
const isGroupedHeader = headerRows.length > 1;
|
|
76565
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.TableHead, { children: headerRows.map((headerRow, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: headerRow.map((cell) => {
|
|
76514
76566
|
var _a;
|
|
76515
76567
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
76516
76568
|
material.TableCell,
|
|
76517
76569
|
{
|
|
76518
|
-
align:
|
|
76519
|
-
|
|
76520
|
-
|
|
76521
|
-
|
|
76522
|
-
|
|
76523
|
-
|
|
76524
|
-
|
|
76525
|
-
|
|
76526
|
-
|
|
76527
|
-
|
|
76528
|
-
|
|
76529
|
-
|
|
76530
|
-
|
|
76531
|
-
|
|
76570
|
+
align: cell.align,
|
|
76571
|
+
colSpan: cell.colSpan,
|
|
76572
|
+
rowSpan: cell.rowSpan,
|
|
76573
|
+
sx: mergeSxProps(
|
|
76574
|
+
{
|
|
76575
|
+
...cell.width != null ? {
|
|
76576
|
+
width: `${cell.width}px !important`,
|
|
76577
|
+
minWidth: `${cell.width}px !important`,
|
|
76578
|
+
maxWidth: `${cell.width}px !important`
|
|
76579
|
+
} : {},
|
|
76580
|
+
height: isGroupedHeader ? GROUPED_HEADER_ROW_HEIGHT : void 0,
|
|
76581
|
+
fontWeight: 550,
|
|
76582
|
+
padding: PADDING_GAP_ITEM,
|
|
76583
|
+
borderRadius: "0 !important",
|
|
76584
|
+
backgroundColor: "#F9FAFB",
|
|
76585
|
+
verticalAlign: isGroupedHeader && cell.rowSpan ? "middle" : "top",
|
|
76586
|
+
textAlign: cell.alignHead ? cell.alignHead : "center",
|
|
76587
|
+
borderTop: rowIndex === 0 ? BORDER_TABLE : "none",
|
|
76588
|
+
top: isGroupedHeader ? rowIndex * GROUPED_HEADER_ROW_HEIGHT : 0
|
|
76589
|
+
},
|
|
76590
|
+
cell.stickyCss ? {
|
|
76591
|
+
...cell.stickyCss,
|
|
76532
76592
|
position: "sticky",
|
|
76533
76593
|
backgroundColor: palette.background.paper,
|
|
76534
76594
|
zIndex: 4,
|
|
76535
|
-
borderRight: ((_a =
|
|
76595
|
+
borderRight: ((_a = cell.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
|
|
76536
76596
|
} : {},
|
|
76537
|
-
|
|
76538
|
-
|
|
76539
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle1", children:
|
|
76597
|
+
cell.sx
|
|
76598
|
+
),
|
|
76599
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle1", children: cell.label })
|
|
76540
76600
|
},
|
|
76541
|
-
|
|
76601
|
+
cell.id
|
|
76542
76602
|
);
|
|
76543
|
-
}) }) });
|
|
76544
|
-
}
|
|
76603
|
+
}) }, rowIndex)) });
|
|
76604
|
+
}
|
|
76545
76605
|
const TableBaseComponent = ({
|
|
76546
76606
|
columns,
|
|
76607
|
+
headerGroups,
|
|
76547
76608
|
rows = [],
|
|
76548
76609
|
loading = false,
|
|
76549
|
-
indexLoadingRow,
|
|
76550
76610
|
stickyHeader = true,
|
|
76551
76611
|
tableSx,
|
|
76552
76612
|
tableRef,
|
|
@@ -76574,7 +76634,7 @@ const TableBaseComponent = ({
|
|
|
76574
76634
|
...Array.isArray(tableSx) ? tableSx : [tableSx]
|
|
76575
76635
|
],
|
|
76576
76636
|
children: [
|
|
76577
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns }),
|
|
76637
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns, headerGroups }),
|
|
76578
76638
|
/* @__PURE__ */ jsxRuntime.jsx(material.TableBody, { children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableCell, { colSpan: columns.length, children: renderLoading() }) }) : rows.length ? rows.map((row, index) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: renderRow(row, index) }, index)) : /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(material.TableCell, { colSpan: columns.length, children: renderEmpty() }) }) })
|
|
76579
76639
|
]
|
|
76580
76640
|
}
|
|
@@ -76585,6 +76645,7 @@ function TableRendererComponent({
|
|
|
76585
76645
|
loading = false,
|
|
76586
76646
|
rows,
|
|
76587
76647
|
columns: initialColumns,
|
|
76648
|
+
headerGroups,
|
|
76588
76649
|
indexLoadingRow,
|
|
76589
76650
|
isStickyActions = false,
|
|
76590
76651
|
rowSx = {},
|
|
@@ -76884,9 +76945,25 @@ function TableRendererComponent({
|
|
|
76884
76945
|
render: (row, index) => /* @__PURE__ */ jsxRuntime.jsx(StackRowAlignJustCenter, { gap: 1, onClick: (e) => e.stopPropagation(), children: renderActionsContent(row, index) })
|
|
76885
76946
|
});
|
|
76886
76947
|
}
|
|
76887
|
-
return updateColumns;
|
|
76948
|
+
if (!(headerGroups == null ? void 0 : headerGroups.length)) return updateColumns;
|
|
76949
|
+
const groupByColumnId = /* @__PURE__ */ new Map();
|
|
76950
|
+
headerGroups.forEach((group) => {
|
|
76951
|
+
group.columnIds.forEach((columnId) => {
|
|
76952
|
+
groupByColumnId.set(columnId, group);
|
|
76953
|
+
});
|
|
76954
|
+
});
|
|
76955
|
+
return updateColumns.map((column) => {
|
|
76956
|
+
const group = groupByColumnId.get(column.id);
|
|
76957
|
+
if (!group || !group.childrenHeadSx && !group.childrenCellSx) return column;
|
|
76958
|
+
return {
|
|
76959
|
+
...column,
|
|
76960
|
+
...group.childrenHeadSx ? { headSx: mergeSxProps(group.childrenHeadSx, column.headSx) } : {},
|
|
76961
|
+
...group.childrenCellSx ? { cellSx: mergeSxProps(group.childrenCellSx, column.cellSx) } : {}
|
|
76962
|
+
};
|
|
76963
|
+
});
|
|
76888
76964
|
}, [
|
|
76889
76965
|
initialColumns,
|
|
76966
|
+
headerGroups,
|
|
76890
76967
|
enableTree,
|
|
76891
76968
|
onSelectRows,
|
|
76892
76969
|
lengthActions,
|
|
@@ -76941,6 +77018,7 @@ function TableRendererComponent({
|
|
|
76941
77018
|
TableBaseComponent,
|
|
76942
77019
|
{
|
|
76943
77020
|
columns,
|
|
77021
|
+
headerGroups,
|
|
76944
77022
|
rows: visibleRows,
|
|
76945
77023
|
loading,
|
|
76946
77024
|
indexLoadingRow,
|
|
@@ -76965,7 +77043,6 @@ function TableRendererComponent({
|
|
|
76965
77043
|
function RowCollapsePart({
|
|
76966
77044
|
columns,
|
|
76967
77045
|
row,
|
|
76968
|
-
indexRow,
|
|
76969
77046
|
collapse,
|
|
76970
77047
|
collapseTableWidth,
|
|
76971
77048
|
renderDefaultRow,
|
|
@@ -77101,6 +77178,10 @@ const tableArgTypes = {
|
|
|
77101
77178
|
control: false,
|
|
77102
77179
|
table: { type: { summary: "Column<R>[]" } }
|
|
77103
77180
|
},
|
|
77181
|
+
headerGroups: {
|
|
77182
|
+
control: false,
|
|
77183
|
+
table: { type: { summary: "TableHeaderGroup[]" } }
|
|
77184
|
+
},
|
|
77104
77185
|
rows: {
|
|
77105
77186
|
control: false,
|
|
77106
77187
|
table: { type: { summary: "R[]" } }
|
|
@@ -79210,8 +79291,10 @@ exports.getPickerSx = getPickerSx;
|
|
|
79210
79291
|
exports.getPopperProps = getPopperProps;
|
|
79211
79292
|
exports.getStyleCell = getStyleCell;
|
|
79212
79293
|
exports.getStyleRow = getStyleRow;
|
|
79294
|
+
exports.getSxArray = getSxArray;
|
|
79213
79295
|
exports.highlightText = highlightText;
|
|
79214
79296
|
exports.highlightYellow = highlightYellow;
|
|
79297
|
+
exports.mergeSxProps = mergeSxProps;
|
|
79215
79298
|
exports.numberUtil = number_util;
|
|
79216
79299
|
exports.objectUtil = object_util;
|
|
79217
79300
|
exports.otherUtil = other_util;
|