sevago-library 1.3.17 → 1.3.19
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 +141 -80
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +141 -80
- package/dist/index.esm.js.map +1 -1
- package/dist/src/common/const/apps.const.d.ts +1 -15
- 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
|
@@ -607,22 +607,6 @@ const APP_OBJ = {
|
|
|
607
607
|
group: AppGroup.MANUFACTURING,
|
|
608
608
|
color: APP_GROUP_COLOR[AppGroup.MANUFACTURING]
|
|
609
609
|
},
|
|
610
|
-
MANUFACTURING_EXECUTION_OLD: {
|
|
611
|
-
path: {
|
|
612
|
-
local: "http://localhost:12021",
|
|
613
|
-
develop: "https://dev.trackingproductionclient.sevago.local",
|
|
614
|
-
staging: "",
|
|
615
|
-
//https://sta.admin.manufacturing-execution.sevago.local
|
|
616
|
-
production: "",
|
|
617
|
-
//https://admin.manufacturing-execution.sevago.local
|
|
618
|
-
production_vps: ""
|
|
619
|
-
},
|
|
620
|
-
icon: ICONS.iconManufacturingExecution,
|
|
621
|
-
content: "Thực thi sản xuất",
|
|
622
|
-
title: "Sevago Execution",
|
|
623
|
-
group: AppGroup.MANUFACTURING,
|
|
624
|
-
color: APP_GROUP_COLOR[AppGroup.MANUFACTURING]
|
|
625
|
-
},
|
|
626
610
|
MANUFACTURING_EXECUTION: {
|
|
627
611
|
path: {
|
|
628
612
|
local: "http://localhost:12021",
|
|
@@ -634,9 +618,9 @@ const APP_OBJ = {
|
|
|
634
618
|
production_vps: ""
|
|
635
619
|
},
|
|
636
620
|
icon: ICONS.iconManufacturingExecution,
|
|
637
|
-
content: "
|
|
638
|
-
group: AppGroup.MANUFACTURING,
|
|
621
|
+
content: "Thực thi sản xuất",
|
|
639
622
|
title: "Sevago Execution",
|
|
623
|
+
group: AppGroup.MANUFACTURING,
|
|
640
624
|
color: APP_GROUP_COLOR[AppGroup.MANUFACTURING]
|
|
641
625
|
},
|
|
642
626
|
MATERIAL_CONTROL: {
|
|
@@ -708,7 +692,6 @@ const APP_BLACK_LIST = {
|
|
|
708
692
|
"PURCHASE",
|
|
709
693
|
"WAREHOUSE_MATERIAL",
|
|
710
694
|
"MANUFACTURING_PLAN",
|
|
711
|
-
"MANUFACTURING_EXECUTION_OLD",
|
|
712
695
|
"MANUFACTURING_EXECUTION",
|
|
713
696
|
"MATERIAL_CONTROL",
|
|
714
697
|
"PRODUCT_MANAGEMENT",
|
|
@@ -739,7 +722,6 @@ const APP_BLACK_LIST = {
|
|
|
739
722
|
"PURCHASE",
|
|
740
723
|
"WAREHOUSE_MATERIAL",
|
|
741
724
|
"MANUFACTURING_PLAN",
|
|
742
|
-
"MANUFACTURING_EXECUTION_OLD",
|
|
743
725
|
"MANUFACTURING_EXECUTION",
|
|
744
726
|
"MATERIAL_CONTROL",
|
|
745
727
|
"PRODUCT_MANAGEMENT",
|
|
@@ -770,7 +752,6 @@ const APP_BLACK_LIST = {
|
|
|
770
752
|
// 'PURCHASE',
|
|
771
753
|
// 'WAREHOUSE_MATERIAL',
|
|
772
754
|
// 'MANUFACTURING_PLAN',
|
|
773
|
-
// 'MANUFACTURING_EXECUTION_OLD',
|
|
774
755
|
// 'MANUFACTURING_EXECUTION',
|
|
775
756
|
// 'MATERIAL_CONTROL',
|
|
776
757
|
// 'PRODUCT_MANAGEMENT',
|
|
@@ -74687,23 +74668,11 @@ const buttonRootSx = {
|
|
|
74687
74668
|
minWidth: 100,
|
|
74688
74669
|
textTransform: "none",
|
|
74689
74670
|
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
|
-
}
|
|
74671
|
+
width: "fit-content"
|
|
74700
74672
|
};
|
|
74701
74673
|
const buttonContentSx = {
|
|
74702
74674
|
...TYPOGRAPHY.textSm.regular,
|
|
74703
|
-
whiteSpace: "nowrap"
|
|
74704
|
-
[TABLET_MEDIA]: {
|
|
74705
|
-
...TYPOGRAPHY.textMd.medium
|
|
74706
|
-
}
|
|
74675
|
+
whiteSpace: "nowrap"
|
|
74707
74676
|
};
|
|
74708
74677
|
const ButtonElement = ({
|
|
74709
74678
|
content,
|
|
@@ -76275,21 +76244,31 @@ const DISABLED_DEFAULT = Object.keys(TableActions).reduce(
|
|
|
76275
76244
|
},
|
|
76276
76245
|
{}
|
|
76277
76246
|
);
|
|
76247
|
+
const getSxArray = (sx) => {
|
|
76248
|
+
if (!sx) return [];
|
|
76249
|
+
return Array.isArray(sx) ? [...sx] : [sx];
|
|
76250
|
+
};
|
|
76251
|
+
const mergeSxProps = (...sxList) => {
|
|
76252
|
+
return sxList.flatMap((sx) => getSxArray(sx));
|
|
76253
|
+
};
|
|
76278
76254
|
const getStyleCell = (column, palette, disableRow) => {
|
|
76279
|
-
return
|
|
76280
|
-
|
|
76281
|
-
|
|
76282
|
-
|
|
76283
|
-
|
|
76284
|
-
|
|
76285
|
-
|
|
76286
|
-
|
|
76287
|
-
|
|
76288
|
-
|
|
76289
|
-
|
|
76290
|
-
|
|
76291
|
-
|
|
76292
|
-
|
|
76255
|
+
return mergeSxProps(
|
|
76256
|
+
{
|
|
76257
|
+
width: `${column.width}px !important`,
|
|
76258
|
+
minWidth: `${column.width}px !important`,
|
|
76259
|
+
maxWidth: `${column.width}px !important`,
|
|
76260
|
+
padding: PADDING_GAP_ITEM,
|
|
76261
|
+
borderRadius: "0 !important",
|
|
76262
|
+
color: disableRow ? palette.divider : "none",
|
|
76263
|
+
...column.stickyCss ? {
|
|
76264
|
+
position: "sticky",
|
|
76265
|
+
backgroundColor: palette.background.default,
|
|
76266
|
+
...column.stickyCss
|
|
76267
|
+
} : {}
|
|
76268
|
+
},
|
|
76269
|
+
column.sx,
|
|
76270
|
+
column.cellSx
|
|
76271
|
+
);
|
|
76293
76272
|
};
|
|
76294
76273
|
const getStyleRow = (hasOnClick, palette, index, rowSx, indexLoadingRow) => {
|
|
76295
76274
|
return {
|
|
@@ -76383,10 +76362,10 @@ function TableRowPart({
|
|
|
76383
76362
|
material.TableCell,
|
|
76384
76363
|
{
|
|
76385
76364
|
align: column.align,
|
|
76386
|
-
sx:
|
|
76387
|
-
|
|
76388
|
-
|
|
76389
|
-
|
|
76365
|
+
sx: mergeSxProps(
|
|
76366
|
+
getStyleCell(column, palette, disabled.DISABLED_ROW),
|
|
76367
|
+
isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : void 0
|
|
76368
|
+
),
|
|
76390
76369
|
onClick: column.id === "actions" || column.id === "selectCheckbox" ? (e) => {
|
|
76391
76370
|
e.stopPropagation();
|
|
76392
76371
|
} : void 0,
|
|
@@ -76511,45 +76490,104 @@ const TreeToggleCell = ({
|
|
|
76511
76490
|
const TableContainerPart = ({ children }) => {
|
|
76512
76491
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.TableContainer, { sx: { maxHeight: "100%", overflow: "auto" }, children }) });
|
|
76513
76492
|
};
|
|
76514
|
-
const
|
|
76493
|
+
const GROUPED_HEADER_ROW_HEIGHT = 44;
|
|
76494
|
+
const toHeaderCell = (column, rowSpan) => ({
|
|
76495
|
+
id: column.id,
|
|
76496
|
+
label: column.label,
|
|
76497
|
+
width: column.width,
|
|
76498
|
+
align: column.align,
|
|
76499
|
+
alignHead: column.alignHead,
|
|
76500
|
+
sx: mergeSxProps(column.sx, column.headSx),
|
|
76501
|
+
stickyCss: column.stickyCss,
|
|
76502
|
+
rowSpan
|
|
76503
|
+
});
|
|
76504
|
+
function TableHeadPart({ columns, headerGroups }) {
|
|
76515
76505
|
const { palette } = material.useTheme();
|
|
76516
|
-
|
|
76506
|
+
const headerRows = React.useMemo(() => {
|
|
76507
|
+
var _a;
|
|
76508
|
+
if (!(headerGroups == null ? void 0 : headerGroups.length)) return [columns.map((column) => toHeaderCell(column))];
|
|
76509
|
+
const groupByColumnId = /* @__PURE__ */ new Map();
|
|
76510
|
+
headerGroups.forEach((group) => {
|
|
76511
|
+
group.columnIds.forEach((columnId) => {
|
|
76512
|
+
groupByColumnId.set(columnId, group);
|
|
76513
|
+
});
|
|
76514
|
+
});
|
|
76515
|
+
const topCells = [];
|
|
76516
|
+
const bottomCells = [];
|
|
76517
|
+
let columnIndex = 0;
|
|
76518
|
+
while (columnIndex < columns.length) {
|
|
76519
|
+
const column = columns[columnIndex];
|
|
76520
|
+
const group = groupByColumnId.get(column.id);
|
|
76521
|
+
if (!group) {
|
|
76522
|
+
topCells.push(toHeaderCell(column, 2));
|
|
76523
|
+
columnIndex += 1;
|
|
76524
|
+
continue;
|
|
76525
|
+
}
|
|
76526
|
+
let colSpan = 1;
|
|
76527
|
+
while (columnIndex + colSpan < columns.length && ((_a = groupByColumnId.get(columns[columnIndex + colSpan].id)) == null ? void 0 : _a.id) === group.id) {
|
|
76528
|
+
colSpan += 1;
|
|
76529
|
+
}
|
|
76530
|
+
topCells.push({
|
|
76531
|
+
id: `${group.id}-${columnIndex}`,
|
|
76532
|
+
label: group.label,
|
|
76533
|
+
alignHead: group.align ?? "center",
|
|
76534
|
+
sx: group.sx,
|
|
76535
|
+
colSpan
|
|
76536
|
+
});
|
|
76537
|
+
for (let subColumnIndex = 0; subColumnIndex < colSpan; subColumnIndex += 1) {
|
|
76538
|
+
bottomCells.push(toHeaderCell(columns[columnIndex + subColumnIndex]));
|
|
76539
|
+
}
|
|
76540
|
+
columnIndex += colSpan;
|
|
76541
|
+
}
|
|
76542
|
+
if (!bottomCells.length) return [columns.map((column) => toHeaderCell(column))];
|
|
76543
|
+
return [topCells, bottomCells];
|
|
76544
|
+
}, [columns, headerGroups]);
|
|
76545
|
+
const isGroupedHeader = headerRows.length > 1;
|
|
76546
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.TableHead, { children: headerRows.map((headerRow, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(material.TableRow, { children: headerRow.map((cell) => {
|
|
76517
76547
|
var _a;
|
|
76518
76548
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
76519
76549
|
material.TableCell,
|
|
76520
76550
|
{
|
|
76521
|
-
align:
|
|
76522
|
-
|
|
76523
|
-
|
|
76524
|
-
|
|
76525
|
-
|
|
76526
|
-
|
|
76527
|
-
|
|
76528
|
-
|
|
76529
|
-
|
|
76530
|
-
|
|
76531
|
-
|
|
76532
|
-
|
|
76533
|
-
|
|
76534
|
-
|
|
76551
|
+
align: cell.align,
|
|
76552
|
+
colSpan: cell.colSpan,
|
|
76553
|
+
rowSpan: cell.rowSpan,
|
|
76554
|
+
sx: mergeSxProps(
|
|
76555
|
+
{
|
|
76556
|
+
...cell.width != null ? {
|
|
76557
|
+
width: `${cell.width}px !important`,
|
|
76558
|
+
minWidth: `${cell.width}px !important`,
|
|
76559
|
+
maxWidth: `${cell.width}px !important`
|
|
76560
|
+
} : {},
|
|
76561
|
+
height: isGroupedHeader ? GROUPED_HEADER_ROW_HEIGHT : void 0,
|
|
76562
|
+
fontWeight: 550,
|
|
76563
|
+
padding: PADDING_GAP_ITEM,
|
|
76564
|
+
borderRadius: "0 !important",
|
|
76565
|
+
backgroundColor: "#F9FAFB",
|
|
76566
|
+
verticalAlign: isGroupedHeader && cell.rowSpan ? "middle" : "top",
|
|
76567
|
+
textAlign: cell.alignHead ? cell.alignHead : "center",
|
|
76568
|
+
borderTop: rowIndex === 0 ? BORDER_TABLE : "none",
|
|
76569
|
+
top: isGroupedHeader ? rowIndex * GROUPED_HEADER_ROW_HEIGHT : 0
|
|
76570
|
+
},
|
|
76571
|
+
cell.stickyCss ? {
|
|
76572
|
+
...cell.stickyCss,
|
|
76535
76573
|
position: "sticky",
|
|
76536
76574
|
backgroundColor: palette.background.paper,
|
|
76537
76575
|
zIndex: 4,
|
|
76538
|
-
borderRight: ((_a =
|
|
76576
|
+
borderRight: ((_a = cell.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
|
|
76539
76577
|
} : {},
|
|
76540
|
-
|
|
76541
|
-
|
|
76542
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle1", children:
|
|
76578
|
+
cell.sx
|
|
76579
|
+
),
|
|
76580
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle1", children: cell.label })
|
|
76543
76581
|
},
|
|
76544
|
-
|
|
76582
|
+
cell.id
|
|
76545
76583
|
);
|
|
76546
|
-
}) }) });
|
|
76547
|
-
}
|
|
76584
|
+
}) }, rowIndex)) });
|
|
76585
|
+
}
|
|
76548
76586
|
const TableBaseComponent = ({
|
|
76549
76587
|
columns,
|
|
76588
|
+
headerGroups,
|
|
76550
76589
|
rows = [],
|
|
76551
76590
|
loading = false,
|
|
76552
|
-
indexLoadingRow,
|
|
76553
76591
|
stickyHeader = true,
|
|
76554
76592
|
tableSx,
|
|
76555
76593
|
tableRef,
|
|
@@ -76577,7 +76615,7 @@ const TableBaseComponent = ({
|
|
|
76577
76615
|
...Array.isArray(tableSx) ? tableSx : [tableSx]
|
|
76578
76616
|
],
|
|
76579
76617
|
children: [
|
|
76580
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns }),
|
|
76618
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeadPart, { columns, headerGroups }),
|
|
76581
76619
|
/* @__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
76620
|
]
|
|
76583
76621
|
}
|
|
@@ -76588,6 +76626,7 @@ function TableRendererComponent({
|
|
|
76588
76626
|
loading = false,
|
|
76589
76627
|
rows,
|
|
76590
76628
|
columns: initialColumns,
|
|
76629
|
+
headerGroups,
|
|
76591
76630
|
indexLoadingRow,
|
|
76592
76631
|
isStickyActions = false,
|
|
76593
76632
|
rowSx = {},
|
|
@@ -76887,9 +76926,25 @@ function TableRendererComponent({
|
|
|
76887
76926
|
render: (row, index) => /* @__PURE__ */ jsxRuntime.jsx(StackRowAlignJustCenter, { gap: 1, onClick: (e) => e.stopPropagation(), children: renderActionsContent(row, index) })
|
|
76888
76927
|
});
|
|
76889
76928
|
}
|
|
76890
|
-
return updateColumns;
|
|
76929
|
+
if (!(headerGroups == null ? void 0 : headerGroups.length)) return updateColumns;
|
|
76930
|
+
const groupByColumnId = /* @__PURE__ */ new Map();
|
|
76931
|
+
headerGroups.forEach((group) => {
|
|
76932
|
+
group.columnIds.forEach((columnId) => {
|
|
76933
|
+
groupByColumnId.set(columnId, group);
|
|
76934
|
+
});
|
|
76935
|
+
});
|
|
76936
|
+
return updateColumns.map((column) => {
|
|
76937
|
+
const group = groupByColumnId.get(column.id);
|
|
76938
|
+
if (!group || !group.childrenHeadSx && !group.childrenCellSx) return column;
|
|
76939
|
+
return {
|
|
76940
|
+
...column,
|
|
76941
|
+
...group.childrenHeadSx ? { headSx: mergeSxProps(group.childrenHeadSx, column.headSx) } : {},
|
|
76942
|
+
...group.childrenCellSx ? { cellSx: mergeSxProps(group.childrenCellSx, column.cellSx) } : {}
|
|
76943
|
+
};
|
|
76944
|
+
});
|
|
76891
76945
|
}, [
|
|
76892
76946
|
initialColumns,
|
|
76947
|
+
headerGroups,
|
|
76893
76948
|
enableTree,
|
|
76894
76949
|
onSelectRows,
|
|
76895
76950
|
lengthActions,
|
|
@@ -76944,6 +76999,7 @@ function TableRendererComponent({
|
|
|
76944
76999
|
TableBaseComponent,
|
|
76945
77000
|
{
|
|
76946
77001
|
columns,
|
|
77002
|
+
headerGroups,
|
|
76947
77003
|
rows: visibleRows,
|
|
76948
77004
|
loading,
|
|
76949
77005
|
indexLoadingRow,
|
|
@@ -76968,7 +77024,6 @@ function TableRendererComponent({
|
|
|
76968
77024
|
function RowCollapsePart({
|
|
76969
77025
|
columns,
|
|
76970
77026
|
row,
|
|
76971
|
-
indexRow,
|
|
76972
77027
|
collapse,
|
|
76973
77028
|
collapseTableWidth,
|
|
76974
77029
|
renderDefaultRow,
|
|
@@ -77104,6 +77159,10 @@ const tableArgTypes = {
|
|
|
77104
77159
|
control: false,
|
|
77105
77160
|
table: { type: { summary: "Column<R>[]" } }
|
|
77106
77161
|
},
|
|
77162
|
+
headerGroups: {
|
|
77163
|
+
control: false,
|
|
77164
|
+
table: { type: { summary: "TableHeaderGroup[]" } }
|
|
77165
|
+
},
|
|
77107
77166
|
rows: {
|
|
77108
77167
|
control: false,
|
|
77109
77168
|
table: { type: { summary: "R[]" } }
|
|
@@ -79213,8 +79272,10 @@ exports.getPickerSx = getPickerSx;
|
|
|
79213
79272
|
exports.getPopperProps = getPopperProps;
|
|
79214
79273
|
exports.getStyleCell = getStyleCell;
|
|
79215
79274
|
exports.getStyleRow = getStyleRow;
|
|
79275
|
+
exports.getSxArray = getSxArray;
|
|
79216
79276
|
exports.highlightText = highlightText;
|
|
79217
79277
|
exports.highlightYellow = highlightYellow;
|
|
79278
|
+
exports.mergeSxProps = mergeSxProps;
|
|
79218
79279
|
exports.numberUtil = number_util;
|
|
79219
79280
|
exports.objectUtil = object_util;
|
|
79220
79281
|
exports.otherUtil = other_util;
|