windmill-components 1.60.4 → 1.70.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/assets/app.css +3 -0
- package/common.d.ts +5 -1
- package/components/ApiConnectForm.svelte +66 -5
- package/components/AppConnect.svelte +24 -9
- package/components/ArgInput.svelte +1 -1
- package/components/CliHelpBox.svelte +49 -0
- package/components/CliHelpBox.svelte.d.ts +14 -0
- package/components/DisplayResult.svelte +51 -1
- package/components/DisplayResult.svelte.d.ts +1 -0
- package/components/Editor.svelte +17 -7
- package/components/EditorBar.svelte +129 -111
- package/components/FlowBuilder.svelte +2 -2
- package/components/FlowJobResult.svelte +10 -2
- package/components/FlowJobResult.svelte.d.ts +1 -0
- package/components/FlowMetadata.svelte +24 -8
- package/components/FlowPreviewContent.svelte +3 -4
- package/components/FlowStatusViewer.svelte +41 -9
- package/components/FolderEditor.svelte +3 -2
- package/components/HighlightCode.svelte +7 -1
- package/components/InlineCodeCopy.svelte +11 -0
- package/components/InlineCodeCopy.svelte.d.ts +16 -0
- package/components/InputTransformForm.svelte +9 -5
- package/components/LogViewer.svelte +6 -0
- package/components/LogViewer.svelte.d.ts +1 -0
- package/components/ModulePreview.svelte +11 -2
- package/components/MoveDrawer.svelte +1 -1
- package/components/Multiselect.svelte.d.ts +2 -2
- package/components/ObjectResourceInput.svelte +6 -1
- package/components/Path.svelte +14 -5
- package/components/Popover.svelte +8 -2
- package/components/Popover.svelte.d.ts +1 -0
- package/components/Range.svelte.d.ts +2 -2
- package/components/ResourceEditor.svelte +39 -16
- package/components/ResourcePicker.svelte +0 -1
- package/components/RunForm.svelte +26 -2
- package/components/RunForm.svelte.d.ts +1 -0
- package/components/ScheduleEditor.svelte +1 -1
- package/components/SchemaEditor.svelte +2 -2
- package/components/SchemaForm.svelte +14 -4
- package/components/SchemaForm.svelte.d.ts +1 -0
- package/components/ScriptBuilder.svelte +45 -22
- package/components/ScriptBuilder.svelte.d.ts +1 -0
- package/components/ScriptEditor.svelte +1 -0
- package/components/SharedBadge.svelte +5 -5
- package/components/Slider.svelte +14 -0
- package/components/Slider.svelte.d.ts +19 -0
- package/components/StringTypeNarrowing.svelte +0 -1
- package/components/SuperadminSettings.svelte +11 -3
- package/components/SuperadminSettings.svelte.d.ts +2 -0
- package/components/TemplateEditor.svelte.d.ts +204 -0
- package/components/TestJobLoader.svelte +3 -3
- package/components/Toggle.svelte +1 -2
- package/components/UserSettings.svelte +11 -3
- package/components/UserSettings.svelte.d.ts +2 -0
- package/components/VariableEditor.svelte +1 -1
- package/components/WhitelistIp.svelte +23 -0
- package/components/WhitelistIp.svelte.d.ts +14 -0
- package/components/apps/components/buttons/AppButton.svelte +52 -6
- package/components/apps/components/buttons/AppButton.svelte.d.ts +3 -0
- package/components/apps/components/{form → buttons}/AppForm.svelte +3 -1
- package/components/apps/components/buttons/AppFormButton.svelte +137 -0
- package/components/apps/components/buttons/AppFormButton.svelte.d.ts +25 -0
- package/components/apps/components/buttons/index.d.ts +3 -0
- package/components/apps/components/buttons/index.js +3 -0
- package/components/apps/components/{dataDisplay → display}/AppBarChart.svelte +15 -4
- package/components/apps/components/{dataDisplay → display}/AppBarChart.svelte.d.ts +1 -0
- package/components/apps/components/display/AppDisplayComponent.svelte +31 -0
- package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +23 -0
- package/components/apps/components/{dataDisplay → display}/AppHtml.svelte +6 -5
- package/components/apps/components/{dataDisplay → display}/AppHtml.svelte.d.ts +1 -1
- package/components/apps/components/display/AppIcon.svelte +35 -0
- package/components/apps/components/display/AppIcon.svelte.d.ts +22 -0
- package/components/apps/components/display/AppImage.svelte +27 -0
- package/components/apps/components/display/AppImage.svelte.d.ts +22 -0
- package/components/apps/components/{dataDisplay → display}/AppPieChart.svelte +2 -1
- package/components/apps/components/{dataDisplay → display}/AppPieChart.svelte.d.ts +1 -0
- package/components/apps/components/{dataDisplay → display}/AppScatterChart.svelte +2 -1
- package/components/apps/components/{dataDisplay → display}/AppScatterChart.svelte.d.ts +1 -0
- package/components/apps/components/{dataDisplay → display}/AppText.svelte +16 -14
- package/components/apps/components/{dataDisplay → display}/AppText.svelte.d.ts +3 -0
- package/components/apps/components/{dataDisplay → display}/AppTimeseries.svelte +3 -2
- package/components/apps/components/{dataDisplay → display}/AppTimeseries.svelte.d.ts +1 -0
- package/components/apps/components/display/PlotlyHtml.svelte +38 -0
- package/components/apps/components/display/PlotlyHtml.svelte.d.ts +24 -0
- package/components/apps/components/{dataDisplay → display}/VegaLiteHtml.svelte +2 -3
- package/components/apps/components/{dataDisplay → display}/VegaLiteHtml.svelte.d.ts +1 -0
- package/components/apps/components/display/index.d.ts +12 -0
- package/components/apps/components/display/index.js +12 -0
- package/components/apps/components/display/table/AppAggridTable.svelte +83 -0
- package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +24 -0
- package/components/apps/components/{table → display/table}/AppTable.svelte +32 -21
- package/components/apps/components/{table → display/table}/AppTable.svelte.d.ts +4 -2
- package/components/apps/components/{table → display/table}/AppTableFooter.svelte +1 -1
- package/components/apps/components/helpers/AlignWrapper.svelte +19 -19
- package/components/apps/components/helpers/AlignWrapper.svelte.d.ts +4 -2
- package/components/apps/components/helpers/HiddenComponent.svelte +22 -0
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +25 -0
- package/components/apps/components/helpers/InputDefaultValue.svelte +17 -0
- package/components/apps/components/helpers/InputDefaultValue.svelte.d.ts +17 -0
- package/components/apps/components/helpers/InputValue.svelte +5 -7
- package/components/apps/components/helpers/InputValue.svelte.d.ts +0 -1
- package/components/apps/components/helpers/RunnableComponent.svelte +37 -48
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +2 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte +7 -2
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +2 -1
- package/components/apps/components/helpers/index.d.ts +10 -0
- package/components/apps/components/helpers/index.js +10 -0
- package/components/apps/components/icon.d.ts +1 -0
- package/components/apps/components/icon.js +18 -0
- package/components/apps/components/index.d.ts +5 -0
- package/components/apps/components/index.js +5 -0
- package/components/apps/components/{selectInputs → inputs}/AppCheckbox.svelte +4 -2
- package/components/apps/components/{dateInputs → inputs}/AppDateInput.svelte +6 -0
- package/components/apps/components/inputs/AppFileInput.svelte +34 -0
- package/components/apps/components/inputs/AppFileInput.svelte.d.ts +20 -0
- package/components/apps/components/inputs/AppNumberInput.svelte +48 -0
- package/components/apps/components/inputs/AppRangeInput.svelte +44 -0
- package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +23 -0
- package/components/apps/components/inputs/AppSelect.svelte +90 -0
- package/components/apps/components/{selectInputs → inputs}/AppSelect.svelte.d.ts +2 -0
- package/components/apps/components/{numberInputs → inputs}/AppSliderInputs.svelte +13 -9
- package/components/apps/components/{textInputs → inputs}/AppTextInput.svelte +6 -0
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +49 -0
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +21 -0
- package/components/apps/components/inputs/currency/CurrencyInput.svelte +181 -0
- package/components/apps/components/inputs/currency/CurrencyInput.svelte.d.ts +32 -0
- package/components/apps/components/inputs/index.d.ts +9 -0
- package/components/apps/components/inputs/index.js +9 -0
- package/components/apps/components/layout/AppContainer.svelte +32 -0
- package/components/apps/components/layout/AppContainer.svelte.d.ts +21 -0
- package/components/apps/components/layout/AppDivider.svelte +20 -0
- package/components/apps/components/layout/AppDivider.svelte.d.ts +22 -0
- package/components/apps/components/layout/AppTabs.svelte +58 -0
- package/components/apps/components/layout/AppTabs.svelte.d.ts +24 -0
- package/components/apps/components/layout/index.d.ts +3 -0
- package/components/apps/components/layout/index.js +3 -0
- package/components/apps/editor/AppComponentInput.svelte +33 -0
- package/components/apps/editor/AppComponentInput.svelte.d.ts +18 -0
- package/components/apps/editor/AppComponentInputs.svelte +13 -0
- package/components/apps/editor/AppComponentInputs.svelte.d.ts +20 -0
- package/components/apps/editor/AppEditor.svelte +66 -31
- package/components/apps/editor/AppEditor.svelte.d.ts +1 -0
- package/components/apps/editor/AppEditorHeader.svelte +74 -18
- package/components/apps/editor/AppEditorHeader.svelte.d.ts +1 -0
- package/components/apps/editor/AppInputs.svelte +60 -0
- package/components/apps/editor/AppInputs.svelte.d.ts +14 -0
- package/components/apps/editor/AppPreview.svelte +11 -6
- package/components/apps/editor/ComponentHeader.svelte +40 -2
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -1
- package/components/apps/editor/GridEditor.svelte +75 -32
- package/components/apps/editor/GridEditor.svelte.d.ts +2 -0
- package/components/apps/editor/SettingsPanel.svelte +31 -3
- package/components/apps/editor/SubGridEditor.svelte +111 -0
- package/components/apps/editor/SubGridEditor.svelte.d.ts +24 -0
- package/components/apps/editor/TablePanel.svelte +2 -0
- package/components/apps/editor/TablePanel.svelte.d.ts +1 -1
- package/components/apps/editor/appUtils.d.ts +9 -0
- package/components/apps/editor/appUtils.js +141 -0
- package/components/apps/editor/component/Component.svelte +209 -0
- package/components/apps/editor/component/Component.svelte.d.ts +23 -0
- package/components/apps/editor/component/README.md +15 -0
- package/components/apps/editor/component/components.d.ts +65 -0
- package/components/apps/editor/component/components.js +1102 -0
- package/components/apps/editor/component/default-codes.d.ts +3 -0
- package/components/apps/editor/component/default-codes.js +322 -0
- package/components/apps/editor/component/index.d.ts +4 -0
- package/components/apps/editor/component/index.js +4 -0
- package/components/apps/editor/component/sets.d.ts +2 -0
- package/components/apps/editor/component/sets.js +47 -0
- package/components/apps/editor/componentsPanel/ComponentList.svelte +30 -106
- package/components/apps/editor/componentsPanel/CssProperty.svelte +31 -0
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +20 -0
- package/components/apps/editor/componentsPanel/CssSettings.svelte +141 -0
- package/components/apps/editor/componentsPanel/CssSettings.svelte.d.ts +14 -0
- package/components/apps/editor/componentsPanel/ListItem.svelte +28 -0
- package/components/apps/editor/componentsPanel/ListItem.svelte.d.ts +20 -0
- package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +4 -1
- package/components/apps/editor/componentsPanel/componentStaticValues.js +4 -1
- package/components/apps/editor/contextPanel/ContextPanel.svelte +8 -6
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +98 -9
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +38 -29
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +21 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +66 -8
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +92 -46
- package/components/apps/editor/inlineScriptsPanel/utils.d.ts +5 -1
- package/components/apps/editor/inlineScriptsPanel/utils.js +30 -0
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte.d.ts +1 -1
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +4 -1
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +59 -1
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +64 -34
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +5 -3
- package/components/apps/editor/settingsPanel/GridTab.svelte +73 -0
- package/components/apps/editor/settingsPanel/GridTab.svelte.d.ts +18 -0
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +3 -0
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +2 -2
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +92 -77
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/MoveToOtherGrid.svelte +85 -0
- package/components/apps/editor/settingsPanel/MoveToOtherGrid.svelte.d.ts +18 -0
- package/components/apps/editor/settingsPanel/Recompute.svelte +4 -1
- package/components/apps/editor/settingsPanel/TableActions.svelte +17 -6
- package/components/apps/editor/settingsPanel/TableActions.svelte.d.ts +2 -1
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte +5 -3
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +83 -0
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte.d.ts +19 -0
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +6 -1
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/inputEditor/UploadInputEditor.svelte +23 -0
- package/components/apps/editor/settingsPanel/inputEditor/UploadInputEditor.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +3 -20
- package/components/apps/gridUtils.d.ts +3 -1
- package/components/apps/gridUtils.js +5 -3
- package/components/apps/inputType.d.ts +33 -6
- package/components/apps/types.d.ts +35 -40
- package/components/apps/types.js +1 -1
- package/components/apps/utils.d.ts +6 -5
- package/components/apps/utils.js +90 -94
- package/components/common/button/Button.svelte +12 -5
- package/components/common/button/Button.svelte.d.ts +3 -1
- package/components/common/button/ButtonPopup.svelte.d.ts +1 -1
- package/components/common/button/model.d.ts +2 -2
- package/components/common/button/model.js +21 -6
- package/components/common/confirmationModal/ConfirmationModal.svelte +8 -1
- package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +4 -4
- package/components/common/drawer/Drawer.svelte +3 -1
- package/components/common/fileInput/FileInput.svelte +112 -0
- package/components/common/fileInput/FileInput.svelte.d.ts +27 -0
- package/components/common/index.d.ts +1 -0
- package/components/common/index.js +1 -0
- package/components/common/kbd/Kbd.svelte.d.ts +2 -2
- package/components/common/modal/Modal.svelte +74 -0
- package/components/common/modal/Modal.svelte.d.ts +22 -0
- package/components/common/popup/Popup.svelte +34 -17
- package/components/common/popup/Popup.svelte.d.ts +11 -4
- package/components/common/table/FlowRow.svelte +22 -3
- package/components/common/table/LanguageBadge.svelte +10 -4
- package/components/common/table/Row.svelte +1 -1
- package/components/common/table/ScriptRow.svelte +2 -2
- package/components/common/tabs/Tabs.svelte +9 -7
- package/components/common/tabs/Tabs.svelte.d.ts +3 -1
- package/components/flows/CreateActionsFlow.svelte +2 -3
- package/components/flows/content/BranchPredicateEditor.svelte +10 -8
- package/components/flows/content/FlowInputs.svelte +109 -99
- package/components/flows/content/FlowLoop.svelte +1 -1
- package/components/flows/content/FlowModuleComponent.svelte +3 -2
- package/components/flows/content/FlowRetries.svelte +8 -6
- package/components/flows/content/FlowSettings.svelte +72 -26
- package/components/flows/flowState.d.ts +1 -0
- package/components/flows/flowState.js +1 -0
- package/components/flows/flowStateUtils.js +4 -2
- package/components/flows/flowStore.d.ts +1 -0
- package/components/flows/flowStore.js +1 -0
- package/components/flows/map/FlowBranchAllMap.svelte +1 -1
- package/components/flows/map/FlowBranchOneMap.svelte +2 -2
- package/components/flows/map/FlowModuleSchemaItem.svelte +5 -5
- package/components/flows/map/FlowModuleSchemaMap.svelte +15 -8
- package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +1 -0
- package/components/flows/map/InsertModuleButton.svelte +24 -10
- package/components/flows/map/InsertModuleButton.svelte.d.ts +1 -0
- package/components/flows/map/MapItem.svelte +3 -1
- package/components/flows/utils.js +16 -10
- package/components/graph/FlowGraph.svelte +38 -15
- package/components/graph/FlowGraph.svelte.d.ts +1 -0
- package/components/icons/SquareIcon.svelte +9 -0
- package/components/icons/SquareIcon.svelte.d.ts +17 -0
- package/components/icons/index.d.ts +2 -0
- package/components/icons/index.js +2 -0
- package/components/jobs/JobDetail.svelte +29 -5
- package/components/propertyPicker/ObjectViewer.svelte +8 -5
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
- package/components/propertyPicker/PropPicker.svelte +8 -1
- package/components/propertyPicker/PropPickerResult.svelte +1 -1
- package/components/random_positive_adjetive.d.ts +1 -0
- package/components/random_positive_adjetive.js +961 -0
- package/components/scriptEditor/LogPanel.svelte +2 -1
- package/components/sidebar/SidebarContent.svelte +1 -1
- package/components/sidebar/UserMenu.svelte +46 -16
- package/components/sidebar/UserMenu.svelte.d.ts +0 -3
- package/components/sidebar/WorkspaceMenu.svelte +3 -1
- package/components/sidebar/settings.d.ts +2 -0
- package/components/sidebar/settings.js +2 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/models/CompletedJob.d.ts +1 -0
- package/gen/models/FlowModule.d.ts +0 -1
- package/gen/models/QueuedJob.d.ts +1 -0
- package/gen/models/WorkerPing.d.ts +1 -1
- package/gen/services/FlowService.d.ts +9 -0
- package/gen/services/FlowService.js +15 -0
- package/gen/services/JobService.d.ts +97 -15
- package/gen/services/JobService.js +74 -15
- package/gen/services/ScriptService.d.ts +10 -1
- package/gen/services/ScriptService.js +16 -1
- package/gen/services/VariableService.d.ts +4 -2
- package/gen/services/VariableService.js +8 -2
- package/gen/services/WorkspaceService.d.ts +17 -0
- package/gen/services/WorkspaceService.js +16 -0
- package/infer.js +3 -0
- package/init_scripts/python_failure_module.py +10 -0
- package/init_scripts/python_init_code.py +37 -0
- package/init_scripts/python_init_code_clear.py +5 -0
- package/init_scripts/python_init_code_trigger.py +14 -0
- package/logout.js +2 -1
- package/package.json +577 -522
- package/script_helpers.d.ts +6 -5
- package/script_helpers.js +7 -73
- package/stores.d.ts +5 -1
- package/stores.js +8 -1
- package/user.d.ts +1 -1
- package/user.js +14 -8
- package/utils.d.ts +1 -1
- package/utils.js +8 -7
- package/components/apps/components/DisplayComponent.svelte +0 -16
- package/components/apps/components/DisplayComponent.svelte.d.ts +0 -20
- package/components/apps/components/numberInputs/AppNumberInput.svelte +0 -33
- package/components/apps/components/selectInputs/AppSelect.svelte +0 -47
- package/components/apps/editor/ComponentEditor.svelte +0 -145
- package/components/apps/editor/ComponentEditor.svelte.d.ts +0 -23
- package/components/apps/editor/componentsPanel/data.d.ts +0 -3
- package/components/apps/editor/componentsPanel/data.js +0 -499
- package/components/apps/editorUtils.d.ts +0 -1
- package/components/apps/editorUtils.js +0 -292
- /package/components/apps/components/{form → buttons}/AppForm.svelte.d.ts +0 -0
- /package/components/apps/components/{table → display/table}/AppTableFooter.svelte.d.ts +0 -0
- /package/components/apps/components/{table → display/table}/tableOptions.d.ts +0 -0
- /package/components/apps/components/{table → display/table}/tableOptions.js +0 -0
- /package/components/apps/components/{selectInputs → inputs}/AppCheckbox.svelte.d.ts +0 -0
- /package/components/apps/components/{dateInputs → inputs}/AppDateInput.svelte.d.ts +0 -0
- /package/components/apps/components/{numberInputs → inputs}/AppNumberInput.svelte.d.ts +0 -0
- /package/components/apps/components/{numberInputs → inputs}/AppSliderInputs.svelte.d.ts +0 -0
- /package/components/apps/components/{textInputs → inputs}/AppTextInput.svelte.d.ts +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<script>import { Loader2 } from 'lucide-svelte';
|
|
2
|
-
import { parse } from 'path';
|
|
3
2
|
import { onMount } from 'svelte';
|
|
4
|
-
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
5
3
|
import InputValue from '../helpers/InputValue.svelte';
|
|
6
4
|
import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
|
|
7
5
|
export let id;
|
|
8
6
|
export let componentInput;
|
|
9
7
|
export let configuration;
|
|
8
|
+
export let initializing = undefined;
|
|
10
9
|
export const staticOutputs = ['result', 'loading'];
|
|
11
10
|
let result = undefined;
|
|
12
11
|
let divEl = null;
|
|
@@ -42,7 +41,7 @@ $: vegaEmbed &&
|
|
|
42
41
|
<InputValue {id} input={configuration.canvas} bind:value={canvas} />
|
|
43
42
|
|
|
44
43
|
<div class="w-full h-full" bind:clientHeight={h} bind:clientWidth={w}>
|
|
45
|
-
<RunnableWrapper flexWrap bind:componentInput {id} bind:result>
|
|
44
|
+
<RunnableWrapper flexWrap bind:componentInput {id} bind:initializing bind:result>
|
|
46
45
|
{#if !vegaEmbed}
|
|
47
46
|
<div class="p-2">
|
|
48
47
|
<Loader2 class="animate-spin" />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as AppTable } from './table/AppTable.svelte';
|
|
2
|
+
export { default as AppBarChart } from './AppBarChart.svelte';
|
|
3
|
+
export { default as AppDisplayComponent } from './AppDisplayComponent.svelte';
|
|
4
|
+
export { default as AppHtml } from './AppHtml.svelte';
|
|
5
|
+
export { default as AppIcon } from './AppIcon.svelte';
|
|
6
|
+
export { default as AppImage } from './AppImage.svelte';
|
|
7
|
+
export { default as AppPieChart } from './AppPieChart.svelte';
|
|
8
|
+
export { default as AppScatterChart } from './AppScatterChart.svelte';
|
|
9
|
+
export { default as AppText } from './AppText.svelte';
|
|
10
|
+
export { default as AppTimeseries } from './AppTimeseries.svelte';
|
|
11
|
+
export { default as PlotlyHtml } from './PlotlyHtml.svelte';
|
|
12
|
+
export { default as VegaLiteHtml } from './VegaLiteHtml.svelte';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as AppTable } from './table/AppTable.svelte';
|
|
2
|
+
export { default as AppBarChart } from './AppBarChart.svelte';
|
|
3
|
+
export { default as AppDisplayComponent } from './AppDisplayComponent.svelte';
|
|
4
|
+
export { default as AppHtml } from './AppHtml.svelte';
|
|
5
|
+
export { default as AppIcon } from './AppIcon.svelte';
|
|
6
|
+
export { default as AppImage } from './AppImage.svelte';
|
|
7
|
+
export { default as AppPieChart } from './AppPieChart.svelte';
|
|
8
|
+
export { default as AppScatterChart } from './AppScatterChart.svelte';
|
|
9
|
+
export { default as AppText } from './AppText.svelte';
|
|
10
|
+
export { default as AppTimeseries } from './AppTimeseries.svelte';
|
|
11
|
+
export { default as PlotlyHtml } from './PlotlyHtml.svelte';
|
|
12
|
+
export { default as VegaLiteHtml } from './VegaLiteHtml.svelte';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script>import AgGridSvelte from 'ag-grid-svelte/AgGridSvelte.svelte';
|
|
2
|
+
import 'ag-grid-community/styles/ag-grid.css';
|
|
3
|
+
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
|
4
|
+
import { getContext, onMount } from 'svelte';
|
|
5
|
+
import InputValue from '../../helpers/InputValue.svelte';
|
|
6
|
+
import RunnableWrapper from '../../helpers/RunnableWrapper.svelte';
|
|
7
|
+
import { isObject } from '../../../../../utils';
|
|
8
|
+
import Alert from '../../../../common/alert/Alert.svelte';
|
|
9
|
+
export let id;
|
|
10
|
+
export let componentInput;
|
|
11
|
+
export let configuration;
|
|
12
|
+
export let initializing = undefined;
|
|
13
|
+
export const staticOutputs = ['selectedRow', 'loading', 'result', 'selectedRowIndex'];
|
|
14
|
+
let result = undefined;
|
|
15
|
+
const { worldStore, staticOutputs: staticOutputsStore, selectedComponent } = getContext('AppEditorContext');
|
|
16
|
+
let selectedRowIndex = -1;
|
|
17
|
+
function toggleRow(row, rowIndex) {
|
|
18
|
+
if (selectedRowIndex !== rowIndex) {
|
|
19
|
+
selectedRowIndex = rowIndex;
|
|
20
|
+
outputs?.selectedRow.set(row.original);
|
|
21
|
+
outputs?.selectedRowIndex.set(rowIndex);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
let mounted = false;
|
|
25
|
+
onMount(() => {
|
|
26
|
+
mounted = true;
|
|
27
|
+
});
|
|
28
|
+
$: selectedRowIndex === -1 &&
|
|
29
|
+
Array.isArray(result) &&
|
|
30
|
+
result.length > 0 &&
|
|
31
|
+
// We need to wait until the component is mounted so the world is created
|
|
32
|
+
mounted &&
|
|
33
|
+
outputs &&
|
|
34
|
+
toggleRow({ original: result[0] }, 0);
|
|
35
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
36
|
+
$: outputs?.result?.set(result);
|
|
37
|
+
let clientHeight;
|
|
38
|
+
let clientWidth;
|
|
39
|
+
let columnDefs = undefined;
|
|
40
|
+
let allEditable = undefined;
|
|
41
|
+
function onCellValueChanged(event) {
|
|
42
|
+
if (result) {
|
|
43
|
+
let dataCell = event.newValue;
|
|
44
|
+
try {
|
|
45
|
+
dataCell = JSON.parse(dataCell);
|
|
46
|
+
}
|
|
47
|
+
catch (e) { }
|
|
48
|
+
result[event.node.rowIndex][event.column.colId] = dataCell;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<InputValue {id} input={configuration.columnDefs} bind:value={columnDefs} />
|
|
54
|
+
<InputValue {id} input={configuration.allEditable} bind:value={allEditable} />
|
|
55
|
+
|
|
56
|
+
<RunnableWrapper flexWrap bind:componentInput {id} bind:initializing bind:result>
|
|
57
|
+
{#if Array.isArray(result) && result.every(isObject)}
|
|
58
|
+
<div
|
|
59
|
+
class="border border-gray-300 shadow-sm divide-y divide-gray-300 flex flex-col h-full"
|
|
60
|
+
bind:clientHeight
|
|
61
|
+
bind:clientWidth
|
|
62
|
+
>
|
|
63
|
+
<div
|
|
64
|
+
on:pointerdown|stopPropagation={() => {
|
|
65
|
+
$selectedComponent = id
|
|
66
|
+
}}
|
|
67
|
+
style:height="{clientHeight}px"
|
|
68
|
+
style:width="{clientWidth}px"
|
|
69
|
+
class="ag-theme-alpine"
|
|
70
|
+
>
|
|
71
|
+
<AgGridSvelte
|
|
72
|
+
bind:rowData={result}
|
|
73
|
+
{columnDefs}
|
|
74
|
+
defaultColDef={{ flex: 1, editable: allEditable, onCellValueChanged }}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
{:else if result != undefined}
|
|
79
|
+
<Alert title="Parsing issues" type="error" size="xs">
|
|
80
|
+
The result should be an array of objects
|
|
81
|
+
</Alert>
|
|
82
|
+
{/if}
|
|
83
|
+
</RunnableWrapper>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import 'ag-grid-community/styles/ag-grid.css';
|
|
3
|
+
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
|
4
|
+
import type { AppInput } from '../../../inputType';
|
|
5
|
+
declare const __propDef: {
|
|
6
|
+
props: {
|
|
7
|
+
id: string;
|
|
8
|
+
componentInput: AppInput | undefined;
|
|
9
|
+
configuration: Record<string, AppInput>;
|
|
10
|
+
initializing?: boolean | undefined;
|
|
11
|
+
staticOutputs?: string[] | undefined;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
};
|
|
18
|
+
export type AppAggridTableProps = typeof __propDef.props;
|
|
19
|
+
export type AppAggridTableEvents = typeof __propDef.events;
|
|
20
|
+
export type AppAggridTableSlots = typeof __propDef.slots;
|
|
21
|
+
export default class AppAggridTable extends SvelteComponentTyped<AppAggridTableProps, AppAggridTableEvents, AppAggridTableSlots> {
|
|
22
|
+
get staticOutputs(): string[];
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
<script>import { getContext, onMount } from 'svelte';
|
|
2
|
-
import InputValue from '
|
|
3
|
-
import RunnableWrapper from '
|
|
2
|
+
import InputValue from '../../helpers/InputValue.svelte';
|
|
3
|
+
import RunnableWrapper from '../../helpers/RunnableWrapper.svelte';
|
|
4
4
|
import { writable } from 'svelte/store';
|
|
5
5
|
import { createSvelteTable, flexRender } from '@tanstack/svelte-table';
|
|
6
|
-
import AppButton from '
|
|
7
|
-
import { classNames, isObject } from '
|
|
8
|
-
import DebouncedInput from '
|
|
6
|
+
import AppButton from '../../buttons/AppButton.svelte';
|
|
7
|
+
import { classNames, isObject } from '../../../../../utils';
|
|
8
|
+
import DebouncedInput from '../../helpers/DebouncedInput.svelte';
|
|
9
9
|
import AppTableFooter from './AppTableFooter.svelte';
|
|
10
10
|
import { tableOptions } from './tableOptions';
|
|
11
|
-
import Alert from '
|
|
11
|
+
import Alert from '../../../../common/alert/Alert.svelte';
|
|
12
12
|
export let id;
|
|
13
13
|
export let componentInput;
|
|
14
14
|
export let configuration;
|
|
15
15
|
export let actionButtons;
|
|
16
|
-
export
|
|
16
|
+
export let initializing = undefined;
|
|
17
|
+
export const staticOutputs = [
|
|
18
|
+
'selectedRow',
|
|
19
|
+
'loading',
|
|
20
|
+
'result',
|
|
21
|
+
'search',
|
|
22
|
+
'selectedRowIndex'
|
|
23
|
+
];
|
|
17
24
|
let result = undefined;
|
|
18
25
|
let search = undefined;
|
|
19
26
|
let searchValue = '';
|
|
@@ -34,6 +41,7 @@ function toggleRow(row, rowIndex) {
|
|
|
34
41
|
if (selectedRowIndex !== rowIndex) {
|
|
35
42
|
selectedRowIndex = rowIndex;
|
|
36
43
|
outputs?.selectedRow.set(row.original);
|
|
44
|
+
outputs?.selectedRowIndex.set(rowIndex);
|
|
37
45
|
}
|
|
38
46
|
}
|
|
39
47
|
let mounted = false;
|
|
@@ -45,6 +53,7 @@ $: selectedRowIndex === -1 &&
|
|
|
45
53
|
result.length > 0 &&
|
|
46
54
|
// We need to wait until the component is mounted so the world is created
|
|
47
55
|
mounted &&
|
|
56
|
+
outputs &&
|
|
48
57
|
toggleRow({ original: result[0] }, 0);
|
|
49
58
|
function setOptions(filteredResult) {
|
|
50
59
|
if (!Array.isArray(result)) {
|
|
@@ -92,7 +101,7 @@ $: result && rerender();
|
|
|
92
101
|
|
|
93
102
|
<InputValue {id} input={configuration.search} bind:value={search} />
|
|
94
103
|
|
|
95
|
-
<RunnableWrapper flexWrap bind:componentInput {id} bind:result>
|
|
104
|
+
<RunnableWrapper flexWrap bind:componentInput {id} bind:initializing bind:result>
|
|
96
105
|
{#if Array.isArray(result) && result.every(isObject)}
|
|
97
106
|
<div class="border border-gray-300 shadow-sm divide-y divide-gray-300 flex flex-col h-full">
|
|
98
107
|
{#if search !== 'Disabled'}
|
|
@@ -167,19 +176,21 @@ $: result && rerender();
|
|
|
167
176
|
{/each}
|
|
168
177
|
|
|
169
178
|
{#if actionButtons.length > 0}
|
|
170
|
-
<td
|
|
171
|
-
class="
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
<td class="p-2 " on:click={() => toggleRow(row, rowIndex)}>
|
|
180
|
+
<div class="center-center h-full w-full flex-wrap gap-1">
|
|
181
|
+
{#each actionButtons as actionButton, actionIndex (actionIndex)}
|
|
182
|
+
<AppButton
|
|
183
|
+
noWFull
|
|
184
|
+
{...actionButton}
|
|
185
|
+
preclickAction={async () => {
|
|
186
|
+
toggleRow(row, rowIndex)
|
|
187
|
+
}}
|
|
188
|
+
extraQueryParams={{ row: row.original }}
|
|
189
|
+
bind:componentInput={actionButton.componentInput}
|
|
190
|
+
bind:staticOutputs={$staticOutputsStore[actionButton.id]}
|
|
191
|
+
/>
|
|
192
|
+
{/each}
|
|
193
|
+
</div>
|
|
183
194
|
</td>
|
|
184
195
|
{/if}
|
|
185
196
|
</tr>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { BaseAppComponent
|
|
3
|
-
import type { AppInput } from '
|
|
2
|
+
import type { BaseAppComponent } from '../../../types';
|
|
3
|
+
import type { AppInput } from '../../../inputType';
|
|
4
|
+
import type { ButtonComponent } from '../../../editor/component';
|
|
4
5
|
declare const __propDef: {
|
|
5
6
|
props: {
|
|
6
7
|
id: string;
|
|
7
8
|
componentInput: AppInput | undefined;
|
|
8
9
|
configuration: Record<string, AppInput>;
|
|
9
10
|
actionButtons: (BaseAppComponent & ButtonComponent)[];
|
|
11
|
+
initializing?: boolean | undefined;
|
|
10
12
|
staticOutputs?: string[] | undefined;
|
|
11
13
|
};
|
|
12
14
|
events: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import Button from '
|
|
1
|
+
<script>import Button from '../../../../common/button/Button.svelte';
|
|
2
2
|
import { faDownload } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import { ChevronLeft, ChevronRight } from 'lucide-svelte';
|
|
4
4
|
import { tableOptions } from './tableOptions';
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
export let horizontalAlignment = undefined;
|
|
3
3
|
export let verticalAlignment = undefined;
|
|
4
4
|
export let noWFull = false;
|
|
5
|
-
function tailwindHorizontalAlignment(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
function tailwindHorizontalAlignment(alignment) {
|
|
6
|
+
if (!alignment)
|
|
7
|
+
return '';
|
|
8
|
+
const classes = {
|
|
9
|
+
left: 'justify-start',
|
|
10
|
+
center: 'justify-center',
|
|
11
|
+
right: 'justify-end',
|
|
12
|
+
};
|
|
13
|
+
return classes[alignment];
|
|
14
14
|
}
|
|
15
|
-
function tailwindVerticalAlignment(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
function tailwindVerticalAlignment(alignment) {
|
|
16
|
+
if (!alignment)
|
|
17
|
+
return '';
|
|
18
|
+
const classes = {
|
|
19
|
+
top: 'items-start',
|
|
20
|
+
center: 'items-center',
|
|
21
|
+
bottom: 'items-end',
|
|
22
|
+
};
|
|
23
|
+
return classes[alignment];
|
|
24
24
|
}
|
|
25
|
-
$: classes = classNames('flex z-auto', noWFull ? '' : 'w-full', tailwindHorizontalAlignment(horizontalAlignment), tailwindVerticalAlignment(verticalAlignment), verticalAlignment ? 'h-full' : '');
|
|
25
|
+
$: classes = classNames('flex z-auto', noWFull ? '' : 'w-full', tailwindHorizontalAlignment(horizontalAlignment), tailwindVerticalAlignment(verticalAlignment), verticalAlignment ? 'h-full' : '', $$props.class || '');
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
<div class={classes}>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { HorizontalAlignment, VerticalAlignment } from '../../types';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
horizontalAlignment?: HorizontalAlignment | undefined;
|
|
7
|
+
verticalAlignment?: VerticalAlignment | undefined;
|
|
6
8
|
noWFull?: boolean | undefined;
|
|
7
9
|
};
|
|
8
10
|
events: {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script>import RunnableComponent from './RunnableComponent.svelte';
|
|
2
|
+
export let id;
|
|
3
|
+
export let name;
|
|
4
|
+
export let inlineScript;
|
|
5
|
+
export let fields;
|
|
6
|
+
let result = undefined;
|
|
7
|
+
export const staticOutputs = ['result', 'loading'];
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<RunnableComponent
|
|
11
|
+
{id}
|
|
12
|
+
bind:fields
|
|
13
|
+
bind:result
|
|
14
|
+
runnable={{
|
|
15
|
+
name,
|
|
16
|
+
inlineScript,
|
|
17
|
+
type: 'runnableByName'
|
|
18
|
+
}}
|
|
19
|
+
wrapperClass="hidden"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</RunnableComponent>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ConnectedAppInput, RowAppInput, StaticAppInput, UserAppInput } from '../../inputType';
|
|
3
|
+
import type { InlineScript } from '../../types';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
inlineScript: InlineScript | undefined;
|
|
9
|
+
fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
|
|
10
|
+
staticOutputs?: string[] | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type HiddenComponentProps = typeof __propDef.props;
|
|
20
|
+
export type HiddenComponentEvents = typeof __propDef.events;
|
|
21
|
+
export type HiddenComponentSlots = typeof __propDef.slots;
|
|
22
|
+
export default class HiddenComponent extends SvelteComponentTyped<HiddenComponentProps, HiddenComponentEvents, HiddenComponentSlots> {
|
|
23
|
+
get staticOutputs(): string[];
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>export let input = undefined;
|
|
2
|
+
export let defaultValue = undefined;
|
|
3
|
+
function setInputValueToDefaultValue() {
|
|
4
|
+
if (defaultValue !== undefined && input) {
|
|
5
|
+
input.value = String(defaultValue);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
function clearInputValue() {
|
|
9
|
+
if (input) {
|
|
10
|
+
input.value = '';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
$: input && defaultValue && setInputValueToDefaultValue();
|
|
14
|
+
$: input &&
|
|
15
|
+
(defaultValue === '' || defaultValue === undefined || defaultValue === null) &&
|
|
16
|
+
clearInputValue();
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
input?: HTMLInputElement | undefined;
|
|
5
|
+
defaultValue?: (string | number | boolean) | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type InputDefaultValueProps = typeof __propDef.props;
|
|
13
|
+
export type InputDefaultValueEvents = typeof __propDef.events;
|
|
14
|
+
export type InputDefaultValueSlots = typeof __propDef.slots;
|
|
15
|
+
export default class InputDefaultValue extends SvelteComponentTyped<InputDefaultValueProps, InputDefaultValueEvents, InputDefaultValueSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -4,26 +4,25 @@ import { accessPropertyByPath } from '../../utils';
|
|
|
4
4
|
export let input;
|
|
5
5
|
export let value;
|
|
6
6
|
export let id = undefined;
|
|
7
|
-
export let row = {};
|
|
8
7
|
export let error = '';
|
|
9
8
|
const { worldStore } = getContext('AppEditorContext');
|
|
10
9
|
$: state = $worldStore?.state;
|
|
11
|
-
$: input && $worldStore &&
|
|
10
|
+
$: input && $worldStore && handleConnection();
|
|
12
11
|
$: input && input.type == 'template' && $state && (value = getValue(input));
|
|
13
12
|
$: input && input.type == 'eval' && $state && (value = evalExpr(input));
|
|
14
13
|
function handleConnection() {
|
|
15
14
|
if (input.type === 'connected') {
|
|
16
15
|
$worldStore?.connect(input, onValueChange);
|
|
17
16
|
}
|
|
18
|
-
else if (input.type === 'row') {
|
|
19
|
-
setTimeout(() => (value = row?.[input['column']]), 0);
|
|
20
|
-
}
|
|
21
17
|
else if (input.type === 'static' || input.type == 'template') {
|
|
22
18
|
setTimeout(() => (value = getValue(input)), 0);
|
|
23
19
|
}
|
|
24
20
|
else if (input.type == 'eval') {
|
|
25
21
|
setTimeout(() => ((value = evalExpr(input)), 0));
|
|
26
22
|
}
|
|
23
|
+
else if (input.type == 'upload') {
|
|
24
|
+
setTimeout(() => ((value = input.value), 0));
|
|
25
|
+
}
|
|
27
26
|
else {
|
|
28
27
|
setTimeout(() => (value = undefined), 0);
|
|
29
28
|
}
|
|
@@ -47,8 +46,7 @@ function computeGlobalContext() {
|
|
|
47
46
|
key,
|
|
48
47
|
Object.fromEntries(Object.entries(value ?? {}).map((x) => [x[0], x[1].peak()]))
|
|
49
48
|
];
|
|
50
|
-
})
|
|
51
|
-
.concat(row ? [['row', row]] : []));
|
|
49
|
+
}));
|
|
52
50
|
}
|
|
53
51
|
export function getValue(input) {
|
|
54
52
|
if (input.type === 'template' && isCodeInjection(input.eval)) {
|
|
@@ -5,7 +5,6 @@ declare const __propDef: {
|
|
|
5
5
|
input: AppInput;
|
|
6
6
|
value: string | number | boolean | Record<string | number, any> | undefined;
|
|
7
7
|
id?: string | undefined;
|
|
8
|
-
row?: Record<string, any> | undefined;
|
|
9
8
|
error?: string | undefined;
|
|
10
9
|
getValue?: ((input: AppInput) => any) | undefined;
|
|
11
10
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { goto } from '$app/navigation';
|
|
2
|
+
import Alert from '../../../common/alert/Alert.svelte';
|
|
2
3
|
import SchemaForm from '../../../SchemaForm.svelte';
|
|
3
4
|
import TestJobLoader from '../../../TestJobLoader.svelte';
|
|
4
5
|
import { AppService } from '../../../../gen';
|
|
5
6
|
import { defaultIfEmptyString, emptySchema, sendUserToast } from '../../../../utils';
|
|
6
7
|
import { getContext, onMount } from 'svelte';
|
|
7
|
-
import {
|
|
8
|
+
import { computeFields } from '../../editor/inlineScriptsPanel/utils';
|
|
8
9
|
import InputValue from './InputValue.svelte';
|
|
9
10
|
import RefreshButton from './RefreshButton.svelte';
|
|
10
11
|
// Component props
|
|
@@ -15,11 +16,12 @@ export let extraQueryParams = {};
|
|
|
15
16
|
export let autoRefresh = true;
|
|
16
17
|
export let result = undefined;
|
|
17
18
|
export let forceSchemaDisplay = false;
|
|
18
|
-
export let noMinH = false;
|
|
19
19
|
export let defaultUserInput = false;
|
|
20
20
|
export let flexWrap = false;
|
|
21
21
|
export let wrapperClass = '';
|
|
22
|
-
|
|
22
|
+
export let initializing = undefined;
|
|
23
|
+
export let gotoUrl = undefined;
|
|
24
|
+
const { worldStore, runnableComponents, workspace, appPath, isEditor, jobs, noBackend, errorByComponent, mode } = getContext('AppEditorContext');
|
|
23
25
|
onMount(() => {
|
|
24
26
|
if (autoRefresh) {
|
|
25
27
|
$runnableComponents[id] = async () => {
|
|
@@ -76,7 +78,7 @@ async function loadSchemaAndInputsByName() {
|
|
|
76
78
|
// Inline scripts directly provide the schema
|
|
77
79
|
if (inlineScript) {
|
|
78
80
|
const newSchema = inlineScript.schema;
|
|
79
|
-
const newFields =
|
|
81
|
+
const newFields = computeFields(newSchema, defaultUserInput, fields);
|
|
80
82
|
if (JSON.stringify(newFields) !== JSON.stringify(fields)) {
|
|
81
83
|
setTimeout(() => {
|
|
82
84
|
fields = newFields;
|
|
@@ -85,35 +87,6 @@ async function loadSchemaAndInputsByName() {
|
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
|
-
// When the schema is loaded, we need to update the inputs spec
|
|
89
|
-
// in order to render the inputs the component panel
|
|
90
|
-
function reloadInputs(schema) {
|
|
91
|
-
let schemaCopy = JSON.parse(JSON.stringify(schema));
|
|
92
|
-
const result = {};
|
|
93
|
-
const newInputs = schemaToInputsSpec(schemaCopy, defaultUserInput);
|
|
94
|
-
if (!fields) {
|
|
95
|
-
return newInputs;
|
|
96
|
-
}
|
|
97
|
-
Object.keys(newInputs).forEach((key) => {
|
|
98
|
-
const newInput = newInputs[key];
|
|
99
|
-
const oldInput = fields[key];
|
|
100
|
-
// If the input is not present in the old inputs, add it
|
|
101
|
-
if (oldInput === undefined) {
|
|
102
|
-
result[key] = newInput;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
if (fieldTypeToTsType(newInput.fieldType) !== fieldTypeToTsType(oldInput.fieldType) ||
|
|
106
|
-
newInput.format !== oldInput.format ||
|
|
107
|
-
newInput.subFieldType !== oldInput.subFieldType) {
|
|
108
|
-
result[key] = newInput;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
result[key] = oldInput;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
return result;
|
|
116
|
-
}
|
|
117
90
|
$: schemaStripped = runnable && stripSchema(fields);
|
|
118
91
|
function stripSchema(inputs) {
|
|
119
92
|
let schema = runnable?.type == 'runnableByName' ? runnable.inlineScript?.schema : runnable?.schema;
|
|
@@ -200,16 +173,20 @@ export async function runComponent() {
|
|
|
200
173
|
await executeComponent();
|
|
201
174
|
}
|
|
202
175
|
let lastStartedAt = Date.now();
|
|
176
|
+
function recordError(error) {
|
|
177
|
+
if (testJob) {
|
|
178
|
+
$errorByComponent[testJob.id] = {
|
|
179
|
+
error: error,
|
|
180
|
+
componentId: id
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
$: result?.error && recordError(result.error);
|
|
203
185
|
</script>
|
|
204
186
|
|
|
205
187
|
{#each Object.entries(fields ?? {}) as [key, v]}
|
|
206
188
|
{#if v.type != 'static' && v.type != 'user'}
|
|
207
|
-
<InputValue
|
|
208
|
-
{id}
|
|
209
|
-
input={fields[key]}
|
|
210
|
-
bind:value={runnableInputValues[key]}
|
|
211
|
-
row={extraQueryParams['row'] ?? {}}
|
|
212
|
-
/>
|
|
189
|
+
<InputValue {id} input={fields[key]} bind:value={runnableInputValues[key]} />
|
|
213
190
|
{/if}
|
|
214
191
|
{/each}
|
|
215
192
|
|
|
@@ -222,6 +199,16 @@ let lastStartedAt = Date.now();
|
|
|
222
199
|
lastStartedAt = startedAt
|
|
223
200
|
outputs.result?.set(testJob?.result)
|
|
224
201
|
result = testJob.result
|
|
202
|
+
|
|
203
|
+
const previousJobId = Object.keys($errorByComponent).find(
|
|
204
|
+
(key) => $errorByComponent[key].componentId === id
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
if (previousJobId && !result?.error) {
|
|
208
|
+
delete $errorByComponent[previousJobId]
|
|
209
|
+
$errorByComponent = $errorByComponent
|
|
210
|
+
}
|
|
211
|
+
gotoUrl && gotoUrl != '' && result?.error == undefined && goto(gotoUrl)
|
|
225
212
|
}
|
|
226
213
|
}
|
|
227
214
|
}}
|
|
@@ -231,7 +218,7 @@ let lastStartedAt = Date.now();
|
|
|
231
218
|
/>
|
|
232
219
|
|
|
233
220
|
<div class="h-full flex relative flex-row flex-wrap {wrapperClass}">
|
|
234
|
-
{#if autoRefresh === true}
|
|
221
|
+
{#if !initializing && autoRefresh === true}
|
|
235
222
|
<div class="flex absolute top-1 right-1">
|
|
236
223
|
<RefreshButton componentId={id} />
|
|
237
224
|
</div>
|
|
@@ -253,19 +240,21 @@ let lastStartedAt = Date.now();
|
|
|
253
240
|
<Alert type="warning" size="xs" class="mt-2 px-1" title="Missing runnable">
|
|
254
241
|
Please select a runnable
|
|
255
242
|
</Alert>
|
|
256
|
-
{:else if result?.error}
|
|
243
|
+
{:else if result?.error && $mode === 'preview'}
|
|
257
244
|
<div class="p-2">
|
|
258
245
|
<Alert type="error" title="Error during execution">
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
class="
|
|
263
|
-
|
|
246
|
+
<div class="flex flex-col gap-2">
|
|
247
|
+
An error occured, please contact the app author.
|
|
248
|
+
<span class="font-semibold">Job id: {testJob?.id}</span>
|
|
249
|
+
<pre class=" whitespace-pre-wrap text-gray-900 bg-white border w-full p-4 text-xs"
|
|
250
|
+
>{JSON.stringify(result.error, null, 4)}
|
|
251
|
+
</pre>
|
|
252
|
+
</div>
|
|
264
253
|
</Alert>
|
|
265
254
|
<slot />
|
|
266
255
|
</div>
|
|
267
256
|
{:else}
|
|
268
|
-
<div class="block w-full h-full">
|
|
257
|
+
<div class="block grow w-full max-h-full">
|
|
269
258
|
<slot />
|
|
270
259
|
</div>
|
|
271
260
|
{/if}
|
|
@@ -9,10 +9,11 @@ declare const __propDef: {
|
|
|
9
9
|
autoRefresh?: boolean | undefined;
|
|
10
10
|
result?: any;
|
|
11
11
|
forceSchemaDisplay?: boolean | undefined;
|
|
12
|
-
noMinH?: boolean | undefined;
|
|
13
12
|
defaultUserInput?: boolean | undefined;
|
|
14
13
|
flexWrap?: boolean | undefined;
|
|
15
14
|
wrapperClass?: string | undefined;
|
|
15
|
+
initializing?: boolean | undefined;
|
|
16
|
+
gotoUrl?: string | undefined;
|
|
16
17
|
runComponent?: (() => Promise<void>) | undefined;
|
|
17
18
|
};
|
|
18
19
|
events: {
|