@etsoo/react 1.4.23 → 1.4.24

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.
@@ -86,7 +86,7 @@ export function DataGridEx(props) {
86
86
  sortLabel = headerCellRenderer({
87
87
  cellProps,
88
88
  column,
89
- columnIndex: index,
89
+ columnIndex: checkable ? index - 1 : index,
90
90
  states
91
91
  });
92
92
  }
@@ -115,7 +115,7 @@ export function DataGridEx(props) {
115
115
  const cell = footerItemRenderer
116
116
  ? footerItemRenderer(rows, {
117
117
  column,
118
- index,
118
+ index: checkable ? index - 1 : index,
119
119
  states,
120
120
  cellProps,
121
121
  checkable
@@ -80,16 +80,18 @@ export var DataGridRenderers;
80
80
  * @param location Renderer location (column index)
81
81
  * @returns Component
82
82
  */
83
- function defaultFooterItemRenderer(_rows, { index, states, checkable }, location = 1) {
83
+ function defaultFooterItemRenderer(_rows, { index, states, checkable }, location = 0) {
84
84
  const { selectedItems, loadedItems, hasNextPage } = states;
85
- if (checkable && index === location + 1) {
86
- return [
87
- selectedItems.length,
88
- loadedItems.toLocaleString() + (hasNextPage ? '+' : '')
89
- ].join(' / ');
90
- }
91
- if (!checkable && index === location) {
92
- return loadedItems.toLocaleString() + (hasNextPage ? '+' : '');
85
+ if (index === location) {
86
+ if (checkable) {
87
+ return [
88
+ selectedItems.length,
89
+ loadedItems.toLocaleString() + (hasNextPage ? '+' : '')
90
+ ].join(' / ');
91
+ }
92
+ else {
93
+ return loadedItems.toLocaleString() + (hasNextPage ? '+' : '');
94
+ }
93
95
  }
94
96
  return undefined;
95
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.23",
3
+ "version": "1.4.24",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -241,7 +241,7 @@ export function DataGridEx<T extends Record<string, any>>(
241
241
  sortLabel = headerCellRenderer({
242
242
  cellProps,
243
243
  column,
244
- columnIndex: index,
244
+ columnIndex: checkable ? index - 1 : index, // Ignore the checkbox case,
245
245
  states
246
246
  });
247
247
  } else if (sortable && field != null) {
@@ -306,7 +306,7 @@ export function DataGridEx<T extends Record<string, any>>(
306
306
  const cell = footerItemRenderer
307
307
  ? footerItemRenderer(rows, {
308
308
  column,
309
- index,
309
+ index: checkable ? index - 1 : index, // Ignore the checkbox case
310
310
  states,
311
311
  cellProps,
312
312
  checkable
@@ -120,19 +120,19 @@ export namespace DataGridRenderers {
120
120
  export function defaultFooterItemRenderer<T>(
121
121
  _rows: T[],
122
122
  { index, states, checkable }: DataGridExFooterItemRendererProps<T>,
123
- location: number = 1
123
+ location: number = 0
124
124
  ) {
125
125
  const { selectedItems, loadedItems, hasNextPage } = states;
126
126
 
127
- if (checkable && index === location + 1) {
128
- return [
129
- selectedItems.length,
130
- loadedItems.toLocaleString() + (hasNextPage ? '+' : '')
131
- ].join(' / ');
132
- }
133
-
134
- if (!checkable && index === location) {
135
- return loadedItems.toLocaleString() + (hasNextPage ? '+' : '');
127
+ if (index === location) {
128
+ if (checkable) {
129
+ return [
130
+ selectedItems.length,
131
+ loadedItems.toLocaleString() + (hasNextPage ? '+' : '')
132
+ ].join(' / ');
133
+ } else {
134
+ return loadedItems.toLocaleString() + (hasNextPage ? '+' : '');
135
+ }
136
136
  }
137
137
 
138
138
  return undefined;