es-grid-template 1.8.98 → 1.9.0

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.
@@ -1993,7 +1993,7 @@ export function isTreeArray(arr) {
1993
1993
  if (!item) {
1994
1994
  return false;
1995
1995
  }
1996
- if (item.children?.length > 0) {
1996
+ if (Array.isArray(item.children)) {
1997
1997
  return true;
1998
1998
  }
1999
1999
  }
@@ -126,6 +126,10 @@ const Grid = props => {
126
126
  }
127
127
  return true;
128
128
  },
129
+ getRowCanExpand: row => {
130
+ // return Array.isArray(row.original.children) && row.original.children.length > 0
131
+ return Array.isArray(row.original.children);
132
+ },
129
133
  initialState: {
130
134
  rowSelection: {}
131
135
  },
@@ -1932,7 +1932,7 @@ const TableContainerEdit = props => {
1932
1932
  overflow: 'hidden'
1933
1933
  }
1934
1934
  }, /*#__PURE__*/React.createElement("div", {
1935
- className: classNames('ui-rc-toolbar-bottom', {
1935
+ className: classNames('ui-rc-toolbar-bottom border-0', {
1936
1936
  'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
1937
1937
  })
1938
1938
  }, /*#__PURE__*/React.createElement(Toolbar, {
@@ -522,6 +522,7 @@ const EditableCell = props => {
522
522
  popupClassName: 'be-popup-container',
523
523
  status: isInvalid ? 'error' : undefined,
524
524
  filterOption: filterOption,
525
+ optionRender: column.editSelectSettings?.formatOptionLabel,
525
526
  fieldNames: fieldNames ? fieldNames : {
526
527
  value: keySelect,
527
528
  label: inputKey ?? 'label'
@@ -676,6 +677,7 @@ const EditableCell = props => {
676
677
  return /*#__PURE__*/React.createElement(React.Fragment, null, " ", menu);
677
678
  }
678
679
  },
680
+ optionRender: column.editSelectSettings?.formatOptionLabel,
679
681
  filterOption: filterOption,
680
682
  fieldNames: fieldNames ? fieldNames : {
681
683
  value: keySelect,
@@ -157,7 +157,8 @@ const Grid = props => {
157
157
  getGroupedRowModel: getGroupedRowModel(),
158
158
  // onExpandedChange: setExpanded,
159
159
  getRowCanExpand: row => {
160
- return Array.isArray(row.original.children) && row.original.children.length > 0;
160
+ // return Array.isArray(row.original.children) && row.original.children.length > 0
161
+ return Array.isArray(row.original.children);
161
162
  },
162
163
  getExpandedRowModel: getExpandedRowModel(),
163
164
  getPaginationRowModel: pagination && !infiniteScroll ? getPaginationRowModel() : undefined,
@@ -237,6 +237,10 @@ const InternalTable = props => {
237
237
  enableColumnResizing: allowResizing !== false,
238
238
  columnResizeMode,
239
239
  columnResizeDirection,
240
+ getRowCanExpand: row => {
241
+ // return Array.isArray(row.original.children) && row.original.children.length > 0
242
+ return Array.isArray(row.original.children);
243
+ },
240
244
  onColumnSizingChange: setColumnSizing,
241
245
  onColumnSizingInfoChange: setColumnSizingInfo,
242
246
  // ColumnSizing
@@ -45,7 +45,7 @@ const TableBodyRow = ({
45
45
  className: classNames(`${prefix}-grid-row ${rowClass ?? ''}`, {
46
46
  [`${prefix}-grid-row-selected`]: row.getIsSelected(),
47
47
  [`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId,
48
- [`${prefix}-grid-row-parent`]: row.subRows && row.subRows.length > 0
48
+ [`${prefix}-grid-row-parent`]: row.getCanExpand()
49
49
  }),
50
50
  style: {
51
51
  ...rowStyles,
@@ -85,7 +85,9 @@ const TableBodyRow = ({
85
85
 
86
86
  // const colSpan = row.subRows && cell.column.id === firstNonGroupColumn?.id ? (groupSetting?.groupColumnSpan ?? 2)
87
87
  const colSpanGroup = row.subRows && row.subRows.length > 0 && cell.column.id === firstNonGroupColumn?.column.id ? 2 : row.subRows && nonGroupColumns[1].column.id === cell.column.id ? 0 : 1;
88
- if (row.subRows && row.subRows.length > 0 && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
88
+
89
+ // if (row.subRows && row.subRows.length > 0 && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
90
+ if (row.subRows && row.getCanExpand() && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
89
91
  return null;
90
92
  }
91
93
 
@@ -128,7 +130,9 @@ const TableBodyRow = ({
128
130
  groupValue: groupValue
129
131
  }));
130
132
  }
131
- if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
133
+
134
+ // if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
135
+ if (row.getCanExpand() && originCol.sumGroup === true && originCol.type === 'number') {
132
136
  const colFormat = typeof originCol.format === 'function' ? originCol.format({}) : originCol.format;
133
137
  const cellFormat = getFormat(colFormat, format);
134
138
  const thousandSeparator = cellFormat?.thousandSeparator;
@@ -2111,7 +2111,7 @@ function isTreeArray(arr) {
2111
2111
  if (!item) {
2112
2112
  return false;
2113
2113
  }
2114
- if (item.children?.length > 0) {
2114
+ if (Array.isArray(item.children)) {
2115
2115
  return true;
2116
2116
  }
2117
2117
  }
@@ -132,6 +132,10 @@ const Grid = props => {
132
132
  }
133
133
  return true;
134
134
  },
135
+ getRowCanExpand: row => {
136
+ // return Array.isArray(row.original.children) && row.original.children.length > 0
137
+ return Array.isArray(row.original.children);
138
+ },
135
139
  initialState: {
136
140
  rowSelection: {}
137
141
  },
@@ -1939,7 +1939,7 @@ const TableContainerEdit = props => {
1939
1939
  overflow: 'hidden'
1940
1940
  }
1941
1941
  }, /*#__PURE__*/_react.default.createElement("div", {
1942
- className: (0, _classnames.default)('ui-rc-toolbar-bottom', {
1942
+ className: (0, _classnames.default)('ui-rc-toolbar-bottom border-0', {
1943
1943
  'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
1944
1944
  })
1945
1945
  }, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Toolbar, {
@@ -530,6 +530,7 @@ const EditableCell = props => {
530
530
  popupClassName: 'be-popup-container',
531
531
  status: isInvalid ? 'error' : undefined,
532
532
  filterOption: filterOption,
533
+ optionRender: column.editSelectSettings?.formatOptionLabel,
533
534
  fieldNames: fieldNames ? fieldNames : {
534
535
  value: keySelect,
535
536
  label: inputKey ?? 'label'
@@ -684,6 +685,7 @@ const EditableCell = props => {
684
685
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", menu);
685
686
  }
686
687
  },
688
+ optionRender: column.editSelectSettings?.formatOptionLabel,
687
689
  filterOption: filterOption,
688
690
  fieldNames: fieldNames ? fieldNames : {
689
691
  value: keySelect,
@@ -162,7 +162,8 @@ const Grid = props => {
162
162
  getGroupedRowModel: (0, _reactTable.getGroupedRowModel)(),
163
163
  // onExpandedChange: setExpanded,
164
164
  getRowCanExpand: row => {
165
- return Array.isArray(row.original.children) && row.original.children.length > 0;
165
+ // return Array.isArray(row.original.children) && row.original.children.length > 0
166
+ return Array.isArray(row.original.children);
166
167
  },
167
168
  getExpandedRowModel: (0, _reactTable.getExpandedRowModel)(),
168
169
  getPaginationRowModel: pagination && !infiniteScroll ? (0, _reactTable.getPaginationRowModel)() : undefined,
@@ -247,6 +247,10 @@ const InternalTable = props => {
247
247
  enableColumnResizing: allowResizing !== false,
248
248
  columnResizeMode,
249
249
  columnResizeDirection,
250
+ getRowCanExpand: row => {
251
+ // return Array.isArray(row.original.children) && row.original.children.length > 0
252
+ return Array.isArray(row.original.children);
253
+ },
250
254
  onColumnSizingChange: setColumnSizing,
251
255
  onColumnSizingInfoChange: setColumnSizingInfo,
252
256
  // ColumnSizing
@@ -52,7 +52,7 @@ const TableBodyRow = ({
52
52
  className: (0, _classnames.default)(`${prefix}-grid-row ${rowClass ?? ''}`, {
53
53
  [`${prefix}-grid-row-selected`]: row.getIsSelected(),
54
54
  [`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId,
55
- [`${prefix}-grid-row-parent`]: row.subRows && row.subRows.length > 0
55
+ [`${prefix}-grid-row-parent`]: row.getCanExpand()
56
56
  }),
57
57
  style: {
58
58
  ...rowStyles,
@@ -92,7 +92,9 @@ const TableBodyRow = ({
92
92
 
93
93
  // const colSpan = row.subRows && cell.column.id === firstNonGroupColumn?.id ? (groupSetting?.groupColumnSpan ?? 2)
94
94
  const colSpanGroup = row.subRows && row.subRows.length > 0 && cell.column.id === firstNonGroupColumn?.column.id ? 2 : row.subRows && nonGroupColumns[1].column.id === cell.column.id ? 0 : 1;
95
- if (row.subRows && row.subRows.length > 0 && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
95
+
96
+ // if (row.subRows && row.subRows.length > 0 && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
97
+ if (row.subRows && row.getCanExpand() && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
96
98
  return null;
97
99
  }
98
100
 
@@ -135,7 +137,9 @@ const TableBodyRow = ({
135
137
  groupValue: groupValue
136
138
  }));
137
139
  }
138
- if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
140
+
141
+ // if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
142
+ if (row.getCanExpand() && originCol.sumGroup === true && originCol.type === 'number') {
139
143
  const colFormat = typeof originCol.format === 'function' ? originCol.format({}) : originCol.format;
140
144
  const cellFormat = (0, _utils.getFormat)(colFormat, format);
141
145
  const thousandSeparator = cellFormat?.thousandSeparator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.98",
3
+ "version": "1.9.0",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",