windmill-components 1.83.0 → 1.83.2
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 +35 -27
- package/components/DisplayResult.svelte +10 -1
- package/components/DisplayResult.svelte.d.ts +1 -0
- package/components/FlowGraphViewer.svelte +4 -20
- package/components/FlowJobResult.svelte +2 -1
- package/components/FlowJobResult.svelte.d.ts +1 -0
- package/components/FlowStatusViewer.svelte +1 -0
- package/components/Range.svelte.d.ts +2 -2
- package/components/RunForm.svelte +6 -2
- package/components/ScriptBuilder.svelte +6 -4
- package/components/ScriptBuilder.svelte.d.ts +1 -0
- package/components/TemplateEditor.svelte.d.ts +205 -0
- package/components/apps/components/display/PlotlyHtml.svelte +26 -13
- package/components/apps/components/display/table/AppAggridTable.svelte +29 -17
- package/components/apps/components/display/table/AppTable.svelte +17 -4
- package/components/apps/components/display/table/AppTableFooter.svelte +2 -2
- package/components/apps/components/display/table/AppTableFooter.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte +3 -1
- package/components/apps/components/inputs/AppSelect.svelte +3 -1
- package/components/apps/components/layout/AppContainer.svelte +4 -2
- package/components/apps/components/layout/AppDrawer.svelte +33 -13
- package/components/apps/components/layout/AppSplitpanes.svelte +7 -6
- package/components/apps/components/layout/AppTabs.svelte +6 -3
- package/components/apps/editor/AppEditor.svelte +25 -37
- package/components/apps/editor/ComponentHeader.svelte +5 -2
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -0
- package/components/apps/editor/ConnectionInstructions.svelte +29 -0
- package/components/apps/editor/ConnectionInstructions.svelte.d.ts +14 -0
- package/components/apps/editor/GridEditor.svelte +6 -28
- package/components/apps/editor/SubGridEditor.svelte +7 -19
- package/components/apps/editor/component/Component.svelte +7 -4
- package/components/apps/editor/component/ComponentWrapper.svelte +59 -0
- package/components/apps/editor/component/ComponentWrapper.svelte.d.ts +20 -0
- package/components/apps/editor/component/components.d.ts +32 -19
- package/components/apps/editor/component/components.js +28 -14
- package/components/apps/editor/componentsPanel/CssProperty.svelte +13 -8
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +4 -2
- package/components/apps/editor/componentsPanel/ListItem.svelte +14 -4
- package/components/apps/editor/componentsPanel/ListItem.svelte.d.ts +5 -0
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +62 -21
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte.d.ts +5 -2
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte +1 -0
- package/components/apps/editor/componentsPanel/quickStyleProperties.d.ts +29 -503
- package/components/apps/editor/componentsPanel/quickStyleProperties.js +97 -98
- package/components/apps/editor/componentsPanel/store.d.ts +1 -0
- package/components/apps/editor/componentsPanel/store.js +1 -0
- package/components/apps/editor/contextPanel/ContextPanel.svelte +11 -10
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +13 -4
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +78 -43
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +17 -3
- package/components/apps/editor/settingsPanel/StylePanel.svelte +2 -0
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte +1 -1
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte +2 -2
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.d.ts +2 -1
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.js +9 -3
- package/components/common/button/Button.svelte.d.ts +1 -1
- package/components/common/button/ButtonPopup.svelte.d.ts +1 -1
- package/components/flows/content/FlowLoop.svelte +26 -14
- package/components/flows/flowStore.js +4 -40
- package/components/flows/utils.js +16 -22
- package/components/propertyPicker/ObjectViewer.svelte +12 -4
- package/infer.js +2 -0
- package/init_scripts/python_failure_module.d.ts +2 -0
- package/init_scripts/{python_failure_module.py → python_failure_module.js} +2 -2
- package/init_scripts/python_init_code.d.ts +2 -0
- package/init_scripts/{python_init_code.py → python_init_code.js} +3 -3
- package/init_scripts/python_init_code_clear.d.ts +2 -0
- package/init_scripts/python_init_code_clear.js +5 -0
- package/init_scripts/python_init_code_trigger.d.ts +2 -0
- package/init_scripts/{python_init_code_trigger.py → python_init_code_trigger.js} +2 -2
- package/package.json +673 -671
- package/script_helpers.d.ts +5 -5
- package/script_helpers.js +15 -5
- package/stores.d.ts +4 -3
- package/stores.js +23 -19
- package/utils.d.ts +1 -0
- package/utils.js +8 -0
- package/init_scripts/python_init_code_clear.py +0 -5
|
@@ -140,6 +140,7 @@ $: {
|
|
|
140
140
|
}
|
|
141
141
|
$: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncoding);
|
|
142
142
|
let redraw = 0;
|
|
143
|
+
let itemsLimit = 50;
|
|
143
144
|
</script>
|
|
144
145
|
|
|
145
146
|
<div class="flex flex-col w-full min-w-[250px]">
|
|
@@ -249,34 +250,41 @@ let redraw = 0;
|
|
|
249
250
|
{#key redraw}
|
|
250
251
|
{#if Array.isArray(value)}
|
|
251
252
|
{#each value ?? [] as v, i}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
253
|
+
{#if i < itemsLimit}
|
|
254
|
+
<div class="flex max-w-md mt-1 w-full items-center">
|
|
255
|
+
{#if itemsType?.type == 'number'}
|
|
256
|
+
<input type="number" bind:value={v} />
|
|
257
|
+
{:else if itemsType?.type == 'string' && itemsType?.contentEncoding == 'base64'}
|
|
258
|
+
<input
|
|
259
|
+
type="file"
|
|
260
|
+
class="my-6"
|
|
261
|
+
on:change={(x) => fileChanged(x, (val) => (value[i] = val))}
|
|
262
|
+
multiple={false}
|
|
263
|
+
/>
|
|
264
|
+
{:else if itemsType?.type == 'object'}
|
|
265
|
+
<JsonEditor code={JSON.stringify(v, null, 2)} bind:value={v} />
|
|
266
|
+
{:else}
|
|
267
|
+
<input type="text" bind:value={v} />
|
|
268
|
+
{/if}
|
|
269
|
+
<button
|
|
270
|
+
transition:fade|local={{ duration: 100 }}
|
|
271
|
+
class="rounded-full p-1 bg-white/60 duration-200 hover:bg-gray-200"
|
|
272
|
+
aria-label="Clear"
|
|
273
|
+
on:click={() => {
|
|
274
|
+
value.splice(i, 1)
|
|
275
|
+
redraw += 1
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
<X size={14} />
|
|
279
|
+
</button>
|
|
280
|
+
</div>
|
|
281
|
+
{/if}
|
|
279
282
|
{/each}
|
|
283
|
+
{#if value.length > itemsLimit}
|
|
284
|
+
<button on:click={() => (itemsLimit += 50)} class="text-xs py-2 text-blue-600"
|
|
285
|
+
>{itemsLimit}/{value.length}: Load 50 more...</button
|
|
286
|
+
>
|
|
287
|
+
{/if}
|
|
280
288
|
{/if}
|
|
281
289
|
{/key}
|
|
282
290
|
</div>
|
|
@@ -8,6 +8,7 @@ import { ClipboardCopy } from 'lucide-svelte';
|
|
|
8
8
|
import Portal from 'svelte-portal';
|
|
9
9
|
export let result;
|
|
10
10
|
export let requireHtmlApproval = false;
|
|
11
|
+
export let filename = undefined;
|
|
11
12
|
let resultKind;
|
|
12
13
|
$: resultKind = inferResultKind(result);
|
|
13
14
|
let forceJson = false;
|
|
@@ -214,7 +215,15 @@ let jsonViewer;
|
|
|
214
215
|
>
|
|
215
216
|
</div>
|
|
216
217
|
{:else}
|
|
217
|
-
|
|
218
|
+
{@const jsonStr = JSON.stringify(result, null, 4).replace(/\\n/g, '\n')}
|
|
219
|
+
{#if jsonStr.length > 10000}
|
|
220
|
+
JSON too large. <a
|
|
221
|
+
download="{filename ?? 'result'}.json"
|
|
222
|
+
href="data:text/json;charset=utf-8,{encodeURIComponent(jsonStr)}">Download</a
|
|
223
|
+
>
|
|
224
|
+
{:else}
|
|
225
|
+
<Highlight language={json} code={jsonStr} />
|
|
226
|
+
{/if}
|
|
218
227
|
{/if}
|
|
219
228
|
{:else}
|
|
220
229
|
<div class="text-gray-500 text-sm">No result: {JSON.stringify(result)}</div>
|
|
@@ -34,11 +34,7 @@ let topHeight = 0;
|
|
|
34
34
|
</div>
|
|
35
35
|
<div class="text-2xs mb-4">
|
|
36
36
|
<h3 class="mb-2">Step Inputs</h3>
|
|
37
|
-
<InputTransformsViewer
|
|
38
|
-
inputTransforms={stepDetail?.value?.input_transforms ??
|
|
39
|
-
stepDetail?.input_transforms ??
|
|
40
|
-
{}}
|
|
41
|
-
/>
|
|
37
|
+
<InputTransformsViewer inputTransforms={stepDetail?.value?.input_transforms ?? {}} />
|
|
42
38
|
</div>
|
|
43
39
|
{#if stepDetail.value.path.startsWith('hub/')}
|
|
44
40
|
<div class="mt-6">
|
|
@@ -54,11 +50,7 @@ let topHeight = 0;
|
|
|
54
50
|
{:else if stepDetail.value.type == 'rawscript'}
|
|
55
51
|
<div class="text-2xs mb-4">
|
|
56
52
|
<h3 class="mb-2">Step Inputs</h3>
|
|
57
|
-
<InputTransformsViewer
|
|
58
|
-
inputTransforms={stepDetail?.value?.input_transforms ??
|
|
59
|
-
stepDetail?.input_transforms ??
|
|
60
|
-
{}}
|
|
61
|
-
/>
|
|
53
|
+
<InputTransformsViewer inputTransforms={stepDetail?.value?.input_transforms ?? {}} />
|
|
62
54
|
</div>
|
|
63
55
|
|
|
64
56
|
<h3 class="mb-2">Code</h3>
|
|
@@ -107,11 +99,7 @@ let topHeight = 0;
|
|
|
107
99
|
{:else if stepDetail.value.type == 'rawscript'}
|
|
108
100
|
<div class="text-2xs mb-4">
|
|
109
101
|
<h3 class="mb-2">Step Inputs</h3>
|
|
110
|
-
<InputTransformsViewer
|
|
111
|
-
inputTransforms={stepDetail?.value?.input_transforms ??
|
|
112
|
-
stepDetail?.input_transforms ??
|
|
113
|
-
{}}
|
|
114
|
-
/>
|
|
102
|
+
<InputTransformsViewer inputTransforms={stepDetail?.value?.input_transforms ?? {}} />
|
|
115
103
|
</div>
|
|
116
104
|
|
|
117
105
|
<h3 class="mb-2"
|
|
@@ -135,11 +123,7 @@ let topHeight = 0;
|
|
|
135
123
|
</div>
|
|
136
124
|
<div class="text-2xs mb-4">
|
|
137
125
|
<h3 class="mb-2">Step Inputs</h3>
|
|
138
|
-
<InputTransformsViewer
|
|
139
|
-
inputTransforms={stepDetail?.value?.input_transforms ??
|
|
140
|
-
stepDetail?.input_transforms ??
|
|
141
|
-
{}}
|
|
142
|
-
/>
|
|
126
|
+
<InputTransformsViewer inputTransforms={stepDetail?.value?.input_transforms ?? {}} />
|
|
143
127
|
</div>
|
|
144
128
|
{#if stepDetail.value.path.startsWith('hub/')}
|
|
145
129
|
<div class="mt-6">
|
|
@@ -6,6 +6,7 @@ export let logs;
|
|
|
6
6
|
export let col = false;
|
|
7
7
|
export let noBorder = false;
|
|
8
8
|
export let loading;
|
|
9
|
+
export let filename = undefined;
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<div
|
|
@@ -15,7 +16,7 @@ export let loading;
|
|
|
15
16
|
<div class="bg-white {col ? '' : 'max-h-80'} h-full p-1 overflow-auto relative">
|
|
16
17
|
<span class="text-gray-500">Result</span>
|
|
17
18
|
{#if result}
|
|
18
|
-
<DisplayResult {result} />
|
|
19
|
+
<DisplayResult {filename} {result} />
|
|
19
20
|
{:else if loading}
|
|
20
21
|
<Loader2 class="animate-spin" />
|
|
21
22
|
{:else}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
export default class Range extends SvelteComponentTyped<{
|
|
5
5
|
value?: number | undefined;
|
|
6
6
|
id?: null | undefined;
|
|
7
|
-
min?: number | undefined;
|
|
8
7
|
max?: number | undefined;
|
|
8
|
+
min?: number | undefined;
|
|
9
9
|
initialValue?: number | undefined;
|
|
10
10
|
}, {
|
|
11
11
|
pointerdown: PointerEvent;
|
|
@@ -22,8 +22,8 @@ declare const __propDef: {
|
|
|
22
22
|
props: {
|
|
23
23
|
value?: number | undefined;
|
|
24
24
|
id?: null | undefined;
|
|
25
|
-
min?: number | undefined;
|
|
26
25
|
max?: number | undefined;
|
|
26
|
+
min?: number | undefined;
|
|
27
27
|
initialValue?: number | undefined;
|
|
28
28
|
};
|
|
29
29
|
events: {
|
|
@@ -6,7 +6,7 @@ import SchemaForm from './SchemaForm.svelte';
|
|
|
6
6
|
import { Badge, Button } from './common';
|
|
7
7
|
import SharedBadge from './SharedBadge.svelte';
|
|
8
8
|
import Toggle from './Toggle.svelte';
|
|
9
|
-
import { userStore } from '../stores';
|
|
9
|
+
import { runFormStore, userStore } from '../stores';
|
|
10
10
|
import Tooltip from './Tooltip.svelte';
|
|
11
11
|
import CliHelpBox from './CliHelpBox.svelte';
|
|
12
12
|
import InlineCodeCopy from './InlineCodeCopy.svelte';
|
|
@@ -21,7 +21,11 @@ export let loading = false;
|
|
|
21
21
|
export let noVariablePicker = false;
|
|
22
22
|
export let viewCliRun = false;
|
|
23
23
|
export let isFlow;
|
|
24
|
-
export let args =
|
|
24
|
+
export let args = {};
|
|
25
|
+
if ($runFormStore) {
|
|
26
|
+
args = $runFormStore;
|
|
27
|
+
$runFormStore = undefined;
|
|
28
|
+
}
|
|
25
29
|
export function run() {
|
|
26
30
|
runAction(scheduledForStr, args, invisible_to_owner);
|
|
27
31
|
}
|
|
@@ -21,6 +21,7 @@ export let initialPath = '';
|
|
|
21
21
|
export let template = 'script';
|
|
22
22
|
export let initialArgs = {};
|
|
23
23
|
export let lockedLanguage = false;
|
|
24
|
+
export let topHash = undefined;
|
|
24
25
|
const langs = [
|
|
25
26
|
['Typescript', Script.language.DENO],
|
|
26
27
|
['Python', Script.language.PYTHON3],
|
|
@@ -70,7 +71,7 @@ async function editScript(leave) {
|
|
|
70
71
|
await inferArgs(script.language, script.content, script.schema);
|
|
71
72
|
}
|
|
72
73
|
catch (error) {
|
|
73
|
-
sendUserToast(`
|
|
74
|
+
sendUserToast(`The main signature was not parsable. This script is considered to be without main function`);
|
|
74
75
|
}
|
|
75
76
|
const newHash = await ScriptService.createScript({
|
|
76
77
|
workspace: $workspaceStore,
|
|
@@ -79,7 +80,7 @@ async function editScript(leave) {
|
|
|
79
80
|
summary: script.summary,
|
|
80
81
|
description: script.description ?? '',
|
|
81
82
|
content: script.content,
|
|
82
|
-
parent_hash: script.hash != '' ? script.hash : undefined,
|
|
83
|
+
parent_hash: script.hash != '' ? topHash ?? script.hash : undefined,
|
|
83
84
|
schema: script.schema,
|
|
84
85
|
is_template: script.is_template,
|
|
85
86
|
language: script.language,
|
|
@@ -93,10 +94,11 @@ async function editScript(leave) {
|
|
|
93
94
|
else {
|
|
94
95
|
await goto(`/scripts/edit/${newHash}?step=2`);
|
|
95
96
|
script.hash = newHash;
|
|
97
|
+
topHash = undefined;
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
catch (error) {
|
|
99
|
-
sendUserToast(`
|
|
101
|
+
sendUserToast(`Error while saving the script: ${error.body || error.message}`, true);
|
|
100
102
|
}
|
|
101
103
|
loadingSave = false;
|
|
102
104
|
}
|
|
@@ -107,7 +109,7 @@ async function changeStep(step) {
|
|
|
107
109
|
await inferArgs(script.language, script.content, script.schema);
|
|
108
110
|
}
|
|
109
111
|
catch (error) {
|
|
110
|
-
console.info('
|
|
112
|
+
console.info('The main signature was not parsable. This script is considered to be without main function');
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
goto(`?step=${step}`);
|
|
@@ -1 +1,206 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
conf?: {
|
|
6
|
+
wordPattern: RegExp;
|
|
7
|
+
comments: {
|
|
8
|
+
lineComment: string;
|
|
9
|
+
blockComment: [string, string];
|
|
10
|
+
};
|
|
11
|
+
brackets: [string, string][];
|
|
12
|
+
onEnterRules: never[];
|
|
13
|
+
autoClosingPairs: ({
|
|
14
|
+
open: string;
|
|
15
|
+
close: string;
|
|
16
|
+
notIn?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
open: string;
|
|
19
|
+
close: string;
|
|
20
|
+
notIn: string[];
|
|
21
|
+
})[];
|
|
22
|
+
folding: {
|
|
23
|
+
markers: {
|
|
24
|
+
start: RegExp;
|
|
25
|
+
end: RegExp;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
} | undefined;
|
|
29
|
+
language?: {
|
|
30
|
+
defaultToken: string;
|
|
31
|
+
tokenPostfix: string;
|
|
32
|
+
keywords: string[];
|
|
33
|
+
operators: string[];
|
|
34
|
+
symbols: RegExp;
|
|
35
|
+
escapes: RegExp;
|
|
36
|
+
digits: RegExp;
|
|
37
|
+
octaldigits: RegExp;
|
|
38
|
+
binarydigits: RegExp;
|
|
39
|
+
hexdigits: RegExp;
|
|
40
|
+
regexpctl: RegExp;
|
|
41
|
+
regexpesc: RegExp;
|
|
42
|
+
tokenizer: {
|
|
43
|
+
root: ((string | RegExp)[] | (RegExp | {
|
|
44
|
+
token: string;
|
|
45
|
+
next: string;
|
|
46
|
+
})[])[];
|
|
47
|
+
common: ((string | RegExp)[] | (RegExp | {
|
|
48
|
+
cases: {
|
|
49
|
+
'@keywords': string;
|
|
50
|
+
'@default': string;
|
|
51
|
+
};
|
|
52
|
+
})[] | {
|
|
53
|
+
include: string;
|
|
54
|
+
} | (RegExp | {
|
|
55
|
+
token: string;
|
|
56
|
+
bracket: string;
|
|
57
|
+
next: string;
|
|
58
|
+
})[] | (RegExp | {
|
|
59
|
+
cases: {
|
|
60
|
+
'@operators': string;
|
|
61
|
+
'@default': string;
|
|
62
|
+
};
|
|
63
|
+
})[])[];
|
|
64
|
+
whitespace: (string | RegExp)[][];
|
|
65
|
+
comment: (string | RegExp)[][];
|
|
66
|
+
jsdoc: (string | RegExp)[][];
|
|
67
|
+
regexp: ((string | RegExp)[] | (RegExp | (string | {
|
|
68
|
+
token: string;
|
|
69
|
+
next: string;
|
|
70
|
+
})[])[] | (RegExp | (string | {
|
|
71
|
+
token: string;
|
|
72
|
+
bracket: string;
|
|
73
|
+
next: string;
|
|
74
|
+
})[])[])[];
|
|
75
|
+
regexrange: ((string | RegExp)[] | (RegExp | {
|
|
76
|
+
token: string;
|
|
77
|
+
next: string;
|
|
78
|
+
bracket: string;
|
|
79
|
+
})[])[];
|
|
80
|
+
string_double: (string | RegExp)[][];
|
|
81
|
+
string_single: (string | RegExp)[][];
|
|
82
|
+
string_backtick: ((string | RegExp)[] | (RegExp | {
|
|
83
|
+
token: string;
|
|
84
|
+
next: string;
|
|
85
|
+
})[])[];
|
|
86
|
+
bracketCounting: ((string | RegExp)[] | {
|
|
87
|
+
include: string;
|
|
88
|
+
})[];
|
|
89
|
+
};
|
|
90
|
+
} | undefined;
|
|
91
|
+
code?: string | undefined;
|
|
92
|
+
hash?: string | undefined;
|
|
93
|
+
automaticLayout?: boolean | undefined;
|
|
94
|
+
extraLib?: string | undefined;
|
|
95
|
+
autoHeight?: boolean | undefined;
|
|
96
|
+
fixedOverflowWidgets?: boolean | undefined;
|
|
97
|
+
fontSize?: number | undefined;
|
|
98
|
+
insertAtCursor?: ((code: string) => void) | undefined;
|
|
99
|
+
setCode?: ((ncode: string) => void) | undefined;
|
|
100
|
+
getCode?: (() => string) | undefined;
|
|
101
|
+
focus?: (() => void) | undefined;
|
|
102
|
+
};
|
|
103
|
+
events: {
|
|
104
|
+
change: CustomEvent<any>;
|
|
105
|
+
focus: CustomEvent<any>;
|
|
106
|
+
} & {
|
|
107
|
+
[evt: string]: CustomEvent<any>;
|
|
108
|
+
};
|
|
109
|
+
slots: {};
|
|
110
|
+
};
|
|
111
|
+
export type TemplateEditorProps = typeof __propDef.props;
|
|
112
|
+
export type TemplateEditorEvents = typeof __propDef.events;
|
|
113
|
+
export type TemplateEditorSlots = typeof __propDef.slots;
|
|
114
|
+
export default class TemplateEditor extends SvelteComponentTyped<TemplateEditorProps, TemplateEditorEvents, TemplateEditorSlots> {
|
|
115
|
+
get conf(): {
|
|
116
|
+
wordPattern: RegExp;
|
|
117
|
+
comments: {
|
|
118
|
+
lineComment: string;
|
|
119
|
+
blockComment: [string, string];
|
|
120
|
+
};
|
|
121
|
+
brackets: [string, string][];
|
|
122
|
+
onEnterRules: never[];
|
|
123
|
+
autoClosingPairs: ({
|
|
124
|
+
open: string;
|
|
125
|
+
close: string;
|
|
126
|
+
notIn?: undefined;
|
|
127
|
+
} | {
|
|
128
|
+
open: string;
|
|
129
|
+
close: string;
|
|
130
|
+
notIn: string[];
|
|
131
|
+
})[];
|
|
132
|
+
folding: {
|
|
133
|
+
markers: {
|
|
134
|
+
start: RegExp;
|
|
135
|
+
end: RegExp;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
get language(): {
|
|
140
|
+
defaultToken: string;
|
|
141
|
+
tokenPostfix: string;
|
|
142
|
+
keywords: string[];
|
|
143
|
+
operators: string[];
|
|
144
|
+
symbols: RegExp;
|
|
145
|
+
escapes: RegExp;
|
|
146
|
+
digits: RegExp;
|
|
147
|
+
octaldigits: RegExp;
|
|
148
|
+
binarydigits: RegExp;
|
|
149
|
+
hexdigits: RegExp;
|
|
150
|
+
regexpctl: RegExp;
|
|
151
|
+
regexpesc: RegExp;
|
|
152
|
+
tokenizer: {
|
|
153
|
+
root: ((string | RegExp)[] | (RegExp | {
|
|
154
|
+
token: string;
|
|
155
|
+
next: string;
|
|
156
|
+
})[])[];
|
|
157
|
+
common: ((string | RegExp)[] | (RegExp | {
|
|
158
|
+
cases: {
|
|
159
|
+
'@keywords': string;
|
|
160
|
+
'@default': string;
|
|
161
|
+
};
|
|
162
|
+
})[] | {
|
|
163
|
+
include: string;
|
|
164
|
+
} | (RegExp | {
|
|
165
|
+
token: string;
|
|
166
|
+
bracket: string;
|
|
167
|
+
next: string;
|
|
168
|
+
})[] | (RegExp | {
|
|
169
|
+
cases: {
|
|
170
|
+
'@operators': string;
|
|
171
|
+
'@default': string;
|
|
172
|
+
};
|
|
173
|
+
})[])[];
|
|
174
|
+
whitespace: (string | RegExp)[][];
|
|
175
|
+
comment: (string | RegExp)[][];
|
|
176
|
+
jsdoc: (string | RegExp)[][];
|
|
177
|
+
regexp: ((string | RegExp)[] | (RegExp | (string | {
|
|
178
|
+
token: string;
|
|
179
|
+
next: string;
|
|
180
|
+
})[])[] | (RegExp | (string | {
|
|
181
|
+
token: string;
|
|
182
|
+
bracket: string;
|
|
183
|
+
next: string;
|
|
184
|
+
})[])[])[];
|
|
185
|
+
regexrange: ((string | RegExp)[] | (RegExp | {
|
|
186
|
+
token: string;
|
|
187
|
+
next: string;
|
|
188
|
+
bracket: string;
|
|
189
|
+
})[])[];
|
|
190
|
+
string_double: (string | RegExp)[][];
|
|
191
|
+
string_single: (string | RegExp)[][];
|
|
192
|
+
string_backtick: ((string | RegExp)[] | (RegExp | {
|
|
193
|
+
token: string;
|
|
194
|
+
next: string;
|
|
195
|
+
})[])[];
|
|
196
|
+
bracketCounting: ((string | RegExp)[] | {
|
|
197
|
+
include: string;
|
|
198
|
+
})[];
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
get insertAtCursor(): (code: string) => void;
|
|
202
|
+
get setCode(): (ncode: string) => void;
|
|
203
|
+
get getCode(): () => string;
|
|
204
|
+
get focus(): () => void;
|
|
205
|
+
}
|
|
1
206
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { Alert } from '../../../common';
|
|
2
|
+
import { getContext, onMount } from 'svelte';
|
|
2
3
|
import { initConfig, initOutput } from '../../editor/appUtils';
|
|
3
4
|
import { components } from '../../editor/component';
|
|
4
5
|
import ResolveConfig from '../helpers/ResolveConfig.svelte';
|
|
@@ -24,18 +25,23 @@ onMount(async () => {
|
|
|
24
25
|
});
|
|
25
26
|
let h = undefined;
|
|
26
27
|
let w = undefined;
|
|
27
|
-
$: Plotly &&
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
28
|
+
$: Plotly && render && result && divEl && h && w && plot();
|
|
29
|
+
let error = '';
|
|
30
|
+
function plot() {
|
|
31
|
+
try {
|
|
32
|
+
Plotly.newPlot(divEl, Array.isArray(result) ? result : [result], {
|
|
33
|
+
width: w,
|
|
34
|
+
height: h,
|
|
35
|
+
margin: { l: 50, r: 40, b: 40, t: 40, pad: 4 },
|
|
36
|
+
...resolvedConfig.layout
|
|
37
|
+
}, { responsive: true, displayModeBar: false });
|
|
38
|
+
error = '';
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
error = e.message;
|
|
42
|
+
console.error(e);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
39
45
|
</script>
|
|
40
46
|
|
|
41
47
|
{#each Object.keys(components['plotlycomponent'].initialData.configuration) as key (key)}
|
|
@@ -49,6 +55,13 @@ $: Plotly &&
|
|
|
49
55
|
|
|
50
56
|
<div class="w-full h-full" bind:clientHeight={h} bind:clientWidth={w}>
|
|
51
57
|
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
58
|
+
{#if error != ''}
|
|
59
|
+
<div class="flex flex-col h-full w-full overflow-auto">
|
|
60
|
+
<Alert title="Plotly error" type="error" size="xs" class="h-full w-full ">
|
|
61
|
+
<pre class="w-full bg-white p-2 rounded-md whitespace-pre-wrap">{error}</pre>
|
|
62
|
+
</Alert>
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
52
65
|
<div on:pointerdown bind:this={divEl} />
|
|
53
66
|
</RunnableWrapper>
|
|
54
67
|
</div>
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
import 'ag-grid-community/styles/ag-grid.css';
|
|
3
3
|
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
|
4
4
|
import { getContext, onMount } from 'svelte';
|
|
5
|
-
import InputValue from '../../helpers/InputValue.svelte';
|
|
6
5
|
import RunnableWrapper from '../../helpers/RunnableWrapper.svelte';
|
|
7
6
|
import { isObject } from '../../../../../utils';
|
|
8
7
|
import Alert from '../../../../common/alert/Alert.svelte';
|
|
9
|
-
import { initOutput } from '../../../editor/appUtils';
|
|
8
|
+
import { initConfig, initOutput } from '../../../editor/appUtils';
|
|
9
|
+
import ResolveConfig from '../../helpers/ResolveConfig.svelte';
|
|
10
|
+
import { components } from '../../../editor/component';
|
|
10
11
|
export let id;
|
|
11
12
|
export let componentInput;
|
|
12
13
|
export let configuration;
|
|
@@ -14,11 +15,14 @@ export let initializing = undefined;
|
|
|
14
15
|
export let render;
|
|
15
16
|
let result = undefined;
|
|
16
17
|
const { worldStore, selectedComponent } = getContext('AppViewerContext');
|
|
18
|
+
let resolvedConfig = initConfig(components['aggridcomponent'].initialData.configuration, configuration);
|
|
17
19
|
let outputs = initOutput($worldStore, id, {
|
|
18
20
|
selectedRowIndex: 0,
|
|
19
21
|
selectedRow: {},
|
|
20
22
|
result: [],
|
|
21
|
-
loading: false
|
|
23
|
+
loading: false,
|
|
24
|
+
page: 0,
|
|
25
|
+
newChange: { row: 0, column: '', value: undefined }
|
|
22
26
|
});
|
|
23
27
|
let selectedRowIndex = -1;
|
|
24
28
|
function toggleRow(row, rowIndex) {
|
|
@@ -42,10 +46,6 @@ $: selectedRowIndex === -1 &&
|
|
|
42
46
|
$: outputs?.result?.set(result ?? []);
|
|
43
47
|
let clientHeight;
|
|
44
48
|
let clientWidth;
|
|
45
|
-
let columnDefs = undefined;
|
|
46
|
-
let allEditable = undefined;
|
|
47
|
-
let pagination = undefined;
|
|
48
|
-
let pageSize = 10;
|
|
49
49
|
function onCellValueChanged(event) {
|
|
50
50
|
if (result) {
|
|
51
51
|
let dataCell = event.newValue;
|
|
@@ -53,15 +53,24 @@ function onCellValueChanged(event) {
|
|
|
53
53
|
dataCell = JSON.parse(dataCell);
|
|
54
54
|
}
|
|
55
55
|
catch (e) { }
|
|
56
|
-
|
|
56
|
+
outputs?.newChange?.set({
|
|
57
|
+
row: event.node.rowIndex,
|
|
58
|
+
column: event.colDef.field,
|
|
59
|
+
value: dataCell
|
|
60
|
+
});
|
|
61
|
+
result[event.node.rowIndex][event.colDef.field] = dataCell;
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
</script>
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
{#each Object.keys(components['aggridcomponent'].initialData.configuration) as key (key)}
|
|
67
|
+
<ResolveConfig
|
|
68
|
+
{id}
|
|
69
|
+
{key}
|
|
70
|
+
bind:resolvedConfig={resolvedConfig[key]}
|
|
71
|
+
configuration={configuration[key]}
|
|
72
|
+
/>
|
|
73
|
+
{/each}
|
|
65
74
|
|
|
66
75
|
<RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
|
|
67
76
|
{#if Array.isArray(result) && result.every(isObject)}
|
|
@@ -78,13 +87,16 @@ function onCellValueChanged(event) {
|
|
|
78
87
|
style:width="{clientWidth}px"
|
|
79
88
|
class="ag-theme-alpine"
|
|
80
89
|
>
|
|
81
|
-
{#key pagination}
|
|
90
|
+
{#key resolvedConfig?.pagination}
|
|
82
91
|
<AgGridSvelte
|
|
83
92
|
bind:rowData={result}
|
|
84
|
-
{columnDefs}
|
|
85
|
-
{pagination}
|
|
86
|
-
|
|
87
|
-
defaultColDef={{ flex: 1, editable: allEditable, onCellValueChanged }}
|
|
93
|
+
columnDefs={resolvedConfig?.columnDefs}
|
|
94
|
+
pagination={resolvedConfig?.pagination}
|
|
95
|
+
paginationAutoPageSize={resolvedConfig?.pagination}
|
|
96
|
+
defaultColDef={{ flex: 1, editable: resolvedConfig?.allEditable, onCellValueChanged }}
|
|
97
|
+
onPaginationChanged={(event) => {
|
|
98
|
+
outputs?.page.set(event.api.paginationGetCurrentPage())
|
|
99
|
+
}}
|
|
88
100
|
/>
|
|
89
101
|
{/key}
|
|
90
102
|
</div>
|