windmill-components 1.79.0 → 1.82.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/components/ArgInput.svelte +3 -0
- package/components/ArgInput.svelte.d.ts +1 -0
- package/components/DisplayResult.svelte +18 -15
- package/components/SchemaEditor.svelte +15 -10
- package/components/SettingSection.svelte +1 -1
- package/components/Toggle.svelte +5 -2
- package/components/Toggle.svelte.d.ts +1 -0
- package/components/apps/components/buttons/AppButton.svelte +33 -40
- package/components/apps/components/buttons/AppButton.svelte.d.ts +2 -1
- package/components/apps/components/buttons/AppForm.svelte +22 -15
- package/components/apps/components/buttons/AppForm.svelte.d.ts +1 -1
- package/components/apps/components/buttons/AppFormButton.svelte +32 -24
- package/components/apps/components/buttons/AppFormButton.svelte.d.ts +1 -3
- package/components/apps/components/display/AppBarChart.svelte +2 -2
- package/components/apps/components/display/AppBarChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppDisplayComponent.svelte +2 -2
- package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +1 -1
- package/components/apps/components/display/AppHtml.svelte +10 -2
- package/components/apps/components/display/AppHtml.svelte.d.ts +1 -1
- package/components/apps/components/display/AppIcon.svelte +4 -1
- package/components/apps/components/display/AppIcon.svelte.d.ts +1 -1
- package/components/apps/components/display/AppImage.svelte +28 -15
- package/components/apps/components/display/AppImage.svelte.d.ts +1 -1
- package/components/apps/components/display/AppMap.svelte.d.ts +1 -1
- package/components/apps/components/display/AppPdf.svelte +3 -2
- package/components/apps/components/display/AppPdf.svelte.d.ts +1 -1
- package/components/apps/components/display/AppPieChart.svelte +2 -2
- package/components/apps/components/display/AppPieChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppScatterChart.svelte +2 -2
- package/components/apps/components/display/AppScatterChart.svelte.d.ts +1 -1
- package/components/apps/components/display/AppText.svelte +35 -22
- package/components/apps/components/display/AppText.svelte.d.ts +1 -1
- package/components/apps/components/display/AppTimeseries.svelte +2 -2
- package/components/apps/components/display/AppTimeseries.svelte.d.ts +1 -1
- package/components/apps/components/display/PlotlyHtml.svelte +2 -2
- package/components/apps/components/display/VegaLiteHtml.svelte +2 -2
- package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
- package/components/apps/components/display/table/AppTable.svelte +28 -12
- package/components/apps/components/display/table/AppTable.svelte.d.ts +1 -1
- package/components/apps/components/helpers/HiddenComponent.svelte +6 -3
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +1 -1
- package/components/apps/components/helpers/InputValue.svelte +9 -9
- package/components/apps/components/helpers/Loader.svelte +18 -0
- package/components/apps/components/helpers/Loader.svelte.d.ts +18 -0
- package/components/apps/components/helpers/NonRunnableComponent.svelte +1 -12
- package/components/apps/components/helpers/ResolveConfig.svelte +29 -0
- package/components/apps/components/helpers/ResolveConfig.svelte.d.ts +21 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +114 -89
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +13 -3
- package/components/apps/components/helpers/RunnableWrapper.svelte +48 -9
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +26 -2
- package/components/apps/components/inputs/AppCheckbox.svelte +1 -1
- package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppDateInput.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppFileInput.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte +0 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppNumberInput.svelte +1 -1
- package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +1 -3
- package/components/apps/components/inputs/AppRangeInput.svelte +7 -1
- package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +2 -1
- package/components/apps/components/inputs/AppSelect.svelte +8 -3
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppSliderInputs.svelte +7 -1
- package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +2 -1
- package/components/apps/components/inputs/AppTextInput.svelte +4 -4
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -3
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +17 -19
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppContainer.svelte +7 -4
- package/components/apps/components/layout/AppContainer.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppDivider.svelte +4 -1
- package/components/apps/components/layout/AppDivider.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppDrawer.svelte +7 -4
- package/components/apps/components/layout/AppDrawer.svelte.d.ts +1 -1
- package/components/apps/components/layout/AppSplitpanes.svelte +34 -21
- package/components/apps/components/layout/AppSplitpanes.svelte.d.ts +1 -3
- package/components/apps/components/layout/AppTabs.svelte +17 -34
- package/components/apps/components/layout/AppTabs.svelte.d.ts +1 -2
- package/components/apps/editor/AppEditor.svelte +3 -1
- package/components/apps/editor/AppEditorHeader.svelte +2 -3
- package/components/apps/editor/AppPreview.svelte +10 -15
- package/components/apps/editor/ComponentHeader.svelte +10 -8
- package/components/apps/editor/ComponentHeader.svelte.d.ts +0 -1
- package/components/apps/editor/GridEditor.svelte +21 -50
- package/components/apps/editor/GridEditor.svelte.d.ts +0 -2
- package/components/apps/editor/RecomputeAllComponents.svelte +13 -2
- package/components/apps/editor/SettingsPanel.svelte +103 -40
- package/components/apps/editor/SubGridEditor.svelte +32 -41
- package/components/apps/editor/SubGridEditor.svelte.d.ts +1 -2
- package/components/apps/editor/appUtils.d.ts +49 -7
- package/components/apps/editor/appUtils.js +133 -37
- package/components/apps/editor/component/Component.svelte +21 -10
- package/components/apps/editor/component/Component.svelte.d.ts +1 -2
- package/components/apps/editor/component/ComponentNavigation.svelte +17 -11
- package/components/apps/editor/component/components.d.ts +1550 -17
- package/components/apps/editor/component/components.js +295 -325
- package/components/apps/editor/component/default-codes.d.ts +1 -1
- package/components/apps/editor/component/default-codes.js +25 -25
- package/components/apps/editor/componentsPanel/ComponentList.svelte +18 -3
- package/components/apps/editor/componentsPanel/CssProperty.svelte +5 -3
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +3 -1
- package/components/apps/editor/componentsPanel/CssSettings.svelte +48 -90
- package/components/apps/editor/componentsPanel/ListItem.svelte +3 -0
- package/components/apps/editor/componentsPanel/ListItem.svelte.d.ts +2 -0
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +1 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +146 -130
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +2 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +31 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +42 -76
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +67 -17
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte.d.ts +1 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +27 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte.d.ts +17 -0
- package/components/apps/editor/inlineScriptsPanel/utils.d.ts +2 -0
- package/components/apps/editor/inlineScriptsPanel/utils.js +6 -5
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +10 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +37 -31
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +4 -104
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +90 -54
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +5 -3
- package/components/apps/editor/settingsPanel/GridTab.svelte +0 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +99 -80
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +8 -0
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +25 -2
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +52 -0
- package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte.d.ts +28 -0
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +70 -26
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +7 -5
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte.d.ts +3 -2
- package/components/apps/editor/settingsPanel/TableActions.svelte +8 -63
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +2 -4
- package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +3 -1
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte.d.ts +2 -4
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +5 -5
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +47 -31
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +8 -2
- package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte +46 -0
- package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte.d.ts +20 -0
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +7 -0
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte +20 -70
- package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +14 -8
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte.d.ts +5 -1
- package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte +85 -27
- package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte.d.ts +4 -6
- package/components/apps/gridUtils.js +1 -1
- package/components/apps/inputType.d.ts +12 -16
- package/components/apps/rx.d.ts +2 -0
- package/components/apps/rx.js +8 -2
- package/components/apps/svelte-grid/Grid.svelte +0 -4
- package/components/apps/svelte-grid/Grid.svelte.d.ts +1 -1
- package/components/apps/svelte-grid/MoveResize.svelte +24 -30
- package/components/apps/svelte-grid/MoveResize.svelte.d.ts +0 -4
- package/components/apps/svelte-grid/types.d.ts +1 -7
- package/components/apps/svelte-grid/utils/helper.js +6 -10
- package/components/apps/types.d.ts +21 -22
- package/components/apps/utils.d.ts +2 -2
- package/components/apps/utils.js +13 -11
- package/components/common/skeleton/Skeleton.svelte +1 -1
- package/components/flows/flowStateUtils.js +8 -1
- package/package.json +7 -4
- package/components/apps/editor/GridPanel.svelte +0 -31
- package/components/apps/editor/GridPanel.svelte.d.ts +0 -18
- package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +0 -12
- package/components/apps/editor/componentsPanel/componentStaticValues.js +0 -25
|
@@ -164,6 +164,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
164
164
|
use:autosize
|
|
165
165
|
rows="1"
|
|
166
166
|
bind:value={description}
|
|
167
|
+
on:keydown|stopPropagation
|
|
167
168
|
placeholder="Field description"
|
|
168
169
|
/>
|
|
169
170
|
{#if type == 'string' && format != 'date-time'}
|
|
@@ -315,6 +316,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
315
316
|
{autofocus}
|
|
316
317
|
{disabled}
|
|
317
318
|
use:autosize
|
|
319
|
+
on:keydown|stopPropagation
|
|
318
320
|
style="max-height: {maxHeight}"
|
|
319
321
|
on:input={() => {
|
|
320
322
|
dispatch('input', { rawValue: value, isRaw: false })
|
|
@@ -390,6 +392,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
390
392
|
}}
|
|
391
393
|
on:blur={() => dispatch('blur')}
|
|
392
394
|
use:autosize
|
|
395
|
+
on:keydown|stopPropagation
|
|
393
396
|
type="text"
|
|
394
397
|
{disabled}
|
|
395
398
|
class="col-span-10 {valid
|
|
@@ -5,6 +5,7 @@ import { copyToClipboard, truncate } from '../utils';
|
|
|
5
5
|
import { Button, Drawer, DrawerContent } from './common';
|
|
6
6
|
import autosize from 'svelte-autosize';
|
|
7
7
|
import { ClipboardCopy } from 'lucide-svelte';
|
|
8
|
+
import Portal from 'svelte-portal';
|
|
8
9
|
export let result;
|
|
9
10
|
export let requireHtmlApproval = false;
|
|
10
11
|
let resultKind;
|
|
@@ -74,20 +75,22 @@ let payload = '';
|
|
|
74
75
|
let jsonViewer;
|
|
75
76
|
</script>
|
|
76
77
|
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
<
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</
|
|
78
|
+
<Portal>
|
|
79
|
+
<Drawer bind:this={jsonViewer} size="900px">
|
|
80
|
+
<DrawerContent title="Expanded Result" on:close={jsonViewer.closeDrawer}>
|
|
81
|
+
<svelte:fragment slot="actions">
|
|
82
|
+
<Button
|
|
83
|
+
on:click={() => copyToClipboard(JSON.stringify(result, null, 4))}
|
|
84
|
+
color="light"
|
|
85
|
+
size="xs"
|
|
86
|
+
>
|
|
87
|
+
<div class="flex gap-2 items-center">Copy to clipboard <ClipboardCopy /> </div>
|
|
88
|
+
</Button>
|
|
89
|
+
</svelte:fragment>
|
|
90
|
+
<Highlight language={json} code={JSON.stringify(result, null, 4).replace(/\\n/g, '\n')} />
|
|
91
|
+
</DrawerContent>
|
|
92
|
+
</Drawer>
|
|
93
|
+
</Portal>
|
|
91
94
|
|
|
92
95
|
<div class="inline-highlight">
|
|
93
96
|
{#if result != undefined}
|
|
@@ -95,7 +98,7 @@ let jsonViewer;
|
|
|
95
98
|
<div class="mb-2 text-gray-500 text-sm bg-gray-50/20">
|
|
96
99
|
as JSON <input class="windmillapp" type="checkbox" bind:checked={forceJson} /></div
|
|
97
100
|
>{/if}{#if typeof result == 'object' && Object.keys(result).length > 0}<div
|
|
98
|
-
class="mb-2 min-w-[
|
|
101
|
+
class="mb-2 min-w-[360px] text-sm text-gray-700 relative"
|
|
99
102
|
>The result keys are: <b>{truncate(Object.keys(result).join(', '), 50)}</b>
|
|
100
103
|
<div class="text-gray-500 text-sm absolute top-0 right-2">
|
|
101
104
|
<button on:click={jsonViewer.openDrawer}>Expand JSON</button>
|
|
@@ -9,6 +9,7 @@ import TableCustom from './TableCustom.svelte';
|
|
|
9
9
|
import Toggle from './Toggle.svelte';
|
|
10
10
|
import Tooltip from './Tooltip.svelte';
|
|
11
11
|
import { flip } from 'svelte/animate';
|
|
12
|
+
import Portal from 'svelte-portal';
|
|
12
13
|
const dispatch = createEventDispatcher();
|
|
13
14
|
export let schema = emptySchema();
|
|
14
15
|
if (!schema) {
|
|
@@ -166,8 +167,10 @@ let error = '';
|
|
|
166
167
|
/>
|
|
167
168
|
<div class="ml-2">
|
|
168
169
|
<Tooltip>
|
|
169
|
-
Arguments can be edited either using the wizard, or by editing their JSON Schema,
|
|
170
|
-
<a href="https://docs.windmill.dev/docs/reference/#script-parameters-to-json-schema"
|
|
170
|
+
Arguments can be edited either using the wizard, or by editing their JSON Schema,
|
|
171
|
+
<a href="https://docs.windmill.dev/docs/reference/#script-parameters-to-json-schema"
|
|
172
|
+
>see docs</a
|
|
173
|
+
>
|
|
171
174
|
</Tooltip>
|
|
172
175
|
</div>
|
|
173
176
|
</div>
|
|
@@ -269,11 +272,13 @@ let error = '';
|
|
|
269
272
|
</div>
|
|
270
273
|
</div>
|
|
271
274
|
|
|
272
|
-
<
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
275
|
+
<Portal>
|
|
276
|
+
<SchemaModal
|
|
277
|
+
bind:this={schemaModal}
|
|
278
|
+
bind:property={modalProperty}
|
|
279
|
+
bind:error={argError}
|
|
280
|
+
on:save={handleAddOrEditArgument}
|
|
281
|
+
bind:editing
|
|
282
|
+
bind:oldArgName
|
|
283
|
+
/>
|
|
284
|
+
</Portal>
|
package/components/Toggle.svelte
CHANGED
|
@@ -5,6 +5,7 @@ export let checked = false;
|
|
|
5
5
|
export let disabled = false;
|
|
6
6
|
export let textClass = '';
|
|
7
7
|
export let textStyle = '';
|
|
8
|
+
export let color = 'blue';
|
|
8
9
|
export let size = 'sm';
|
|
9
10
|
const id = (Math.random() + 1).toString(36).substring(10);
|
|
10
11
|
const dispatch = createEventDispatcher();
|
|
@@ -20,7 +21,7 @@ const dispatch = createEventDispatcher();
|
|
|
20
21
|
{#if Boolean(options?.left)}
|
|
21
22
|
<span
|
|
22
23
|
class={twMerge(
|
|
23
|
-
'
|
|
24
|
+
'mr-2 font-medium duration-200',
|
|
24
25
|
disabled ? 'text-gray-500' : 'text-gray-900',
|
|
25
26
|
size === 'xs' ? 'text-xs' : 'text-sm',
|
|
26
27
|
textClass
|
|
@@ -49,7 +50,9 @@ const dispatch = createEventDispatcher();
|
|
|
49
50
|
class="w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 peer-focus:ring-blue-300
|
|
50
51
|
peer-checked:after:translate-x-full peer-checked:after:border-white after:content-['']
|
|
51
52
|
after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300
|
|
52
|
-
after:border after:rounded-full after:h-5 after:w-5 after:transition-all
|
|
53
|
+
after:border after:rounded-full after:h-5 after:w-5 after:transition-all {color == 'red'
|
|
54
|
+
? 'peer-checked:bg-red-600'
|
|
55
|
+
: 'peer-checked:bg-blue-600'}"
|
|
53
56
|
/>
|
|
54
57
|
</div>
|
|
55
58
|
{#if Boolean(options?.right)}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<script>import { Button } from '../../../common';
|
|
2
2
|
import { getContext } from 'svelte';
|
|
3
3
|
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
4
|
-
import InputValue from '../helpers/InputValue.svelte';
|
|
5
4
|
import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
|
|
6
5
|
import { loadIcon } from '../icon';
|
|
7
6
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
7
|
+
import { initConfig, initOutput } from '../../editor/appUtils';
|
|
8
|
+
import { components } from '../../editor/component';
|
|
9
|
+
import ResolveConfig from '../helpers/ResolveConfig.svelte';
|
|
11
10
|
export let id;
|
|
12
11
|
export let componentInput;
|
|
13
12
|
export let configuration;
|
|
@@ -19,26 +18,22 @@ export let noWFull = false;
|
|
|
19
18
|
export let preclickAction = undefined;
|
|
20
19
|
export let customCss = undefined;
|
|
21
20
|
export let render;
|
|
22
|
-
export let initializing =
|
|
21
|
+
export let initializing = false;
|
|
22
|
+
export let extraKey = undefined;
|
|
23
23
|
export let controls = undefined;
|
|
24
|
-
const { worldStore, app, componentControl } = getContext('AppViewerContext');
|
|
24
|
+
const { worldStore, app, componentControl, selectedComponent } = getContext('AppViewerContext');
|
|
25
|
+
let resolvedConfig = initConfig(components['buttoncomponent'].initialData.configuration, configuration);
|
|
26
|
+
$: initializing = resolvedConfig?.label == undefined;
|
|
27
|
+
let outputs = initOutput($worldStore, id, {
|
|
28
|
+
result: undefined,
|
|
29
|
+
loading: false
|
|
30
|
+
});
|
|
25
31
|
if (controls) {
|
|
26
32
|
$componentControl[id] = controls;
|
|
27
33
|
}
|
|
28
34
|
let runnableComponent;
|
|
29
|
-
// let labelValue: string
|
|
30
|
-
// let color: ButtonType.Color
|
|
31
|
-
// let size: ButtonType.Size
|
|
32
|
-
// let disabled: boolean | undefined = undefined
|
|
33
|
-
// let fillContainer: boolean | undefined = undefined
|
|
34
|
-
// let gotoUrl: string | undefined = undefined
|
|
35
|
-
// let gotoNewTab: boolean | undefined = undefined
|
|
36
35
|
let isLoading = false;
|
|
37
36
|
let ownClick = false;
|
|
38
|
-
// let beforeIcon: undefined | string = undefined
|
|
39
|
-
// let afterIcon: undefined | string = undefined
|
|
40
|
-
let resolvedConfig = {};
|
|
41
|
-
$: initializing = resolvedConfig?.label == undefined;
|
|
42
37
|
let beforeIconComponent;
|
|
43
38
|
let afterIconComponent;
|
|
44
39
|
$: resolvedConfig.beforeIcon && handleBeforeIcon();
|
|
@@ -53,11 +48,7 @@ async function handleAfterIcon() {
|
|
|
53
48
|
afterIconComponent = await loadIcon(resolvedConfig.afterIcon);
|
|
54
49
|
}
|
|
55
50
|
}
|
|
56
|
-
|
|
57
|
-
result: undefined,
|
|
58
|
-
loading: false
|
|
59
|
-
});
|
|
60
|
-
$: resolvedConfig.triggerOnAppLoad && runnableComponent?.runComponent();
|
|
51
|
+
$: resolvedConfig?.triggerOnAppLoad && runnableComponent?.runComponent();
|
|
61
52
|
$: if (outputs?.loading != undefined) {
|
|
62
53
|
outputs.loading.set(false, true);
|
|
63
54
|
}
|
|
@@ -75,22 +66,17 @@ let errors = {};
|
|
|
75
66
|
$: errorsMessage = Object.values(errors)
|
|
76
67
|
.filter((x) => x != '')
|
|
77
68
|
.join('\n');
|
|
69
|
+
let runnableWrapper;
|
|
78
70
|
async function handleClick(event) {
|
|
79
71
|
event?.stopPropagation();
|
|
80
72
|
event?.preventDefault();
|
|
73
|
+
$selectedComponent = id;
|
|
81
74
|
if (preclickAction) {
|
|
82
75
|
await preclickAction();
|
|
83
76
|
}
|
|
84
77
|
ownClick = true;
|
|
85
78
|
if (!runnableComponent) {
|
|
86
|
-
|
|
87
|
-
if (resolvedConfig.gotoNewTab) {
|
|
88
|
-
window.open(resolvedConfig.gotoUrl, '_blank');
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
goto(resolvedConfig.gotoUrl);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
79
|
+
runnableWrapper.onSuccess();
|
|
94
80
|
}
|
|
95
81
|
else {
|
|
96
82
|
await runnableComponent?.runComponent();
|
|
@@ -98,37 +84,44 @@ async function handleClick(event) {
|
|
|
98
84
|
}
|
|
99
85
|
</script>
|
|
100
86
|
|
|
101
|
-
{#each
|
|
102
|
-
<
|
|
87
|
+
{#each Object.keys(components['buttoncomponent'].initialData.configuration) as key (key)}
|
|
88
|
+
<ResolveConfig
|
|
89
|
+
{id}
|
|
90
|
+
{extraKey}
|
|
91
|
+
{key}
|
|
92
|
+
bind:resolvedConfig={resolvedConfig[key]}
|
|
93
|
+
configuration={configuration[key]}
|
|
94
|
+
/>
|
|
103
95
|
{/each}
|
|
104
96
|
|
|
97
|
+
<!-- gotoNewTab={resolvedConfig.onSuccess.selected == 'goto'} -->
|
|
98
|
+
|
|
105
99
|
<RunnableWrapper
|
|
100
|
+
bind:this={runnableWrapper}
|
|
106
101
|
{recomputeIds}
|
|
107
102
|
bind:runnableComponent
|
|
108
103
|
{componentInput}
|
|
104
|
+
doOnSuccess={resolvedConfig.onSuccess}
|
|
109
105
|
{id}
|
|
110
106
|
{extraQueryParams}
|
|
111
107
|
autoRefresh={false}
|
|
112
|
-
goto={resolvedConfig.gotoUrl}
|
|
113
|
-
gotoNewTab={resolvedConfig.gotoNewTab}
|
|
114
108
|
{render}
|
|
109
|
+
{outputs}
|
|
110
|
+
{extraKey}
|
|
115
111
|
>
|
|
116
112
|
<AlignWrapper {noWFull} {horizontalAlignment} {verticalAlignment}>
|
|
117
113
|
{#if errorsMessage}
|
|
118
114
|
<div class="text-red-500 text-xs">{errorsMessage}</div>
|
|
119
115
|
{/if}
|
|
120
116
|
<Button
|
|
117
|
+
on:pointerdown={(e) => e.stopPropagation()}
|
|
121
118
|
btnClasses={twMerge(
|
|
122
119
|
$app.css?.['buttoncomponent']?.['button']?.class,
|
|
123
|
-
customCss?.button
|
|
120
|
+
customCss?.button?.class,
|
|
124
121
|
resolvedConfig.fillContainer ? 'w-full h-full' : ''
|
|
125
122
|
)}
|
|
126
|
-
style={[$app.css?.['buttoncomponent']?.['button']?.style, customCss?.button
|
|
123
|
+
style={[$app.css?.['buttoncomponent']?.['button']?.style, customCss?.button?.style].join(';')}
|
|
127
124
|
disabled={resolvedConfig.disabled}
|
|
128
|
-
on:pointerdown={(e) => {
|
|
129
|
-
e?.stopPropagation()
|
|
130
|
-
window.dispatchEvent(new Event('pointerup'))
|
|
131
|
-
}}
|
|
132
125
|
on:click={handleClick}
|
|
133
126
|
size={resolvedConfig.size}
|
|
134
127
|
color={resolvedConfig.color}
|
|
@@ -12,9 +12,10 @@ declare const __propDef: {
|
|
|
12
12
|
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
13
13
|
noWFull?: boolean | undefined;
|
|
14
14
|
preclickAction?: (() => Promise<void>) | undefined;
|
|
15
|
-
customCss?: ComponentCustomCSS<'
|
|
15
|
+
customCss?: ComponentCustomCSS<'buttoncomponent'> | undefined;
|
|
16
16
|
render: boolean;
|
|
17
17
|
initializing?: boolean | undefined;
|
|
18
|
+
extraKey?: string | undefined;
|
|
18
19
|
controls?: {
|
|
19
20
|
left: () => boolean;
|
|
20
21
|
right: () => boolean | string;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import { faUser } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import { getContext } from 'svelte';
|
|
4
4
|
import { Icon } from 'svelte-awesome';
|
|
5
|
+
import { initConfig, initOutput } from '../../editor/appUtils';
|
|
6
|
+
import { components } from '../../editor/component';
|
|
5
7
|
import { concatCustomCss } from '../../utils';
|
|
6
8
|
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
7
|
-
import
|
|
9
|
+
import ResolveConfig from '../helpers/ResolveConfig.svelte';
|
|
8
10
|
import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
|
|
9
11
|
export let id;
|
|
10
12
|
export let componentInput;
|
|
@@ -16,16 +18,16 @@ export let customCss = undefined;
|
|
|
16
18
|
export let render;
|
|
17
19
|
export const staticOutputs = ['loading', 'result'];
|
|
18
20
|
const { app, worldStore, stateId } = getContext('AppViewerContext');
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
let outputs = initOutput($worldStore, id, {
|
|
22
|
+
result: undefined,
|
|
23
|
+
loading: false
|
|
24
|
+
});
|
|
25
|
+
let resolvedConfig = initConfig(components['formcomponent'].initialData.configuration, configuration);
|
|
22
26
|
let runnableComponent;
|
|
23
|
-
let goto = undefined;
|
|
24
27
|
let isLoading = false;
|
|
25
28
|
$: noInputs =
|
|
26
29
|
$stateId != undefined &&
|
|
27
30
|
(componentInput?.type != 'runnable' || Object.keys(componentInput?.fields ?? {}).length == 0);
|
|
28
|
-
$: outputs = $worldStore?.outputsById[id];
|
|
29
31
|
$: if (outputs?.loading != undefined) {
|
|
30
32
|
outputs.loading.set(false, true);
|
|
31
33
|
}
|
|
@@ -38,10 +40,14 @@ $: outputs?.loading.subscribe({
|
|
|
38
40
|
$: css = concatCustomCss($app.css?.formcomponent, customCss);
|
|
39
41
|
</script>
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
{#each Object.keys(components['formcomponent'].initialData.configuration) as key (key)}
|
|
44
|
+
<ResolveConfig
|
|
45
|
+
{id}
|
|
46
|
+
{key}
|
|
47
|
+
bind:resolvedConfig={resolvedConfig[key]}
|
|
48
|
+
configuration={configuration[key]}
|
|
49
|
+
/>
|
|
50
|
+
{/each}
|
|
45
51
|
|
|
46
52
|
<RunnableWrapper
|
|
47
53
|
{recomputeIds}
|
|
@@ -49,12 +55,13 @@ $: css = concatCustomCss($app.css?.formcomponent, customCss);
|
|
|
49
55
|
bind:runnableComponent
|
|
50
56
|
{componentInput}
|
|
51
57
|
{id}
|
|
52
|
-
{
|
|
58
|
+
doOnSuccess={resolvedConfig.onSuccess}
|
|
53
59
|
{extraQueryParams}
|
|
54
60
|
autoRefresh={false}
|
|
55
61
|
forceSchemaDisplay={true}
|
|
56
62
|
runnableClass="!block"
|
|
57
|
-
runnableStyle={css?.container
|
|
63
|
+
runnableStyle={css?.container?.style}
|
|
64
|
+
{outputs}
|
|
58
65
|
>
|
|
59
66
|
<AlignWrapper {horizontalAlignment}>
|
|
60
67
|
<div
|
|
@@ -87,10 +94,10 @@ $: css = concatCustomCss($app.css?.formcomponent, customCss);
|
|
|
87
94
|
on:click={() => {
|
|
88
95
|
runnableComponent?.runComponent()
|
|
89
96
|
}}
|
|
90
|
-
{size}
|
|
91
|
-
{color}
|
|
97
|
+
size={resolvedConfig.size}
|
|
98
|
+
color={resolvedConfig.color}
|
|
92
99
|
>
|
|
93
|
-
{
|
|
100
|
+
{resolvedConfig.label}
|
|
94
101
|
</Button>
|
|
95
102
|
{/if}
|
|
96
103
|
</div>
|
|
@@ -9,7 +9,7 @@ declare const __propDef: {
|
|
|
9
9
|
recomputeIds?: string[] | undefined;
|
|
10
10
|
extraQueryParams?: Record<string, any> | undefined;
|
|
11
11
|
horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
|
|
12
|
-
customCss?: ComponentCustomCSS<'
|
|
12
|
+
customCss?: ComponentCustomCSS<'formcomponent'> | undefined;
|
|
13
13
|
render: boolean;
|
|
14
14
|
staticOutputs?: string[] | undefined;
|
|
15
15
|
};
|
|
@@ -8,6 +8,9 @@ import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
|
|
|
8
8
|
import Portal from 'svelte-portal';
|
|
9
9
|
import Modal from '../../../common/modal/Modal.svelte';
|
|
10
10
|
import { concatCustomCss } from '../../utils';
|
|
11
|
+
import { initConfig, initOutput } from '../../editor/appUtils';
|
|
12
|
+
import { components } from '../../editor/component';
|
|
13
|
+
import ResolveConfig from '../helpers/ResolveConfig.svelte';
|
|
11
14
|
export let id;
|
|
12
15
|
export let componentInput;
|
|
13
16
|
export let configuration;
|
|
@@ -17,13 +20,13 @@ export let horizontalAlignment = undefined;
|
|
|
17
20
|
export let verticalAlignment = undefined;
|
|
18
21
|
export let customCss = undefined;
|
|
19
22
|
export let render;
|
|
20
|
-
export const staticOutputs = ['loading', 'result'];
|
|
21
23
|
const { app, worldStore } = getContext('AppViewerContext');
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
let outputs = initOutput($worldStore, id, {
|
|
25
|
+
result: undefined,
|
|
26
|
+
loading: false
|
|
27
|
+
});
|
|
28
|
+
let resolvedConfig = initConfig(components['formbuttoncomponent'].initialData.configuration, configuration);
|
|
25
29
|
let runnableComponent;
|
|
26
|
-
let disabled = undefined;
|
|
27
30
|
let isLoading = false;
|
|
28
31
|
let ownClick = false;
|
|
29
32
|
let errors = {};
|
|
@@ -33,7 +36,6 @@ $: errorsMessage = Object.values(errors)
|
|
|
33
36
|
.join('\n');
|
|
34
37
|
$: noInputs =
|
|
35
38
|
componentInput?.type != 'runnable' || Object.keys(componentInput?.fields ?? {}).length == 0;
|
|
36
|
-
$: outputs = $worldStore?.outputsById[id];
|
|
37
39
|
$: if (outputs?.loading != undefined) {
|
|
38
40
|
outputs.loading.set(false, true);
|
|
39
41
|
}
|
|
@@ -48,24 +50,24 @@ $: outputs?.loading.subscribe({
|
|
|
48
50
|
});
|
|
49
51
|
$: loading = isLoading && ownClick;
|
|
50
52
|
$: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
|
|
53
|
+
let runnableWrapper;
|
|
51
54
|
</script>
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/>
|
|
56
|
+
{#each Object.keys(components['formbuttoncomponent'].initialData.configuration) as key (key)}
|
|
57
|
+
<ResolveConfig
|
|
58
|
+
{id}
|
|
59
|
+
{key}
|
|
60
|
+
bind:resolvedConfig={resolvedConfig[key]}
|
|
61
|
+
configuration={configuration[key]}
|
|
62
|
+
/>
|
|
63
|
+
{/each}
|
|
62
64
|
|
|
63
65
|
<Portal>
|
|
64
66
|
<Modal
|
|
65
67
|
{open}
|
|
66
|
-
title={
|
|
67
|
-
class={css?.popup
|
|
68
|
-
style={css?.popup
|
|
68
|
+
title={resolvedConfig.label ?? ''}
|
|
69
|
+
class={css?.popup?.class}
|
|
70
|
+
style={css?.popup?.style}
|
|
69
71
|
on:canceled={() => {
|
|
70
72
|
open = false
|
|
71
73
|
}}
|
|
@@ -74,6 +76,7 @@ $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
|
|
|
74
76
|
}}
|
|
75
77
|
>
|
|
76
78
|
<RunnableWrapper
|
|
79
|
+
bind:this={runnableWrapper}
|
|
77
80
|
{recomputeIds}
|
|
78
81
|
{render}
|
|
79
82
|
bind:runnableComponent
|
|
@@ -83,6 +86,8 @@ $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
|
|
|
83
86
|
autoRefresh={false}
|
|
84
87
|
forceSchemaDisplay={true}
|
|
85
88
|
runnableClass="!block"
|
|
89
|
+
{outputs}
|
|
90
|
+
doOnSuccess={resolvedConfig.onSuccess}
|
|
86
91
|
>
|
|
87
92
|
<div class="flex flex-col gap-2 px-4 w-full">
|
|
88
93
|
<div>
|
|
@@ -107,8 +112,11 @@ $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
|
|
|
107
112
|
window.dispatchEvent(new Event('pointerup'))
|
|
108
113
|
}}
|
|
109
114
|
on:click={async () => {
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
if (!runnableComponent) {
|
|
116
|
+
runnableWrapper.onSuccess()
|
|
117
|
+
} else {
|
|
118
|
+
await runnableComponent?.runComponent()
|
|
119
|
+
}
|
|
112
120
|
open = false
|
|
113
121
|
}}
|
|
114
122
|
size="xs"
|
|
@@ -127,15 +135,15 @@ $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
|
|
|
127
135
|
<div class="text-red-500 text-xs">{errorsMessage}</div>
|
|
128
136
|
{/if}
|
|
129
137
|
<Button
|
|
130
|
-
{disabled}
|
|
131
|
-
{size}
|
|
132
|
-
{color}
|
|
138
|
+
disabled={resolvedConfig.disabled ?? false}
|
|
139
|
+
size={resolvedConfig.size ?? 'md'}
|
|
140
|
+
color={resolvedConfig.color}
|
|
133
141
|
btnClasses={css?.button?.class ?? ''}
|
|
134
142
|
style={css?.button?.style ?? ''}
|
|
135
143
|
on:click={(e) => {
|
|
136
144
|
open = true
|
|
137
145
|
}}
|
|
138
146
|
>
|
|
139
|
-
{
|
|
147
|
+
{resolvedConfig.label}
|
|
140
148
|
</Button>
|
|
141
149
|
</AlignWrapper>
|
|
@@ -10,9 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
extraQueryParams?: Record<string, any> | undefined;
|
|
11
11
|
horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
|
|
12
12
|
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
13
|
-
customCss?: ComponentCustomCSS<'
|
|
13
|
+
customCss?: ComponentCustomCSS<'formbuttoncomponent'> | undefined;
|
|
14
14
|
render: boolean;
|
|
15
|
-
staticOutputs?: string[] | undefined;
|
|
16
15
|
};
|
|
17
16
|
events: {
|
|
18
17
|
[evt: string]: CustomEvent<any>;
|
|
@@ -23,6 +22,5 @@ export type AppFormButtonProps = typeof __propDef.props;
|
|
|
23
22
|
export type AppFormButtonEvents = typeof __propDef.events;
|
|
24
23
|
export type AppFormButtonSlots = typeof __propDef.slots;
|
|
25
24
|
export default class AppFormButton extends SvelteComponentTyped<AppFormButtonProps, AppFormButtonEvents, AppFormButtonSlots> {
|
|
26
|
-
get staticOutputs(): string[];
|
|
27
25
|
}
|
|
28
26
|
export {};
|
|
@@ -12,7 +12,7 @@ export let initializing = undefined;
|
|
|
12
12
|
export let customCss = undefined;
|
|
13
13
|
export let render;
|
|
14
14
|
const { app, worldStore } = getContext('AppViewerContext');
|
|
15
|
-
initOutput($worldStore, id, {
|
|
15
|
+
let outputs = initOutput($worldStore, id, {
|
|
16
16
|
result: undefined,
|
|
17
17
|
loading: false
|
|
18
18
|
});
|
|
@@ -62,7 +62,7 @@ $: css = concatCustomCss($app.css?.barchartcomponent, customCss);
|
|
|
62
62
|
<InputValue {id} input={configuration.theme} bind:value={theme} />
|
|
63
63
|
<InputValue {id} input={configuration.line} bind:value={lineChart} />
|
|
64
64
|
|
|
65
|
-
<RunnableWrapper {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
|
|
65
|
+
<RunnableWrapper {outputs} {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
|
|
66
66
|
<div class="w-full h-full {css?.container?.class ?? ''}" style={css?.container?.style ?? ''}>
|
|
67
67
|
{#if result}
|
|
68
68
|
{#if lineChart}
|
|
@@ -7,7 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
componentInput: AppInput | undefined;
|
|
8
8
|
configuration: RichConfigurations;
|
|
9
9
|
initializing?: boolean | undefined;
|
|
10
|
-
customCss?: ComponentCustomCSS<'
|
|
10
|
+
customCss?: ComponentCustomCSS<'barchartcomponent'> | undefined;
|
|
11
11
|
render: boolean;
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
@@ -12,13 +12,13 @@ export let render;
|
|
|
12
12
|
const requireHtmlApproval = getContext(IS_APP_PUBLIC_CONTEXT_KEY);
|
|
13
13
|
const { app, worldStore } = getContext('AppViewerContext');
|
|
14
14
|
let result = undefined;
|
|
15
|
-
initOutput($worldStore, id, {
|
|
15
|
+
const outputs = initOutput($worldStore, id, {
|
|
16
16
|
result: undefined,
|
|
17
17
|
loading: false
|
|
18
18
|
});
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
|
-
<RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
|
|
21
|
+
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
22
22
|
<div
|
|
23
23
|
class={twMerge(
|
|
24
24
|
'w-full border-b px-2 text-xs p-1 font-semibold bg-gray-500 text-white rounded-t-sm',
|
|
@@ -6,7 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
id: string;
|
|
7
7
|
componentInput: AppInput | undefined;
|
|
8
8
|
initializing?: boolean | undefined;
|
|
9
|
-
customCss?: ComponentCustomCSS<'
|
|
9
|
+
customCss?: ComponentCustomCSS<'displaycomponent'> | undefined;
|
|
10
10
|
render: boolean;
|
|
11
11
|
};
|
|
12
12
|
events: {
|
|
@@ -8,7 +8,7 @@ export let initializing = undefined;
|
|
|
8
8
|
export let customCss = undefined;
|
|
9
9
|
export let render;
|
|
10
10
|
const { app, worldStore } = getContext('AppViewerContext');
|
|
11
|
-
initOutput($worldStore, id, {
|
|
11
|
+
const outputs = initOutput($worldStore, id, {
|
|
12
12
|
result: undefined,
|
|
13
13
|
loading: false
|
|
14
14
|
});
|
|
@@ -26,7 +26,15 @@ $: css = concatCustomCss($app.css?.htmlcomponent, customCss);
|
|
|
26
26
|
bind:clientHeight={h}
|
|
27
27
|
bind:clientWidth={w}
|
|
28
28
|
>
|
|
29
|
-
<RunnableWrapper
|
|
29
|
+
<RunnableWrapper
|
|
30
|
+
{outputs}
|
|
31
|
+
{render}
|
|
32
|
+
autoRefresh
|
|
33
|
+
{componentInput}
|
|
34
|
+
{id}
|
|
35
|
+
bind:initializing
|
|
36
|
+
bind:result
|
|
37
|
+
>
|
|
30
38
|
{#key result}
|
|
31
39
|
<iframe
|
|
32
40
|
frameborder="0"
|
|
@@ -6,7 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
id: string;
|
|
7
7
|
componentInput: AppInput | undefined;
|
|
8
8
|
initializing?: boolean | undefined;
|
|
9
|
-
customCss?: ComponentCustomCSS<'
|
|
9
|
+
customCss?: ComponentCustomCSS<'htmlcomponent'> | undefined;
|
|
10
10
|
render: boolean;
|
|
11
11
|
};
|
|
12
12
|
events: {
|