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