@tanstack/react-table 8.0.0-alpha.86 → 8.0.0-alpha.87

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.
@@ -2342,21 +2342,54 @@ function isRowSelected(row, selection, instance) {
2342
2342
  }
2343
2343
 
2344
2344
  const reSplitAlphaNumeric = /([0-9]+)/gm;
2345
- const sortingFns = {
2346
- alphanumeric,
2347
- alphanumericCaseSensitive,
2348
- text,
2349
- textCaseSensitive,
2350
- datetime,
2351
- basic
2352
- };
2353
2345
 
2354
- function alphanumeric(rowA, rowB, columnId) {
2346
+ const alphanumeric = (rowA, rowB, columnId) => {
2355
2347
  return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
2356
- }
2348
+ };
2357
2349
 
2358
- function alphanumericCaseSensitive(rowA, rowB, columnId) {
2350
+ const alphanumericCaseSensitive = (rowA, rowB, columnId) => {
2359
2351
  return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
2352
+ }; // The text filter is more basic (less numeric support)
2353
+ // but is much faster
2354
+
2355
+
2356
+ const text = (rowA, rowB, columnId) => {
2357
+ return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
2358
+ }; // The text filter is more basic (less numeric support)
2359
+ // but is much faster
2360
+
2361
+
2362
+ const textCaseSensitive = (rowA, rowB, columnId) => {
2363
+ return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
2364
+ };
2365
+
2366
+ const datetime = (rowA, rowB, columnId) => {
2367
+ return compareBasic(rowA.getValue(columnId).getTime(), rowB.getValue(columnId).getTime());
2368
+ };
2369
+
2370
+ const basic = (rowA, rowB, columnId) => {
2371
+ return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
2372
+ }; // Utils
2373
+
2374
+
2375
+ function compareBasic(a, b) {
2376
+ return a === b ? 0 : a > b ? 1 : -1;
2377
+ }
2378
+
2379
+ function toString(a) {
2380
+ if (typeof a === 'number') {
2381
+ if (isNaN(a) || a === Infinity || a === -Infinity) {
2382
+ return '';
2383
+ }
2384
+
2385
+ return String(a);
2386
+ }
2387
+
2388
+ if (typeof a === 'string') {
2389
+ return a;
2390
+ }
2391
+
2392
+ return '';
2360
2393
  } // Mixed sorting is slow, but very inclusive of many edge cases.
2361
2394
  // It handles numbers, mixed alphanumeric combinations, and even
2362
2395
  // null, undefined, and Infinity
@@ -2403,48 +2436,17 @@ function compareAlphanumeric(aStr, bStr) {
2403
2436
  }
2404
2437
 
2405
2438
  return a.length - b.length;
2406
- } // The text filter is more basic (less numeric support)
2407
- // but is much faster
2408
-
2409
-
2410
- function text(rowA, rowB, columnId) {
2411
- return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
2412
- } // The text filter is more basic (less numeric support)
2413
- // but is much faster
2414
-
2415
-
2416
- function textCaseSensitive(rowA, rowB, columnId) {
2417
- return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
2418
- }
2419
-
2420
- function datetime(rowA, rowB, columnId) {
2421
- return compareBasic(rowA.getValue(columnId).getTime(), rowB.getValue(columnId).getTime());
2422
- }
2423
-
2424
- function basic(rowA, rowB, columnId) {
2425
- return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
2426
- } // Utils
2427
-
2428
-
2429
- function compareBasic(a, b) {
2430
- return a === b ? 0 : a > b ? 1 : -1;
2431
- }
2432
-
2433
- function toString(a) {
2434
- if (typeof a === 'number') {
2435
- if (isNaN(a) || a === Infinity || a === -Infinity) {
2436
- return '';
2437
- }
2439
+ } // Exports
2438
2440
 
2439
- return String(a);
2440
- }
2441
-
2442
- if (typeof a === 'string') {
2443
- return a;
2444
- }
2445
2441
 
2446
- return '';
2447
- }
2442
+ const sortingFns = {
2443
+ alphanumeric,
2444
+ alphanumericCaseSensitive,
2445
+ text,
2446
+ textCaseSensitive,
2447
+ datetime,
2448
+ basic
2449
+ };
2448
2450
 
2449
2451
  //
2450
2452
  const Sorting = {