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,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;
|
|
@@ -9,16 +10,21 @@ export const staticOutputs = ['result'];
|
|
|
9
10
|
const { worldStore } = getContext('AppEditorContext');
|
|
10
11
|
let input;
|
|
11
12
|
let placeholder = undefined;
|
|
13
|
+
let defaultValue = undefined;
|
|
12
14
|
$: outputs = $worldStore?.outputsById[id];
|
|
13
15
|
function handleInput() {
|
|
14
16
|
outputs?.result.set(input.value);
|
|
15
17
|
}
|
|
18
|
+
$: input && handleInput();
|
|
16
19
|
</script>
|
|
17
20
|
|
|
18
21
|
<InputValue {id} input={configuration.placeholder} bind:value={placeholder} />
|
|
22
|
+
<InputValue {id} input={configuration.defaultValue} bind:value={defaultValue} />
|
|
23
|
+
<InputDefaultValue bind:input {defaultValue} />
|
|
19
24
|
|
|
20
25
|
<AlignWrapper {verticalAlignment}>
|
|
21
26
|
<input
|
|
27
|
+
class="mx-0.5"
|
|
22
28
|
on:focus={(e) => {
|
|
23
29
|
e?.stopPropagation()
|
|
24
30
|
window.dispatchEvent(new Event('pointerup'))
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import AlignWrapper from '../../helpers/AlignWrapper.svelte';
|
|
3
|
+
import InputValue from '../../helpers/InputValue.svelte';
|
|
4
|
+
import CurrencyInput from './CurrencyInput.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 defaultValue = undefined;
|
|
11
|
+
let isNegativeAllowed = undefined;
|
|
12
|
+
let currency = undefined;
|
|
13
|
+
let locale = undefined;
|
|
14
|
+
let value = undefined;
|
|
15
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
16
|
+
function handleInput() {
|
|
17
|
+
outputs?.result.set(value ?? null);
|
|
18
|
+
}
|
|
19
|
+
function handleDefault() {
|
|
20
|
+
value = defaultValue;
|
|
21
|
+
handleInput();
|
|
22
|
+
}
|
|
23
|
+
$: value != undefined && handleInput();
|
|
24
|
+
$: defaultValue != undefined && handleDefault();
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<InputValue {id} input={configuration.defaultValue} bind:value={defaultValue} />
|
|
28
|
+
<InputValue {id} input={configuration.isNegativeAllowed} bind:value={isNegativeAllowed} />
|
|
29
|
+
<InputValue {id} input={configuration.currency} bind:value={currency} />
|
|
30
|
+
<InputValue {id} input={configuration.locale} bind:value={locale} />
|
|
31
|
+
|
|
32
|
+
<AlignWrapper {verticalAlignment}>
|
|
33
|
+
{#key isNegativeAllowed}
|
|
34
|
+
{#key locale}
|
|
35
|
+
{#key currency}
|
|
36
|
+
<CurrencyInput
|
|
37
|
+
inputClasses={{ formatted: 'p-0', wrapper: 'w-full', formattedZero: 'text-black' }}
|
|
38
|
+
bind:value
|
|
39
|
+
{currency}
|
|
40
|
+
{locale}
|
|
41
|
+
on:focus={(e) => {
|
|
42
|
+
e?.stopPropagation()
|
|
43
|
+
}}
|
|
44
|
+
{isNegativeAllowed}
|
|
45
|
+
/>
|
|
46
|
+
{/key}
|
|
47
|
+
{/key}
|
|
48
|
+
{/key}
|
|
49
|
+
</AlignWrapper>
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type AppCurrencyInputProps = typeof __propDef.props;
|
|
16
|
+
export type AppCurrencyInputEvents = typeof __propDef.events;
|
|
17
|
+
export type AppCurrencyInputSlots = typeof __propDef.slots;
|
|
18
|
+
export default class AppCurrencyInput extends SvelteComponentTyped<AppCurrencyInputProps, AppCurrencyInputEvents, AppCurrencyInputSlots> {
|
|
19
|
+
get staticOutputs(): string[];
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<script>/* Forked from MIT LICENSE
|
|
2
|
+
https://raw.githubusercontent.com/Canutin/svelte-currency-input/main/src/lib/CurrencyInput.svelte
|
|
3
|
+
*/
|
|
4
|
+
const DEFAULT_LOCALE = 'en-US';
|
|
5
|
+
const DEFAULT_CURRENCY = 'USD';
|
|
6
|
+
const DEFAULT_NAME = 'total';
|
|
7
|
+
const DEFAULT_VALUE = 0;
|
|
8
|
+
const DEFAULT_FRACTION_DIGITS = 2;
|
|
9
|
+
const DEFAULT_CLASS_WRAPPER = 'currencyInput';
|
|
10
|
+
const DEFAULT_CLASS_UNFORMATTED = 'currencyInput__unformatted';
|
|
11
|
+
const DEFAULT_CLASS_FORMATTED = 'currencyInput__formatted';
|
|
12
|
+
const DEFAULT_CLASS_FORMATTED_POSITIVE = 'currencyInput__formatted--positive';
|
|
13
|
+
const DEFAULT_CLASS_FORMATTED_NEGATIVE = 'currencyInput__formatted--negative';
|
|
14
|
+
const DEFAULT_CLASS_FORMATTED_ZERO = 'currencyInput__formatted--zero';
|
|
15
|
+
export let value = DEFAULT_VALUE;
|
|
16
|
+
export let locale = DEFAULT_LOCALE;
|
|
17
|
+
export let currency = DEFAULT_CURRENCY;
|
|
18
|
+
export let name = DEFAULT_NAME;
|
|
19
|
+
export let required = false;
|
|
20
|
+
export let disabled = false;
|
|
21
|
+
export let placeholder = DEFAULT_VALUE;
|
|
22
|
+
export let isNegativeAllowed = true;
|
|
23
|
+
export let fractionDigits = DEFAULT_FRACTION_DIGITS;
|
|
24
|
+
export let inputClasses = null;
|
|
25
|
+
// Formats value as: e.g. $1,523.00 | -$1,523.00
|
|
26
|
+
const formatCurrency = (value, maximumFractionDigits, minimumFractionDigits) => {
|
|
27
|
+
return new Intl.NumberFormat(locale, {
|
|
28
|
+
currency: currency,
|
|
29
|
+
style: 'currency',
|
|
30
|
+
maximumFractionDigits: maximumFractionDigits || 0,
|
|
31
|
+
minimumFractionDigits: minimumFractionDigits || 0
|
|
32
|
+
}).format(value);
|
|
33
|
+
};
|
|
34
|
+
// Checks if the key pressed is allowed
|
|
35
|
+
const handleKeyDown = (event) => {
|
|
36
|
+
const isDeletion = event.key === 'Backspace' || event.key === 'Delete';
|
|
37
|
+
const isModifier = event.metaKey || event.altKey || event.ctrlKey;
|
|
38
|
+
const isArrowKey = event.key === 'ArrowLeft' || event.key === 'ArrowRight';
|
|
39
|
+
const isTab = event.key === 'Tab';
|
|
40
|
+
const isInvalidCharacter = !/^\d|,|\.|-$/g.test(event.key); // Keys that are not a digit, comma, period or minus sign
|
|
41
|
+
if (!isDeletion && !isModifier && !isArrowKey && isInvalidCharacter && !isTab)
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
};
|
|
44
|
+
let inputTarget;
|
|
45
|
+
const currencyDecimal = new Intl.NumberFormat(locale).format(1.1).charAt(1); // '.' or ','
|
|
46
|
+
const isDecimalComma = currencyDecimal === ',';
|
|
47
|
+
const currencySymbol = formatCurrency(0, 0)
|
|
48
|
+
.replace('0', '') // e.g. '$0' > '$'
|
|
49
|
+
.replace(/\u00A0/, ''); // e.g '0 €' > '€'
|
|
50
|
+
// Updates `value` by stripping away the currency formatting
|
|
51
|
+
const setUnformattedValue = (event) => {
|
|
52
|
+
if (event) {
|
|
53
|
+
// Don't format if the user is typing a `currencyDecimal` point
|
|
54
|
+
if (event.key === currencyDecimal)
|
|
55
|
+
return;
|
|
56
|
+
// Pressing `.` when the decimal point is `,` gets replaced with `,`
|
|
57
|
+
if (isDecimalComma && event.key === '.')
|
|
58
|
+
formattedValue = formattedValue.replace(/\.([^.]*)$/, currencyDecimal + '$1'); // Only replace the last occurence
|
|
59
|
+
// Pressing `,` when the decimal point is `.` gets replaced with `.`
|
|
60
|
+
if (!isDecimalComma && event.key === ',')
|
|
61
|
+
formattedValue = formattedValue.replace(/\,([^,]*)$/, currencyDecimal + '$1'); // Only replace the last occurence
|
|
62
|
+
// Don't format if `formattedValue` is ['$', '-$', "-"]
|
|
63
|
+
const ignoreSymbols = [currencySymbol, `-${currencySymbol}`, '-'];
|
|
64
|
+
const strippedUnformattedValue = formattedValue.replace(' ', '');
|
|
65
|
+
if (ignoreSymbols.includes(strippedUnformattedValue))
|
|
66
|
+
return;
|
|
67
|
+
// Set the starting caret positions
|
|
68
|
+
inputTarget = event.target;
|
|
69
|
+
// Reverse the value when minus is pressed
|
|
70
|
+
if (isNegativeAllowed && event.key === '-')
|
|
71
|
+
value = value * -1;
|
|
72
|
+
}
|
|
73
|
+
// Remove all characters that arent: numbers, commas, periods (or minus signs if `isNegativeAllowed`)
|
|
74
|
+
let unformattedValue = isNegativeAllowed
|
|
75
|
+
? formattedValue.replace(/[^0-9,.-]/g, '')
|
|
76
|
+
: formattedValue.replace(/[^0-9,.]/g, '');
|
|
77
|
+
// Finally set the value
|
|
78
|
+
if (Number.isNaN(parseFloat(unformattedValue))) {
|
|
79
|
+
value = 0;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// The order of the following operations is *critical*
|
|
83
|
+
unformattedValue = unformattedValue.replace(isDecimalComma ? /\./g : /\,/g, ''); // Remove all group symbols
|
|
84
|
+
if (isDecimalComma)
|
|
85
|
+
unformattedValue = unformattedValue.replace(',', '.'); // If the decimal point is a comma, replace it with a period
|
|
86
|
+
// If the zero-key has been pressed
|
|
87
|
+
// and if the current `value` is the same as the `value` before the key-press
|
|
88
|
+
// formatting may need to be done (Issue #30)
|
|
89
|
+
const previousValue = value;
|
|
90
|
+
value = parseFloat(unformattedValue);
|
|
91
|
+
if (event && previousValue === value) {
|
|
92
|
+
// Do the formatting if the number of digits after the decimal point exceeds `fractionDigits`
|
|
93
|
+
if (unformattedValue.includes('.') &&
|
|
94
|
+
unformattedValue.split('.')[1].length > fractionDigits) {
|
|
95
|
+
setFormattedValue();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const setFormattedValue = () => {
|
|
101
|
+
// Previous caret position
|
|
102
|
+
const startCaretPosition = inputTarget?.selectionStart || 0;
|
|
103
|
+
const previousFormattedValueLength = formattedValue.length;
|
|
104
|
+
// Apply formatting to input
|
|
105
|
+
formattedValue = formatCurrency(value, fractionDigits, 0);
|
|
106
|
+
// Update `value` after formatting
|
|
107
|
+
setUnformattedValue();
|
|
108
|
+
// New caret position
|
|
109
|
+
const endCaretPosition = startCaretPosition + formattedValue.length - previousFormattedValueLength;
|
|
110
|
+
// HACK:
|
|
111
|
+
// Delay setting the new caret position until the input has been formatted
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
inputTarget?.setSelectionRange(endCaretPosition, endCaretPosition);
|
|
114
|
+
}, 0.1);
|
|
115
|
+
};
|
|
116
|
+
let formattedValue = '';
|
|
117
|
+
let formattedPlaceholder = placeholder !== null ? formatCurrency(placeholder, fractionDigits, fractionDigits) : '';
|
|
118
|
+
$: isZero = value === 0;
|
|
119
|
+
$: isNegative = value < 0;
|
|
120
|
+
$: value, setFormattedValue();
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<div class={inputClasses?.wrapper ?? DEFAULT_CLASS_WRAPPER}>
|
|
124
|
+
<input
|
|
125
|
+
class={inputClasses?.unformatted ?? DEFAULT_CLASS_UNFORMATTED}
|
|
126
|
+
type="hidden"
|
|
127
|
+
{name}
|
|
128
|
+
{disabled}
|
|
129
|
+
bind:value
|
|
130
|
+
/>
|
|
131
|
+
<input
|
|
132
|
+
class="
|
|
133
|
+
{inputClasses?.formatted ?? DEFAULT_CLASS_FORMATTED}
|
|
134
|
+
{isNegativeAllowed && !isZero && !isNegative
|
|
135
|
+
? inputClasses?.formattedPositive ?? DEFAULT_CLASS_FORMATTED_POSITIVE
|
|
136
|
+
: ''}
|
|
137
|
+
{isZero ? inputClasses?.formattedZero ?? DEFAULT_CLASS_FORMATTED_ZERO : ''}
|
|
138
|
+
{isNegativeAllowed && isNegative
|
|
139
|
+
? inputClasses?.formattedNegative ?? DEFAULT_CLASS_FORMATTED_NEGATIVE
|
|
140
|
+
: ''}
|
|
141
|
+
"
|
|
142
|
+
type="text"
|
|
143
|
+
inputmode="numeric"
|
|
144
|
+
name={`formatted-${name}`}
|
|
145
|
+
required={required && !isZero}
|
|
146
|
+
placeholder={formattedPlaceholder}
|
|
147
|
+
{disabled}
|
|
148
|
+
bind:value={formattedValue}
|
|
149
|
+
on:keydown={handleKeyDown}
|
|
150
|
+
on:keyup={setUnformattedValue}
|
|
151
|
+
on:blur={setFormattedValue}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<style>
|
|
156
|
+
input.currencyInput__formatted {
|
|
157
|
+
border: 1px solid #e2e2e2;
|
|
158
|
+
padding: 10px;
|
|
159
|
+
box-sizing: border-box;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
input.currencyInput__formatted--zero {
|
|
163
|
+
color: #333;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
input.currencyInput__formatted--positive {
|
|
167
|
+
--tw-text-opacity: 1;
|
|
168
|
+
color: rgb(21 128 61 / var(--tw-text-opacity));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
input.currencyInput__formatted--negative {
|
|
172
|
+
--tw-text-opacity: 1;
|
|
173
|
+
color: rgb(239 68 68 / var(--tw-text-opacity));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
input.currencyInput__formatted:disabled {
|
|
177
|
+
color: #999;
|
|
178
|
+
background-color: #e2e2e2;
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
cursor: default;
|
|
181
|
+
}</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
value?: number | undefined;
|
|
5
|
+
locale?: string | undefined;
|
|
6
|
+
currency?: string | undefined;
|
|
7
|
+
name?: string | undefined;
|
|
8
|
+
required?: boolean | undefined;
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
placeholder?: number | null | undefined;
|
|
11
|
+
isNegativeAllowed?: boolean | undefined;
|
|
12
|
+
fractionDigits?: number | undefined;
|
|
13
|
+
inputClasses?: {
|
|
14
|
+
wrapper?: string | undefined;
|
|
15
|
+
unformatted?: string | undefined;
|
|
16
|
+
formatted?: string | undefined;
|
|
17
|
+
formattedPositive?: string | undefined;
|
|
18
|
+
formattedNegative?: string | undefined;
|
|
19
|
+
formattedZero?: string | undefined;
|
|
20
|
+
} | null | undefined;
|
|
21
|
+
};
|
|
22
|
+
events: {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
};
|
|
25
|
+
slots: {};
|
|
26
|
+
};
|
|
27
|
+
export type CurrencyInputProps = typeof __propDef.props;
|
|
28
|
+
export type CurrencyInputEvents = typeof __propDef.events;
|
|
29
|
+
export type CurrencyInputSlots = typeof __propDef.slots;
|
|
30
|
+
export default class CurrencyInput extends SvelteComponentTyped<CurrencyInputProps, CurrencyInputEvents, CurrencyInputSlots> {
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as AppCheckbox } from './AppCheckbox.svelte';
|
|
2
|
+
export { default as AppCurrencyInput } from './currency/AppCurrencyInput.svelte';
|
|
3
|
+
export { default as AppDateInput } from './AppDateInput.svelte';
|
|
4
|
+
export { default as AppFileInput } from './AppFileInput.svelte';
|
|
5
|
+
export { default as AppNumberInput } from './AppNumberInput.svelte';
|
|
6
|
+
export { default as AppRangeInput } from './AppRangeInput.svelte';
|
|
7
|
+
export { default as AppSelect } from './AppSelect.svelte';
|
|
8
|
+
export { default as AppSliderInputs } from './AppSliderInputs.svelte';
|
|
9
|
+
export { default as AppTextInput } from './AppTextInput.svelte';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as AppCheckbox } from './AppCheckbox.svelte';
|
|
2
|
+
export { default as AppCurrencyInput } from './currency/AppCurrencyInput.svelte';
|
|
3
|
+
export { default as AppDateInput } from './AppDateInput.svelte';
|
|
4
|
+
export { default as AppFileInput } from './AppFileInput.svelte';
|
|
5
|
+
export { default as AppNumberInput } from './AppNumberInput.svelte';
|
|
6
|
+
export { default as AppRangeInput } from './AppRangeInput.svelte';
|
|
7
|
+
export { default as AppSelect } from './AppSelect.svelte';
|
|
8
|
+
export { default as AppSliderInputs } from './AppSliderInputs.svelte';
|
|
9
|
+
export { default as AppTextInput } from './AppTextInput.svelte';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import SubGridEditor from '../../editor/SubGridEditor.svelte';
|
|
3
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
4
|
+
export let id;
|
|
5
|
+
export let configuration;
|
|
6
|
+
export let componentContainerHeight;
|
|
7
|
+
let noPadding = undefined;
|
|
8
|
+
export const staticOutputs = [];
|
|
9
|
+
const { app, focusedGrid, selectedComponent } = getContext('AppEditorContext');
|
|
10
|
+
let gridContent = undefined;
|
|
11
|
+
function onFocus() {
|
|
12
|
+
$focusedGrid = {
|
|
13
|
+
parentComponentId: id,
|
|
14
|
+
subGridIndex: 0
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
$: $selectedComponent === id && onFocus();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<InputValue {id} input={configuration.noPadding} bind:value={noPadding} />
|
|
21
|
+
<InputValue {id} input={configuration.gridContent} bind:value={gridContent} />
|
|
22
|
+
|
|
23
|
+
{#if $app.subgrids?.[`${id}-0`]}
|
|
24
|
+
<SubGridEditor
|
|
25
|
+
{noPadding}
|
|
26
|
+
bind:subGrid={$app.subgrids[`${id}-0`]}
|
|
27
|
+
containerHeight={componentContainerHeight}
|
|
28
|
+
on:focus={() => {
|
|
29
|
+
$selectedComponent = id
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
{/if}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
componentContainerHeight: number;
|
|
8
|
+
staticOutputs?: string[] | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type AppContainerProps = typeof __propDef.props;
|
|
16
|
+
export type AppContainerEvents = typeof __propDef.events;
|
|
17
|
+
export type AppContainerSlots = typeof __propDef.slots;
|
|
18
|
+
export default class AppContainer extends SvelteComponentTyped<AppContainerProps, AppContainerEvents, AppContainerSlots> {
|
|
19
|
+
get staticOutputs(): string[];
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script>import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
2
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
3
|
+
export let id;
|
|
4
|
+
export let configuration;
|
|
5
|
+
export let horizontalAlignment = undefined;
|
|
6
|
+
export let verticalAlignment = undefined;
|
|
7
|
+
export let position;
|
|
8
|
+
let size = 2;
|
|
9
|
+
let color = '#00000060';
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<InputValue {id} input={configuration.size} bind:value={size} />
|
|
13
|
+
<InputValue {id} input={configuration.color} bind:value={color} />
|
|
14
|
+
|
|
15
|
+
<AlignWrapper {horizontalAlignment} {verticalAlignment} class="h-full">
|
|
16
|
+
<div
|
|
17
|
+
class="rounded-full {position === 'horizontal' ? 'w-full' : 'h-full'}"
|
|
18
|
+
style="{position === 'horizontal' ? 'height' : 'width'}: {size}px; background-color: {color}"
|
|
19
|
+
/>
|
|
20
|
+
</AlignWrapper>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { AppInput } from '../../inputType';
|
|
3
|
+
import type { HorizontalAlignment, VerticalAlignment } from '../../types';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
id: string;
|
|
7
|
+
configuration: Record<string, AppInput>;
|
|
8
|
+
horizontalAlignment?: HorizontalAlignment | undefined;
|
|
9
|
+
verticalAlignment?: VerticalAlignment | undefined;
|
|
10
|
+
position: 'horizontal' | 'vertical';
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type AppDividerProps = typeof __propDef.props;
|
|
18
|
+
export type AppDividerEvents = typeof __propDef.events;
|
|
19
|
+
export type AppDividerSlots = typeof __propDef.slots;
|
|
20
|
+
export default class AppDivider extends SvelteComponentTyped<AppDividerProps, AppDividerEvents, AppDividerSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script>import { Tab, Tabs } from '../../../common';
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
import SubGridEditor from '../../editor/SubGridEditor.svelte';
|
|
4
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
5
|
+
export let id;
|
|
6
|
+
export let configuration;
|
|
7
|
+
export let componentContainerHeight;
|
|
8
|
+
export let tabs;
|
|
9
|
+
export const staticOutputs = ['selectedTabIndex'];
|
|
10
|
+
const { app, worldStore, focusedGrid, selectedComponent } = getContext('AppEditorContext');
|
|
11
|
+
let selected = '';
|
|
12
|
+
let noPadding = undefined;
|
|
13
|
+
$: selectedIndex = tabs?.indexOf(selected) ?? -1;
|
|
14
|
+
$: if ((tabs && selected === '') || !tabs.includes(selected)) {
|
|
15
|
+
selected = tabs[0];
|
|
16
|
+
}
|
|
17
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
18
|
+
function handleTabSelection() {
|
|
19
|
+
outputs?.selectedTabIndex.set(selectedIndex);
|
|
20
|
+
}
|
|
21
|
+
$: selectedIndex >= 0 && handleTabSelection();
|
|
22
|
+
let tabHeight = 0;
|
|
23
|
+
function onFocus() {
|
|
24
|
+
$focusedGrid = {
|
|
25
|
+
parentComponentId: id,
|
|
26
|
+
subGridIndex: selectedIndex ?? 0
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
$: $selectedComponent === id && selectedIndex >= 0 && onFocus();
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<InputValue {id} input={configuration.tabs} bind:value={tabs} />
|
|
33
|
+
<InputValue {id} input={configuration.noPadding} bind:value={noPadding} />
|
|
34
|
+
|
|
35
|
+
<div>
|
|
36
|
+
<div bind:clientHeight={tabHeight} on:pointerdown|stopPropagation>
|
|
37
|
+
<Tabs bind:selected>
|
|
38
|
+
{#each tabs ?? [] as res}
|
|
39
|
+
<Tab value={res}>
|
|
40
|
+
<span class="font-semibold">{res}</span>
|
|
41
|
+
</Tab>
|
|
42
|
+
{/each}
|
|
43
|
+
</Tabs>
|
|
44
|
+
</div>
|
|
45
|
+
{#if $app.subgrids}
|
|
46
|
+
{#each tabs ?? [] as res, i}
|
|
47
|
+
<SubGridEditor
|
|
48
|
+
visible={i === selectedIndex}
|
|
49
|
+
bind:subGrid={$app.subgrids[`${id}-${i}`]}
|
|
50
|
+
{noPadding}
|
|
51
|
+
containerHeight={componentContainerHeight - tabHeight}
|
|
52
|
+
on:focus={() => {
|
|
53
|
+
$selectedComponent = id
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
{/each}
|
|
57
|
+
{/if}
|
|
58
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
componentContainerHeight: number;
|
|
8
|
+
tabs: string[];
|
|
9
|
+
staticOutputs?: string[] | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
pointerdown: PointerEvent;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
};
|
|
18
|
+
export type AppTabsProps = typeof __propDef.props;
|
|
19
|
+
export type AppTabsEvents = typeof __propDef.events;
|
|
20
|
+
export type AppTabsSlots = typeof __propDef.slots;
|
|
21
|
+
export default class AppTabs extends SvelteComponentTyped<AppTabsProps, AppTabsEvents, AppTabsSlots> {
|
|
22
|
+
get staticOutputs(): string[];
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script>import { components } from './component';
|
|
2
|
+
import InputsSpecsEditor from './settingsPanel/InputsSpecsEditor.svelte';
|
|
3
|
+
export let component;
|
|
4
|
+
export let resourceOnly = false;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
{#if component?.componentInput?.type === 'runnable' && Object.keys(component?.componentInput?.fields ?? {}).length > 0}
|
|
8
|
+
<div class="mb-8 border p-2">
|
|
9
|
+
<div class="flex justify-between mb-4">
|
|
10
|
+
<span class="text-sm font-bold">{component.id}</span>
|
|
11
|
+
<span class="text-sm font-bold">{components[component.type].name}</span>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
{#if resourceOnly && Object.keys(component.componentInput.fields).filter((fieldKey) => {
|
|
15
|
+
if (component?.componentInput?.type === 'runnable') {
|
|
16
|
+
const fields = component.componentInput?.fields
|
|
17
|
+
const field = fields[fieldKey]
|
|
18
|
+
return field.fieldType === 'object' && field.format?.startsWith('resource-')
|
|
19
|
+
}
|
|
20
|
+
return false
|
|
21
|
+
}).length === 0}
|
|
22
|
+
<span class="text-sm text-gray-600">No resource input</span>
|
|
23
|
+
{:else}
|
|
24
|
+
<InputsSpecsEditor
|
|
25
|
+
id={component.id}
|
|
26
|
+
shouldCapitalize={false}
|
|
27
|
+
bind:inputSpecs={component.componentInput.fields}
|
|
28
|
+
userInputEnabled={component.type !== 'buttoncomponent'}
|
|
29
|
+
{resourceOnly}
|
|
30
|
+
/>
|
|
31
|
+
{/if}
|
|
32
|
+
</div>
|
|
33
|
+
{/if}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { type AppComponent } from './component';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
component: AppComponent;
|
|
6
|
+
resourceOnly?: boolean | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type AppComponentInputProps = typeof __propDef.props;
|
|
14
|
+
export type AppComponentInputEvents = typeof __propDef.events;
|
|
15
|
+
export type AppComponentInputSlots = typeof __propDef.slots;
|
|
16
|
+
export default class AppComponentInput extends SvelteComponentTyped<AppComponentInputProps, AppComponentInputEvents, AppComponentInputSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script>import InputsSpecsEditor from './settingsPanel/InputsSpecsEditor.svelte';
|
|
2
|
+
export let fields;
|
|
3
|
+
export let component;
|
|
4
|
+
export let resourceOnly = false;
|
|
5
|
+
$: fields = resourceOnly ? fields : fields;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<InputsSpecsEditor
|
|
9
|
+
id={component.id}
|
|
10
|
+
shouldCapitalize={false}
|
|
11
|
+
bind:inputSpecs={fields}
|
|
12
|
+
userInputEnabled={component.type !== 'buttoncomponent'}
|
|
13
|
+
/>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ConnectedAppInput, RowAppInput, StaticAppInput, UserAppInput } from '../inputType';
|
|
3
|
+
import type { AppComponent } from './component';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
|
|
7
|
+
component: AppComponent;
|
|
8
|
+
resourceOnly?: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type AppComponentInputsProps = typeof __propDef.props;
|
|
16
|
+
export type AppComponentInputsEvents = typeof __propDef.events;
|
|
17
|
+
export type AppComponentInputsSlots = typeof __propDef.slots;
|
|
18
|
+
export default class AppComponentInputs extends SvelteComponentTyped<AppComponentInputsProps, AppComponentInputsEvents, AppComponentInputsSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|