windmill-components 1.82.7 → 1.82.8
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/common.d.ts +2 -2
- package/components/ArgInput.svelte +66 -52
- package/components/ArgInput.svelte.d.ts +3 -1
- package/components/DisplayResult.svelte +17 -17
- package/components/Editor.svelte +3 -0
- package/components/Editor.svelte.d.ts +1 -0
- package/components/FieldHeader.svelte +1 -0
- package/components/FieldHeader.svelte.d.ts +4 -0
- package/components/FlowViewer.svelte +1 -0
- package/components/InputTransformForm.svelte +1 -0
- package/components/LightweightArgInput.svelte +9 -1
- package/components/LightweightArgInput.svelte.d.ts +3 -1
- package/components/SimpleEditor.svelte +1 -0
- package/components/SimpleEditor.svelte.d.ts +1 -0
- package/components/TemplateEditor.svelte +1 -0
- package/components/apps/components/helpers/InputValue.svelte +3 -3
- package/components/apps/components/helpers/RunnableComponent.svelte +2 -2
- package/components/apps/components/helpers/RunnableWrapper.svelte +1 -1
- package/components/apps/components/helpers/eval.d.ts +1 -3
- package/components/apps/components/helpers/eval.js +2 -4
- package/components/apps/components/inputs/AppMultiSelect.svelte +4 -8
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +2 -0
- package/components/apps/components/inputs/AppSelect.svelte +1 -9
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +2 -0
- package/components/apps/components/inputs/AppTextInput.svelte +39 -52
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -1
- package/components/apps/editor/AppEditor.svelte +1 -1
- package/components/apps/editor/GridEditor.svelte +1 -1
- package/components/apps/editor/SettingsPanel.svelte +1 -1
- package/components/apps/editor/component/Component.svelte +1 -13
- package/components/apps/editor/component/components.d.ts +2 -29
- package/components/apps/editor/component/components.js +1 -24
- package/components/apps/editor/component/sets.js +1 -2
- package/components/apps/editor/componentsPanel/quickStyleProperties.js +0 -3
- package/components/apps/editor/componentsPanel/store.js +4 -4
- package/components/apps/editor/contextPanel/ContextPanel.svelte +5 -5
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +7 -2
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +8 -7
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +3 -4
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +0 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +0 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +17 -20
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +1 -4
- package/components/apps/editor/settingsPanel/GridTab.svelte +2 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +1 -2
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +0 -4
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +0 -1
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +2 -1
- package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +1 -5
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +2 -3
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +1 -4
- package/components/apps/rx.d.ts +2 -2
- package/components/apps/utils.js +0 -1
- package/components/flows/map/MapItem.svelte +3 -3
- package/components/scriptEditor/LogPanel.svelte +3 -3
- package/infer.js +0 -3
- package/package.json +1 -1
package/common.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Script } from
|
|
1
|
+
import type { Script } from "./gen";
|
|
2
2
|
export type OwnerKind = 'group' | 'user' | 'folder';
|
|
3
3
|
export type ActionKind = 'Create' | 'Update' | 'Delete' | 'Execute';
|
|
4
4
|
export type SupportedLanguage = Script.language;
|
|
@@ -11,7 +11,7 @@ export interface SchemaProperty {
|
|
|
11
11
|
contentEncoding?: 'base64' | 'binary';
|
|
12
12
|
format?: string;
|
|
13
13
|
items?: {
|
|
14
|
-
type?: 'string' | 'number' | 'bytes'
|
|
14
|
+
type?: 'string' | 'number' | 'bytes';
|
|
15
15
|
contentEncoding?: 'base64';
|
|
16
16
|
};
|
|
17
17
|
properties?: {
|
|
@@ -15,9 +15,6 @@ import Toggle from './Toggle.svelte';
|
|
|
15
15
|
import Password from './Password.svelte';
|
|
16
16
|
import NumberTypeNarrowing from './NumberTypeNarrowing.svelte';
|
|
17
17
|
import Range from './Range.svelte';
|
|
18
|
-
import JsonEditor from './apps/editor/settingsPanel/inputEditor/JsonEditor.svelte';
|
|
19
|
-
import { fade } from 'svelte/transition';
|
|
20
|
-
import { X } from 'lucide-svelte';
|
|
21
18
|
export let label = '';
|
|
22
19
|
export let value;
|
|
23
20
|
export let defaultValue = undefined;
|
|
@@ -71,7 +68,7 @@ $: {
|
|
|
71
68
|
}
|
|
72
69
|
export function evalValueToRaw() {
|
|
73
70
|
if (value) {
|
|
74
|
-
rawValue = JSON.stringify(value, null,
|
|
71
|
+
rawValue = JSON.stringify(value, null, 4);
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
74
|
function fileChanged(e, cb) {
|
|
@@ -139,13 +136,12 @@ $: {
|
|
|
139
136
|
}
|
|
140
137
|
}
|
|
141
138
|
$: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncoding);
|
|
142
|
-
let redraw = 0;
|
|
143
139
|
</script>
|
|
144
140
|
|
|
145
141
|
<div class="flex flex-col w-full min-w-[250px]">
|
|
146
142
|
<div>
|
|
147
143
|
{#if displayHeader}
|
|
148
|
-
<FieldHeader {label} {required} {type} {contentEncoding} {format} />
|
|
144
|
+
<FieldHeader {label} {required} {type} {contentEncoding} {format} {itemsType} />
|
|
149
145
|
{/if}
|
|
150
146
|
{#if editableSchema}
|
|
151
147
|
<div class="p-2 my-1 text-xs border-solid border border-gray-400">
|
|
@@ -168,7 +164,7 @@ let redraw = 0;
|
|
|
168
164
|
use:autosize
|
|
169
165
|
rows="1"
|
|
170
166
|
bind:value={description}
|
|
171
|
-
on:keydown|stopPropagation
|
|
167
|
+
on:keydown|stopPropagation
|
|
172
168
|
placeholder="Field description"
|
|
173
169
|
/>
|
|
174
170
|
{#if type == 'string' && format != 'date-time'}
|
|
@@ -181,7 +177,6 @@ let redraw = 0;
|
|
|
181
177
|
<select bind:value={itemsType}>
|
|
182
178
|
<option value={undefined}>No specific item type</option>
|
|
183
179
|
<option value={{ type: 'string' }}> Items are strings</option>
|
|
184
|
-
<option value={{ type: 'object' }}> Items are objects (JSON)</option>
|
|
185
180
|
<option value={{ type: 'number' }}>Items are numbers</option>
|
|
186
181
|
<option value={{ type: 'string', contentEncoding: 'base64' }}
|
|
187
182
|
>Items are bytes</option
|
|
@@ -227,6 +222,7 @@ let redraw = 0;
|
|
|
227
222
|
bind:value
|
|
228
223
|
min={extra['min']}
|
|
229
224
|
max={extra['max']}
|
|
225
|
+
on:input={() => dispatch('input', { value, isRaw: true })}
|
|
230
226
|
/>
|
|
231
227
|
{/if}
|
|
232
228
|
{:else if inputCat == 'boolean'}
|
|
@@ -244,46 +240,44 @@ let redraw = 0;
|
|
|
244
240
|
<span> Not set</span>
|
|
245
241
|
{/if}
|
|
246
242
|
{:else if inputCat == 'list'}
|
|
247
|
-
<div
|
|
248
|
-
<div
|
|
249
|
-
{#
|
|
250
|
-
|
|
251
|
-
{#
|
|
252
|
-
<
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
{
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
{/if}
|
|
281
|
-
{/key}
|
|
243
|
+
<div>
|
|
244
|
+
<div>
|
|
245
|
+
{#each value ?? [] as v, i}
|
|
246
|
+
<div class="flex flex-row max-w-md mt-1">
|
|
247
|
+
{#if itemsType?.type == 'number'}
|
|
248
|
+
<input autofocus={autofocus && i == 0} type="number" bind:value={v} />
|
|
249
|
+
{:else if itemsType?.type == 'string' && itemsType?.contentEncoding == 'base64'}
|
|
250
|
+
<input
|
|
251
|
+
autofocus={autofocus && i == 0}
|
|
252
|
+
type="file"
|
|
253
|
+
class="my-6"
|
|
254
|
+
on:change={(x) => fileChanged(x, (val) => (value[i] = val))}
|
|
255
|
+
multiple={false}
|
|
256
|
+
/>
|
|
257
|
+
{:else}
|
|
258
|
+
<input autofocus={autofocus && i == 0} type="text" bind:value={v} />
|
|
259
|
+
{/if}
|
|
260
|
+
<Button
|
|
261
|
+
variant="border"
|
|
262
|
+
color="red"
|
|
263
|
+
size="sm"
|
|
264
|
+
btnClasses="mx-6"
|
|
265
|
+
on:click={() => {
|
|
266
|
+
value = value.filter((el) => el != v)
|
|
267
|
+
if (value.length == 0) {
|
|
268
|
+
value = []
|
|
269
|
+
}
|
|
270
|
+
}}
|
|
271
|
+
>
|
|
272
|
+
<Icon data={faMinus} />
|
|
273
|
+
</Button>
|
|
274
|
+
</div>
|
|
275
|
+
{/each}
|
|
282
276
|
</div>
|
|
283
277
|
<Button
|
|
284
278
|
variant="border"
|
|
285
|
-
color="
|
|
286
|
-
size="
|
|
279
|
+
color="blue"
|
|
280
|
+
size="sm"
|
|
287
281
|
btnClasses="mt-1"
|
|
288
282
|
on:click={() => {
|
|
289
283
|
if (value == undefined || !Array.isArray(value)) {
|
|
@@ -295,6 +289,9 @@ let redraw = 0;
|
|
|
295
289
|
<Icon data={faPlus} class="mr-2" />
|
|
296
290
|
Add item
|
|
297
291
|
</Button>
|
|
292
|
+
<span class="ml-2">
|
|
293
|
+
{(value ?? []).length} item{(value ?? []).length > 1 ? 's' : ''}
|
|
294
|
+
</span>
|
|
298
295
|
</div>
|
|
299
296
|
{:else if inputCat == 'resource-object'}
|
|
300
297
|
<ObjectResourceInput {format} bind:value />
|
|
@@ -307,16 +304,25 @@ let redraw = 0;
|
|
|
307
304
|
bind:args={value}
|
|
308
305
|
/>
|
|
309
306
|
</div>
|
|
310
|
-
{:else if disabled}
|
|
311
|
-
<textarea disabled />
|
|
312
307
|
{:else}
|
|
313
|
-
<
|
|
314
|
-
bind:
|
|
308
|
+
<textarea
|
|
309
|
+
bind:this={el}
|
|
315
310
|
on:focus={(e) => {
|
|
316
311
|
dispatch('focus')
|
|
317
312
|
}}
|
|
318
|
-
|
|
319
|
-
|
|
313
|
+
{autofocus}
|
|
314
|
+
{disabled}
|
|
315
|
+
use:autosize
|
|
316
|
+
on:keydown|stopPropagation
|
|
317
|
+
style="max-height: {maxHeight}"
|
|
318
|
+
on:input={() => {
|
|
319
|
+
dispatch('input', { rawValue: value, isRaw: false })
|
|
320
|
+
}}
|
|
321
|
+
class="col-span-10 {valid
|
|
322
|
+
? ''
|
|
323
|
+
: 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'}"
|
|
324
|
+
placeholder={defaultValue ? JSON.stringify(defaultValue, null, 4) : ''}
|
|
325
|
+
bind:value={rawValue}
|
|
320
326
|
/>
|
|
321
327
|
{/if}
|
|
322
328
|
{:else if inputCat == 'enum'}
|
|
@@ -340,9 +346,13 @@ let redraw = 0;
|
|
|
340
346
|
on:focus={(e) => {
|
|
341
347
|
dispatch('focus')
|
|
342
348
|
}}
|
|
349
|
+
on:blur={() => dispatch('blur')}
|
|
343
350
|
bind:this={editor}
|
|
344
351
|
lang={inputCat}
|
|
345
352
|
bind:code={value}
|
|
353
|
+
on:change={async () => {
|
|
354
|
+
dispatch('input', { rawValue: value, isRaw: false })
|
|
355
|
+
}}
|
|
346
356
|
autoHeight
|
|
347
357
|
/>
|
|
348
358
|
</div>
|
|
@@ -374,8 +384,9 @@ let redraw = 0;
|
|
|
374
384
|
on:focus={(e) => {
|
|
375
385
|
dispatch('focus')
|
|
376
386
|
}}
|
|
387
|
+
on:blur={() => dispatch('blur')}
|
|
377
388
|
use:autosize
|
|
378
|
-
on:keydown|stopPropagation
|
|
389
|
+
on:keydown|stopPropagation
|
|
379
390
|
type="text"
|
|
380
391
|
{disabled}
|
|
381
392
|
class="col-span-10 {valid
|
|
@@ -383,6 +394,9 @@ let redraw = 0;
|
|
|
383
394
|
: 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'}"
|
|
384
395
|
placeholder={defaultValue ?? ''}
|
|
385
396
|
bind:value
|
|
397
|
+
on:input={() => {
|
|
398
|
+
dispatch('input', { rawValue: value, isRaw: false })
|
|
399
|
+
}}
|
|
386
400
|
/>
|
|
387
401
|
{#if itemPicker}
|
|
388
402
|
<div class="ml-1 relative">
|
|
@@ -20,7 +20,7 @@ declare const __propDef: {
|
|
|
20
20
|
disabled?: boolean | undefined;
|
|
21
21
|
editableSchema?: boolean | undefined;
|
|
22
22
|
itemsType?: {
|
|
23
|
-
type?: "string" | "number" | "
|
|
23
|
+
type?: "string" | "number" | "bytes" | undefined;
|
|
24
24
|
contentEncoding?: "base64" | undefined;
|
|
25
25
|
} | undefined;
|
|
26
26
|
displayHeader?: boolean | undefined;
|
|
@@ -42,6 +42,8 @@ declare const __propDef: {
|
|
|
42
42
|
events: {
|
|
43
43
|
keydown: KeyboardEvent;
|
|
44
44
|
focus: CustomEvent<any>;
|
|
45
|
+
input: CustomEvent<any>;
|
|
46
|
+
blur: CustomEvent<any>;
|
|
45
47
|
} & {
|
|
46
48
|
[evt: string]: CustomEvent<any>;
|
|
47
49
|
};
|
|
@@ -75,6 +75,23 @@ let payload = '';
|
|
|
75
75
|
let jsonViewer;
|
|
76
76
|
</script>
|
|
77
77
|
|
|
78
|
+
<Portal>
|
|
79
|
+
<Drawer bind:this={jsonViewer} size="900px">
|
|
80
|
+
<DrawerContent title="Expanded Result" on:close={jsonViewer.closeDrawer}>
|
|
81
|
+
<svelte:fragment slot="actions">
|
|
82
|
+
<Button
|
|
83
|
+
on:click={() => copyToClipboard(JSON.stringify(result, null, 4))}
|
|
84
|
+
color="light"
|
|
85
|
+
size="xs"
|
|
86
|
+
>
|
|
87
|
+
<div class="flex gap-2 items-center">Copy to clipboard <ClipboardCopy /> </div>
|
|
88
|
+
</Button>
|
|
89
|
+
</svelte:fragment>
|
|
90
|
+
<Highlight language={json} code={JSON.stringify(result, null, 4).replace(/\\n/g, '\n')} />
|
|
91
|
+
</DrawerContent>
|
|
92
|
+
</Drawer>
|
|
93
|
+
</Portal>
|
|
94
|
+
|
|
78
95
|
<div class="inline-highlight">
|
|
79
96
|
{#if result != undefined}
|
|
80
97
|
{#if resultKind && resultKind != 'json'}
|
|
@@ -220,20 +237,3 @@ let jsonViewer;
|
|
|
220
237
|
<div class="text-gray-500 text-sm">No result: {JSON.stringify(result)}</div>
|
|
221
238
|
{/if}
|
|
222
239
|
</div>
|
|
223
|
-
|
|
224
|
-
<Portal>
|
|
225
|
-
<Drawer bind:this={jsonViewer} size="900px">
|
|
226
|
-
<DrawerContent title="Expanded Result" on:close={jsonViewer.closeDrawer}>
|
|
227
|
-
<svelte:fragment slot="actions">
|
|
228
|
-
<Button
|
|
229
|
-
on:click={() => copyToClipboard(JSON.stringify(result, null, 4))}
|
|
230
|
-
color="light"
|
|
231
|
-
size="xs"
|
|
232
|
-
>
|
|
233
|
-
<div class="flex gap-2 items-center">Copy to clipboard <ClipboardCopy /> </div>
|
|
234
|
-
</Button>
|
|
235
|
-
</svelte:fragment>
|
|
236
|
-
<Highlight language={json} code={JSON.stringify(result, null, 4).replace(/\\n/g, '\n')} />
|
|
237
|
-
</DrawerContent>
|
|
238
|
-
</Drawer>
|
|
239
|
-
</Portal>
|
package/components/Editor.svelte
CHANGED
|
@@ -6,6 +6,10 @@ declare const __propDef: {
|
|
|
6
6
|
contentEncoding?: string | undefined;
|
|
7
7
|
type?: string | undefined;
|
|
8
8
|
required?: boolean | undefined;
|
|
9
|
+
itemsType?: {
|
|
10
|
+
type?: "string" | "number" | "bytes" | undefined;
|
|
11
|
+
contentEncoding?: "base64" | undefined;
|
|
12
|
+
} | undefined;
|
|
9
13
|
};
|
|
10
14
|
events: {
|
|
11
15
|
[evt: string]: CustomEvent<any>;
|
|
@@ -52,6 +52,7 @@ function toAny(x) {
|
|
|
52
52
|
type={toAny(v)?.type}
|
|
53
53
|
contentEncoding={toAny(v)?.contentEncoding}
|
|
54
54
|
format={toAny(v)?.format}
|
|
55
|
+
itemsType={toAny(v)?.itemsType}
|
|
55
56
|
/><span class="ml-4 mt-2 text-xs"
|
|
56
57
|
>{toAny(v)?.default != undefined
|
|
57
58
|
? 'default: ' + JSON.stringify(toAny(v)?.default)
|
|
@@ -104,6 +104,7 @@ $: schema.properties[argName].default && setDefaultCode();
|
|
|
104
104
|
contentEncoding={schema.properties[argName].contentEncoding}
|
|
105
105
|
required={schema.required.includes(argName)}
|
|
106
106
|
type={schema.properties[argName].type}
|
|
107
|
+
itemsType={schema.properties[argName].items}
|
|
107
108
|
/>
|
|
108
109
|
|
|
109
110
|
{#if isStaticTemplate(inputCat)}
|
|
@@ -122,7 +122,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
122
122
|
<div class="flex flex-col w-full min-w-[250px]">
|
|
123
123
|
<div>
|
|
124
124
|
{#if displayHeader}
|
|
125
|
-
<FieldHeader {label} {required} {type} {contentEncoding} {format} />
|
|
125
|
+
<FieldHeader {label} {required} {type} {contentEncoding} {format} {itemsType} />
|
|
126
126
|
{/if}
|
|
127
127
|
|
|
128
128
|
{#if description}
|
|
@@ -155,6 +155,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
155
155
|
bind:value
|
|
156
156
|
min={extra['min']}
|
|
157
157
|
max={extra['max']}
|
|
158
|
+
on:input={() => dispatch('input', { value, isRaw: true })}
|
|
158
159
|
/>
|
|
159
160
|
{/if}
|
|
160
161
|
{:else if inputCat == 'boolean'}
|
|
@@ -241,6 +242,9 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
241
242
|
}}
|
|
242
243
|
use:autosize
|
|
243
244
|
style="max-height: {maxHeight}"
|
|
245
|
+
on:input={() => {
|
|
246
|
+
dispatch('input', { rawValue: value, isRaw: false })
|
|
247
|
+
}}
|
|
244
248
|
class="col-span-10 {valid
|
|
245
249
|
? ''
|
|
246
250
|
: 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'}"
|
|
@@ -285,6 +289,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
285
289
|
on:focus={(e) => {
|
|
286
290
|
dispatch('focus')
|
|
287
291
|
}}
|
|
292
|
+
on:blur={() => dispatch('blur')}
|
|
288
293
|
use:autosize
|
|
289
294
|
type="text"
|
|
290
295
|
class="col-span-10 {valid
|
|
@@ -292,6 +297,9 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
292
297
|
: 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'}"
|
|
293
298
|
placeholder={defaultValue ?? ''}
|
|
294
299
|
bind:value
|
|
300
|
+
on:input={() => {
|
|
301
|
+
dispatch('input', { rawValue: value, isRaw: false })
|
|
302
|
+
}}
|
|
295
303
|
/>
|
|
296
304
|
</div>
|
|
297
305
|
</div>
|
|
@@ -15,7 +15,7 @@ declare const __propDef: {
|
|
|
15
15
|
maxRows?: number | undefined;
|
|
16
16
|
enum_?: string[] | undefined;
|
|
17
17
|
itemsType?: {
|
|
18
|
-
type?: "string" | "number" | "
|
|
18
|
+
type?: "string" | "number" | "bytes" | undefined;
|
|
19
19
|
contentEncoding?: "base64" | undefined;
|
|
20
20
|
} | undefined;
|
|
21
21
|
displayHeader?: boolean | undefined;
|
|
@@ -28,6 +28,8 @@ declare const __propDef: {
|
|
|
28
28
|
};
|
|
29
29
|
events: {
|
|
30
30
|
focus: CustomEvent<any>;
|
|
31
|
+
input: CustomEvent<any>;
|
|
32
|
+
blur: CustomEvent<any>;
|
|
31
33
|
} & {
|
|
32
34
|
[evt: string]: CustomEvent<any>;
|
|
33
35
|
};
|
|
@@ -9,7 +9,7 @@ export let id = undefined;
|
|
|
9
9
|
export let error = '';
|
|
10
10
|
export let extraContext = {};
|
|
11
11
|
export let key = '';
|
|
12
|
-
const { componentControl
|
|
12
|
+
const { componentControl } = getContext('AppViewerContext');
|
|
13
13
|
const dispatch = createEventDispatcher();
|
|
14
14
|
if (input == undefined) {
|
|
15
15
|
dispatch('done');
|
|
@@ -67,7 +67,7 @@ async function handleConnection() {
|
|
|
67
67
|
}
|
|
68
68
|
async function evalExpr(input) {
|
|
69
69
|
try {
|
|
70
|
-
const r = await eval_like(input.expr, computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore
|
|
70
|
+
const r = await eval_like(input.expr, computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
71
71
|
error = '';
|
|
72
72
|
return r;
|
|
73
73
|
}
|
|
@@ -81,7 +81,7 @@ async function getValue(input) {
|
|
|
81
81
|
return;
|
|
82
82
|
if (input.type === 'template' && isCodeInjection(input.eval)) {
|
|
83
83
|
try {
|
|
84
|
-
const r = await eval_like('`' + input.eval + '`', computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore
|
|
84
|
+
const r = await eval_like('`' + input.eval + '`', computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
85
85
|
error = '';
|
|
86
86
|
return r;
|
|
87
87
|
}
|
|
@@ -108,7 +108,7 @@ async function executeComponent(noToast = false, inlineScriptOverride) {
|
|
|
108
108
|
if (runnable?.type === 'runnableByName' && runnable.inlineScript?.language === 'frontend') {
|
|
109
109
|
loading = true;
|
|
110
110
|
try {
|
|
111
|
-
const r = await eval_like(runnable.inlineScript?.content, computeGlobalContext($worldStore, id, {}), false, $state, $mode == 'dnd', $componentControl, $worldStore
|
|
111
|
+
const r = await eval_like(runnable.inlineScript?.content, computeGlobalContext($worldStore, id, {}), false, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
112
112
|
await setResult(r);
|
|
113
113
|
$state = $state;
|
|
114
114
|
}
|
|
@@ -200,7 +200,7 @@ async function setResult(res) {
|
|
|
200
200
|
const hasRes = res !== undefined && res !== null;
|
|
201
201
|
if (transformer) {
|
|
202
202
|
$worldStore.newOutput(id, 'raw', res);
|
|
203
|
-
res = await eval_like(transformer.content, computeGlobalContext($worldStore, id, { result: res }), false, $state, $mode == 'dnd', $componentControl, $worldStore
|
|
203
|
+
res = await eval_like(transformer.content, computeGlobalContext($worldStore, id, { result: res }), false, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
204
204
|
if (hasRes && res === undefined) {
|
|
205
205
|
res = {
|
|
206
206
|
error: {
|
|
@@ -35,7 +35,7 @@ function isRunnableDefined(componentInput) {
|
|
|
35
35
|
}
|
|
36
36
|
export function onSuccess() {
|
|
37
37
|
if (recomputeIds) {
|
|
38
|
-
recomputeIds.
|
|
38
|
+
recomputeIds.map((id) => $runnableComponents?.cb?.[id]?.());
|
|
39
39
|
}
|
|
40
40
|
if (!doOnSuccess)
|
|
41
41
|
return;
|
|
@@ -2,6 +2,4 @@ import type { World } from '../../rx';
|
|
|
2
2
|
export declare function computeGlobalContext(world: World | undefined, id: string | undefined, extraContext?: any): any;
|
|
3
3
|
export declare function eval_like(text: string, context: {} | undefined, noReturn: boolean, state: Record<string, any>, editor: boolean, controlComponents: Record<string, {
|
|
4
4
|
setTab?: (index: number) => void;
|
|
5
|
-
}>, worldStore: World | undefined
|
|
6
|
-
cb?: () => void;
|
|
7
|
-
}>): Promise<any>;
|
|
5
|
+
}>, worldStore: World | undefined): Promise<any>;
|
|
@@ -15,7 +15,7 @@ export function computeGlobalContext(world, id, extraContext = {}) {
|
|
|
15
15
|
}
|
|
16
16
|
function create_context_function_template(eval_string, context, noReturn) {
|
|
17
17
|
return `
|
|
18
|
-
return async function (context, state, goto, setTab
|
|
18
|
+
return async function (context, state, goto, setTab) {
|
|
19
19
|
"use strict";
|
|
20
20
|
${Object.keys(context).length > 0
|
|
21
21
|
? `let ${Object.keys(context).map((key) => ` ${key} = context['${key}']`)};`
|
|
@@ -58,7 +58,7 @@ function isSerializable(obj) {
|
|
|
58
58
|
}
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
|
-
export async function eval_like(text, context = {}, noReturn, state, editor, controlComponents, worldStore
|
|
61
|
+
export async function eval_like(text, context = {}, noReturn, state, editor, controlComponents, worldStore) {
|
|
62
62
|
const proxiedState = new Proxy(state, {
|
|
63
63
|
set(target, key, value) {
|
|
64
64
|
if (typeof key !== 'string') {
|
|
@@ -88,7 +88,5 @@ export async function eval_like(text, context = {}, noReturn, state, editor, con
|
|
|
88
88
|
}
|
|
89
89
|
}, (id, index) => {
|
|
90
90
|
controlComponents[id]?.setTab?.(index);
|
|
91
|
-
}, (id) => {
|
|
92
|
-
runnableComponents[id]?.cb?.();
|
|
93
91
|
});
|
|
94
92
|
}
|
|
@@ -35,7 +35,7 @@ function handleItems() {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
$: value && outputs?.result.set(value.map((v) => v.value));
|
|
38
|
-
$: css = concatCustomCss($app.css?.
|
|
38
|
+
$: css = concatCustomCss($app.css?.selectcomponent, customCss);
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<InputValue {id} input={configuration.items} bind:value={labels} />
|
|
@@ -44,12 +44,8 @@ $: css = concatCustomCss($app.css?.multiselectcomponent, customCss);
|
|
|
44
44
|
<AlignWrapper {render} {horizontalAlignment} {verticalAlignment}>
|
|
45
45
|
<div
|
|
46
46
|
class="app-select w-full"
|
|
47
|
-
style="height:
|
|
48
|
-
on:pointerdown
|
|
49
|
-
if (!e.shiftKey) {
|
|
50
|
-
e.stopPropagation()
|
|
51
|
-
}
|
|
52
|
-
}}
|
|
47
|
+
style="height: 34px; overflow: auto;"
|
|
48
|
+
on:pointerdown|stopPropagation
|
|
53
49
|
>
|
|
54
50
|
{#if !value || Array.isArray(value)}
|
|
55
51
|
<Select
|
|
@@ -59,7 +55,7 @@ $: css = concatCustomCss($app.css?.multiselectcomponent, customCss);
|
|
|
59
55
|
on:change={(e) => e.stopPropagation()}
|
|
60
56
|
{items}
|
|
61
57
|
inputStyles={SELECT_INPUT_DEFAULT_STYLE.inputStyles}
|
|
62
|
-
containerStyles={'border-color: #999;
|
|
58
|
+
containerStyles={'border-color: #999;' +
|
|
63
59
|
SELECT_INPUT_DEFAULT_STYLE.containerStyles +
|
|
64
60
|
css?.input?.style}
|
|
65
61
|
bind:value
|
|
@@ -87,15 +87,7 @@ let filterText = '';
|
|
|
87
87
|
<InputValue {id} input={configuration.create} bind:value={create} />
|
|
88
88
|
|
|
89
89
|
<AlignWrapper {render} {horizontalAlignment} {verticalAlignment}>
|
|
90
|
-
<div
|
|
91
|
-
class="app-select w-full"
|
|
92
|
-
style="height: 34px;"
|
|
93
|
-
on:pointerdown={(e) => {
|
|
94
|
-
if (!e.shiftKey) {
|
|
95
|
-
e.stopPropagation()
|
|
96
|
-
}
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
90
|
+
<div class="app-select w-full" style="height: 34px;" on:pointerdown|stopPropagation>
|
|
99
91
|
<Select
|
|
100
92
|
--border-radius="0"
|
|
101
93
|
--border-color="#999"
|