windmill-components 1.60.3 → 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 +4 -3
- 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 +25 -28
- 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/display/AppHtml.svelte +32 -0
- package/components/apps/components/{dataDisplay → display}/AppHtml.svelte.d.ts +1 -3
- 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/display/VegaLiteHtml.svelte +52 -0
- package/components/apps/components/{dataDisplay → display}/VegaLiteHtml.svelte.d.ts +3 -2
- 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 +44 -23
- 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 +32 -5
- package/components/apps/editor/AppPreview.svelte.d.ts +2 -0
- 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 -105
- 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 -39
- package/components/apps/types.js +1 -1
- package/components/apps/utils.d.ts +6 -5
- package/components/apps/utils.js +90 -90
- 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/CapturePayload.svelte +3 -3
- 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/dataDisplay/AppHtml.svelte +0 -35
- package/components/apps/components/dataDisplay/VegaLiteHtml.svelte +0 -28
- 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 -138
- 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 -465
- package/components/apps/editorUtils.d.ts +0 -1
- package/components/apps/editorUtils.js +0 -253
- /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,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: {
|
|
@@ -5,7 +5,7 @@ import RunnableComponent from './RunnableComponent.svelte';
|
|
|
5
5
|
export let componentInput;
|
|
6
6
|
export let id;
|
|
7
7
|
export let result = undefined;
|
|
8
|
-
export let
|
|
8
|
+
export let initializing = true;
|
|
9
9
|
export let extraQueryParams = {};
|
|
10
10
|
export let autoRefresh = true;
|
|
11
11
|
export let runnableComponent = undefined;
|
|
@@ -13,7 +13,11 @@ export let forceSchemaDisplay = false;
|
|
|
13
13
|
export let defaultUserInput = false;
|
|
14
14
|
export let flexWrap = false;
|
|
15
15
|
export let runnableClass = '';
|
|
16
|
+
export let goto = undefined;
|
|
16
17
|
const { staticExporter, noBackend } = getContext('AppEditorContext');
|
|
18
|
+
$: if (initializing && result) {
|
|
19
|
+
initializing = false;
|
|
20
|
+
}
|
|
17
21
|
if (noBackend && componentInput?.type == 'runnable') {
|
|
18
22
|
result = componentInput?.['value'];
|
|
19
23
|
}
|
|
@@ -29,6 +33,7 @@ function isRunnableDefined() {
|
|
|
29
33
|
<slot />
|
|
30
34
|
{:else if componentInput.type === 'runnable' && isRunnableDefined()}
|
|
31
35
|
<RunnableComponent
|
|
36
|
+
gotoUrl={goto}
|
|
32
37
|
{flexWrap}
|
|
33
38
|
{defaultUserInput}
|
|
34
39
|
bind:this={runnableComponent}
|
|
@@ -39,7 +44,7 @@ function isRunnableDefined() {
|
|
|
39
44
|
{id}
|
|
40
45
|
{extraQueryParams}
|
|
41
46
|
{forceSchemaDisplay}
|
|
42
|
-
{
|
|
47
|
+
{initializing}
|
|
43
48
|
wrapperClass={runnableClass}
|
|
44
49
|
>
|
|
45
50
|
<slot />
|
|
@@ -6,7 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
componentInput: AppInput | undefined;
|
|
7
7
|
id: string;
|
|
8
8
|
result?: any;
|
|
9
|
-
|
|
9
|
+
initializing?: boolean | undefined;
|
|
10
10
|
extraQueryParams?: Record<string, any> | undefined;
|
|
11
11
|
autoRefresh?: boolean | undefined;
|
|
12
12
|
runnableComponent?: RunnableComponent | undefined;
|
|
@@ -14,6 +14,7 @@ declare const __propDef: {
|
|
|
14
14
|
defaultUserInput?: boolean | undefined;
|
|
15
15
|
flexWrap?: boolean | undefined;
|
|
16
16
|
runnableClass?: string | undefined;
|
|
17
|
+
goto?: string | undefined;
|
|
17
18
|
};
|
|
18
19
|
events: {
|
|
19
20
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as AlignWrapper } from './AlignWrapper.svelte';
|
|
2
|
+
export { default as DebouncedInput } from './DebouncedInput.svelte';
|
|
3
|
+
export { default as HiddenComponent } from './HiddenComponent.svelte';
|
|
4
|
+
export { default as InputDefaultValue } from './InputDefaultValue.svelte';
|
|
5
|
+
export { default as InputValue } from './InputValue.svelte';
|
|
6
|
+
export { default as MissingConnectionWarning } from './MissingConnectionWarning.svelte';
|
|
7
|
+
export { default as NonRunnableComponent } from './NonRunnableComponent.svelte';
|
|
8
|
+
export { default as RefreshButton } from './RefreshButton.svelte';
|
|
9
|
+
export { default as RunnableComponent } from './RunnableComponent.svelte';
|
|
10
|
+
export { default as RunnableWrapper } from './RunnableWrapper.svelte';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as AlignWrapper } from './AlignWrapper.svelte';
|
|
2
|
+
export { default as DebouncedInput } from './DebouncedInput.svelte';
|
|
3
|
+
export { default as HiddenComponent } from './HiddenComponent.svelte';
|
|
4
|
+
export { default as InputDefaultValue } from './InputDefaultValue.svelte';
|
|
5
|
+
export { default as InputValue } from './InputValue.svelte';
|
|
6
|
+
export { default as MissingConnectionWarning } from './MissingConnectionWarning.svelte';
|
|
7
|
+
export { default as NonRunnableComponent } from './NonRunnableComponent.svelte';
|
|
8
|
+
export { default as RefreshButton } from './RefreshButton.svelte';
|
|
9
|
+
export { default as RunnableComponent } from './RunnableComponent.svelte';
|
|
10
|
+
export { default as RunnableWrapper } from './RunnableWrapper.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadIcon(name: string): Promise<any>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { toKebabCase } from '../utils';
|
|
2
|
+
export async function loadIcon(name) {
|
|
3
|
+
let iconComponent;
|
|
4
|
+
try {
|
|
5
|
+
if (name) {
|
|
6
|
+
name = toKebabCase(name).replace(/([a-z])(\d)/i, '$1-$2');
|
|
7
|
+
iconComponent = (await import(`../../../../../node_modules/lucide-svelte/dist/svelte/icons/${name}.svelte`)).default;
|
|
8
|
+
return iconComponent;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
iconComponent = undefined;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error(error);
|
|
16
|
+
iconComponent = undefined;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -8,14 +8,16 @@ export let horizontalAlignment = undefined;
|
|
|
8
8
|
export let verticalAlignment = undefined;
|
|
9
9
|
const { worldStore } = getContext('AppEditorContext');
|
|
10
10
|
export const staticOutputs = ['result'];
|
|
11
|
+
let defaultValue = undefined;
|
|
11
12
|
let labelValue = 'Default label';
|
|
12
|
-
let value = false;
|
|
13
13
|
// As the checkbox is a special case and has no input
|
|
14
14
|
// we need to manually set the output
|
|
15
15
|
$: outputs = $worldStore?.outputsById[id];
|
|
16
|
+
$: defaultValue != undefined && outputs?.result.set(defaultValue);
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
19
|
<InputValue {id} input={configuration.label} bind:value={labelValue} />
|
|
20
|
+
<InputValue {id} input={configuration.defaultValue} bind:value={defaultValue} />
|
|
19
21
|
|
|
20
22
|
<AlignWrapper {horizontalAlignment} {verticalAlignment}>
|
|
21
23
|
<Toggle
|
|
@@ -23,7 +25,7 @@ $: outputs = $worldStore?.outputsById[id];
|
|
|
23
25
|
e?.stopPropagation()
|
|
24
26
|
window.dispatchEvent(new Event('pointerup'))
|
|
25
27
|
}}
|
|
26
|
-
|
|
28
|
+
checked={defaultValue}
|
|
27
29
|
options={{ right: labelValue }}
|
|
28
30
|
on:change={(e) => {
|
|
29
31
|
outputs.result.set(e.detail)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
2
|
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
3
|
+
import InputDefaultValue from '../helpers/InputDefaultValue.svelte';
|
|
3
4
|
import InputValue from '../helpers/InputValue.svelte';
|
|
4
5
|
export let id;
|
|
5
6
|
export let configuration;
|
|
@@ -11,15 +12,20 @@ let input;
|
|
|
11
12
|
let labelValue = 'Title';
|
|
12
13
|
let minValue = '';
|
|
13
14
|
let maxValue = '';
|
|
15
|
+
let defaultValue = undefined;
|
|
14
16
|
$: outputs = $worldStore?.outputsById[id];
|
|
15
17
|
function handleInput() {
|
|
16
18
|
outputs?.result.set(input.value);
|
|
17
19
|
}
|
|
20
|
+
$: input && handleInput();
|
|
18
21
|
</script>
|
|
19
22
|
|
|
20
23
|
<InputValue {id} input={configuration.label} bind:value={labelValue} />
|
|
21
24
|
<InputValue {id} input={configuration.minDate} bind:value={minValue} />
|
|
22
25
|
<InputValue {id} input={configuration.maxDate} bind:value={maxValue} />
|
|
26
|
+
<InputValue {id} input={configuration.defaultValue} bind:value={defaultValue} />
|
|
27
|
+
|
|
28
|
+
<InputDefaultValue bind:input {defaultValue} />
|
|
23
29
|
|
|
24
30
|
<AlignWrapper {verticalAlignment}>
|
|
25
31
|
<input
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import { FileInput } from '../../../common';
|
|
3
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
4
|
+
export let id;
|
|
5
|
+
export let configuration;
|
|
6
|
+
export const staticOutputs = ['result'];
|
|
7
|
+
const { worldStore } = getContext('AppEditorContext');
|
|
8
|
+
let acceptedFileTypes = undefined;
|
|
9
|
+
let allowMultiple = undefined;
|
|
10
|
+
let text = undefined;
|
|
11
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
12
|
+
// Receives Base64 encoded strings from the input component
|
|
13
|
+
async function handleChange(files) {
|
|
14
|
+
outputs?.result.set(files);
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<InputValue {id} input={configuration.acceptedFileTypes} bind:value={acceptedFileTypes} />
|
|
19
|
+
<InputValue {id} input={configuration.allowMultiple} bind:value={allowMultiple} />
|
|
20
|
+
<InputValue {id} input={configuration.text} bind:value={text} />
|
|
21
|
+
|
|
22
|
+
<div class="w-full h-full p-1">
|
|
23
|
+
<FileInput
|
|
24
|
+
accept={acceptedFileTypes?.length ? acceptedFileTypes?.join(', ') : undefined}
|
|
25
|
+
multiple={allowMultiple}
|
|
26
|
+
convertToBase64
|
|
27
|
+
on:change={({ detail }) => {
|
|
28
|
+
handleChange(detail)
|
|
29
|
+
}}
|
|
30
|
+
class="w-full h-full"
|
|
31
|
+
>
|
|
32
|
+
{text}
|
|
33
|
+
</FileInput>
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { AppInput } from '../../inputType';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
id: string;
|
|
6
|
+
configuration: Record<string, AppInput>;
|
|
7
|
+
staticOutputs?: string[] | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type AppFileInputProps = typeof __propDef.props;
|
|
15
|
+
export type AppFileInputEvents = typeof __propDef.events;
|
|
16
|
+
export type AppFileInputSlots = typeof __propDef.slots;
|
|
17
|
+
export default class AppFileInput extends SvelteComponentTyped<AppFileInputProps, AppFileInputEvents, AppFileInputSlots> {
|
|
18
|
+
get staticOutputs(): string[];
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
3
|
+
import InputDefaultValue from '../helpers/InputDefaultValue.svelte';
|
|
4
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
5
|
+
export let id;
|
|
6
|
+
export let configuration;
|
|
7
|
+
export let verticalAlignment = undefined;
|
|
8
|
+
export const staticOutputs = ['result'];
|
|
9
|
+
const { worldStore } = getContext('AppEditorContext');
|
|
10
|
+
let input;
|
|
11
|
+
let defaultValue = undefined;
|
|
12
|
+
let placeholder = undefined;
|
|
13
|
+
let min = undefined;
|
|
14
|
+
let max = undefined;
|
|
15
|
+
let step = 1;
|
|
16
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
17
|
+
function handleInput() {
|
|
18
|
+
const value = input?.value;
|
|
19
|
+
const num = isNaN(+value) ? null : +value;
|
|
20
|
+
outputs?.result.set(num);
|
|
21
|
+
}
|
|
22
|
+
$: input && handleInput();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<InputValue {id} input={configuration.step} bind:value={step} />
|
|
26
|
+
<InputValue {id} input={configuration.min} bind:value={min} />
|
|
27
|
+
<InputValue {id} input={configuration.max} bind:value={max} />
|
|
28
|
+
<InputValue {id} input={configuration.placeholder} bind:value={placeholder} />
|
|
29
|
+
<InputValue {id} input={configuration.defaultValue} bind:value={defaultValue} />
|
|
30
|
+
<InputDefaultValue bind:input {defaultValue} />
|
|
31
|
+
|
|
32
|
+
<AlignWrapper {verticalAlignment}>
|
|
33
|
+
<input
|
|
34
|
+
bind:this={input}
|
|
35
|
+
on:input={handleInput}
|
|
36
|
+
on:focus={(e) => {
|
|
37
|
+
e?.stopPropagation()
|
|
38
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
39
|
+
}}
|
|
40
|
+
{min}
|
|
41
|
+
{max}
|
|
42
|
+
{step}
|
|
43
|
+
type="number"
|
|
44
|
+
inputmode="numeric"
|
|
45
|
+
pattern="\d*"
|
|
46
|
+
{placeholder}
|
|
47
|
+
/>
|
|
48
|
+
</AlignWrapper>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script>import RangeSlider from 'svelte-range-slider-pips';
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
4
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
5
|
+
import { Badge } from '../../../common';
|
|
6
|
+
export let id;
|
|
7
|
+
export let configuration;
|
|
8
|
+
export let verticalAlignment = undefined;
|
|
9
|
+
export const staticOutputs = ['result'];
|
|
10
|
+
const { worldStore } = getContext('AppEditorContext');
|
|
11
|
+
let min = 0;
|
|
12
|
+
let max = 42;
|
|
13
|
+
let step = 1;
|
|
14
|
+
let values = [0, 0];
|
|
15
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
16
|
+
$: outputs?.result.set(values);
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<InputValue {id} input={configuration.step} bind:value={step} />
|
|
20
|
+
<InputValue {id} input={configuration.min} bind:value={min} />
|
|
21
|
+
<InputValue {id} input={configuration.max} bind:value={max} />
|
|
22
|
+
<InputValue {id} input={configuration.defaultLow} bind:value={values[0]} />
|
|
23
|
+
<InputValue {id} input={configuration.defaultHigh} bind:value={values[1]} />
|
|
24
|
+
|
|
25
|
+
<AlignWrapper {verticalAlignment}>
|
|
26
|
+
<div class="flex flex-col w-full">
|
|
27
|
+
<div class="flex items-center w-full gap-1 px-1">
|
|
28
|
+
<span>{min}</span>
|
|
29
|
+
<div class="grow" on:pointerdown|stopPropagation>
|
|
30
|
+
<RangeSlider {step} range min={min ?? 0} max={max ?? 1} bind:values />
|
|
31
|
+
<!-- <DoubleRange bind:start bind:end /> -->
|
|
32
|
+
</div>
|
|
33
|
+
<span>{max}</span>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="flex justify-between px-1">
|
|
36
|
+
<div>
|
|
37
|
+
<Badge color="blue">{values[0]}</Badge>
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
<Badge color="blue">{values[1]}</Badge>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</AlignWrapper>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { AppInput } from '../../inputType';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
id: string;
|
|
6
|
+
configuration: Record<string, AppInput>;
|
|
7
|
+
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
8
|
+
staticOutputs?: string[] | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
pointerdown: PointerEvent;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type AppRangeInputProps = typeof __propDef.props;
|
|
18
|
+
export type AppRangeInputEvents = typeof __propDef.events;
|
|
19
|
+
export type AppRangeInputSlots = typeof __propDef.slots;
|
|
20
|
+
export default class AppRangeInput extends SvelteComponentTyped<AppRangeInputProps, AppRangeInputEvents, AppRangeInputSlots> {
|
|
21
|
+
get staticOutputs(): string[];
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import Select from 'svelte-select';
|
|
3
|
+
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
4
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
5
|
+
export const staticOutputs = ['result'];
|
|
6
|
+
export let id;
|
|
7
|
+
export let configuration;
|
|
8
|
+
export let horizontalAlignment = undefined;
|
|
9
|
+
export let verticalAlignment = undefined;
|
|
10
|
+
const { worldStore, connectingInput, selectedComponent } = getContext('AppEditorContext');
|
|
11
|
+
let items;
|
|
12
|
+
let multiple = false;
|
|
13
|
+
let placeholder = 'Select an item';
|
|
14
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
15
|
+
// $: outputs && handleOutputs()
|
|
16
|
+
// function handleOutputs() {
|
|
17
|
+
// value = outputs.result.peak()
|
|
18
|
+
// }
|
|
19
|
+
let value = outputs?.result.peak();
|
|
20
|
+
$: items && handleItems();
|
|
21
|
+
let listItems = [];
|
|
22
|
+
function handleItems() {
|
|
23
|
+
listItems = Array.isArray(items)
|
|
24
|
+
? items.map((item) => {
|
|
25
|
+
return {
|
|
26
|
+
label: item.label,
|
|
27
|
+
value: JSON.stringify(item.value)
|
|
28
|
+
};
|
|
29
|
+
})
|
|
30
|
+
: [];
|
|
31
|
+
const valuePeak = outputs?.result.peak();
|
|
32
|
+
if (!valuePeak) {
|
|
33
|
+
const value0 = items?.[0]?.['value'];
|
|
34
|
+
if (value0 != value && !items.includes(value0)) {
|
|
35
|
+
value = JSON.stringify(value0);
|
|
36
|
+
outputs?.result.set(value0);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
value = valuePeak;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function onChange(e) {
|
|
44
|
+
e?.stopPropagation();
|
|
45
|
+
window.dispatchEvent(new Event('pointerup'));
|
|
46
|
+
let result = undefined;
|
|
47
|
+
try {
|
|
48
|
+
result = JSON.parse(e.detail?.['value']);
|
|
49
|
+
}
|
|
50
|
+
catch (_) { }
|
|
51
|
+
outputs?.result.set(result);
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<InputValue {id} input={configuration.items} bind:value={items} />
|
|
56
|
+
<InputValue {id} input={configuration.multiple} bind:value={multiple} />
|
|
57
|
+
<InputValue {id} input={configuration.placeholder} bind:value={placeholder} />
|
|
58
|
+
|
|
59
|
+
<AlignWrapper {horizontalAlignment} {verticalAlignment}>
|
|
60
|
+
<div class="app-select w-full" style="height: 34px" on:pointerdown|stopPropagation>
|
|
61
|
+
<Select
|
|
62
|
+
--height="34px"
|
|
63
|
+
{multiple}
|
|
64
|
+
on:clear={onChange}
|
|
65
|
+
on:change={onChange}
|
|
66
|
+
items={listItems}
|
|
67
|
+
{value}
|
|
68
|
+
{placeholder}
|
|
69
|
+
on:click={() => {
|
|
70
|
+
if (!$connectingInput.opened) {
|
|
71
|
+
$selectedComponent = id
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
on:focus={() => {
|
|
75
|
+
$selectedComponent = id
|
|
76
|
+
}}
|
|
77
|
+
floatingConfig={{
|
|
78
|
+
strategy: 'fixed'
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
</AlignWrapper>
|
|
83
|
+
|
|
84
|
+
<style global>
|
|
85
|
+
:global(.app-select) :global(.value-container) {
|
|
86
|
+
padding: 0 !important;
|
|
87
|
+
}
|
|
88
|
+
:global(.svelte-select-list) {
|
|
89
|
+
z-index: 1000 !important;
|
|
90
|
+
}</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { Badge } from '../../../common';
|
|
2
|
-
import
|
|
2
|
+
import RangeSlider from 'svelte-range-slider-pips';
|
|
3
3
|
import { getContext } from 'svelte';
|
|
4
4
|
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
5
5
|
import InputValue from '../helpers/InputValue.svelte';
|
|
@@ -7,31 +7,35 @@ export let id;
|
|
|
7
7
|
export let configuration;
|
|
8
8
|
export let verticalAlignment = undefined;
|
|
9
9
|
export const staticOutputs = ['result'];
|
|
10
|
-
const { worldStore } = getContext('AppEditorContext');
|
|
11
|
-
let value;
|
|
10
|
+
const { worldStore, selectedComponent } = getContext('AppEditorContext');
|
|
12
11
|
let min = 0;
|
|
13
12
|
let max = 42;
|
|
13
|
+
let step = 1;
|
|
14
14
|
$: outputs = $worldStore?.outputsById[id];
|
|
15
|
-
|
|
15
|
+
let values = [outputs?.result.peak() ?? 0];
|
|
16
|
+
$: values && handleValues();
|
|
17
|
+
function handleValues() {
|
|
16
18
|
// Disallow 'e' character in numbers
|
|
17
19
|
// if(value && value.toString().includes('e')) {
|
|
18
20
|
// value = +value.toString().replaceAll('e', '')
|
|
19
21
|
// }
|
|
20
|
-
const num = isNaN(+
|
|
22
|
+
const num = isNaN(+values[0]) ? null : +values[0];
|
|
21
23
|
outputs?.result.set(num);
|
|
22
24
|
}
|
|
23
25
|
</script>
|
|
24
26
|
|
|
27
|
+
<InputValue {id} input={configuration.step} bind:value={step} />
|
|
25
28
|
<InputValue {id} input={configuration.min} bind:value={min} />
|
|
26
29
|
<InputValue {id} input={configuration.max} bind:value={max} />
|
|
30
|
+
<InputValue {id} input={configuration.defaultValue} bind:value={values[0]} />
|
|
27
31
|
|
|
28
32
|
<AlignWrapper {verticalAlignment}>
|
|
29
|
-
<div class="flex w-full gap-1 px-1">
|
|
33
|
+
<div class="flex items-center w-full gap-1 px-1">
|
|
30
34
|
<span>{min}</span>
|
|
31
|
-
<div class="grow
|
|
32
|
-
<
|
|
35
|
+
<div class="grow" on:pointerdown|stopPropagation={() => ($selectedComponent = id)}>
|
|
36
|
+
<RangeSlider {step} min={min ?? 0} max={max ?? 1} bind:values />
|
|
33
37
|
</div>
|
|
34
38
|
<span>{max}</span>
|
|
35
|
-
<span class="mx-2"><Badge large color="blue">{
|
|
39
|
+
<span class="mx-2"><Badge large color="blue">{values[0]}</Badge></span>
|
|
36
40
|
</div>
|
|
37
41
|
</AlignWrapper>
|