windmill-components 1.79.0 → 1.82.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 +3 -0
- package/components/ArgInput.svelte.d.ts +1 -0
- package/components/DisplayResult.svelte +18 -15
- package/components/SchemaEditor.svelte +15 -10
- package/components/SettingSection.svelte +1 -1
- package/components/Toggle.svelte +5 -2
- package/components/Toggle.svelte.d.ts +1 -0
- package/components/apps/components/buttons/AppButton.svelte +33 -40
- package/components/apps/components/buttons/AppButton.svelte.d.ts +2 -1
- package/components/apps/components/buttons/AppForm.svelte +22 -15
- package/components/apps/components/buttons/AppForm.svelte.d.ts +1 -1
- package/components/apps/components/buttons/AppFormButton.svelte +32 -24
- package/components/apps/components/buttons/AppFormButton.svelte.d.ts +1 -3
- package/components/apps/components/display/AppBarChart.svelte +2 -2
- package/components/apps/components/display/AppBarChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppDisplayComponent.svelte +2 -2
- package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +1 -1
- package/components/apps/components/display/AppHtml.svelte +10 -2
- package/components/apps/components/display/AppHtml.svelte.d.ts +1 -1
- package/components/apps/components/display/AppIcon.svelte +4 -1
- package/components/apps/components/display/AppIcon.svelte.d.ts +1 -1
- package/components/apps/components/display/AppImage.svelte +28 -15
- package/components/apps/components/display/AppImage.svelte.d.ts +1 -1
- package/components/apps/components/display/AppMap.svelte.d.ts +1 -1
- package/components/apps/components/display/AppPdf.svelte +3 -2
- package/components/apps/components/display/AppPdf.svelte.d.ts +1 -1
- package/components/apps/components/display/AppPieChart.svelte +2 -2
- package/components/apps/components/display/AppPieChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppScatterChart.svelte +2 -2
- package/components/apps/components/display/AppScatterChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppText.svelte +35 -22
- package/components/apps/components/display/AppText.svelte.d.ts +1 -1
- package/components/apps/components/display/AppTimeseries.svelte +2 -2
- package/components/apps/components/display/AppTimeseries.svelte.d.ts +1 -1
- package/components/apps/components/display/PlotlyHtml.svelte +2 -2
- package/components/apps/components/display/VegaLiteHtml.svelte +2 -2
- package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
- package/components/apps/components/display/table/AppTable.svelte +28 -12
- package/components/apps/components/display/table/AppTable.svelte.d.ts +1 -1
- package/components/apps/components/helpers/HiddenComponent.svelte +6 -3
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +1 -1
- package/components/apps/components/helpers/InputValue.svelte +9 -9
- package/components/apps/components/helpers/Loader.svelte +18 -0
- package/components/apps/components/helpers/Loader.svelte.d.ts +18 -0
- package/components/apps/components/helpers/NonRunnableComponent.svelte +1 -12
- package/components/apps/components/helpers/ResolveConfig.svelte +29 -0
- package/components/apps/components/helpers/ResolveConfig.svelte.d.ts +21 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +114 -89
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +13 -3
- package/components/apps/components/helpers/RunnableWrapper.svelte +48 -9
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +26 -2
- package/components/apps/components/inputs/AppCheckbox.svelte +1 -1
- package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppDateInput.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppFileInput.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte +0 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppNumberInput.svelte +1 -1
- package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +1 -3
- package/components/apps/components/inputs/AppRangeInput.svelte +7 -1
- package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +2 -1
- package/components/apps/components/inputs/AppSelect.svelte +8 -3
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppSliderInputs.svelte +7 -1
- package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +2 -1
- package/components/apps/components/inputs/AppTextInput.svelte +4 -4
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -3
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +17 -19
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppContainer.svelte +7 -4
- package/components/apps/components/layout/AppContainer.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppDivider.svelte +4 -1
- package/components/apps/components/layout/AppDivider.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppDrawer.svelte +7 -4
- package/components/apps/components/layout/AppDrawer.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppSplitpanes.svelte +34 -21
- package/components/apps/components/layout/AppSplitpanes.svelte.d.ts +1 -3
- package/components/apps/components/layout/AppTabs.svelte +17 -34
- package/components/apps/components/layout/AppTabs.svelte.d.ts +1 -2
- package/components/apps/editor/AppEditor.svelte +3 -1
- package/components/apps/editor/AppEditorHeader.svelte +2 -3
- package/components/apps/editor/AppPreview.svelte +10 -15
- package/components/apps/editor/ComponentHeader.svelte +10 -8
- package/components/apps/editor/ComponentHeader.svelte.d.ts +0 -1
- package/components/apps/editor/GridEditor.svelte +21 -50
- package/components/apps/editor/GridEditor.svelte.d.ts +0 -2
- package/components/apps/editor/RecomputeAllComponents.svelte +13 -2
- package/components/apps/editor/SettingsPanel.svelte +103 -40
- package/components/apps/editor/SubGridEditor.svelte +32 -41
- package/components/apps/editor/SubGridEditor.svelte.d.ts +1 -2
- package/components/apps/editor/appUtils.d.ts +49 -7
- package/components/apps/editor/appUtils.js +133 -37
- package/components/apps/editor/component/Component.svelte +21 -10
- package/components/apps/editor/component/Component.svelte.d.ts +1 -2
- package/components/apps/editor/component/ComponentNavigation.svelte +17 -11
- package/components/apps/editor/component/components.d.ts +1550 -17
- package/components/apps/editor/component/components.js +295 -325
- package/components/apps/editor/component/default-codes.d.ts +1 -1
- package/components/apps/editor/component/default-codes.js +25 -25
- package/components/apps/editor/componentsPanel/ComponentList.svelte +18 -3
- package/components/apps/editor/componentsPanel/CssProperty.svelte +5 -3
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +3 -1
- package/components/apps/editor/componentsPanel/CssSettings.svelte +48 -90
- package/components/apps/editor/componentsPanel/ListItem.svelte +3 -0
- package/components/apps/editor/componentsPanel/ListItem.svelte.d.ts +2 -0
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +1 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +146 -130
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +2 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +31 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +42 -76
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +67 -17
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte.d.ts +1 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +27 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte.d.ts +17 -0
- package/components/apps/editor/inlineScriptsPanel/utils.d.ts +2 -0
- package/components/apps/editor/inlineScriptsPanel/utils.js +6 -5
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +10 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +37 -31
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +4 -104
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +90 -54
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +5 -3
- package/components/apps/editor/settingsPanel/GridTab.svelte +0 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +99 -80
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +8 -0
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +25 -2
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +52 -0
- package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte.d.ts +28 -0
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +70 -26
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +7 -5
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte.d.ts +3 -2
- package/components/apps/editor/settingsPanel/TableActions.svelte +8 -63
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +2 -4
- package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +3 -1
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte.d.ts +2 -4
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +5 -5
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +47 -31
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +8 -2
- package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte +46 -0
- package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte.d.ts +20 -0
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +7 -0
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte +20 -70
- package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +14 -8
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte.d.ts +5 -1
- package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte +85 -27
- package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte.d.ts +4 -6
- package/components/apps/gridUtils.js +1 -1
- package/components/apps/inputType.d.ts +12 -16
- package/components/apps/rx.d.ts +2 -0
- package/components/apps/rx.js +8 -2
- package/components/apps/svelte-grid/Grid.svelte +0 -4
- package/components/apps/svelte-grid/Grid.svelte.d.ts +1 -1
- package/components/apps/svelte-grid/MoveResize.svelte +24 -30
- package/components/apps/svelte-grid/MoveResize.svelte.d.ts +0 -4
- package/components/apps/svelte-grid/types.d.ts +1 -7
- package/components/apps/svelte-grid/utils/helper.js +6 -10
- package/components/apps/types.d.ts +21 -22
- package/components/apps/utils.d.ts +2 -2
- package/components/apps/utils.js +13 -11
- package/components/common/skeleton/Skeleton.svelte +1 -1
- package/components/flows/flowStateUtils.js +8 -1
- package/package.json +7 -4
- package/components/apps/editor/GridPanel.svelte +0 -31
- package/components/apps/editor/GridPanel.svelte.d.ts +0 -18
- package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +0 -12
- package/components/apps/editor/componentsPanel/componentStaticValues.js +0 -25
|
@@ -19,7 +19,8 @@ export let id;
|
|
|
19
19
|
export let defaultUserInput = false;
|
|
20
20
|
export let fields = {};
|
|
21
21
|
export let syncFields = false;
|
|
22
|
-
|
|
22
|
+
export let transformer = false;
|
|
23
|
+
const { runnableComponents, stateId, worldStore, state, appPath, app } = getContext('AppViewerContext');
|
|
23
24
|
let editor;
|
|
24
25
|
let simpleEditor;
|
|
25
26
|
let validCode = true;
|
|
@@ -34,21 +35,21 @@ async function inferInlineScriptSchema(language, content, schema) {
|
|
|
34
35
|
}
|
|
35
36
|
return schema;
|
|
36
37
|
}
|
|
37
|
-
$: inlineScript.path = `${appPath}/${name}
|
|
38
|
+
$: inlineScript && (inlineScript.path = `${appPath}/${name}`);
|
|
38
39
|
onMount(async () => {
|
|
39
40
|
if (inlineScript && !inlineScript.schema) {
|
|
40
41
|
if (inlineScript.language != 'frontend') {
|
|
41
42
|
inlineScript.schema = await inferInlineScriptSchema(inlineScript?.language, inlineScript?.content, emptySchema());
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
if (inlineScript.
|
|
45
|
+
if (inlineScript?.schema && inlineScript.language != 'frontend') {
|
|
45
46
|
loadSchemaAndInputsByName();
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
const dispatch = createEventDispatcher();
|
|
49
50
|
let runLoading = false;
|
|
50
51
|
async function loadSchemaAndInputsByName() {
|
|
51
|
-
if (syncFields) {
|
|
52
|
+
if (syncFields && inlineScript) {
|
|
52
53
|
const newSchema = inlineScript.schema ?? emptySchema();
|
|
53
54
|
const newFields = computeFields(newSchema, defaultUserInput, fields);
|
|
54
55
|
if (!deepEqual(newFields, fields)) {
|
|
@@ -59,13 +60,13 @@ async function loadSchemaAndInputsByName() {
|
|
|
59
60
|
}
|
|
60
61
|
let isMac = navigator.userAgent.indexOf('Mac OS X') !== -1;
|
|
61
62
|
$: extraLib =
|
|
62
|
-
inlineScript
|
|
63
|
+
inlineScript?.language == 'frontend' && worldStore
|
|
63
64
|
? buildExtraLib($worldStore?.outputsById ?? {}, id, false, $state, true)
|
|
64
65
|
: undefined;
|
|
65
|
-
let refreshOn = inlineScript
|
|
66
|
+
let refreshOn = inlineScript?.refreshOn?.map((x) => `${x.id}.${x.key}`).join(' ') ?? '';
|
|
66
67
|
$: handleRefreshOn(refreshOn);
|
|
67
68
|
function handleRefreshOn(refreshOn) {
|
|
68
|
-
if (refreshOn && refreshOn != '') {
|
|
69
|
+
if (refreshOn && refreshOn != '' && inlineScript) {
|
|
69
70
|
inlineScript.refreshOn = refreshOn
|
|
70
71
|
.split(' ')
|
|
71
72
|
.filter((x) => x.split('.').length == 2)
|
|
@@ -77,147 +78,162 @@ function handleRefreshOn(refreshOn) {
|
|
|
77
78
|
}
|
|
78
79
|
</script>
|
|
79
80
|
|
|
80
|
-
{#if inlineScript
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
|
|
84
|
-
<div class="h-full flex flex-col gap-1">
|
|
85
|
-
<div class="flex justify-between w-full gap-2 px-2 pt-1 flex-row items-center">
|
|
86
|
-
{#if name !== undefined}
|
|
87
|
-
<input
|
|
88
|
-
on:keydown|stopPropagation
|
|
89
|
-
bind:value={name}
|
|
90
|
-
placeholder="Inline script name"
|
|
91
|
-
class="!text-xs !rounded-xs"
|
|
92
|
-
/>
|
|
93
|
-
{/if}
|
|
94
|
-
<div class="flex w-full flex-row gap-2 items-center justify-end">
|
|
95
|
-
{#if validCode}
|
|
96
|
-
<Badge color="green" baseClass="!text-2xs">Valid</Badge>
|
|
97
|
-
{:else}
|
|
98
|
-
<Badge color="red" baseClass="!text-2xs">Invalid</Badge>
|
|
99
|
-
{/if}
|
|
81
|
+
{#if inlineScript}
|
|
82
|
+
{#if inlineScript.language != 'frontend'}
|
|
83
|
+
<InlineScriptEditorDrawer {editor} bind:this={inlineScriptEditorDrawer} bind:inlineScript />
|
|
84
|
+
{/if}
|
|
100
85
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
{/if}
|
|
115
|
-
{#if inlineScript.language != 'frontend'}
|
|
116
|
-
<Popover notClickable placement="bottom">
|
|
117
|
-
<Button
|
|
118
|
-
size="xs"
|
|
119
|
-
color="light"
|
|
120
|
-
btnClasses="!px-2 !bg-gray-100 hover:!bg-gray-200"
|
|
121
|
-
aria-label="Open full editor"
|
|
122
|
-
on:click={() => {
|
|
123
|
-
inlineScriptEditorDrawer?.openDrawer()
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
<Maximize2 size={14} />
|
|
127
|
-
</Button>
|
|
128
|
-
<svelte:fragment slot="text">Open full editor</svelte:fragment>
|
|
129
|
-
</Popover>
|
|
86
|
+
<div class="h-full flex flex-col gap-1">
|
|
87
|
+
<div class="flex justify-between w-full gap-2 px-2 pt-1 flex-row items-center">
|
|
88
|
+
{#if name !== undefined}
|
|
89
|
+
{#if !transformer}
|
|
90
|
+
<input
|
|
91
|
+
on:keydown|stopPropagation
|
|
92
|
+
bind:value={name}
|
|
93
|
+
placeholder="Inline script name"
|
|
94
|
+
class="!text-xs !rounded-xs"
|
|
95
|
+
/>
|
|
96
|
+
{:else}
|
|
97
|
+
<span class="text-xs font-semibold truncate w-full">{name} of {id}</span>
|
|
98
|
+
{/if}
|
|
130
99
|
{/if}
|
|
100
|
+
<div class="flex w-full flex-row gap-2 items-center justify-end">
|
|
101
|
+
{#if validCode}
|
|
102
|
+
<Badge color="green" baseClass="!text-2xs">Valid</Badge>
|
|
103
|
+
{:else}
|
|
104
|
+
<Badge color="red" baseClass="!text-2xs">Invalid</Badge>
|
|
105
|
+
{/if}
|
|
131
106
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
107
|
+
{#if id.startsWith('unused-') || id.startsWith('bg_')}
|
|
108
|
+
<Popover notClickable placement="bottom">
|
|
109
|
+
<Button
|
|
110
|
+
size="xs"
|
|
111
|
+
color="light"
|
|
112
|
+
btnClasses="!px-2 !bg-red-100 hover:!bg-red-200"
|
|
113
|
+
aria-label="Delete"
|
|
114
|
+
on:click={() => dispatch('delete')}
|
|
115
|
+
>
|
|
116
|
+
<Trash2 size={14} class="text-red-800" />
|
|
117
|
+
</Button>
|
|
118
|
+
<svelte:fragment slot="text">Delete</svelte:fragment>
|
|
119
|
+
</Popover>
|
|
120
|
+
{/if}
|
|
121
|
+
{#if inlineScript.language != 'frontend'}
|
|
122
|
+
<Popover notClickable placement="bottom">
|
|
123
|
+
<Button
|
|
124
|
+
size="xs"
|
|
125
|
+
color="light"
|
|
126
|
+
btnClasses="!px-2 !bg-gray-100 hover:!bg-gray-200"
|
|
127
|
+
aria-label="Open full editor"
|
|
128
|
+
on:click={() => {
|
|
129
|
+
inlineScriptEditorDrawer?.openDrawer()
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
Full Editor <Maximize2 size={14} />
|
|
133
|
+
</Button>
|
|
134
|
+
<svelte:fragment slot="text">Open full editor</svelte:fragment>
|
|
135
|
+
</Popover>
|
|
136
|
+
{/if}
|
|
144
137
|
|
|
145
|
-
<div class="flex flex-row items-center gap-1">
|
|
146
|
-
<Kbd>{isMac ? '⌘' : 'CTRL'}</Kbd>
|
|
147
|
-
<Kbd>S</Kbd>
|
|
148
|
-
</div>
|
|
149
|
-
</div>
|
|
150
|
-
</Button>
|
|
151
|
-
{#if $runnableComponents[id] != undefined}
|
|
152
138
|
<Button
|
|
153
|
-
loading={runLoading}
|
|
154
|
-
size="xs"
|
|
155
|
-
color="dark"
|
|
156
139
|
variant="border"
|
|
157
|
-
|
|
140
|
+
size="xs"
|
|
141
|
+
color="light"
|
|
142
|
+
btnClasses="!px-2 !py-1"
|
|
158
143
|
on:click={async () => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
runLoading = false
|
|
144
|
+
editor?.format()
|
|
145
|
+
simpleEditor?.format()
|
|
162
146
|
}}
|
|
163
147
|
>
|
|
164
148
|
<div class="flex flex-row gap-1 items-center">
|
|
165
|
-
|
|
149
|
+
Format
|
|
166
150
|
|
|
167
151
|
<div class="flex flex-row items-center gap-1">
|
|
168
152
|
<Kbd>{isMac ? '⌘' : 'CTRL'}</Kbd>
|
|
169
|
-
<Kbd>
|
|
170
|
-
<div class="h-4 flex items-center justify-center">
|
|
171
|
-
<CornerDownLeft size={10} />
|
|
172
|
-
</div>
|
|
173
|
-
</Kbd>
|
|
153
|
+
<Kbd>S</Kbd>
|
|
174
154
|
</div>
|
|
175
155
|
</div>
|
|
176
156
|
</Button>
|
|
177
|
-
|
|
157
|
+
{#if $runnableComponents[id] != undefined}
|
|
158
|
+
<Button
|
|
159
|
+
loading={runLoading}
|
|
160
|
+
size="xs"
|
|
161
|
+
color="dark"
|
|
162
|
+
variant="border"
|
|
163
|
+
btnClasses="!px-2 !py-1 !bg-gray-700 !text-white hover:!bg-gray-900"
|
|
164
|
+
on:click={async () => {
|
|
165
|
+
runLoading = true
|
|
166
|
+
await $runnableComponents[id]?.(!transformer ? inlineScript : undefined)
|
|
167
|
+
runLoading = false
|
|
168
|
+
}}
|
|
169
|
+
>
|
|
170
|
+
<div class="flex flex-row gap-1 items-center">
|
|
171
|
+
Run
|
|
172
|
+
|
|
173
|
+
<div class="flex flex-row items-center gap-1">
|
|
174
|
+
<Kbd>{isMac ? '⌘' : 'CTRL'}</Kbd>
|
|
175
|
+
<Kbd>
|
|
176
|
+
<div class="h-4 flex items-center justify-center">
|
|
177
|
+
<CornerDownLeft size={10} />
|
|
178
|
+
</div>
|
|
179
|
+
</Kbd>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</Button>
|
|
183
|
+
{/if}
|
|
184
|
+
</div>
|
|
178
185
|
</div>
|
|
179
|
-
</div>
|
|
180
186
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
on:change={async (e) => {
|
|
195
|
-
if (inlineScript && inlineScript.language != 'frontend') {
|
|
196
|
-
const oldSchema = JSON.stringify(inlineScript.schema)
|
|
197
|
-
if (inlineScript.schema == undefined) {
|
|
198
|
-
inlineScript.schema = emptySchema()
|
|
187
|
+
<!-- {inlineScript.content} -->
|
|
188
|
+
|
|
189
|
+
<div class="border h-full">
|
|
190
|
+
{#if inlineScript.language != 'frontend'}
|
|
191
|
+
<Editor
|
|
192
|
+
bind:this={editor}
|
|
193
|
+
class="flex flex-1 grow h-full"
|
|
194
|
+
lang={scriptLangToEditorLang(inlineScript?.language)}
|
|
195
|
+
bind:code={inlineScript.content}
|
|
196
|
+
fixedOverflowWidgets={true}
|
|
197
|
+
cmdEnterAction={async () => {
|
|
198
|
+
if (inlineScript) {
|
|
199
|
+
inlineScript.content = editor?.getCode() ?? ''
|
|
199
200
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
runLoading = true
|
|
202
|
+
await $runnableComponents[id]?.(inlineScript)
|
|
203
|
+
runLoading = false
|
|
204
|
+
}}
|
|
205
|
+
on:change={async (e) => {
|
|
206
|
+
if (inlineScript && inlineScript.language != 'frontend') {
|
|
207
|
+
const oldSchema = JSON.stringify(inlineScript.schema)
|
|
208
|
+
if (inlineScript.schema == undefined) {
|
|
209
|
+
inlineScript.schema = emptySchema()
|
|
210
|
+
}
|
|
211
|
+
await inferInlineScriptSchema(inlineScript?.language, e.detail, inlineScript.schema)
|
|
212
|
+
if (JSON.stringify(inlineScript.schema) != oldSchema) {
|
|
213
|
+
inlineScript = inlineScript
|
|
214
|
+
loadSchemaAndInputsByName()
|
|
215
|
+
}
|
|
204
216
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
$app = $app
|
|
218
|
+
}}
|
|
219
|
+
/>
|
|
220
|
+
{:else}
|
|
221
|
+
<SimpleEditor
|
|
222
|
+
bind:this={simpleEditor}
|
|
223
|
+
cmdEnterAction={async () => {
|
|
224
|
+
runLoading = true
|
|
225
|
+
await $runnableComponents[id]?.(!transformer ? inlineScript : undefined)
|
|
226
|
+
runLoading = false
|
|
227
|
+
}}
|
|
228
|
+
class="h-full"
|
|
229
|
+
{extraLib}
|
|
230
|
+
bind:code={inlineScript.content}
|
|
231
|
+
lang="javascript"
|
|
232
|
+
on:change={() => {
|
|
233
|
+
$app = $app
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
{/if}
|
|
237
|
+
</div>
|
|
222
238
|
</div>
|
|
223
|
-
|
|
239
|
+
{/if}
|
|
@@ -3,12 +3,13 @@ import type { InlineScript } from '../../types';
|
|
|
3
3
|
import type { AppInput } from '../../inputType';
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
|
-
inlineScript: InlineScript;
|
|
6
|
+
inlineScript: InlineScript | undefined;
|
|
7
7
|
name?: string | undefined;
|
|
8
8
|
id: string;
|
|
9
9
|
defaultUserInput?: boolean | undefined;
|
|
10
10
|
fields?: Record<string, AppInput> | undefined;
|
|
11
11
|
syncFields?: boolean | undefined;
|
|
12
|
+
transformer?: boolean | undefined;
|
|
12
13
|
};
|
|
13
14
|
events: {
|
|
14
15
|
keydown: KeyboardEvent;
|
|
@@ -11,9 +11,12 @@ import EmptyInlineScript from './EmptyInlineScript.svelte';
|
|
|
11
11
|
import InlineScriptEditor from './InlineScriptEditor.svelte';
|
|
12
12
|
import { computeFields } from './utils';
|
|
13
13
|
import { deepEqual } from 'fast-equals';
|
|
14
|
+
import { getContext } from 'svelte';
|
|
14
15
|
export let componentInput;
|
|
15
16
|
export let defaultUserInput = false;
|
|
16
17
|
export let id;
|
|
18
|
+
export let transformer;
|
|
19
|
+
const { app } = getContext('AppViewerContext');
|
|
17
20
|
async function fork(path) {
|
|
18
21
|
let { content, language, schema } = await getScriptByPath(path);
|
|
19
22
|
if (componentInput && componentInput.type == 'runnable') {
|
|
@@ -67,7 +70,27 @@ function deleteInlineScript() {
|
|
|
67
70
|
</DrawerContent>
|
|
68
71
|
</Drawer>
|
|
69
72
|
|
|
70
|
-
{#if
|
|
73
|
+
{#if transformer}
|
|
74
|
+
{#if componentInput?.type == 'runnable' && componentInput.transformer}
|
|
75
|
+
<InlineScriptEditor
|
|
76
|
+
transformer
|
|
77
|
+
defaultUserInput={false}
|
|
78
|
+
{id}
|
|
79
|
+
bind:inlineScript={componentInput.transformer}
|
|
80
|
+
name="Transformer"
|
|
81
|
+
on:delete={() => {
|
|
82
|
+
if (componentInput?.type == 'runnable') {
|
|
83
|
+
componentInput.transformer = undefined
|
|
84
|
+
componentInput = componentInput
|
|
85
|
+
}
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
{:else}
|
|
89
|
+
<span class="px-2 text-gray-600"
|
|
90
|
+
>Selected editor component is a transformer but component has no transformer
|
|
91
|
+
</span>
|
|
92
|
+
{/if}
|
|
93
|
+
{:else if componentInput && componentInput.type == 'runnable'}
|
|
71
94
|
{#if componentInput?.runnable?.type === 'runnableByName' && componentInput?.runnable?.name !== undefined}
|
|
72
95
|
{#if componentInput.runnable.inlineScript}
|
|
73
96
|
<InlineScriptEditor
|
|
@@ -91,6 +114,7 @@ function deleteInlineScript() {
|
|
|
91
114
|
componentInput?.runnable?.type === 'runnableByName'
|
|
92
115
|
) {
|
|
93
116
|
componentInput.runnable.inlineScript = e.detail
|
|
117
|
+
$app = $app
|
|
94
118
|
}
|
|
95
119
|
}}
|
|
96
120
|
/>
|
|
@@ -109,6 +133,7 @@ function deleteInlineScript() {
|
|
|
109
133
|
componentInput.runnable?.type === 'runnableByPath'
|
|
110
134
|
) {
|
|
111
135
|
fork(componentInput.runnable.path)
|
|
136
|
+
$app = $app
|
|
112
137
|
}
|
|
113
138
|
}}
|
|
114
139
|
>
|
|
@@ -127,8 +152,10 @@ function deleteInlineScript() {
|
|
|
127
152
|
on:click={() => {
|
|
128
153
|
flowPath = componentInput?.['runnable']?.path
|
|
129
154
|
drawerFlowViewer.openDrawer()
|
|
130
|
-
}}
|
|
155
|
+
}}
|
|
131
156
|
>
|
|
157
|
+
Expand
|
|
158
|
+
</Button>
|
|
132
159
|
<Button
|
|
133
160
|
size="xs"
|
|
134
161
|
startIcon={{ icon: faPen }}
|
|
@@ -142,8 +169,9 @@ function deleteInlineScript() {
|
|
|
142
169
|
endIcon={{ icon: faExternalLinkAlt }}
|
|
143
170
|
target="_blank"
|
|
144
171
|
href="/flows/get/{componentInput?.['runnable']?.path}?workspace_id={$workspaceStore}"
|
|
145
|
-
>Details page</Button
|
|
146
172
|
>
|
|
173
|
+
Details page
|
|
174
|
+
</Button>
|
|
147
175
|
</div>
|
|
148
176
|
<FlowPathViewer path={componentInput.runnable.path} />
|
|
149
177
|
{:else}
|
|
@@ -4,114 +4,80 @@ import { Pane, Splitpanes } from 'svelte-splitpanes';
|
|
|
4
4
|
import InlineScriptsPanelList from './InlineScriptsPanelList.svelte';
|
|
5
5
|
import InlineScriptEditor from './InlineScriptEditor.svelte';
|
|
6
6
|
import EmptyInlineScript from './EmptyInlineScript.svelte';
|
|
7
|
-
import
|
|
7
|
+
import InlineScriptsPanelWithTable from './InlineScriptsPanelWithTable.svelte';
|
|
8
|
+
import { findGridItem } from '../appUtils';
|
|
8
9
|
const { app, runnableComponents } = getContext('AppViewerContext');
|
|
9
|
-
|
|
10
|
+
const { selectedComponentInEditor } = getContext('AppEditorContext');
|
|
10
11
|
function deleteBackgroundScript(index) {
|
|
11
12
|
// remove the script from the array at the index
|
|
12
13
|
$app.hiddenInlineScripts.splice(index, 1);
|
|
13
14
|
$app.hiddenInlineScripts = [...$app.hiddenInlineScripts];
|
|
14
15
|
delete $runnableComponents[`bg_${index}`];
|
|
15
16
|
}
|
|
17
|
+
$: gridItem =
|
|
18
|
+
$selectedComponentInEditor && !$selectedComponentInEditor.startsWith('bg_')
|
|
19
|
+
? findGridItem($app, $selectedComponentInEditor?.split('_')?.[0])
|
|
20
|
+
: undefined;
|
|
21
|
+
$: hiddenInlineScript = $app?.hiddenInlineScripts?.findIndex((k_, index) => `bg_${index}` === $selectedComponentInEditor);
|
|
22
|
+
$: unusedInlineScript = $app?.unusedInlineScripts?.findIndex((k_, index) => `unused-${index}` === $selectedComponentInEditor);
|
|
16
23
|
</script>
|
|
17
24
|
|
|
18
25
|
<SplitPanesWrapper>
|
|
19
26
|
<Splitpanes class="!overflow-visible">
|
|
20
27
|
<Pane size={25}>
|
|
21
|
-
<InlineScriptsPanelList
|
|
28
|
+
<InlineScriptsPanelList />
|
|
22
29
|
</Pane>
|
|
23
30
|
<Pane size={75}>
|
|
24
|
-
{#if
|
|
31
|
+
{#if !$selectedComponentInEditor}
|
|
25
32
|
<div class="text-sm text-gray-500 text-center py-8 px-2">
|
|
26
33
|
Select a script on the left panel
|
|
27
34
|
</div>
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
gridItem?.data?.type == 'formbuttoncomponent'}
|
|
35
|
-
id={gridItem.data.id}
|
|
36
|
-
bind:componentInput={gridItem.data.componentInput}
|
|
37
|
-
/>
|
|
38
|
-
{/if}
|
|
39
|
-
|
|
40
|
-
{#if gridItem?.data?.type === 'tablecomponent'}
|
|
41
|
-
{#each gridItem.data.actionButtons as actionButton (actionButton.id)}
|
|
42
|
-
{#if actionButton.id === selectedScriptComponentId}
|
|
43
|
-
<InlineScriptEditorPanel
|
|
44
|
-
id={actionButton.id}
|
|
45
|
-
bind:componentInput={actionButton.componentInput}
|
|
46
|
-
/>
|
|
47
|
-
{/if}
|
|
48
|
-
{/each}
|
|
49
|
-
{/if}
|
|
50
|
-
{/each}
|
|
51
|
-
|
|
52
|
-
{#if $app.subgrids}
|
|
53
|
-
{#each Object.keys($app.subgrids ?? {}) as key (key)}
|
|
54
|
-
{#each $app.subgrids[key] as gridItem (gridItem?.data?.id)}
|
|
55
|
-
{#if gridItem?.data?.id && gridItem.data.id === selectedScriptComponentId}
|
|
56
|
-
<InlineScriptEditorPanel
|
|
57
|
-
defaultUserInput={gridItem.data?.type == 'formcomponent' ||
|
|
58
|
-
gridItem?.data?.type == 'formbuttoncomponent'}
|
|
59
|
-
id={gridItem.data.id}
|
|
60
|
-
bind:componentInput={gridItem.data.componentInput}
|
|
61
|
-
/>
|
|
62
|
-
{/if}
|
|
63
|
-
|
|
64
|
-
{#if gridItem?.data?.type === 'tablecomponent'}
|
|
65
|
-
{#each gridItem.data.actionButtons as actionButton, index (index)}
|
|
66
|
-
{#if actionButton.id === selectedScriptComponentId}
|
|
67
|
-
<InlineScriptEditorPanel
|
|
68
|
-
id={actionButton.id}
|
|
69
|
-
bind:componentInput={actionButton.componentInput}
|
|
70
|
-
/>
|
|
71
|
-
{/if}
|
|
72
|
-
{/each}
|
|
73
|
-
{/if}
|
|
74
|
-
{/each}
|
|
75
|
-
{/each}
|
|
76
|
-
{/if}
|
|
77
|
-
|
|
78
|
-
{#each $app.unusedInlineScripts as unusedInlineScript, index (index)}
|
|
79
|
-
{#if `unused-${index}` === selectedScriptComponentId}
|
|
35
|
+
{:else if gridItem}
|
|
36
|
+
{#key gridItem?.id}
|
|
37
|
+
<InlineScriptsPanelWithTable bind:gridItem />
|
|
38
|
+
{/key}
|
|
39
|
+
{:else if unusedInlineScript > -1 && $app.unusedInlineScripts?.[unusedInlineScript]}
|
|
40
|
+
{#key unusedInlineScript}
|
|
80
41
|
<InlineScriptEditor
|
|
81
|
-
id={`unused-${
|
|
82
|
-
bind:name={unusedInlineScript.name}
|
|
83
|
-
bind:inlineScript={unusedInlineScript.inlineScript}
|
|
42
|
+
id={`unused-${unusedInlineScript}`}
|
|
43
|
+
bind:name={$app.unusedInlineScripts[unusedInlineScript].name}
|
|
44
|
+
bind:inlineScript={$app.unusedInlineScripts[unusedInlineScript].inlineScript}
|
|
84
45
|
on:delete={() => {
|
|
85
46
|
// remove the script from the array at the index
|
|
86
|
-
$app.unusedInlineScripts.splice(
|
|
47
|
+
$app.unusedInlineScripts.splice(unusedInlineScript, 1)
|
|
87
48
|
$app.unusedInlineScripts = [...$app.unusedInlineScripts]
|
|
88
49
|
}}
|
|
89
50
|
/>
|
|
90
|
-
{/
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
{#if hiddenInlineScript.inlineScript}
|
|
51
|
+
{/key}
|
|
52
|
+
{:else if hiddenInlineScript > -1}
|
|
53
|
+
{#key hiddenInlineScript}
|
|
54
|
+
{#if $app.hiddenInlineScripts?.[hiddenInlineScript]?.inlineScript}
|
|
95
55
|
<InlineScriptEditor
|
|
96
|
-
id={`bg_${
|
|
97
|
-
bind:inlineScript={hiddenInlineScript.inlineScript}
|
|
98
|
-
bind:name={hiddenInlineScript.name}
|
|
99
|
-
bind:fields={hiddenInlineScript.fields}
|
|
56
|
+
id={`bg_${hiddenInlineScript}`}
|
|
57
|
+
bind:inlineScript={$app.hiddenInlineScripts[hiddenInlineScript].inlineScript}
|
|
58
|
+
bind:name={$app.hiddenInlineScripts[hiddenInlineScript].name}
|
|
59
|
+
bind:fields={$app.hiddenInlineScripts[hiddenInlineScript].fields}
|
|
100
60
|
syncFields
|
|
101
|
-
on:delete={() => deleteBackgroundScript(
|
|
61
|
+
on:delete={() => deleteBackgroundScript(hiddenInlineScript)}
|
|
102
62
|
/>
|
|
103
63
|
{:else}
|
|
104
64
|
<EmptyInlineScript
|
|
105
|
-
id={`b_${
|
|
106
|
-
name={hiddenInlineScript.name}
|
|
107
|
-
on:delete={() => deleteBackgroundScript(
|
|
65
|
+
id={`b_${hiddenInlineScript}`}
|
|
66
|
+
name={$app.hiddenInlineScripts[hiddenInlineScript].name}
|
|
67
|
+
on:delete={() => deleteBackgroundScript(hiddenInlineScript)}
|
|
108
68
|
on:new={(e) => {
|
|
109
|
-
hiddenInlineScript
|
|
69
|
+
if ($app.hiddenInlineScripts[hiddenInlineScript]) {
|
|
70
|
+
$app.hiddenInlineScripts[hiddenInlineScript].inlineScript = e.detail
|
|
71
|
+
}
|
|
110
72
|
}}
|
|
111
73
|
/>
|
|
112
74
|
{/if}
|
|
113
|
-
{/
|
|
114
|
-
{
|
|
75
|
+
{/key}
|
|
76
|
+
{:else}
|
|
77
|
+
<div class="text-sm text-gray-500 text-center py-8 px-2">
|
|
78
|
+
No script found at id {$selectedComponentInEditor}
|
|
79
|
+
</div>
|
|
80
|
+
{/if}
|
|
115
81
|
</Pane>
|
|
116
82
|
</Splitpanes>
|
|
117
83
|
</SplitPanesWrapper>
|