@dosgato/dialog 0.0.77 → 0.0.78

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.
@@ -57,7 +57,7 @@ function reactToChoices(..._) {
57
57
  const choiceSet = new Set(choices?.map(c => c.value));
58
58
  const filtered = val?.filter(v => choiceSet.has(v));
59
59
  if (filtered?.length !== val?.length)
60
- stVal(filtered);
60
+ stVal(filtered, true);
61
61
  }
62
62
  $: reactToChoices(choices);
63
63
  onMount(reactToChoices);
@@ -31,11 +31,11 @@ function reactToChoices(..._) {
31
31
  if (!stVal)
32
32
  return;
33
33
  if (!choices.length) {
34
- stVal(finalDeserialize(''));
34
+ stVal(finalDeserialize(''), true);
35
35
  return;
36
36
  }
37
37
  if (!choices.some(o => o.value === finalDeserialize(val)))
38
- stVal(notNull ? defaultValue : finalDeserialize(''));
38
+ stVal(notNull ? defaultValue : finalDeserialize(''), true);
39
39
  }
40
40
  $: reactToChoices(choices);
41
41
  onMount(reactToChoices);
@@ -33,11 +33,11 @@ function reactToChoices(..._) {
33
33
  if (!stVal)
34
34
  return;
35
35
  if (!choices.length) {
36
- stVal(finalDeserialize(''));
36
+ stVal(finalDeserialize(''), true);
37
37
  return;
38
38
  }
39
39
  if (!choices.some(o => o.value === finalDeserialize(val)))
40
- stVal(notNull ? defaultValue : finalDeserialize(''));
40
+ stVal(notNull ? defaultValue : finalDeserialize(''), true);
41
41
  }
42
42
  $: reactToChoices(choices);
43
43
  onMount(reactToChoices);
@@ -27,13 +27,15 @@ export let serialize = undefined;
27
27
  export let deserialize = undefined;
28
28
  /** If you need to do some processing just before submit or validate define that processing here. */
29
29
  export let finalize = undefined;
30
+ /** If you specified a finalize, you probably need an initialize to invert it. */
31
+ export let initialize = undefined;
30
32
  export let conditional = undefined;
31
33
  export let required = false;
32
34
  export let related = 0;
33
35
  export let helptext = undefined;
34
36
  </script>
35
37
 
36
- <Field {path} {defaultValue} {conditional} {notNull} {number} {date} {datetime} {boolean} {serialize} {deserialize} {finalize} let:path let:value let:onBlur let:onChange let:setVal let:messages let:valid let:invalid let:serialize let:deserialize>
38
+ <Field {path} {defaultValue} {conditional} {notNull} {number} {date} {datetime} {boolean} {serialize} {deserialize} {initialize} {finalize} let:path let:value let:onBlur let:onChange let:setVal let:messages let:valid let:invalid let:serialize let:deserialize>
37
39
  <Container {id} {label} {messages} {descid} {required} {related} {helptext} let:messagesid let:helptextid>
38
40
  <slot {id} {path} {value} {onBlur} {onChange} {setVal} {valid} {invalid} {messagesid} {helptextid} {serialize} {deserialize} />
39
41
  </Container>
@@ -15,6 +15,7 @@ declare const __propDef: {
15
15
  serialize?: ((value: any) => string) | undefined;
16
16
  deserialize?: ((value: string) => any) | undefined;
17
17
  /** If you need to do some processing just before submit or validate define that processing here. */ finalize?: ((value: any) => any) | undefined;
18
+ /** If you specified a finalize, you probably need an initialize to invert it. */ initialize?: ((value: any) => any) | undefined;
18
19
  conditional?: boolean | undefined;
19
20
  required?: boolean | undefined;
20
21
  related?: number | true | undefined;
@@ -30,7 +31,7 @@ declare const __propDef: {
30
31
  value: any;
31
32
  onBlur: () => void;
32
33
  onChange: (e?: any) => void;
33
- setVal: (val: string | number | boolean | object | Date | undefined) => void;
34
+ setVal: (val: string | number | boolean | object | Date | undefined, notDirty?: boolean | undefined) => void;
34
35
  valid: boolean;
35
36
  invalid: boolean;
36
37
  messagesid: any;
@@ -24,9 +24,9 @@ function reactToOptions(..._) {
24
24
  if (!stVal)
25
25
  return;
26
26
  if (!options.length)
27
- stVal(addAllOption ? 'alternating' : undefined);
27
+ stVal(addAllOption ? 'alternating' : undefined, true);
28
28
  if (val !== 'alternating' && !options.some(o => o.value === val))
29
- stVal(notNull ? options[0].value : (addAllOption ? 'alternating' : undefined));
29
+ stVal(notNull ? options[0].value : (addAllOption ? 'alternating' : undefined), true);
30
30
  }
31
31
  $: reactToOptions(options);
32
32
  onMount(reactToOptions);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dosgato/dialog",
3
3
  "description": "A component library for building forms that edit a JSON document.",
4
- "version": "0.0.77",
4
+ "version": "0.0.78",
5
5
  "scripts": {
6
6
  "prepublishOnly": "svelte-package",
7
7
  "dev": "vite dev --force",
@@ -27,7 +27,7 @@
27
27
  "@iconify-icons/mdi": "^1.2.22",
28
28
  "@iconify-icons/ph": "^1.2.2",
29
29
  "@txstate-mws/svelte-components": "^1.5.3",
30
- "@txstate-mws/svelte-forms": "^1.3.6",
30
+ "@txstate-mws/svelte-forms": "^1.3.7",
31
31
  "codemirror": "^6.0.1",
32
32
  "txstate-utils": "^1.8.0"
33
33
  },
@@ -44,7 +44,7 @@
44
44
  "typescript": "^5.0.2"
45
45
  },
46
46
  "peerDependencies": {
47
- "svelte": "^3.53.1"
47
+ "svelte": "^3.53.1 || ^4.0.0"
48
48
  },
49
49
  "files": ["dist"],
50
50
  "type": "module"