windmill-components 1.55.0 → 1.55.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/common.d.ts +1 -1
- package/common.js +3 -0
- package/components/AppConnect.svelte +2 -2
- package/components/ArgInput.svelte +1 -1
- package/components/CronInput.svelte +54 -53
- package/components/Dropdown.svelte +21 -9
- package/components/Editor.svelte +10 -10
- package/components/EditorBar.svelte +2 -2
- package/components/FlowBuilder.svelte +41 -25
- package/components/FlowGraphViewer.svelte +6 -2
- package/components/FlowMetadata.svelte +8 -3
- package/components/FlowViewer.svelte +2 -2
- package/components/FolderEditor.svelte +299 -0
- package/components/FolderEditor.svelte.d.ts +16 -0
- package/components/FolderInfo.svelte +13 -0
- package/components/FolderInfo.svelte.d.ts +16 -0
- package/components/FolderUsageInfo.svelte +17 -0
- package/components/FolderUsageInfo.svelte.d.ts +16 -0
- package/components/GroupEditor.svelte +287 -0
- package/components/GroupEditor.svelte.d.ts +18 -0
- package/components/GroupInfo.svelte +22 -0
- package/components/GroupInfo.svelte.d.ts +16 -0
- package/components/InputTransformForm.svelte +16 -7
- package/components/MoveDrawer.svelte +75 -0
- package/components/MoveDrawer.svelte.d.ts +19 -0
- package/components/Path.svelte +243 -96
- package/components/Path.svelte.d.ts +1 -4
- package/components/RadioButton.svelte +2 -0
- package/components/RadioButton.svelte.d.ts +1 -0
- package/components/ResourceEditor.svelte +11 -16
- package/components/RunForm.svelte +21 -4
- package/components/RunForm.svelte.d.ts +1 -1
- package/components/ScheduleEditor.svelte +226 -0
- package/components/ScheduleEditor.svelte.d.ts +26 -0
- package/components/ScriptBuilder.svelte +109 -114
- package/components/ScriptEditor.svelte +17 -14
- package/components/ScriptEditor.svelte.d.ts +1 -0
- package/components/ScriptPicker.svelte +55 -29
- package/components/ScriptPicker.svelte.d.ts +1 -0
- package/components/ShareModal.svelte +94 -73
- package/components/ShareModal.svelte.d.ts +2 -4
- package/components/SimpleEditor.svelte +15 -10
- package/components/TemplateEditor.svelte +496 -0
- package/components/TemplateEditor.svelte.d.ts +25 -0
- package/components/TestJobLoader.svelte +1 -1
- package/components/VariableEditor.svelte +2 -1
- package/components/apps/CreateApp.svelte +1 -1
- package/components/apps/components/buttons/AppButton.svelte +3 -3
- package/components/apps/components/dataDisplay/AppBarChart.svelte +5 -4
- package/components/apps/components/dataDisplay/AppPieChart.svelte +3 -3
- package/components/apps/components/dateInputs/AppDateInput.svelte +34 -0
- package/components/apps/components/dateInputs/AppDateInput.svelte.d.ts +22 -0
- package/components/apps/components/form/AppForm.svelte +4 -5
- package/components/apps/components/form/AppForm.svelte.d.ts +0 -1
- package/components/apps/components/helpers/AlignWrapper.svelte +3 -4
- package/components/apps/components/helpers/AlignWrapper.svelte.d.ts +2 -3
- package/components/apps/components/helpers/InputValue.svelte +54 -5
- package/components/apps/components/helpers/InputValue.svelte.d.ts +1 -0
- package/components/apps/components/helpers/NonRunnableComponent.svelte +2 -1
- package/components/apps/components/helpers/RefreshButton.svelte +20 -0
- package/components/apps/components/helpers/RefreshButton.svelte.d.ts +16 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +38 -42
- package/components/apps/components/helpers/RunnableWrapper.svelte +6 -3
- package/components/apps/components/numberInputs/AppNumberInput.svelte +8 -11
- package/components/apps/components/numberInputs/AppNumberInput.svelte.d.ts +1 -0
- package/components/apps/components/selectInputs/AppCheckbox.svelte +1 -1
- package/components/apps/components/selectInputs/AppSelect.svelte +26 -0
- package/components/apps/components/selectInputs/AppSelect.svelte.d.ts +22 -0
- package/components/apps/components/table/AppTable.svelte +159 -0
- package/components/apps/components/{dataDisplay → table}/AppTable.svelte.d.ts +0 -0
- package/components/apps/components/table/AppTableFooter.svelte +54 -0
- package/components/apps/components/table/AppTableFooter.svelte.d.ts +20 -0
- package/components/apps/components/table/tableOptions.d.ts +10 -0
- package/components/apps/components/table/tableOptions.js +11 -0
- package/components/apps/components/textInputs/AppTextInput.svelte +17 -10
- package/components/apps/components/textInputs/AppTextInput.svelte.d.ts +2 -0
- package/components/apps/editor/AppEditor.svelte +35 -20
- package/components/apps/editor/AppEditorHeader.svelte +15 -7
- package/components/apps/editor/AppPreview.svelte +5 -3
- package/components/apps/editor/AppPreview.svelte.d.ts +4 -1
- package/components/apps/editor/ComponentEditor.svelte +21 -3
- package/components/apps/editor/ComponentEditor.svelte.d.ts +2 -0
- package/components/apps/editor/ComponentHeader.svelte +21 -4
- package/components/apps/editor/ComponentHeader.svelte.d.ts +2 -0
- package/components/apps/editor/GridEditor.svelte +40 -20
- package/components/apps/editor/RecomputeAllComponents.svelte +5 -7
- package/components/apps/editor/componentsPanel/ComponentList.svelte +30 -82
- package/components/apps/editor/componentsPanel/data.js +78 -29
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +5 -1
- package/components/apps/editor/contextPanel/ContextPanel.svelte +35 -152
- package/components/apps/editor/contextPanel/ContextPanel.svelte.d.ts +1 -3
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +64 -0
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +18 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +95 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +20 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte +32 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte.d.ts +19 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +63 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +17 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +44 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte.d.ts +14 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +126 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte.d.ts +16 -0
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +41 -0
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +44 -0
- package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte.d.ts +18 -0
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +48 -130
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +3 -0
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +2 -2
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/Recompute.svelte +2 -2
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +46 -0
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte +1 -1
- package/components/apps/editor/settingsPanel/{ConnectedInputEditor.svelte → inputEditor/ConnectedInputEditor.svelte} +1 -2
- package/components/apps/editor/settingsPanel/{ConnectedInputEditor.svelte.d.ts → inputEditor/ConnectedInputEditor.svelte.d.ts} +1 -1
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +12 -0
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/{StaticInputEditor.svelte → inputEditor/StaticInputEditor.svelte} +5 -5
- package/components/apps/editor/settingsPanel/{StaticInputEditor.svelte.d.ts → inputEditor/StaticInputEditor.svelte.d.ts} +1 -1
- package/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte +6 -3
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +66 -22
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte.d.ts +2 -3
- package/components/apps/editor/settingsPanel/mainInput/WorkspaceFlowList.svelte +1 -1
- package/components/apps/gridUtils.d.ts +3 -1
- package/components/apps/gridUtils.js +16 -1
- package/components/apps/inputType.d.ts +10 -4
- package/components/apps/rx.d.ts +8 -8
- package/components/apps/rx.js +17 -9
- package/components/apps/types.d.ts +14 -2
- package/components/apps/utils.d.ts +4 -3
- package/components/apps/utils.js +37 -5
- package/components/common/drawer/Drawer.svelte +1 -1
- package/components/common/drawer/Drawer.svelte.d.ts +1 -0
- package/components/common/popup/Popup.svelte +0 -2
- package/components/common/popup/Popup.svelte.d.ts +0 -4
- package/components/common/table/FlowRow.svelte +21 -7
- package/components/common/table/FlowRow.svelte.d.ts +2 -0
- package/components/common/table/ScriptRow.svelte +22 -7
- package/components/common/table/ScriptRow.svelte.d.ts +2 -0
- package/components/common/toggleButton/ToggleButton.svelte +1 -1
- package/components/common/toggleButton/ToggleButtonGroup.svelte +1 -1
- package/components/common/toggleButton/ToggleButtonGroup.svelte.d.ts +1 -0
- package/components/flows/content/FlowEditorPanel.svelte +10 -16
- package/components/flows/content/FlowInputs.svelte +18 -4
- package/components/flows/content/FlowInputs.svelte.d.ts +1 -0
- package/components/flows/content/FlowModuleComponent.svelte +1 -1
- package/components/flows/content/FlowModuleWrapper.svelte +26 -1
- package/components/flows/content/FlowSchedules.svelte +5 -0
- package/components/flows/content/FlowSettings.svelte +16 -24
- package/components/flows/content/FlowSettings.svelte.d.ts +0 -1
- package/components/flows/header/FlowPreviewButtons.svelte +13 -10
- package/components/flows/map/FlowErrorHandlerItem.svelte +1 -1
- package/components/flows/map/FlowModuleSchemaMap.svelte +12 -3
- package/components/flows/map/FlowSettingsItem.svelte +8 -15
- package/components/flows/map/InsertModuleButton.svelte +29 -2
- package/components/flows/map/InsertModuleButton.svelte.d.ts +3 -1
- package/components/flows/map/MapItem.svelte +2 -1
- package/components/flows/map/MapItem.svelte.d.ts +1 -0
- package/components/flows/pickers/WorkspaceScriptPicker.svelte +3 -0
- package/components/flows/previousResults.js +1 -1
- package/components/graph/FlowGraph.svelte +15 -15
- package/components/graph/model.d.ts +35 -1
- package/components/home/ItemsList.svelte +20 -12
- package/components/jobs/JobDetail.svelte +9 -3
- package/components/sidebar/SidebarContent.svelte +4 -3
- package/components/sidebar/UserMenu.svelte +1 -1
- package/editorUtils.d.ts +7 -1
- package/editorUtils.js +98 -3
- package/es5.d.ts.txt +4526 -0
- package/gen/index.d.ts +2 -0
- package/gen/index.js +1 -0
- package/gen/models/CompletedJob.d.ts +1 -0
- package/gen/models/EditSchedule.d.ts +0 -2
- package/gen/models/Folder.d.ts +5 -0
- package/gen/models/Folder.js +4 -0
- package/gen/models/QueuedJob.d.ts +1 -0
- package/gen/models/Script.d.ts +1 -1
- package/gen/models/User.d.ts +1 -0
- package/gen/services/FolderService.d.ts +128 -0
- package/gen/services/FolderService.js +151 -0
- package/gen/services/GranularAclService.d.ts +3 -3
- package/gen/services/GroupService.d.ts +5 -1
- package/gen/services/GroupService.js +4 -1
- package/gen/services/JobService.d.ts +25 -5
- package/gen/services/JobService.js +10 -5
- package/gen/services/ScriptService.d.ts +2 -1
- package/gen/services/UserService.d.ts +9 -0
- package/gen/services/UserService.js +15 -0
- package/package.json +485 -461
- package/script_helpers.d.ts +2 -2
- package/script_helpers.js +4 -4
- package/stores.d.ts +1 -0
- package/utils.d.ts +3 -0
- package/utils.js +44 -7
- package/components/GroupModal.svelte +0 -98
- package/components/GroupModal.svelte.d.ts +0 -17
- package/components/apps/components/dataDisplay/AppTable.svelte +0 -132
- package/components/apps/components/dataDisplay/app.md +0 -49
- package/components/apps/editor/contextPanel/InlineScriptCreationPanel.svelte +0 -29
- package/components/apps/editor/contextPanel/InlineScriptCreationPanel.svelte.d.ts +0 -16
|
@@ -8,42 +8,33 @@ import { getNextId } from '../../../flows/flowStateUtils';
|
|
|
8
8
|
import { faAngleDown } from '@fortawesome/free-solid-svg-icons';
|
|
9
9
|
import { isOpenStore } from './store';
|
|
10
10
|
import { gridColumns } from '../../gridUtils';
|
|
11
|
-
const { app } = getContext('AppEditorContext');
|
|
11
|
+
const { app, selectedComponent } = getContext('AppEditorContext');
|
|
12
12
|
function getMinDimensionsByComponent(componentType, column) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return column === 3 ? { w: 3, h: 4 } : { w: 12, h: 4 };
|
|
37
|
-
}
|
|
38
|
-
else if (componentType === 'displaycomponent') {
|
|
39
|
-
return column === 3 ? { w: 2, h: 2 } : { w: 6, h: 4 };
|
|
40
|
-
}
|
|
41
|
-
else if (componentType === 'checkboxcomponent') {
|
|
42
|
-
return column === 3 ? { w: 1, h: 1 } : { w: 3, h: 1 };
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return { w: 2, h: 1 };
|
|
13
|
+
// Dimensions key formula: <mobile width>:<mobile height>-<desktop width>:<desktop height>
|
|
14
|
+
const dimensions = {
|
|
15
|
+
'1:1-3:1': ['buttoncomponent', 'textcomponent', 'checkboxcomponent'],
|
|
16
|
+
'1:2-2:1': ['textinputcomponent', 'numberinputcomponent', 'selectcomponent'],
|
|
17
|
+
'2:2-6:4': ['displaycomponent'],
|
|
18
|
+
'2:3-6:4': ['formcomponent'],
|
|
19
|
+
'2:4-6:4': ['barchartcomponent', 'piechartcomponent'],
|
|
20
|
+
'3:4-12:4': ['tablecomponent']
|
|
21
|
+
};
|
|
22
|
+
// Finds the key that is associated with the component type and extracts the dimensions from it
|
|
23
|
+
const [dimension] = Object.entries(dimensions).find(([_, value]) => value.includes(componentType)) || ['2:1-2:1'];
|
|
24
|
+
const size = dimension.split('-')[column === 3 ? 0 : 1].split(':');
|
|
25
|
+
return { w: +size[0], h: +size[1] };
|
|
26
|
+
}
|
|
27
|
+
function getMaxDimensionsByComponent(componentType, column) {
|
|
28
|
+
if ([
|
|
29
|
+
'textinputcomponent',
|
|
30
|
+
'numberinputcomponent',
|
|
31
|
+
'selectcomponent',
|
|
32
|
+
'dateinputcomponent',
|
|
33
|
+
'passwordinputcomponent'
|
|
34
|
+
].includes(componentType)) {
|
|
35
|
+
return { w: column, h: 1 };
|
|
46
36
|
}
|
|
37
|
+
return { w: column, h: 12 };
|
|
47
38
|
}
|
|
48
39
|
function addComponent(appComponent) {
|
|
49
40
|
const grid = $app.grid ?? [];
|
|
@@ -63,58 +54,15 @@ function addComponent(appComponent) {
|
|
|
63
54
|
id: id
|
|
64
55
|
};
|
|
65
56
|
gridColumns.forEach((column) => {
|
|
66
|
-
newItem[column] = newComponent;
|
|
67
|
-
const position = gridHelp.findSpace(newItem, grid, column);
|
|
68
57
|
const min = getMinDimensionsByComponent(appComponent.type, column);
|
|
69
|
-
const max =
|
|
70
|
-
newItem[column].w
|
|
71
|
-
|
|
58
|
+
const max = getMaxDimensionsByComponent(appComponent.type, column);
|
|
59
|
+
newItem[column] = { ...newComponent, min, max, w: min.w, h: min.h };
|
|
60
|
+
const position = gridHelp.findSpace(newItem, grid, column);
|
|
72
61
|
newItem[column] = { ...newItem[column], ...position, min, max };
|
|
73
62
|
});
|
|
74
63
|
$app.grid = [...grid, newItem];
|
|
64
|
+
$selectedComponent = id;
|
|
75
65
|
}
|
|
76
|
-
const products = {
|
|
77
|
-
1: {
|
|
78
|
-
name: 'Product 1',
|
|
79
|
-
description: 'Product 1 description',
|
|
80
|
-
image: 'https://picsum.photos/200'
|
|
81
|
-
},
|
|
82
|
-
2: {
|
|
83
|
-
name: 'Product 2',
|
|
84
|
-
description: 'Product 2 description',
|
|
85
|
-
image: 'https://picsum.photos/200'
|
|
86
|
-
},
|
|
87
|
-
3: {
|
|
88
|
-
name: 'Product 3',
|
|
89
|
-
description: 'Product 3 description',
|
|
90
|
-
image: 'https://picsum.photos/200'
|
|
91
|
-
},
|
|
92
|
-
4: {
|
|
93
|
-
name: 'Product 4',
|
|
94
|
-
description: 'Product 4 description',
|
|
95
|
-
image: 'https://picsum.photos/200'
|
|
96
|
-
},
|
|
97
|
-
5: {
|
|
98
|
-
name: 'Product 5',
|
|
99
|
-
description: 'Product 5 description',
|
|
100
|
-
image: 'https://picsum.photos/200'
|
|
101
|
-
},
|
|
102
|
-
6: {
|
|
103
|
-
name: 'Product 6',
|
|
104
|
-
description: 'Product 6 description',
|
|
105
|
-
image: 'https://picsum.photos/200'
|
|
106
|
-
},
|
|
107
|
-
7: {
|
|
108
|
-
name: 'Product 7',
|
|
109
|
-
description: 'Product 7 description',
|
|
110
|
-
image: 'https://picsum.photos/200'
|
|
111
|
-
},
|
|
112
|
-
8: {
|
|
113
|
-
name: 'Product 8',
|
|
114
|
-
description: 'Product 8 description',
|
|
115
|
-
image: 'https://picsum.photos/200'
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
66
|
onMount(() => {
|
|
119
67
|
isOpenStore.addItems(componentSets.map((set) => ({ [set.title]: true })));
|
|
120
68
|
});
|
|
@@ -140,7 +88,7 @@ onMount(() => {
|
|
|
140
88
|
on:click={() => addComponent(item)}
|
|
141
89
|
title={displayData[item.type].name}
|
|
142
90
|
class="border shadow-sm h-16 p-2 flex flex-col gap-2 items-center
|
|
143
|
-
justify-center bg-white rounded-md
|
|
91
|
+
justify-center bg-white rounded-md hover:bg-gray-100 duration-200"
|
|
144
92
|
>
|
|
145
93
|
<svelte:component this={displayData[item.type].icon} class="text-blue-800" />
|
|
146
94
|
<div class="text-xs w-full text-center ellipsize">
|
|
@@ -3,50 +3,97 @@ const inputs = {
|
|
|
3
3
|
title: 'Inputs',
|
|
4
4
|
components: [
|
|
5
5
|
{
|
|
6
|
+
verticalAlignment: 'center',
|
|
6
7
|
id: 'textinputcomponent',
|
|
7
8
|
type: 'textinputcomponent',
|
|
8
9
|
componentInput: undefined,
|
|
9
|
-
configuration: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
10
|
+
configuration: {},
|
|
11
|
+
card: false
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
verticalAlignment: 'center',
|
|
15
|
+
id: 'passwordinputcomponent',
|
|
16
|
+
type: 'passwordinputcomponent',
|
|
17
|
+
componentInput: undefined,
|
|
18
|
+
configuration: {},
|
|
18
19
|
card: false
|
|
19
20
|
},
|
|
20
21
|
{
|
|
22
|
+
verticalAlignment: 'center',
|
|
21
23
|
id: 'numberinputcomponent',
|
|
22
24
|
type: 'numberinputcomponent',
|
|
23
25
|
componentInput: undefined,
|
|
26
|
+
configuration: {},
|
|
27
|
+
card: false
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
verticalAlignment: 'center',
|
|
31
|
+
id: 'dateinputcomponent',
|
|
32
|
+
type: 'dateinputcomponent',
|
|
33
|
+
componentInput: undefined,
|
|
24
34
|
configuration: {
|
|
25
|
-
|
|
35
|
+
minDate: {
|
|
26
36
|
type: 'static',
|
|
27
37
|
visible: false,
|
|
28
|
-
value: '
|
|
29
|
-
fieldType: '
|
|
30
|
-
defaultValue: '
|
|
38
|
+
value: '',
|
|
39
|
+
fieldType: 'date',
|
|
40
|
+
defaultValue: ''
|
|
41
|
+
},
|
|
42
|
+
maxDate: {
|
|
43
|
+
type: 'static',
|
|
44
|
+
visible: false,
|
|
45
|
+
value: '',
|
|
46
|
+
fieldType: 'date',
|
|
47
|
+
defaultValue: ''
|
|
31
48
|
}
|
|
32
49
|
},
|
|
33
|
-
card: false
|
|
50
|
+
card: false,
|
|
51
|
+
softWrap: true
|
|
34
52
|
},
|
|
35
53
|
{
|
|
36
54
|
...defaultAlignement,
|
|
37
55
|
id: 'checkboxcomponent',
|
|
38
56
|
type: 'checkboxcomponent',
|
|
57
|
+
componentInput: undefined,
|
|
39
58
|
configuration: {
|
|
40
59
|
label: {
|
|
41
60
|
type: 'static',
|
|
42
61
|
visible: true,
|
|
43
|
-
value: '
|
|
62
|
+
value: 'Label',
|
|
44
63
|
fieldType: 'textarea',
|
|
45
|
-
defaultValue: '
|
|
64
|
+
defaultValue: 'Label'
|
|
46
65
|
}
|
|
47
66
|
},
|
|
48
|
-
componentInput: undefined,
|
|
49
67
|
card: false
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
verticalAlignment: 'center',
|
|
71
|
+
id: 'selectcomponent',
|
|
72
|
+
type: 'selectcomponent',
|
|
73
|
+
componentInput: undefined,
|
|
74
|
+
configuration: {
|
|
75
|
+
items: {
|
|
76
|
+
type: 'static',
|
|
77
|
+
fieldType: 'array',
|
|
78
|
+
subFieldType: 'object',
|
|
79
|
+
defaultValue: [
|
|
80
|
+
{ value: 'foo', label: 'Foo' },
|
|
81
|
+
{ value: 'bar', label: 'Bar' }
|
|
82
|
+
],
|
|
83
|
+
value: [
|
|
84
|
+
{ value: 'foo', label: 'Foo' },
|
|
85
|
+
{ value: 'bar', label: 'Bar' }
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
itemKey: {
|
|
89
|
+
type: 'static',
|
|
90
|
+
fieldType: 'text',
|
|
91
|
+
defaultValue: 'value',
|
|
92
|
+
value: 'value'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
card: false,
|
|
96
|
+
softWrap: true
|
|
50
97
|
}
|
|
51
98
|
]
|
|
52
99
|
};
|
|
@@ -58,10 +105,11 @@ const buttons = {
|
|
|
58
105
|
id: 'buttoncomponent',
|
|
59
106
|
type: 'buttoncomponent',
|
|
60
107
|
componentInput: {
|
|
61
|
-
type: '
|
|
62
|
-
fieldType: '
|
|
63
|
-
|
|
64
|
-
|
|
108
|
+
type: 'runnable',
|
|
109
|
+
fieldType: 'any',
|
|
110
|
+
fields: {},
|
|
111
|
+
runnable: undefined,
|
|
112
|
+
defaultValue: undefined
|
|
65
113
|
},
|
|
66
114
|
recomputeIds: undefined,
|
|
67
115
|
configuration: {
|
|
@@ -92,14 +140,15 @@ const buttons = {
|
|
|
92
140
|
card: false
|
|
93
141
|
},
|
|
94
142
|
{
|
|
95
|
-
|
|
143
|
+
horizontalAlignment: 'center',
|
|
96
144
|
id: 'formcomponent',
|
|
97
145
|
type: 'formcomponent',
|
|
98
146
|
componentInput: {
|
|
99
|
-
type: '
|
|
100
|
-
fieldType: '
|
|
101
|
-
|
|
102
|
-
|
|
147
|
+
type: 'runnable',
|
|
148
|
+
fieldType: 'any',
|
|
149
|
+
fields: {},
|
|
150
|
+
runnable: undefined,
|
|
151
|
+
defaultValue: undefined
|
|
103
152
|
},
|
|
104
153
|
recomputeIds: undefined,
|
|
105
154
|
configuration: {
|
|
@@ -131,8 +180,8 @@ const buttons = {
|
|
|
131
180
|
}
|
|
132
181
|
]
|
|
133
182
|
};
|
|
134
|
-
const
|
|
135
|
-
title: '
|
|
183
|
+
const display = {
|
|
184
|
+
title: 'Display',
|
|
136
185
|
components: [
|
|
137
186
|
{
|
|
138
187
|
...defaultAlignement,
|
|
@@ -269,5 +318,5 @@ const dataDisplay = {
|
|
|
269
318
|
}
|
|
270
319
|
]
|
|
271
320
|
};
|
|
272
|
-
const componentSets = [buttons, inputs,
|
|
321
|
+
const componentSets = [buttons, inputs, display];
|
|
273
322
|
export { componentSets };
|
|
@@ -19,4 +19,8 @@ $: $worldStore?.outputsById[componentId] &&
|
|
|
19
19
|
subscribeToAllOutputs($worldStore.outputsById[componentId]);
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
{#if Object.keys(object).length > 0}
|
|
23
|
+
<ObjectViewer json={object} on:select topBrackets={false} />
|
|
24
|
+
{:else}
|
|
25
|
+
<div class="text-xs text-gray-500 px-4">No outputs</div>
|
|
26
|
+
{/if}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { Drawer } from '../../../common';
|
|
3
|
-
import Button from '../../../common/button/Button.svelte';
|
|
4
|
-
import DrawerContent from '../../../common/drawer/DrawerContent.svelte';
|
|
5
|
-
import ScriptEditor from '../../../ScriptEditor.svelte';
|
|
6
|
-
import { Preview } from '../../../../gen';
|
|
7
|
-
import { DENO_INIT_CODE_CLEAR } from '../../../../script_helpers';
|
|
8
|
-
import { classNames, emptySchema } from '../../../../utils';
|
|
9
|
-
import { faEdit, faPlus, faSave, faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
1
|
+
<script>import { classNames } from '../../../../utils';
|
|
10
2
|
import { getContext } from 'svelte';
|
|
3
|
+
import { displayData } from '../../utils';
|
|
11
4
|
import PanelSection from '../settingsPanel/common/PanelSection.svelte';
|
|
12
5
|
import ComponentOutputViewer from './ComponentOutputViewer.svelte';
|
|
13
|
-
|
|
14
|
-
const { connectingInput, staticOutputs, app, worldStore, selectedComponent } = getContext('AppEditorContext');
|
|
15
|
-
let newScriptPath;
|
|
16
|
-
let ignorePathError = false;
|
|
17
|
-
$: isTakenPath = Object.keys($app.inlineScripts).includes(newScriptPath);
|
|
6
|
+
const { connectingInput, staticOutputs, worldStore, selectedComponent, app } = getContext('AppEditorContext');
|
|
18
7
|
function connectInput(componentId, path) {
|
|
19
8
|
if ($connectingInput) {
|
|
20
9
|
$connectingInput = {
|
|
@@ -29,156 +18,50 @@ function connectInput(componentId, path) {
|
|
|
29
18
|
};
|
|
30
19
|
}
|
|
31
20
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const inlineScript = {
|
|
37
|
-
content: DENO_INIT_CODE_CLEAR,
|
|
38
|
-
language: Preview.language.DENO,
|
|
39
|
-
path,
|
|
40
|
-
schema: emptySchema()
|
|
41
|
-
};
|
|
42
|
-
if ($app.inlineScripts) {
|
|
43
|
-
$app.inlineScripts[newScriptPath] = inlineScript;
|
|
21
|
+
function getComponentNameById(componentId) {
|
|
22
|
+
const component = $app.grid.find((c) => c.data.id === componentId);
|
|
23
|
+
if (component?.data.type) {
|
|
24
|
+
return displayData[component?.data.type].name;
|
|
44
25
|
}
|
|
45
|
-
else {
|
|
46
|
-
$app.inlineScripts = {
|
|
47
|
-
[newScriptPath]: inlineScript
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
scriptCreationDrawer?.closeDrawer?.();
|
|
51
|
-
selectedScript = inlineScript;
|
|
52
|
-
scriptEditorDrawer.openDrawer?.();
|
|
53
|
-
}
|
|
54
|
-
function afterCreateScript() {
|
|
55
|
-
newScriptPath = '';
|
|
56
|
-
ignorePathError = false;
|
|
57
26
|
}
|
|
58
|
-
let selectedScript = undefined;
|
|
59
|
-
let scriptEditorDrawer;
|
|
60
|
-
let scriptCreationDrawer = undefined;
|
|
61
27
|
</script>
|
|
62
28
|
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
autofocus
|
|
70
|
-
id="pathInput"
|
|
71
|
-
class="grow min-w-[150px]"
|
|
72
|
-
bind:value={newScriptPath}
|
|
73
|
-
on:keypress={(e) => e.key === 'Enter' && createScript()}
|
|
74
|
-
/>
|
|
75
|
-
<Button on:click={createScript} size="sm" disabled={isTakenPath} startIcon={{ icon: faPlus }}>
|
|
76
|
-
Create
|
|
77
|
-
</Button>
|
|
78
|
-
</div>
|
|
79
|
-
{#if isTakenPath && !ignorePathError}
|
|
80
|
-
<div transition:fade={{ duration: 100 }} class="text-sm text-red-600 h-5 mt-1">
|
|
81
|
-
This name is already used.
|
|
82
|
-
</div>
|
|
83
|
-
{/if}
|
|
84
|
-
</DrawerContent>
|
|
85
|
-
</Drawer>
|
|
86
|
-
|
|
87
|
-
<Drawer bind:this={scriptEditorDrawer} size="1200px">
|
|
88
|
-
<DrawerContent
|
|
89
|
-
title="Script Editor"
|
|
90
|
-
noPadding
|
|
91
|
-
forceOverflowVisible
|
|
92
|
-
on:close={scriptEditorDrawer.closeDrawer}
|
|
93
|
-
>
|
|
94
|
-
{#if selectedScript}
|
|
95
|
-
<ScriptEditor
|
|
96
|
-
lang={selectedScript.language}
|
|
97
|
-
bind:code={selectedScript.content}
|
|
98
|
-
path={selectedScript.path}
|
|
99
|
-
bind:schema={selectedScript.schema}
|
|
100
|
-
fixedOverflowWidgets={false}
|
|
101
|
-
/>
|
|
102
|
-
{/if}
|
|
103
|
-
<svelte:fragment slot="actions">
|
|
104
|
-
<Button startIcon={{ icon: faSave }} disabled>Automatically Saved</Button>
|
|
105
|
-
</svelte:fragment>
|
|
106
|
-
</DrawerContent>
|
|
107
|
-
</Drawer>
|
|
108
|
-
|
|
109
|
-
<PanelSection title="Inline scripts">
|
|
110
|
-
<svelte:fragment slot="action">
|
|
111
|
-
<Button
|
|
112
|
-
size="xs"
|
|
113
|
-
color="light"
|
|
114
|
-
variant="border"
|
|
115
|
-
on:click={scriptCreationDrawer?.openDrawer}
|
|
116
|
-
startIcon={{ icon: faPlus }}
|
|
117
|
-
iconOnly
|
|
118
|
-
/>
|
|
119
|
-
</svelte:fragment>
|
|
120
|
-
|
|
121
|
-
{#if $app.inlineScripts && Object.keys($app.inlineScripts).length > 0}
|
|
122
|
-
<div class="w-full border rounded-sm">
|
|
123
|
-
{#each $app.inlineScripts ? Object.entries($app.inlineScripts) : [] as [key, value], index}
|
|
124
|
-
<div
|
|
29
|
+
<PanelSection title="Outputs">
|
|
30
|
+
{#each Object.entries($staticOutputs) as [componentId, outputs] (componentId)}
|
|
31
|
+
{#if outputs.length > 0 && $worldStore?.outputsById[componentId]}
|
|
32
|
+
<div class="flex flex-row justify-between w-full -mb-2 ">
|
|
33
|
+
<button
|
|
34
|
+
on:click={() => ($selectedComponent = componentId)}
|
|
125
35
|
class={classNames(
|
|
126
|
-
'
|
|
127
|
-
|
|
36
|
+
'px-2 text-2xs py-0.5 font-bold rounded-t-sm w-fit',
|
|
37
|
+
$selectedComponent === componentId
|
|
38
|
+
? ' bg-indigo-500 text-white'
|
|
39
|
+
: 'bg-gray-200 text-gray-500'
|
|
128
40
|
)}
|
|
129
41
|
>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
scriptEditorDrawer.openDrawer && scriptEditorDrawer.openDrawer()
|
|
142
|
-
}
|
|
143
|
-
}}
|
|
144
|
-
/>
|
|
145
|
-
<Button
|
|
146
|
-
size="xs"
|
|
147
|
-
color="red"
|
|
148
|
-
variant="border"
|
|
149
|
-
iconOnly
|
|
150
|
-
startIcon={{ icon: faTrash }}
|
|
151
|
-
on:click={() => {
|
|
152
|
-
if ($app.inlineScripts[key]) {
|
|
153
|
-
delete $app.inlineScripts[key]
|
|
154
|
-
$app = $app
|
|
155
|
-
}
|
|
156
|
-
}}
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
</div>
|
|
160
|
-
{/each}
|
|
161
|
-
</div>
|
|
162
|
-
{:else}
|
|
163
|
-
<div class="text-sm text-gray-500">No inline scripts</div>
|
|
164
|
-
{/if}
|
|
165
|
-
</PanelSection>
|
|
166
|
-
|
|
167
|
-
<PanelSection title="Outputs">
|
|
168
|
-
{#each Object.entries($staticOutputs) as [componentId, outputs], index}
|
|
169
|
-
{#if outputs.length > 0 && $worldStore?.outputsById[componentId]}
|
|
170
|
-
<Button size="xs" on:click={() => ($selectedComponent = componentId)} color="blue">
|
|
171
|
-
Component: {componentId}
|
|
172
|
-
</Button>
|
|
42
|
+
{componentId}
|
|
43
|
+
</button>
|
|
44
|
+
<span
|
|
45
|
+
class={classNames(
|
|
46
|
+
'px-1 text-2xs py-0.5 font-bold rounded-t-sm w-fit',
|
|
47
|
+
'bg-gray-500 text-white'
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
{getComponentNameById(componentId)}
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
173
53
|
|
|
54
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
174
55
|
<div
|
|
56
|
+
on:click={() => ($selectedComponent = componentId)}
|
|
175
57
|
class={classNames(
|
|
176
|
-
'w-full
|
|
177
|
-
$selectedComponent === componentId
|
|
178
|
-
? 'outline-1 outline outline-offset-2 outline-blue-500'
|
|
179
|
-
: ''
|
|
58
|
+
'w-full py-2 border relative',
|
|
59
|
+
$selectedComponent === componentId ? 'border border-blue-500 ' : 'cursor-pointer'
|
|
180
60
|
)}
|
|
181
61
|
>
|
|
62
|
+
{#if $selectedComponent === componentId && $connectingInput?.opened}
|
|
63
|
+
<div class="absolute top-0 left-0 w-full h-full bg-gray-500 bg-opacity-50 z-10" />
|
|
64
|
+
{/if}
|
|
182
65
|
<ComponentOutputViewer
|
|
183
66
|
{outputs}
|
|
184
67
|
{componentId}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script>import FlowScriptPicker from '../../../flows/pickers/FlowScriptPicker.svelte';
|
|
2
|
+
import { Script } from '../../../../gen';
|
|
3
|
+
import { inferArgs } from '../../../../infer';
|
|
4
|
+
import { initialCode } from '../../../../script_helpers';
|
|
5
|
+
import { emptySchema } from '../../../../utils';
|
|
6
|
+
import { createEventDispatcher, getContext } from 'svelte';
|
|
7
|
+
import { fly } from 'svelte/transition';
|
|
8
|
+
export let name;
|
|
9
|
+
const { appPath } = getContext('AppEditorContext');
|
|
10
|
+
const dispatch = createEventDispatcher();
|
|
11
|
+
async function inferInlineScriptSchema(language, content, schema) {
|
|
12
|
+
try {
|
|
13
|
+
await inferArgs(language, content, schema);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
console.error("Couldn't infer args", e);
|
|
17
|
+
}
|
|
18
|
+
return schema;
|
|
19
|
+
}
|
|
20
|
+
async function createInlineScriptByLanguage(language, path, subkind = undefined) {
|
|
21
|
+
const fullPath = `${appPath}/inline-script/${path}`;
|
|
22
|
+
const content = initialCode(language, Script.kind.SCRIPT, subkind ?? 'flow');
|
|
23
|
+
let schema = emptySchema();
|
|
24
|
+
schema = await inferInlineScriptSchema(language, content, schema);
|
|
25
|
+
const newInlineScript = {
|
|
26
|
+
content,
|
|
27
|
+
language,
|
|
28
|
+
path: fullPath,
|
|
29
|
+
schema
|
|
30
|
+
};
|
|
31
|
+
dispatch('new', newInlineScript);
|
|
32
|
+
}
|
|
33
|
+
const langs = ['deno', 'python3', 'go', 'bash'];
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<div class="flex flex-col p-4 gap-2 text-sm" in:fly={{ duration: 50 }}>
|
|
37
|
+
Please choose a language:
|
|
38
|
+
<div class="flex gap-2 flex-row flex-wrap">
|
|
39
|
+
{#each langs as lang}
|
|
40
|
+
<FlowScriptPicker
|
|
41
|
+
label={lang}
|
|
42
|
+
{lang}
|
|
43
|
+
on:click={() => {
|
|
44
|
+
createInlineScriptByLanguage(lang, name)
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
{/each}
|
|
48
|
+
|
|
49
|
+
<FlowScriptPicker
|
|
50
|
+
label={`PostgreSQL`}
|
|
51
|
+
lang="pgsql"
|
|
52
|
+
on:click={() => {
|
|
53
|
+
createInlineScriptByLanguage(Script.language.DENO, name, 'pgsql')
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
<FlowScriptPicker
|
|
57
|
+
label={`MySQL`}
|
|
58
|
+
lang="mysql"
|
|
59
|
+
on:click={() => {
|
|
60
|
+
createInlineScriptByLanguage(Script.language.DENO, name, 'mysql')
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
new: CustomEvent<any>;
|
|
8
|
+
} & {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type EmptyInlineScriptProps = typeof __propDef.props;
|
|
14
|
+
export type EmptyInlineScriptEvents = typeof __propDef.events;
|
|
15
|
+
export type EmptyInlineScriptSlots = typeof __propDef.slots;
|
|
16
|
+
export default class EmptyInlineScript extends SvelteComponentTyped<EmptyInlineScriptProps, EmptyInlineScriptEvents, EmptyInlineScriptSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|