svelte-json-schema-form 0.0.1-alpha2 → 0.0.1-alpha5
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/package.json +2 -2
- package/src/Form.stories.svelte +21 -1
- package/src/Form.svelte +1 -16
- package/src/utils/svelteObjectStore.js +2 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-json-schema-form",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.1-
|
|
4
|
+
"version": "0.0.1-alpha5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"vite": "^5.1.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"json-form-core": "0.0.1-
|
|
36
|
+
"json-form-core": "0.0.1-alpha10"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/Form.stories.svelte
CHANGED
|
@@ -87,7 +87,27 @@
|
|
|
87
87
|
"properties": {
|
|
88
88
|
"f1": {
|
|
89
89
|
"title": "Array Obj Field 1",
|
|
90
|
-
"component": "textInput"
|
|
90
|
+
"component": "textInput",
|
|
91
|
+
"automations": [
|
|
92
|
+
{
|
|
93
|
+
"condition":{
|
|
94
|
+
"and": {
|
|
95
|
+
"$[value]": {
|
|
96
|
+
"eq": "val"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"actions":[
|
|
101
|
+
{
|
|
102
|
+
"action":"set",
|
|
103
|
+
"args":[
|
|
104
|
+
"$[value]../f2",
|
|
105
|
+
"xxx"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
]
|
|
91
111
|
},
|
|
92
112
|
"f2": {
|
|
93
113
|
"title": "Array Obj Field 2",
|
package/src/Form.svelte
CHANGED
|
@@ -21,10 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
export let paths = {};
|
|
23
23
|
|
|
24
|
-
$: {
|
|
25
|
-
console.log("PATHS!", paths);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
24
|
export let components = {}; // svelte input components
|
|
29
25
|
|
|
30
26
|
// TODO set in store, not here
|
|
@@ -64,18 +60,11 @@
|
|
|
64
60
|
formController.logger = logger;
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
// TODO remove this
|
|
68
|
-
$: {
|
|
69
|
-
console.log("STORE VALUE!", JSON.stringify(value));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
63
|
// svelte-compatible read-only store for components
|
|
73
64
|
const componentsStore = {
|
|
74
65
|
subscribe: (callback) => formController.subscribeComponents(callback)
|
|
75
66
|
};
|
|
76
67
|
|
|
77
|
-
|
|
78
|
-
|
|
79
68
|
setContext(context, formController); // make form controller available to all children
|
|
80
69
|
|
|
81
70
|
/*
|
|
@@ -98,10 +87,8 @@
|
|
|
98
87
|
*/
|
|
99
88
|
|
|
100
89
|
onMount(() => {
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
window.formController = formController;
|
|
103
91
|
const unsubscribeValue = formController.subscribeValue((storeValue) => {
|
|
104
|
-
console.log("STORE VALUE", storeValue)
|
|
105
92
|
value = storeValue;
|
|
106
93
|
});
|
|
107
94
|
|
|
@@ -109,8 +96,6 @@
|
|
|
109
96
|
unsubscribeValue();
|
|
110
97
|
}
|
|
111
98
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
99
|
</script>
|
|
115
100
|
|
|
116
101
|
<svelte:component
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Svelte Object Store v0.0.2
|
|
2
3
|
* Returns a Svelte-compatible writeable store from an object-subscriptions object store or object store child
|
|
3
4
|
* @param nestedObject
|
|
4
5
|
* @param pathOrPathParts
|
|
@@ -24,7 +25,7 @@ const svelteObjectStore = (nestedObject, pathOrPathParts = [], options = {}) =>
|
|
|
24
25
|
? mergedOptions.set(value)
|
|
25
26
|
: value;
|
|
26
27
|
|
|
27
|
-
nestedObject.set(pathParts, setValue);
|
|
28
|
+
nestedObject.set(pathParts, setValue, options);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|