windmill-components 1.77.0 → 1.78.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.
- package/components/ArgInput.svelte +4 -14
- package/components/LightweightArgInput.svelte +315 -0
- package/components/LightweightArgInput.svelte.d.ts +47 -0
- package/components/LightweightSchemaForm.svelte +31 -0
- package/components/LightweightSchemaForm.svelte.d.ts +18 -0
- package/components/ModulePreview.svelte +1 -0
- package/components/Multiselect.svelte.d.ts +2 -2
- package/components/Path.svelte +4 -0
- package/components/Range.svelte.d.ts +2 -2
- package/components/SimpleEditor.svelte +1 -1
- package/components/SimpleEditor.svelte.d.ts +2 -0
- package/components/TemplateEditor.svelte +3 -0
- package/components/TemplateEditor.svelte.d.ts +0 -204
- package/components/VariableEditor.svelte +2 -1
- package/components/apps/components/buttons/AppButton.svelte +5 -3
- package/components/apps/components/buttons/AppButton.svelte.d.ts +0 -2
- package/components/apps/components/buttons/AppFormButton.svelte +1 -1
- package/components/apps/components/display/AppBarChart.svelte +7 -3
- package/components/apps/components/display/AppBarChart.svelte.d.ts +0 -2
- package/components/apps/components/display/AppDisplayComponent.svelte +7 -3
- package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +0 -2
- package/components/apps/components/display/AppHtml.svelte +7 -11
- package/components/apps/components/display/AppHtml.svelte.d.ts +0 -2
- package/components/apps/components/display/AppIcon.svelte +0 -1
- package/components/apps/components/display/AppIcon.svelte.d.ts +0 -2
- package/components/apps/components/display/AppImage.svelte +0 -1
- package/components/apps/components/display/AppImage.svelte.d.ts +0 -2
- package/components/apps/components/display/AppMap.svelte +10 -3
- package/components/apps/components/display/AppMap.svelte.d.ts +0 -2
- package/components/apps/components/display/AppPdf.svelte +8 -3
- package/components/apps/components/display/AppPdf.svelte.d.ts +0 -2
- package/components/apps/components/display/AppPieChart.svelte +7 -3
- package/components/apps/components/display/AppPieChart.svelte.d.ts +0 -2
- package/components/apps/components/display/AppScatterChart.svelte +7 -3
- package/components/apps/components/display/AppScatterChart.svelte.d.ts +0 -2
- package/components/apps/components/display/AppText.svelte +41 -17
- package/components/apps/components/display/AppText.svelte.d.ts +0 -2
- package/components/apps/components/display/AppTimeseries.svelte +7 -3
- package/components/apps/components/display/AppTimeseries.svelte.d.ts +0 -2
- package/components/apps/components/display/PlotlyHtml.svelte +9 -4
- package/components/apps/components/display/PlotlyHtml.svelte.d.ts +0 -2
- package/components/apps/components/display/VegaLiteHtml.svelte +8 -3
- package/components/apps/components/display/VegaLiteHtml.svelte.d.ts +0 -2
- package/components/apps/components/display/table/AppAggridTable.svelte +9 -4
- package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +0 -2
- package/components/apps/components/display/table/AppTable.svelte +15 -12
- package/components/apps/components/display/table/AppTable.svelte.d.ts +0 -2
- package/components/apps/components/helpers/HiddenComponent.svelte +8 -2
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +0 -2
- package/components/apps/components/helpers/NonRunnableComponent.svelte +2 -2
- package/components/apps/components/helpers/ResizeWrapper.svelte +3 -4
- package/components/apps/components/helpers/RunnableComponent.svelte +3 -18
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +0 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte +0 -2
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +0 -1
- package/components/apps/components/inputs/AppCheckbox.svelte +4 -2
- package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppDateInput.svelte +4 -2
- package/components/apps/components/inputs/AppDateInput.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppFileInput.svelte +4 -2
- package/components/apps/components/inputs/AppFileInput.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppMultiSelect.svelte +4 -2
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppNumberInput.svelte +4 -2
- package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppRangeInput.svelte +5 -2
- package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppSelect.svelte +4 -2
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppSliderInputs.svelte +4 -2
- package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppTextInput.svelte +5 -3
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +0 -2
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +5 -2
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +0 -2
- package/components/apps/components/layout/AppContainer.svelte +0 -1
- package/components/apps/components/layout/AppContainer.svelte.d.ts +0 -2
- package/components/apps/components/layout/AppTabs.svelte +3 -6
- package/components/apps/components/layout/AppTabs.svelte.d.ts +0 -2
- package/components/apps/editor/AppComponentInput.svelte +2 -1
- package/components/apps/editor/AppEditor.svelte +9 -12
- package/components/apps/editor/AppPreview.svelte +66 -14
- package/components/apps/editor/GridEditor.svelte +6 -27
- package/components/apps/editor/GridPanel.svelte +3 -1
- package/components/apps/editor/GridViewer.svelte +91 -0
- package/components/apps/editor/GridViewer.svelte.d.ts +32 -0
- package/components/apps/editor/SubGridEditor.svelte +73 -50
- package/components/apps/editor/appUtils.d.ts +3 -2
- package/components/apps/editor/appUtils.js +14 -19
- package/components/apps/editor/component/Component.svelte +2 -43
- package/components/apps/editor/component/ComponentNavigation.svelte +17 -12
- package/components/apps/editor/component/components.d.ts +2 -2
- package/components/apps/editor/component/components.js +42 -79
- package/components/apps/editor/componentsPanel/ComponentList.svelte +5 -4
- package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +1 -1
- package/components/apps/editor/contextPanel/ComponentOutput.svelte +23 -33
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +14 -13
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte.d.ts +0 -1
- package/components/apps/editor/contextPanel/ContextPanel.svelte +16 -23
- package/components/apps/editor/contextPanel/SubGridOutput.svelte +5 -10
- package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte +9 -6
- package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte.d.ts +0 -1
- package/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte +1 -2
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +62 -41
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte.d.ts +0 -2
- package/components/apps/editor/contextPanel/components/TableActionOutput.svelte +2 -4
- package/components/apps/editor/contextPanel/components/TableActionOutput.svelte.d.ts +0 -1
- package/components/apps/editor/contextPanel/components/TableActionsOutput.svelte +1 -2
- package/components/apps/editor/contextPanel/components/TableActionsOutput.svelte.d.ts +0 -1
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +2 -2
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +6 -2
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +5 -9
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +12 -7
- package/components/apps/editor/settingsPanel/GridPane.svelte +1 -3
- package/components/apps/editor/settingsPanel/GridTab.svelte +1 -3
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -16
- package/components/apps/editor/settingsPanel/TableActions.svelte +2 -5
- package/components/apps/gridUtils.d.ts +1 -3
- package/components/apps/gridUtils.js +1 -15
- package/components/apps/rx.d.ts +1 -1
- package/components/apps/rx.js +8 -10
- package/components/apps/svelte-grid/Grid.svelte +8 -12
- package/components/apps/svelte-grid/Grid.svelte.d.ts +0 -2
- package/components/apps/svelte-grid/MoveResize.svelte +1 -1
- package/components/apps/svelte-grid/types.d.ts +12 -16
- package/components/apps/svelte-grid/utils/helper.d.ts +1 -5
- package/components/apps/types.d.ts +9 -7
- package/components/apps/utils.js +2 -2
- package/components/common/button/Button.svelte.d.ts +1 -1
- package/components/common/button/ButtonPopup.svelte.d.ts +1 -1
- package/components/common/menu/Menu.svelte.d.ts +1 -1
- package/components/propertyPicker/ObjectViewer.svelte +1 -1
- package/components/propertyPicker/PropPicker.svelte +4 -1
- package/package.json +4 -2
- package/components/apps/editor/AppComponentInputs.svelte +0 -13
- package/components/apps/editor/AppComponentInputs.svelte.d.ts +0 -20
|
@@ -129,6 +129,9 @@ $: {
|
|
|
129
129
|
else if (inputCat == 'boolean') {
|
|
130
130
|
value = false;
|
|
131
131
|
}
|
|
132
|
+
else if (inputCat == 'list') {
|
|
133
|
+
value = [];
|
|
134
|
+
}
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
137
|
}
|
|
@@ -263,7 +266,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
263
266
|
on:click={() => {
|
|
264
267
|
value = value.filter((el) => el != v)
|
|
265
268
|
if (value.length == 0) {
|
|
266
|
-
value =
|
|
269
|
+
value = []
|
|
267
270
|
}
|
|
268
271
|
}}
|
|
269
272
|
>
|
|
@@ -425,19 +428,6 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
425
428
|
{/if}
|
|
426
429
|
</div>
|
|
427
430
|
{/if}
|
|
428
|
-
{#if !required && inputCat != 'resource-object'}
|
|
429
|
-
<!-- <Tooltip placement="bottom" content="Reset to default value">
|
|
430
|
-
<Button
|
|
431
|
-
on:click={() => (value = undefined)}
|
|
432
|
-
{disabled}
|
|
433
|
-
color="alternative"
|
|
434
|
-
size="sm"
|
|
435
|
-
class="h-8"
|
|
436
|
-
>
|
|
437
|
-
<Icon data={faArrowRotateLeft} />
|
|
438
|
-
</Button>
|
|
439
|
-
</Tooltip> -->
|
|
440
|
-
{/if}
|
|
441
431
|
<slot name="actions" />
|
|
442
432
|
</div>
|
|
443
433
|
{#if !compact || (error && error != '')}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<script>import { faMinus, faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { setInputCat as computeInputCat } from '../utils';
|
|
3
|
+
import { Badge, Button } from './common';
|
|
4
|
+
import { createEventDispatcher } from 'svelte';
|
|
5
|
+
import Icon from 'svelte-awesome';
|
|
6
|
+
import FieldHeader from './FieldHeader.svelte';
|
|
7
|
+
import ObjectResourceInput from './ObjectResourceInput.svelte';
|
|
8
|
+
import ResourcePicker from './ResourcePicker.svelte';
|
|
9
|
+
import autosize from 'svelte-autosize';
|
|
10
|
+
import Toggle from './Toggle.svelte';
|
|
11
|
+
import Range from './Range.svelte';
|
|
12
|
+
import LightweightSchemaForm from './LightweightSchemaForm.svelte';
|
|
13
|
+
export let label = '';
|
|
14
|
+
export let value;
|
|
15
|
+
export let defaultValue = undefined;
|
|
16
|
+
export let description = '';
|
|
17
|
+
export let format = '';
|
|
18
|
+
export let contentEncoding = undefined;
|
|
19
|
+
export let type = undefined;
|
|
20
|
+
export let required = false;
|
|
21
|
+
export let pattern = undefined;
|
|
22
|
+
export let valid = required ? false : true;
|
|
23
|
+
export let maxRows = 10;
|
|
24
|
+
export let enum_ = undefined;
|
|
25
|
+
export let itemsType = undefined;
|
|
26
|
+
export let displayHeader = true;
|
|
27
|
+
export let properties = undefined;
|
|
28
|
+
export let extra = {};
|
|
29
|
+
const dispatch = createEventDispatcher();
|
|
30
|
+
$: maxHeight = maxRows ? `${1 + maxRows * 1.2}em` : `auto`;
|
|
31
|
+
$: validateInput(pattern, value);
|
|
32
|
+
let error = '';
|
|
33
|
+
let el = undefined;
|
|
34
|
+
let rawValue = undefined;
|
|
35
|
+
$: {
|
|
36
|
+
if (rawValue) {
|
|
37
|
+
try {
|
|
38
|
+
value = JSON.parse(rawValue);
|
|
39
|
+
error = '';
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
error = err.toString();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
$: {
|
|
47
|
+
error = '';
|
|
48
|
+
if (inputCat === 'object') {
|
|
49
|
+
evalValueToRaw();
|
|
50
|
+
validateInput(pattern, value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function evalValueToRaw() {
|
|
54
|
+
if (value) {
|
|
55
|
+
rawValue = JSON.stringify(value, null, 4);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function fileChanged(e, cb) {
|
|
59
|
+
let t = e.target;
|
|
60
|
+
if (t && 'files' in t && t.files.length > 0) {
|
|
61
|
+
let reader = new FileReader();
|
|
62
|
+
reader.onload = (e) => {
|
|
63
|
+
cb(e.target.result.split('base64,')[1]);
|
|
64
|
+
};
|
|
65
|
+
reader.readAsDataURL(t.files[0]);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
cb(undefined);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function focus() {
|
|
72
|
+
el?.focus();
|
|
73
|
+
if (el) {
|
|
74
|
+
el.style.height = '5px';
|
|
75
|
+
el.style.height = el.scrollHeight + 50 + 'px';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function validateInput(pattern, v) {
|
|
79
|
+
if (required && (v == undefined || v == null || v === '')) {
|
|
80
|
+
error = 'This field is required';
|
|
81
|
+
valid = false;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
if (pattern && !testRegex(pattern, v)) {
|
|
85
|
+
error = `Should match ${pattern}`;
|
|
86
|
+
valid = false;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
error = '';
|
|
90
|
+
valid = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function testRegex(pattern, value) {
|
|
95
|
+
try {
|
|
96
|
+
const regex = new RegExp(pattern);
|
|
97
|
+
return regex.test(value);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
$: {
|
|
104
|
+
if (value == undefined || value == null) {
|
|
105
|
+
value = defaultValue;
|
|
106
|
+
if (defaultValue === undefined || defaultValue === null) {
|
|
107
|
+
if (inputCat === 'string') {
|
|
108
|
+
value = '';
|
|
109
|
+
}
|
|
110
|
+
else if (inputCat == 'enum') {
|
|
111
|
+
value = enum_?.[0];
|
|
112
|
+
}
|
|
113
|
+
else if (inputCat == 'boolean') {
|
|
114
|
+
value = false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
$: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncoding);
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<div class="flex flex-col w-full min-w-[250px]">
|
|
123
|
+
<div>
|
|
124
|
+
{#if displayHeader}
|
|
125
|
+
<FieldHeader {label} {required} {type} {contentEncoding} {format} {itemsType} />
|
|
126
|
+
{/if}
|
|
127
|
+
|
|
128
|
+
{#if description}
|
|
129
|
+
<div class="text-sm italic pb-1">
|
|
130
|
+
{description}
|
|
131
|
+
</div>
|
|
132
|
+
{/if}
|
|
133
|
+
|
|
134
|
+
<div class="flex space-x-1">
|
|
135
|
+
{#if inputCat == 'number'}
|
|
136
|
+
{#if extra['min'] != undefined && extra['max'] != undefined}
|
|
137
|
+
<div class="flex w-full gap-1">
|
|
138
|
+
<span>{extra['min']}</span>
|
|
139
|
+
<div class="grow">
|
|
140
|
+
<Range bind:value min={extra['min']} max={extra['max']} />
|
|
141
|
+
</div>
|
|
142
|
+
<span>{extra['max']}</span>
|
|
143
|
+
<span class="mx-2"><Badge large color="blue">{value}</Badge></span>
|
|
144
|
+
</div>
|
|
145
|
+
{:else}
|
|
146
|
+
<input
|
|
147
|
+
on:focus={(e) => {
|
|
148
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
149
|
+
dispatch('focus')
|
|
150
|
+
}}
|
|
151
|
+
type="number"
|
|
152
|
+
class={valid
|
|
153
|
+
? ''
|
|
154
|
+
: 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'}
|
|
155
|
+
placeholder={defaultValue ?? ''}
|
|
156
|
+
bind:value
|
|
157
|
+
min={extra['min']}
|
|
158
|
+
max={extra['max']}
|
|
159
|
+
on:input={() => dispatch('input', { value, isRaw: true })}
|
|
160
|
+
/>
|
|
161
|
+
{/if}
|
|
162
|
+
{:else if inputCat == 'boolean'}
|
|
163
|
+
<Toggle
|
|
164
|
+
on:pointerdown={(e) => {
|
|
165
|
+
e?.stopPropagation()
|
|
166
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
167
|
+
}}
|
|
168
|
+
class={valid
|
|
169
|
+
? ''
|
|
170
|
+
: 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'}
|
|
171
|
+
bind:checked={value}
|
|
172
|
+
/>
|
|
173
|
+
{#if type == 'boolean' && value == undefined}
|
|
174
|
+
<span> Not set</span>
|
|
175
|
+
{/if}
|
|
176
|
+
{:else if inputCat == 'list'}
|
|
177
|
+
<div>
|
|
178
|
+
<div>
|
|
179
|
+
{#each value ?? [] as v, i}
|
|
180
|
+
<div class="flex flex-row max-w-md mt-1">
|
|
181
|
+
{#if itemsType?.type == 'number'}
|
|
182
|
+
<input type="number" bind:value={v} />
|
|
183
|
+
{:else if itemsType?.type == 'string' && itemsType?.contentEncoding == 'base64'}
|
|
184
|
+
<input
|
|
185
|
+
type="file"
|
|
186
|
+
class="my-6"
|
|
187
|
+
on:change={(x) => fileChanged(x, (val) => (value[i] = val))}
|
|
188
|
+
multiple={false}
|
|
189
|
+
/>
|
|
190
|
+
{:else}
|
|
191
|
+
<input type="text" bind:value={v} />
|
|
192
|
+
{/if}
|
|
193
|
+
<Button
|
|
194
|
+
variant="border"
|
|
195
|
+
color="red"
|
|
196
|
+
size="sm"
|
|
197
|
+
btnClasses="mx-6"
|
|
198
|
+
on:click={() => {
|
|
199
|
+
value = value.filter((el) => el != v)
|
|
200
|
+
if (value.length == 0) {
|
|
201
|
+
value = undefined
|
|
202
|
+
}
|
|
203
|
+
}}
|
|
204
|
+
>
|
|
205
|
+
<Icon data={faMinus} />
|
|
206
|
+
</Button>
|
|
207
|
+
</div>
|
|
208
|
+
{/each}
|
|
209
|
+
</div>
|
|
210
|
+
<Button
|
|
211
|
+
variant="border"
|
|
212
|
+
color="blue"
|
|
213
|
+
size="sm"
|
|
214
|
+
btnClasses="mt-1"
|
|
215
|
+
on:click={() => {
|
|
216
|
+
if (value == undefined || !Array.isArray(value)) {
|
|
217
|
+
value = []
|
|
218
|
+
}
|
|
219
|
+
value = value.concat('')
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
<Icon data={faPlus} class="mr-2" />
|
|
223
|
+
Add item
|
|
224
|
+
</Button>
|
|
225
|
+
<span class="ml-2">
|
|
226
|
+
{(value ?? []).length} item{(value ?? []).length > 1 ? 's' : ''}
|
|
227
|
+
</span>
|
|
228
|
+
</div>
|
|
229
|
+
{:else if inputCat == 'resource-object'}
|
|
230
|
+
<ObjectResourceInput {format} bind:value />
|
|
231
|
+
{:else if inputCat == 'object'}
|
|
232
|
+
{#if properties && Object.keys(properties).length > 0}
|
|
233
|
+
<div class="p-4 pl-8 border rounded w-full">
|
|
234
|
+
<LightweightSchemaForm
|
|
235
|
+
schema={{ properties, $schema: '', required: [], type: 'object' }}
|
|
236
|
+
bind:args={value}
|
|
237
|
+
/>
|
|
238
|
+
</div>
|
|
239
|
+
{:else}
|
|
240
|
+
<textarea
|
|
241
|
+
bind:this={el}
|
|
242
|
+
on:focus={(e) => {
|
|
243
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
244
|
+
dispatch('focus')
|
|
245
|
+
}}
|
|
246
|
+
use:autosize
|
|
247
|
+
style="max-height: {maxHeight}"
|
|
248
|
+
on:input={() => {
|
|
249
|
+
dispatch('input', { rawValue: value, isRaw: false })
|
|
250
|
+
}}
|
|
251
|
+
class="col-span-10 {valid
|
|
252
|
+
? ''
|
|
253
|
+
: 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'}"
|
|
254
|
+
placeholder={defaultValue ? JSON.stringify(defaultValue, null, 4) : ''}
|
|
255
|
+
bind:value={rawValue}
|
|
256
|
+
/>
|
|
257
|
+
{/if}
|
|
258
|
+
{:else if inputCat == 'enum'}
|
|
259
|
+
<select
|
|
260
|
+
on:focus={(e) => {
|
|
261
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
262
|
+
dispatch('focus')
|
|
263
|
+
}}
|
|
264
|
+
class="px-6"
|
|
265
|
+
bind:value
|
|
266
|
+
>
|
|
267
|
+
{#each enum_ ?? [] as e}
|
|
268
|
+
<option>{e}</option>
|
|
269
|
+
{/each}
|
|
270
|
+
</select>
|
|
271
|
+
{:else if inputCat == 'date'}
|
|
272
|
+
<input class="inline-block" type="datetime-local" bind:value />
|
|
273
|
+
{:else if inputCat == 'base64'}
|
|
274
|
+
<input
|
|
275
|
+
type="file"
|
|
276
|
+
class="my-6"
|
|
277
|
+
on:change={(x) => fileChanged(x, (val) => (value = val))}
|
|
278
|
+
multiple={false}
|
|
279
|
+
/>
|
|
280
|
+
{:else if inputCat == 'resource-string'}
|
|
281
|
+
<ResourcePicker
|
|
282
|
+
bind:value
|
|
283
|
+
resourceType={format.split('-').length > 1
|
|
284
|
+
? format.substring('resource-'.length)
|
|
285
|
+
: undefined}
|
|
286
|
+
/>
|
|
287
|
+
{:else if inputCat == 'string'}
|
|
288
|
+
<div class="flex flex-col w-full">
|
|
289
|
+
<div class="flex flex-row w-full items- justify-between">
|
|
290
|
+
<textarea
|
|
291
|
+
rows="1"
|
|
292
|
+
bind:this={el}
|
|
293
|
+
on:focus={(e) => {
|
|
294
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
295
|
+
dispatch('focus')
|
|
296
|
+
}}
|
|
297
|
+
on:blur={() => dispatch('blur')}
|
|
298
|
+
use:autosize
|
|
299
|
+
type="text"
|
|
300
|
+
class="col-span-10 {valid
|
|
301
|
+
? ''
|
|
302
|
+
: 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'}"
|
|
303
|
+
placeholder={defaultValue ?? ''}
|
|
304
|
+
bind:value
|
|
305
|
+
on:input={() => {
|
|
306
|
+
dispatch('input', { rawValue: value, isRaw: false })
|
|
307
|
+
}}
|
|
308
|
+
/>
|
|
309
|
+
</div>
|
|
310
|
+
</div>
|
|
311
|
+
{/if}
|
|
312
|
+
<slot name="actions" />
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
</div>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SchemaProperty } from '../common';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
value: any;
|
|
7
|
+
defaultValue?: any;
|
|
8
|
+
description?: string | undefined;
|
|
9
|
+
format?: string | undefined;
|
|
10
|
+
contentEncoding?: 'base64' | 'binary' | undefined;
|
|
11
|
+
type?: string | undefined;
|
|
12
|
+
required?: boolean | undefined;
|
|
13
|
+
pattern?: undefined | string;
|
|
14
|
+
valid?: boolean | undefined;
|
|
15
|
+
maxRows?: number | undefined;
|
|
16
|
+
enum_?: string[] | undefined;
|
|
17
|
+
itemsType?: {
|
|
18
|
+
type?: "string" | "number" | "bytes" | undefined;
|
|
19
|
+
contentEncoding?: "base64" | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
displayHeader?: boolean | undefined;
|
|
22
|
+
properties?: {
|
|
23
|
+
[name: string]: SchemaProperty;
|
|
24
|
+
} | undefined;
|
|
25
|
+
extra?: Record<string, any> | undefined;
|
|
26
|
+
evalValueToRaw?: (() => void) | undefined;
|
|
27
|
+
focus?: (() => void) | undefined;
|
|
28
|
+
};
|
|
29
|
+
events: {
|
|
30
|
+
focus: CustomEvent<any>;
|
|
31
|
+
input: CustomEvent<any>;
|
|
32
|
+
blur: CustomEvent<any>;
|
|
33
|
+
} & {
|
|
34
|
+
[evt: string]: CustomEvent<any>;
|
|
35
|
+
};
|
|
36
|
+
slots: {
|
|
37
|
+
actions: {};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type LightweightArgInputProps = typeof __propDef.props;
|
|
41
|
+
export type LightweightArgInputEvents = typeof __propDef.events;
|
|
42
|
+
export type LightweightArgInputSlots = typeof __propDef.slots;
|
|
43
|
+
export default class LightweightArgInput extends SvelteComponentTyped<LightweightArgInputProps, LightweightArgInputEvents, LightweightArgInputSlots> {
|
|
44
|
+
get evalValueToRaw(): () => void;
|
|
45
|
+
get focus(): () => void;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script>import LightweightArgInput from './LightweightArgInput.svelte';
|
|
2
|
+
export let schema;
|
|
3
|
+
export let args = undefined;
|
|
4
|
+
$: if (args === undefined) {
|
|
5
|
+
args = {};
|
|
6
|
+
}
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div class="w-full">
|
|
10
|
+
{#each Object.keys(schema.properties ?? {}) as argName, i (argName)}
|
|
11
|
+
<div>
|
|
12
|
+
{#if typeof args == 'object' && schema?.properties[argName] && args}
|
|
13
|
+
<LightweightArgInput
|
|
14
|
+
label={argName}
|
|
15
|
+
description={schema.properties[argName].description}
|
|
16
|
+
bind:value={args[argName]}
|
|
17
|
+
type={schema.properties[argName].type}
|
|
18
|
+
required={schema.required.includes(argName)}
|
|
19
|
+
pattern={schema.properties[argName].pattern}
|
|
20
|
+
defaultValue={schema.properties[argName].default}
|
|
21
|
+
enum_={schema.properties[argName].enum}
|
|
22
|
+
format={schema.properties[argName].format}
|
|
23
|
+
contentEncoding={schema.properties[argName].contentEncoding}
|
|
24
|
+
properties={schema.properties[argName].properties}
|
|
25
|
+
itemsType={schema.properties[argName].items}
|
|
26
|
+
extra={schema.properties[argName]}
|
|
27
|
+
/>
|
|
28
|
+
{/if}
|
|
29
|
+
</div>
|
|
30
|
+
{/each}
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Schema } from '../common';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
schema: Schema;
|
|
6
|
+
args?: Record<string, any> | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type LightweightSchemaFormProps = typeof __propDef.props;
|
|
14
|
+
export type LightweightSchemaFormEvents = typeof __propDef.events;
|
|
15
|
+
export type LightweightSchemaFormSlots = typeof __propDef.slots;
|
|
16
|
+
export default class LightweightSchemaForm extends SvelteComponentTyped<LightweightSchemaFormProps, LightweightSchemaFormEvents, LightweightSchemaFormSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -49,6 +49,7 @@ function jobDone() {
|
|
|
49
49
|
if (testJob && !testJob.canceled && testJob.type == 'CompletedJob' && `result` in testJob) {
|
|
50
50
|
if ($flowStateStore[mod.id]?.previewResult) {
|
|
51
51
|
$flowStateStore[mod.id].previewResult = testJob.result;
|
|
52
|
+
$flowStateStore = $flowStateStore;
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
export default class Multiselect extends SvelteComponentTyped<{
|
|
5
5
|
value?: any[] | undefined;
|
|
6
6
|
id?: string | undefined;
|
|
7
|
-
placeholder?: string | undefined;
|
|
8
7
|
readonly?: boolean | undefined;
|
|
8
|
+
placeholder?: string | undefined;
|
|
9
9
|
}, {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
}, {
|
|
@@ -20,8 +20,8 @@ declare const __propDef: {
|
|
|
20
20
|
props: {
|
|
21
21
|
value?: any[] | undefined;
|
|
22
22
|
id?: string | undefined;
|
|
23
|
-
placeholder?: string | undefined;
|
|
24
23
|
readonly?: boolean | undefined;
|
|
24
|
+
placeholder?: string | undefined;
|
|
25
25
|
};
|
|
26
26
|
events: {
|
|
27
27
|
[evt: string]: CustomEvent<any>;
|
package/components/Path.svelte
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
export default class Range extends SvelteComponentTyped<{
|
|
5
5
|
value?: number | undefined;
|
|
6
6
|
id?: null | undefined;
|
|
7
|
-
max?: number | undefined;
|
|
8
7
|
min?: number | undefined;
|
|
8
|
+
max?: number | undefined;
|
|
9
9
|
initialValue?: number | undefined;
|
|
10
10
|
}, {
|
|
11
11
|
pointerdown: PointerEvent;
|
|
@@ -22,8 +22,8 @@ declare const __propDef: {
|
|
|
22
22
|
props: {
|
|
23
23
|
value?: number | undefined;
|
|
24
24
|
id?: null | undefined;
|
|
25
|
-
max?: number | undefined;
|
|
26
25
|
min?: number | undefined;
|
|
26
|
+
max?: number | undefined;
|
|
27
27
|
initialValue?: number | undefined;
|
|
28
28
|
};
|
|
29
29
|
events: {
|
|
@@ -15,6 +15,7 @@ declare const __propDef: {
|
|
|
15
15
|
getCode?: (() => string) | undefined;
|
|
16
16
|
insertAtCursor?: ((code: string) => void) | undefined;
|
|
17
17
|
setCode?: ((ncode: string) => void) | undefined;
|
|
18
|
+
format?: (() => void) | undefined;
|
|
18
19
|
focus?: (() => void) | undefined;
|
|
19
20
|
};
|
|
20
21
|
events: {
|
|
@@ -33,6 +34,7 @@ export default class SimpleEditor extends SvelteComponentTyped<SimpleEditorProps
|
|
|
33
34
|
get getCode(): () => string;
|
|
34
35
|
get insertAtCursor(): (code: string) => void;
|
|
35
36
|
get setCode(): (ncode: string) => void;
|
|
37
|
+
get format(): () => void;
|
|
36
38
|
get focus(): () => void;
|
|
37
39
|
}
|
|
38
40
|
export {};
|