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/dist/index.esm.js CHANGED
@@ -589,22 +589,6 @@ const APP_OBJ = {
589
589
  group: AppGroup.MANUFACTURING,
590
590
  color: APP_GROUP_COLOR[AppGroup.MANUFACTURING]
591
591
  },
592
- MANUFACTURING_EXECUTION_OLD: {
593
- path: {
594
- local: "http://localhost:12021",
595
- develop: "https://dev.trackingproductionclient.sevago.local",
596
- staging: "",
597
- //https://sta.admin.manufacturing-execution.sevago.local
598
- production: "",
599
- //https://admin.manufacturing-execution.sevago.local
600
- production_vps: ""
601
- },
602
- icon: ICONS.iconManufacturingExecution,
603
- content: "Thực thi sản xuất",
604
- title: "Sevago Execution",
605
- group: AppGroup.MANUFACTURING,
606
- color: APP_GROUP_COLOR[AppGroup.MANUFACTURING]
607
- },
608
592
  MANUFACTURING_EXECUTION: {
609
593
  path: {
610
594
  local: "http://localhost:12021",
@@ -616,9 +600,9 @@ const APP_OBJ = {
616
600
  production_vps: ""
617
601
  },
618
602
  icon: ICONS.iconManufacturingExecution,
619
- content: "ME",
620
- group: AppGroup.MANUFACTURING,
603
+ content: "Thực thi sản xuất",
621
604
  title: "Sevago Execution",
605
+ group: AppGroup.MANUFACTURING,
622
606
  color: APP_GROUP_COLOR[AppGroup.MANUFACTURING]
623
607
  },
624
608
  MATERIAL_CONTROL: {
@@ -690,7 +674,6 @@ const APP_BLACK_LIST = {
690
674
  "PURCHASE",
691
675
  "WAREHOUSE_MATERIAL",
692
676
  "MANUFACTURING_PLAN",
693
- "MANUFACTURING_EXECUTION_OLD",
694
677
  "MANUFACTURING_EXECUTION",
695
678
  "MATERIAL_CONTROL",
696
679
  "PRODUCT_MANAGEMENT",
@@ -721,7 +704,6 @@ const APP_BLACK_LIST = {
721
704
  "PURCHASE",
722
705
  "WAREHOUSE_MATERIAL",
723
706
  "MANUFACTURING_PLAN",
724
- "MANUFACTURING_EXECUTION_OLD",
725
707
  "MANUFACTURING_EXECUTION",
726
708
  "MATERIAL_CONTROL",
727
709
  "PRODUCT_MANAGEMENT",
@@ -752,7 +734,6 @@ const APP_BLACK_LIST = {
752
734
  // 'PURCHASE',
753
735
  // 'WAREHOUSE_MATERIAL',
754
736
  // 'MANUFACTURING_PLAN',
755
- // 'MANUFACTURING_EXECUTION_OLD',
756
737
  // 'MANUFACTURING_EXECUTION',
757
738
  // 'MATERIAL_CONTROL',
758
739
  // 'PRODUCT_MANAGEMENT',
@@ -74669,23 +74650,11 @@ const buttonRootSx = {
74669
74650
  minWidth: 100,
74670
74651
  textTransform: "none",
74671
74652
  borderRadius: BORDER_RADIUS_ELEMENT_SMALL,
74672
- width: "fit-content",
74673
- [TABLET_MEDIA]: {
74674
- minWidth: 120,
74675
- minHeight: 44,
74676
- px: 2.5,
74677
- py: 1,
74678
- "& .MuiButton-startIcon .material-symbols-rounded, & .MuiButton-endIcon .material-symbols-rounded": {
74679
- fontSize: 22
74680
- }
74681
- }
74653
+ width: "fit-content"
74682
74654
  };
74683
74655
  const buttonContentSx = {
74684
74656
  ...TYPOGRAPHY.textSm.regular,
74685
- whiteSpace: "nowrap",
74686
- [TABLET_MEDIA]: {
74687
- ...TYPOGRAPHY.textMd.medium
74688
- }
74657
+ whiteSpace: "nowrap"
74689
74658
  };
74690
74659
  const ButtonElement = ({
74691
74660
  content,
@@ -76257,21 +76226,31 @@ const DISABLED_DEFAULT = Object.keys(TableActions).reduce(
76257
76226
  },
76258
76227
  {}
76259
76228
  );
76229
+ const getSxArray = (sx) => {
76230
+ if (!sx) return [];
76231
+ return Array.isArray(sx) ? [...sx] : [sx];
76232
+ };
76233
+ const mergeSxProps = (...sxList) => {
76234
+ return sxList.flatMap((sx) => getSxArray(sx));
76235
+ };
76260
76236
  const getStyleCell = (column, palette, disableRow) => {
76261
- return {
76262
- width: `${column.width}px !important`,
76263
- minWidth: `${column.width}px !important`,
76264
- maxWidth: `${column.width}px !important`,
76265
- padding: PADDING_GAP_ITEM,
76266
- borderRadius: "0 !important",
76267
- color: disableRow ? palette.divider : "none",
76268
- ...column.stickyCss ? {
76269
- position: "sticky",
76270
- backgroundColor: palette.background.default,
76271
- ...column.stickyCss
76272
- } : {},
76273
- ...column.sx ? column.sx : {}
76274
- };
76237
+ return mergeSxProps(
76238
+ {
76239
+ width: `${column.width}px !important`,
76240
+ minWidth: `${column.width}px !important`,
76241
+ maxWidth: `${column.width}px !important`,
76242
+ padding: PADDING_GAP_ITEM,
76243
+ borderRadius: "0 !important",
76244
+ color: disableRow ? palette.divider : "none",
76245
+ ...column.stickyCss ? {
76246
+ position: "sticky",
76247
+ backgroundColor: palette.background.default,
76248
+ ...column.stickyCss
76249
+ } : {}
76250
+ },
76251
+ column.sx,
76252
+ column.cellSx
76253
+ );
76275
76254
  };
76276
76255
  const getStyleRow = (hasOnClick, palette, index, rowSx, indexLoadingRow) => {
76277
76256
  return {
@@ -76365,10 +76344,10 @@ function TableRowPart({
76365
76344
  TableCell,
76366
76345
  {
76367
76346
  align: column.align,
76368
- sx: {
76369
- ...getStyleCell(column, palette, disabled.DISABLED_ROW),
76370
- ...isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : {}
76371
- },
76347
+ sx: mergeSxProps(
76348
+ getStyleCell(column, palette, disabled.DISABLED_ROW),
76349
+ isFirstDataCol ? { pl: (theme) => `calc(${theme.spacing(1)} + ${level * 16}px)` } : void 0
76350
+ ),
76372
76351
  onClick: column.id === "actions" || column.id === "selectCheckbox" ? (e) => {
76373
76352
  e.stopPropagation();
76374
76353
  } : void 0,
@@ -76493,45 +76472,104 @@ const TreeToggleCell = ({
76493
76472
  const TableContainerPart = ({ children }) => {
76494
76473
  return /* @__PURE__ */ jsx(Box, { sx: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ jsx(TableContainer, { sx: { maxHeight: "100%", overflow: "auto" }, children }) });
76495
76474
  };
76496
- const TableHeadPart = ({ columns }) => {
76475
+ const GROUPED_HEADER_ROW_HEIGHT = 44;
76476
+ const toHeaderCell = (column, rowSpan) => ({
76477
+ id: column.id,
76478
+ label: column.label,
76479
+ width: column.width,
76480
+ align: column.align,
76481
+ alignHead: column.alignHead,
76482
+ sx: mergeSxProps(column.sx, column.headSx),
76483
+ stickyCss: column.stickyCss,
76484
+ rowSpan
76485
+ });
76486
+ function TableHeadPart({ columns, headerGroups }) {
76497
76487
  const { palette } = useTheme$4();
76498
- return /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: columns.map((column) => {
76488
+ const headerRows = useMemo(() => {
76489
+ var _a;
76490
+ if (!(headerGroups == null ? void 0 : headerGroups.length)) return [columns.map((column) => toHeaderCell(column))];
76491
+ const groupByColumnId = /* @__PURE__ */ new Map();
76492
+ headerGroups.forEach((group) => {
76493
+ group.columnIds.forEach((columnId) => {
76494
+ groupByColumnId.set(columnId, group);
76495
+ });
76496
+ });
76497
+ const topCells = [];
76498
+ const bottomCells = [];
76499
+ let columnIndex = 0;
76500
+ while (columnIndex < columns.length) {
76501
+ const column = columns[columnIndex];
76502
+ const group = groupByColumnId.get(column.id);
76503
+ if (!group) {
76504
+ topCells.push(toHeaderCell(column, 2));
76505
+ columnIndex += 1;
76506
+ continue;
76507
+ }
76508
+ let colSpan = 1;
76509
+ while (columnIndex + colSpan < columns.length && ((_a = groupByColumnId.get(columns[columnIndex + colSpan].id)) == null ? void 0 : _a.id) === group.id) {
76510
+ colSpan += 1;
76511
+ }
76512
+ topCells.push({
76513
+ id: `${group.id}-${columnIndex}`,
76514
+ label: group.label,
76515
+ alignHead: group.align ?? "center",
76516
+ sx: group.sx,
76517
+ colSpan
76518
+ });
76519
+ for (let subColumnIndex = 0; subColumnIndex < colSpan; subColumnIndex += 1) {
76520
+ bottomCells.push(toHeaderCell(columns[columnIndex + subColumnIndex]));
76521
+ }
76522
+ columnIndex += colSpan;
76523
+ }
76524
+ if (!bottomCells.length) return [columns.map((column) => toHeaderCell(column))];
76525
+ return [topCells, bottomCells];
76526
+ }, [columns, headerGroups]);
76527
+ const isGroupedHeader = headerRows.length > 1;
76528
+ return /* @__PURE__ */ jsx(TableHead, { children: headerRows.map((headerRow, rowIndex) => /* @__PURE__ */ jsx(TableRow, { children: headerRow.map((cell) => {
76499
76529
  var _a;
76500
76530
  return /* @__PURE__ */ jsx(
76501
76531
  TableCell,
76502
76532
  {
76503
- align: column.align,
76504
- sx: {
76505
- width: `${column.width}px !important`,
76506
- minWidth: `${column.width}px !important`,
76507
- maxWidth: `${column.width}px !important`,
76508
- fontWeight: 550,
76509
- padding: PADDING_GAP_ITEM,
76510
- borderRadius: "0 !important",
76511
- backgroundColor: "#F9FAFB",
76512
- verticalAlign: "top",
76513
- textAlign: column.alignHead ? column.alignHead : "center",
76514
- borderTop: BORDER_TABLE,
76515
- ...column.stickyCss ? {
76516
- ...column.stickyCss,
76533
+ align: cell.align,
76534
+ colSpan: cell.colSpan,
76535
+ rowSpan: cell.rowSpan,
76536
+ sx: mergeSxProps(
76537
+ {
76538
+ ...cell.width != null ? {
76539
+ width: `${cell.width}px !important`,
76540
+ minWidth: `${cell.width}px !important`,
76541
+ maxWidth: `${cell.width}px !important`
76542
+ } : {},
76543
+ height: isGroupedHeader ? GROUPED_HEADER_ROW_HEIGHT : void 0,
76544
+ fontWeight: 550,
76545
+ padding: PADDING_GAP_ITEM,
76546
+ borderRadius: "0 !important",
76547
+ backgroundColor: "#F9FAFB",
76548
+ verticalAlign: isGroupedHeader && cell.rowSpan ? "middle" : "top",
76549
+ textAlign: cell.alignHead ? cell.alignHead : "center",
76550
+ borderTop: rowIndex === 0 ? BORDER_TABLE : "none",
76551
+ top: isGroupedHeader ? rowIndex * GROUPED_HEADER_ROW_HEIGHT : 0
76552
+ },
76553
+ cell.stickyCss ? {
76554
+ ...cell.stickyCss,
76517
76555
  position: "sticky",
76518
76556
  backgroundColor: palette.background.paper,
76519
76557
  zIndex: 4,
76520
- borderRight: ((_a = column.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
76558
+ borderRight: ((_a = cell.stickyCss) == null ? void 0 : _a.left) != null ? BORDER_TABLE : ""
76521
76559
  } : {},
76522
- ...column.sx ? column.sx : {}
76523
- },
76524
- children: /* @__PURE__ */ jsx(Typography$1, { variant: "subtitle1", children: column.label })
76560
+ cell.sx
76561
+ ),
76562
+ children: /* @__PURE__ */ jsx(Typography$1, { variant: "subtitle1", children: cell.label })
76525
76563
  },
76526
- column.id
76564
+ cell.id
76527
76565
  );
76528
- }) }) });
76529
- };
76566
+ }) }, rowIndex)) });
76567
+ }
76530
76568
  const TableBaseComponent = ({
76531
76569
  columns,
76570
+ headerGroups,
76532
76571
  rows = [],
76533
76572
  loading = false,
76534
- indexLoadingRow,
76535
76573
  stickyHeader = true,
76536
76574
  tableSx,
76537
76575
  tableRef,
@@ -76559,7 +76597,7 @@ const TableBaseComponent = ({
76559
76597
  ...Array.isArray(tableSx) ? tableSx : [tableSx]
76560
76598
  ],
76561
76599
  children: [
76562
- /* @__PURE__ */ jsx(TableHeadPart, { columns }),
76600
+ /* @__PURE__ */ jsx(TableHeadPart, { columns, headerGroups }),
76563
76601
  /* @__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() }) }) })
76564
76602
  ]
76565
76603
  }
@@ -76570,6 +76608,7 @@ function TableRendererComponent({
76570
76608
  loading = false,
76571
76609
  rows,
76572
76610
  columns: initialColumns,
76611
+ headerGroups,
76573
76612
  indexLoadingRow,
76574
76613
  isStickyActions = false,
76575
76614
  rowSx = {},
@@ -76869,9 +76908,25 @@ function TableRendererComponent({
76869
76908
  render: (row, index) => /* @__PURE__ */ jsx(StackRowAlignJustCenter, { gap: 1, onClick: (e) => e.stopPropagation(), children: renderActionsContent(row, index) })
76870
76909
  });
76871
76910
  }
76872
- return updateColumns;
76911
+ if (!(headerGroups == null ? void 0 : headerGroups.length)) return updateColumns;
76912
+ const groupByColumnId = /* @__PURE__ */ new Map();
76913
+ headerGroups.forEach((group) => {
76914
+ group.columnIds.forEach((columnId) => {
76915
+ groupByColumnId.set(columnId, group);
76916
+ });
76917
+ });
76918
+ return updateColumns.map((column) => {
76919
+ const group = groupByColumnId.get(column.id);
76920
+ if (!group || !group.childrenHeadSx && !group.childrenCellSx) return column;
76921
+ return {
76922
+ ...column,
76923
+ ...group.childrenHeadSx ? { headSx: mergeSxProps(group.childrenHeadSx, column.headSx) } : {},
76924
+ ...group.childrenCellSx ? { cellSx: mergeSxProps(group.childrenCellSx, column.cellSx) } : {}
76925
+ };
76926
+ });
76873
76927
  }, [
76874
76928
  initialColumns,
76929
+ headerGroups,
76875
76930
  enableTree,
76876
76931
  onSelectRows,
76877
76932
  lengthActions,
@@ -76926,6 +76981,7 @@ function TableRendererComponent({
76926
76981
  TableBaseComponent,
76927
76982
  {
76928
76983
  columns,
76984
+ headerGroups,
76929
76985
  rows: visibleRows,
76930
76986
  loading,
76931
76987
  indexLoadingRow,
@@ -76950,7 +77006,6 @@ function TableRendererComponent({
76950
77006
  function RowCollapsePart({
76951
77007
  columns,
76952
77008
  row,
76953
- indexRow,
76954
77009
  collapse,
76955
77010
  collapseTableWidth,
76956
77011
  renderDefaultRow,
@@ -77086,6 +77141,10 @@ const tableArgTypes = {
77086
77141
  control: false,
77087
77142
  table: { type: { summary: "Column<R>[]" } }
77088
77143
  },
77144
+ headerGroups: {
77145
+ control: false,
77146
+ table: { type: { summary: "TableHeaderGroup[]" } }
77147
+ },
77089
77148
  rows: {
77090
77149
  control: false,
77091
77150
  table: { type: { summary: "R[]" } }
@@ -79196,8 +79255,10 @@ export {
79196
79255
  getPopperProps,
79197
79256
  getStyleCell,
79198
79257
  getStyleRow,
79258
+ getSxArray,
79199
79259
  highlightText,
79200
79260
  highlightYellow,
79261
+ mergeSxProps,
79201
79262
  number_util as numberUtil,
79202
79263
  object_util as objectUtil,
79203
79264
  other_util as otherUtil,