windmill-components 1.82.6 → 1.82.7

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 (160) hide show
  1. package/common.d.ts +2 -2
  2. package/components/ArgInput.svelte +52 -72
  3. package/components/ArgInput.svelte.d.ts +1 -3
  4. package/components/DisplayResult.svelte +17 -17
  5. package/components/Editor.svelte +0 -3
  6. package/components/Editor.svelte.d.ts +0 -1
  7. package/components/FieldHeader.svelte +0 -1
  8. package/components/FieldHeader.svelte.d.ts +0 -4
  9. package/components/FlowBuilder.svelte +5 -0
  10. package/components/FlowViewer.svelte +0 -1
  11. package/components/InputTransformForm.svelte +0 -1
  12. package/components/LightweightArgInput.svelte +1 -14
  13. package/components/LightweightArgInput.svelte.d.ts +1 -3
  14. package/components/Multiselect.svelte.d.ts +2 -2
  15. package/components/SimpleEditor.svelte +0 -1
  16. package/components/SimpleEditor.svelte.d.ts +0 -1
  17. package/components/TemplateEditor.svelte +0 -1
  18. package/components/Toggle.svelte +1 -1
  19. package/components/Toggle.svelte.d.ts +0 -1
  20. package/components/apps/components/buttons/AppButton.svelte +3 -17
  21. package/components/apps/components/buttons/AppForm.svelte +2 -10
  22. package/components/apps/components/buttons/AppFormButton.svelte +58 -82
  23. package/components/apps/components/display/AppDisplayComponent.svelte +23 -17
  24. package/components/apps/components/display/AppHtml.svelte +7 -1
  25. package/components/apps/components/display/AppHtml.svelte.d.ts +2 -0
  26. package/components/apps/components/display/AppMap.svelte +1 -1
  27. package/components/apps/components/display/AppPdf.svelte +1 -1
  28. package/components/apps/components/display/PlotlyHtml.svelte +20 -3
  29. package/components/apps/components/display/PlotlyHtml.svelte.d.ts +2 -0
  30. package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
  31. package/components/apps/components/display/table/AppTable.svelte +21 -14
  32. package/components/apps/components/helpers/HiddenComponent.svelte +3 -2
  33. package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +2 -1
  34. package/components/apps/components/helpers/InputValue.svelte +3 -3
  35. package/components/apps/components/helpers/RefreshButton.svelte +3 -10
  36. package/components/apps/components/helpers/RefreshButton.svelte.d.ts +1 -0
  37. package/components/apps/components/helpers/RunnableComponent.svelte +19 -15
  38. package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +2 -1
  39. package/components/apps/components/helpers/RunnableWrapper.svelte +3 -1
  40. package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +1 -0
  41. package/components/apps/components/helpers/eval.d.ts +3 -1
  42. package/components/apps/components/helpers/eval.js +4 -2
  43. package/components/apps/components/inputs/AppCheckbox.svelte +0 -4
  44. package/components/apps/components/inputs/AppDateInput.svelte +2 -2
  45. package/components/apps/components/inputs/AppMultiSelect.svelte +13 -5
  46. package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +0 -2
  47. package/components/apps/components/inputs/AppNumberInput.svelte +3 -3
  48. package/components/apps/components/inputs/AppSelect.svelte +11 -4
  49. package/components/apps/components/inputs/AppSelect.svelte.d.ts +0 -2
  50. package/components/apps/components/inputs/AppSliderInputs.svelte +1 -1
  51. package/components/apps/components/inputs/AppTextInput.svelte +53 -43
  52. package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -1
  53. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +1 -1
  54. package/components/apps/components/layout/AppContainer.svelte +2 -2
  55. package/components/apps/components/layout/AppDrawer.svelte +1 -2
  56. package/components/apps/components/layout/AppSplitpanes.svelte +3 -3
  57. package/components/apps/components/layout/AppTabs.svelte +1 -1
  58. package/components/apps/editor/AppEditor.svelte +49 -21
  59. package/components/apps/editor/AppEditorHeader.svelte +5 -0
  60. package/components/apps/editor/AppPreview.svelte +18 -7
  61. package/components/apps/editor/ComponentHeader.svelte +1 -0
  62. package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -1
  63. package/components/apps/editor/GridEditor.svelte +22 -12
  64. package/components/apps/editor/GridViewer.svelte +2 -2
  65. package/components/apps/editor/GridViewer.svelte.d.ts +1 -1
  66. package/components/apps/editor/RecomputeAllComponents.svelte +5 -7
  67. package/components/apps/editor/SettingsPanel.svelte +4 -4
  68. package/components/apps/editor/SubGridEditor.svelte +13 -12
  69. package/components/apps/editor/appUtils.d.ts +1 -0
  70. package/components/apps/editor/appUtils.js +19 -0
  71. package/components/apps/editor/component/Component.svelte +19 -8
  72. package/components/apps/editor/component/Component.svelte.d.ts +1 -1
  73. package/components/apps/editor/component/ComponentNavigation.svelte +57 -47
  74. package/components/apps/editor/component/README.md +4 -0
  75. package/components/apps/editor/component/components.d.ts +38 -28
  76. package/components/apps/editor/component/components.js +34 -27
  77. package/components/apps/editor/component/sets.js +2 -1
  78. package/components/apps/editor/componentsPanel/ComponentList.svelte +1 -1
  79. package/components/apps/editor/componentsPanel/CssProperty.svelte +62 -48
  80. package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +3 -2
  81. package/components/apps/editor/componentsPanel/CssSettings.svelte +1 -0
  82. package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +170 -0
  83. package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte.d.ts +18 -0
  84. package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte +130 -0
  85. package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte.d.ts +21 -0
  86. package/components/apps/editor/componentsPanel/quickStyleProperties.d.ts +535 -0
  87. package/components/apps/editor/componentsPanel/quickStyleProperties.js +598 -0
  88. package/components/apps/editor/componentsPanel/store.js +4 -4
  89. package/components/apps/editor/contextPanel/ComponentOutput.svelte +2 -26
  90. package/components/apps/editor/contextPanel/ComponentOutput.svelte.d.ts +0 -1
  91. package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +8 -6
  92. package/components/apps/editor/contextPanel/ContextPanel.svelte +7 -14
  93. package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte +2 -25
  94. package/components/apps/editor/contextPanel/components/OutputHeader.svelte +29 -40
  95. package/components/apps/editor/contextPanel/components/OutputHeader.svelte.d.ts +1 -2
  96. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +2 -7
  97. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -1
  98. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +10 -11
  99. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +4 -3
  100. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
  101. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +0 -1
  102. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +2 -2
  103. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +2 -0
  104. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +22 -19
  105. package/components/apps/editor/settingsPanel/ComponentPanel.svelte +42 -13
  106. package/components/apps/editor/settingsPanel/GridTab.svelte +1 -2
  107. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +2 -1
  108. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +4 -0
  109. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -0
  110. package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +1 -2
  111. package/components/apps/editor/settingsPanel/StylePanel.svelte +61 -0
  112. package/components/apps/editor/settingsPanel/StylePanel.svelte.d.ts +17 -0
  113. package/components/apps/editor/settingsPanel/TableActions.svelte +3 -3
  114. package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte +12 -12
  115. package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +3 -2
  116. package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +5 -1
  117. package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +3 -3
  118. package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +3 -2
  119. package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +4 -1
  120. package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +2 -2
  121. package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte +47 -0
  122. package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte.d.ts +14 -0
  123. package/components/apps/editor/settingsPanel/secondaryMenu/index.d.ts +2 -0
  124. package/components/apps/editor/settingsPanel/secondaryMenu/index.js +2 -0
  125. package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.d.ts +12 -0
  126. package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.js +10 -0
  127. package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +1 -1
  128. package/components/apps/inputType.d.ts +2 -2
  129. package/components/apps/rx.d.ts +2 -2
  130. package/components/apps/svelte-grid/Grid.svelte +50 -34
  131. package/components/apps/svelte-grid/Grid.svelte.d.ts +14 -9
  132. package/components/apps/svelte-grid/MoveResize.svelte +76 -55
  133. package/components/apps/svelte-grid/MoveResize.svelte.d.ts +15 -9
  134. package/components/apps/svelte-grid/utils/helper.d.ts +0 -1
  135. package/components/apps/svelte-grid/utils/helper.js +0 -3
  136. package/components/apps/types.d.ts +9 -5
  137. package/components/apps/utils.d.ts +2 -0
  138. package/components/apps/utils.js +31 -1
  139. package/components/common/button/ButtonPopup.svelte +5 -2
  140. package/components/common/button/ButtonPopup.svelte.d.ts +5 -1
  141. package/components/common/button/ButtonPopupItem.svelte +2 -1
  142. package/components/common/button/ButtonPopupItem.svelte.d.ts +1 -0
  143. package/components/common/clearableInput/ClearableInput.svelte +56 -0
  144. package/components/common/clearableInput/ClearableInput.svelte.d.ts +28 -0
  145. package/components/common/index.d.ts +1 -0
  146. package/components/common/index.js +1 -0
  147. package/components/common/kbd/Kbd.svelte +4 -1
  148. package/components/common/kbd/Kbd.svelte.d.ts +6 -14
  149. package/components/common/menu/Menu.svelte +8 -2
  150. package/components/common/menu/Menu.svelte.d.ts +4 -1
  151. package/components/common/modal/AlwaysMountedModal.svelte +109 -0
  152. package/components/common/modal/AlwaysMountedModal.svelte.d.ts +22 -0
  153. package/components/flows/map/MapItem.svelte +3 -3
  154. package/components/scriptEditor/LogPanel.svelte +3 -3
  155. package/infer.js +6 -1
  156. package/package.json +11 -2
  157. package/utils.d.ts +1 -0
  158. package/utils.js +3 -0
  159. package/components/apps/editor/contextPanel/components/MinMaxButton.svelte +0 -25
  160. package/components/apps/editor/contextPanel/components/MinMaxButton.svelte.d.ts +0 -16
@@ -3,14 +3,12 @@ import { faUser } from '@fortawesome/free-solid-svg-icons';
3
3
  import { getContext } from 'svelte';
4
4
  import { Icon } from 'svelte-awesome';
5
5
  import AlignWrapper from '../helpers/AlignWrapper.svelte';
6
- import InputValue from '../helpers/InputValue.svelte';
7
6
  import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
8
- import Portal from 'svelte-portal';
9
- import Modal from '../../../common/modal/Modal.svelte';
10
7
  import { concatCustomCss } from '../../utils';
11
8
  import { initConfig, initOutput } from '../../editor/appUtils';
12
9
  import { components } from '../../editor/component';
13
10
  import ResolveConfig from '../helpers/ResolveConfig.svelte';
11
+ import AlwaysMountedModal, { getModal } from '../../../common/modal/AlwaysMountedModal.svelte';
14
12
  export let id;
15
13
  export let componentInput;
16
14
  export let configuration;
@@ -27,10 +25,7 @@ let outputs = initOutput($worldStore, id, {
27
25
  });
28
26
  let resolvedConfig = initConfig(components['formbuttoncomponent'].initialData.configuration, configuration);
29
27
  let runnableComponent;
30
- let isLoading = false;
31
- let ownClick = false;
32
28
  let errors = {};
33
- let open = false;
34
29
  $: errorsMessage = Object.values(errors)
35
30
  .filter((x) => x != '')
36
31
  .join('\n');
@@ -39,18 +34,9 @@ $: noInputs =
39
34
  $: if (outputs?.loading != undefined) {
40
35
  outputs.loading.set(false, true);
41
36
  }
42
- $: outputs?.loading.subscribe({
43
- id: 'loading-' + id,
44
- next: (value) => {
45
- isLoading = value;
46
- if (ownClick && !value) {
47
- ownClick = false;
48
- }
49
- }
50
- });
51
- $: loading = isLoading && ownClick;
52
37
  $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
53
38
  let runnableWrapper;
39
+ let loading = false;
54
40
  </script>
55
41
 
56
42
  {#each Object.keys(components['formbuttoncomponent'].initialData.configuration) as key (key)}
@@ -62,73 +48,63 @@ let runnableWrapper;
62
48
  />
63
49
  {/each}
64
50
 
65
- <Portal>
66
- <Modal
67
- {open}
68
- title={resolvedConfig.label ?? ''}
69
- class={css?.popup?.class}
70
- style={css?.popup?.style}
71
- on:canceled={() => {
72
- open = false
73
- }}
74
- on:confirmed={() => {
75
- open = false
76
- }}
51
+ <AlwaysMountedModal
52
+ title={resolvedConfig.label ?? ''}
53
+ class={css?.popup?.class}
54
+ style={css?.popup?.style}
55
+ >
56
+ <RunnableWrapper
57
+ bind:this={runnableWrapper}
58
+ {recomputeIds}
59
+ {render}
60
+ bind:runnableComponent
61
+ {componentInput}
62
+ {id}
63
+ {extraQueryParams}
64
+ autoRefresh={false}
65
+ forceSchemaDisplay={true}
66
+ runnableClass="!block"
67
+ {outputs}
68
+ doOnSuccess={resolvedConfig.onSuccess}
77
69
  >
78
- <RunnableWrapper
79
- bind:this={runnableWrapper}
80
- {recomputeIds}
81
- {render}
82
- bind:runnableComponent
83
- {componentInput}
84
- {id}
85
- {extraQueryParams}
86
- autoRefresh={false}
87
- forceSchemaDisplay={true}
88
- runnableClass="!block"
89
- {outputs}
90
- doOnSuccess={resolvedConfig.onSuccess}
91
- >
92
- <div class="flex flex-col gap-2 px-4 w-full">
93
- <div>
94
- {#if noInputs}
95
- <div class="text-gray-600 italic text-sm my-4">
96
- Run forms are associated with a runnable that has user inputs.
97
- <br />
98
- Once a script or flow is chosen, set some <strong>Runnable Inputs</strong> to
99
- <strong>
100
- User Input
101
- <Icon data={faUser} scale={1.3} class="rounded-sm bg-gray-200 p-1 ml-0.5" />
102
- </strong>
103
- </div>
104
- {/if}
105
- </div>
106
- <div class="flex justify-end">
107
- <Button
108
- {loading}
109
- btnClasses="my-1"
110
- on:pointerdown={(e) => {
111
- e?.stopPropagation()
112
- window.dispatchEvent(new Event('pointerup'))
113
- }}
114
- on:click={async () => {
115
- if (!runnableComponent) {
116
- runnableWrapper.onSuccess()
117
- } else {
118
- await runnableComponent?.runComponent()
119
- }
120
- open = false
121
- }}
122
- size="xs"
123
- color="dark"
124
- >
125
- Submit
126
- </Button>
127
- </div>
70
+ <div class="flex flex-col gap-2 px-4 w-full">
71
+ <div>
72
+ {#if noInputs}
73
+ <div class="text-gray-600 italic text-sm my-4">
74
+ Run forms are associated with a runnable that has user inputs.
75
+ <br />
76
+ Once a script or flow is chosen, set some <strong>Runnable Inputs</strong> to
77
+ <strong>
78
+ User Input
79
+ <Icon data={faUser} scale={1.3} class="rounded-sm bg-gray-200 p-1 ml-0.5" />
80
+ </strong>
81
+ </div>
82
+ {/if}
83
+ </div>
84
+ <div class="flex justify-end">
85
+ <Button
86
+ {loading}
87
+ btnClasses="my-1"
88
+ on:pointerdown={(e) => {
89
+ e?.stopPropagation()
90
+ }}
91
+ on:click={async () => {
92
+ if (!runnableComponent) {
93
+ runnableWrapper.onSuccess()
94
+ } else {
95
+ await runnableComponent?.runComponent()
96
+ }
97
+ getModal().close()
98
+ }}
99
+ size="xs"
100
+ color="dark"
101
+ >
102
+ Submit
103
+ </Button>
128
104
  </div>
129
- </RunnableWrapper>
130
- </Modal>
131
- </Portal>
105
+ </div>
106
+ </RunnableWrapper>
107
+ </AlwaysMountedModal>
132
108
 
133
109
  <AlignWrapper {horizontalAlignment} {verticalAlignment}>
134
110
  {#if errorsMessage}
@@ -141,7 +117,7 @@ let runnableWrapper;
141
117
  btnClasses={css?.button?.class ?? ''}
142
118
  style={css?.button?.style ?? ''}
143
119
  on:click={(e) => {
144
- open = true
120
+ getModal().open()
145
121
  }}
146
122
  >
147
123
  {resolvedConfig.label}
@@ -19,22 +19,28 @@ const outputs = initOutput($worldStore, id, {
19
19
  </script>
20
20
 
21
21
  <RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
22
- <div
23
- class={twMerge(
24
- 'w-full border-b px-2 text-xs p-1 font-semibold bg-gray-500 text-white rounded-t-sm',
25
- $app.css?.['displaycomponent']?.['header']?.class,
26
- customCss?.header?.class
27
- )}
28
- >
29
- Results
30
- </div>
31
- <div
32
- class={twMerge(
33
- 'p-2',
34
- $app.css?.['displaycomponent']?.['container']?.class,
35
- customCss?.container?.class
36
- )}
37
- >
38
- <DisplayResult {result} {requireHtmlApproval} />
22
+ <div class="flex flex-col w-full h-full">
23
+ <div
24
+ class={twMerge(
25
+ 'w-full border-b px-2 text-xs p-1 font-semibold bg-gray-500 text-white rounded-t-sm',
26
+ $app.css?.['displaycomponent']?.['header']?.class,
27
+ customCss?.header?.class
28
+ )}
29
+ >
30
+ Results
31
+ </div>
32
+ <div
33
+ style={twMerge(
34
+ $app.css?.['displaycomponent']?.['container']?.style,
35
+ customCss?.container?.style
36
+ )}
37
+ class={twMerge(
38
+ 'p-2 grow',
39
+ $app.css?.['displaycomponent']?.['container']?.class,
40
+ customCss?.container?.class
41
+ )}
42
+ >
43
+ <DisplayResult {result} {requireHtmlApproval} />
44
+ </div>
39
45
  </div>
40
46
  </RunnableWrapper>
@@ -7,7 +7,7 @@ export let componentInput;
7
7
  export let initializing = undefined;
8
8
  export let customCss = undefined;
9
9
  export let render;
10
- const { app, worldStore } = getContext('AppViewerContext');
10
+ const { app, worldStore, selectedComponent } = getContext('AppViewerContext');
11
11
  const outputs = initOutput($worldStore, id, {
12
12
  result: undefined,
13
13
  loading: false
@@ -26,6 +26,10 @@ $: css = concatCustomCss($app.css?.htmlcomponent, customCss);
26
26
  bind:clientHeight={h}
27
27
  bind:clientWidth={w}
28
28
  >
29
+ <button
30
+ class="absolute bottom-0 left-0 text-xs border px-2 py-0.5 bg-white/80"
31
+ on:click={() => ($selectedComponent = [id])}>Select</button
32
+ >
29
33
  <RunnableWrapper
30
34
  {outputs}
31
35
  {render}
@@ -46,5 +50,7 @@ $: css = concatCustomCss($app.css?.htmlcomponent, customCss);
46
50
  : 'No html'}
47
51
  />
48
52
  {/key}
53
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
54
+ <div on:click|stopPropagation class="absolute top-0 h-full w-full" />
49
55
  </RunnableWrapper>
50
56
  </div>
@@ -10,6 +10,8 @@ declare const __propDef: {
10
10
  render: boolean;
11
11
  };
12
12
  events: {
13
+ click: MouseEvent;
14
+ } & {
13
15
  [evt: string]: CustomEvent<any>;
14
16
  };
15
17
  slots: {};
@@ -41,7 +41,7 @@ $: if (map && markers) {
41
41
  }
42
42
  function selectComponent() {
43
43
  if (!$connectingInput.opened) {
44
- $selectedComponent = id;
44
+ $selectedComponent = [id];
45
45
  $focusedGrid = undefined;
46
46
  }
47
47
  }
@@ -289,7 +289,7 @@ $: css = concatCustomCss($app.css?.pdfcomponent, customCss);
289
289
  style="padding-top: {controlsHeight ?? 0}px; {css?.container?.style ?? ''}"
290
290
  />
291
291
  {/if}
292
- {#if $mode !== 'preview' && $selectedComponent === id}
292
+ {#if $mode !== 'preview' && $selectedComponent?.includes(id)}
293
293
  <button
294
294
  class="fixed z-10 bottom-0 left-0 px-2 py-0.5 bg-indigo-500/90
295
295
  hover:bg-indigo-500 focus:bg-indigo-500 duration-200 text-white text-2xs"
@@ -1,12 +1,15 @@
1
1
  <script>import { getContext, onMount } from 'svelte';
2
- import { initOutput } from '../../editor/appUtils';
2
+ import { initConfig, initOutput } from '../../editor/appUtils';
3
+ import { components } from '../../editor/component';
4
+ import ResolveConfig from '../helpers/ResolveConfig.svelte';
3
5
  import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
4
6
  export let id;
5
7
  export let componentInput;
6
- // export let configuration: Record<string, AppInput>
8
+ export let configuration;
7
9
  export let initializing = undefined;
8
10
  export let render;
9
11
  const { worldStore } = getContext('AppViewerContext');
12
+ let resolvedConfig = initConfig(components['plotlycomponent'].initialData.configuration, configuration);
10
13
  const outputs = initOutput($worldStore, id, {
11
14
  result: undefined,
12
15
  loading: false
@@ -27,9 +30,23 @@ $: Plotly &&
27
30
  divEl &&
28
31
  h &&
29
32
  w &&
30
- Plotly.newPlot(divEl, [result], { width: w, height: h, margin: { l: 50, r: 40, b: 40, t: 40, pad: 4 } }, { responsive: true, displayModeBar: false });
33
+ Plotly.newPlot(divEl, Array.isArray(result) ? result : [result], {
34
+ width: w,
35
+ height: h,
36
+ margin: { l: 50, r: 40, b: 40, t: 40, pad: 4 },
37
+ ...resolvedConfig.layout
38
+ }, { responsive: true, displayModeBar: false });
31
39
  </script>
32
40
 
41
+ {#each Object.keys(components['plotlycomponent'].initialData.configuration) as key (key)}
42
+ <ResolveConfig
43
+ {id}
44
+ {key}
45
+ bind:resolvedConfig={resolvedConfig[key]}
46
+ configuration={configuration[key]}
47
+ />
48
+ {/each}
49
+
33
50
  <div class="w-full h-full" bind:clientHeight={h} bind:clientWidth={w}>
34
51
  <RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
35
52
  <div on:pointerdown bind:this={divEl} />
@@ -1,9 +1,11 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { AppInput } from '../../inputType';
3
+ import type { RichConfigurations } from '../../types';
3
4
  declare const __propDef: {
4
5
  props: {
5
6
  id: string;
6
7
  componentInput: AppInput | undefined;
8
+ configuration: RichConfigurations;
7
9
  initializing?: boolean | undefined;
8
10
  render: boolean;
9
11
  };
@@ -72,7 +72,7 @@ function onCellValueChanged(event) {
72
72
  >
73
73
  <div
74
74
  on:pointerdown|stopPropagation={() => {
75
- $selectedComponent = id
75
+ $selectedComponent = [id]
76
76
  }}
77
77
  style:height="{clientHeight}px"
78
78
  style:width="{clientWidth}px"
@@ -112,7 +112,7 @@ $componentControl[id] = {
112
112
  }
113
113
  const hasActions = actionButtons.length >= 1;
114
114
  if (hasActions) {
115
- $selectedComponent = actionButtons[0].id;
115
+ $selectedComponent = [actionButtons[0].id];
116
116
  return true;
117
117
  }
118
118
  return false;
@@ -221,7 +221,8 @@ $componentControl[id] = {
221
221
  on:click={() => toggleRow(row, rowIndex)}
222
222
  >
223
223
  <div class="center-center h-full w-full flex-wrap gap-1 ">
224
- {#each actionButtons as actionButton, actionIndex (actionIndex)}
224
+ {#each actionButtons as actionButton, actionIndex (actionButton?.id)}
225
+ <!-- svelte-ignore a11y-mouse-events-have-key-events -->
225
226
  <div
226
227
  on:mouseover|stopPropagation={() => {
227
228
  if (actionButton.id !== $hoverStore) {
@@ -233,13 +234,13 @@ $componentControl[id] = {
233
234
  $hoverStore = undefined
234
235
  }
235
236
  }}
236
- class={(actionButton.id === $selectedComponent ||
237
+ class={($selectedComponent?.includes(actionButton.id) ||
237
238
  $hoverStore === actionButton.id) &&
238
239
  $mode !== 'preview'
239
240
  ? 'outline outline-indigo-500 outline-1 outline-offset-1 relative '
240
241
  : ''}
241
242
  >
242
- {#if actionButton.id === $selectedComponent || $hoverStore === actionButton.id}
243
+ {#if $selectedComponent?.includes(actionButton.id) || $hoverStore === actionButton.id}
243
244
  <span
244
245
  title={`Id: ${actionButton.id}`}
245
246
  class={classNames(
@@ -255,19 +256,22 @@ $componentControl[id] = {
255
256
  extraKey={'idx' + rowIndex}
256
257
  {render}
257
258
  noWFull
258
- {...actionButton}
259
259
  preclickAction={async () => {
260
260
  toggleRow(row, rowIndex)
261
261
  }}
262
+ id={actionButton.id}
263
+ customCss={actionButton.customCss}
264
+ configuration={actionButton.configuration}
265
+ recomputeIds={actionButton.recomputeIds}
262
266
  extraQueryParams={{ row: row.original }}
263
- bind:componentInput={actionButton.componentInput}
267
+ componentInput={actionButton.componentInput}
264
268
  controls={{
265
269
  left: () => {
266
270
  if (actionIndex === 0) {
267
- $selectedComponent = id
271
+ $selectedComponent = [id]
268
272
  return true
269
273
  } else if (actionIndex > 0) {
270
- $selectedComponent = actionButtons[actionIndex - 1].id
274
+ $selectedComponent = [actionButtons[actionIndex - 1].id]
271
275
  return true
272
276
  }
273
277
  return false
@@ -276,7 +280,7 @@ $componentControl[id] = {
276
280
  if (actionIndex === actionButtons.length - 1) {
277
281
  return id
278
282
  } else if (actionIndex < actionButtons.length - 1) {
279
- $selectedComponent = actionButtons[actionIndex + 1].id
283
+ $selectedComponent = [actionButtons[actionIndex + 1].id]
280
284
  return true
281
285
  }
282
286
  return false
@@ -288,12 +292,15 @@ $componentControl[id] = {
288
292
  extraKey={'idx' + rowIndex}
289
293
  {render}
290
294
  noWFull
291
- {...actionButton}
295
+ id={actionButton.id}
296
+ customCss={actionButton.customCss}
297
+ configuration={actionButton.configuration}
298
+ recomputeIds={actionButton.recomputeIds}
292
299
  preclickAction={async () => {
293
300
  toggleRow(row, rowIndex)
294
301
  }}
295
302
  extraQueryParams={{ row: row.original }}
296
- bind:componentInput={actionButton.componentInput}
303
+ componentInput={actionButton.componentInput}
297
304
  />
298
305
  {/if}
299
306
  </div>
@@ -319,9 +326,9 @@ $componentControl[id] = {
319
326
  <div class="flex flex-col h-full w-full overflow-auto">
320
327
  <Alert title="Parsing issues" type="error" size="xs" class="h-full w-full ">
321
328
  The result should be an array of objects. Received:
322
- <pre class="w-full bg-white p-2 rounded-md">
323
- {JSON.stringify(result, null, 4)}
324
- </pre>
329
+ <pre class="w-full bg-white p-2 rounded-md whitespace-pre-wrap"
330
+ >{JSON.stringify(result, null, 4)}</pre
331
+ >
325
332
  </Alert>
326
333
  </div>
327
334
  {/if}
@@ -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 = false;
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?: boolean | undefined;
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, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
70
+ const r = await eval_like(input.expr, computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore, $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, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
84
+ const r = await eval_like('`' + input.eval + '`', computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore, $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
- const { runnableComponents, worldStore } = getContext('AppViewerContext');
4
+ export let loading;
5
+ const { runnableComponents } = getContext('AppViewerContext');
5
6
  async function refresh() {
6
- window.dispatchEvent(new Event('pointerup'));
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
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  componentId: string;
5
+ loading: boolean;
5
6
  };
6
7
  events: {
7
8
  pointerdown: PointerEvent;
@@ -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
- if (recomputable || autoRefresh) {
33
- $runnableComponents[id] = async (inlineScript) => {
33
+ $runnableComponents[id] = {
34
+ autoRefresh: autoRefresh && recomputableByRefreshButton,
35
+ cb: async (inlineScript) => {
34
36
  await executeComponent(true, inlineScript);
35
- };
36
- $runnableComponents = $runnableComponents;
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
- outputs.loading?.set(true);
109
+ loading = true;
107
110
  try {
108
- const r = await eval_like(runnable.inlineScript?.content, computeGlobalContext($worldStore, id, {}), false, $state, $mode == 'dnd', $componentControl, $worldStore);
111
+ const r = await eval_like(runnable.inlineScript?.content, computeGlobalContext($worldStore, id, {}), 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
- outputs.loading?.set(false);
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
- outputs.loading?.set(true);
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
- outputs.loading?.set(false);
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
- console.error(e);
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, id, { result: res }), false, $state, $mode == 'dnd', $componentControl, $worldStore);
203
+ res = await eval_like(transformer.content, computeGlobalContext($worldStore, id, { 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
- outputs.loading?.set(false)
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>