windmill-components 1.82.4 → 1.82.5
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/common.d.ts +2 -2
- package/components/ArgInput.svelte +72 -52
- package/components/ArgInput.svelte.d.ts +3 -1
- package/components/DisplayResult.svelte +17 -17
- package/components/Editor.svelte +3 -0
- package/components/Editor.svelte.d.ts +1 -0
- package/components/FieldHeader.svelte +1 -0
- package/components/FieldHeader.svelte.d.ts +4 -0
- package/components/FlowBuilder.svelte +0 -6
- package/components/FlowStatusViewer.svelte +4 -7
- package/components/FlowStatusViewer.svelte.d.ts +0 -1
- package/components/FlowViewer.svelte +1 -0
- package/components/InputTransformForm.svelte +1 -0
- package/components/LightweightArgInput.svelte +14 -1
- package/components/LightweightArgInput.svelte.d.ts +3 -1
- package/components/Multiselect.svelte.d.ts +2 -2
- package/components/SimpleEditor.svelte +1 -0
- package/components/SimpleEditor.svelte.d.ts +1 -0
- package/components/TemplateEditor.svelte +1 -0
- package/components/Toggle.svelte +1 -1
- package/components/Toggle.svelte.d.ts +1 -0
- package/components/apps/components/buttons/AppButton.svelte +17 -3
- package/components/apps/components/buttons/AppForm.svelte +10 -2
- package/components/apps/components/buttons/AppFormButton.svelte +82 -58
- 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 +49 -75
- package/components/apps/components/display/table/AppTable.svelte.d.ts +1 -1
- package/components/apps/components/display/table/AppTableFooter.svelte +1 -2
- package/components/apps/components/display/table/AppTableFooter.svelte.d.ts +0 -1
- package/components/apps/components/display/table/tableOptions.js +1 -1
- package/components/apps/components/helpers/DebouncedInput.svelte +0 -1
- package/components/apps/components/helpers/DebouncedInput.svelte.d.ts +0 -2
- 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/InputValue.svelte +3 -3
- 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 +15 -19
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +1 -2
- package/components/apps/components/helpers/RunnableWrapper.svelte +1 -3
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +0 -1
- package/components/apps/components/helpers/eval.d.ts +2 -4
- package/components/apps/components/helpers/eval.js +4 -6
- 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 +5 -13
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +2 -0
- package/components/apps/components/inputs/AppNumberInput.svelte +3 -3
- package/components/apps/components/inputs/AppSelect.svelte +4 -11
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +2 -0
- package/components/apps/components/inputs/AppSliderInputs.svelte +1 -1
- package/components/apps/components/inputs/AppTextInput.svelte +43 -53
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -1
- 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 +21 -49
- package/components/apps/editor/AppEditorHeader.svelte +0 -5
- package/components/apps/editor/AppPreview.svelte +7 -18
- package/components/apps/editor/ComponentHeader.svelte +0 -1
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -1
- package/components/apps/editor/GridEditor.svelte +12 -22
- 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 +4 -4
- 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 +8 -19
- package/components/apps/editor/component/Component.svelte.d.ts +1 -1
- package/components/apps/editor/component/ComponentNavigation.svelte +47 -57
- package/components/apps/editor/component/README.md +0 -4
- package/components/apps/editor/component/components.d.ts +28 -45
- package/components/apps/editor/component/components.js +27 -41
- package/components/apps/editor/component/sets.js +1 -2
- package/components/apps/editor/componentsPanel/ComponentList.svelte +1 -1
- package/components/apps/editor/componentsPanel/CssProperty.svelte +48 -62
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +2 -3
- package/components/apps/editor/componentsPanel/CssSettings.svelte +0 -1
- package/components/apps/editor/componentsPanel/store.js +4 -4
- 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 +14 -7
- 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/EmptyInlineScript.svelte +7 -2
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +11 -10
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +3 -4
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +0 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +2 -2
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +0 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +19 -22
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +13 -42
- package/components/apps/editor/settingsPanel/GridTab.svelte +2 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +1 -2
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +0 -4
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +0 -1
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +2 -1
- package/components/apps/editor/settingsPanel/TableActions.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte +12 -12
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +2 -3
- package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +1 -5
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +2 -3
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +1 -4
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +3 -3
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +1 -1
- package/components/apps/inputType.d.ts +2 -2
- package/components/apps/rx.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 +5 -9
- package/components/apps/utils.d.ts +0 -2
- package/components/apps/utils.js +1 -33
- package/components/common/button/ButtonPopup.svelte +2 -5
- package/components/common/button/ButtonPopup.svelte.d.ts +1 -5
- package/components/common/button/ButtonPopupItem.svelte +1 -2
- package/components/common/button/ButtonPopupItem.svelte.d.ts +0 -1
- package/components/common/index.d.ts +0 -1
- package/components/common/index.js +0 -1
- package/components/common/kbd/Kbd.svelte +1 -4
- package/components/common/kbd/Kbd.svelte.d.ts +14 -6
- package/components/common/menu/Menu.svelte +2 -8
- package/components/common/menu/Menu.svelte.d.ts +1 -4
- package/components/flows/map/MapItem.svelte +3 -3
- package/components/propertyPicker/ObjectViewer.svelte +3 -0
- package/components/scriptEditor/LogPanel.svelte +3 -3
- package/infer.js +1 -6
- package/package.json +2 -11
- package/utils.d.ts +0 -1
- package/utils.js +0 -3
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +0 -170
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte.d.ts +0 -18
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte +0 -130
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte.d.ts +0 -21
- package/components/apps/editor/componentsPanel/quickStyleProperties.d.ts +0 -535
- package/components/apps/editor/componentsPanel/quickStyleProperties.js +0 -598
- package/components/apps/editor/settingsPanel/StylePanel.svelte +0 -61
- package/components/apps/editor/settingsPanel/StylePanel.svelte.d.ts +0 -17
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte +0 -47
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte.d.ts +0 -14
- package/components/apps/editor/settingsPanel/secondaryMenu/index.d.ts +0 -2
- package/components/apps/editor/settingsPanel/secondaryMenu/index.js +0 -2
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.d.ts +0 -12
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.js +0 -10
- package/components/common/clearableInput/ClearableInput.svelte +0 -56
- package/components/common/clearableInput/ClearableInput.svelte.d.ts +0 -28
- package/components/common/modal/AlwaysMountedModal.svelte +0 -109
- package/components/common/modal/AlwaysMountedModal.svelte.d.ts +0 -22
|
@@ -9,11 +9,9 @@ import DebouncedInput from '../../helpers/DebouncedInput.svelte';
|
|
|
9
9
|
import AppTableFooter from './AppTableFooter.svelte';
|
|
10
10
|
import { tableOptions } from './tableOptions';
|
|
11
11
|
import Alert from '../../../../common/alert/Alert.svelte';
|
|
12
|
-
import { components } from '../../../editor/component';
|
|
13
12
|
import { concatCustomCss } from '../../../utils';
|
|
14
13
|
import { twMerge } from 'tailwind-merge';
|
|
15
|
-
import {
|
|
16
|
-
import ResolveConfig from '../../helpers/ResolveConfig.svelte';
|
|
14
|
+
import { initOutput } from '../../../editor/appUtils';
|
|
17
15
|
export let id;
|
|
18
16
|
export let componentInput;
|
|
19
17
|
export let configuration;
|
|
@@ -22,16 +20,9 @@ export let initializing = undefined;
|
|
|
22
20
|
export let customCss = undefined;
|
|
23
21
|
export let render;
|
|
24
22
|
let result = undefined;
|
|
25
|
-
|
|
23
|
+
let search = undefined;
|
|
26
24
|
let searchValue = '';
|
|
27
|
-
let
|
|
28
|
-
selectedRowIndex: 0,
|
|
29
|
-
selectedRow: undefined,
|
|
30
|
-
loading: false,
|
|
31
|
-
result: [],
|
|
32
|
-
search: '',
|
|
33
|
-
page: 1
|
|
34
|
-
});
|
|
25
|
+
let pagination = true;
|
|
35
26
|
$: setSearch(searchValue);
|
|
36
27
|
function setSearch(srch) {
|
|
37
28
|
outputs?.search?.set(srch);
|
|
@@ -42,7 +33,7 @@ const options = writable({
|
|
|
42
33
|
columns: []
|
|
43
34
|
});
|
|
44
35
|
let table = createSvelteTable(options);
|
|
45
|
-
|
|
36
|
+
const { app, worldStore, componentControl, selectedComponent, hoverStore, mode } = getContext('AppViewerContext');
|
|
46
37
|
let selectedRowIndex = -1;
|
|
47
38
|
function toggleRow(row, rowIndex, force = false) {
|
|
48
39
|
if (selectedRowIndex !== rowIndex || force) {
|
|
@@ -62,6 +53,22 @@ $: selectedRowIndex === -1 &&
|
|
|
62
53
|
mounted &&
|
|
63
54
|
outputs &&
|
|
64
55
|
toggleRow({ original: result[0] }, 0);
|
|
56
|
+
function setOptions(filteredResult) {
|
|
57
|
+
if (!Array.isArray(result)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const headers = Array.from(new Set(result.flatMap((row) => Object.keys(row))));
|
|
61
|
+
$options = {
|
|
62
|
+
...tableOptions,
|
|
63
|
+
data: filteredResult,
|
|
64
|
+
columns: headers.map((header) => {
|
|
65
|
+
return {
|
|
66
|
+
accessorKey: header,
|
|
67
|
+
cell: (info) => info.getValue()
|
|
68
|
+
};
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
}
|
|
65
72
|
function searchInResult(result, searchValue) {
|
|
66
73
|
if (searchValue === '') {
|
|
67
74
|
return result;
|
|
@@ -80,41 +87,23 @@ function cellIsObject(x, props) {
|
|
|
80
87
|
return typeof x != 'string' && typeof x(props) == 'object';
|
|
81
88
|
}
|
|
82
89
|
let filteredResult = [];
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
$: filteredResult && setOptions(filteredResult);
|
|
91
|
+
$: search === 'By Component' && (filteredResult = searchInResult(result ?? [], searchValue));
|
|
92
|
+
$: (search === 'By Runnable' || search === 'Disabled') && (filteredResult = result ?? []);
|
|
93
|
+
let outputs = initOutput($worldStore, id, {
|
|
94
|
+
selectedRowIndex: 0,
|
|
95
|
+
selectedRow: undefined,
|
|
96
|
+
loading: false,
|
|
97
|
+
result: [],
|
|
98
|
+
search: ''
|
|
99
|
+
});
|
|
93
100
|
function rerender() {
|
|
94
|
-
if (!Array.isArray(result)) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const headers = Array.from(new Set(result.flatMap((row) => (typeof row == 'object' ? Object.keys(row) : []))));
|
|
98
|
-
$options = {
|
|
99
|
-
...tableOptions,
|
|
100
|
-
manualPagination: resolvedConfig.manualPagination,
|
|
101
|
-
data: filteredResult,
|
|
102
|
-
columns: headers.map((header) => {
|
|
103
|
-
return {
|
|
104
|
-
accessorKey: header,
|
|
105
|
-
cell: (info) => info.getValue()
|
|
106
|
-
};
|
|
107
|
-
})
|
|
108
|
-
};
|
|
109
101
|
table = createSvelteTable(options);
|
|
110
102
|
if (result) {
|
|
111
103
|
toggleRow({ original: result[0] }, 0, true);
|
|
112
104
|
}
|
|
113
|
-
if (outputs.page.peak()) {
|
|
114
|
-
$table.setPageIndex(outputs?.page.peak());
|
|
115
|
-
}
|
|
116
105
|
}
|
|
117
|
-
$:
|
|
106
|
+
$: result && rerender();
|
|
118
107
|
$: css = concatCustomCss($app.css?.tablecomponent, customCss);
|
|
119
108
|
$componentControl[id] = {
|
|
120
109
|
right: (skipActions) => {
|
|
@@ -123,7 +112,7 @@ $componentControl[id] = {
|
|
|
123
112
|
}
|
|
124
113
|
const hasActions = actionButtons.length >= 1;
|
|
125
114
|
if (hasActions) {
|
|
126
|
-
$selectedComponent =
|
|
115
|
+
$selectedComponent = actionButtons[0].id;
|
|
127
116
|
return true;
|
|
128
117
|
}
|
|
129
118
|
return false;
|
|
@@ -131,14 +120,7 @@ $componentControl[id] = {
|
|
|
131
120
|
};
|
|
132
121
|
</script>
|
|
133
122
|
|
|
134
|
-
{
|
|
135
|
-
<ResolveConfig
|
|
136
|
-
{id}
|
|
137
|
-
{key}
|
|
138
|
-
bind:resolvedConfig={resolvedConfig[key]}
|
|
139
|
-
configuration={configuration[key]}
|
|
140
|
-
/>
|
|
141
|
-
{/each}
|
|
123
|
+
<InputValue {id} input={configuration.search} bind:value={search} />
|
|
142
124
|
|
|
143
125
|
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
144
126
|
{#if Array.isArray(result) && result.every(isObject)}
|
|
@@ -150,7 +132,7 @@ $componentControl[id] = {
|
|
|
150
132
|
)}
|
|
151
133
|
style={css?.container?.style ?? ''}
|
|
152
134
|
>
|
|
153
|
-
{#if
|
|
135
|
+
{#if search !== 'Disabled'}
|
|
154
136
|
<div class="px-2 py-1">
|
|
155
137
|
<div class="flex items-center">
|
|
156
138
|
<div class="grow max-w-[300px]">
|
|
@@ -239,8 +221,7 @@ $componentControl[id] = {
|
|
|
239
221
|
on:click={() => toggleRow(row, rowIndex)}
|
|
240
222
|
>
|
|
241
223
|
<div class="center-center h-full w-full flex-wrap gap-1 ">
|
|
242
|
-
{#each actionButtons as actionButton, actionIndex (
|
|
243
|
-
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
|
224
|
+
{#each actionButtons as actionButton, actionIndex (actionIndex)}
|
|
244
225
|
<div
|
|
245
226
|
on:mouseover|stopPropagation={() => {
|
|
246
227
|
if (actionButton.id !== $hoverStore) {
|
|
@@ -252,13 +233,13 @@ $componentControl[id] = {
|
|
|
252
233
|
$hoverStore = undefined
|
|
253
234
|
}
|
|
254
235
|
}}
|
|
255
|
-
class={(
|
|
236
|
+
class={(actionButton.id === $selectedComponent ||
|
|
256
237
|
$hoverStore === actionButton.id) &&
|
|
257
238
|
$mode !== 'preview'
|
|
258
239
|
? 'outline outline-indigo-500 outline-1 outline-offset-1 relative '
|
|
259
240
|
: ''}
|
|
260
241
|
>
|
|
261
|
-
{#if
|
|
242
|
+
{#if actionButton.id === $selectedComponent || $hoverStore === actionButton.id}
|
|
262
243
|
<span
|
|
263
244
|
title={`Id: ${actionButton.id}`}
|
|
264
245
|
class={classNames(
|
|
@@ -274,22 +255,19 @@ $componentControl[id] = {
|
|
|
274
255
|
extraKey={'idx' + rowIndex}
|
|
275
256
|
{render}
|
|
276
257
|
noWFull
|
|
258
|
+
{...actionButton}
|
|
277
259
|
preclickAction={async () => {
|
|
278
260
|
toggleRow(row, rowIndex)
|
|
279
261
|
}}
|
|
280
|
-
id={actionButton.id}
|
|
281
|
-
customCss={actionButton.customCss}
|
|
282
|
-
configuration={actionButton.configuration}
|
|
283
|
-
recomputeIds={actionButton.recomputeIds}
|
|
284
262
|
extraQueryParams={{ row: row.original }}
|
|
285
|
-
componentInput={actionButton.componentInput}
|
|
263
|
+
bind:componentInput={actionButton.componentInput}
|
|
286
264
|
controls={{
|
|
287
265
|
left: () => {
|
|
288
266
|
if (actionIndex === 0) {
|
|
289
|
-
$selectedComponent =
|
|
267
|
+
$selectedComponent = id
|
|
290
268
|
return true
|
|
291
269
|
} else if (actionIndex > 0) {
|
|
292
|
-
$selectedComponent =
|
|
270
|
+
$selectedComponent = actionButtons[actionIndex - 1].id
|
|
293
271
|
return true
|
|
294
272
|
}
|
|
295
273
|
return false
|
|
@@ -298,7 +276,7 @@ $componentControl[id] = {
|
|
|
298
276
|
if (actionIndex === actionButtons.length - 1) {
|
|
299
277
|
return id
|
|
300
278
|
} else if (actionIndex < actionButtons.length - 1) {
|
|
301
|
-
$selectedComponent =
|
|
279
|
+
$selectedComponent = actionButtons[actionIndex + 1].id
|
|
302
280
|
return true
|
|
303
281
|
}
|
|
304
282
|
return false
|
|
@@ -310,15 +288,12 @@ $componentControl[id] = {
|
|
|
310
288
|
extraKey={'idx' + rowIndex}
|
|
311
289
|
{render}
|
|
312
290
|
noWFull
|
|
313
|
-
|
|
314
|
-
customCss={actionButton.customCss}
|
|
315
|
-
configuration={actionButton.configuration}
|
|
316
|
-
recomputeIds={actionButton.recomputeIds}
|
|
291
|
+
{...actionButton}
|
|
317
292
|
preclickAction={async () => {
|
|
318
293
|
toggleRow(row, rowIndex)
|
|
319
294
|
}}
|
|
320
295
|
extraQueryParams={{ row: row.original }}
|
|
321
|
-
componentInput={actionButton.componentInput}
|
|
296
|
+
bind:componentInput={actionButton.componentInput}
|
|
322
297
|
/>
|
|
323
298
|
{/if}
|
|
324
299
|
</div>
|
|
@@ -333,9 +308,8 @@ $componentControl[id] = {
|
|
|
333
308
|
</div>
|
|
334
309
|
|
|
335
310
|
<AppTableFooter
|
|
336
|
-
paginationEnabled
|
|
337
|
-
|
|
338
|
-
result={filteredResult}
|
|
311
|
+
paginationEnabled={pagination}
|
|
312
|
+
{result}
|
|
339
313
|
{table}
|
|
340
314
|
class={css?.tableFooter?.class}
|
|
341
315
|
style={css?.tableFooter?.style}
|
|
@@ -345,9 +319,9 @@ $componentControl[id] = {
|
|
|
345
319
|
<div class="flex flex-col h-full w-full overflow-auto">
|
|
346
320
|
<Alert title="Parsing issues" type="error" size="xs" class="h-full w-full ">
|
|
347
321
|
The result should be an array of objects. Received:
|
|
348
|
-
<pre class="w-full bg-white p-2 rounded-md
|
|
349
|
-
|
|
350
|
-
>
|
|
322
|
+
<pre class="w-full bg-white p-2 rounded-md">
|
|
323
|
+
{JSON.stringify(result, null, 4)}
|
|
324
|
+
</pre>
|
|
351
325
|
</Alert>
|
|
352
326
|
</div>
|
|
353
327
|
{/if}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { BaseAppComponent, ComponentCustomCSS, RichConfigurations } from '../../../types';
|
|
3
3
|
import type { AppInput } from '../../../inputType';
|
|
4
|
-
import {
|
|
4
|
+
import type { ButtonComponent } from '../../../editor/component';
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: {
|
|
7
7
|
id: string;
|
|
@@ -5,7 +5,6 @@ import { twMerge } from 'tailwind-merge';
|
|
|
5
5
|
import { tableOptions } from './tableOptions';
|
|
6
6
|
export let result;
|
|
7
7
|
export let paginationEnabled = false;
|
|
8
|
-
export let manualPagination;
|
|
9
8
|
export let table;
|
|
10
9
|
let c = '';
|
|
11
10
|
export { c as class };
|
|
@@ -25,7 +24,7 @@ function downloadResultAsJSON() {
|
|
|
25
24
|
class={twMerge('px-2 py-1 text-xs gap-2 items-center justify-between', c, 'flex flex-row')}
|
|
26
25
|
{style}
|
|
27
26
|
>
|
|
28
|
-
{#if
|
|
27
|
+
{#if paginationEnabled && result.length > (tableOptions.initialState?.pagination?.pageSize ?? 25)}
|
|
29
28
|
<div class="flex items-center gap-2 flex-row">
|
|
30
29
|
<Button
|
|
31
30
|
size="xs"
|
|
@@ -5,8 +5,7 @@ export let id;
|
|
|
5
5
|
export let name;
|
|
6
6
|
export let inlineScript;
|
|
7
7
|
export let fields;
|
|
8
|
-
export let doNotRecomputeOnInputChanged;
|
|
9
|
-
export let recomputableByRefreshButton;
|
|
8
|
+
export let doNotRecomputeOnInputChanged = false;
|
|
10
9
|
let result = undefined;
|
|
11
10
|
const { worldStore } = getContext('AppViewerContext');
|
|
12
11
|
let outputs = initOutput($worldStore, id, {
|
|
@@ -29,8 +28,8 @@ let outputs = initOutput($worldStore, id, {
|
|
|
29
28
|
type: 'runnableByName'
|
|
30
29
|
}}
|
|
31
30
|
wrapperClass="hidden"
|
|
31
|
+
recomputable
|
|
32
32
|
{outputs}
|
|
33
|
-
{recomputableByRefreshButton}
|
|
34
33
|
>
|
|
35
34
|
<slot />
|
|
36
35
|
</RunnableComponent>
|
|
@@ -7,8 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
name: string;
|
|
8
8
|
inlineScript: InlineScript | undefined;
|
|
9
9
|
fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
|
|
10
|
-
doNotRecomputeOnInputChanged
|
|
11
|
-
recomputableByRefreshButton: boolean;
|
|
10
|
+
doNotRecomputeOnInputChanged?: boolean | undefined;
|
|
12
11
|
};
|
|
13
12
|
events: {
|
|
14
13
|
[evt: string]: CustomEvent<any>;
|
|
@@ -9,7 +9,7 @@ export let id = undefined;
|
|
|
9
9
|
export let error = '';
|
|
10
10
|
export let extraContext = {};
|
|
11
11
|
export let key = '';
|
|
12
|
-
const { componentControl
|
|
12
|
+
const { componentControl } = getContext('AppViewerContext');
|
|
13
13
|
const dispatch = createEventDispatcher();
|
|
14
14
|
if (input == undefined) {
|
|
15
15
|
dispatch('done');
|
|
@@ -67,7 +67,7 @@ async function handleConnection() {
|
|
|
67
67
|
}
|
|
68
68
|
async function evalExpr(input) {
|
|
69
69
|
try {
|
|
70
|
-
const r = await eval_like(input.expr, computeGlobalContext($worldStore, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore
|
|
70
|
+
const r = await eval_like(input.expr, computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
71
71
|
error = '';
|
|
72
72
|
return r;
|
|
73
73
|
}
|
|
@@ -81,7 +81,7 @@ async function getValue(input) {
|
|
|
81
81
|
return;
|
|
82
82
|
if (input.type === 'template' && isCodeInjection(input.eval)) {
|
|
83
83
|
try {
|
|
84
|
-
const r = await eval_like('`' + input.eval + '`', computeGlobalContext($worldStore, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore
|
|
84
|
+
const r = await eval_like('`' + input.eval + '`', computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
85
85
|
error = '';
|
|
86
86
|
return r;
|
|
87
87
|
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
<script>import { RefreshCw } from 'lucide-svelte';
|
|
2
2
|
import { getContext } from 'svelte';
|
|
3
3
|
export let componentId;
|
|
4
|
-
|
|
5
|
-
const { runnableComponents } = getContext('AppViewerContext');
|
|
4
|
+
const { runnableComponents, worldStore } = getContext('AppViewerContext');
|
|
6
5
|
async function refresh() {
|
|
7
|
-
|
|
6
|
+
window.dispatchEvent(new Event('pointerup'));
|
|
7
|
+
await $runnableComponents[componentId]?.();
|
|
8
8
|
}
|
|
9
|
+
let loading = false;
|
|
10
|
+
$: $worldStore?.outputsById[componentId]?.['loading']?.subscribe({
|
|
11
|
+
id: 'refresh-' + componentId,
|
|
12
|
+
next: (value) => {
|
|
13
|
+
loading = value;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
9
16
|
</script>
|
|
10
17
|
|
|
11
18
|
<button
|
|
@@ -23,25 +23,22 @@ export let wrapperClass = '';
|
|
|
23
23
|
export let wrapperStyle = '';
|
|
24
24
|
export let initializing = undefined;
|
|
25
25
|
export let render;
|
|
26
|
+
export let recomputable = false;
|
|
26
27
|
export let outputs;
|
|
27
28
|
export let extraKey = '';
|
|
28
29
|
export let doNotRecomputeOnInputChanged = false;
|
|
29
|
-
export let loading = false;
|
|
30
|
-
export let recomputableByRefreshButton = true;
|
|
31
30
|
const { worldStore, runnableComponents, workspace, appPath, isEditor, jobs, noBackend, errorByComponent, mode, stateId, state, componentControl } = getContext('AppViewerContext');
|
|
32
31
|
const dispatch = createEventDispatcher();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
cb: async (inlineScript) => {
|
|
32
|
+
if (recomputable || autoRefresh) {
|
|
33
|
+
$runnableComponents[id] = async (inlineScript) => {
|
|
36
34
|
await executeComponent(true, inlineScript);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
};
|
|
36
|
+
$runnableComponents = $runnableComponents;
|
|
37
|
+
}
|
|
40
38
|
let args = undefined;
|
|
41
39
|
let testIsLoading = false;
|
|
42
40
|
let runnableInputValues = {};
|
|
43
41
|
let executeTimeout = undefined;
|
|
44
|
-
$: outputs.loading?.set(loading);
|
|
45
42
|
function setDebouncedExecute() {
|
|
46
43
|
executeTimeout && clearTimeout(executeTimeout);
|
|
47
44
|
executeTimeout = setTimeout(() => {
|
|
@@ -106,16 +103,16 @@ function stripSchema(inputs, s) {
|
|
|
106
103
|
}
|
|
107
104
|
async function executeComponent(noToast = false, inlineScriptOverride) {
|
|
108
105
|
if (runnable?.type === 'runnableByName' && runnable.inlineScript?.language === 'frontend') {
|
|
109
|
-
loading
|
|
106
|
+
outputs.loading?.set(true);
|
|
110
107
|
try {
|
|
111
|
-
const r = await eval_like(runnable.inlineScript?.content, computeGlobalContext($worldStore, {}), false, $state, $mode == 'dnd', $componentControl, $worldStore
|
|
108
|
+
const r = await eval_like(runnable.inlineScript?.content, computeGlobalContext($worldStore, id, {}), false, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
112
109
|
await setResult(r);
|
|
113
110
|
$state = $state;
|
|
114
111
|
}
|
|
115
112
|
catch (e) {
|
|
116
113
|
sendUserToast('Error running frontend script: ' + e.message, true);
|
|
117
114
|
}
|
|
118
|
-
loading
|
|
115
|
+
outputs.loading?.set(false);
|
|
119
116
|
return;
|
|
120
117
|
}
|
|
121
118
|
if (noBackend) {
|
|
@@ -127,7 +124,7 @@ async function executeComponent(noToast = false, inlineScriptOverride) {
|
|
|
127
124
|
if (runnable?.type === 'runnableByName' && !runnable.inlineScript) {
|
|
128
125
|
return;
|
|
129
126
|
}
|
|
130
|
-
loading
|
|
127
|
+
outputs.loading?.set(true);
|
|
131
128
|
try {
|
|
132
129
|
let njob = await testJobLoader?.abstractRun(() => {
|
|
133
130
|
const nonStaticRunnableInputs = {};
|
|
@@ -175,8 +172,7 @@ async function executeComponent(noToast = false, inlineScriptOverride) {
|
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
174
|
catch (e) {
|
|
178
|
-
|
|
179
|
-
loading = false;
|
|
175
|
+
outputs.loading?.set(false);
|
|
180
176
|
}
|
|
181
177
|
}
|
|
182
178
|
export async function runComponent() {
|
|
@@ -184,7 +180,7 @@ export async function runComponent() {
|
|
|
184
180
|
await executeComponent();
|
|
185
181
|
}
|
|
186
182
|
catch (e) {
|
|
187
|
-
|
|
183
|
+
console.error(e);
|
|
188
184
|
}
|
|
189
185
|
}
|
|
190
186
|
let lastStartedAt = Date.now();
|
|
@@ -200,7 +196,7 @@ async function setResult(res) {
|
|
|
200
196
|
const hasRes = res !== undefined && res !== null;
|
|
201
197
|
if (transformer) {
|
|
202
198
|
$worldStore.newOutput(id, 'raw', res);
|
|
203
|
-
res = await eval_like(transformer.content, computeGlobalContext($worldStore, { result: res }), false, $state, $mode == 'dnd', $componentControl, $worldStore
|
|
199
|
+
res = await eval_like(transformer.content, computeGlobalContext($worldStore, id, { result: res }), false, $state, $mode == 'dnd', $componentControl, $worldStore);
|
|
204
200
|
if (hasRes && res === undefined) {
|
|
205
201
|
res = {
|
|
206
202
|
error: {
|
|
@@ -260,7 +256,7 @@ async function setResult(res) {
|
|
|
260
256
|
setResult(e.detail.result)
|
|
261
257
|
}
|
|
262
258
|
}
|
|
263
|
-
loading
|
|
259
|
+
outputs.loading?.set(false)
|
|
264
260
|
}}
|
|
265
261
|
bind:isLoading={testIsLoading}
|
|
266
262
|
bind:job={testJob}
|
|
@@ -311,7 +307,7 @@ async function setResult(res) {
|
|
|
311
307
|
{/if}
|
|
312
308
|
{#if !initializing && autoRefresh === true}
|
|
313
309
|
<div class="flex absolute top-1 right-1 z-50">
|
|
314
|
-
<RefreshButton
|
|
310
|
+
<RefreshButton componentId={id} />
|
|
315
311
|
</div>
|
|
316
312
|
{/if}
|
|
317
313
|
</div>
|
|
@@ -18,14 +18,13 @@ declare const __propDef: {
|
|
|
18
18
|
wrapperStyle?: string | undefined;
|
|
19
19
|
initializing?: boolean | undefined;
|
|
20
20
|
render: boolean;
|
|
21
|
+
recomputable?: boolean | undefined;
|
|
21
22
|
outputs: {
|
|
22
23
|
result: Output<any>;
|
|
23
24
|
loading: Output<boolean>;
|
|
24
25
|
};
|
|
25
26
|
extraKey?: string | undefined;
|
|
26
27
|
doNotRecomputeOnInputChanged?: boolean | undefined;
|
|
27
|
-
loading?: boolean | undefined;
|
|
28
|
-
recomputableByRefreshButton?: boolean | undefined;
|
|
29
28
|
runComponent?: (() => Promise<void>) | undefined;
|
|
30
29
|
};
|
|
31
30
|
events: {
|
|
@@ -8,7 +8,6 @@ export let componentInput;
|
|
|
8
8
|
export let id;
|
|
9
9
|
export let result = undefined;
|
|
10
10
|
export let initializing = true;
|
|
11
|
-
export let loading = false;
|
|
12
11
|
export let extraQueryParams = {};
|
|
13
12
|
export let autoRefresh = true;
|
|
14
13
|
export let runnableComponent = undefined;
|
|
@@ -35,7 +34,7 @@ function isRunnableDefined(componentInput) {
|
|
|
35
34
|
}
|
|
36
35
|
export function onSuccess() {
|
|
37
36
|
if (recomputeIds) {
|
|
38
|
-
recomputeIds.
|
|
37
|
+
recomputeIds.map((id) => $runnableComponents?.[id]?.());
|
|
39
38
|
}
|
|
40
39
|
if (!doOnSuccess)
|
|
41
40
|
return;
|
|
@@ -74,7 +73,6 @@ export function onSuccess() {
|
|
|
74
73
|
{:else if componentInput.type === 'runnable' && isRunnableDefined(componentInput)}
|
|
75
74
|
<RunnableComponent
|
|
76
75
|
{extraKey}
|
|
77
|
-
bind:loading
|
|
78
76
|
bind:this={runnableComponent}
|
|
79
77
|
fields={componentInput.fields}
|
|
80
78
|
bind:result
|
|
@@ -8,7 +8,6 @@ declare const __propDef: {
|
|
|
8
8
|
id: string;
|
|
9
9
|
result?: any;
|
|
10
10
|
initializing?: boolean | undefined;
|
|
11
|
-
loading?: boolean | undefined;
|
|
12
11
|
extraQueryParams?: Record<string, any> | undefined;
|
|
13
12
|
autoRefresh?: boolean | undefined;
|
|
14
13
|
runnableComponent?: RunnableComponent | undefined;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { World } from '../../rx';
|
|
2
|
-
export declare function computeGlobalContext(world: World | undefined, extraContext?: any): any;
|
|
2
|
+
export declare function computeGlobalContext(world: World | undefined, id: string | undefined, extraContext?: any): any;
|
|
3
3
|
export declare function eval_like(text: string, context: {} | undefined, noReturn: boolean, state: Record<string, any>, editor: boolean, controlComponents: Record<string, {
|
|
4
4
|
setTab?: (index: number) => void;
|
|
5
|
-
}>, worldStore: World | undefined
|
|
6
|
-
cb?: () => void;
|
|
7
|
-
}>): Promise<any>;
|
|
5
|
+
}>, worldStore: World | undefined): Promise<any>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { sendUserToast } from '../../../../utils';
|
|
2
2
|
import { isPlainObject } from 'lodash';
|
|
3
|
-
export function computeGlobalContext(world, extraContext = {}) {
|
|
3
|
+
export function computeGlobalContext(world, id, extraContext = {}) {
|
|
4
4
|
return {
|
|
5
5
|
...Object.fromEntries(Object.entries(world?.outputsById ?? {})
|
|
6
|
-
.filter(([k, _]) => k != 'state')
|
|
6
|
+
.filter(([k, _]) => k != id && k != 'state')
|
|
7
7
|
.map(([key, value]) => {
|
|
8
8
|
return [
|
|
9
9
|
key,
|
|
@@ -15,7 +15,7 @@ export function computeGlobalContext(world, extraContext = {}) {
|
|
|
15
15
|
}
|
|
16
16
|
function create_context_function_template(eval_string, context, noReturn) {
|
|
17
17
|
return `
|
|
18
|
-
return async function (context, state, goto, setTab
|
|
18
|
+
return async function (context, state, goto, setTab) {
|
|
19
19
|
"use strict";
|
|
20
20
|
${Object.keys(context).length > 0
|
|
21
21
|
? `let ${Object.keys(context).map((key) => ` ${key} = context['${key}']`)};`
|
|
@@ -58,7 +58,7 @@ function isSerializable(obj) {
|
|
|
58
58
|
}
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
|
-
export async function eval_like(text, context = {}, noReturn, state, editor, controlComponents, worldStore
|
|
61
|
+
export async function eval_like(text, context = {}, noReturn, state, editor, controlComponents, worldStore) {
|
|
62
62
|
const proxiedState = new Proxy(state, {
|
|
63
63
|
set(target, key, value) {
|
|
64
64
|
if (typeof key !== 'string') {
|
|
@@ -88,7 +88,5 @@ export async function eval_like(text, context = {}, noReturn, state, editor, con
|
|
|
88
88
|
}
|
|
89
89
|
}, (id, index) => {
|
|
90
90
|
controlComponents[id]?.setTab?.(index);
|
|
91
|
-
}, (id) => {
|
|
92
|
-
runnableComponents[id]?.cb?.();
|
|
93
91
|
});
|
|
94
92
|
}
|
|
@@ -27,6 +27,10 @@ $: css = concatCustomCss($app.css?.checkboxcomponent, customCss);
|
|
|
27
27
|
|
|
28
28
|
<AlignWrapper {render} {horizontalAlignment} {verticalAlignment}>
|
|
29
29
|
<Toggle
|
|
30
|
+
on:pointerdown={(e) => {
|
|
31
|
+
e?.stopPropagation()
|
|
32
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
33
|
+
}}
|
|
30
34
|
checked={defaultValue}
|
|
31
35
|
options={{ right: labelValue }}
|
|
32
36
|
textClass={css?.text?.class ?? ''}
|
|
@@ -35,14 +35,14 @@ $: css = concatCustomCss($app.css?.dateinputcomponent, customCss);
|
|
|
35
35
|
<AlignWrapper {render} {verticalAlignment}>
|
|
36
36
|
{#if inputType === 'date'}
|
|
37
37
|
<input
|
|
38
|
-
on:focus={() => ($selectedComponent =
|
|
38
|
+
on:focus={() => ($selectedComponent = id)}
|
|
39
39
|
on:pointerdown|stopPropagation
|
|
40
40
|
type="date"
|
|
41
41
|
bind:value
|
|
42
42
|
min={minValue}
|
|
43
43
|
max={maxValue}
|
|
44
44
|
placeholder="Type..."
|
|
45
|
-
class={twMerge(css?.input?.class ?? '')}
|
|
45
|
+
class={twMerge('mx-0.5', css?.input?.class ?? '')}
|
|
46
46
|
style={css?.input?.style ?? ''}
|
|
47
47
|
/>
|
|
48
48
|
{/if}
|