windmill-components 1.78.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 +50 -70
- package/components/apps/components/buttons/AppButton.svelte.d.ts +8 -3
- package/components/apps/components/buttons/AppForm.svelte +22 -15
- package/components/apps/components/buttons/AppForm.svelte.d.ts +3 -3
- package/components/apps/components/buttons/AppFormButton.svelte +32 -24
- package/components/apps/components/buttons/AppFormButton.svelte.d.ts +3 -5
- package/components/apps/components/display/AppBarChart.svelte +2 -2
- package/components/apps/components/display/AppBarChart.svelte.d.ts +3 -3
- 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 +3 -4
- package/components/apps/components/display/AppImage.svelte +28 -15
- package/components/apps/components/display/AppImage.svelte.d.ts +3 -4
- package/components/apps/components/display/AppMap.svelte +3 -3
- package/components/apps/components/display/AppMap.svelte.d.ts +3 -4
- package/components/apps/components/display/AppPdf.svelte +3 -2
- package/components/apps/components/display/AppPdf.svelte.d.ts +3 -4
- package/components/apps/components/display/AppPieChart.svelte +2 -2
- package/components/apps/components/display/AppPieChart.svelte.d.ts +3 -3
- package/components/apps/components/display/AppScatterChart.svelte +2 -2
- package/components/apps/components/display/AppScatterChart.svelte.d.ts +3 -3
- package/components/apps/components/display/AppText.svelte +35 -22
- package/components/apps/components/display/AppText.svelte.d.ts +3 -3
- package/components/apps/components/display/AppTimeseries.svelte +2 -2
- package/components/apps/components/display/AppTimeseries.svelte.d.ts +3 -3
- package/components/apps/components/display/PlotlyHtml.svelte +2 -2
- package/components/apps/components/display/VegaLiteHtml.svelte +2 -2
- package/components/apps/components/display/VegaLiteHtml.svelte.d.ts +2 -1
- package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
- package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +2 -1
- package/components/apps/components/display/table/AppTable.svelte +102 -34
- package/components/apps/components/display/table/AppTable.svelte.d.ts +3 -3
- 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 +11 -7
- package/components/apps/components/helpers/InputValue.svelte.d.ts +3 -1
- 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 +126 -93
- 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/helpers/eval.js +36 -1
- package/components/apps/components/inputs/AppCheckbox.svelte +1 -1
- package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +3 -4
- package/components/apps/components/inputs/AppDateInput.svelte.d.ts +3 -4
- package/components/apps/components/inputs/AppFileInput.svelte.d.ts +3 -4
- package/components/apps/components/inputs/AppMultiSelect.svelte +0 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +3 -4
- package/components/apps/components/inputs/AppNumberInput.svelte +1 -1
- package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +3 -6
- package/components/apps/components/inputs/AppRangeInput.svelte +7 -1
- package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +4 -4
- package/components/apps/components/inputs/AppSelect.svelte +8 -2
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +3 -4
- package/components/apps/components/inputs/AppSliderInputs.svelte +7 -1
- package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +4 -4
- package/components/apps/components/inputs/AppTextInput.svelte +4 -4
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +3 -6
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +17 -19
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +3 -4
- package/components/apps/components/layout/AppContainer.svelte +7 -5
- package/components/apps/components/layout/AppContainer.svelte.d.ts +1 -3
- package/components/apps/components/layout/AppDivider.svelte +4 -1
- package/components/apps/components/layout/AppDivider.svelte.d.ts +3 -4
- package/components/apps/components/layout/AppDrawer.svelte +7 -4
- package/components/apps/components/layout/AppDrawer.svelte.d.ts +3 -4
- package/components/apps/components/layout/AppSplitpanes.svelte +34 -25
- package/components/apps/components/layout/AppSplitpanes.svelte.d.ts +1 -5
- package/components/apps/components/layout/AppTabs.svelte +22 -37
- package/components/apps/components/layout/AppTabs.svelte.d.ts +3 -5
- package/components/apps/editor/AppEditor.svelte +6 -3
- package/components/apps/editor/AppEditorHeader.svelte +4 -5
- package/components/apps/editor/AppInputs.svelte +13 -14
- package/components/apps/editor/AppPreview.svelte +12 -16
- package/components/apps/editor/ComponentHeader.svelte +58 -57
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -2
- 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 +104 -30
- package/components/apps/editor/SubGridEditor.svelte +34 -43
- package/components/apps/editor/SubGridEditor.svelte.d.ts +2 -3
- package/components/apps/editor/appUtils.d.ts +49 -6
- package/components/apps/editor/appUtils.js +145 -37
- package/components/apps/editor/component/Component.svelte +37 -22
- package/components/apps/editor/component/Component.svelte.d.ts +1 -2
- package/components/apps/editor/component/ComponentNavigation.svelte +28 -12
- package/components/apps/editor/component/components.d.ts +1550 -16
- package/components/apps/editor/component/components.js +295 -304
- 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/contextPanel/ContextPanel.svelte +4 -5
- package/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte +0 -1
- package/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte.d.ts +1 -3
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +12 -2
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +2 -2
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +158 -129
- 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 -74
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +68 -18
- 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 +108 -87
- 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 +128 -13
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +14 -2
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +35 -100
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +3 -2
- 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 +73 -25
- 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/TableActionLabel.svelte.d.ts +2 -2
- package/components/apps/editor/settingsPanel/TableActions.svelte +8 -63
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte +1 -2
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte.d.ts +0 -1
- 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 +59 -37
- 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 +31 -0
- package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte.d.ts +22 -0
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +24 -0
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte.d.ts +21 -0
- package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte +156 -0
- package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte.d.ts +22 -0
- package/components/apps/editor/settingsPanel/triggerLists/triggerListUtils.d.ts +2 -0
- package/components/apps/editor/settingsPanel/triggerLists/triggerListUtils.js +11 -0
- package/components/apps/gridUtils.js +1 -1
- package/components/apps/inputType.d.ts +23 -18
- package/components/apps/rx.d.ts +2 -0
- package/components/apps/rx.js +10 -3
- package/components/apps/svelte-grid/Grid.svelte +1 -5
- 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 +32 -15
- 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/components/flows/flowStore.js +1 -1
- package/components/graph/FlowGraph.svelte +0 -2
- package/components/graph/FlowGraph.svelte.d.ts +0 -1
- package/components/graph/svelvet/container/views/GraphView.svelte +3 -28
- package/components/graph/svelvet/container/views/GraphView.svelte.d.ts +0 -3
- package/components/graph/svelvet/container/views/Svelvet.svelte +1 -17
- package/components/graph/svelvet/container/views/Svelvet.svelte.d.ts +0 -8
- package/components/graph/svelvet/customCss/controllers/getCss.js +0 -11
- package/components/graph/svelvet/edges/controllers/util.js +1 -2
- package/components/graph/svelvet/edges/views/Edges/SmoothStepEdge.svelte.d.ts +2 -2
- package/components/graph/svelvet/nodes/controllers/util.js +1 -1
- package/components/graph/svelvet/nodes/models/Node.d.ts +0 -4
- package/components/graph/svelvet/nodes/models/Node.js +3 -41
- package/components/graph/svelvet/store/controllers/storeApi.js +2 -7
- package/components/graph/svelvet/store/controllers/util.d.ts +0 -7
- package/components/graph/svelvet/store/controllers/util.js +4 -36
- package/components/graph/svelvet/store/types/types.d.ts +0 -5
- package/components/home/ItemsList.svelte +1 -1
- package/package.json +13 -8
- package/utils.d.ts +2 -0
- package/utils.js +6 -0
- 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
- package/components/graph/svelvet/nodes/views/EditNode.svelte +0 -147
- package/components/graph/svelvet/nodes/views/EditNode.svelte.d.ts +0 -33
- package/components/graph/svelvet/resizableNodes/controllers/util.d.ts +0 -11
- package/components/graph/svelvet/resizableNodes/controllers/util.js +0 -24
- package/components/graph/svelvet/resizableNodes/models/ResizeNode.d.ts +0 -33
- package/components/graph/svelvet/resizableNodes/models/ResizeNode.js +0 -71
- package/components/graph/svelvet/resizableNodes/views/ResizeNode.svelte +0 -81
- package/components/graph/svelvet/resizableNodes/views/ResizeNode.svelte.d.ts +0 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import Button from '../../../common/button/Button.svelte';
|
|
2
2
|
import { createEventDispatcher, getContext, onMount } from 'svelte';
|
|
3
|
-
import { CornerDownLeft, Maximize2,
|
|
3
|
+
import { CornerDownLeft, Maximize2, Trash2 } from 'lucide-svelte';
|
|
4
4
|
import InlineScriptEditorDrawer from './InlineScriptEditorDrawer.svelte';
|
|
5
5
|
import { inferArgs } from '../../../../infer';
|
|
6
6
|
import Badge from '../../../common/badge/Badge.svelte';
|
|
@@ -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,152 +60,180 @@ 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;
|
|
66
|
+
let refreshOn = inlineScript?.refreshOn?.map((x) => `${x.id}.${x.key}`).join(' ') ?? '';
|
|
67
|
+
$: handleRefreshOn(refreshOn);
|
|
68
|
+
function handleRefreshOn(refreshOn) {
|
|
69
|
+
if (refreshOn && refreshOn != '' && inlineScript) {
|
|
70
|
+
inlineScript.refreshOn = refreshOn
|
|
71
|
+
.split(' ')
|
|
72
|
+
.filter((x) => x.split('.').length == 2)
|
|
73
|
+
.map((x) => {
|
|
74
|
+
const [id, key] = x.split('.');
|
|
75
|
+
return { id, key };
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
65
79
|
</script>
|
|
66
80
|
|
|
67
|
-
{#if inlineScript
|
|
68
|
-
|
|
69
|
-
{
|
|
81
|
+
{#if inlineScript}
|
|
82
|
+
{#if inlineScript.language != 'frontend'}
|
|
83
|
+
<InlineScriptEditorDrawer {editor} bind:this={inlineScriptEditorDrawer} bind:inlineScript />
|
|
84
|
+
{/if}
|
|
70
85
|
|
|
71
|
-
<div class="h-full flex flex-col gap-1">
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
{:else}
|
|
85
|
-
<Badge color="red" baseClass="!text-2xs">Invalid</Badge>
|
|
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}
|
|
86
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}
|
|
87
106
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<Button
|
|
120
|
-
variant="border"
|
|
121
|
-
size="xs"
|
|
122
|
-
color="light"
|
|
123
|
-
btnClasses="!px-2 !py-1"
|
|
124
|
-
on:click={async () => {
|
|
125
|
-
editor?.format()
|
|
126
|
-
simpleEditor?.format()
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
<div class="flex flex-row gap-1 items-center">
|
|
130
|
-
Format
|
|
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}
|
|
131
137
|
|
|
132
|
-
<div class="flex flex-row items-center gap-1">
|
|
133
|
-
<Kbd>{isMac ? '⌘' : 'CTRL'}</Kbd>
|
|
134
|
-
<Kbd>S</Kbd>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
</Button>
|
|
138
|
-
{#if $runnableComponents[id] != undefined}
|
|
139
138
|
<Button
|
|
140
|
-
loading={runLoading}
|
|
141
|
-
size="xs"
|
|
142
|
-
color="dark"
|
|
143
139
|
variant="border"
|
|
144
|
-
|
|
140
|
+
size="xs"
|
|
141
|
+
color="light"
|
|
142
|
+
btnClasses="!px-2 !py-1"
|
|
145
143
|
on:click={async () => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
runLoading = false
|
|
144
|
+
editor?.format()
|
|
145
|
+
simpleEditor?.format()
|
|
149
146
|
}}
|
|
150
147
|
>
|
|
151
148
|
<div class="flex flex-row gap-1 items-center">
|
|
152
|
-
|
|
149
|
+
Format
|
|
153
150
|
|
|
154
151
|
<div class="flex flex-row items-center gap-1">
|
|
155
152
|
<Kbd>{isMac ? '⌘' : 'CTRL'}</Kbd>
|
|
156
|
-
<Kbd>
|
|
157
|
-
<div class="h-4 flex items-center justify-center">
|
|
158
|
-
<CornerDownLeft size={10} />
|
|
159
|
-
</div>
|
|
160
|
-
</Kbd>
|
|
153
|
+
<Kbd>S</Kbd>
|
|
161
154
|
</div>
|
|
162
155
|
</div>
|
|
163
156
|
</Button>
|
|
164
|
-
|
|
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>
|
|
165
185
|
</div>
|
|
166
|
-
</div>
|
|
167
186
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
on:change={async (e) => {
|
|
182
|
-
if (inlineScript && inlineScript.language != 'frontend') {
|
|
183
|
-
const oldSchema = JSON.stringify(inlineScript.schema)
|
|
184
|
-
if (inlineScript.schema == undefined) {
|
|
185
|
-
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() ?? ''
|
|
186
200
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
+
}
|
|
191
216
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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>
|
|
209
238
|
</div>
|
|
210
|
-
|
|
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,112 +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
|
-
id={gridItem.data.id}
|
|
35
|
-
bind:componentInput={gridItem.data.componentInput}
|
|
36
|
-
/>
|
|
37
|
-
{/if}
|
|
38
|
-
|
|
39
|
-
{#if gridItem?.data?.type === 'tablecomponent'}
|
|
40
|
-
{#each gridItem.data.actionButtons as actionButton (actionButton.id)}
|
|
41
|
-
{#if actionButton.id === selectedScriptComponentId}
|
|
42
|
-
<InlineScriptEditorPanel
|
|
43
|
-
id={actionButton.id}
|
|
44
|
-
bind:componentInput={actionButton.componentInput}
|
|
45
|
-
/>
|
|
46
|
-
{/if}
|
|
47
|
-
{/each}
|
|
48
|
-
{/if}
|
|
49
|
-
{/each}
|
|
50
|
-
|
|
51
|
-
{#if $app.subgrids}
|
|
52
|
-
{#each Object.keys($app.subgrids ?? {}) as key (key)}
|
|
53
|
-
{#each $app.subgrids[key] as gridItem (gridItem?.data?.id)}
|
|
54
|
-
{#if gridItem?.data?.id && gridItem.data.id === selectedScriptComponentId}
|
|
55
|
-
<InlineScriptEditorPanel
|
|
56
|
-
defaultUserInput={gridItem.data?.type == 'formcomponent'}
|
|
57
|
-
id={gridItem.data.id}
|
|
58
|
-
bind:componentInput={gridItem.data.componentInput}
|
|
59
|
-
/>
|
|
60
|
-
{/if}
|
|
61
|
-
|
|
62
|
-
{#if gridItem?.data?.type === 'tablecomponent'}
|
|
63
|
-
{#each gridItem.data.actionButtons as actionButton, index (index)}
|
|
64
|
-
{#if actionButton.id === selectedScriptComponentId}
|
|
65
|
-
<InlineScriptEditorPanel
|
|
66
|
-
id={actionButton.id}
|
|
67
|
-
bind:componentInput={actionButton.componentInput}
|
|
68
|
-
/>
|
|
69
|
-
{/if}
|
|
70
|
-
{/each}
|
|
71
|
-
{/if}
|
|
72
|
-
{/each}
|
|
73
|
-
{/each}
|
|
74
|
-
{/if}
|
|
75
|
-
|
|
76
|
-
{#each $app.unusedInlineScripts as unusedInlineScript, index (index)}
|
|
77
|
-
{#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}
|
|
78
41
|
<InlineScriptEditor
|
|
79
|
-
id={`unused-${
|
|
80
|
-
bind:name={unusedInlineScript.name}
|
|
81
|
-
bind:inlineScript={unusedInlineScript.inlineScript}
|
|
42
|
+
id={`unused-${unusedInlineScript}`}
|
|
43
|
+
bind:name={$app.unusedInlineScripts[unusedInlineScript].name}
|
|
44
|
+
bind:inlineScript={$app.unusedInlineScripts[unusedInlineScript].inlineScript}
|
|
82
45
|
on:delete={() => {
|
|
83
46
|
// remove the script from the array at the index
|
|
84
|
-
$app.unusedInlineScripts.splice(
|
|
47
|
+
$app.unusedInlineScripts.splice(unusedInlineScript, 1)
|
|
85
48
|
$app.unusedInlineScripts = [...$app.unusedInlineScripts]
|
|
86
49
|
}}
|
|
87
50
|
/>
|
|
88
|
-
{/
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{#if hiddenInlineScript.inlineScript}
|
|
51
|
+
{/key}
|
|
52
|
+
{:else if hiddenInlineScript > -1}
|
|
53
|
+
{#key hiddenInlineScript}
|
|
54
|
+
{#if $app.hiddenInlineScripts?.[hiddenInlineScript]?.inlineScript}
|
|
93
55
|
<InlineScriptEditor
|
|
94
|
-
id={`bg_${
|
|
95
|
-
bind:inlineScript={hiddenInlineScript.inlineScript}
|
|
96
|
-
bind:name={hiddenInlineScript.name}
|
|
97
|
-
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}
|
|
98
60
|
syncFields
|
|
99
|
-
on:delete={() => deleteBackgroundScript(
|
|
61
|
+
on:delete={() => deleteBackgroundScript(hiddenInlineScript)}
|
|
100
62
|
/>
|
|
101
63
|
{:else}
|
|
102
64
|
<EmptyInlineScript
|
|
103
|
-
id={`b_${
|
|
104
|
-
name={hiddenInlineScript.name}
|
|
105
|
-
on:delete={() => deleteBackgroundScript(
|
|
65
|
+
id={`b_${hiddenInlineScript}`}
|
|
66
|
+
name={$app.hiddenInlineScripts[hiddenInlineScript].name}
|
|
67
|
+
on:delete={() => deleteBackgroundScript(hiddenInlineScript)}
|
|
106
68
|
on:new={(e) => {
|
|
107
|
-
hiddenInlineScript
|
|
69
|
+
if ($app.hiddenInlineScripts[hiddenInlineScript]) {
|
|
70
|
+
$app.hiddenInlineScripts[hiddenInlineScript].inlineScript = e.detail
|
|
71
|
+
}
|
|
108
72
|
}}
|
|
109
73
|
/>
|
|
110
74
|
{/if}
|
|
111
|
-
{/
|
|
112
|
-
{
|
|
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}
|
|
113
81
|
</Pane>
|
|
114
82
|
</Splitpanes>
|
|
115
83
|
</SplitPanesWrapper>
|