windmill-components 1.56.5 → 1.57.2
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/assets/app.css +5 -1
- package/components/ArgInput.svelte +6 -6
- package/components/DisplayResult.svelte +1 -1
- package/components/Dropdown.svelte +1 -1
- package/components/Dropdown.svelte.d.ts +1 -0
- package/components/Editor.svelte +5 -3
- package/components/Editor.svelte.d.ts +2 -0
- package/components/EditorBar.svelte +15 -1
- package/components/FlowBuilder.svelte +18 -10
- package/components/GroupEditor.svelte +1 -0
- package/components/IconedResourceType.svelte +2 -2
- package/components/InputTransformForm.svelte +7 -5
- package/components/ItemPicker.svelte +63 -57
- package/components/ItemPicker.svelte.d.ts +1 -2
- package/components/LogViewer.svelte +7 -9
- package/components/ModulePreview.svelte +4 -13
- package/components/MoveDrawer.svelte +40 -16
- package/components/MoveDrawer.svelte.d.ts +2 -2
- package/components/PageHeader.svelte +1 -1
- package/components/Path.svelte +5 -2
- package/components/Popover.svelte +6 -4
- package/components/Popover.svelte.d.ts +2 -0
- package/components/ResourcePicker.svelte +1 -0
- package/components/RunChart.svelte +0 -1
- package/components/SchemaForm.svelte +2 -1
- package/components/SchemaForm.svelte.d.ts +1 -0
- package/components/ScriptBuilder.svelte +2 -1
- package/components/ScriptEditor.svelte +86 -80
- package/components/ShareModal.svelte.d.ts +2 -2
- package/components/SimpleEditor.svelte +17 -0
- package/components/StringTypeNarrowing.svelte +30 -8
- package/components/TemplateEditor.svelte +18 -2
- package/components/TestJobLoader.svelte +83 -74
- package/components/Tooltip.svelte +1 -1
- package/components/VariableEditor.svelte +4 -3
- package/components/VariableEditor.svelte.d.ts +2 -2
- package/components/apps/components/buttons/AppButton.svelte +3 -7
- package/components/apps/components/dataDisplay/AppBarChart.svelte +10 -6
- package/components/apps/components/dataDisplay/AppHtml.svelte +23 -0
- package/components/apps/components/dataDisplay/AppHtml.svelte.d.ts +23 -0
- package/components/apps/components/dataDisplay/AppPieChart.svelte +10 -6
- package/components/apps/components/dataDisplay/AppScatterChart.svelte +46 -0
- package/components/apps/components/dataDisplay/AppScatterChart.svelte.d.ts +21 -0
- package/components/apps/components/dataDisplay/AppText.svelte +48 -7
- package/components/apps/components/dataDisplay/AppText.svelte.d.ts +1 -0
- package/components/apps/components/dataDisplay/AppTimeseries.svelte +57 -0
- package/components/apps/components/dataDisplay/AppTimeseries.svelte.d.ts +22 -0
- package/components/apps/components/form/AppForm.svelte +33 -28
- package/components/apps/components/helpers/InputValue.svelte +10 -16
- package/components/apps/components/helpers/InputValue.svelte.d.ts +2 -0
- package/components/apps/components/helpers/NonRunnableComponent.svelte +4 -6
- package/components/apps/components/helpers/NonRunnableComponent.svelte.d.ts +1 -1
- package/components/apps/components/helpers/RefreshButton.svelte +1 -1
- package/components/apps/components/helpers/RunnableComponent.svelte +120 -119
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +1 -0
- package/components/apps/components/helpers/RunnableWrapper.svelte +11 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +1 -0
- package/components/apps/components/selectInputs/AppSelect.svelte +2 -0
- package/components/apps/components/table/AppTable.svelte +22 -17
- package/components/apps/components/table/AppTableFooter.svelte +2 -1
- package/components/apps/components/table/tableOptions.d.ts +2 -9
- package/components/apps/components/table/tableOptions.js +5 -2
- package/components/apps/components/textInputs/AppTextInput.svelte +0 -1
- package/components/apps/editor/AppEditor.svelte +133 -102
- package/components/apps/editor/AppEditor.svelte.d.ts +1 -0
- package/components/apps/editor/AppEditorHeader.svelte +355 -50
- package/components/apps/editor/AppEditorHeader.svelte.d.ts +2 -4
- package/components/apps/editor/AppExportButton.svelte +34 -0
- package/components/apps/editor/AppExportButton.svelte.d.ts +17 -0
- package/components/apps/editor/AppPreview.svelte +19 -6
- package/components/apps/editor/AppPreview.svelte.d.ts +5 -0
- package/components/apps/editor/AppPublishButton.svelte +46 -0
- package/components/apps/editor/AppPublishButton.svelte.d.ts +19 -0
- package/components/apps/editor/ComponentEditor.svelte +35 -3
- package/components/apps/editor/ComponentHeader.svelte +23 -16
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -0
- package/components/apps/editor/GridEditor.svelte +71 -48
- package/components/apps/editor/RecomputeAllComponents.svelte +80 -13
- package/components/apps/editor/componentsPanel/ComponentList.svelte +30 -28
- package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +2 -1
- package/components/apps/editor/componentsPanel/componentStaticValues.js +3 -2
- package/components/apps/editor/componentsPanel/data.js +191 -77
- package/components/apps/editor/contextPanel/ContextPanel.svelte +60 -41
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +6 -2
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +47 -10
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +11 -4
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +29 -21
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +10 -6
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +38 -33
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +3 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +1 -10
- package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +27 -9
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +8 -6
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +6 -16
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +0 -1
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +46 -21
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +3 -1
- package/components/apps/editor/settingsPanel/PickInlineScript.svelte +0 -1
- package/components/apps/editor/settingsPanel/Recompute.svelte +1 -1
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +8 -7
- package/components/apps/editor/settingsPanel/TableActions.svelte +10 -10
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte +1 -0
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +55 -49
- package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte.d.ts +2 -2
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +24 -0
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +8 -11
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +35 -7
- package/components/apps/editorUtils.d.ts +1 -0
- package/components/apps/editorUtils.js +11 -0
- package/components/apps/gridUtils.js +1 -1
- package/components/apps/inputType.d.ts +5 -4
- package/components/apps/rx.d.ts +1 -1
- package/components/apps/rx.js +6 -2
- package/components/apps/store.d.ts +2 -0
- package/components/apps/store.js +2 -0
- package/components/apps/types.d.ts +19 -3
- package/components/apps/utils.d.ts +2 -2
- package/components/apps/utils.js +22 -8
- package/components/common/button/Button.svelte +6 -8
- package/components/common/button/Button.svelte.d.ts +1 -0
- package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +4 -1
- package/components/common/popup/Popup.svelte +1 -1
- package/components/common/table/AppRow.svelte +26 -3
- package/components/common/table/AppRow.svelte.d.ts +4 -0
- package/components/common/table/FlowRow.svelte +4 -4
- package/components/common/table/RowIcon.svelte +1 -1
- package/components/common/table/ScriptRow.svelte +2 -2
- package/components/common/tabs/Tabs.svelte +1 -1
- package/components/common/toggleButton/ToggleButton.svelte +2 -0
- package/components/common/toggleButton/ToggleButton.svelte.d.ts +1 -0
- package/components/common/toggleButton/ToggleButtonGroup.svelte +3 -3
- package/components/flows/CreateActionsApp.svelte +43 -0
- package/components/flows/CreateActionsApp.svelte.d.ts +14 -0
- package/components/flows/CreateActionsFlow.svelte +6 -1
- package/components/flows/content/DynamicInputHelpBox.svelte +1 -1
- package/components/flows/content/FlowConstants.svelte +23 -9
- package/components/flows/content/FlowInputs.svelte +2 -2
- package/components/flows/content/FlowModuleHeader.svelte +6 -5
- package/components/flows/content/FlowSettings.svelte +1 -1
- package/components/flows/header/FlowImportExportMenu.svelte +1 -1
- package/components/flows/map/FlowConstantsItem.svelte +5 -7
- package/components/flows/map/FlowModuleSchemaMap.svelte +1 -5
- package/components/flows/map/FlowSettingsItem.svelte +5 -7
- package/components/flows/pickers/PickHubApp.svelte +73 -0
- package/components/flows/pickers/PickHubApp.svelte.d.ts +20 -0
- package/components/flows/pickers/PickHubFlow.svelte +3 -1
- package/components/flows/pickers/PickHubScript.svelte +1 -0
- package/components/flows/propPicker/PropPickerWrapper.svelte +42 -31
- package/components/home/ItemsList.svelte +6 -4
- package/components/icons/ClickhouseIcon.svelte +22 -0
- package/components/icons/ClickhouseIcon.svelte.d.ts +17 -0
- package/components/icons/FaunadbIcon.svelte +19 -0
- package/components/icons/FaunadbIcon.svelte.d.ts +17 -0
- package/components/icons/OpenaiIcon.svelte +18 -0
- package/components/icons/OpenaiIcon.svelte.d.ts +17 -0
- package/components/icons/index.d.ts +7 -1
- package/components/icons/index.js +8 -2
- package/components/propertyPicker/ObjectViewer.svelte +11 -4
- package/components/propertyPicker/PropPicker.svelte +1 -1
- package/components/scriptEditor/LogPanel.svelte +26 -22
- package/components/sidebar/WorkspaceMenu.svelte +2 -3
- package/components/splitPanes/SplitPanesWrapper.svelte +1 -5
- package/components/splitPanes/SplitPanesWrapper.svelte.d.ts +0 -1
- package/editorUtils.js +2 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/models/Policy.d.ts +1 -0
- package/gen/services/AppService.d.ts +50 -0
- package/gen/services/AppService.js +55 -0
- package/gen/services/GranularAclService.d.ts +3 -3
- package/gen/services/ResourceService.d.ts +15 -0
- package/gen/services/ResourceService.js +17 -0
- package/infer.js +4 -0
- package/package.json +18 -9
- package/stores.d.ts +1 -0
- package/stores.js +13 -5
- package/utils.d.ts +9 -1
- package/utils.js +28 -11
- package/components/apps/CreateApp.svelte +0 -68
- package/components/apps/CreateApp.svelte.d.ts +0 -14
- package/components/apps/editor/settingsPanel/SectionPanel.svelte +0 -70
- package/components/apps/editor/settingsPanel/SectionPanel.svelte.d.ts +0 -19
- package/components/apps/editor/settingsPanel/UserInputEditor.svelte +0 -2
- package/components/apps/editor/settingsPanel/UserInputEditor.svelte.d.ts +0 -14
|
@@ -3,33 +3,48 @@ import { capitalize } from '../../../../utils';
|
|
|
3
3
|
import { faArrowRight, faPen, faTableCells, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
4
4
|
import { fieldTypeToTsType } from '../../utils';
|
|
5
5
|
import InputsSpecEditor from './InputsSpecEditor.svelte';
|
|
6
|
+
import { getContext } from 'svelte';
|
|
6
7
|
export let inputSpecs;
|
|
7
8
|
export let userInputEnabled = true;
|
|
8
9
|
export let staticOnly = false;
|
|
9
10
|
export let shouldCapitalize = true;
|
|
10
11
|
export let rowColumns = false;
|
|
12
|
+
const { connectingInput } = getContext('AppEditorContext');
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
15
|
{#if inputSpecs}
|
|
14
16
|
<div class="w-full flex flex-col gap-4">
|
|
15
|
-
{#each Object.keys(inputSpecs) as inputSpecKey
|
|
17
|
+
{#each Object.keys(inputSpecs) as inputSpecKey (inputSpecKey)}
|
|
16
18
|
{@const input = inputSpecs[inputSpecKey]}
|
|
17
|
-
|
|
18
|
-
<div class="flex
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</span>
|
|
19
|
+
<div class="flex flex-col gap-1">
|
|
20
|
+
<div class="flex justify-between items-end gap-1">
|
|
21
|
+
<span class="text-sm font-semibold truncate">
|
|
22
|
+
{shouldCapitalize ? capitalize(inputSpecKey) : inputSpecKey}
|
|
23
|
+
</span>
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
<div class="flex gap-2 flex-wrap items-center">
|
|
26
|
+
<Badge color="blue">
|
|
27
|
+
{input.fieldType === 'array' && input.subFieldType
|
|
28
|
+
? `${capitalize(fieldTypeToTsType(input.subFieldType))}[]`
|
|
29
|
+
: capitalize(fieldTypeToTsType(input.fieldType))}
|
|
30
|
+
</Badge>
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
{#if !inputSpecs[inputSpecKey].onlyStatic}
|
|
33
|
+
<ToggleButtonGroup
|
|
34
|
+
bind:selected={inputSpecs[inputSpecKey].type}
|
|
35
|
+
on:selected={(e) => {
|
|
36
|
+
console.log(inputSpecs[inputSpecKey])
|
|
37
|
+
if (e.detail == 'connected' && !inputSpecs[inputSpecKey]['connection']) {
|
|
38
|
+
$connectingInput = {
|
|
39
|
+
opened: true,
|
|
40
|
+
input: undefined,
|
|
41
|
+
hoveredComponent: undefined
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
32
46
|
<ToggleButton
|
|
47
|
+
title="Static"
|
|
33
48
|
position="left"
|
|
34
49
|
value="static"
|
|
35
50
|
startIcon={{ icon: faPen }}
|
|
@@ -38,6 +53,7 @@ export let rowColumns = false;
|
|
|
38
53
|
/>
|
|
39
54
|
{#if rowColumns}
|
|
40
55
|
<ToggleButton
|
|
56
|
+
title="From Row"
|
|
41
57
|
position="center"
|
|
42
58
|
value="row"
|
|
43
59
|
startIcon={{ icon: faTableCells }}
|
|
@@ -46,7 +62,19 @@ export let rowColumns = false;
|
|
|
46
62
|
disabled={staticOnly}
|
|
47
63
|
/>
|
|
48
64
|
{/if}
|
|
65
|
+
{#if userInputEnabled && (!input.format?.startsWith('resource-') || true)}
|
|
66
|
+
<ToggleButton
|
|
67
|
+
title="User Input"
|
|
68
|
+
position="center"
|
|
69
|
+
value="user"
|
|
70
|
+
startIcon={{ icon: faUser }}
|
|
71
|
+
size="xs"
|
|
72
|
+
iconOnly
|
|
73
|
+
disabled={staticOnly}
|
|
74
|
+
/>
|
|
75
|
+
{/if}
|
|
49
76
|
<ToggleButton
|
|
77
|
+
title="Connect"
|
|
50
78
|
position="right"
|
|
51
79
|
value="connected"
|
|
52
80
|
startIcon={{ icon: faArrowRight }}
|
|
@@ -55,15 +83,12 @@ export let rowColumns = false;
|
|
|
55
83
|
disabled={staticOnly}
|
|
56
84
|
/>
|
|
57
85
|
</ToggleButtonGroup>
|
|
58
|
-
|
|
86
|
+
{/if}
|
|
59
87
|
</div>
|
|
60
|
-
|
|
61
|
-
<InputsSpecEditor
|
|
62
|
-
bind:componentInput={inputSpecs[inputSpecKey]}
|
|
63
|
-
userInputEnabled={userInputEnabled && input.format === undefined}
|
|
64
|
-
/>
|
|
65
88
|
</div>
|
|
66
|
-
|
|
89
|
+
|
|
90
|
+
<InputsSpecEditor bind:componentInput={inputSpecs[inputSpecKey]} />
|
|
91
|
+
</div>
|
|
67
92
|
{/each}
|
|
68
93
|
</div>
|
|
69
94
|
{:else}
|
|
@@ -2,7 +2,9 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import type { ConnectedAppInput, RowAppInput, StaticAppInput, UserAppInput } from '../../inputType';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
inputSpecs: Record<string, StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput
|
|
5
|
+
inputSpecs: Record<string, (StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput) & {
|
|
6
|
+
onlyStatic?: boolean;
|
|
7
|
+
}>;
|
|
6
8
|
userInputEnabled?: boolean | undefined;
|
|
7
9
|
staticOnly?: boolean | undefined;
|
|
8
10
|
shouldCapitalize?: boolean | undefined;
|
|
@@ -31,7 +31,7 @@ function onChange(event, id) {
|
|
|
31
31
|
{#each Object.keys($runnableComponents ?? {}).filter((id) => id !== ownId) as id}
|
|
32
32
|
<tr>
|
|
33
33
|
<td class="whitespace-nowrap px-4 py-2 text-xs">
|
|
34
|
-
<Badge color="
|
|
34
|
+
<Badge color="dark-indigo">{id}</Badge>
|
|
35
35
|
</td>
|
|
36
36
|
<td class="relative whitespace-nowrap px-4 py-2 ">
|
|
37
37
|
<input
|
|
@@ -33,7 +33,7 @@ function clear() {
|
|
|
33
33
|
bind:inlineScript={appInput.runnable.inlineScript}
|
|
34
34
|
/>
|
|
35
35
|
{/if}
|
|
36
|
-
<div class="flex flex-col xl:flex-row justify-between w-full items-center gap-1">
|
|
36
|
+
<div class="flex flex-col xl:flex-row justify-between w-full flex-wrap items-center gap-1">
|
|
37
37
|
<span class="text-xs font-semibold truncate">
|
|
38
38
|
{#if appInput.runnable?.type === 'runnableByName'}
|
|
39
39
|
{appInput.runnable.name}
|
|
@@ -41,16 +41,17 @@ function clear() {
|
|
|
41
41
|
{appInput.runnable.path}
|
|
42
42
|
{/if}
|
|
43
43
|
</span>
|
|
44
|
-
<div class="flex gap-1">
|
|
44
|
+
<div class="flex gap-1 flex-wrap justify-center">
|
|
45
45
|
{#if appInput.runnable?.type === 'runnableByName' && appInput.runnable.inlineScript}
|
|
46
46
|
<Button size="xs" color="light" variant="border" startIcon={{ icon: faEdit }} on:click={edit}>
|
|
47
47
|
Edit
|
|
48
48
|
</Button>
|
|
49
|
-
<Button size="xs" color="light" variant="border" on:click={detach}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
<Button size="xs" color="light" variant="border" on:click={detach}>
|
|
50
|
+
Detach
|
|
51
|
+
<Tooltip>
|
|
52
|
+
Detaching an inline script keep it for later to be reused by another component
|
|
53
|
+
</Tooltip>
|
|
54
|
+
</Button>
|
|
54
55
|
{/if}
|
|
55
56
|
<Button size="xs" color="red" variant="border" startIcon={{ icon: faClose }} on:click={clear}>
|
|
56
57
|
Clear
|
|
@@ -19,22 +19,19 @@ function addComponent() {
|
|
|
19
19
|
label: {
|
|
20
20
|
type: 'static',
|
|
21
21
|
value: 'Action',
|
|
22
|
-
fieldType: 'text'
|
|
23
|
-
defaultValue: 'Action'
|
|
22
|
+
fieldType: 'text'
|
|
24
23
|
},
|
|
25
24
|
color: {
|
|
26
25
|
fieldType: 'select',
|
|
27
26
|
type: 'static',
|
|
28
27
|
value: 'dark',
|
|
29
|
-
optionValuesKey: 'buttonColorOptions'
|
|
30
|
-
defaultValue: 'dark'
|
|
28
|
+
optionValuesKey: 'buttonColorOptions'
|
|
31
29
|
},
|
|
32
30
|
size: {
|
|
33
31
|
fieldType: 'select',
|
|
34
32
|
type: 'static',
|
|
35
33
|
value: 'xs',
|
|
36
|
-
optionValuesKey: 'buttonSizeOptions'
|
|
37
|
-
defaultValue: 'xs'
|
|
34
|
+
optionValuesKey: 'buttonSizeOptions'
|
|
38
35
|
}
|
|
39
36
|
},
|
|
40
37
|
componentInput: {
|
|
@@ -42,7 +39,7 @@ function addComponent() {
|
|
|
42
39
|
fieldType: 'any',
|
|
43
40
|
fields: {},
|
|
44
41
|
runnable: undefined,
|
|
45
|
-
|
|
42
|
+
value: undefined
|
|
46
43
|
},
|
|
47
44
|
recomputeIds: undefined,
|
|
48
45
|
card: false
|
|
@@ -69,10 +66,13 @@ function deleteComponent(cid) {
|
|
|
69
66
|
/>
|
|
70
67
|
</svelte:fragment>
|
|
71
68
|
|
|
69
|
+
{#if components.length == 0}
|
|
70
|
+
<span class="text-xs text-gray-500">No action buttons</span>
|
|
71
|
+
{/if}
|
|
72
72
|
{#each components as component}
|
|
73
73
|
<div
|
|
74
74
|
class={classNames(
|
|
75
|
-
'w-full text-xs font-bold py-1.5 px-2 cursor-pointer transition-all justify-between flex items-center border border-gray-3 rounded-md',
|
|
75
|
+
'w-full text-xs font-bold gap-1 py-1.5 px-2 cursor-pointer transition-all justify-between flex items-center border border-gray-3 rounded-md',
|
|
76
76
|
'bg-white border-gray-300 hover:bg-gray-100 focus:bg-gray-100 text-gray-700',
|
|
77
77
|
$selectedComponent === component.id ? 'outline outline-blue-500 bg-red-400' : ''
|
|
78
78
|
)}
|
|
@@ -89,8 +89,8 @@ function deleteComponent(cid) {
|
|
|
89
89
|
<div>
|
|
90
90
|
<TableActionLabel componentInput={component.configuration.label} />
|
|
91
91
|
</div>
|
|
92
|
-
<Badge color="dark-
|
|
93
|
-
|
|
92
|
+
<Badge color="dark-indigo">
|
|
93
|
+
{component.id}
|
|
94
94
|
</Badge>
|
|
95
95
|
</div>
|
|
96
96
|
{/each}
|
|
@@ -6,64 +6,70 @@ const { connectingInput } = getContext('AppEditorContext');
|
|
|
6
6
|
function applyConnection() {
|
|
7
7
|
if (!$connectingInput.opened &&
|
|
8
8
|
$connectingInput.input !== undefined &&
|
|
9
|
-
componentInput.type === 'connected' &&
|
|
10
9
|
!componentInput.connection) {
|
|
11
10
|
componentInput.connection = $connectingInput.input.connection;
|
|
12
11
|
$connectingInput = {
|
|
13
12
|
opened: false,
|
|
14
|
-
input: undefined
|
|
13
|
+
input: undefined,
|
|
14
|
+
hoveredComponent: undefined
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
function startConnecting() {
|
|
19
|
+
$connectingInput = {
|
|
20
|
+
opened: true,
|
|
21
|
+
input: undefined,
|
|
22
|
+
hoveredComponent: undefined
|
|
23
|
+
};
|
|
24
|
+
}
|
|
18
25
|
$: $connectingInput && applyConnection();
|
|
19
26
|
</script>
|
|
20
27
|
|
|
21
|
-
{#if componentInput.
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
28
|
+
{#if componentInput.connection}
|
|
29
|
+
<div class="flex justify-between w-full gap-1">
|
|
30
|
+
<span class="text-xs">Status</span>
|
|
31
|
+
<Badge color="green">Connected</Badge>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="flex justify-between w-full">
|
|
34
|
+
<span class="text-xs">Component</span>
|
|
35
|
+
<Badge color="indigo">{componentInput.connection.componentId}</Badge>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="flex justify-between w-full">
|
|
38
|
+
<span class="text-xs">Path</span>
|
|
39
|
+
<Badge color="indigo">{componentInput.connection.path}</Badge>
|
|
40
|
+
</div>
|
|
41
|
+
<Button
|
|
42
|
+
size="xs"
|
|
43
|
+
startIcon={{ icon: faClose }}
|
|
44
|
+
color="red"
|
|
45
|
+
variant="border"
|
|
46
|
+
on:click={() => {
|
|
47
|
+
if (componentInput.type === 'connected') {
|
|
48
|
+
componentInput.connection = undefined
|
|
49
|
+
}
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
Disconnect
|
|
53
|
+
</Button>
|
|
54
|
+
{:else}
|
|
55
|
+
<div class="flex justify-between w-full gap-1">
|
|
56
|
+
<span class="text-xs">Status</span>
|
|
57
|
+
<Badge color="yellow">Not connected</Badge>
|
|
58
|
+
</div>
|
|
59
|
+
<Button
|
|
60
|
+
size="xs"
|
|
61
|
+
endIcon={{ icon: faArrowRight }}
|
|
62
|
+
color="blue"
|
|
63
|
+
on:click={() => {
|
|
64
|
+
if (componentInput.type === 'connected') {
|
|
65
|
+
$connectingInput = {
|
|
66
|
+
opened: true,
|
|
67
|
+
input: undefined,
|
|
68
|
+
hoveredComponent: undefined
|
|
63
69
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
}
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
Connect
|
|
74
|
+
</Button>
|
|
69
75
|
{/if}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ConnectedAppInput } from '../../../inputType';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
componentInput:
|
|
5
|
+
componentInput: ConnectedAppInput;
|
|
6
6
|
};
|
|
7
7
|
events: {
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script>import SimpleEditor from '../../../../SimpleEditor.svelte';
|
|
2
|
+
export let code;
|
|
3
|
+
export let value;
|
|
4
|
+
function parseJson() {
|
|
5
|
+
try {
|
|
6
|
+
value = JSON.parse(code);
|
|
7
|
+
error = '';
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
error = e.message;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
let error = '';
|
|
14
|
+
$: code && parseJson();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="flex flex-col w-full">
|
|
18
|
+
<div class="border border-gray-300 w-full">
|
|
19
|
+
<SimpleEditor autoHeight lang="json" bind:code />
|
|
20
|
+
</div>
|
|
21
|
+
{#if error != ''}
|
|
22
|
+
<span class="text-red-600 text-xs">{error}</span>
|
|
23
|
+
{/if}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
code: string;
|
|
5
|
+
value: any;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type JsonEditorProps = typeof __propDef.props;
|
|
13
|
+
export type JsonEditorEvents = typeof __propDef.events;
|
|
14
|
+
export type JsonEditorSlots = typeof __propDef.slots;
|
|
15
|
+
export default class JsonEditor extends SvelteComponentTyped<JsonEditorProps, JsonEditorEvents, JsonEditorSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script>import Toggle from '../../../../Toggle.svelte';
|
|
2
2
|
import { staticValues } from '../../componentsPanel/componentStaticValues';
|
|
3
|
-
import SimpleEditor from '../../../../SimpleEditor.svelte';
|
|
4
3
|
import ArrayStaticInputEditor from '../ArrayStaticInputEditor.svelte';
|
|
5
4
|
import ResourcePicker from '../../../../ResourcePicker.svelte';
|
|
5
|
+
import JsonEditor from './JsonEditor.svelte';
|
|
6
|
+
import { getContext } from 'svelte';
|
|
6
7
|
export let componentInput;
|
|
8
|
+
const { onchange } = getContext('AppEditorContext');
|
|
9
|
+
$: componentInput && onchange?.();
|
|
7
10
|
</script>
|
|
8
11
|
|
|
9
12
|
{#if componentInput?.type === 'static'}
|
|
@@ -22,7 +25,7 @@ export let componentInput;
|
|
|
22
25
|
{/each}
|
|
23
26
|
</select>
|
|
24
27
|
{:else if componentInput.fieldType === 'object'}
|
|
25
|
-
{#if componentInput
|
|
28
|
+
{#if componentInput?.format?.startsWith('resource-')}
|
|
26
29
|
<ResourcePicker
|
|
27
30
|
initialValue={componentInput.value?.split('$res:')[1] || ''}
|
|
28
31
|
on:change={(e) => {
|
|
@@ -37,16 +40,10 @@ export let componentInput;
|
|
|
37
40
|
: undefined}
|
|
38
41
|
/>
|
|
39
42
|
{:else}
|
|
40
|
-
<div class="
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
+
<div class="flex w-full flex-col">
|
|
44
|
+
<JsonEditor
|
|
45
|
+
bind:value={componentInput.value}
|
|
43
46
|
code={JSON.stringify(componentInput.value, null, 2)}
|
|
44
|
-
class="few-lines-editor"
|
|
45
|
-
on:change={(e) => {
|
|
46
|
-
if (componentInput?.type === 'static' && componentInput.value) {
|
|
47
|
-
componentInput.value = JSON.parse(e.detail.code)
|
|
48
|
-
}
|
|
49
|
-
}}
|
|
50
47
|
/>
|
|
51
48
|
</div>
|
|
52
49
|
{/if}
|
|
@@ -6,36 +6,53 @@ import InlineScriptList from './InlineScriptList.svelte';
|
|
|
6
6
|
import WorkspaceScriptList from './WorkspaceScriptList.svelte';
|
|
7
7
|
import WorkspaceFlowList from './WorkspaceFlowList.svelte';
|
|
8
8
|
import { getContext } from 'svelte';
|
|
9
|
+
import { loadSchema, schemaToInputsSpec } from '../../../utils';
|
|
10
|
+
import { emptySchema } from '../../../../../utils';
|
|
9
11
|
export let appInput;
|
|
10
12
|
let tab = 'inlinescripts';
|
|
11
13
|
let filter = '';
|
|
12
14
|
let picker;
|
|
13
|
-
const { app } = getContext('AppEditorContext');
|
|
14
|
-
function
|
|
15
|
+
const { app, workspace } = getContext('AppEditorContext');
|
|
16
|
+
async function loadSchemaFromTriggerable(path, runType) {
|
|
17
|
+
return loadSchema(workspace, path, runType) ?? emptySchema();
|
|
18
|
+
}
|
|
19
|
+
async function pickScript(path) {
|
|
15
20
|
if (appInput.type === 'runnable') {
|
|
21
|
+
const schema = await loadSchemaFromTriggerable(path, 'script');
|
|
22
|
+
const fields = schemaToInputsSpec(schema);
|
|
16
23
|
appInput.runnable = {
|
|
17
24
|
type: 'runnableByPath',
|
|
18
25
|
path,
|
|
19
|
-
runType: 'script'
|
|
26
|
+
runType: 'script',
|
|
27
|
+
schema
|
|
20
28
|
};
|
|
29
|
+
appInput.fields = fields;
|
|
21
30
|
}
|
|
22
31
|
}
|
|
23
|
-
function pickFlow(path) {
|
|
32
|
+
async function pickFlow(path) {
|
|
24
33
|
if (appInput.type === 'runnable') {
|
|
34
|
+
const schema = await loadSchemaFromTriggerable(path, 'flow');
|
|
35
|
+
const fields = schemaToInputsSpec(schema);
|
|
25
36
|
appInput.runnable = {
|
|
26
37
|
type: 'runnableByPath',
|
|
27
38
|
path,
|
|
28
|
-
runType: 'flow'
|
|
39
|
+
runType: 'flow',
|
|
40
|
+
schema
|
|
29
41
|
};
|
|
42
|
+
appInput.fields = fields;
|
|
30
43
|
}
|
|
31
44
|
}
|
|
32
|
-
function pickHubScript(path) {
|
|
45
|
+
async function pickHubScript(path) {
|
|
33
46
|
if (appInput.type === 'runnable') {
|
|
47
|
+
const schema = await loadSchemaFromTriggerable(path, 'hubscript');
|
|
48
|
+
const fields = schemaToInputsSpec(schema);
|
|
34
49
|
appInput.runnable = {
|
|
35
50
|
type: 'runnableByPath',
|
|
36
51
|
path,
|
|
37
|
-
runType: 'hubscript'
|
|
52
|
+
runType: 'hubscript',
|
|
53
|
+
schema
|
|
38
54
|
};
|
|
55
|
+
appInput.fields = fields;
|
|
39
56
|
}
|
|
40
57
|
}
|
|
41
58
|
function pickInlineScript(name) {
|
|
@@ -60,6 +77,15 @@ function createScript() {
|
|
|
60
77
|
componentInput?.runnable?.type === 'runnableByName') {
|
|
61
78
|
acc.push(componentInput.runnable.name);
|
|
62
79
|
}
|
|
80
|
+
if (componentInput?.type === 'tablecomponent') {
|
|
81
|
+
componentInput.actionButtons.forEach((actionButton) => {
|
|
82
|
+
if (actionButton.componentInput?.type === 'runnable') {
|
|
83
|
+
if (actionButton.componentInput.runnable?.type === 'runnableByName') {
|
|
84
|
+
acc.push(actionButton.componentInput.runnable.name);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
63
89
|
return acc;
|
|
64
90
|
}, []);
|
|
65
91
|
const unusedNames = $app.unusedInlineScripts.map((x) => x.name);
|
|
@@ -138,6 +164,7 @@ function createScript() {
|
|
|
138
164
|
color="light"
|
|
139
165
|
variant="border"
|
|
140
166
|
startIcon={{ icon: faPlus }}
|
|
167
|
+
btnClasses="truncate"
|
|
141
168
|
>
|
|
142
169
|
Create an inline script
|
|
143
170
|
</Button>
|
|
@@ -146,6 +173,7 @@ function createScript() {
|
|
|
146
173
|
size="sm"
|
|
147
174
|
color="blue"
|
|
148
175
|
startIcon={{ icon: faMousePointer }}
|
|
176
|
+
btnClasses="truncate"
|
|
149
177
|
>
|
|
150
178
|
Select a script or flow
|
|
151
179
|
</Button>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function defaultCode(component: string, language: string): string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function defaultCode(component, language) {
|
|
2
|
+
if (component === 'tablecomponent' && language === 'deno') {
|
|
3
|
+
return `export async function main(x: string) {
|
|
4
|
+
return [
|
|
5
|
+
{ foo: x, bar: 42 },
|
|
6
|
+
{ foo: "static", bar: 84 }]
|
|
7
|
+
}
|
|
8
|
+
`;
|
|
9
|
+
}
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { staticValues } from './editor/componentsPanel/componentStaticValues';
|
|
2
2
|
import type { InlineScript } from './types';
|
|
3
|
-
export type InputType = 'text' | 'textarea' | 'number' | 'boolean' | 'select' | 'date' | 'time' | 'datetime' | 'object' | 'array' | 'any';
|
|
3
|
+
export type InputType = 'text' | 'textarea' | 'template' | 'number' | 'boolean' | 'select' | 'date' | 'time' | 'datetime' | 'object' | 'array' | 'any';
|
|
4
4
|
export type InputConnection = {
|
|
5
5
|
componentId: string;
|
|
6
6
|
path: string;
|
|
@@ -27,6 +27,7 @@ export type TemplateInput = {
|
|
|
27
27
|
};
|
|
28
28
|
type RunnableByPath = {
|
|
29
29
|
path: string;
|
|
30
|
+
schema: any;
|
|
30
31
|
runType: 'script' | 'flow' | 'hubscript';
|
|
31
32
|
type: 'runnableByPath';
|
|
32
33
|
};
|
|
@@ -38,17 +39,17 @@ type RunnableByName = {
|
|
|
38
39
|
export type Runnable = RunnableByPath | RunnableByName | undefined;
|
|
39
40
|
export type ResultInput = {
|
|
40
41
|
runnable: Runnable;
|
|
41
|
-
fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput>;
|
|
42
|
+
fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
|
|
42
43
|
type: 'runnable';
|
|
44
|
+
value?: any;
|
|
43
45
|
};
|
|
44
46
|
type AppInputSpec<T extends InputType, U, V extends InputType = never> = (StaticInput<U> | ConnectedInput | UserInput<U> | RowInput | ResultInput | TemplateInput) & InputConfiguration<T, U, V>;
|
|
45
47
|
type InputConfiguration<T extends InputType, U, V extends InputType> = {
|
|
46
48
|
fieldType: T;
|
|
47
|
-
defaultValue: U;
|
|
48
49
|
subFieldType?: V;
|
|
49
50
|
format?: string | undefined;
|
|
50
51
|
};
|
|
51
|
-
export type AppInput = AppInputSpec<'text', string> | AppInputSpec<'textarea', string> | AppInputSpec<'number', number> | AppInputSpec<'boolean', boolean> | AppInputSpec<'date', string> | AppInputSpec<'time', string> | AppInputSpec<'datetime', string> | AppInputSpec<'any', any> | AppInputSpec<'object', Record<string | number, any>> | AppInputSpec<'object', string> | (AppInputSpec<'select', string> & {
|
|
52
|
+
export type AppInput = AppInputSpec<'text', string> | AppInputSpec<'textarea', string> | AppInputSpec<'template', string> | AppInputSpec<'number', number> | AppInputSpec<'boolean', boolean> | AppInputSpec<'date', string> | AppInputSpec<'time', string> | AppInputSpec<'datetime', string> | AppInputSpec<'any', any> | AppInputSpec<'object', Record<string | number, any>> | AppInputSpec<'object', string> | (AppInputSpec<'select', string> & {
|
|
52
53
|
/**
|
|
53
54
|
* One of the keys of `staticValues` from `lib/components/apps/editor/componentsPanel/componentStaticValues`
|
|
54
55
|
*/
|
package/components/apps/rx.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type World = {
|
|
|
18
18
|
connect: <T>(inputSpec: AppInput, next: (x: T) => void) => Input<T>;
|
|
19
19
|
state: Writable<number>;
|
|
20
20
|
};
|
|
21
|
-
export declare function buildWorld(components: Record<string, string[]>, previousWorld: World | undefined): World;
|
|
21
|
+
export declare function buildWorld(components: Record<string, string[]>, previousWorld: World | undefined, context: Record<string, any>): World;
|
|
22
22
|
export declare function buildObservableWorld(): {
|
|
23
23
|
connect: <T>(inputSpec: AppInput, next: (x: T) => void) => Input<T>;
|
|
24
24
|
newOutput: <T_1>(id: string, name: string, state: Writable<number>, previousValue: T_1) => Output<T_1>;
|
package/components/apps/rx.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { writable } from 'svelte/store';
|
|
2
|
-
export function buildWorld(components, previousWorld) {
|
|
2
|
+
export function buildWorld(components, previousWorld, context) {
|
|
3
3
|
const newWorld = buildObservableWorld();
|
|
4
|
-
const outputsById = {};
|
|
5
4
|
const state = writable(0);
|
|
5
|
+
const outputsById = {
|
|
6
|
+
ctx: Object.fromEntries(Object.entries(context).map(([k, v]) => {
|
|
7
|
+
return [k, newWorld.newOutput('ctx', k, state, v)];
|
|
8
|
+
}))
|
|
9
|
+
};
|
|
6
10
|
for (const [k, outputs] of Object.entries(components)) {
|
|
7
11
|
outputsById[k] = {};
|
|
8
12
|
for (const o of outputs) {
|