@lavalogic/scoria 0.10.1 → 0.11.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.
@@ -12,18 +12,21 @@
12
12
 
13
13
  export interface ContextWrapperProps {
14
14
  children: Snippet;
15
+ debug?: boolean;
15
16
  }
16
17
  </script>
17
18
 
18
19
  <script lang="ts">
19
- const { children }: ContextWrapperProps = $props();
20
+ const { children, debug = false }: ContextWrapperProps = $props();
20
21
 
21
22
  setContext(ContextMenuContext.identifier, new ContextMenuContext());
22
23
  setContext(TooltipContext.identifier, new TooltipContext());
23
24
  setContext(ToastContext.identifier, new ToastContext());
24
25
  const alertContext = new AlertContext();
25
26
  setContext(AlertContext.identifier, alertContext);
26
- setContext(UntypedInputContext.identifier, new UntypedInputContext());
27
+
28
+ const untypedListenerContext = new UntypedInputContext(debug);
29
+ setContext(UntypedInputContext.identifier, untypedListenerContext);
27
30
  </script>
28
31
 
29
32
  <ContextMenu />
@@ -32,5 +35,5 @@
32
35
  {#if alertContext.showModal}
33
36
  <AlertModal />
34
37
  {/if}
35
-
38
+ <svelte:window onkeydown={untypedListenerContext.handleGlobalKeydown} />
36
39
  {@render children()}
@@ -1,6 +1,7 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  export interface ContextWrapperProps {
3
3
  children: Snippet;
4
+ debug?: boolean;
4
5
  }
5
6
  declare const ContextWrapper: import("svelte").Component<ContextWrapperProps, {}, "">;
6
7
  type ContextWrapper = ReturnType<typeof ContextWrapper>;
@@ -101,7 +101,9 @@
101
101
  {@debug cell}
102
102
  {/if}
103
103
  {:catch e}
104
- <FocusableImmutableCell value={e?.toString()} {cell} />
104
+ <FocusableImmutableCell {cell}>
105
+ {e?.toString()}
106
+ </FocusableImmutableCell>
105
107
  {/await}
106
108
  {/if}
107
109
  {/if}
@@ -16,14 +16,14 @@
16
16
  <label>
17
17
  {#await checked}
18
18
  <input
19
- onchange={tableContext.onSelectAllInCurrentPage}
19
+ onchange={tableContext.selectAllInCurrentPage}
20
20
  type="checkbox"
21
21
  checked={false}
22
22
  disabled={tableContext.showSelectedOnly}
23
23
  />
24
24
  {:then checked}
25
25
  <input
26
- onchange={tableContext.onSelectAllInCurrentPage}
26
+ onchange={tableContext.selectAllInCurrentPage}
27
27
  type="checkbox"
28
28
  {checked}
29
29
  disabled={tableContext.showSelectedOnly}
@@ -165,7 +165,7 @@ export declare class TableContext<T extends object> {
165
165
  readonly updateSelectedItems: () => Promise<void>;
166
166
  readonly resetSelectedItems: () => void;
167
167
  readonly recalculateAllSelectedInCurrentPage: () => void;
168
- readonly onSelectAllInCurrentPage: () => Promise<void>;
168
+ readonly selectAllInCurrentPage: () => Promise<void>;
169
169
  readonly onHighlightAll: () => void;
170
170
  readonly onEditCell: (item: T, coords: CellCoordinates, value: unknown) => Promise<void>;
171
171
  readonly handleTdKeydown: (e: KeyboardEvent) => void;
@@ -860,7 +860,7 @@ export class TableContext {
860
860
  });
861
861
  });
862
862
  };
863
- onSelectAllInCurrentPage = async () => {
863
+ selectAllInCurrentPage = async () => {
864
864
  if (!this.dataRepo) {
865
865
  return;
866
866
  }
@@ -12,14 +12,23 @@
12
12
  style?: string;
13
13
  noscroll?: boolean;
14
14
  noTabMessage?: string;
15
+ nohistory?: boolean;
15
16
  }
16
17
  </script>
17
18
 
18
19
  <script lang="ts">
19
- let { name, tabs, selected, style, noscroll, noTabMessage }: VerticalTabGroupProps = $props();
20
+ let {
21
+ name,
22
+ tabs,
23
+ selected,
24
+ style,
25
+ noscroll,
26
+ noTabMessage,
27
+ nohistory = false
28
+ }: VerticalTabGroupProps = $props();
20
29
 
21
30
  onMount(() => {
22
- if (name) {
31
+ if (name && nohistory !== true) {
23
32
  const tabName = sessionStorage.getItem(`${name}-active-tab`);
24
33
  if (tabName) {
25
34
  tabs.find((it) => it.label === tabName)?.onclick();
@@ -6,6 +6,7 @@ export interface VerticalTabGroupProps {
6
6
  style?: string;
7
7
  noscroll?: boolean;
8
8
  noTabMessage?: string;
9
+ nohistory?: boolean;
9
10
  }
10
11
  declare const VerticalTabGroup: import("svelte").Component<VerticalTabGroupProps, {}, "">;
11
12
  type VerticalTabGroup = ReturnType<typeof VerticalTabGroup>;
@@ -1,6 +1,8 @@
1
1
  export type StringCallback = (value: string) => boolean | void | Promise<boolean | void>;
2
2
  import type { Unsubscriber } from '../Types/Internal/Misc.js';
3
3
  export declare class UntypedInputContext {
4
+ private debug;
5
+ constructor(debug?: boolean);
4
6
  static readonly identifier: unique symbol;
5
7
  private readonly registeredListeners;
6
8
  readonly registerListener: (listener: StringCallback) => Unsubscriber;
@@ -1,4 +1,8 @@
1
1
  export class UntypedInputContext {
2
+ debug;
3
+ constructor(debug = false) {
4
+ this.debug = debug;
5
+ }
2
6
  static identifier = Symbol();
3
7
  registeredListeners = [];
4
8
  registerListener = (listener) => {
@@ -42,11 +46,20 @@ export class UntypedInputContext {
42
46
  if (!this.tagNameSet.has(document.activeElement?.tagName)) {
43
47
  clearTimeout(this.debounceTimer);
44
48
  if (e.key === 'Enter') {
49
+ if (this.debug) {
50
+ console.log('firing');
51
+ }
45
52
  this.fire();
53
+ if (this.debug) {
54
+ console.log('clearing');
55
+ }
46
56
  this.untypedValue = '';
47
57
  return;
48
58
  }
49
59
  if (e.key.length == 1) {
60
+ if (this.debug) {
61
+ console.log(`adding ${e.key}`);
62
+ }
50
63
  this.untypedValue += e.key;
51
64
  }
52
65
  // else {
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.10.1",
4
+ "version": "0.11.0",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },