awing-library 2.1.2-dev.71 → 2.1.2-dev.73

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.
@@ -24,7 +24,7 @@ export interface ColumnDefinition<T extends object> {
24
24
  }
25
25
  export type TableEditableProps<T> = {
26
26
  columnDefinitions: Array<ColumnDefinition<Partial<T>>>;
27
- fieldDefinitions: Array<ColumnDefinition<Partial<T>>>;
27
+ fieldDefinitions?: Array<ColumnDefinition<Partial<T>>>;
28
28
  items: Array<Partial<T>>;
29
29
  onChange(newData: Array<Partial<T>>, dataValid: boolean, fieldName?: keyof T): void;
30
30
  getRowId?(obj: Partial<T>): number;
@@ -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,
@@ -177657,20 +177660,27 @@ function TableCellEditable(props) {
177657
177660
  children: renderDataInput()
177658
177661
  })
177659
177662
  }) : renderDataInput()
177660
- }) : jsxRuntimeExports.jsx(TableCell, Object.assign({
177663
+ }) : jsxRuntimeExports.jsxs(TableCell, Object.assign({
177661
177664
  sx: {
177662
177665
  p: 1,
177663
177666
  border: error ? '2px solid #ED1D25' : '1px solid rgb(224, 224, 224)'
177664
177667
  },
177665
177668
  rowSpan: numOfRowSpan
177666
177669
  }, TableCellProps, {
177667
- children: isTooltip ? jsxRuntimeExports.jsx(StyleTooltip$1, {
177670
+ children: [!!isShowCollapsible &&
177671
+ // Hiển thị icon mở rộng, ở cột đầu tiên
177672
+ jsxRuntimeExports.jsx(IconButton$1, {
177673
+ "aria-label": "expand row",
177674
+ size: "small",
177675
+ onClick: onToggleCollapsible,
177676
+ children: isCollapsed ? jsxRuntimeExports.jsx(KeyboardArrowDown, {}) : jsxRuntimeExports.jsx(KeyboardArrowRight, {})
177677
+ }), isTooltip ? jsxRuntimeExports.jsx(StyleTooltip$1, {
177668
177678
  title: getTitleTooltip && getTitleTooltip(value) || '',
177669
177679
  placement: "top-start",
177670
177680
  children: jsxRuntimeExports.jsx(Stack, {
177671
177681
  children: renderDataInput()
177672
177682
  })
177673
- }) : renderDataInput()
177683
+ }) : renderDataInput()]
177674
177684
  }));
177675
177685
  }
177676
177686
 
@@ -177777,6 +177787,9 @@ function TableRowEditable(props) {
177777
177787
  const numOfRowSpan = isMergeColumn ? convertItems.filter(c => c[fieldName] === row[fieldName]).length : 1;
177778
177788
  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
177789
  return isDisplay && jsxRuntimeExports.jsx(TableCellEditable, {
177790
+ isShowCollapsible: idx === 0,
177791
+ isCollapsed: open,
177792
+ onToggleCollapsible: () => setOpen(!open),
177780
177793
  cellDefinition: Object.assign(Object.assign({}, colDef.editFieldDefinition), {
177781
177794
  row,
177782
177795
  TableCellProps: colDef.TableCellProps,
@@ -178110,7 +178123,7 @@ function TableEditable(props) {
178110
178123
  var _a;
178111
178124
  return ((_a = x.editFieldDefinition) === null || _a === void 0 ? void 0 : _a.fieldName) === fieldName;
178112
178125
  })) === null || _a === void 0 ? void 0 : _a.editFieldDefinition;
178113
- let collapField = (_b = fieldDefinitions.find(x => {
178126
+ let collapField = (_b = fieldDefinitions === null || fieldDefinitions === void 0 ? void 0 : fieldDefinitions.find(x => {
178114
178127
  var _a;
178115
178128
  return ((_a = x.editFieldDefinition) === null || _a === void 0 ? void 0 : _a.fieldName) === fieldName;
178116
178129
  })) === null || _b === void 0 ? void 0 : _b.editFieldDefinition;
@@ -178289,7 +178302,7 @@ function TableEditable(props) {
178289
178302
  children: [jsxRuntimeExports.jsxs(TableContainer, {
178290
178303
  component: Paper$1,
178291
178304
  sx: {
178292
- overflow: 'hidden'
178305
+ // overflow: 'hidden',
178293
178306
  },
178294
178307
  children: [selected && onSelectedChange && selected.length > 0 && selectionActions && jsxRuntimeExports.jsx(TopBarActions, {
178295
178308
  selected: selected,
package/dist/index.d.ts CHANGED
@@ -1826,7 +1826,7 @@ interface ColumnDefinition<T extends object> {
1826
1826
  }
1827
1827
  type TableEditableProps<T> = {
1828
1828
  columnDefinitions: Array<ColumnDefinition<Partial<T>>>;
1829
- fieldDefinitions: Array<ColumnDefinition<Partial<T>>>;
1829
+ fieldDefinitions?: Array<ColumnDefinition<Partial<T>>>;
1830
1830
  items: Array<Partial<T>>;
1831
1831
  onChange(newData: Array<Partial<T>>, dataValid: boolean, fieldName?: keyof T): void;
1832
1832
  getRowId?(obj: Partial<T>): number;
@@ -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.71",
3
+ "version": "2.1.2-dev.73",
4
4
  "main": "dist/esm/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",