@bexis2/bexis2-core-ui 0.4.99 → 0.4.100
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/README.md +7 -0
- package/dist/components/Table/TableContent.svelte +6 -102
- package/dist/components/Table/clientDB.js +1 -1
- package/dist/components/Table/tableWorker.js +1 -1
- package/dist/css/themes/theme-bexis2.css_old +100 -0
- package/dist/themes/theme-bexis2 copy.d.ts +2 -0
- package/dist/themes/theme-bexis2 copy.js +112 -0
- package/package.json +1 -1
- package/src/lib/components/Table/TableContent.svelte +7 -113
- package/src/lib/components/Table/clientDB.js +1 -1
- package/src/lib/components/Table/tableWorker.js +1 -1
- package/src/lib/css/themes/theme-bexis2.css_old +100 -0
- package/src/lib/themes/theme-bexis2 copy.ts +114 -0
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ const serverSide = server !== void 0 || clientDb;
|
|
|
68
68
|
let _clientDbInstance = null;
|
|
69
69
|
let clientDbEnabled = clientDb;
|
|
70
70
|
let clientDbReady = false;
|
|
71
|
+
let clientDbInitPromise = null;
|
|
71
72
|
let clientDbInitSource = [];
|
|
72
73
|
let clientDbSeedSize = 0;
|
|
73
74
|
const { sendModel = new Send() } = server ?? {};
|
|
@@ -298,6 +299,9 @@ const sortServer = (order, id) => {
|
|
|
298
299
|
const updateTableWithParams = async () => {
|
|
299
300
|
if (clientDbEnabled) {
|
|
300
301
|
isFetching = true;
|
|
302
|
+
if (!clientDbReady && clientDbInitPromise) {
|
|
303
|
+
await clientDbInitPromise;
|
|
304
|
+
}
|
|
301
305
|
const filtersNormalized = utils.normalizeFilters($filters);
|
|
302
306
|
const q = sendModel?.q || "";
|
|
303
307
|
const offset2 = $pageSize * $pageIndex;
|
|
@@ -305,106 +309,6 @@ const updateTableWithParams = async () => {
|
|
|
305
309
|
if (!_clientDbInstance) {
|
|
306
310
|
_clientDbInstance = new ClientDB(tableId);
|
|
307
311
|
}
|
|
308
|
-
if (!clientDbReady) {
|
|
309
|
-
const source = clientDbInitSource.length > 0 ? clientDbInitSource : $data;
|
|
310
|
-
const getValue = (row, column) => {
|
|
311
|
-
const dot = String(column || "").replaceAll("%%%", ".");
|
|
312
|
-
return row[dot] ?? row[column] ?? row[dot.replaceAll(".", "%%%")];
|
|
313
|
-
};
|
|
314
|
-
const localMatches = (row) => {
|
|
315
|
-
if (q && q.length > 0) {
|
|
316
|
-
const ql = String(q).toLowerCase();
|
|
317
|
-
let found = false;
|
|
318
|
-
for (const k in row) {
|
|
319
|
-
const v = row[k];
|
|
320
|
-
if (v == null) continue;
|
|
321
|
-
if (String(v).toLowerCase().includes(ql)) {
|
|
322
|
-
found = true;
|
|
323
|
-
break;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
if (!found) return false;
|
|
327
|
-
}
|
|
328
|
-
for (const f of filtersNormalized) {
|
|
329
|
-
const actual = getValue(row, f.column);
|
|
330
|
-
const val = f.value;
|
|
331
|
-
if (val == null) continue;
|
|
332
|
-
const aStr = String(actual ?? "").toLowerCase();
|
|
333
|
-
const vStr = String(val ?? "").toLowerCase();
|
|
334
|
-
const aNum = Number(actual);
|
|
335
|
-
const vNum = Number(val);
|
|
336
|
-
const aDate = new Date(actual).getTime();
|
|
337
|
-
const vDate = new Date(val).getTime();
|
|
338
|
-
switch (f.filterBy) {
|
|
339
|
-
case "c":
|
|
340
|
-
if (!aStr.includes(vStr)) return false;
|
|
341
|
-
break;
|
|
342
|
-
case "nc":
|
|
343
|
-
if (aStr.includes(vStr)) return false;
|
|
344
|
-
break;
|
|
345
|
-
case "sw":
|
|
346
|
-
if (!aStr.startsWith(vStr)) return false;
|
|
347
|
-
break;
|
|
348
|
-
case "ew":
|
|
349
|
-
if (!aStr.endsWith(vStr)) return false;
|
|
350
|
-
break;
|
|
351
|
-
case "e":
|
|
352
|
-
if (actual != val) return false;
|
|
353
|
-
break;
|
|
354
|
-
case "ne":
|
|
355
|
-
if (actual == val) return false;
|
|
356
|
-
break;
|
|
357
|
-
case "gt":
|
|
358
|
-
if (Number.isNaN(aNum) || Number.isNaN(vNum) || !(aNum > vNum)) return false;
|
|
359
|
-
break;
|
|
360
|
-
case "lt":
|
|
361
|
-
if (Number.isNaN(aNum) || Number.isNaN(vNum) || !(aNum < vNum)) return false;
|
|
362
|
-
break;
|
|
363
|
-
case "gte":
|
|
364
|
-
if (Number.isNaN(aNum) || Number.isNaN(vNum) || !(aNum >= vNum)) return false;
|
|
365
|
-
break;
|
|
366
|
-
case "lte":
|
|
367
|
-
if (Number.isNaN(aNum) || Number.isNaN(vNum) || !(aNum <= vNum)) return false;
|
|
368
|
-
break;
|
|
369
|
-
case "o":
|
|
370
|
-
if (Number.isNaN(aDate) || Number.isNaN(vDate) || aDate !== vDate) return false;
|
|
371
|
-
break;
|
|
372
|
-
case "sf":
|
|
373
|
-
case "a":
|
|
374
|
-
if (Number.isNaN(aDate) || Number.isNaN(vDate) || !(aDate >= vDate)) return false;
|
|
375
|
-
break;
|
|
376
|
-
case "u":
|
|
377
|
-
case "b":
|
|
378
|
-
if (Number.isNaN(aDate) || Number.isNaN(vDate) || !(aDate <= vDate)) return false;
|
|
379
|
-
break;
|
|
380
|
-
case "no":
|
|
381
|
-
if (Number.isNaN(aDate) || Number.isNaN(vDate) || aDate === vDate) return false;
|
|
382
|
-
break;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
return true;
|
|
386
|
-
};
|
|
387
|
-
const filtered = source.filter(localMatches);
|
|
388
|
-
const order = sendModel?.order || [];
|
|
389
|
-
if (order.length > 0) {
|
|
390
|
-
const { column, direction } = order[0];
|
|
391
|
-
const dir = direction === "desc" ? -1 : 1;
|
|
392
|
-
filtered.sort((a, b) => {
|
|
393
|
-
const av = getValue(a, column);
|
|
394
|
-
const bv = getValue(b, column);
|
|
395
|
-
if (av == null && bv == null) return 0;
|
|
396
|
-
if (av == null) return -1 * dir;
|
|
397
|
-
if (bv == null) return 1 * dir;
|
|
398
|
-
if (typeof av === "number" && typeof bv === "number") return (av - bv) * dir;
|
|
399
|
-
return String(av).localeCompare(String(bv)) * dir;
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
const localRows = filtered.slice(offset2, offset2 + limit);
|
|
403
|
-
serverItems?.set(filtered.length);
|
|
404
|
-
data.set(localRows);
|
|
405
|
-
isFetching = false;
|
|
406
|
-
return { rows: localRows, total: filtered.length };
|
|
407
|
-
}
|
|
408
312
|
const res = await _clientDbInstance.query({
|
|
409
313
|
q,
|
|
410
314
|
filters: filtersNormalized,
|
|
@@ -516,10 +420,10 @@ onMount(async () => {
|
|
|
516
420
|
serverItems?.set(clientDbInitSource.length);
|
|
517
421
|
data.set(firstPage);
|
|
518
422
|
_clientDbInstance = new ClientDB(tableId);
|
|
519
|
-
_clientDbInstance.init(clientDbInitSource).then(async () => {
|
|
520
|
-
const result = await updateTableWithParams();
|
|
423
|
+
clientDbInitPromise = _clientDbInstance.init(clientDbInitSource).then(async () => {
|
|
521
424
|
clientDbReady = true;
|
|
522
425
|
clientDbInitSource = [];
|
|
426
|
+
const result = await updateTableWithParams();
|
|
523
427
|
return result;
|
|
524
428
|
}).catch(() => {
|
|
525
429
|
clientDbReady = false;
|
|
@@ -3,7 +3,7 @@ const DB_PREFIX = 'table-db-';
|
|
|
3
3
|
|
|
4
4
|
function openDB(name) {
|
|
5
5
|
return new Promise((resolve, reject) => {
|
|
6
|
-
const req = indexedDB.open(DB_PREFIX + name
|
|
6
|
+
const req = indexedDB.open(DB_PREFIX + name);
|
|
7
7
|
req.onupgradeneeded = () => {
|
|
8
8
|
const db = req.result;
|
|
9
9
|
if (!db.objectStoreNames.contains('rows')) {
|
|
@@ -4,7 +4,7 @@ const DB_PREFIX = 'table-db-';
|
|
|
4
4
|
|
|
5
5
|
function openDB(name) {
|
|
6
6
|
return new Promise((resolve, reject) => {
|
|
7
|
-
const req = indexedDB.open(DB_PREFIX + name
|
|
7
|
+
const req = indexedDB.open(DB_PREFIX + name);
|
|
8
8
|
req.onupgradeneeded = () => {
|
|
9
9
|
const db = req.result;
|
|
10
10
|
if (!db.objectStoreNames.contains('rows')) {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
[data-theme='bexis2theme'] {
|
|
2
|
+
/* =~= Theme Properties =~= */
|
|
3
|
+
--base-font-family: system-ui;
|
|
4
|
+
--base-font-color: var(--color-surface-900);
|
|
5
|
+
--base-font-color-dark: 255 255 255;
|
|
6
|
+
/*--theme-rounded-base: 4px;
|
|
7
|
+
--theme-rounded-container: 4px;
|
|
8
|
+
--theme-border-base: 1px;*/
|
|
9
|
+
--radius-base: 4px;
|
|
10
|
+
--radius-container: 4px;
|
|
11
|
+
--default-border-width: 1px;
|
|
12
|
+
--default-divide-width: 1px;
|
|
13
|
+
--default-ring-width: 1px;
|
|
14
|
+
/* =~= Theme On-X Colors =~= */
|
|
15
|
+
--on-primary: 255 255 255;
|
|
16
|
+
--on-secondary: 255 255 255;
|
|
17
|
+
--on-tertiary: 0 0 0;
|
|
18
|
+
--on-success: 255 255 255;
|
|
19
|
+
--on-warning: 255 255 255;
|
|
20
|
+
--on-error: 255 255 255;
|
|
21
|
+
--on-surface: 0 0 0;
|
|
22
|
+
/* =~= Theme Colors =~= */
|
|
23
|
+
/* primary | #45b2a1 */
|
|
24
|
+
--color-primary-50: #e3f3f1;
|
|
25
|
+
--color-primary-100: #daf0ec;
|
|
26
|
+
--color-primary-200: #d1ece8;
|
|
27
|
+
--color-primary-300: #b5e0d9;
|
|
28
|
+
--color-primary-400: #7dc9bd;
|
|
29
|
+
--color-primary-500: #45b2a1;
|
|
30
|
+
--color-primary-600: #3ea091;
|
|
31
|
+
--color-primary-700: #348679;
|
|
32
|
+
--color-primary-800: #296b61;
|
|
33
|
+
--color-primary-900: #22574f;
|
|
34
|
+
/* secondary | #ff9700 */
|
|
35
|
+
--color-secondary-50: #ffefd9;
|
|
36
|
+
--color-secondary-100: #ffeacc;
|
|
37
|
+
--color-secondary-200: #ffe5bf;
|
|
38
|
+
--color-secondary-300: #ffd599;
|
|
39
|
+
--color-secondary-400: #ffb64d;
|
|
40
|
+
--color-secondary-500: #ff9700;
|
|
41
|
+
--color-secondary-600: #e68800;
|
|
42
|
+
--color-secondary-700: #bf7100;
|
|
43
|
+
--color-secondary-800: #995b00;
|
|
44
|
+
--color-secondary-900: #7d4a00;
|
|
45
|
+
/* tertiary | #bee1da */
|
|
46
|
+
--color-tertiary-50: #f5fbf9;
|
|
47
|
+
--color-tertiary-100: #f2f9f8;
|
|
48
|
+
--color-tertiary-200: #eff8f6;
|
|
49
|
+
--color-tertiary-300: #e5f3f0;
|
|
50
|
+
--color-tertiary-400: #d2eae5;
|
|
51
|
+
--color-tertiary-500: #bee1da;
|
|
52
|
+
--color-tertiary-600: #abcbc4;
|
|
53
|
+
--color-tertiary-700: #8fa9a4;
|
|
54
|
+
--color-tertiary-800: #728783;
|
|
55
|
+
--color-tertiary-900: #5d6e6b;
|
|
56
|
+
/* success | #4BB543 */
|
|
57
|
+
--color-success-50: #e4f4e3;
|
|
58
|
+
--color-success-100: #dbf0d9;
|
|
59
|
+
--color-success-200: #d2edd0;
|
|
60
|
+
--color-success-300: #b7e1b4;
|
|
61
|
+
--color-success-400: #81cb7b;
|
|
62
|
+
--color-success-500: #4bb543;
|
|
63
|
+
--color-success-600: #44a33c;
|
|
64
|
+
--color-success-700: #388832;
|
|
65
|
+
--color-success-800: #2d6d28;
|
|
66
|
+
--color-success-900: #255921;
|
|
67
|
+
/* warning | #EAB308 */
|
|
68
|
+
--color-warning-50: #fcf4da;
|
|
69
|
+
--color-warning-100: #fbf0ce;
|
|
70
|
+
--color-warning-200: #faecc1;
|
|
71
|
+
--color-warning-300: #f7e19c;
|
|
72
|
+
--color-warning-400: #f0ca52;
|
|
73
|
+
--color-warning-500: #eab308;
|
|
74
|
+
--color-warning-600: #d3a107;
|
|
75
|
+
--color-warning-700: #b08606;
|
|
76
|
+
--color-warning-800: #8c6b05;
|
|
77
|
+
--color-warning-900: #735804;
|
|
78
|
+
/* error | #FF0000 */
|
|
79
|
+
--color-error-50: #ffd9d9;
|
|
80
|
+
--color-error-100: #ffcccc;
|
|
81
|
+
--color-error-200: #ffbfbf;
|
|
82
|
+
--color-error-300: #ff9999;
|
|
83
|
+
--color-error-400: #ff4d4d;
|
|
84
|
+
--color-error-500: #ff0000;
|
|
85
|
+
--color-error-600: #e60000;
|
|
86
|
+
--color-error-700: #bf0000;
|
|
87
|
+
--color-error-800: #990000;
|
|
88
|
+
--color-error-900: #7d0000;
|
|
89
|
+
/* surface | #c7c7c7 */
|
|
90
|
+
--color-surface-50: #f7f7f7;
|
|
91
|
+
--color-surface-100: #f4f4f4;
|
|
92
|
+
--color-surface-200: #f1f1f1;
|
|
93
|
+
--color-surface-300: #e9e9e9;
|
|
94
|
+
--color-surface-400: #d8d8d8;
|
|
95
|
+
--color-surface-500: #c7c7c7;
|
|
96
|
+
--color-surface-600: #b3b3b3;
|
|
97
|
+
--color-surface-700: #959595;
|
|
98
|
+
--color-surface-800: #777777;
|
|
99
|
+
--color-surface-900: #626262;
|
|
100
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export const bexis2theme = {
|
|
2
|
+
name: 'bexis2theme',
|
|
3
|
+
properties: {
|
|
4
|
+
// =~= Theme Properties =~=
|
|
5
|
+
'--theme-font-family-base': `system-ui`,
|
|
6
|
+
'--theme-font-family-heading': `system-ui`,
|
|
7
|
+
'--theme-font-color-base': 'var(--color-surface-900)',
|
|
8
|
+
'--theme-font-color-dark': '#ffffff',
|
|
9
|
+
'--theme-rounded-base': '4px',
|
|
10
|
+
'--theme-rounded-container': '4px',
|
|
11
|
+
'--theme-border-base': '1px',
|
|
12
|
+
// =~= Theme On-X Colors =~=
|
|
13
|
+
'--on-primary': '255 255 255',
|
|
14
|
+
'--on-secondary': '255 255 255',
|
|
15
|
+
'--on-tertiary': '0 0 0',
|
|
16
|
+
'--on-success': '255 255 255',
|
|
17
|
+
'--on-warning': '255 255 255',
|
|
18
|
+
'--on-error': '255 255 255',
|
|
19
|
+
'--on-surface': '255 255 255',
|
|
20
|
+
// =~= Theme Colors =~=
|
|
21
|
+
// primary | #45b2a1
|
|
22
|
+
'--color-primary-50': '#e3f3f1',
|
|
23
|
+
'--color-primary-100': '#daf0ec',
|
|
24
|
+
'--color-primary-200': '#d1ece8',
|
|
25
|
+
'--color-primary-300': '#b5e0d9',
|
|
26
|
+
'--color-primary-400': '#7dc9bd',
|
|
27
|
+
'--color-primary-500': '#45b2a1',
|
|
28
|
+
'--color-primary-600': '#3ea091',
|
|
29
|
+
'--color-primary-700': '#348679',
|
|
30
|
+
'--color-primary-800': '#296b61',
|
|
31
|
+
'--color-primary-900': '#22574f',
|
|
32
|
+
// secondary | #ff9700
|
|
33
|
+
'--color-secondary-50': '#ffefd9',
|
|
34
|
+
'--color-secondary-100': '#ffeacc',
|
|
35
|
+
'--color-secondary-200': '#ffe5bf',
|
|
36
|
+
'--color-secondary-300': '#ffd599',
|
|
37
|
+
'--color-secondary-400': '#ffb64d',
|
|
38
|
+
'--color-secondary-500': '#ff9700',
|
|
39
|
+
'--color-secondary-600': '#e68800',
|
|
40
|
+
'--color-secondary-700': '#bf7100',
|
|
41
|
+
'--color-secondary-800': '#995b00',
|
|
42
|
+
'--color-secondary-900': '#7d4a00',
|
|
43
|
+
// tertiary | #bee1da
|
|
44
|
+
'--color-tertiary-50': '#f5fbf9',
|
|
45
|
+
'--color-tertiary-100': '#f2f9f8',
|
|
46
|
+
'--color-tertiary-200': '#eff8f6',
|
|
47
|
+
'--color-tertiary-300': '#e5f3f0',
|
|
48
|
+
'--color-tertiary-400': '#d2eae5',
|
|
49
|
+
'--color-tertiary-500': '#bee1da',
|
|
50
|
+
'--color-tertiary-600': '#abcbc4',
|
|
51
|
+
'--color-tertiary-700': '#8fa9a4',
|
|
52
|
+
'--color-tertiary-800': '#728783',
|
|
53
|
+
'--color-tertiary-900': '#5d6e6b',
|
|
54
|
+
// success | #4BB543
|
|
55
|
+
'--color-success-50': '#e4f4e3',
|
|
56
|
+
'--color-success-100': '#dbf0d9',
|
|
57
|
+
'--color-success-200': '#d2edd0',
|
|
58
|
+
'--color-success-300': '#b7e1b4',
|
|
59
|
+
'--color-success-400': '#81cb7b',
|
|
60
|
+
'--color-success-500': '#4bb543',
|
|
61
|
+
'--color-success-600': '#44a33c',
|
|
62
|
+
'--color-success-700': '#388832',
|
|
63
|
+
'--color-success-800': '#2d6d28',
|
|
64
|
+
'--color-success-900': '#255921',
|
|
65
|
+
// warning | #EAB308
|
|
66
|
+
'--color-warning-50': '#fcf4da',
|
|
67
|
+
'--color-warning-100': '#fbf0ce',
|
|
68
|
+
'--color-warning-200': '#faecc1',
|
|
69
|
+
'--color-warning-300': '#f7e19c',
|
|
70
|
+
'--color-warning-400': '#f0ca52',
|
|
71
|
+
'--color-warning-500': '#eab308',
|
|
72
|
+
'--color-warning-600': '#d3a107',
|
|
73
|
+
'--color-warning-700': '#b08606',
|
|
74
|
+
'--color-warning-800': '#8c6b05',
|
|
75
|
+
'--color-warning-900': '#735804',
|
|
76
|
+
// error | #FF0000
|
|
77
|
+
'--color-error-50': '#ffd9d9',
|
|
78
|
+
'--color-error-100': '#ffcccc',
|
|
79
|
+
'--color-error-200': '#ffbfbf',
|
|
80
|
+
'--color-error-300': '#ff9999',
|
|
81
|
+
'--color-error-400': '#ff4d4d',
|
|
82
|
+
'--color-error-500': '#ff0000',
|
|
83
|
+
'--color-error-600': '#e60000',
|
|
84
|
+
'--color-error-700': '#bf0000',
|
|
85
|
+
'--color-error-800': '#990000',
|
|
86
|
+
'--color-error-900': '#7d0000',
|
|
87
|
+
// surface | #c7c7c7
|
|
88
|
+
'--color-surface-50': '#f7f7f7',
|
|
89
|
+
'--color-surface-100': '#f4f4f4',
|
|
90
|
+
'--color-surface-200': '#f1f1f1',
|
|
91
|
+
'--color-surface-300': '#e9e9e9',
|
|
92
|
+
'--color-surface-400': '#d8d8d8',
|
|
93
|
+
'--color-surface-500': '#c7c7c7',
|
|
94
|
+
'--color-surface-600': '#b3b3b3',
|
|
95
|
+
'--color-surface-700': '#959595',
|
|
96
|
+
'--color-surface-800': '#777777',
|
|
97
|
+
'--color-surface-900': '#626262'
|
|
98
|
+
},
|
|
99
|
+
properties_dark: {
|
|
100
|
+
// surface | #2e2e2e
|
|
101
|
+
'--color-surface-50': '#e0e0e0',
|
|
102
|
+
'--color-surface-100': '#d5d5d5',
|
|
103
|
+
'--color-surface-200': '#cbcbcb',
|
|
104
|
+
'--color-surface-300': '#ababab',
|
|
105
|
+
'--color-surface-400': '#6d6d6d',
|
|
106
|
+
'--color-surface-500': '#2e2e2e',
|
|
107
|
+
'--color-surface-600': '#292929',
|
|
108
|
+
'--color-surface-700': '#232323',
|
|
109
|
+
'--color-surface-800': '#1c1c1c',
|
|
110
|
+
'--color-surface-900': '#171717'
|
|
111
|
+
}
|
|
112
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bexis2/bexis2-core-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.100",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).",
|
|
6
6
|
"keywords": [
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
let _clientDbInstance: any = null;
|
|
68
68
|
let clientDbEnabled = clientDb;
|
|
69
69
|
let clientDbReady = false;
|
|
70
|
+
let clientDbInitPromise: Promise<any> | null = null;
|
|
70
71
|
let clientDbInitSource: any[] = [];
|
|
71
72
|
let clientDbSeedSize = 0;
|
|
72
73
|
const { sendModel = new Send() } = server ?? {};
|
|
@@ -367,6 +368,9 @@
|
|
|
367
368
|
// If we're using a client-side DB (worker + IndexedDB), route queries there
|
|
368
369
|
if (clientDbEnabled) {
|
|
369
370
|
isFetching = true;
|
|
371
|
+
if (!clientDbReady && clientDbInitPromise) {
|
|
372
|
+
await clientDbInitPromise;
|
|
373
|
+
}
|
|
370
374
|
const filtersNormalized = utils.normalizeFilters($filters);
|
|
371
375
|
const q = sendModel?.q || '';
|
|
372
376
|
const offset = $pageSize * $pageIndex;
|
|
@@ -376,116 +380,6 @@
|
|
|
376
380
|
_clientDbInstance = new ClientDB(tableId);
|
|
377
381
|
}
|
|
378
382
|
|
|
379
|
-
if (!clientDbReady) {
|
|
380
|
-
// Fallback while DB is still importing: apply local search/filter/sort for responsiveness.
|
|
381
|
-
const source = clientDbInitSource.length > 0 ? clientDbInitSource : $data;
|
|
382
|
-
|
|
383
|
-
const getValue = (row, column) => {
|
|
384
|
-
const dot = String(column || '').replaceAll('%%%', '.');
|
|
385
|
-
return row[dot] ?? row[column] ?? row[dot.replaceAll('.', '%%%')];
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
const localMatches = (row) => {
|
|
389
|
-
if (q && q.length > 0) {
|
|
390
|
-
const ql = String(q).toLowerCase();
|
|
391
|
-
let found = false;
|
|
392
|
-
for (const k in row) {
|
|
393
|
-
const v = row[k];
|
|
394
|
-
if (v == null) continue;
|
|
395
|
-
if (String(v).toLowerCase().includes(ql)) {
|
|
396
|
-
found = true;
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
if (!found) return false;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
for (const f of filtersNormalized) {
|
|
404
|
-
const actual = getValue(row, f.column);
|
|
405
|
-
const val = f.value;
|
|
406
|
-
if (val == null) continue;
|
|
407
|
-
|
|
408
|
-
const aStr = String(actual ?? '').toLowerCase();
|
|
409
|
-
const vStr = String(val ?? '').toLowerCase();
|
|
410
|
-
const aNum = Number(actual);
|
|
411
|
-
const vNum = Number(val);
|
|
412
|
-
const aDate = new Date(actual as any).getTime();
|
|
413
|
-
const vDate = new Date(val as any).getTime();
|
|
414
|
-
|
|
415
|
-
switch (f.filterBy) {
|
|
416
|
-
case 'c':
|
|
417
|
-
if (!aStr.includes(vStr)) return false;
|
|
418
|
-
break;
|
|
419
|
-
case 'nc':
|
|
420
|
-
if (aStr.includes(vStr)) return false;
|
|
421
|
-
break;
|
|
422
|
-
case 'sw':
|
|
423
|
-
if (!aStr.startsWith(vStr)) return false;
|
|
424
|
-
break;
|
|
425
|
-
case 'ew':
|
|
426
|
-
if (!aStr.endsWith(vStr)) return false;
|
|
427
|
-
break;
|
|
428
|
-
case 'e':
|
|
429
|
-
if (actual != val) return false;
|
|
430
|
-
break;
|
|
431
|
-
case 'ne':
|
|
432
|
-
if (actual == val) return false;
|
|
433
|
-
break;
|
|
434
|
-
case 'gt':
|
|
435
|
-
if (Number.isNaN(aNum) || Number.isNaN(vNum) || !(aNum > vNum)) return false;
|
|
436
|
-
break;
|
|
437
|
-
case 'lt':
|
|
438
|
-
if (Number.isNaN(aNum) || Number.isNaN(vNum) || !(aNum < vNum)) return false;
|
|
439
|
-
break;
|
|
440
|
-
case 'gte':
|
|
441
|
-
if (Number.isNaN(aNum) || Number.isNaN(vNum) || !(aNum >= vNum)) return false;
|
|
442
|
-
break;
|
|
443
|
-
case 'lte':
|
|
444
|
-
if (Number.isNaN(aNum) || Number.isNaN(vNum) || !(aNum <= vNum)) return false;
|
|
445
|
-
break;
|
|
446
|
-
case 'o':
|
|
447
|
-
if (Number.isNaN(aDate) || Number.isNaN(vDate) || aDate !== vDate) return false;
|
|
448
|
-
break;
|
|
449
|
-
case 'sf':
|
|
450
|
-
case 'a':
|
|
451
|
-
if (Number.isNaN(aDate) || Number.isNaN(vDate) || !(aDate >= vDate)) return false;
|
|
452
|
-
break;
|
|
453
|
-
case 'u':
|
|
454
|
-
case 'b':
|
|
455
|
-
if (Number.isNaN(aDate) || Number.isNaN(vDate) || !(aDate <= vDate)) return false;
|
|
456
|
-
break;
|
|
457
|
-
case 'no':
|
|
458
|
-
if (Number.isNaN(aDate) || Number.isNaN(vDate) || aDate === vDate) return false;
|
|
459
|
-
break;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
return true;
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
const filtered = source.filter(localMatches);
|
|
467
|
-
const order = sendModel?.order || [];
|
|
468
|
-
if (order.length > 0) {
|
|
469
|
-
const { column, direction } = order[0];
|
|
470
|
-
const dir = direction === 'desc' ? -1 : 1;
|
|
471
|
-
filtered.sort((a, b) => {
|
|
472
|
-
const av = getValue(a, column);
|
|
473
|
-
const bv = getValue(b, column);
|
|
474
|
-
if (av == null && bv == null) return 0;
|
|
475
|
-
if (av == null) return -1 * dir;
|
|
476
|
-
if (bv == null) return 1 * dir;
|
|
477
|
-
if (typeof av === 'number' && typeof bv === 'number') return (av - bv) * dir;
|
|
478
|
-
return String(av).localeCompare(String(bv)) * dir;
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
const localRows = filtered.slice(offset, offset + limit);
|
|
483
|
-
serverItems?.set(filtered.length);
|
|
484
|
-
data.set(localRows);
|
|
485
|
-
isFetching = false;
|
|
486
|
-
return { rows: localRows, total: filtered.length };
|
|
487
|
-
}
|
|
488
|
-
|
|
489
383
|
const res = await _clientDbInstance.query({
|
|
490
384
|
q,
|
|
491
385
|
filters: filtersNormalized,
|
|
@@ -626,13 +520,13 @@
|
|
|
626
520
|
data.set(firstPage);
|
|
627
521
|
|
|
628
522
|
_clientDbInstance = new ClientDB(tableId);
|
|
629
|
-
_clientDbInstance
|
|
523
|
+
clientDbInitPromise = _clientDbInstance
|
|
630
524
|
.init(clientDbInitSource)
|
|
631
525
|
.then(async () => {
|
|
632
|
-
// Only mark ready and release seed after the first DB-backed query succeeds.
|
|
633
|
-
const result = await updateTableWithParams();
|
|
634
526
|
clientDbReady = true;
|
|
527
|
+
// Release the seed before refreshing so paging and filtering always query IndexedDB.
|
|
635
528
|
clientDbInitSource = [];
|
|
529
|
+
const result = await updateTableWithParams();
|
|
636
530
|
return result;
|
|
637
531
|
})
|
|
638
532
|
.catch(() => {
|
|
@@ -3,7 +3,7 @@ const DB_PREFIX = 'table-db-';
|
|
|
3
3
|
|
|
4
4
|
function openDB(name) {
|
|
5
5
|
return new Promise((resolve, reject) => {
|
|
6
|
-
const req = indexedDB.open(DB_PREFIX + name
|
|
6
|
+
const req = indexedDB.open(DB_PREFIX + name);
|
|
7
7
|
req.onupgradeneeded = () => {
|
|
8
8
|
const db = req.result;
|
|
9
9
|
if (!db.objectStoreNames.contains('rows')) {
|
|
@@ -4,7 +4,7 @@ const DB_PREFIX = 'table-db-';
|
|
|
4
4
|
|
|
5
5
|
function openDB(name) {
|
|
6
6
|
return new Promise((resolve, reject) => {
|
|
7
|
-
const req = indexedDB.open(DB_PREFIX + name
|
|
7
|
+
const req = indexedDB.open(DB_PREFIX + name);
|
|
8
8
|
req.onupgradeneeded = () => {
|
|
9
9
|
const db = req.result;
|
|
10
10
|
if (!db.objectStoreNames.contains('rows')) {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
[data-theme='bexis2theme'] {
|
|
2
|
+
/* =~= Theme Properties =~= */
|
|
3
|
+
--base-font-family: system-ui;
|
|
4
|
+
--base-font-color: var(--color-surface-900);
|
|
5
|
+
--base-font-color-dark: 255 255 255;
|
|
6
|
+
/*--theme-rounded-base: 4px;
|
|
7
|
+
--theme-rounded-container: 4px;
|
|
8
|
+
--theme-border-base: 1px;*/
|
|
9
|
+
--radius-base: 4px;
|
|
10
|
+
--radius-container: 4px;
|
|
11
|
+
--default-border-width: 1px;
|
|
12
|
+
--default-divide-width: 1px;
|
|
13
|
+
--default-ring-width: 1px;
|
|
14
|
+
/* =~= Theme On-X Colors =~= */
|
|
15
|
+
--on-primary: 255 255 255;
|
|
16
|
+
--on-secondary: 255 255 255;
|
|
17
|
+
--on-tertiary: 0 0 0;
|
|
18
|
+
--on-success: 255 255 255;
|
|
19
|
+
--on-warning: 255 255 255;
|
|
20
|
+
--on-error: 255 255 255;
|
|
21
|
+
--on-surface: 0 0 0;
|
|
22
|
+
/* =~= Theme Colors =~= */
|
|
23
|
+
/* primary | #45b2a1 */
|
|
24
|
+
--color-primary-50: #e3f3f1;
|
|
25
|
+
--color-primary-100: #daf0ec;
|
|
26
|
+
--color-primary-200: #d1ece8;
|
|
27
|
+
--color-primary-300: #b5e0d9;
|
|
28
|
+
--color-primary-400: #7dc9bd;
|
|
29
|
+
--color-primary-500: #45b2a1;
|
|
30
|
+
--color-primary-600: #3ea091;
|
|
31
|
+
--color-primary-700: #348679;
|
|
32
|
+
--color-primary-800: #296b61;
|
|
33
|
+
--color-primary-900: #22574f;
|
|
34
|
+
/* secondary | #ff9700 */
|
|
35
|
+
--color-secondary-50: #ffefd9;
|
|
36
|
+
--color-secondary-100: #ffeacc;
|
|
37
|
+
--color-secondary-200: #ffe5bf;
|
|
38
|
+
--color-secondary-300: #ffd599;
|
|
39
|
+
--color-secondary-400: #ffb64d;
|
|
40
|
+
--color-secondary-500: #ff9700;
|
|
41
|
+
--color-secondary-600: #e68800;
|
|
42
|
+
--color-secondary-700: #bf7100;
|
|
43
|
+
--color-secondary-800: #995b00;
|
|
44
|
+
--color-secondary-900: #7d4a00;
|
|
45
|
+
/* tertiary | #bee1da */
|
|
46
|
+
--color-tertiary-50: #f5fbf9;
|
|
47
|
+
--color-tertiary-100: #f2f9f8;
|
|
48
|
+
--color-tertiary-200: #eff8f6;
|
|
49
|
+
--color-tertiary-300: #e5f3f0;
|
|
50
|
+
--color-tertiary-400: #d2eae5;
|
|
51
|
+
--color-tertiary-500: #bee1da;
|
|
52
|
+
--color-tertiary-600: #abcbc4;
|
|
53
|
+
--color-tertiary-700: #8fa9a4;
|
|
54
|
+
--color-tertiary-800: #728783;
|
|
55
|
+
--color-tertiary-900: #5d6e6b;
|
|
56
|
+
/* success | #4BB543 */
|
|
57
|
+
--color-success-50: #e4f4e3;
|
|
58
|
+
--color-success-100: #dbf0d9;
|
|
59
|
+
--color-success-200: #d2edd0;
|
|
60
|
+
--color-success-300: #b7e1b4;
|
|
61
|
+
--color-success-400: #81cb7b;
|
|
62
|
+
--color-success-500: #4bb543;
|
|
63
|
+
--color-success-600: #44a33c;
|
|
64
|
+
--color-success-700: #388832;
|
|
65
|
+
--color-success-800: #2d6d28;
|
|
66
|
+
--color-success-900: #255921;
|
|
67
|
+
/* warning | #EAB308 */
|
|
68
|
+
--color-warning-50: #fcf4da;
|
|
69
|
+
--color-warning-100: #fbf0ce;
|
|
70
|
+
--color-warning-200: #faecc1;
|
|
71
|
+
--color-warning-300: #f7e19c;
|
|
72
|
+
--color-warning-400: #f0ca52;
|
|
73
|
+
--color-warning-500: #eab308;
|
|
74
|
+
--color-warning-600: #d3a107;
|
|
75
|
+
--color-warning-700: #b08606;
|
|
76
|
+
--color-warning-800: #8c6b05;
|
|
77
|
+
--color-warning-900: #735804;
|
|
78
|
+
/* error | #FF0000 */
|
|
79
|
+
--color-error-50: #ffd9d9;
|
|
80
|
+
--color-error-100: #ffcccc;
|
|
81
|
+
--color-error-200: #ffbfbf;
|
|
82
|
+
--color-error-300: #ff9999;
|
|
83
|
+
--color-error-400: #ff4d4d;
|
|
84
|
+
--color-error-500: #ff0000;
|
|
85
|
+
--color-error-600: #e60000;
|
|
86
|
+
--color-error-700: #bf0000;
|
|
87
|
+
--color-error-800: #990000;
|
|
88
|
+
--color-error-900: #7d0000;
|
|
89
|
+
/* surface | #c7c7c7 */
|
|
90
|
+
--color-surface-50: #f7f7f7;
|
|
91
|
+
--color-surface-100: #f4f4f4;
|
|
92
|
+
--color-surface-200: #f1f1f1;
|
|
93
|
+
--color-surface-300: #e9e9e9;
|
|
94
|
+
--color-surface-400: #d8d8d8;
|
|
95
|
+
--color-surface-500: #c7c7c7;
|
|
96
|
+
--color-surface-600: #b3b3b3;
|
|
97
|
+
--color-surface-700: #959595;
|
|
98
|
+
--color-surface-800: #777777;
|
|
99
|
+
--color-surface-900: #626262;
|
|
100
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { CustomThemeConfig } from '@skeletonlabs/tw-plugin';
|
|
2
|
+
|
|
3
|
+
export const bexis2theme: CustomThemeConfig = {
|
|
4
|
+
name: 'bexis2theme',
|
|
5
|
+
properties: {
|
|
6
|
+
// =~= Theme Properties =~=
|
|
7
|
+
'--theme-font-family-base': `system-ui`,
|
|
8
|
+
'--theme-font-family-heading': `system-ui`,
|
|
9
|
+
'--theme-font-color-base': 'var(--color-surface-900)',
|
|
10
|
+
'--theme-font-color-dark': '#ffffff',
|
|
11
|
+
'--theme-rounded-base': '4px',
|
|
12
|
+
'--theme-rounded-container': '4px',
|
|
13
|
+
'--theme-border-base': '1px',
|
|
14
|
+
// =~= Theme On-X Colors =~=
|
|
15
|
+
'--on-primary': '255 255 255',
|
|
16
|
+
'--on-secondary': '255 255 255',
|
|
17
|
+
'--on-tertiary': '0 0 0',
|
|
18
|
+
'--on-success': '255 255 255',
|
|
19
|
+
'--on-warning': '255 255 255',
|
|
20
|
+
'--on-error': '255 255 255',
|
|
21
|
+
'--on-surface': '255 255 255',
|
|
22
|
+
// =~= Theme Colors =~=
|
|
23
|
+
// primary | #45b2a1
|
|
24
|
+
'--color-primary-50': '#e3f3f1',
|
|
25
|
+
'--color-primary-100': '#daf0ec',
|
|
26
|
+
'--color-primary-200': '#d1ece8',
|
|
27
|
+
'--color-primary-300': '#b5e0d9',
|
|
28
|
+
'--color-primary-400': '#7dc9bd',
|
|
29
|
+
'--color-primary-500': '#45b2a1',
|
|
30
|
+
'--color-primary-600': '#3ea091',
|
|
31
|
+
'--color-primary-700': '#348679',
|
|
32
|
+
'--color-primary-800': '#296b61',
|
|
33
|
+
'--color-primary-900': '#22574f',
|
|
34
|
+
// secondary | #ff9700
|
|
35
|
+
'--color-secondary-50': '#ffefd9',
|
|
36
|
+
'--color-secondary-100': '#ffeacc',
|
|
37
|
+
'--color-secondary-200': '#ffe5bf',
|
|
38
|
+
'--color-secondary-300': '#ffd599',
|
|
39
|
+
'--color-secondary-400': '#ffb64d',
|
|
40
|
+
'--color-secondary-500': '#ff9700',
|
|
41
|
+
'--color-secondary-600': '#e68800',
|
|
42
|
+
'--color-secondary-700': '#bf7100',
|
|
43
|
+
'--color-secondary-800': '#995b00',
|
|
44
|
+
'--color-secondary-900': '#7d4a00',
|
|
45
|
+
// tertiary | #bee1da
|
|
46
|
+
'--color-tertiary-50': '#f5fbf9',
|
|
47
|
+
'--color-tertiary-100': '#f2f9f8',
|
|
48
|
+
'--color-tertiary-200': '#eff8f6',
|
|
49
|
+
'--color-tertiary-300': '#e5f3f0',
|
|
50
|
+
'--color-tertiary-400': '#d2eae5',
|
|
51
|
+
'--color-tertiary-500': '#bee1da',
|
|
52
|
+
'--color-tertiary-600': '#abcbc4',
|
|
53
|
+
'--color-tertiary-700': '#8fa9a4',
|
|
54
|
+
'--color-tertiary-800': '#728783',
|
|
55
|
+
'--color-tertiary-900': '#5d6e6b',
|
|
56
|
+
// success | #4BB543
|
|
57
|
+
'--color-success-50': '#e4f4e3',
|
|
58
|
+
'--color-success-100': '#dbf0d9',
|
|
59
|
+
'--color-success-200': '#d2edd0',
|
|
60
|
+
'--color-success-300': '#b7e1b4',
|
|
61
|
+
'--color-success-400': '#81cb7b',
|
|
62
|
+
'--color-success-500': '#4bb543',
|
|
63
|
+
'--color-success-600': '#44a33c',
|
|
64
|
+
'--color-success-700': '#388832',
|
|
65
|
+
'--color-success-800': '#2d6d28',
|
|
66
|
+
'--color-success-900': '#255921',
|
|
67
|
+
// warning | #EAB308
|
|
68
|
+
'--color-warning-50': '#fcf4da',
|
|
69
|
+
'--color-warning-100': '#fbf0ce',
|
|
70
|
+
'--color-warning-200': '#faecc1',
|
|
71
|
+
'--color-warning-300': '#f7e19c',
|
|
72
|
+
'--color-warning-400': '#f0ca52',
|
|
73
|
+
'--color-warning-500': '#eab308',
|
|
74
|
+
'--color-warning-600': '#d3a107',
|
|
75
|
+
'--color-warning-700': '#b08606',
|
|
76
|
+
'--color-warning-800': '#8c6b05',
|
|
77
|
+
'--color-warning-900': '#735804',
|
|
78
|
+
// error | #FF0000
|
|
79
|
+
'--color-error-50': '#ffd9d9',
|
|
80
|
+
'--color-error-100': '#ffcccc',
|
|
81
|
+
'--color-error-200': '#ffbfbf',
|
|
82
|
+
'--color-error-300': '#ff9999',
|
|
83
|
+
'--color-error-400': '#ff4d4d',
|
|
84
|
+
'--color-error-500': '#ff0000',
|
|
85
|
+
'--color-error-600': '#e60000',
|
|
86
|
+
'--color-error-700': '#bf0000',
|
|
87
|
+
'--color-error-800': '#990000',
|
|
88
|
+
'--color-error-900': '#7d0000',
|
|
89
|
+
// surface | #c7c7c7
|
|
90
|
+
'--color-surface-50': '#f7f7f7',
|
|
91
|
+
'--color-surface-100': '#f4f4f4',
|
|
92
|
+
'--color-surface-200': '#f1f1f1',
|
|
93
|
+
'--color-surface-300': '#e9e9e9',
|
|
94
|
+
'--color-surface-400': '#d8d8d8',
|
|
95
|
+
'--color-surface-500': '#c7c7c7',
|
|
96
|
+
'--color-surface-600': '#b3b3b3',
|
|
97
|
+
'--color-surface-700': '#959595',
|
|
98
|
+
'--color-surface-800': '#777777',
|
|
99
|
+
'--color-surface-900': '#626262'
|
|
100
|
+
},
|
|
101
|
+
properties_dark: {
|
|
102
|
+
// surface | #2e2e2e
|
|
103
|
+
'--color-surface-50': '#e0e0e0',
|
|
104
|
+
'--color-surface-100': '#d5d5d5',
|
|
105
|
+
'--color-surface-200': '#cbcbcb',
|
|
106
|
+
'--color-surface-300': '#ababab',
|
|
107
|
+
'--color-surface-400': '#6d6d6d',
|
|
108
|
+
'--color-surface-500': '#2e2e2e',
|
|
109
|
+
'--color-surface-600': '#292929',
|
|
110
|
+
'--color-surface-700': '#232323',
|
|
111
|
+
'--color-surface-800': '#1c1c1c',
|
|
112
|
+
'--color-surface-900': '#171717'
|
|
113
|
+
}
|
|
114
|
+
};
|