windmill-components 1.79.0 → 1.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/components/ArgInput.svelte +3 -0
  2. package/components/ArgInput.svelte.d.ts +1 -0
  3. package/components/DisplayResult.svelte +18 -15
  4. package/components/SchemaEditor.svelte +15 -10
  5. package/components/SettingSection.svelte +1 -1
  6. package/components/Toggle.svelte +5 -2
  7. package/components/Toggle.svelte.d.ts +1 -0
  8. package/components/apps/components/buttons/AppButton.svelte +33 -40
  9. package/components/apps/components/buttons/AppButton.svelte.d.ts +2 -1
  10. package/components/apps/components/buttons/AppForm.svelte +22 -15
  11. package/components/apps/components/buttons/AppForm.svelte.d.ts +1 -1
  12. package/components/apps/components/buttons/AppFormButton.svelte +32 -24
  13. package/components/apps/components/buttons/AppFormButton.svelte.d.ts +1 -3
  14. package/components/apps/components/display/AppBarChart.svelte +2 -2
  15. package/components/apps/components/display/AppBarChart.svelte.d.ts +1 -1
  16. package/components/apps/components/display/AppDisplayComponent.svelte +2 -2
  17. package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +1 -1
  18. package/components/apps/components/display/AppHtml.svelte +10 -2
  19. package/components/apps/components/display/AppHtml.svelte.d.ts +1 -1
  20. package/components/apps/components/display/AppIcon.svelte +4 -1
  21. package/components/apps/components/display/AppIcon.svelte.d.ts +1 -1
  22. package/components/apps/components/display/AppImage.svelte +28 -15
  23. package/components/apps/components/display/AppImage.svelte.d.ts +1 -1
  24. package/components/apps/components/display/AppMap.svelte.d.ts +1 -1
  25. package/components/apps/components/display/AppPdf.svelte +3 -2
  26. package/components/apps/components/display/AppPdf.svelte.d.ts +1 -1
  27. package/components/apps/components/display/AppPieChart.svelte +2 -2
  28. package/components/apps/components/display/AppPieChart.svelte.d.ts +1 -1
  29. package/components/apps/components/display/AppScatterChart.svelte +2 -2
  30. package/components/apps/components/display/AppScatterChart.svelte.d.ts +1 -1
  31. package/components/apps/components/display/AppText.svelte +35 -22
  32. package/components/apps/components/display/AppText.svelte.d.ts +1 -1
  33. package/components/apps/components/display/AppTimeseries.svelte +2 -2
  34. package/components/apps/components/display/AppTimeseries.svelte.d.ts +1 -1
  35. package/components/apps/components/display/PlotlyHtml.svelte +2 -2
  36. package/components/apps/components/display/VegaLiteHtml.svelte +2 -2
  37. package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
  38. package/components/apps/components/display/table/AppTable.svelte +28 -12
  39. package/components/apps/components/display/table/AppTable.svelte.d.ts +1 -1
  40. package/components/apps/components/helpers/HiddenComponent.svelte +6 -3
  41. package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +1 -1
  42. package/components/apps/components/helpers/InputValue.svelte +9 -9
  43. package/components/apps/components/helpers/Loader.svelte +18 -0
  44. package/components/apps/components/helpers/Loader.svelte.d.ts +18 -0
  45. package/components/apps/components/helpers/NonRunnableComponent.svelte +1 -12
  46. package/components/apps/components/helpers/ResolveConfig.svelte +29 -0
  47. package/components/apps/components/helpers/ResolveConfig.svelte.d.ts +21 -0
  48. package/components/apps/components/helpers/RunnableComponent.svelte +114 -89
  49. package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +13 -3
  50. package/components/apps/components/helpers/RunnableWrapper.svelte +48 -9
  51. package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +26 -2
  52. package/components/apps/components/inputs/AppCheckbox.svelte +1 -1
  53. package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +1 -1
  54. package/components/apps/components/inputs/AppDateInput.svelte.d.ts +1 -1
  55. package/components/apps/components/inputs/AppFileInput.svelte.d.ts +1 -1
  56. package/components/apps/components/inputs/AppMultiSelect.svelte +0 -1
  57. package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +1 -1
  58. package/components/apps/components/inputs/AppNumberInput.svelte +1 -1
  59. package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +1 -3
  60. package/components/apps/components/inputs/AppRangeInput.svelte +7 -1
  61. package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +2 -1
  62. package/components/apps/components/inputs/AppSelect.svelte +8 -3
  63. package/components/apps/components/inputs/AppSelect.svelte.d.ts +1 -1
  64. package/components/apps/components/inputs/AppSliderInputs.svelte +7 -1
  65. package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +2 -1
  66. package/components/apps/components/inputs/AppTextInput.svelte +4 -4
  67. package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -3
  68. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +17 -19
  69. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +1 -1
  70. package/components/apps/components/layout/AppContainer.svelte +7 -4
  71. package/components/apps/components/layout/AppContainer.svelte.d.ts +1 -1
  72. package/components/apps/components/layout/AppDivider.svelte +4 -1
  73. package/components/apps/components/layout/AppDivider.svelte.d.ts +1 -1
  74. package/components/apps/components/layout/AppDrawer.svelte +7 -4
  75. package/components/apps/components/layout/AppDrawer.svelte.d.ts +1 -1
  76. package/components/apps/components/layout/AppSplitpanes.svelte +34 -21
  77. package/components/apps/components/layout/AppSplitpanes.svelte.d.ts +1 -3
  78. package/components/apps/components/layout/AppTabs.svelte +17 -34
  79. package/components/apps/components/layout/AppTabs.svelte.d.ts +1 -2
  80. package/components/apps/editor/AppEditor.svelte +3 -1
  81. package/components/apps/editor/AppEditorHeader.svelte +2 -3
  82. package/components/apps/editor/AppPreview.svelte +10 -15
  83. package/components/apps/editor/ComponentHeader.svelte +10 -8
  84. package/components/apps/editor/ComponentHeader.svelte.d.ts +0 -1
  85. package/components/apps/editor/GridEditor.svelte +21 -50
  86. package/components/apps/editor/GridEditor.svelte.d.ts +0 -2
  87. package/components/apps/editor/RecomputeAllComponents.svelte +13 -2
  88. package/components/apps/editor/SettingsPanel.svelte +103 -40
  89. package/components/apps/editor/SubGridEditor.svelte +32 -41
  90. package/components/apps/editor/SubGridEditor.svelte.d.ts +1 -2
  91. package/components/apps/editor/appUtils.d.ts +49 -7
  92. package/components/apps/editor/appUtils.js +133 -37
  93. package/components/apps/editor/component/Component.svelte +21 -10
  94. package/components/apps/editor/component/Component.svelte.d.ts +1 -2
  95. package/components/apps/editor/component/ComponentNavigation.svelte +17 -11
  96. package/components/apps/editor/component/components.d.ts +1550 -17
  97. package/components/apps/editor/component/components.js +295 -325
  98. package/components/apps/editor/component/default-codes.d.ts +1 -1
  99. package/components/apps/editor/component/default-codes.js +25 -25
  100. package/components/apps/editor/componentsPanel/ComponentList.svelte +18 -3
  101. package/components/apps/editor/componentsPanel/CssProperty.svelte +5 -3
  102. package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +3 -1
  103. package/components/apps/editor/componentsPanel/CssSettings.svelte +48 -90
  104. package/components/apps/editor/componentsPanel/ListItem.svelte +3 -0
  105. package/components/apps/editor/componentsPanel/ListItem.svelte.d.ts +2 -0
  106. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +1 -1
  107. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +146 -130
  108. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +2 -1
  109. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +31 -3
  110. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
  111. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +42 -76
  112. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +67 -17
  113. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte.d.ts +1 -3
  114. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +27 -0
  115. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte.d.ts +17 -0
  116. package/components/apps/editor/inlineScriptsPanel/utils.d.ts +2 -0
  117. package/components/apps/editor/inlineScriptsPanel/utils.js +6 -5
  118. package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +10 -2
  119. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +37 -31
  120. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +4 -104
  121. package/components/apps/editor/settingsPanel/ComponentPanel.svelte +90 -54
  122. package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +5 -3
  123. package/components/apps/editor/settingsPanel/GridTab.svelte +0 -1
  124. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +99 -80
  125. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +8 -0
  126. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +25 -2
  127. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +1 -0
  128. package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +52 -0
  129. package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte.d.ts +28 -0
  130. package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +70 -26
  131. package/components/apps/editor/settingsPanel/SelectedRunnable.svelte.d.ts +2 -0
  132. package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +7 -5
  133. package/components/apps/editor/settingsPanel/SubTypeEditor.svelte.d.ts +3 -2
  134. package/components/apps/editor/settingsPanel/TableActions.svelte +8 -63
  135. package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +2 -4
  136. package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +3 -1
  137. package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte.d.ts +2 -4
  138. package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +5 -5
  139. package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte.d.ts +2 -0
  140. package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +47 -31
  141. package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +8 -2
  142. package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte +46 -0
  143. package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte.d.ts +20 -0
  144. package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +7 -0
  145. package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte.d.ts +1 -0
  146. package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte +20 -70
  147. package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte.d.ts +1 -0
  148. package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +14 -8
  149. package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte.d.ts +5 -1
  150. package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte +85 -27
  151. package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte.d.ts +4 -6
  152. package/components/apps/gridUtils.js +1 -1
  153. package/components/apps/inputType.d.ts +12 -16
  154. package/components/apps/rx.d.ts +2 -0
  155. package/components/apps/rx.js +8 -2
  156. package/components/apps/svelte-grid/Grid.svelte +0 -4
  157. package/components/apps/svelte-grid/Grid.svelte.d.ts +1 -1
  158. package/components/apps/svelte-grid/MoveResize.svelte +24 -30
  159. package/components/apps/svelte-grid/MoveResize.svelte.d.ts +0 -4
  160. package/components/apps/svelte-grid/types.d.ts +1 -7
  161. package/components/apps/svelte-grid/utils/helper.js +6 -10
  162. package/components/apps/types.d.ts +21 -22
  163. package/components/apps/utils.d.ts +2 -2
  164. package/components/apps/utils.js +13 -11
  165. package/components/common/skeleton/Skeleton.svelte +1 -1
  166. package/components/flows/flowStateUtils.js +8 -1
  167. package/package.json +7 -4
  168. package/components/apps/editor/GridPanel.svelte +0 -31
  169. package/components/apps/editor/GridPanel.svelte.d.ts +0 -18
  170. package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +0 -12
  171. package/components/apps/editor/componentsPanel/componentStaticValues.js +0 -25
@@ -1,18 +1,15 @@
1
1
  <script>import Button from '../../../common/button/Button.svelte';
2
+ import Toggle from '../../../Toggle.svelte';
2
3
  import Tooltip from '../../../Tooltip.svelte';
3
4
  import { faClose, faEdit } from '@fortawesome/free-solid-svg-icons';
5
+ import { includes } from 'lodash';
4
6
  import { getContext } from 'svelte';
5
7
  import { clearResultAppInput } from '../../utils';
6
- import InlineScriptEditorDrawer from '../inlineScriptsPanel/InlineScriptEditorDrawer.svelte';
7
8
  import ComponentTriggerList from './triggerLists/ComponentTriggerList.svelte';
8
9
  const { app } = getContext('AppViewerContext');
10
+ const { selectedComponentInEditor } = getContext('AppEditorContext');
9
11
  export let appInput;
10
- let inlineScriptEditorDrawer;
11
- function edit() {
12
- if (appInput.runnable?.type === 'runnableByName') {
13
- inlineScriptEditorDrawer?.openDrawer();
14
- }
15
- }
12
+ export let appComponent;
16
13
  function detach() {
17
14
  if (appInput.runnable?.type === 'runnableByName' && appInput.runnable.inlineScript) {
18
15
  $app.unusedInlineScripts.push({
@@ -28,13 +25,7 @@ function clear() {
28
25
  }
29
26
  </script>
30
27
 
31
- {#if appInput.runnable && appInput.runnable.type === 'runnableByName' && appInput.runnable.inlineScript}
32
- <InlineScriptEditorDrawer
33
- bind:this={inlineScriptEditorDrawer}
34
- bind:inlineScript={appInput.runnable.inlineScript}
35
- />
36
- {/if}
37
- <div class="flex flex-col xl:flex-row justify-between w-full flex-wrap items-center gap-1">
28
+ <div class="flex justify-between w-full items-center gap-1">
38
29
  <span class="text-xs font-semibold truncate">
39
30
  {#if appInput.runnable?.type === 'runnableByName'}
40
31
  {appInput.runnable.name}
@@ -42,13 +33,10 @@ function clear() {
42
33
  {appInput.runnable.path}
43
34
  {/if}
44
35
  </span>
45
- <div class="flex gap-1 flex-wrap justify-center">
36
+ <div class="flex gap-1 justify-center">
46
37
  {#if appInput.runnable?.type === 'runnableByName' && appInput.runnable.inlineScript}
47
- <Button size="xs" color="light" variant="border" startIcon={{ icon: faEdit }} on:click={edit}>
48
- Edit
49
- </Button>
50
38
  <Button size="xs" color="light" variant="border" on:click={detach}>
51
- Detach
39
+ Detach&nbsp;
52
40
  <Tooltip>
53
41
  Detaching an inline script keep it for later to be reused by another component
54
42
  </Tooltip>
@@ -59,17 +47,73 @@ function clear() {
59
47
  </Button>
60
48
  </div>
61
49
  </div>
50
+ <div>
51
+ <div class="w-full"><div class="mx-auto w-0">&downarrow;</div></div>
52
+ <div class="flex gap-1 justify-between items-center">
53
+ <span class="text-xs font-semibold truncate">
54
+ Transformer &nbsp;<Tooltip
55
+ >A transformer is an optional frontend script that is executed right after the component's
56
+ script whose purpose is to do lightweight transformation in the browser. It takes the
57
+ previous computation's result as `result`</Tooltip
58
+ ></span
59
+ >
60
+ <div class="flex gap-1">
61
+ {#if !appInput.transformer}
62
+ <div>
63
+ <Button
64
+ variant="border"
65
+ color="light"
66
+ size="xs"
67
+ on:click={() => {
68
+ appInput.transformer = {
69
+ language: 'frontend',
70
+ content: 'return result'
71
+ }
72
+ $selectedComponentInEditor = appComponent.id + '_transformer'
73
+ }}>Add Transformer</Button
74
+ >
75
+ </div>
76
+ {:else}
77
+ <Button
78
+ size="xs"
79
+ color="red"
80
+ variant="border"
81
+ startIcon={{ icon: faClose }}
82
+ on:click={() => {
83
+ appInput.transformer = undefined
84
+ }}
85
+ >
86
+ Clear
87
+ </Button>
88
+ {/if}
89
+ </div></div
90
+ >
91
+ </div>
92
+
62
93
  {#if appInput.runnable?.type === 'runnableByName' && appInput.runnable.inlineScript}
63
- <ComponentTriggerList fields={appInput.fields} />
94
+ {#if !['buttoncomponent', 'formbuttoncomponent', 'formcomponent'].includes(appComponent.type)}
95
+ <div class="flex items-center">
96
+ <Toggle
97
+ size="xs"
98
+ color="red"
99
+ bind:checked={appInput.doNotRecomputeOnInputChanged}
100
+ options={{ right: 'do NOT recompute on input changes' }}
101
+ />
102
+ <Tooltip>If not toggled, whenever an input is changed, the script will be re-run.</Tooltip>
103
+ </div>
104
+ {/if}
105
+
106
+ <div>
107
+ <ComponentTriggerList
108
+ bind:runnable={appInput.runnable}
109
+ {appComponent}
110
+ fields={appInput.fields}
111
+ doNotRecomputeOnInputChanged={appInput.doNotRecomputeOnInputChanged}
112
+ />
113
+ </div>
64
114
  {/if}
65
115
  {#if appInput.runnable?.type === 'runnableByName' && !appInput.runnable.inlineScript}
66
116
  <span class="text-xs text-gray-500">
67
117
  Please configure the language in the inline script panel
68
118
  </span>
69
119
  {/if}
70
- {#if appInput.runnable?.type === 'runnableByName' && appInput.runnable.inlineScript?.language === 'frontend'}
71
- <span class="text-xs text-gray-500">
72
- If the component is a display component. The script will be recomputed upon any changes to any
73
- output or to the state.
74
- </span>
75
- {/if}
@@ -1,8 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { ResultAppInput } from '../../inputType';
3
+ import type { AppComponent } from '../component';
3
4
  declare const __propDef: {
4
5
  props: {
5
6
  appInput: ResultAppInput;
7
+ appComponent: AppComponent;
6
8
  };
7
9
  events: {
8
10
  [evt: string]: CustomEvent<any>;
@@ -1,15 +1,17 @@
1
1
  <script>import StaticInputEditor from './inputEditor/StaticInputEditor.svelte';
2
2
  export let value;
3
3
  export let componentInput;
4
+ export let subFieldType;
4
5
  let fakeComponentInput = {
5
6
  ...componentInput,
6
- value,
7
- // We don't support array of arrays
8
- // @ts-ignore
9
- fieldType: componentInput.subFieldType
7
+ value
10
8
  };
11
9
  // Bubble up changes to the real componentInput
12
10
  $: fakeComponentInput && (value = fakeComponentInput.value);
13
11
  </script>
14
12
 
15
- <StaticInputEditor bind:componentInput={fakeComponentInput} />
13
+ <StaticInputEditor
14
+ noVariablePicker
15
+ fieldType={subFieldType}
16
+ bind:componentInput={fakeComponentInput}
17
+ />
@@ -1,9 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { StaticAppInput } from '../../inputType';
2
+ import type { InputType, StaticInput } from '../../inputType';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  value: any;
6
- componentInput: StaticAppInput;
6
+ componentInput: StaticInput<any>;
7
+ subFieldType: InputType | undefined;
7
8
  };
8
9
  events: {
9
10
  [evt: string]: CustomEvent<any>;
@@ -5,82 +5,27 @@ import { classNames } from '../../../../utils';
5
5
  import { faPlus, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
6
6
  import { getContext } from 'svelte';
7
7
  import { Icon } from 'svelte-awesome';
8
+ import { appComponentFromType, clearErrorByComponentId, clearJobsByComponentId } from '../appUtils';
8
9
  import PanelSection from './common/PanelSection.svelte';
9
10
  import TableActionLabel from './TableActionLabel.svelte';
10
11
  export let components;
11
12
  export let id;
12
- const { selectedComponent } = getContext('AppViewerContext');
13
+ const { selectedComponent, app, errorByComponent, jobs } = getContext('AppViewerContext');
13
14
  function addComponent() {
14
15
  const actionId = getNextId(components.map((x) => x.id.split('_')[1]));
15
16
  const newComponent = {
16
- id: `${id}_${actionId}`,
17
- type: 'buttoncomponent',
18
- configuration: {
19
- label: {
20
- type: 'static',
21
- value: 'Action',
22
- fieldType: 'text'
23
- },
24
- color: {
25
- fieldType: 'select',
26
- type: 'static',
27
- value: 'dark',
28
- optionValuesKey: 'buttonColorOptions'
29
- },
30
- size: {
31
- fieldType: 'select',
32
- type: 'static',
33
- value: 'xs',
34
- optionValuesKey: 'buttonSizeOptions'
35
- },
36
- disabled: {
37
- fieldType: 'boolean',
38
- type: 'eval',
39
- expr: 'false',
40
- tooltip: "Disabled based on a predicate. Use `row` to access the current row's data"
41
- },
42
- goto: {
43
- tooltip: 'Go to an url on success if not empty',
44
- fieldType: 'text',
45
- type: 'static',
46
- value: ''
47
- },
48
- gotoNewTab: {
49
- tooltip: 'Go to create a new tab',
50
- fieldType: 'boolean',
51
- type: 'static',
52
- value: true
53
- },
54
- beforeIcon: {
55
- type: 'static',
56
- value: undefined,
57
- fieldType: 'icon-select',
58
- onlyStatic: true
59
- },
60
- afterIcon: {
61
- type: 'static',
62
- value: undefined,
63
- fieldType: 'icon-select',
64
- onlyStatic: true
65
- }
66
- },
67
- componentInput: {
68
- type: 'runnable',
69
- fieldType: 'any',
70
- fields: {},
71
- runnable: undefined,
72
- value: undefined
73
- },
74
- recomputeIds: undefined,
75
- customCss: {
76
- button: { style: '', class: '' }
77
- }
17
+ ...appComponentFromType('buttoncomponent')(`${id}_${actionId}`),
18
+ recomputeIds: []
78
19
  };
79
20
  components = [...components, newComponent];
21
+ $app = $app;
80
22
  }
81
23
  function deleteComponent(cid) {
82
24
  components = components.filter((x) => x.id !== cid);
25
+ $errorByComponent = clearErrorByComponentId(cid, $errorByComponent);
26
+ $jobs = clearJobsByComponentId(cid, $jobs);
83
27
  $selectedComponent = id;
28
+ $app = $app;
84
29
  }
85
30
  </script>
86
31
 
@@ -1,10 +1,8 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { AppInput, StaticInput } from '../../../inputType';
2
+ import type { StaticInput } from '../../../inputType';
3
3
  declare const __propDef: {
4
4
  props: {
5
- componentInput: StaticInput<string> & Extract<AppInput, {
6
- fieldType: 'color';
7
- }>;
5
+ componentInput: StaticInput<string>;
8
6
  };
9
7
  events: {
10
8
  [evt: string]: CustomEvent<any>;
@@ -2,7 +2,7 @@
2
2
  import { faArrowRight, faClose } from '@fortawesome/free-solid-svg-icons';
3
3
  import { getContext } from 'svelte';
4
4
  export let componentInput;
5
- const { connectingInput, app } = getContext('AppViewerContext');
5
+ const { connectingInput, app, worldStore } = getContext('AppViewerContext');
6
6
  function applyConnection() {
7
7
  if (!$connectingInput.opened &&
8
8
  $connectingInput.input !== undefined &&
@@ -14,6 +14,8 @@ function applyConnection() {
14
14
  hoveredComponent: undefined
15
15
  };
16
16
  }
17
+ $app = $app;
18
+ $worldStore = $worldStore;
17
19
  }
18
20
  $: $connectingInput && applyConnection();
19
21
  </script>
@@ -1,10 +1,8 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { AppInput, StaticInput } from '../../../inputType';
2
+ import type { StaticInput } from '../../../inputType';
3
3
  declare const __propDef: {
4
4
  props: {
5
- componentInput: StaticInput<string> & Extract<AppInput, {
6
- fieldType: 'icon-select';
7
- }>;
5
+ componentInput: StaticInput<string>;
8
6
  };
9
7
  events: {
10
8
  keydown: KeyboardEvent;
@@ -3,11 +3,11 @@ import RunnableSelector from '../mainInput/RunnableSelector.svelte';
3
3
  import SelectedRunnable from '../SelectedRunnable.svelte';
4
4
  export let appInput;
5
5
  export let defaultUserInput = false;
6
- $: isRunnableSelected = isScriptByPathDefined(appInput) || isScriptByNameDefined(appInput);
6
+ export let appComponent;
7
7
  </script>
8
8
 
9
- {#if isRunnableSelected}
10
- <SelectedRunnable bind:appInput />
11
- {:else}
12
- <RunnableSelector {defaultUserInput} bind:appInput />
9
+ {#if isScriptByPathDefined(appInput) || isScriptByNameDefined(appInput)}
10
+ <SelectedRunnable {appComponent} bind:appInput />
11
+ {:else if appInput !== undefined}
12
+ <RunnableSelector id={appComponent.id} {defaultUserInput} bind:appInput />
13
13
  {/if}
@@ -1,9 +1,11 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { ResultAppInput } from '../../../inputType';
3
+ import type { AppComponent } from '../../component';
3
4
  declare const __propDef: {
4
5
  props: {
5
6
  appInput: ResultAppInput;
6
7
  defaultUserInput?: boolean | undefined;
8
+ appComponent: AppComponent;
7
9
  };
8
10
  events: {
9
11
  [evt: string]: CustomEvent<any>;
@@ -1,5 +1,4 @@
1
1
  <script>import Toggle from '../../../../Toggle.svelte';
2
- import { staticValues } from '../../componentsPanel/componentStaticValues';
3
2
  import ArrayStaticInputEditor from '../ArrayStaticInputEditor.svelte';
4
3
  import ResourcePicker from '../../../../ResourcePicker.svelte';
5
4
  import JsonEditor from './JsonEditor.svelte';
@@ -8,32 +7,47 @@ import IconSelectInput from './IconSelectInput.svelte';
8
7
  import ColorInput from './ColorInput.svelte';
9
8
  import { Icon } from 'svelte-awesome';
10
9
  import { faDollarSign } from '@fortawesome/free-solid-svg-icons';
10
+ import TabSelectInput from './TabSelectInput.svelte';
11
11
  export let componentInput;
12
+ export let fieldType = undefined;
13
+ export let subFieldType = undefined;
14
+ export let selectOptions = undefined;
15
+ export let placeholder = undefined;
16
+ export let format = undefined;
17
+ export let noVariablePicker = false;
12
18
  const { onchange } = getContext('AppViewerContext');
13
19
  const { pickVariableCallback } = getContext('AppEditorContext');
14
20
  $: componentInput && onchange?.();
15
21
  </script>
16
22
 
17
23
  {#if componentInput?.type === 'static'}
18
- {#if componentInput.fieldType === 'number'}
24
+ {#if fieldType === 'number'}
19
25
  <input on:keydown|stopPropagation type="number" bind:value={componentInput.value} />
20
- {:else if componentInput.fieldType === 'textarea'}
26
+ {:else if fieldType === 'textarea'}
21
27
  <textarea on:keydown|stopPropagation bind:value={componentInput.value} />
22
- {:else if componentInput.fieldType === 'date'}
28
+ {:else if fieldType === 'date'}
23
29
  <input on:keydown|stopPropagation type="date" bind:value={componentInput.value} />
24
- {:else if componentInput.fieldType === 'boolean'}
30
+ {:else if fieldType === 'boolean'}
25
31
  <Toggle bind:checked={componentInput.value} />
26
- {:else if componentInput.fieldType === 'select'}
32
+ {:else if fieldType === 'select' && selectOptions}
27
33
  <select on:keydown|stopPropagation on:keydown|stopPropagation bind:value={componentInput.value}>
28
- {#each staticValues[componentInput.optionValuesKey] || [] as option}
29
- <option value={option}>
30
- {option}
31
- </option>
34
+ {#each selectOptions ?? [] as option}
35
+ {#if typeof option == 'string'}
36
+ <option value={option}>
37
+ {option}
38
+ </option>
39
+ {:else}
40
+ <option value={option.value}>
41
+ {option.label}
42
+ </option>
43
+ {/if}
32
44
  {/each}
33
45
  </select>
34
- {:else if componentInput.fieldType === 'icon-select'}
46
+ {:else if fieldType === 'icon-select'}
35
47
  <IconSelectInput bind:componentInput />
36
- {:else if componentInput.fieldType === 'labeledresource'}
48
+ {:else if fieldType === 'tab-select'}
49
+ <TabSelectInput bind:componentInput />
50
+ {:else if fieldType === 'labeledresource'}
37
51
  {#if componentInput?.value && typeof componentInput?.value == 'object' && 'label' in componentInput?.value}
38
52
  <div class="flex flex-col gap-1 w-full">
39
53
  <input
@@ -59,10 +73,10 @@ $: componentInput && onchange?.();
59
73
  {:else}
60
74
  Inconsistent labeled resource object
61
75
  {/if}
62
- {:else if componentInput.fieldType === 'color'}
76
+ {:else if fieldType === 'color'}
63
77
  <ColorInput bind:componentInput />
64
- {:else if componentInput.fieldType === 'object'}
65
- {#if componentInput?.format?.startsWith('resource-')}
78
+ {:else if fieldType === 'object'}
79
+ {#if format?.startsWith('resource-')}
66
80
  <ResourcePicker
67
81
  initialValue={componentInput.value?.split('$res:')[1] || ''}
68
82
  on:change={(e) => {
@@ -75,8 +89,8 @@ $: componentInput && onchange?.();
75
89
  }
76
90
  }
77
91
  }}
78
- resourceType={componentInput.format.split('-').length > 1
79
- ? componentInput.format.substring('resource-'.length)
92
+ resourceType={format.split('-').length > 1
93
+ ? format.substring('resource-'.length)
80
94
  : undefined}
81
95
  />
82
96
  {:else}
@@ -87,28 +101,30 @@ $: componentInput && onchange?.();
87
101
  />
88
102
  </div>
89
103
  {/if}
90
- {:else if componentInput.fieldType === 'array'}
91
- <ArrayStaticInputEditor bind:componentInput on:deleteArrayItem />
104
+ {:else if fieldType === 'array'}
105
+ <ArrayStaticInputEditor {subFieldType} bind:componentInput on:deleteArrayItem />
92
106
  {:else}
93
107
  <div class="flex gap-1">
94
108
  <input
95
109
  on:keydown|stopPropagation
96
110
  type="text"
97
- placeholder="Static value"
111
+ placeholder={placeholder ?? 'Static value'}
98
112
  bind:value={componentInput.value}
99
113
  />
100
- <!-- svelte-ignore a11y-click-events-have-key-events -->
101
- <div
102
- class="min-w-min min-h-[34px] items-center leading-4 px-3 text-gray-600 cursor-pointer border border-gray-700 rounded center-center"
103
- on:click={() => {
104
- $pickVariableCallback = (variable) => {
105
- if (componentInput) {
106
- componentInput.value = `$var:${variable}`
114
+ {#if !noVariablePicker}
115
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
116
+ <div
117
+ class="min-w-min min-h-[34px] items-center leading-4 px-3 text-gray-600 cursor-pointer border border-gray-700 rounded center-center"
118
+ on:click={() => {
119
+ $pickVariableCallback = (variable) => {
120
+ if (componentInput) {
121
+ componentInput.value = `$var:${variable}`
122
+ }
107
123
  }
108
- }
109
- }}
110
- ><Icon data={faDollarSign} />
111
- </div>
124
+ }}
125
+ ><Icon data={faDollarSign} />
126
+ </div>
127
+ {/if}
112
128
  </div>
113
129
  {/if}
114
130
  {/if}
@@ -1,8 +1,14 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { StaticAppInput } from '../../../inputType';
2
+ import type { InputType, StaticInput, StaticOptions } from '../../../inputType';
3
3
  declare const __propDef: {
4
4
  props: {
5
- componentInput: StaticAppInput | undefined;
5
+ componentInput: StaticInput<any> | undefined;
6
+ fieldType?: InputType | undefined;
7
+ subFieldType?: InputType | undefined;
8
+ selectOptions?: StaticOptions['selectOptions'] | undefined;
9
+ placeholder?: string | undefined;
10
+ format?: string | undefined;
11
+ noVariablePicker?: boolean | undefined;
6
12
  };
7
13
  events: {
8
14
  keydown: KeyboardEvent;
@@ -0,0 +1,46 @@
1
+ <script>import { allItems } from '../../../utils';
2
+ import { getContext } from 'svelte';
3
+ export let componentInput;
4
+ const { app } = getContext('AppViewerContext');
5
+ const tabComponents = allItems($app.grid, $app.subgrids).filter((component) => component.data.type === 'tabscomponent');
6
+ </script>
7
+
8
+ {#if componentInput.value && tabComponents.length > 0}
9
+ <div>
10
+ <div class="flex flex-row gap-2 w-full">
11
+ <div class="flex flex-col">
12
+ <label for="tabId" class="text-xs font-semibold">Tab ID</label>
13
+
14
+ <select
15
+ id="tabId"
16
+ bind:value={componentInput.value.id}
17
+ class="border border-gray-300 rounded-md p-1 !w-16"
18
+ >
19
+ {#each tabComponents as tabComponent}
20
+ <option value={tabComponent.data.id}>
21
+ {tabComponent.data.id}
22
+ </option>
23
+ {/each}
24
+ </select>
25
+ </div>
26
+ <div class="flex flex-col">
27
+ <label for="tabIndex" class="text-xs font-semibold">Tab Index</label>
28
+ <select
29
+ id="tabIndex"
30
+ bind:value={componentInput.value.index}
31
+ class="border border-gray-300 rounded-md p-1 !w-16"
32
+ >
33
+ {#each tabComponents as tabComponent}
34
+ {#if tabComponent.data.id === componentInput.value.id}
35
+ {#each Array(tabComponent.data.numberOfSubgrids) as _, i}
36
+ <option value={i}>{i}</option>
37
+ {/each}
38
+ {/if}
39
+ {/each}
40
+ </select>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ {:else}
45
+ <div class="text-xs text-gray-500"> No tab component found in the app </div>
46
+ {/if}
@@ -0,0 +1,20 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { StaticInput } from '../../../inputType';
3
+ declare const __propDef: {
4
+ props: {
5
+ componentInput: StaticInput<{
6
+ id: string;
7
+ index: number;
8
+ }>;
9
+ };
10
+ events: {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {};
14
+ };
15
+ export type TabSelectInputProps = typeof __propDef.props;
16
+ export type TabSelectInputEvents = typeof __propDef.events;
17
+ export type TabSelectInputSlots = typeof __propDef.slots;
18
+ export default class TabSelectInput extends SvelteComponentTyped<TabSelectInputProps, TabSelectInputEvents, TabSelectInputSlots> {
19
+ }
20
+ export {};
@@ -10,10 +10,12 @@ import { getAllScriptNames, loadSchema, schemaToInputsSpec } from '../../../util
10
10
  import { emptySchema } from '../../../../../utils';
11
11
  export let appInput;
12
12
  export let defaultUserInput = false;
13
+ export let id;
13
14
  let tab = 'inlinescripts';
14
15
  let filter = '';
15
16
  let picker;
16
17
  const { app, workspace } = getContext('AppViewerContext');
18
+ const { selectedComponentInEditor } = getContext('AppEditorContext');
17
19
  async function loadSchemaFromTriggerable(path, runType) {
18
20
  return loadSchema(workspace, path, runType) ?? emptySchema();
19
21
  }
@@ -28,6 +30,7 @@ async function pickScript(path) {
28
30
  schema
29
31
  };
30
32
  appInput.fields = fields;
33
+ $selectedComponentInEditor = id;
31
34
  }
32
35
  }
33
36
  async function pickFlow(path) {
@@ -41,6 +44,7 @@ async function pickFlow(path) {
41
44
  schema
42
45
  };
43
46
  appInput.fields = fields;
47
+ $selectedComponentInEditor = id;
44
48
  }
45
49
  }
46
50
  async function pickHubScript(path) {
@@ -54,6 +58,7 @@ async function pickHubScript(path) {
54
58
  schema
55
59
  };
56
60
  appInput.fields = fields;
61
+ $selectedComponentInEditor = id;
57
62
  }
58
63
  }
59
64
  function pickInlineScript(name) {
@@ -67,6 +72,7 @@ function pickInlineScript(name) {
67
72
  };
68
73
  $app.unusedInlineScripts.splice(unusedInlineScriptIndex, 1);
69
74
  }
75
+ $selectedComponentInEditor = id;
70
76
  $app = $app;
71
77
  }
72
78
  function createScript() {
@@ -83,6 +89,7 @@ function createScript() {
83
89
  inlineScript: undefined
84
90
  };
85
91
  appInput = appInput;
92
+ $selectedComponentInEditor = id;
86
93
  return newScriptPath;
87
94
  }
88
95
  </script>
@@ -4,6 +4,7 @@ declare const __propDef: {
4
4
  props: {
5
5
  appInput: ResultAppInput;
6
6
  defaultUserInput?: boolean | undefined;
7
+ id: string;
7
8
  };
8
9
  events: {
9
10
  [evt: string]: CustomEvent<any>;