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