windmill-components 1.82.8 → 1.82.10
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 +6 -0
- package/components/FlowBuilder.svelte +0 -5
- package/components/LightweightArgInput.svelte +5 -0
- package/components/Toggle.svelte +1 -1
- package/components/Toggle.svelte.d.ts +1 -0
- package/components/apps/components/buttons/AppButton.svelte +1 -1
- package/components/apps/components/buttons/AppForm.svelte +1 -0
- package/components/apps/components/buttons/AppFormButton.svelte +1 -0
- package/components/apps/components/display/AppDisplayComponent.svelte +17 -23
- package/components/apps/components/display/AppHtml.svelte +1 -7
- package/components/apps/components/display/AppHtml.svelte.d.ts +0 -2
- package/components/apps/components/display/AppMap.svelte +1 -1
- package/components/apps/components/display/AppPdf.svelte +1 -1
- package/components/apps/components/display/PlotlyHtml.svelte +3 -20
- package/components/apps/components/display/PlotlyHtml.svelte.d.ts +0 -2
- package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
- package/components/apps/components/display/table/AppTable.svelte +6 -6
- package/components/apps/components/helpers/HiddenComponent.svelte +2 -3
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +1 -2
- package/components/apps/components/helpers/RefreshButton.svelte +10 -3
- package/components/apps/components/helpers/RefreshButton.svelte.d.ts +0 -1
- package/components/apps/components/helpers/RunnableComponent.svelte +7 -8
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +1 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte +1 -1
- package/components/apps/components/inputs/AppCheckbox.svelte +4 -0
- package/components/apps/components/inputs/AppDateInput.svelte +2 -2
- package/components/apps/components/inputs/AppMultiSelect.svelte +3 -7
- package/components/apps/components/inputs/AppNumberInput.svelte +3 -3
- package/components/apps/components/inputs/AppSelect.svelte +4 -3
- package/components/apps/components/inputs/AppSliderInputs.svelte +1 -1
- package/components/apps/components/inputs/AppTextInput.svelte +10 -7
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +1 -1
- package/components/apps/components/layout/AppContainer.svelte +2 -2
- package/components/apps/components/layout/AppDrawer.svelte +2 -1
- package/components/apps/components/layout/AppSplitpanes.svelte +3 -3
- package/components/apps/components/layout/AppTabs.svelte +1 -1
- package/components/apps/editor/AppEditor.svelte +9 -35
- package/components/apps/editor/AppEditorHeader.svelte +0 -5
- package/components/apps/editor/AppPreview.svelte +5 -17
- package/components/apps/editor/ComponentHeader.svelte +0 -1
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -1
- package/components/apps/editor/GridEditor.svelte +11 -21
- package/components/apps/editor/GridViewer.svelte +2 -2
- package/components/apps/editor/GridViewer.svelte.d.ts +1 -1
- package/components/apps/editor/RecomputeAllComponents.svelte +7 -5
- package/components/apps/editor/SettingsPanel.svelte +3 -3
- package/components/apps/editor/SubGridEditor.svelte +12 -13
- package/components/apps/editor/appUtils.d.ts +0 -1
- package/components/apps/editor/appUtils.js +0 -19
- package/components/apps/editor/component/Component.svelte +6 -5
- package/components/apps/editor/component/Component.svelte.d.ts +1 -1
- package/components/apps/editor/component/ComponentNavigation.svelte +46 -55
- package/components/apps/editor/component/components.d.ts +26 -9
- package/components/apps/editor/component/components.js +26 -10
- package/components/apps/editor/componentsPanel/ComponentList.svelte +1 -1
- package/components/apps/editor/componentsPanel/CssProperty.svelte +26 -0
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +2 -0
- package/components/apps/editor/componentsPanel/CssSettings.svelte +0 -1
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +10 -13
- package/components/apps/editor/contextPanel/ComponentOutput.svelte +26 -2
- package/components/apps/editor/contextPanel/ComponentOutput.svelte.d.ts +1 -0
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +6 -8
- package/components/apps/editor/contextPanel/ContextPanel.svelte +11 -4
- package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte +25 -2
- package/components/apps/editor/contextPanel/components/MinMaxButton.svelte +25 -0
- package/components/apps/editor/contextPanel/components/MinMaxButton.svelte.d.ts +16 -0
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +40 -29
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte.d.ts +2 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +3 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +2 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +2 -2
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +2 -18
- package/components/apps/editor/settingsPanel/StylePanel.svelte +2 -40
- package/components/apps/editor/settingsPanel/TableActions.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +1 -1
- package/components/apps/inputType.d.ts +2 -2
- package/components/apps/svelte-grid/Grid.svelte +34 -50
- package/components/apps/svelte-grid/Grid.svelte.d.ts +9 -14
- package/components/apps/svelte-grid/MoveResize.svelte +55 -76
- package/components/apps/svelte-grid/MoveResize.svelte.d.ts +9 -15
- package/components/apps/svelte-grid/utils/helper.d.ts +1 -0
- package/components/apps/svelte-grid/utils/helper.js +3 -0
- package/components/apps/types.d.ts +4 -7
- package/components/apps/utils.d.ts +0 -2
- package/components/apps/utils.js +1 -30
- package/infer.js +1 -3
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
3
|
import { initOutput } from '../../editor/appUtils';
|
|
4
|
-
import { concatCustomCss
|
|
4
|
+
import { concatCustomCss } from '../../utils';
|
|
5
5
|
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
6
6
|
import InputValue from '../helpers/InputValue.svelte';
|
|
7
7
|
export let id;
|
|
@@ -33,11 +33,12 @@ $: css = concatCustomCss($app.css?.[appCssKey], customCss);
|
|
|
33
33
|
{#if inputType === 'password'}
|
|
34
34
|
<input
|
|
35
35
|
class={twMerge(
|
|
36
|
-
'windmillapp w-full py-1.5 text-sm focus:ring-indigo-100 px-2 ',
|
|
36
|
+
'windmillapp w-full py-1.5 text-sm focus:ring-indigo-100 px-2 mx-0.5',
|
|
37
37
|
css?.input?.class ?? ''
|
|
38
38
|
)}
|
|
39
39
|
style={css?.input?.style ?? ''}
|
|
40
|
-
on:
|
|
40
|
+
on:focus|stopPropagation={() => ($selectedComponent = id)}
|
|
41
|
+
on:pointerdown|stopPropagation={() => ($selectedComponent = id)}
|
|
41
42
|
type="password"
|
|
42
43
|
bind:value
|
|
43
44
|
{placeholder}
|
|
@@ -45,11 +46,12 @@ $: css = concatCustomCss($app.css?.[appCssKey], customCss);
|
|
|
45
46
|
{:else if inputType === 'text'}
|
|
46
47
|
<input
|
|
47
48
|
class={twMerge(
|
|
48
|
-
'windmillapp w-full py-1.5 text-sm focus:ring-indigo-100 px-2 ',
|
|
49
|
+
'windmillapp w-full py-1.5 text-sm focus:ring-indigo-100 px-2 mx-0.5',
|
|
49
50
|
css?.input?.class ?? ''
|
|
50
51
|
)}
|
|
51
52
|
style={css?.input?.style ?? ''}
|
|
52
|
-
on:
|
|
53
|
+
on:focus={() => ($selectedComponent = id)}
|
|
54
|
+
on:pointerdown|stopPropagation={() => ($selectedComponent = id)}
|
|
53
55
|
type="text"
|
|
54
56
|
bind:value
|
|
55
57
|
{placeholder}
|
|
@@ -57,11 +59,12 @@ $: css = concatCustomCss($app.css?.[appCssKey], customCss);
|
|
|
57
59
|
{:else if inputType === 'email'}
|
|
58
60
|
<input
|
|
59
61
|
class={twMerge(
|
|
60
|
-
'windmillapp w-full py-1.5 text-sm focus:ring-indigo-100 px-2 ',
|
|
62
|
+
'windmillapp w-full py-1.5 text-sm focus:ring-indigo-100 px-2 mx-0.5',
|
|
61
63
|
css?.input?.class ?? ''
|
|
62
64
|
)}
|
|
63
65
|
style={css?.input?.style ?? ''}
|
|
64
|
-
on:
|
|
66
|
+
on:focus={() => ($selectedComponent = id)}
|
|
67
|
+
on:pointerdown|stopPropagation={() => ($selectedComponent = id)}
|
|
65
68
|
type="email"
|
|
66
69
|
bind:value
|
|
67
70
|
{placeholder}
|
|
@@ -40,7 +40,7 @@ $: css = concatCustomCss($app.css?.currencycomponent, customCss);
|
|
|
40
40
|
{#key isNegativeAllowed}
|
|
41
41
|
{#key locale}
|
|
42
42
|
{#key currency}
|
|
43
|
-
<div class="w-full" on:pointerdown|stopPropagation={() => ($selectedComponent =
|
|
43
|
+
<div class="w-full" on:pointerdown|stopPropagation={() => ($selectedComponent = id)}>
|
|
44
44
|
<CurrencyInput
|
|
45
45
|
inputClasses={{
|
|
46
46
|
formatted: twMerge('px-2 w-full py-1.5 windmillapp', css?.input?.class),
|
|
@@ -15,6 +15,7 @@ function onFocus() {
|
|
|
15
15
|
subGridIndex: 0
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
$: $selectedComponent === id && onFocus();
|
|
18
19
|
$: css = concatCustomCss($app.css?.containercomponent, customCss);
|
|
19
20
|
</script>
|
|
20
21
|
|
|
@@ -28,8 +29,7 @@ $: css = concatCustomCss($app.css?.containercomponent, customCss);
|
|
|
28
29
|
subGridId={`${id}-0`}
|
|
29
30
|
containerHeight={componentContainerHeight}
|
|
30
31
|
on:focus={() => {
|
|
31
|
-
$selectedComponent =
|
|
32
|
-
onFocus()
|
|
32
|
+
$selectedComponent = id
|
|
33
33
|
}}
|
|
34
34
|
/>
|
|
35
35
|
{/if}
|
|
@@ -38,6 +38,7 @@ $: css = concatCustomCss($app.css?.containercomponent, customCss);
|
|
|
38
38
|
{disabled}
|
|
39
39
|
on:pointerdown={(e) => {
|
|
40
40
|
e?.stopPropagation()
|
|
41
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
41
42
|
}}
|
|
42
43
|
on:click={async (e) => {
|
|
43
44
|
$focusedGrid = {
|
|
@@ -79,7 +80,7 @@ $: css = concatCustomCss($app.css?.containercomponent, customCss);
|
|
|
79
80
|
subGridId={`${id}-0`}
|
|
80
81
|
containerHeight={1200}
|
|
81
82
|
on:focus={() => {
|
|
82
|
-
$selectedComponent =
|
|
83
|
+
$selectedComponent = id
|
|
83
84
|
}}
|
|
84
85
|
/>
|
|
85
86
|
{/if}
|
|
@@ -19,7 +19,7 @@ function onFocus() {
|
|
|
19
19
|
subGridIndex: 0
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
$: $selectedComponent
|
|
22
|
+
$: $selectedComponent === id && onFocus();
|
|
23
23
|
$: css = concatCustomCss($app.css?.containercomponent, customCss);
|
|
24
24
|
$componentControl[id] = {
|
|
25
25
|
left: () => {
|
|
@@ -60,7 +60,7 @@ $: {
|
|
|
60
60
|
<div
|
|
61
61
|
class="w-full h-full"
|
|
62
62
|
on:pointerdown|stopPropagation={() => {
|
|
63
|
-
$selectedComponent =
|
|
63
|
+
$selectedComponent = id
|
|
64
64
|
$focusedGrid = {
|
|
65
65
|
parentComponentId: id,
|
|
66
66
|
subGridIndex: index
|
|
@@ -77,7 +77,7 @@ $: {
|
|
|
77
77
|
subGridId={`${id}-${index}`}
|
|
78
78
|
containerHeight={horizontal ? undefined : componentContainerHeight - 8}
|
|
79
79
|
on:focus={() => {
|
|
80
|
-
$selectedComponent =
|
|
80
|
+
$selectedComponent = id
|
|
81
81
|
$focusedGrid = {
|
|
82
82
|
parentComponentId: id,
|
|
83
83
|
subGridIndex: index
|
|
@@ -27,8 +27,6 @@ import ItemPicker from '../../ItemPicker.svelte';
|
|
|
27
27
|
import VariableEditor from '../../VariableEditor.svelte';
|
|
28
28
|
import { SecondaryMenu } from './settingsPanel/secondaryMenu';
|
|
29
29
|
import { Component, Paintbrush, Plus } from 'lucide-svelte';
|
|
30
|
-
import { findGridItem, findGridItemParentGrid } from './appUtils';
|
|
31
|
-
import { findItemsById } from '../svelte-grid/utils/matrix';
|
|
32
30
|
export let app;
|
|
33
31
|
export let path;
|
|
34
32
|
export let initialMode = 'dnd';
|
|
@@ -64,7 +62,7 @@ setContext('AppViewerContext', {
|
|
|
64
62
|
mode,
|
|
65
63
|
connectingInput,
|
|
66
64
|
breakpoint,
|
|
67
|
-
runnableComponents
|
|
65
|
+
runnableComponents,
|
|
68
66
|
appPath: path,
|
|
69
67
|
workspace: $workspaceStore ?? '',
|
|
70
68
|
onchange: () => saveDraft(),
|
|
@@ -79,14 +77,13 @@ setContext('AppViewerContext', {
|
|
|
79
77
|
parentWidth: writable(0),
|
|
80
78
|
state: writable({}),
|
|
81
79
|
componentControl: writable({}),
|
|
82
|
-
hoverStore: writable(undefined)
|
|
83
|
-
allIdsInPath: writable([])
|
|
80
|
+
hoverStore: writable(undefined)
|
|
84
81
|
});
|
|
85
82
|
setContext('AppEditorContext', {
|
|
86
83
|
history,
|
|
87
84
|
pickVariableCallback,
|
|
88
85
|
ontextfocus: writable(undefined),
|
|
89
|
-
|
|
86
|
+
movingcomponent: writable(undefined),
|
|
90
87
|
selectedComponentInEditor: writable(undefined)
|
|
91
88
|
});
|
|
92
89
|
let timeout = undefined;
|
|
@@ -113,36 +110,11 @@ function hashchange(e) {
|
|
|
113
110
|
$: previewing = $mode === 'preview';
|
|
114
111
|
$: width = $breakpoint === 'sm' ? 'min-w-[400px] max-w-[656px]' : 'min-w-[710px] w-full';
|
|
115
112
|
let selectedTab = 'insert';
|
|
116
|
-
|
|
117
|
-
$: if ($selectedComponent?.[0] != befSelected) {
|
|
118
|
-
befSelected = $selectedComponent?.[0];
|
|
113
|
+
$: if ($selectedComponent) {
|
|
119
114
|
selectedTab = 'settings';
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (item?.data.type === 'containercomponent') {
|
|
124
|
-
$focusedGrid = {
|
|
125
|
-
parentComponentId: befSelected,
|
|
126
|
-
subGridIndex: 0
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
let subgrid = findGridItemParentGrid($appStore, befSelected);
|
|
131
|
-
if (subgrid) {
|
|
132
|
-
try {
|
|
133
|
-
$focusedGrid = {
|
|
134
|
-
parentComponentId: subgrid.split('-')[0],
|
|
135
|
-
subGridIndex: parseInt(subgrid.split('-')[1])
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
catch { }
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
$focusedGrid = undefined;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
selectedTab = 'insert';
|
|
146
118
|
}
|
|
147
119
|
let itemPicker = undefined;
|
|
148
120
|
$: if ($pickVariableCallback) {
|
|
@@ -236,6 +208,7 @@ let variableEditor = undefined;
|
|
|
236
208
|
<Tab value="insert" size="xs">
|
|
237
209
|
<div class="m-1 center-center gap-1">
|
|
238
210
|
<Plus size={18} />
|
|
211
|
+
<span>Insert</span>
|
|
239
212
|
</div>
|
|
240
213
|
</Tab>
|
|
241
214
|
<Tab value="settings" size="xs">
|
|
@@ -247,6 +220,7 @@ let variableEditor = undefined;
|
|
|
247
220
|
<Tab value="css" size="xs">
|
|
248
221
|
<div class="m-1 center-center gap-1">
|
|
249
222
|
<Paintbrush size={18} />
|
|
223
|
+
<span>Styling</span>
|
|
250
224
|
</div>
|
|
251
225
|
</Tab>
|
|
252
226
|
<div slot="content" class="h-full overflow-y-auto">
|
|
@@ -177,11 +177,6 @@ let lock = false;
|
|
|
177
177
|
function onKeyDown(event) {
|
|
178
178
|
if (lock)
|
|
179
179
|
return;
|
|
180
|
-
let classes = event.target?.['className'];
|
|
181
|
-
if ((typeof classes === 'string' && classes.includes('inputarea')) ||
|
|
182
|
-
['INPUT', 'TEXTAREA'].includes(document.activeElement?.tagName)) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
180
|
lock = true;
|
|
186
181
|
switch (event.key) {
|
|
187
182
|
case 'Z':
|
|
@@ -10,8 +10,6 @@ import { Component } from './component';
|
|
|
10
10
|
import { twMerge } from 'tailwind-merge';
|
|
11
11
|
import { columnConfiguration } from '../gridUtils';
|
|
12
12
|
import { HiddenComponent } from '../components';
|
|
13
|
-
import { deepEqual } from 'fast-equals';
|
|
14
|
-
import { dfs } from './appUtils';
|
|
15
13
|
export let app;
|
|
16
14
|
export let appPath;
|
|
17
15
|
export let breakpoint;
|
|
@@ -30,7 +28,7 @@ const connectingInput = writable({
|
|
|
30
28
|
input: undefined,
|
|
31
29
|
hoveredComponent: undefined
|
|
32
30
|
});
|
|
33
|
-
const
|
|
31
|
+
const runnableComponents = writable({});
|
|
34
32
|
const parentWidth = writable(0);
|
|
35
33
|
setContext('AppViewerContext', {
|
|
36
34
|
worldStore: buildWorld(context),
|
|
@@ -40,7 +38,7 @@ setContext('AppViewerContext', {
|
|
|
40
38
|
mode,
|
|
41
39
|
connectingInput,
|
|
42
40
|
breakpoint,
|
|
43
|
-
runnableComponents
|
|
41
|
+
runnableComponents,
|
|
44
42
|
appPath,
|
|
45
43
|
workspace,
|
|
46
44
|
onchange: undefined,
|
|
@@ -55,21 +53,13 @@ setContext('AppViewerContext', {
|
|
|
55
53
|
parentWidth,
|
|
56
54
|
state: writable({}),
|
|
57
55
|
componentControl: writable({}),
|
|
58
|
-
hoverStore: writable(undefined)
|
|
59
|
-
allIdsInPath
|
|
56
|
+
hoverStore: writable(undefined)
|
|
60
57
|
});
|
|
61
58
|
let ncontext = context;
|
|
62
59
|
function hashchange(e) {
|
|
63
60
|
ncontext.hash = e.newURL.split('#')[1];
|
|
64
61
|
ncontext = ncontext;
|
|
65
62
|
}
|
|
66
|
-
let previousSelectedIds = undefined;
|
|
67
|
-
$: if (!deepEqual(previousSelectedIds, $selectedComponent)) {
|
|
68
|
-
previousSelectedIds = $selectedComponent;
|
|
69
|
-
$allIdsInPath = ($selectedComponent ?? [])
|
|
70
|
-
.flatMap((id) => dfs(app.grid, id, app.subgrids ?? {}))
|
|
71
|
-
.filter((x) => x != undefined);
|
|
72
|
-
}
|
|
73
63
|
$: width = $breakpoint === 'sm' ? 'max-w-[640px]' : 'w-full ';
|
|
74
64
|
$: lockedClasses = isLocked ? '!max-h-[400px] overflow-hidden pointer-events-none' : '';
|
|
75
65
|
</script>
|
|
@@ -110,7 +100,7 @@ $: lockedClasses = isLocked ? '!max-h-[400px] overflow-hidden pointer-events-non
|
|
|
110
100
|
>
|
|
111
101
|
<div>
|
|
112
102
|
<GridViewer
|
|
113
|
-
|
|
103
|
+
onTopId={$selectedComponent}
|
|
114
104
|
items={app.grid}
|
|
115
105
|
let:dataItem
|
|
116
106
|
rowHeight={36}
|
|
@@ -120,7 +110,7 @@ $: lockedClasses = isLocked ? '!max-h-[400px] overflow-hidden pointer-events-non
|
|
|
120
110
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
121
111
|
<div
|
|
122
112
|
class={'h-full w-full center-center'}
|
|
123
|
-
on:pointerdown={() => ($selectedComponent =
|
|
113
|
+
on:pointerdown={() => ($selectedComponent = dataItem.id)}
|
|
124
114
|
>
|
|
125
115
|
<Component render={true} component={dataItem.data} selected={false} locked={true} />
|
|
126
116
|
</div>
|
|
@@ -151,8 +141,6 @@ $: lockedClasses = isLocked ? '!max-h-[400px] overflow-hidden pointer-events-non
|
|
|
151
141
|
inlineScript={script.inlineScript}
|
|
152
142
|
name={script.name}
|
|
153
143
|
fields={script.fields}
|
|
154
|
-
doNotRecomputeOnInputChanged={script.doNotRecomputeOnInputChanged ?? false}
|
|
155
|
-
recomputableByRefreshButton={script.autoRefresh ?? false}
|
|
156
144
|
/>
|
|
157
145
|
{/if}
|
|
158
146
|
{/each}
|
|
@@ -6,20 +6,12 @@ import RecomputeAllComponents from './RecomputeAllComponents.svelte';
|
|
|
6
6
|
import HiddenComponent from '../components/helpers/HiddenComponent.svelte';
|
|
7
7
|
import Component from './component/Component.svelte';
|
|
8
8
|
import { push } from '../../../history';
|
|
9
|
-
import {
|
|
9
|
+
import { expandGriditem, findGridItem } from './appUtils';
|
|
10
10
|
import Grid from '../svelte-grid/Grid.svelte';
|
|
11
|
-
import
|
|
12
|
-
import { deepEqual } from 'fast-equals';
|
|
11
|
+
import Toggle from '../../Toggle.svelte';
|
|
13
12
|
export let policy;
|
|
14
|
-
const { selectedComponent, app, mode, connectingInput, runnableComponents, summary, focusedGrid, parentWidth, breakpoint
|
|
13
|
+
const { selectedComponent, app, mode, connectingInput, runnableComponents, summary, focusedGrid, parentWidth, breakpoint } = getContext('AppViewerContext');
|
|
15
14
|
const { history } = getContext('AppEditorContext');
|
|
16
|
-
let previousSelectedIds = undefined;
|
|
17
|
-
$: if (!deepEqual(previousSelectedIds, $selectedComponent)) {
|
|
18
|
-
previousSelectedIds = $selectedComponent;
|
|
19
|
-
$allIdsInPath = ($selectedComponent ?? [])
|
|
20
|
-
.flatMap((id) => dfs($app.grid, id, $app.subgrids ?? {}))
|
|
21
|
-
.filter((x) => x != undefined);
|
|
22
|
-
}
|
|
23
15
|
function removeGridElement(component) {
|
|
24
16
|
if (component) {
|
|
25
17
|
$app.grid = $app.grid.filter((gridComponent) => {
|
|
@@ -45,9 +37,9 @@ function removeGridElement(component) {
|
|
|
45
37
|
$selectedComponent = undefined;
|
|
46
38
|
}
|
|
47
39
|
}
|
|
48
|
-
function selectComponent(
|
|
40
|
+
function selectComponent(id) {
|
|
49
41
|
if (!$connectingInput.opened) {
|
|
50
|
-
|
|
42
|
+
$selectedComponent = id;
|
|
51
43
|
if ($focusedGrid?.parentComponentId != id) {
|
|
52
44
|
$focusedGrid = undefined;
|
|
53
45
|
}
|
|
@@ -89,8 +81,7 @@ function selectComponent(e, id) {
|
|
|
89
81
|
>
|
|
90
82
|
<div class={!$focusedGrid && $mode !== 'preview' ? 'border-gray-400 border border-dashed' : ''}>
|
|
91
83
|
<Grid
|
|
92
|
-
|
|
93
|
-
selectedIds={$selectedComponent}
|
|
84
|
+
onTopId={$selectedComponent}
|
|
94
85
|
items={$app.grid}
|
|
95
86
|
on:redraw={(e) => {
|
|
96
87
|
push(history, $app)
|
|
@@ -118,16 +109,16 @@ function selectComponent(e, id) {
|
|
|
118
109
|
{/if}
|
|
119
110
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
120
111
|
<div
|
|
121
|
-
on:pointerdown={(
|
|
112
|
+
on:pointerdown={() => selectComponent(dataItem.id)}
|
|
122
113
|
class={classNames(
|
|
123
114
|
'h-full w-full center-center',
|
|
124
|
-
|
|
115
|
+
$selectedComponent === dataItem.id ? 'active-grid-item' : ''
|
|
125
116
|
)}
|
|
126
117
|
>
|
|
127
118
|
<Component
|
|
128
119
|
render={true}
|
|
129
120
|
component={dataItem.data}
|
|
130
|
-
selected={
|
|
121
|
+
selected={$selectedComponent === dataItem.id}
|
|
131
122
|
locked={isFixed(dataItem)}
|
|
132
123
|
on:delete={() => removeGridElement(dataItem.data)}
|
|
133
124
|
on:lock={() => {
|
|
@@ -139,7 +130,7 @@ function selectComponent(e, id) {
|
|
|
139
130
|
}}
|
|
140
131
|
on:expand={() => {
|
|
141
132
|
push(history, $app)
|
|
142
|
-
$selectedComponent =
|
|
133
|
+
$selectedComponent = dataItem.id
|
|
143
134
|
expandGriditem($app.grid, dataItem.id, $breakpoint)
|
|
144
135
|
$app = $app
|
|
145
136
|
}}
|
|
@@ -158,8 +149,7 @@ function selectComponent(e, id) {
|
|
|
158
149
|
inlineScript={script.inlineScript}
|
|
159
150
|
name={script.name}
|
|
160
151
|
fields={script.fields}
|
|
161
|
-
doNotRecomputeOnInputChanged={script.doNotRecomputeOnInputChanged
|
|
162
|
-
recomputableByRefreshButton={script.autoRefresh ?? false}
|
|
152
|
+
doNotRecomputeOnInputChanged={script.doNotRecomputeOnInputChanged}
|
|
163
153
|
/>
|
|
164
154
|
{/if}
|
|
165
155
|
{/each}
|
|
@@ -8,7 +8,7 @@ export let rowHeight;
|
|
|
8
8
|
export let cols;
|
|
9
9
|
export let gap = [10, 10];
|
|
10
10
|
export let throttleUpdate = 100;
|
|
11
|
-
export let
|
|
11
|
+
export let onTopId = undefined;
|
|
12
12
|
export let containerWidth = undefined;
|
|
13
13
|
export let parentWidth = undefined;
|
|
14
14
|
let getComputedCols;
|
|
@@ -56,7 +56,7 @@ onMount(() => {
|
|
|
56
56
|
<div class="svlt-grid-container" style="height: {containerHeight}px" bind:this={container}>
|
|
57
57
|
{#if xPerPx}
|
|
58
58
|
{#each items as item (item.id)}
|
|
59
|
-
{@const onTop =
|
|
59
|
+
{@const onTop = item.id == onTopId}
|
|
60
60
|
{@const width =
|
|
61
61
|
Math.min(getComputedCols, item[getComputedCols] && item[getComputedCols].w) * xPerPx -
|
|
62
62
|
gapX * 2}
|
|
@@ -7,7 +7,7 @@ declare class __sveltets_Render<T> {
|
|
|
7
7
|
cols: [number, number][];
|
|
8
8
|
gap?: number[] | undefined;
|
|
9
9
|
throttleUpdate?: number | undefined;
|
|
10
|
-
|
|
10
|
+
onTopId?: string | undefined;
|
|
11
11
|
containerWidth?: number | undefined;
|
|
12
12
|
parentWidth?: number | undefined;
|
|
13
13
|
};
|
|
@@ -13,7 +13,7 @@ $: !firstLoad &&
|
|
|
13
13
|
$worldStore.initializedOutputs ==
|
|
14
14
|
allItems($app.grid, $app.subgrids).length + $app.hiddenInlineScripts.length &&
|
|
15
15
|
refresh();
|
|
16
|
-
$: componentNumber = Object.
|
|
16
|
+
$: componentNumber = Object.keys($runnableComponents).length;
|
|
17
17
|
function onClick(stopAfterClear = true) {
|
|
18
18
|
if (timeout) {
|
|
19
19
|
clearInterval(timeout);
|
|
@@ -39,10 +39,13 @@ function refresh() {
|
|
|
39
39
|
}
|
|
40
40
|
loading = true;
|
|
41
41
|
Promise.all(Object.keys($runnableComponents).map((id) => {
|
|
42
|
-
if (
|
|
43
|
-
|
|
42
|
+
if (id.startsWith('bg_')) {
|
|
43
|
+
let index = parseInt(id.split('_')[1]);
|
|
44
|
+
if (!$app.hiddenInlineScripts[index]?.autoRefresh) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
44
47
|
}
|
|
45
|
-
return $runnableComponents?.[id]?.
|
|
48
|
+
return $runnableComponents?.[id]?.();
|
|
46
49
|
})).finally(() => {
|
|
47
50
|
loading = false;
|
|
48
51
|
});
|
|
@@ -71,7 +74,6 @@ onMount(() => {
|
|
|
71
74
|
|
|
72
75
|
<div class="flex items-center">
|
|
73
76
|
<Button
|
|
74
|
-
disabled={componentNumber == 0}
|
|
75
77
|
on:click={() => onClick()}
|
|
76
78
|
color={timeout ? 'blue' : 'light'}
|
|
77
79
|
variant={timeout ? 'contained' : 'border'}
|
|
@@ -10,9 +10,9 @@ import BackgroundScriptTriggerList from './settingsPanel/triggerLists/Background
|
|
|
10
10
|
const { selectedComponent, app, stateId } = getContext('AppViewerContext');
|
|
11
11
|
$: hiddenInlineScript = $app?.hiddenInlineScripts
|
|
12
12
|
?.map((x, i) => ({ script: x, index: i }))
|
|
13
|
-
.find(({ script, index }) =>
|
|
14
|
-
$: componentSettings = findComponentSettings($app, $selectedComponent
|
|
15
|
-
$: tableActionSettings = findTableActionSettings($app, $selectedComponent
|
|
13
|
+
.find(({ script, index }) => `bg_${index}` === $selectedComponent);
|
|
14
|
+
$: componentSettings = findComponentSettings($app, $selectedComponent);
|
|
15
|
+
$: tableActionSettings = findTableActionSettings($app, $selectedComponent);
|
|
16
16
|
function findTableActionSettings(app, id) {
|
|
17
17
|
return allItems(app.grid, app.subgrids)
|
|
18
18
|
.map((x) => {
|
|
@@ -7,7 +7,6 @@ import { expandGriditem, findGridItem } from './appUtils';
|
|
|
7
7
|
import { push } from '../../../history';
|
|
8
8
|
import Grid from '../svelte-grid/Grid.svelte';
|
|
9
9
|
import GridViewer from './GridViewer.svelte';
|
|
10
|
-
import { selectId } from '../utils';
|
|
11
10
|
export let containerHeight = undefined;
|
|
12
11
|
export let containerWidth = undefined;
|
|
13
12
|
let classes = '';
|
|
@@ -20,15 +19,16 @@ export let visible = true;
|
|
|
20
19
|
export let id;
|
|
21
20
|
export let shouldHighlight = true;
|
|
22
21
|
const dispatch = createEventDispatcher();
|
|
23
|
-
const { app, connectingInput, selectedComponent, focusedGrid, mode, parentWidth, breakpoint
|
|
22
|
+
const { app, connectingInput, selectedComponent, focusedGrid, mode, parentWidth, breakpoint } = getContext('AppViewerContext');
|
|
24
23
|
const editorContext = getContext('AppEditorContext');
|
|
25
24
|
$: highlight = id === $focusedGrid?.parentComponentId && shouldHighlight;
|
|
26
25
|
const onpointerdown = (e) => {
|
|
27
26
|
dispatch('focus');
|
|
28
27
|
};
|
|
29
|
-
function selectComponent(
|
|
28
|
+
function selectComponent(id) {
|
|
30
29
|
if (!$connectingInput.opened) {
|
|
31
|
-
|
|
30
|
+
dispatch('focus');
|
|
31
|
+
$selectedComponent = id;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
function lock(dataItem) {
|
|
@@ -60,7 +60,6 @@ let container = undefined;
|
|
|
60
60
|
{#if $mode !== 'preview'}
|
|
61
61
|
<div class={highlight ? 'border-gray-400 border border-dashed min-h-full' : ''}>
|
|
62
62
|
<Grid
|
|
63
|
-
allIdsInPath={$allIdsInPath}
|
|
64
63
|
items={$app.subgrids?.[subGridId] ?? []}
|
|
65
64
|
on:redraw={(e) => {
|
|
66
65
|
push(editorContext?.history, $app)
|
|
@@ -68,7 +67,7 @@ let container = undefined;
|
|
|
68
67
|
$app.subgrids[subGridId] = e.detail
|
|
69
68
|
}
|
|
70
69
|
}}
|
|
71
|
-
|
|
70
|
+
onTopId={$selectedComponent}
|
|
72
71
|
let:dataItem
|
|
73
72
|
rowHeight={36}
|
|
74
73
|
cols={columnConfiguration}
|
|
@@ -95,17 +94,17 @@ let container = undefined;
|
|
|
95
94
|
|
|
96
95
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
97
96
|
<div
|
|
98
|
-
on:pointerdown={(
|
|
97
|
+
on:pointerdown={() => selectComponent(dataItem.id)}
|
|
99
98
|
class={classNames(
|
|
100
99
|
'h-full w-full center-center',
|
|
101
|
-
$selectedComponent
|
|
100
|
+
$selectedComponent === dataItem.id ? 'active-grid-item' : '',
|
|
102
101
|
'top-0'
|
|
103
102
|
)}
|
|
104
103
|
>
|
|
105
104
|
<Component
|
|
106
105
|
render={visible}
|
|
107
106
|
component={dataItem.data}
|
|
108
|
-
selected={
|
|
107
|
+
selected={$selectedComponent === dataItem.id}
|
|
109
108
|
locked={isFixed(dataItem)}
|
|
110
109
|
on:lock={() => lock(dataItem)}
|
|
111
110
|
on:expand={() => {
|
|
@@ -114,7 +113,7 @@ let container = undefined;
|
|
|
114
113
|
if (!parentGridItem) {
|
|
115
114
|
return
|
|
116
115
|
}
|
|
117
|
-
$selectedComponent =
|
|
116
|
+
$selectedComponent = dataItem.id
|
|
118
117
|
push(editorContext?.history, $app)
|
|
119
118
|
|
|
120
119
|
expandGriditem(
|
|
@@ -131,7 +130,7 @@ let container = undefined;
|
|
|
131
130
|
</div>
|
|
132
131
|
{:else}
|
|
133
132
|
<GridViewer
|
|
134
|
-
|
|
133
|
+
onTopId={$selectedComponent}
|
|
135
134
|
items={$app.subgrids?.[subGridId] ?? []}
|
|
136
135
|
let:dataItem
|
|
137
136
|
rowHeight={36}
|
|
@@ -142,13 +141,13 @@ let container = undefined;
|
|
|
142
141
|
>
|
|
143
142
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
144
143
|
<div
|
|
145
|
-
on:pointerdown
|
|
144
|
+
on:pointerdown={() => selectComponent(dataItem.id)}
|
|
146
145
|
class={classNames('h-full w-full center-center', 'top-0')}
|
|
147
146
|
>
|
|
148
147
|
<Component
|
|
149
148
|
render={visible}
|
|
150
149
|
component={dataItem.data}
|
|
151
|
-
selected={
|
|
150
|
+
selected={$selectedComponent === dataItem.id}
|
|
152
151
|
locked={isFixed(dataItem)}
|
|
153
152
|
/>
|
|
154
153
|
</div>
|
|
@@ -3,7 +3,6 @@ import { components, type AppComponent, type BaseComponent } from './component';
|
|
|
3
3
|
import type { Output, World } from '../rx';
|
|
4
4
|
import type { FilledItem } from '../svelte-grid/types';
|
|
5
5
|
import type { EvalAppInput, StaticAppInput } from '../inputType';
|
|
6
|
-
export declare function dfs(grid: GridItem[], id: string, subgrids: Record<string, GridItem[]>): string[] | undefined;
|
|
7
6
|
export declare function findGridItemParentGrid(app: App, id: string): string | undefined;
|
|
8
7
|
export declare function allsubIds(app: App, parentId: string): string[];
|
|
9
8
|
export declare function findGridItem(app: App, id: string): GridItem | undefined;
|
|
@@ -3,25 +3,6 @@ import { ccomponents, components, getRecommendedDimensionsByComponent } from './
|
|
|
3
3
|
import { gridColumns } from '../gridUtils';
|
|
4
4
|
import { allItems } from '../utils';
|
|
5
5
|
import gridHelp from '../svelte-grid/utils/helper';
|
|
6
|
-
export function dfs(grid, id, subgrids) {
|
|
7
|
-
for (const item of grid) {
|
|
8
|
-
if (item.id === id) {
|
|
9
|
-
return [id];
|
|
10
|
-
}
|
|
11
|
-
else if (item.data.type == 'tablecomponent' && item.data.actionButtons.find((x) => x.id)) {
|
|
12
|
-
return [item.id, id];
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
for (let i = 0; i < (item.data.numberOfSubgrids ?? 0); i++) {
|
|
16
|
-
const res = dfs(subgrids[`${item.id}-${i}`], id, subgrids);
|
|
17
|
-
if (res) {
|
|
18
|
-
return [item.id, ...res];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
6
|
function findGridItemById(root, subGrids, id) {
|
|
26
7
|
for (const gridItem of allItems(root, subGrids)) {
|
|
27
8
|
if (gridItem.id === id) {
|