@lavalogic/scoria 0.15.0 → 0.16.0

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.
@@ -41,6 +41,9 @@
41
41
  alertContext.onOther();
42
42
  break;
43
43
  }
44
+ default: {
45
+ console.warn(`Uncaught command \`${value}\``);
46
+ }
44
47
  }
45
48
 
46
49
  return true;
@@ -41,7 +41,9 @@
41
41
  if (!menuEl) {
42
42
  return;
43
43
  }
44
- if (e.target === menuEl || menuEl.contains(e.target as Node)) return;
44
+ if (e.target === menuEl || menuEl.contains(e.target as Node)) {
45
+ return;
46
+ }
45
47
  contextMenuContext.closeMenu();
46
48
  }
47
49
  </script>
@@ -21,7 +21,9 @@
21
21
  });
22
22
 
23
23
  $effect(() => {
24
- if (!showModal && dialog) dialog.close();
24
+ if (!showModal && dialog) {
25
+ dialog.close();
26
+ }
25
27
  });
26
28
 
27
29
  function uncloseable(
@@ -130,7 +130,9 @@
130
130
  onkeydown={handleEsc}
131
131
  onclick={(e) => {
132
132
  if (e.target === dialog) {
133
- if (!mandatory) dialog.close();
133
+ if (!mandatory) {
134
+ dialog.close();
135
+ }
134
136
  }
135
137
  clearTimer();
136
138
  }}
@@ -1,6 +1,9 @@
1
1
  <svelte:options runes />
2
2
 
3
- <script lang="ts" generics="T extends object">
3
+ <script
4
+ lang="ts"
5
+ generics="T extends object"
6
+ >
4
7
  import { dev } from '$app/environment';
5
8
  import Action from '../../Action.svelte';
6
9
  import Button from '../../Button.svelte';
@@ -402,8 +405,10 @@
402
405
  case false: {
403
406
  return Ternary.False;
404
407
  }
408
+ default: {
409
+ return Ternary.Neutral;
410
+ }
405
411
  }
406
- return Ternary.Neutral;
407
412
  })()}
408
413
  <div class="centered">
409
414
  <ThreeStateRadio
@@ -459,7 +464,7 @@
459
464
  onkeydown={closeOnCtrlF}
460
465
  />
461
466
  </div>
462
- {:else if value == null || typeof value == 'string'}
467
+ {:else if value == null || typeof value == 'number'}
463
468
  <div class="input-wrapper right">
464
469
  {#if selectedNumberFilterType?.value == NumberDateFilterMode.null}
465
470
  <TextInput
@@ -470,19 +475,33 @@
470
475
  variant={InputVariant.Table}
471
476
  />
472
477
  {:else}
473
- <TextInput
478
+ <NumberInput
474
479
  data-type="quicksearch"
475
480
  id={inputId}
476
- bind:value={value as string | null}
477
- placeholder="Filter&hellip;"
481
+ bind:value={valueMin}
478
482
  variant={InputVariant.Table}
483
+ placeholder="Min&hellip;"
479
484
  oninput={() => {
480
- tableContext.paginationRepo?.filterBy(def.id, [value]);
485
+ tableContext.paginationRepo?.filterBy(def.id, [valueMin, null]);
481
486
  }}
482
487
  onkeydown={closeOnCtrlF}
483
488
  />
484
489
  {/if}
485
490
  </div>
491
+ {:else if typeof value == 'string'}
492
+ <div class="input-wrapper right">
493
+ <TextInput
494
+ data-type="quicksearch"
495
+ id={inputId}
496
+ bind:value={value as string | null}
497
+ placeholder="Filter&hellip;"
498
+ variant={InputVariant.Table}
499
+ oninput={() => {
500
+ tableContext.paginationRepo?.filterBy(def.id, [value]);
501
+ }}
502
+ onkeydown={closeOnCtrlF}
503
+ />
504
+ </div>
486
505
  {/if}
487
506
  {:else if value == null || typeof value == 'string'}
488
507
  <div class="input-wrapper right">
@@ -529,7 +548,7 @@
529
548
  icon={{
530
549
  name: 'filter-2',
531
550
  size: Size.MediumLarge,
532
- colour: Colour['$ui-blue-5']
551
+ colour: Colour['$ui-blue-5'],
533
552
  }}
534
553
  onclick={() => {
535
554
  if (!openedSelect) {
@@ -547,7 +566,10 @@
547
566
  {/if}
548
567
 
549
568
  {#if isSelectOpen}
550
- <div class="floating" transition:fade={{ easing: cubicOut, duration: 100 }}>
569
+ <div
570
+ class="floating"
571
+ transition:fade={{ easing: cubicOut, duration: 100 }}
572
+ >
551
573
  <div class="select-wrapper">
552
574
  {#if isNumeric}
553
575
  <SingleSelect
@@ -23,7 +23,9 @@
23
23
  return [item, index];
24
24
  }
25
25
  function togglePinLeft() {
26
- if (columnDef == null) return;
26
+ if (columnDef == null) {
27
+ return;
28
+ }
27
29
 
28
30
  tableContext.setColumnPinning((pinning) => {
29
31
  const leftPinIndex = pinning.left?.get(columnDef.id) ?? -1;
@@ -48,7 +50,9 @@
48
50
  }
49
51
 
50
52
  function togglePinRight() {
51
- if (columnDef == null) return;
53
+ if (columnDef == null) {
54
+ return;
55
+ }
52
56
 
53
57
  tableContext.setColumnPinning((pinning) => {
54
58
  const rightPinIndex = pinning.right?.get(columnDef.id) ?? -1;
@@ -210,6 +210,10 @@
210
210
  })
211
211
  .catch(devCatch);
212
212
  break;
213
+ default: {
214
+ //ignore other keys
215
+ break;
216
+ }
213
217
  }
214
218
  }
215
219
 
@@ -203,6 +203,10 @@
203
203
  })
204
204
  .catch(devCatch);
205
205
  break;
206
+ default: {
207
+ //ignore other keys
208
+ break;
209
+ }
206
210
  }
207
211
  }
208
212
 
@@ -1065,6 +1065,13 @@ export class TableContext {
1065
1065
  else {
1066
1066
  this.setFocusRight();
1067
1067
  }
1068
+ return;
1069
+ }
1070
+ default: {
1071
+ if (this.debug) {
1072
+ console.log(`handleKeystroke: ignoring key ${e.key}`);
1073
+ }
1074
+ break;
1068
1075
  }
1069
1076
  }
1070
1077
  if (this.allowCopy) {
@@ -1086,6 +1093,10 @@ export class TableContext {
1086
1093
  await this.copyDataToClipboard();
1087
1094
  }
1088
1095
  break;
1096
+ default: {
1097
+ //nothing
1098
+ break;
1099
+ }
1089
1100
  }
1090
1101
  }
1091
1102
  }
@@ -1438,8 +1449,9 @@ export class TableContext {
1438
1449
  }
1439
1450
  };
1440
1451
  moveToStart = () => {
1441
- if (!this.focusStart)
1452
+ if (!this.focusStart) {
1442
1453
  return;
1454
+ }
1443
1455
  const visibility = this.columnVisibility;
1444
1456
  const columnDefs = this.columnDefs;
1445
1457
  const current = this.focusStart.column;
@@ -43,6 +43,6 @@ export declare abstract class TableDataRepository<T extends object> implements I
43
43
  set forceRefresh(v: () => void);
44
44
  readonly registerRefreshMethod: (method: () => void) => void;
45
45
  protected getValueSet(values: Array<string | number | undefined>): Set<number>;
46
- static getValues(values: Array<string | number | undefined>): Array<number>;
46
+ static getValues(values: Array<string | number | null | undefined>): Array<number>;
47
47
  static getMinMax(values: Array<string | number | null | undefined>): number[] | undefined[];
48
48
  }
@@ -103,7 +103,9 @@
103
103
  onkeydown={handleEsc}
104
104
  onclick={(e) => {
105
105
  if (e.target === dialog) {
106
- if (!mandatory) dialog.close();
106
+ if (!mandatory) {
107
+ dialog.close();
108
+ }
107
109
  }
108
110
  clearTimer();
109
111
  }}
@@ -62,7 +62,7 @@ export function refWrapper(initial) {
62
62
  },
63
63
  set value(v) {
64
64
  value = v;
65
- }
65
+ },
66
66
  };
67
67
  }
68
68
  export function SQLFriendly(date) {
@@ -94,7 +94,7 @@ export const localTimeFormat = new Intl.DateTimeFormat('en-GB', {
94
94
  hourCycle: 'h23',
95
95
  minute: '2-digit',
96
96
  second: '2-digit',
97
- timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
97
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
98
98
  });
99
99
  export function passthrough(e) {
100
100
  if (!e.key.match(/^[a-zA-Z0-9[\]]$/gm)) {
@@ -212,7 +212,7 @@ export async function asyncSome(array, asyncCallback) {
212
212
  // empty promise is required here
213
213
  // because otherwise the first false would immediately end the race without checking the rest of the array
214
214
  promises.map(async (p) => (await p) || emptyPromise)),
215
- Promise.all(promises).then((r) => r.some(Boolean))
215
+ Promise.all(promises).then((r) => r.some(Boolean)),
216
216
  ]);
217
217
  }
218
218
  export async function asyncAll(array, asyncCallback) {
@@ -224,7 +224,7 @@ export async function asyncAll(array, asyncCallback) {
224
224
  // empty promise is required here
225
225
  // because otherwise the first false would immediately end the race without checking the rest of the array
226
226
  promises.map(async (p) => (await p) || emptyPromise)),
227
- Promise.all(promises).then((r) => r.every(Boolean))
227
+ Promise.all(promises).then((r) => r.every(Boolean)),
228
228
  ]);
229
229
  }
230
230
  export const asyncEvery = asyncAll;
@@ -2,4 +2,4 @@ import type { GridNumberItem } from './GridNumberItem.js';
2
2
  import type { GridSelectItem } from './GridSelectItem.js';
3
3
  import type { GridTextItem } from './GridTextItem.js';
4
4
  import type { ValueProp } from './Misc.js';
5
- export type GridItem<V extends object, VP extends ValueProp<V>> = GridTextItem | GridNumberItem | GridSelectItem<V, VP>;
5
+ export type GridItem<V extends object, VP extends ValueProp<V> = ValueProp<V>> = GridTextItem | GridNumberItem | GridSelectItem<V, VP>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lavalogic/scoria",
3
3
  "description": "Svelte components used for the FloWMS Web Frontend",
4
- "version": "0.15.0",
4
+ "version": "0.16.0",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -33,11 +33,11 @@
33
33
  "@eslint/compat": "^2.0.2",
34
34
  "@eslint/js": "^10.0.1",
35
35
  "@playwright/test": "^1.58.2",
36
- "@storybook/addon-a11y": "^10.2.13",
37
- "@storybook/addon-docs": "^10.2.13",
36
+ "@storybook/addon-a11y": "^10.2.14",
37
+ "@storybook/addon-docs": "^10.2.14",
38
38
  "@storybook/addon-svelte-csf": "^5.0.11",
39
- "@storybook/addon-vitest": "^10.2.13",
40
- "@storybook/sveltekit": "^10.2.13",
39
+ "@storybook/addon-vitest": "^10.2.14",
40
+ "@storybook/sveltekit": "^10.2.14",
41
41
  "@sveltejs/adapter-node": "^5.5.4",
42
42
  "@sveltejs/kit": "^2.53.4",
43
43
  "@sveltejs/package": "^2.5.7",
@@ -50,17 +50,17 @@
50
50
  "@vitest/browser-playwright": "^4.0.18",
51
51
  "eslint": "^10.0.2",
52
52
  "eslint-config-prettier": "^10.1.8",
53
- "eslint-plugin-storybook": "^10.2.13",
53
+ "eslint-plugin-storybook": "^10.2.14",
54
54
  "eslint-plugin-svelte": "^3.15.0",
55
55
  "globals": "^17.4.0",
56
56
  "mdsvex": "^0.12.6",
57
57
  "playwright": "^1.58.2",
58
58
  "prettier": "^3.8.1",
59
- "prettier-plugin-svelte": "^3.5.0",
59
+ "prettier-plugin-svelte": "^3.5.1",
60
60
  "publint": "^0.3.18",
61
61
  "sass-embedded": "^1.97.3",
62
- "storybook": "^10.2.13",
63
- "svelte": "^5.53.6",
62
+ "storybook": "^10.2.14",
63
+ "svelte": "^5.53.7",
64
64
  "svelte-check": "^4.4.4",
65
65
  "svelte-render-scan": "^1.1.0",
66
66
  "typescript": "^5.9.3",