awing-library 2.1.2-dev.72 → 2.1.2-dev.74

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.
@@ -92,5 +92,8 @@ export interface TableRowEditableProps<T> {
92
92
  export interface TableCellEditableProps<T extends object> {
93
93
  cellDefinition: CellDefinition<T>;
94
94
  isContainer?: boolean;
95
+ isShowCollapsible?: boolean;
96
+ isCollapsed?: boolean;
95
97
  numOfRowSpan?: number;
98
+ onToggleCollapsible?: () => void;
96
99
  }
package/dist/esm/index.js CHANGED
@@ -177625,7 +177625,10 @@ function TableCellEditable(props) {
177625
177625
  const {
177626
177626
  isContainer,
177627
177627
  cellDefinition,
177628
- numOfRowSpan
177628
+ numOfRowSpan,
177629
+ isShowCollapsible,
177630
+ isCollapsed,
177631
+ onToggleCollapsible
177629
177632
  } = props;
177630
177633
  const {
177631
177634
  TableCellProps,
@@ -177664,13 +177667,28 @@ function TableCellEditable(props) {
177664
177667
  },
177665
177668
  rowSpan: numOfRowSpan
177666
177669
  }, TableCellProps, {
177667
- children: isTooltip ? jsxRuntimeExports.jsx(StyleTooltip$1, {
177668
- title: getTitleTooltip && getTitleTooltip(value) || '',
177669
- placement: "top-start",
177670
- children: jsxRuntimeExports.jsx(Stack, {
177671
- children: renderDataInput()
177672
- })
177673
- }) : renderDataInput()
177670
+ children: jsxRuntimeExports.jsxs(Box$1, {
177671
+ display: "flex",
177672
+ alignItems: "center",
177673
+ gap: 0.5,
177674
+ children: [!!isShowCollapsible &&
177675
+ // Hiển thị icon mở rộng, ở cột đầu tiên
177676
+ jsxRuntimeExports.jsx(IconButton$1, {
177677
+ sx: {
177678
+ width: 24,
177679
+ height: 24
177680
+ },
177681
+ size: "small",
177682
+ onClick: onToggleCollapsible,
177683
+ children: isCollapsed ? jsxRuntimeExports.jsx(KeyboardArrowDown, {}) : jsxRuntimeExports.jsx(KeyboardArrowRight, {})
177684
+ }), isTooltip ? jsxRuntimeExports.jsx(StyleTooltip$1, {
177685
+ title: getTitleTooltip && getTitleTooltip(value) || '',
177686
+ placement: "top-start",
177687
+ children: jsxRuntimeExports.jsx(Stack, {
177688
+ children: renderDataInput()
177689
+ })
177690
+ }) : renderDataInput()]
177691
+ })
177674
177692
  }));
177675
177693
  }
177676
177694
 
@@ -177742,7 +177760,7 @@ function TableRowEditable(props) {
177742
177760
  const isMergeColumn = fieldName === mergeRowsBy;
177743
177761
  const isDisplay = isMergeColumn ? itemIndex === 0 || convertItems[itemIndex - 1][fieldName] !== row[fieldName] : true;
177744
177762
  const numOfRowSpan = isMergeColumn ? convertItems.filter(c => c[fieldName] === row[fieldName]).length : 1;
177745
- return isDisplay && jsxRuntimeExports.jsxs(TableCell, Object.assign({
177763
+ return isDisplay && jsxRuntimeExports.jsx(TableCell, Object.assign({
177746
177764
  sx: {
177747
177765
  border: '1px solid rgb(224, 224, 224)'
177748
177766
  }
@@ -177751,20 +177769,28 @@ function TableRowEditable(props) {
177751
177769
  }, idx === 0 ? {
177752
177770
  width: '15%'
177753
177771
  } : {}, {
177754
- children: [idx === 0 &&
177755
- // Hiển thị icon mở rộng, ở cột đầu tiên
177756
- jsxRuntimeExports.jsx(IconButton$1, {
177757
- "aria-label": "expand row",
177758
- size: "small",
177759
- onClick: () => setOpen(!open),
177760
- children: open ? jsxRuntimeExports.jsx(KeyboardArrowDown, {}) : jsxRuntimeExports.jsx(KeyboardArrowRight, {})
177761
- }), colDef.isTooltip ? jsxRuntimeExports.jsx(StyleTooltip, {
177762
- title: colDef.getTitleTooltip && colDef.getTitleTooltip(content),
177763
- placement: "top-start",
177764
- children: jsxRuntimeExports.jsx("div", {
177765
- children: content
177766
- })
177767
- }) : colDef.contentGetter(row, rowIdx)]
177772
+ children: jsxRuntimeExports.jsxs(Box$1, {
177773
+ display: "flex",
177774
+ alignItems: "center",
177775
+ gap: 0.5,
177776
+ children: [idx === 0 &&
177777
+ // Hiển thị icon mở rộng, ở cột đầu tiên
177778
+ jsxRuntimeExports.jsx(IconButton$1, {
177779
+ sx: {
177780
+ width: 24,
177781
+ height: 24
177782
+ },
177783
+ size: "small",
177784
+ onClick: () => setOpen(!open),
177785
+ children: open ? jsxRuntimeExports.jsx(KeyboardArrowDown, {}) : jsxRuntimeExports.jsx(KeyboardArrowRight, {})
177786
+ }), colDef.isTooltip ? jsxRuntimeExports.jsx(StyleTooltip, {
177787
+ title: colDef.getTitleTooltip && colDef.getTitleTooltip(content),
177788
+ placement: "top-start",
177789
+ children: jsxRuntimeExports.jsx("div", {
177790
+ children: content
177791
+ })
177792
+ }) : colDef.contentGetter(row, rowIdx)]
177793
+ })
177768
177794
  }), idx);
177769
177795
  }
177770
177796
  if (colDef.editFieldDefinition) {
@@ -177777,6 +177803,9 @@ function TableRowEditable(props) {
177777
177803
  const numOfRowSpan = isMergeColumn ? convertItems.filter(c => c[fieldName] === row[fieldName]).length : 1;
177778
177804
  const error = ((_c = dataValidation === null || dataValidation === void 0 ? void 0 : dataValidation[rowIdx]) === null || _c === void 0 ? void 0 : _c[fieldName]) !== undefined && !((_d = dataValidation === null || dataValidation === void 0 ? void 0 : dataValidation[rowIdx]) === null || _d === void 0 ? void 0 : _d[fieldName]);
177779
177805
  return isDisplay && jsxRuntimeExports.jsx(TableCellEditable, {
177806
+ isShowCollapsible: idx === 0,
177807
+ isCollapsed: open,
177808
+ onToggleCollapsible: () => setOpen(!open),
177780
177809
  cellDefinition: Object.assign(Object.assign({}, colDef.editFieldDefinition), {
177781
177810
  row,
177782
177811
  TableCellProps: colDef.TableCellProps,
package/dist/index.d.ts CHANGED
@@ -1875,7 +1875,10 @@ interface TableEditableBodyProps<T> {
1875
1875
  interface TableCellEditableProps<T extends object> {
1876
1876
  cellDefinition: CellDefinition<T>;
1877
1877
  isContainer?: boolean;
1878
+ isShowCollapsible?: boolean;
1879
+ isCollapsed?: boolean;
1878
1880
  numOfRowSpan?: number;
1881
+ onToggleCollapsible?: () => void;
1879
1882
  }
1880
1883
 
1881
1884
  declare function TableEditable<T>(props: TableEditableProps<T>): react_jsx_runtime.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.2-dev.72",
3
+ "version": "2.1.2-dev.74",
4
4
  "main": "dist/esm/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",