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