sevago-library 1.3.17 → 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 +6 -0
- package/dist/index.cjs.js +139 -59
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +139 -59
- 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
|
@@ -74687,23 +74687,11 @@ const buttonRootSx = {
|
|
|
74687
74687
|
minWidth: 100,
|
|
74688
74688
|
textTransform: "none",
|
|
74689
74689
|
borderRadius: BORDER_RADIUS_ELEMENT_SMALL,
|
|
74690
|
-
width: "fit-content"
|
|
74691
|
-
[TABLET_MEDIA]: {
|
|
74692
|
-
minWidth: 120,
|
|
74693
|
-
minHeight: 44,
|
|
74694
|
-
px: 2.5,
|
|
74695
|
-
py: 1,
|
|
74696
|
-
"& .MuiButton-startIcon .material-symbols-rounded, & .MuiButton-endIcon .material-symbols-rounded": {
|
|
74697
|
-
fontSize: 22
|
|
74698
|
-
}
|
|
74699
|
-
}
|
|
74690
|
+
width: "fit-content"
|
|
74700
74691
|
};
|
|
74701
74692
|
const buttonContentSx = {
|
|
74702
74693
|
...TYPOGRAPHY.textSm.regular,
|
|
74703
|
-
whiteSpace: "nowrap"
|
|
74704
|
-
[TABLET_MEDIA]: {
|
|
74705
|
-
...TYPOGRAPHY.textMd.medium
|
|
74706
|
-
}
|
|
74694
|
+
whiteSpace: "nowrap"
|
|
74707
74695
|
};
|
|
74708
74696
|
const ButtonElement = ({
|
|
74709
74697
|
content,
|
|
@@ -76275,21 +76263,31 @@ const DISABLED_DEFAULT = Object.keys(TableActions).reduce(
|
|
|
76275
76263
|
},
|
|
76276
76264
|
{}
|
|
76277
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
|
+
};
|
|
76278
76273
|
const getStyleCell = (column, palette, disableRow) => {
|
|
76279
|
-
return
|
|
76280
|
-
|
|
76281
|
-
|
|
76282
|
-
|
|
76283
|
-
|
|
76284
|
-
|
|
76285
|
-
|
|
76286
|
-
|
|
76287
|
-
|
|
76288
|
-
|
|
76289
|
-
|
|
76290
|
-
|
|
76291
|
-
|
|
76292
|
-
|
|
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
|
+
);
|
|
76293
76291
|
};
|
|
76294
76292
|
const getStyleRow = (hasOnClick, palette, index, rowSx, indexLoadingRow) => {
|
|
76295
76293
|
return {
|
|
@@ -76383,10 +76381,10 @@ function TableRowPart({
|
|
|
76383
76381
|
material.TableCell,
|
|
76384
76382
|
{
|
|
76385
76383
|
align: column.align,
|
|
76386
|
-
sx:
|
|
76387
|
-
|
|
76388
|
-
|
|
76389
|
-
|
|
76384
|
+
sx: mergeSxProps(
|
|
76385
|
+
getStyleCell(column, palette, disabled.DISABLED_ROW),
|
|
76386
|
+
isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : void 0
|
|
76387
|
+
),
|
|
76390
76388
|
onClick: column.id === "actions" || column.id === "selectCheckbox" ? (e) => {
|
|
76391
76389
|
e.stopPropagation();
|
|
76392
76390
|
} : void 0,
|
|
@@ -76511,45 +76509,104 @@ const TreeToggleCell = ({
|
|
|
76511
76509
|
const TableContainerPart = ({ children }) => {
|
|
76512
76510
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.TableContainer, { sx: { maxHeight: "100%", overflow: "auto" }, children }) });
|
|
76513
76511
|
};
|
|
76514
|
-
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 }) {
|
|
76515
76524
|
const { palette } = material.useTheme();
|
|
76516
|
-
|
|
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) => {
|
|
76517
76566
|
var _a;
|
|
76518
76567
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
76519
76568
|
material.TableCell,
|
|
76520
76569
|
{
|
|
76521
|
-
align:
|
|
76522
|
-
|
|
76523
|
-
|
|
76524
|
-
|
|
76525
|
-
|
|
76526
|
-
|
|
76527
|
-
|
|
76528
|
-
|
|
76529
|
-
|
|
76530
|
-
|
|
76531
|
-
|
|
76532
|
-
|
|
76533
|
-
|
|
76534
|
-
|
|
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,
|
|
76535
76592
|
position: "sticky",
|
|
76536
76593
|
backgroundColor: palette.background.paper,
|
|
76537
76594
|
zIndex: 4,
|
|
76538
|
-
borderRight: ((_a =
|
|
76595
|
+
borderRight: ((_a = cell.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
|
|
76539
76596
|
} : {},
|
|
76540
|
-
|
|
76541
|
-
|
|
76542
|
-
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 })
|
|
76543
76600
|
},
|
|
76544
|
-
|
|
76601
|
+
cell.id
|
|
76545
76602
|
);
|
|
76546
|
-
}) }) });
|
|
76547
|
-
}
|
|
76603
|
+
}) }, rowIndex)) });
|
|
76604
|
+
}
|
|
76548
76605
|
const TableBaseComponent = ({
|
|
76549
76606
|
columns,
|
|
76607
|
+
headerGroups,
|
|
76550
76608
|
rows = [],
|
|
76551
76609
|
loading = false,
|
|
76552
|
-
indexLoadingRow,
|
|
76553
76610
|
stickyHeader = true,
|
|
76554
76611
|
tableSx,
|
|
76555
76612
|
tableRef,
|
|
@@ -76577,7 +76634,7 @@ const TableBaseComponent = ({
|
|
|
76577
76634
|
...Array.isArray(tableSx) ? tableSx : [tableSx]
|
|
76578
76635
|
],
|
|
76579
76636
|
children: [
|
|
76580
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns }),
|
|
76637
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns, headerGroups }),
|
|
76581
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() }) }) })
|
|
76582
76639
|
]
|
|
76583
76640
|
}
|
|
@@ -76588,6 +76645,7 @@ function TableRendererComponent({
|
|
|
76588
76645
|
loading = false,
|
|
76589
76646
|
rows,
|
|
76590
76647
|
columns: initialColumns,
|
|
76648
|
+
headerGroups,
|
|
76591
76649
|
indexLoadingRow,
|
|
76592
76650
|
isStickyActions = false,
|
|
76593
76651
|
rowSx = {},
|
|
@@ -76887,9 +76945,25 @@ function TableRendererComponent({
|
|
|
76887
76945
|
render: (row, index) => /* @__PURE__ */ jsxRuntime.jsx(StackRowAlignJustCenter, { gap: 1, onClick: (e) => e.stopPropagation(), children: renderActionsContent(row, index) })
|
|
76888
76946
|
});
|
|
76889
76947
|
}
|
|
76890
|
-
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
|
+
});
|
|
76891
76964
|
}, [
|
|
76892
76965
|
initialColumns,
|
|
76966
|
+
headerGroups,
|
|
76893
76967
|
enableTree,
|
|
76894
76968
|
onSelectRows,
|
|
76895
76969
|
lengthActions,
|
|
@@ -76944,6 +77018,7 @@ function TableRendererComponent({
|
|
|
76944
77018
|
TableBaseComponent,
|
|
76945
77019
|
{
|
|
76946
77020
|
columns,
|
|
77021
|
+
headerGroups,
|
|
76947
77022
|
rows: visibleRows,
|
|
76948
77023
|
loading,
|
|
76949
77024
|
indexLoadingRow,
|
|
@@ -76968,7 +77043,6 @@ function TableRendererComponent({
|
|
|
76968
77043
|
function RowCollapsePart({
|
|
76969
77044
|
columns,
|
|
76970
77045
|
row,
|
|
76971
|
-
indexRow,
|
|
76972
77046
|
collapse,
|
|
76973
77047
|
collapseTableWidth,
|
|
76974
77048
|
renderDefaultRow,
|
|
@@ -77104,6 +77178,10 @@ const tableArgTypes = {
|
|
|
77104
77178
|
control: false,
|
|
77105
77179
|
table: { type: { summary: "Column<R>[]" } }
|
|
77106
77180
|
},
|
|
77181
|
+
headerGroups: {
|
|
77182
|
+
control: false,
|
|
77183
|
+
table: { type: { summary: "TableHeaderGroup[]" } }
|
|
77184
|
+
},
|
|
77107
77185
|
rows: {
|
|
77108
77186
|
control: false,
|
|
77109
77187
|
table: { type: { summary: "R[]" } }
|
|
@@ -79213,8 +79291,10 @@ exports.getPickerSx = getPickerSx;
|
|
|
79213
79291
|
exports.getPopperProps = getPopperProps;
|
|
79214
79292
|
exports.getStyleCell = getStyleCell;
|
|
79215
79293
|
exports.getStyleRow = getStyleRow;
|
|
79294
|
+
exports.getSxArray = getSxArray;
|
|
79216
79295
|
exports.highlightText = highlightText;
|
|
79217
79296
|
exports.highlightYellow = highlightYellow;
|
|
79297
|
+
exports.mergeSxProps = mergeSxProps;
|
|
79218
79298
|
exports.numberUtil = number_util;
|
|
79219
79299
|
exports.objectUtil = object_util;
|
|
79220
79300
|
exports.otherUtil = other_util;
|