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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
|
+
import { initOutput } from '../../editor/appUtils';
|
|
2
3
|
import { concatCustomCss } from '../../utils';
|
|
3
4
|
import { AlignWrapper, InputValue } from '../helpers';
|
|
4
5
|
import { loadIcon } from '../icon';
|
|
@@ -8,7 +9,9 @@ export let verticalAlignment = undefined;
|
|
|
8
9
|
export let configuration;
|
|
9
10
|
export let customCss = undefined;
|
|
10
11
|
export let render;
|
|
11
|
-
const { app } = getContext('AppViewerContext');
|
|
12
|
+
const { app, worldStore } = getContext('AppViewerContext');
|
|
13
|
+
//used so that we can count number of outputs setup for first refresh
|
|
14
|
+
initOutput($worldStore, id, {});
|
|
12
15
|
let icon = undefined;
|
|
13
16
|
let size;
|
|
14
17
|
let color;
|
|
@@ -6,7 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
|
|
7
7
|
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
8
8
|
configuration: RichConfigurations;
|
|
9
|
-
customCss?: ComponentCustomCSS<'
|
|
9
|
+
customCss?: ComponentCustomCSS<'iconcomponent'> | undefined;
|
|
10
10
|
render: boolean;
|
|
11
11
|
};
|
|
12
12
|
events: {
|
|
@@ -1,33 +1,46 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { initConfig, initOutput } from '../../editor/appUtils';
|
|
4
|
+
import { components, selectOptions } from '../../editor/component';
|
|
3
5
|
import { concatCustomCss } from '../../utils';
|
|
4
|
-
import
|
|
6
|
+
import Loader from '../helpers/Loader.svelte';
|
|
7
|
+
import ResolveConfig from '../helpers/ResolveConfig.svelte';
|
|
5
8
|
export let id;
|
|
6
9
|
export let configuration;
|
|
7
10
|
export let customCss = undefined;
|
|
8
11
|
export let render;
|
|
9
|
-
|
|
12
|
+
let resolvedConfig = initConfig(components['imagecomponent'].initialData.configuration, configuration);
|
|
13
|
+
const { app, worldStore } = getContext('AppViewerContext');
|
|
10
14
|
const fit = {
|
|
11
15
|
cover: 'object-cover',
|
|
12
16
|
contain: 'object-contain',
|
|
13
17
|
fill: 'object-fill'
|
|
14
18
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let altText = undefined;
|
|
19
|
+
//used so that we can count number of outputs setup for first refresh
|
|
20
|
+
initOutput($worldStore, id, {});
|
|
18
21
|
$: css = concatCustomCss($app.css?.imagecomponent, customCss);
|
|
19
22
|
</script>
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
+
{#each Object.keys(components['imagecomponent'].initialData.configuration) as key (key)}
|
|
25
|
+
<ResolveConfig
|
|
26
|
+
{id}
|
|
27
|
+
{key}
|
|
28
|
+
bind:resolvedConfig={resolvedConfig[key]}
|
|
29
|
+
configuration={configuration[key]}
|
|
30
|
+
/>
|
|
31
|
+
{/each}
|
|
24
32
|
|
|
25
33
|
{#if render}
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
<Loader loading={resolvedConfig.source == undefined}>
|
|
35
|
+
<img
|
|
36
|
+
on:pointerdown|preventDefault
|
|
37
|
+
src={resolvedConfig.source}
|
|
38
|
+
alt={resolvedConfig.altText}
|
|
39
|
+
style={css?.image?.style ?? ''}
|
|
40
|
+
class={twMerge(
|
|
41
|
+
`w-full h-full ${fit[resolvedConfig.imageFit || 'cover']}`,
|
|
42
|
+
css?.image?.class ?? ''
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
45
|
+
</Loader>
|
|
33
46
|
{/if}
|
|
@@ -14,8 +14,7 @@ export let configuration;
|
|
|
14
14
|
export let customCss = undefined;
|
|
15
15
|
export let render;
|
|
16
16
|
const { app, mode, worldStore, selectedComponent } = getContext('AppViewerContext');
|
|
17
|
-
initOutput($worldStore, id, {
|
|
18
|
-
result: undefined,
|
|
17
|
+
const outputs = initOutput($worldStore, id, {
|
|
19
18
|
loading: false
|
|
20
19
|
});
|
|
21
20
|
let source = undefined;
|
|
@@ -53,6 +52,7 @@ async function loadDocument(src) {
|
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
54
|
try {
|
|
55
|
+
outputs.loading.set(true);
|
|
56
56
|
await resetDoc();
|
|
57
57
|
doc = await getDocument(src).promise;
|
|
58
58
|
pageNumber = 1;
|
|
@@ -64,6 +64,7 @@ async function loadDocument(src) {
|
|
|
64
64
|
error = err?.message ?? (typeof err === 'string' ? err : 'Error loading PDF');
|
|
65
65
|
console.log(err);
|
|
66
66
|
}
|
|
67
|
+
outputs.loading.set(false);
|
|
67
68
|
}
|
|
68
69
|
async function renderPdf(scaleToViewport = true, resizing = false) {
|
|
69
70
|
if (!(doc && wrapper && zoom)) {
|
|
@@ -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
|
+
const outputs = initOutput($worldStore, id, {
|
|
16
16
|
result: undefined,
|
|
17
17
|
loading: false
|
|
18
18
|
});
|
|
@@ -47,7 +47,7 @@ $: css = concatCustomCss($app.css?.piechartcomponent, customCss);
|
|
|
47
47
|
<InputValue {id} input={configuration.theme} bind:value={theme} />
|
|
48
48
|
<InputValue {id} input={configuration.doughnutStyle} bind:value={doughnut} />
|
|
49
49
|
|
|
50
|
-
<RunnableWrapper {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
|
|
50
|
+
<RunnableWrapper {outputs} {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
|
|
51
51
|
<div class="w-full h-full {css?.container?.class ?? ''}" style={css?.container?.style ?? ''}>
|
|
52
52
|
{#if result}
|
|
53
53
|
{#if doughnut}
|
|
@@ -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<'piechartcomponent'> | undefined;
|
|
11
11
|
render: boolean;
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
@@ -15,7 +15,7 @@ export let render;
|
|
|
15
15
|
let zoomable = false;
|
|
16
16
|
let pannable = false;
|
|
17
17
|
const { app, worldStore } = getContext('AppViewerContext');
|
|
18
|
-
initOutput($worldStore, id, {
|
|
18
|
+
const outputs = initOutput($worldStore, id, {
|
|
19
19
|
result: undefined,
|
|
20
20
|
loading: false
|
|
21
21
|
});
|
|
@@ -50,7 +50,7 @@ $: css = concatCustomCss($app.css?.scatterchartcomponent, customCss);
|
|
|
50
50
|
<InputValue {id} input={configuration.zoomable} bind:value={zoomable} />
|
|
51
51
|
<InputValue {id} input={configuration.pannable} bind:value={pannable} />
|
|
52
52
|
|
|
53
|
-
<RunnableWrapper {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
|
|
53
|
+
<RunnableWrapper {outputs} {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
|
|
54
54
|
<div class="w-full h-full {css?.container?.class ?? ''}" style={css?.container?.style ?? ''}>
|
|
55
55
|
{#if result}
|
|
56
56
|
<Scatter {data} {options} />
|
|
@@ -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<'scatterchartcomponent'> | undefined;
|
|
11
11
|
render: boolean;
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
@@ -3,12 +3,15 @@ import { copyToClipboard } from '../../../../utils';
|
|
|
3
3
|
import Button from '../../../common/button/Button.svelte';
|
|
4
4
|
import Popover from '../../../Popover.svelte';
|
|
5
5
|
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
6
|
-
import InputValue from '../helpers/InputValue.svelte';
|
|
7
6
|
import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
|
|
8
7
|
import { twMerge } from 'tailwind-merge';
|
|
9
8
|
import { getContext } from 'svelte';
|
|
10
|
-
import { initOutput } from '../../editor/appUtils';
|
|
9
|
+
import { initConfig, initOutput } from '../../editor/appUtils';
|
|
11
10
|
import Tooltip from '../../../Tooltip.svelte';
|
|
11
|
+
import { get } from 'svelte/store';
|
|
12
|
+
import ResolveConfig from '../helpers/ResolveConfig.svelte';
|
|
13
|
+
import { components } from '../../editor/component';
|
|
14
|
+
import { isCodeInjection } from '../../../flows/utils';
|
|
12
15
|
export let id;
|
|
13
16
|
export let componentInput;
|
|
14
17
|
export let horizontalAlignment = 'left';
|
|
@@ -17,18 +20,20 @@ export let configuration;
|
|
|
17
20
|
export let initializing = undefined;
|
|
18
21
|
export let customCss = undefined;
|
|
19
22
|
export let render;
|
|
23
|
+
let resolvedConfig = initConfig(components['textcomponent'].initialData.configuration, configuration);
|
|
20
24
|
const { app, worldStore, mode } = getContext('AppViewerContext');
|
|
21
|
-
const
|
|
22
|
-
initOutput($worldStore, id, {
|
|
23
|
-
result: undefined,
|
|
24
|
-
loading: false
|
|
25
|
-
});
|
|
25
|
+
const editorcontext = getContext('AppEditorContext');
|
|
26
26
|
let result = undefined;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
if (componentInput?.type == 'template' && !isCodeInjection(componentInput.eval)) {
|
|
28
|
+
result = componentInput.eval;
|
|
29
|
+
initializing = false;
|
|
30
|
+
}
|
|
31
|
+
const outputs = initOutput($worldStore, id, {
|
|
32
|
+
result,
|
|
33
|
+
loading: initializing
|
|
34
|
+
});
|
|
30
35
|
function getComponent() {
|
|
31
|
-
switch (style) {
|
|
36
|
+
switch (resolvedConfig.style) {
|
|
32
37
|
case 'Title':
|
|
33
38
|
return 'h1';
|
|
34
39
|
case 'Subtitle':
|
|
@@ -44,7 +49,7 @@ function getComponent() {
|
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
function getClasses() {
|
|
47
|
-
switch (style) {
|
|
52
|
+
switch (resolvedConfig.style) {
|
|
48
53
|
case 'Caption':
|
|
49
54
|
return 'text-sm italic text-gray-500';
|
|
50
55
|
case 'Label':
|
|
@@ -55,15 +60,20 @@ function getClasses() {
|
|
|
55
60
|
}
|
|
56
61
|
let component = 'p';
|
|
57
62
|
let classes = '';
|
|
58
|
-
$: style && (component = getComponent());
|
|
59
|
-
$: style && (classes = getClasses());
|
|
63
|
+
$: resolvedConfig.style && (component = getComponent());
|
|
64
|
+
$: resolvedConfig.style && (classes = getClasses());
|
|
60
65
|
</script>
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
67
|
+
{#each Object.keys(components['textcomponent'].initialData.configuration) as key (key)}
|
|
68
|
+
<ResolveConfig
|
|
69
|
+
{id}
|
|
70
|
+
{key}
|
|
71
|
+
bind:resolvedConfig={resolvedConfig[key]}
|
|
72
|
+
configuration={configuration[key]}
|
|
73
|
+
/>
|
|
74
|
+
{/each}
|
|
65
75
|
|
|
66
|
-
<RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
|
|
76
|
+
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
67
77
|
<div class="h-full w-full overflow-hidden">
|
|
68
78
|
<AlignWrapper {horizontalAlignment} {verticalAlignment}>
|
|
69
79
|
{#if !result || result === ''}
|
|
@@ -78,7 +88,10 @@ $: style && (classes = getClasses());
|
|
|
78
88
|
: ''}"
|
|
79
89
|
on:click={() => {
|
|
80
90
|
if ($mode === 'dnd' && componentInput?.type == 'template') {
|
|
81
|
-
|
|
91
|
+
let ontextfocus = editorcontext?.ontextfocus
|
|
92
|
+
if (ontextfocus) {
|
|
93
|
+
get(ontextfocus)?.()
|
|
94
|
+
}
|
|
82
95
|
}
|
|
83
96
|
}}
|
|
84
97
|
>
|
|
@@ -93,10 +106,10 @@ $: style && (classes = getClasses());
|
|
|
93
106
|
style={[$app.css?.['textcomponent']?.['text']?.style, customCss?.text?.style].join(';')}
|
|
94
107
|
>
|
|
95
108
|
{String(result)}
|
|
96
|
-
{#if tooltip != ''}
|
|
97
|
-
<Tooltip>{tooltip}</Tooltip>
|
|
109
|
+
{#if resolvedConfig.tooltip != ''}
|
|
110
|
+
<Tooltip>{resolvedConfig.tooltip}</Tooltip>
|
|
98
111
|
{/if}
|
|
99
|
-
{#if copyButton && result}
|
|
112
|
+
{#if resolvedConfig.copyButton && result}
|
|
100
113
|
<Popover notClickable>
|
|
101
114
|
<Button
|
|
102
115
|
variant="border"
|
|
@@ -9,7 +9,7 @@ declare const __propDef: {
|
|
|
9
9
|
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
10
10
|
configuration: RichConfigurations;
|
|
11
11
|
initializing?: boolean | undefined;
|
|
12
|
-
customCss?: ComponentCustomCSS<'
|
|
12
|
+
customCss?: ComponentCustomCSS<'textcomponent'> | undefined;
|
|
13
13
|
render: boolean;
|
|
14
14
|
};
|
|
15
15
|
events: {
|
|
@@ -14,7 +14,7 @@ export let initializing = undefined;
|
|
|
14
14
|
export let customCss = undefined;
|
|
15
15
|
export let render;
|
|
16
16
|
const { app, worldStore } = getContext('AppViewerContext');
|
|
17
|
-
initOutput($worldStore, id, {
|
|
17
|
+
const outputs = initOutput($worldStore, id, {
|
|
18
18
|
result: undefined,
|
|
19
19
|
loading: false
|
|
20
20
|
});
|
|
@@ -61,7 +61,7 @@ $: css = concatCustomCss($app.css?.timeseriescomponent, customCss);
|
|
|
61
61
|
<InputValue {id} input={configuration.zoomable} bind:value={zoomable} />
|
|
62
62
|
<InputValue {id} input={configuration.pannable} bind:value={pannable} />
|
|
63
63
|
|
|
64
|
-
<RunnableWrapper {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
|
|
64
|
+
<RunnableWrapper {outputs} {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
|
|
65
65
|
<div class="w-full h-full {css?.container?.class ?? ''}" style={css?.container?.style ?? ''}>
|
|
66
66
|
{#if result}
|
|
67
67
|
<Scatter {data} {options} />
|
|
@@ -8,7 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
componentInput: AppInput | undefined;
|
|
9
9
|
configuration: RichConfigurations;
|
|
10
10
|
initializing?: boolean | undefined;
|
|
11
|
-
customCss?: ComponentCustomCSS<'
|
|
11
|
+
customCss?: ComponentCustomCSS<'timeseriescomponent'> | undefined;
|
|
12
12
|
render: boolean;
|
|
13
13
|
};
|
|
14
14
|
events: {
|
|
@@ -7,7 +7,7 @@ export let componentInput;
|
|
|
7
7
|
export let initializing = undefined;
|
|
8
8
|
export let render;
|
|
9
9
|
const { worldStore } = getContext('AppViewerContext');
|
|
10
|
-
initOutput($worldStore, id, {
|
|
10
|
+
const outputs = initOutput($worldStore, id, {
|
|
11
11
|
result: undefined,
|
|
12
12
|
loading: false
|
|
13
13
|
});
|
|
@@ -31,7 +31,7 @@ $: Plotly &&
|
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
33
|
<div class="w-full h-full" bind:clientHeight={h} bind:clientWidth={w}>
|
|
34
|
-
<RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
|
|
34
|
+
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
35
35
|
<div on:pointerdown bind:this={divEl} />
|
|
36
36
|
</RunnableWrapper>
|
|
37
37
|
</div>
|
|
@@ -10,7 +10,7 @@ export let render;
|
|
|
10
10
|
let result = undefined;
|
|
11
11
|
let divEl = null;
|
|
12
12
|
const { worldStore } = getContext('AppViewerContext');
|
|
13
|
-
initOutput($worldStore, id, {
|
|
13
|
+
const outputs = initOutput($worldStore, id, {
|
|
14
14
|
result: undefined,
|
|
15
15
|
loading: false
|
|
16
16
|
});
|
|
@@ -46,7 +46,7 @@ $: vegaEmbed &&
|
|
|
46
46
|
<InputValue {id} input={configuration.canvas} bind:value={canvas} />
|
|
47
47
|
|
|
48
48
|
<div class="w-full h-full" bind:clientHeight={h} bind:clientWidth={w}>
|
|
49
|
-
<RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
|
|
49
|
+
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
50
50
|
<div on:pointerdown bind:this={divEl} />
|
|
51
51
|
</RunnableWrapper>
|
|
52
52
|
</div>
|
|
@@ -63,7 +63,7 @@ function onCellValueChanged(event) {
|
|
|
63
63
|
<InputValue {id} input={configuration.pagination} bind:value={pagination} />
|
|
64
64
|
<InputValue {id} input={configuration.pageSize} bind:value={pageSize} />
|
|
65
65
|
|
|
66
|
-
<RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
|
|
66
|
+
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
67
67
|
{#if Array.isArray(result) && result.every(isObject)}
|
|
68
68
|
<div
|
|
69
69
|
class="border border-gray-300 shadow-sm divide-y divide-gray-300 flex flex-col h-full"
|
|
@@ -33,7 +33,7 @@ const options = writable({
|
|
|
33
33
|
columns: []
|
|
34
34
|
});
|
|
35
35
|
let table = createSvelteTable(options);
|
|
36
|
-
const { app, worldStore, componentControl, selectedComponent } = getContext('AppViewerContext');
|
|
36
|
+
const { app, worldStore, componentControl, selectedComponent, hoverStore, mode } = getContext('AppViewerContext');
|
|
37
37
|
let selectedRowIndex = -1;
|
|
38
38
|
function toggleRow(row, rowIndex, force = false) {
|
|
39
39
|
if (selectedRowIndex !== rowIndex || force) {
|
|
@@ -122,7 +122,7 @@ $componentControl[id] = {
|
|
|
122
122
|
|
|
123
123
|
<InputValue {id} input={configuration.search} bind:value={search} />
|
|
124
124
|
|
|
125
|
-
<RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
|
|
125
|
+
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
126
126
|
{#if Array.isArray(result) && result.every(isObject)}
|
|
127
127
|
<div
|
|
128
128
|
class={twMerge(
|
|
@@ -223,11 +223,23 @@ $componentControl[id] = {
|
|
|
223
223
|
<div class="center-center h-full w-full flex-wrap gap-1 ">
|
|
224
224
|
{#each actionButtons as actionButton, actionIndex (actionIndex)}
|
|
225
225
|
<div
|
|
226
|
-
|
|
226
|
+
on:mouseover|stopPropagation={() => {
|
|
227
|
+
if (actionButton.id !== $hoverStore) {
|
|
228
|
+
$hoverStore = actionButton.id
|
|
229
|
+
}
|
|
230
|
+
}}
|
|
231
|
+
on:mouseout|stopPropagation={() => {
|
|
232
|
+
if ($hoverStore !== undefined) {
|
|
233
|
+
$hoverStore = undefined
|
|
234
|
+
}
|
|
235
|
+
}}
|
|
236
|
+
class={(actionButton.id === $selectedComponent ||
|
|
237
|
+
$hoverStore === actionButton.id) &&
|
|
238
|
+
$mode !== 'preview'
|
|
227
239
|
? 'outline outline-indigo-500 outline-1 outline-offset-1 relative '
|
|
228
240
|
: ''}
|
|
229
241
|
>
|
|
230
|
-
{#if actionButton.id === $selectedComponent}
|
|
242
|
+
{#if actionButton.id === $selectedComponent || $hoverStore === actionButton.id}
|
|
231
243
|
<span
|
|
232
244
|
title={`Id: ${actionButton.id}`}
|
|
233
245
|
class={classNames(
|
|
@@ -240,6 +252,7 @@ $componentControl[id] = {
|
|
|
240
252
|
{/if}
|
|
241
253
|
{#if rowIndex == 0}
|
|
242
254
|
<AppButton
|
|
255
|
+
extraKey={'idx' + rowIndex}
|
|
243
256
|
{render}
|
|
244
257
|
noWFull
|
|
245
258
|
{...actionButton}
|
|
@@ -272,6 +285,7 @@ $componentControl[id] = {
|
|
|
272
285
|
/>
|
|
273
286
|
{:else}
|
|
274
287
|
<AppButton
|
|
288
|
+
extraKey={'idx' + rowIndex}
|
|
275
289
|
{render}
|
|
276
290
|
noWFull
|
|
277
291
|
{...actionButton}
|
|
@@ -297,16 +311,18 @@ $componentControl[id] = {
|
|
|
297
311
|
paginationEnabled={pagination}
|
|
298
312
|
{result}
|
|
299
313
|
{table}
|
|
300
|
-
class={css?.tableFooter
|
|
301
|
-
style={css?.tableFooter
|
|
314
|
+
class={css?.tableFooter?.class}
|
|
315
|
+
style={css?.tableFooter?.style}
|
|
302
316
|
/>
|
|
303
317
|
</div>
|
|
304
318
|
{:else if result != undefined}
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
319
|
+
<div class="flex flex-col h-full w-full overflow-auto">
|
|
320
|
+
<Alert title="Parsing issues" type="error" size="xs" class="h-full w-full ">
|
|
321
|
+
The result should be an array of objects. Received:
|
|
322
|
+
<pre class="w-full bg-white p-2 rounded-md">
|
|
323
|
+
{JSON.stringify(result, null, 4)}
|
|
324
|
+
</pre>
|
|
325
|
+
</Alert>
|
|
326
|
+
</div>
|
|
311
327
|
{/if}
|
|
312
328
|
</RunnableWrapper>
|
|
@@ -9,7 +9,7 @@ declare const __propDef: {
|
|
|
9
9
|
configuration: RichConfigurations;
|
|
10
10
|
actionButtons: (BaseAppComponent & ButtonComponent)[];
|
|
11
11
|
initializing?: boolean | undefined;
|
|
12
|
-
customCss?: ComponentCustomCSS<'
|
|
12
|
+
customCss?: ComponentCustomCSS<'tablecomponent'> | undefined;
|
|
13
13
|
render: boolean;
|
|
14
14
|
};
|
|
15
15
|
events: {
|
|
@@ -5,10 +5,10 @@ export let id;
|
|
|
5
5
|
export let name;
|
|
6
6
|
export let inlineScript;
|
|
7
7
|
export let fields;
|
|
8
|
-
export let
|
|
8
|
+
export let doNotRecomputeOnInputChanged = false;
|
|
9
9
|
let result = undefined;
|
|
10
10
|
const { worldStore } = getContext('AppViewerContext');
|
|
11
|
-
initOutput($worldStore, id, {
|
|
11
|
+
let outputs = initOutput($worldStore, id, {
|
|
12
12
|
result: undefined,
|
|
13
13
|
loading: false
|
|
14
14
|
});
|
|
@@ -18,8 +18,10 @@ initOutput($worldStore, id, {
|
|
|
18
18
|
render={false}
|
|
19
19
|
{id}
|
|
20
20
|
{fields}
|
|
21
|
-
{
|
|
21
|
+
autoRefresh={true}
|
|
22
|
+
{doNotRecomputeOnInputChanged}
|
|
22
23
|
bind:result
|
|
24
|
+
transformer={undefined}
|
|
23
25
|
runnable={{
|
|
24
26
|
name,
|
|
25
27
|
inlineScript,
|
|
@@ -27,6 +29,7 @@ initOutput($worldStore, id, {
|
|
|
27
29
|
}}
|
|
28
30
|
wrapperClass="hidden"
|
|
29
31
|
recomputable
|
|
32
|
+
{outputs}
|
|
30
33
|
>
|
|
31
34
|
<slot />
|
|
32
35
|
</RunnableComponent>
|
|
@@ -7,7 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
name: string;
|
|
8
8
|
inlineScript: InlineScript | undefined;
|
|
9
9
|
fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
|
|
10
|
-
|
|
10
|
+
doNotRecomputeOnInputChanged?: boolean | undefined;
|
|
11
11
|
};
|
|
12
12
|
events: {
|
|
13
13
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { isCodeInjection } from '../../../flows/utils';
|
|
2
2
|
import { deepEqual } from 'fast-equals';
|
|
3
|
-
import { createEventDispatcher, getContext } from 'svelte';
|
|
3
|
+
import { createEventDispatcher, getContext, onDestroy } from 'svelte';
|
|
4
4
|
import { accessPropertyByPath } from '../../utils';
|
|
5
5
|
import { computeGlobalContext, eval_like } from './eval';
|
|
6
6
|
export let input;
|
|
@@ -9,14 +9,13 @@ export let id = undefined;
|
|
|
9
9
|
export let error = '';
|
|
10
10
|
export let extraContext = {};
|
|
11
11
|
export let key = '';
|
|
12
|
-
$: console.log(value);
|
|
13
12
|
const { componentControl } = getContext('AppViewerContext');
|
|
14
13
|
const dispatch = createEventDispatcher();
|
|
15
14
|
if (input == undefined) {
|
|
16
15
|
dispatch('done');
|
|
17
16
|
}
|
|
18
17
|
let lastInput = input ? JSON.parse(JSON.stringify(input)) : undefined;
|
|
19
|
-
|
|
18
|
+
onDestroy(() => (lastInput = undefined));
|
|
20
19
|
$: if (input && !deepEqual(input, lastInput)) {
|
|
21
20
|
lastInput = JSON.parse(JSON.stringify(input));
|
|
22
21
|
// Needed because of file uploads
|
|
@@ -49,17 +48,16 @@ $: lastInput &&
|
|
|
49
48
|
$state &&
|
|
50
49
|
debounce(async () => (value = await evalExpr(lastInput)));
|
|
51
50
|
async function handleConnection() {
|
|
52
|
-
|
|
53
|
-
if (lastInput.type === 'connected') {
|
|
51
|
+
if (lastInput?.type === 'connected') {
|
|
54
52
|
$worldStore?.connect(lastInput, onValueChange, `${id}-${key}`);
|
|
55
53
|
}
|
|
56
|
-
else if (lastInput
|
|
54
|
+
else if (lastInput?.type === 'static' || lastInput?.type == 'template') {
|
|
57
55
|
value = await getValue(lastInput);
|
|
58
56
|
}
|
|
59
|
-
else if (lastInput
|
|
57
|
+
else if (lastInput?.type == 'eval') {
|
|
60
58
|
value = await evalExpr(lastInput);
|
|
61
59
|
}
|
|
62
|
-
else if (lastInput
|
|
60
|
+
else if (lastInput?.type == 'upload') {
|
|
63
61
|
value = lastInput.value;
|
|
64
62
|
}
|
|
65
63
|
else {
|
|
@@ -79,6 +77,8 @@ async function evalExpr(input) {
|
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
async function getValue(input) {
|
|
80
|
+
if (!input)
|
|
81
|
+
return;
|
|
82
82
|
if (input.type === 'template' && isCodeInjection(input.eval)) {
|
|
83
83
|
try {
|
|
84
84
|
const r = await eval_like('`' + input.eval + '`', computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
@@ -97,7 +97,7 @@ async function getValue(input) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
function onValueChange(newValue) {
|
|
100
|
-
if (lastInput
|
|
100
|
+
if (lastInput?.type === 'connected' && newValue !== undefined && newValue !== null) {
|
|
101
101
|
const { connection } = lastInput;
|
|
102
102
|
if (!connection) {
|
|
103
103
|
// No connection
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>import { Loader2 } from 'lucide-svelte';
|
|
2
|
+
import { fade } from 'svelte/transition';
|
|
3
|
+
export let loading;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
{#if !loading}
|
|
7
|
+
<slot />
|
|
8
|
+
{:else}
|
|
9
|
+
<div class="w-full h-full">
|
|
10
|
+
<div
|
|
11
|
+
out:fade|local={{ duration: 50 }}
|
|
12
|
+
class="absolute inset-0 center-center flex-col bg-white text-gray-600 border"
|
|
13
|
+
>
|
|
14
|
+
<Loader2 class="animate-spin" size={16} />
|
|
15
|
+
<span class="text-xs mt-1">Loading</span>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
{/if}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {
|
|
10
|
+
default: {};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type LoaderProps = typeof __propDef.props;
|
|
14
|
+
export type LoaderEvents = typeof __propDef.events;
|
|
15
|
+
export type LoaderSlots = typeof __propDef.slots;
|
|
16
|
+
export default class Loader extends SvelteComponentTyped<LoaderProps, LoaderEvents, LoaderSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|