@tint-ui/data-table 0.3.10 → 0.3.11
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/cjs/use-data-table.js +16 -14
- package/package.json +1 -1
- package/use-data-table.js +16 -14
package/cjs/use-data-table.js
CHANGED
|
@@ -427,9 +427,6 @@ const useDataTable = function (props) {
|
|
|
427
427
|
},
|
|
428
428
|
onGlobalFilterChange(value) {
|
|
429
429
|
const cb = refOptions.current?.onGlobalFilterChange;
|
|
430
|
-
if (cb) {
|
|
431
|
-
cb(value);
|
|
432
|
-
}
|
|
433
430
|
setState(prev => {
|
|
434
431
|
if (prev.loading) {
|
|
435
432
|
return prev;
|
|
@@ -441,6 +438,9 @@ const useDataTable = function (props) {
|
|
|
441
438
|
if (typeof value === "function") {
|
|
442
439
|
value = value(globalFilter);
|
|
443
440
|
}
|
|
441
|
+
if (cb) {
|
|
442
|
+
cb(value);
|
|
443
|
+
}
|
|
444
444
|
const state = Object.assign({}, rest, {
|
|
445
445
|
pagination: {
|
|
446
446
|
pageSize: prev.pagination.pageSize,
|
|
@@ -457,9 +457,6 @@ const useDataTable = function (props) {
|
|
|
457
457
|
},
|
|
458
458
|
onColumnFiltersChange(value) {
|
|
459
459
|
const cb = refOptions.current?.onColumnFiltersChange;
|
|
460
|
-
if (cb) {
|
|
461
|
-
cb(value);
|
|
462
|
-
}
|
|
463
460
|
setState(prev => {
|
|
464
461
|
if (prev.loading) {
|
|
465
462
|
return prev;
|
|
@@ -474,6 +471,9 @@ const useDataTable = function (props) {
|
|
|
474
471
|
value = value.filter(({
|
|
475
472
|
value
|
|
476
473
|
}) => Array.isArray(value) ? value.length > 0 : value != null && value !== "");
|
|
474
|
+
if (cb) {
|
|
475
|
+
cb(value);
|
|
476
|
+
}
|
|
477
477
|
const state = Object.assign({}, rest, {
|
|
478
478
|
pagination: {
|
|
479
479
|
pageSize: prev.pagination.pageSize,
|
|
@@ -490,9 +490,6 @@ const useDataTable = function (props) {
|
|
|
490
490
|
},
|
|
491
491
|
onSortingChange(value) {
|
|
492
492
|
const cb = refOptions.current?.onSortingChange;
|
|
493
|
-
if (cb) {
|
|
494
|
-
cb(value);
|
|
495
|
-
}
|
|
496
493
|
setState(prev => {
|
|
497
494
|
if (prev.loading) {
|
|
498
495
|
return prev;
|
|
@@ -501,13 +498,17 @@ const useDataTable = function (props) {
|
|
|
501
498
|
sorting
|
|
502
499
|
} = prev,
|
|
503
500
|
rest = (0, _objectWithoutPropertiesLoose2.default)(prev, _excluded3);
|
|
501
|
+
const sortingState = typeof value === "function" ? value(sorting) : value;
|
|
502
|
+
if (cb) {
|
|
503
|
+
cb(sortingState);
|
|
504
|
+
}
|
|
504
505
|
const state = Object.assign({}, rest, {
|
|
505
506
|
pagination: {
|
|
506
507
|
pageSize: prev.pagination.pageSize,
|
|
507
508
|
pageIndex: 0
|
|
508
509
|
},
|
|
509
510
|
error: null,
|
|
510
|
-
sorting:
|
|
511
|
+
sorting: sortingState,
|
|
511
512
|
loading: false
|
|
512
513
|
});
|
|
513
514
|
if (force(state)) {
|
|
@@ -522,9 +523,6 @@ const useDataTable = function (props) {
|
|
|
522
523
|
},
|
|
523
524
|
onPaginationChange(value) {
|
|
524
525
|
const cb = refOptions.current?.onPaginationChange;
|
|
525
|
-
if (cb) {
|
|
526
|
-
cb(value);
|
|
527
|
-
}
|
|
528
526
|
setState(prev => {
|
|
529
527
|
if (prev.loading) {
|
|
530
528
|
return prev;
|
|
@@ -533,8 +531,12 @@ const useDataTable = function (props) {
|
|
|
533
531
|
pagination
|
|
534
532
|
} = prev,
|
|
535
533
|
rest = (0, _objectWithoutPropertiesLoose2.default)(prev, _excluded4);
|
|
534
|
+
const paginationState = typeof value === "function" ? value(pagination) : value;
|
|
535
|
+
if (cb) {
|
|
536
|
+
cb(paginationState);
|
|
537
|
+
}
|
|
536
538
|
const state = Object.assign({}, rest, {
|
|
537
|
-
pagination:
|
|
539
|
+
pagination: paginationState,
|
|
538
540
|
error: null,
|
|
539
541
|
loading: false
|
|
540
542
|
});
|
package/package.json
CHANGED
package/use-data-table.js
CHANGED
|
@@ -421,9 +421,6 @@ const useDataTable = function (props) {
|
|
|
421
421
|
},
|
|
422
422
|
onGlobalFilterChange(value) {
|
|
423
423
|
const cb = refOptions.current?.onGlobalFilterChange;
|
|
424
|
-
if (cb) {
|
|
425
|
-
cb(value);
|
|
426
|
-
}
|
|
427
424
|
setState(prev => {
|
|
428
425
|
if (prev.loading) {
|
|
429
426
|
return prev;
|
|
@@ -435,6 +432,9 @@ const useDataTable = function (props) {
|
|
|
435
432
|
if (typeof value === "function") {
|
|
436
433
|
value = value(globalFilter);
|
|
437
434
|
}
|
|
435
|
+
if (cb) {
|
|
436
|
+
cb(value);
|
|
437
|
+
}
|
|
438
438
|
const state = {
|
|
439
439
|
...rest,
|
|
440
440
|
pagination: {
|
|
@@ -452,9 +452,6 @@ const useDataTable = function (props) {
|
|
|
452
452
|
},
|
|
453
453
|
onColumnFiltersChange(value) {
|
|
454
454
|
const cb = refOptions.current?.onColumnFiltersChange;
|
|
455
|
-
if (cb) {
|
|
456
|
-
cb(value);
|
|
457
|
-
}
|
|
458
455
|
setState(prev => {
|
|
459
456
|
if (prev.loading) {
|
|
460
457
|
return prev;
|
|
@@ -469,6 +466,9 @@ const useDataTable = function (props) {
|
|
|
469
466
|
value = value.filter(({
|
|
470
467
|
value
|
|
471
468
|
}) => Array.isArray(value) ? value.length > 0 : value != null && value !== "");
|
|
469
|
+
if (cb) {
|
|
470
|
+
cb(value);
|
|
471
|
+
}
|
|
472
472
|
const state = {
|
|
473
473
|
...rest,
|
|
474
474
|
pagination: {
|
|
@@ -486,9 +486,6 @@ const useDataTable = function (props) {
|
|
|
486
486
|
},
|
|
487
487
|
onSortingChange(value) {
|
|
488
488
|
const cb = refOptions.current?.onSortingChange;
|
|
489
|
-
if (cb) {
|
|
490
|
-
cb(value);
|
|
491
|
-
}
|
|
492
489
|
setState(prev => {
|
|
493
490
|
if (prev.loading) {
|
|
494
491
|
return prev;
|
|
@@ -497,6 +494,10 @@ const useDataTable = function (props) {
|
|
|
497
494
|
sorting,
|
|
498
495
|
...rest
|
|
499
496
|
} = prev;
|
|
497
|
+
const sortingState = typeof value === "function" ? value(sorting) : value;
|
|
498
|
+
if (cb) {
|
|
499
|
+
cb(sortingState);
|
|
500
|
+
}
|
|
500
501
|
const state = {
|
|
501
502
|
...rest,
|
|
502
503
|
pagination: {
|
|
@@ -504,7 +505,7 @@ const useDataTable = function (props) {
|
|
|
504
505
|
pageIndex: 0
|
|
505
506
|
},
|
|
506
507
|
error: null,
|
|
507
|
-
sorting:
|
|
508
|
+
sorting: sortingState,
|
|
508
509
|
loading: false
|
|
509
510
|
};
|
|
510
511
|
if (force(state)) {
|
|
@@ -519,9 +520,6 @@ const useDataTable = function (props) {
|
|
|
519
520
|
},
|
|
520
521
|
onPaginationChange(value) {
|
|
521
522
|
const cb = refOptions.current?.onPaginationChange;
|
|
522
|
-
if (cb) {
|
|
523
|
-
cb(value);
|
|
524
|
-
}
|
|
525
523
|
setState(prev => {
|
|
526
524
|
if (prev.loading) {
|
|
527
525
|
return prev;
|
|
@@ -530,9 +528,13 @@ const useDataTable = function (props) {
|
|
|
530
528
|
pagination,
|
|
531
529
|
...rest
|
|
532
530
|
} = prev;
|
|
531
|
+
const paginationState = typeof value === "function" ? value(pagination) : value;
|
|
532
|
+
if (cb) {
|
|
533
|
+
cb(paginationState);
|
|
534
|
+
}
|
|
533
535
|
const state = {
|
|
534
536
|
...rest,
|
|
535
|
-
pagination:
|
|
537
|
+
pagination: paginationState,
|
|
536
538
|
error: null,
|
|
537
539
|
loading: false
|
|
538
540
|
};
|