@lavalogic/scoria 0.0.47 → 0.2.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.
@@ -29,7 +29,9 @@
29
29
  </script>
30
30
 
31
31
  <script lang="ts" generics="V,VP">
32
- const { item = $bindable(), first, last }: GridInputProps<V, VP> = $props();
32
+ const { item, first, last }: GridInputProps<V, VP> = $props();
33
+
34
+ let value = $state(isText(item) ? (item.value ?? '') : '');
33
35
 
34
36
  function isSelect(
35
37
  item: GridItem<V, VP>
@@ -81,7 +83,10 @@
81
83
  {#if isText(item)}
82
84
  <TextInput
83
85
  disabled={item.disabled}
84
- bind:value={item.value}
86
+ bind:value
87
+ oninput={() => {
88
+ item.updater(value);
89
+ }}
85
90
  required={item.required}
86
91
  invalid={item.invalid}
87
92
  />
@@ -100,7 +105,7 @@
100
105
  selectedValues={item.value}
101
106
  invalid={item.invalid}
102
107
  onchange={(v) => {
103
- item.value = v;
108
+ item.updater(v || null);
104
109
  }}
105
110
  />
106
111
  {:else if isMultiSelectPrimitive(item)}
@@ -113,7 +118,7 @@
113
118
  selectedValues={item.value}
114
119
  invalid={item.invalid}
115
120
  onchange={(v) => {
116
- item.value = v.map((it) => it[item.valueProp]);
121
+ item.updater(v.map((it) => it[item.valueProp]));
117
122
  }}
118
123
  />
119
124
  {/if}
@@ -135,7 +140,7 @@
135
140
  disabled={item.disabled}
136
141
  invalid={item.invalid}
137
142
  onchange={(v) => {
138
- item.value = v;
143
+ item.updater(v || null);
139
144
  }}
140
145
  />
141
146
  {:else if isSingleSelectPrimitive(item)}
@@ -151,7 +156,7 @@
151
156
  disabled={item.disabled}
152
157
  invalid={item.invalid}
153
158
  onchange={(v) => {
154
- item.value = v?.[item.valueProp] ?? null;
159
+ item.updater(v?.[item.valueProp] ?? null);
155
160
  }}
156
161
  />
157
162
  {/if}
@@ -7,7 +7,7 @@ export interface GridInputProps<V, VP> {
7
7
  declare function $$render<V, VP>(): {
8
8
  props: GridInputProps<V, VP>;
9
9
  exports: {};
10
- bindings: "item";
10
+ bindings: "";
11
11
  slots: {};
12
12
  events: {};
13
13
  };
@@ -15,7 +15,7 @@ declare class __sveltets_Render<V, VP> {
15
15
  props(): ReturnType<typeof $$render<V, VP>>['props'];
16
16
  events(): ReturnType<typeof $$render<V, VP>>['events'];
17
17
  slots(): ReturnType<typeof $$render<V, VP>>['slots'];
18
- bindings(): "item";
18
+ bindings(): "";
19
19
  exports(): {};
20
20
  }
21
21
  interface $$IsomorphicComponent {
@@ -13,7 +13,7 @@
13
13
  import GridInput from './GridInput.svelte';
14
14
  import type { GridItem } from '../Types/Internal/GridItem.js';
15
15
 
16
- const { items = $bindable(), header }: GridInputSetProps<V, VP> = $props();
16
+ const { items, header }: GridInputSetProps<V, VP> = $props();
17
17
 
18
18
  const lastIndex = $derived(items.length - 1);
19
19
  </script>
@@ -23,7 +23,7 @@
23
23
  {@render header()}
24
24
  {/if}
25
25
  {#each items as item, index (item)}
26
- <GridInput bind:item={items[index]} first={index == 0} last={index == lastIndex} />
26
+ <GridInput item={items[index]} first={index == 0} last={index == lastIndex} />
27
27
  {/each}
28
28
  </div>
29
29
 
@@ -7,7 +7,7 @@ import type { GridItem } from '../Types/Internal/GridItem.js';
7
7
  declare function $$render<V, VP>(): {
8
8
  props: GridInputSetProps<V, VP>;
9
9
  exports: {};
10
- bindings: "items";
10
+ bindings: "";
11
11
  slots: {};
12
12
  events: {};
13
13
  };
@@ -15,7 +15,7 @@ declare class __sveltets_Render<V, VP> {
15
15
  props(): ReturnType<typeof $$render<V, VP>>['props'];
16
16
  events(): ReturnType<typeof $$render<V, VP>>['events'];
17
17
  slots(): ReturnType<typeof $$render<V, VP>>['slots'];
18
- bindings(): "items";
18
+ bindings(): "";
19
19
  exports(): {};
20
20
  }
21
21
  interface $$IsomorphicComponent {
@@ -2,4 +2,5 @@ import type { GridMultiSelectItem } from './GridMultiSelectItem.js';
2
2
  export interface GridMultiSelectItemAsObject<V extends object, VP extends string & keyof V> extends GridMultiSelectItem<V, VP> {
3
3
  valueAsObject: true;
4
4
  value: V[];
5
+ updater: (v: V[]) => void;
5
6
  }
@@ -2,4 +2,5 @@ import type { GridMultiSelectItem } from './GridMultiSelectItem.js';
2
2
  export interface GridMultiSelectItemAsPrimitive<V extends object, VP extends string & keyof V> extends GridMultiSelectItem<V, VP> {
3
3
  valueAsObject: false;
4
4
  value: Array<V[VP]>;
5
+ updater: (v: Array<V[VP]>) => void;
5
6
  }
@@ -1,4 +1,5 @@
1
1
  import type { GridStringItem } from './GridStringItem.js';
2
2
  export interface GridNumberItem extends GridStringItem {
3
3
  type: 'number';
4
+ updater: (v: number) => void;
4
5
  }
@@ -2,4 +2,5 @@ import type { GridSingleSelectItem } from './GridSingleSelectItem.js';
2
2
  export interface GridSingleSelectItemAsObject<V extends object, VP extends keyof V> extends GridSingleSelectItem<V, VP> {
3
3
  valueAsObject: true;
4
4
  value: V | null;
5
+ updater: (v: V | null) => void;
5
6
  }
@@ -2,4 +2,5 @@ import type { GridSingleSelectItem } from './GridSingleSelectItem.js';
2
2
  export interface GridSingleSelectItemAsPrimitive<V extends object, VP extends keyof V> extends GridSingleSelectItem<V, VP> {
3
3
  valueAsObject: false;
4
4
  value: V[VP] | null;
5
+ updater: (v: V[VP] | null) => void;
5
6
  }
@@ -1,4 +1,5 @@
1
1
  import type { GridStringItem } from './GridStringItem.js';
2
2
  export interface GridTextItem extends GridStringItem {
3
3
  type?: 'text' | 'email' | 'tel';
4
+ updater: (v: string) => void;
4
5
  }
package/dist/index.d.ts CHANGED
@@ -114,7 +114,7 @@ export { default as TextInput } from './Components/TextInput.svelte';
114
114
  export { default as ThreeStateRadio } from './Components/ThreeStateRadio.svelte';
115
115
  export { default as VerticalTabGroup } from './Components/VerticalTabGroup.svelte';
116
116
  export { default as VerticalTabGroupButton } from './Components/VerticalTabGroupButton.svelte';
117
- export { AlertContext } from './Contexts/AlertContext.svelte.js';
117
+ export { AlertContext, type IAlertProps, type IPromptProps } from './Contexts/AlertContext.svelte.js';
118
118
  export { ContextMenuContext } from './Contexts/ContextMenuContext.svelte.js';
119
119
  export { ToastContext } from './Contexts/ToastContext.svelte.js';
120
120
  export { TooltipContext } from './Contexts/TooltipContext.svelte.js';
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.0.47",
4
+ "version": "0.2.0",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },