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
@@ -164,6 +164,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
164
164
  use:autosize
165
165
  rows="1"
166
166
  bind:value={description}
167
+ on:keydown|stopPropagation
167
168
  placeholder="Field description"
168
169
  />
169
170
  {#if type == 'string' && format != 'date-time'}
@@ -315,6 +316,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
315
316
  {autofocus}
316
317
  {disabled}
317
318
  use:autosize
319
+ on:keydown|stopPropagation
318
320
  style="max-height: {maxHeight}"
319
321
  on:input={() => {
320
322
  dispatch('input', { rawValue: value, isRaw: false })
@@ -390,6 +392,7 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
390
392
  }}
391
393
  on:blur={() => dispatch('blur')}
392
394
  use:autosize
395
+ on:keydown|stopPropagation
393
396
  type="text"
394
397
  {disabled}
395
398
  class="col-span-10 {valid
@@ -40,6 +40,7 @@ declare const __propDef: {
40
40
  focus?: (() => void) | undefined;
41
41
  };
42
42
  events: {
43
+ keydown: KeyboardEvent;
43
44
  focus: CustomEvent<any>;
44
45
  input: CustomEvent<any>;
45
46
  blur: CustomEvent<any>;
@@ -5,6 +5,7 @@ import { copyToClipboard, truncate } from '../utils';
5
5
  import { Button, Drawer, DrawerContent } from './common';
6
6
  import autosize from 'svelte-autosize';
7
7
  import { ClipboardCopy } from 'lucide-svelte';
8
+ import Portal from 'svelte-portal';
8
9
  export let result;
9
10
  export let requireHtmlApproval = false;
10
11
  let resultKind;
@@ -74,20 +75,22 @@ let payload = '';
74
75
  let jsonViewer;
75
76
  </script>
76
77
 
77
- <Drawer bind:this={jsonViewer} size="900px">
78
- <DrawerContent title="Expanded Result" on:close={jsonViewer.closeDrawer}>
79
- <svelte:fragment slot="actions">
80
- <Button
81
- on:click={() => copyToClipboard(JSON.stringify(result, null, 4))}
82
- color="light"
83
- size="xs"
84
- >
85
- <div class="flex gap-2 items-center">Copy to clipboard <ClipboardCopy /> </div>
86
- </Button>
87
- </svelte:fragment>
88
- <Highlight language={json} code={JSON.stringify(result, null, 4).replace(/\\n/g, '\n')} />
89
- </DrawerContent>
90
- </Drawer>
78
+ <Portal>
79
+ <Drawer bind:this={jsonViewer} size="900px">
80
+ <DrawerContent title="Expanded Result" on:close={jsonViewer.closeDrawer}>
81
+ <svelte:fragment slot="actions">
82
+ <Button
83
+ on:click={() => copyToClipboard(JSON.stringify(result, null, 4))}
84
+ color="light"
85
+ size="xs"
86
+ >
87
+ <div class="flex gap-2 items-center">Copy to clipboard <ClipboardCopy /> </div>
88
+ </Button>
89
+ </svelte:fragment>
90
+ <Highlight language={json} code={JSON.stringify(result, null, 4).replace(/\\n/g, '\n')} />
91
+ </DrawerContent>
92
+ </Drawer>
93
+ </Portal>
91
94
 
92
95
  <div class="inline-highlight">
93
96
  {#if result != undefined}
@@ -95,7 +98,7 @@ let jsonViewer;
95
98
  <div class="mb-2 text-gray-500 text-sm bg-gray-50/20">
96
99
  as JSON&nbsp;<input class="windmillapp" type="checkbox" bind:checked={forceJson} /></div
97
100
  >{/if}{#if typeof result == 'object' && Object.keys(result).length > 0}<div
98
- class="mb-2 min-w-[400px] text-sm text-gray-700 relative"
101
+ class="mb-2 min-w-[360px] text-sm text-gray-700 relative"
99
102
  >The result keys are: <b>{truncate(Object.keys(result).join(', '), 50)}</b>
100
103
  <div class="text-gray-500 text-sm absolute top-0 right-2">
101
104
  <button on:click={jsonViewer.openDrawer}>Expand JSON</button>
@@ -9,6 +9,7 @@ import TableCustom from './TableCustom.svelte';
9
9
  import Toggle from './Toggle.svelte';
10
10
  import Tooltip from './Tooltip.svelte';
11
11
  import { flip } from 'svelte/animate';
12
+ import Portal from 'svelte-portal';
12
13
  const dispatch = createEventDispatcher();
13
14
  export let schema = emptySchema();
14
15
  if (!schema) {
@@ -166,8 +167,10 @@ let error = '';
166
167
  />
167
168
  <div class="ml-2">
168
169
  <Tooltip>
169
- Arguments can be edited either using the wizard, or by editing their JSON Schema,
170
- <a href="https://docs.windmill.dev/docs/reference/#script-parameters-to-json-schema">see docs</a>
170
+ Arguments can be edited either using the wizard, or by editing their JSON Schema,
171
+ <a href="https://docs.windmill.dev/docs/reference/#script-parameters-to-json-schema"
172
+ >see docs</a
173
+ >
171
174
  </Tooltip>
172
175
  </div>
173
176
  </div>
@@ -269,11 +272,13 @@ let error = '';
269
272
  </div>
270
273
  </div>
271
274
 
272
- <SchemaModal
273
- bind:this={schemaModal}
274
- bind:property={modalProperty}
275
- bind:error={argError}
276
- on:save={handleAddOrEditArgument}
277
- bind:editing
278
- bind:oldArgName
279
- />
275
+ <Portal>
276
+ <SchemaModal
277
+ bind:this={schemaModal}
278
+ bind:property={modalProperty}
279
+ bind:error={argError}
280
+ on:save={handleAddOrEditArgument}
281
+ bind:editing
282
+ bind:oldArgName
283
+ />
284
+ </Portal>
@@ -38,7 +38,7 @@ let showContent = !accordion;
38
38
  {/if}
39
39
  </div>
40
40
  {#if showContent}
41
- <div transition:slide={{ duration: 300 }}>
41
+ <div transition:slide|local={{ duration: 300 }}>
42
42
  <slot />
43
43
  </div>
44
44
  {/if}
@@ -5,6 +5,7 @@ export let checked = false;
5
5
  export let disabled = false;
6
6
  export let textClass = '';
7
7
  export let textStyle = '';
8
+ export let color = 'blue';
8
9
  export let size = 'sm';
9
10
  const id = (Math.random() + 1).toString(36).substring(10);
10
11
  const dispatch = createEventDispatcher();
@@ -20,7 +21,7 @@ const dispatch = createEventDispatcher();
20
21
  {#if Boolean(options?.left)}
21
22
  <span
22
23
  class={twMerge(
23
- 'ml-2 font-medium duration-200',
24
+ 'mr-2 font-medium duration-200',
24
25
  disabled ? 'text-gray-500' : 'text-gray-900',
25
26
  size === 'xs' ? 'text-xs' : 'text-sm',
26
27
  textClass
@@ -49,7 +50,9 @@ const dispatch = createEventDispatcher();
49
50
  class="w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 peer-focus:ring-blue-300
50
51
  peer-checked:after:translate-x-full peer-checked:after:border-white after:content-['']
51
52
  after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300
52
- after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"
53
+ after:border after:rounded-full after:h-5 after:w-5 after:transition-all {color == 'red'
54
+ ? 'peer-checked:bg-red-600'
55
+ : 'peer-checked:bg-blue-600'}"
53
56
  />
54
57
  </div>
55
58
  {#if Boolean(options?.right)}
@@ -10,6 +10,7 @@ declare const __propDef: {
10
10
  disabled?: boolean | undefined;
11
11
  textClass?: string | undefined;
12
12
  textStyle?: string | undefined;
13
+ color?: "blue" | "red" | undefined;
13
14
  size?: "xs" | "sm" | undefined;
14
15
  };
15
16
  events: {
@@ -1,13 +1,12 @@
1
1
  <script>import { Button } from '../../../common';
2
2
  import { getContext } from 'svelte';
3
3
  import AlignWrapper from '../helpers/AlignWrapper.svelte';
4
- import InputValue from '../helpers/InputValue.svelte';
5
4
  import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
6
5
  import { loadIcon } from '../icon';
7
6
  import { twMerge } from 'tailwind-merge';
8
- import { goto } from '$app/navigation';
9
- import { initOutput } from '../../editor/appUtils';
10
- import { configurationKeys } from '../../editor/component';
7
+ import { initConfig, initOutput } from '../../editor/appUtils';
8
+ import { components } from '../../editor/component';
9
+ import ResolveConfig from '../helpers/ResolveConfig.svelte';
11
10
  export let id;
12
11
  export let componentInput;
13
12
  export let configuration;
@@ -19,26 +18,22 @@ export let noWFull = false;
19
18
  export let preclickAction = undefined;
20
19
  export let customCss = undefined;
21
20
  export let render;
22
- export let initializing = true;
21
+ export let initializing = false;
22
+ export let extraKey = undefined;
23
23
  export let controls = undefined;
24
- const { worldStore, app, componentControl } = getContext('AppViewerContext');
24
+ const { worldStore, app, componentControl, selectedComponent } = getContext('AppViewerContext');
25
+ let resolvedConfig = initConfig(components['buttoncomponent'].initialData.configuration, configuration);
26
+ $: initializing = resolvedConfig?.label == undefined;
27
+ let outputs = initOutput($worldStore, id, {
28
+ result: undefined,
29
+ loading: false
30
+ });
25
31
  if (controls) {
26
32
  $componentControl[id] = controls;
27
33
  }
28
34
  let runnableComponent;
29
- // let labelValue: string
30
- // let color: ButtonType.Color
31
- // let size: ButtonType.Size
32
- // let disabled: boolean | undefined = undefined
33
- // let fillContainer: boolean | undefined = undefined
34
- // let gotoUrl: string | undefined = undefined
35
- // let gotoNewTab: boolean | undefined = undefined
36
35
  let isLoading = false;
37
36
  let ownClick = false;
38
- // let beforeIcon: undefined | string = undefined
39
- // let afterIcon: undefined | string = undefined
40
- let resolvedConfig = {};
41
- $: initializing = resolvedConfig?.label == undefined;
42
37
  let beforeIconComponent;
43
38
  let afterIconComponent;
44
39
  $: resolvedConfig.beforeIcon && handleBeforeIcon();
@@ -53,11 +48,7 @@ async function handleAfterIcon() {
53
48
  afterIconComponent = await loadIcon(resolvedConfig.afterIcon);
54
49
  }
55
50
  }
56
- let outputs = initOutput($worldStore, id, {
57
- result: undefined,
58
- loading: false
59
- });
60
- $: resolvedConfig.triggerOnAppLoad && runnableComponent?.runComponent();
51
+ $: resolvedConfig?.triggerOnAppLoad && runnableComponent?.runComponent();
61
52
  $: if (outputs?.loading != undefined) {
62
53
  outputs.loading.set(false, true);
63
54
  }
@@ -75,22 +66,17 @@ let errors = {};
75
66
  $: errorsMessage = Object.values(errors)
76
67
  .filter((x) => x != '')
77
68
  .join('\n');
69
+ let runnableWrapper;
78
70
  async function handleClick(event) {
79
71
  event?.stopPropagation();
80
72
  event?.preventDefault();
73
+ $selectedComponent = id;
81
74
  if (preclickAction) {
82
75
  await preclickAction();
83
76
  }
84
77
  ownClick = true;
85
78
  if (!runnableComponent) {
86
- if (resolvedConfig.gotoUrl) {
87
- if (resolvedConfig.gotoNewTab) {
88
- window.open(resolvedConfig.gotoUrl, '_blank');
89
- }
90
- else {
91
- goto(resolvedConfig.gotoUrl);
92
- }
93
- }
79
+ runnableWrapper.onSuccess();
94
80
  }
95
81
  else {
96
82
  await runnableComponent?.runComponent();
@@ -98,37 +84,44 @@ async function handleClick(event) {
98
84
  }
99
85
  </script>
100
86
 
101
- {#each configurationKeys['buttoncomponent'] as key (key)}
102
- <InputValue {key} {id} input={configuration[key]} bind:value={resolvedConfig[key]} />
87
+ {#each Object.keys(components['buttoncomponent'].initialData.configuration) as key (key)}
88
+ <ResolveConfig
89
+ {id}
90
+ {extraKey}
91
+ {key}
92
+ bind:resolvedConfig={resolvedConfig[key]}
93
+ configuration={configuration[key]}
94
+ />
103
95
  {/each}
104
96
 
97
+ <!-- gotoNewTab={resolvedConfig.onSuccess.selected == 'goto'} -->
98
+
105
99
  <RunnableWrapper
100
+ bind:this={runnableWrapper}
106
101
  {recomputeIds}
107
102
  bind:runnableComponent
108
103
  {componentInput}
104
+ doOnSuccess={resolvedConfig.onSuccess}
109
105
  {id}
110
106
  {extraQueryParams}
111
107
  autoRefresh={false}
112
- goto={resolvedConfig.gotoUrl}
113
- gotoNewTab={resolvedConfig.gotoNewTab}
114
108
  {render}
109
+ {outputs}
110
+ {extraKey}
115
111
  >
116
112
  <AlignWrapper {noWFull} {horizontalAlignment} {verticalAlignment}>
117
113
  {#if errorsMessage}
118
114
  <div class="text-red-500 text-xs">{errorsMessage}</div>
119
115
  {/if}
120
116
  <Button
117
+ on:pointerdown={(e) => e.stopPropagation()}
121
118
  btnClasses={twMerge(
122
119
  $app.css?.['buttoncomponent']?.['button']?.class,
123
- customCss?.button.class,
120
+ customCss?.button?.class,
124
121
  resolvedConfig.fillContainer ? 'w-full h-full' : ''
125
122
  )}
126
- style={[$app.css?.['buttoncomponent']?.['button']?.style, customCss?.button.style].join(';')}
123
+ style={[$app.css?.['buttoncomponent']?.['button']?.style, customCss?.button?.style].join(';')}
127
124
  disabled={resolvedConfig.disabled}
128
- on:pointerdown={(e) => {
129
- e?.stopPropagation()
130
- window.dispatchEvent(new Event('pointerup'))
131
- }}
132
125
  on:click={handleClick}
133
126
  size={resolvedConfig.size}
134
127
  color={resolvedConfig.color}
@@ -12,9 +12,10 @@ declare const __propDef: {
12
12
  verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
13
13
  noWFull?: boolean | undefined;
14
14
  preclickAction?: (() => Promise<void>) | undefined;
15
- customCss?: ComponentCustomCSS<'button'> | undefined;
15
+ customCss?: ComponentCustomCSS<'buttoncomponent'> | undefined;
16
16
  render: boolean;
17
17
  initializing?: boolean | undefined;
18
+ extraKey?: string | undefined;
18
19
  controls?: {
19
20
  left: () => boolean;
20
21
  right: () => boolean | string;
@@ -2,9 +2,11 @@
2
2
  import { faUser } from '@fortawesome/free-solid-svg-icons';
3
3
  import { getContext } from 'svelte';
4
4
  import { Icon } from 'svelte-awesome';
5
+ import { initConfig, initOutput } from '../../editor/appUtils';
6
+ import { components } from '../../editor/component';
5
7
  import { concatCustomCss } from '../../utils';
6
8
  import AlignWrapper from '../helpers/AlignWrapper.svelte';
7
- import InputValue from '../helpers/InputValue.svelte';
9
+ import ResolveConfig from '../helpers/ResolveConfig.svelte';
8
10
  import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
9
11
  export let id;
10
12
  export let componentInput;
@@ -16,16 +18,16 @@ export let customCss = undefined;
16
18
  export let render;
17
19
  export const staticOutputs = ['loading', 'result'];
18
20
  const { app, worldStore, stateId } = getContext('AppViewerContext');
19
- let labelValue = 'Default label';
20
- let color;
21
- let size;
21
+ let outputs = initOutput($worldStore, id, {
22
+ result: undefined,
23
+ loading: false
24
+ });
25
+ let resolvedConfig = initConfig(components['formcomponent'].initialData.configuration, configuration);
22
26
  let runnableComponent;
23
- let goto = undefined;
24
27
  let isLoading = false;
25
28
  $: noInputs =
26
29
  $stateId != undefined &&
27
30
  (componentInput?.type != 'runnable' || Object.keys(componentInput?.fields ?? {}).length == 0);
28
- $: outputs = $worldStore?.outputsById[id];
29
31
  $: if (outputs?.loading != undefined) {
30
32
  outputs.loading.set(false, true);
31
33
  }
@@ -38,10 +40,14 @@ $: outputs?.loading.subscribe({
38
40
  $: css = concatCustomCss($app.css?.formcomponent, customCss);
39
41
  </script>
40
42
 
41
- <InputValue {id} input={configuration.goto} bind:value={goto} />
42
- <InputValue {id} input={configuration.label} bind:value={labelValue} />
43
- <InputValue {id} input={configuration.color} bind:value={color} />
44
- <InputValue {id} input={configuration.size} bind:value={size} />
43
+ {#each Object.keys(components['formcomponent'].initialData.configuration) as key (key)}
44
+ <ResolveConfig
45
+ {id}
46
+ {key}
47
+ bind:resolvedConfig={resolvedConfig[key]}
48
+ configuration={configuration[key]}
49
+ />
50
+ {/each}
45
51
 
46
52
  <RunnableWrapper
47
53
  {recomputeIds}
@@ -49,12 +55,13 @@ $: css = concatCustomCss($app.css?.formcomponent, customCss);
49
55
  bind:runnableComponent
50
56
  {componentInput}
51
57
  {id}
52
- {goto}
58
+ doOnSuccess={resolvedConfig.onSuccess}
53
59
  {extraQueryParams}
54
60
  autoRefresh={false}
55
61
  forceSchemaDisplay={true}
56
62
  runnableClass="!block"
57
- runnableStyle={css?.container.style}
63
+ runnableStyle={css?.container?.style}
64
+ {outputs}
58
65
  >
59
66
  <AlignWrapper {horizontalAlignment}>
60
67
  <div
@@ -87,10 +94,10 @@ $: css = concatCustomCss($app.css?.formcomponent, customCss);
87
94
  on:click={() => {
88
95
  runnableComponent?.runComponent()
89
96
  }}
90
- {size}
91
- {color}
97
+ size={resolvedConfig.size}
98
+ color={resolvedConfig.color}
92
99
  >
93
- {labelValue}
100
+ {resolvedConfig.label}
94
101
  </Button>
95
102
  {/if}
96
103
  </div>
@@ -9,7 +9,7 @@ declare const __propDef: {
9
9
  recomputeIds?: string[] | undefined;
10
10
  extraQueryParams?: Record<string, any> | undefined;
11
11
  horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
12
- customCss?: ComponentCustomCSS<'container' | 'button'> | undefined;
12
+ customCss?: ComponentCustomCSS<'formcomponent'> | undefined;
13
13
  render: boolean;
14
14
  staticOutputs?: string[] | undefined;
15
15
  };
@@ -8,6 +8,9 @@ import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
8
8
  import Portal from 'svelte-portal';
9
9
  import Modal from '../../../common/modal/Modal.svelte';
10
10
  import { concatCustomCss } from '../../utils';
11
+ import { initConfig, initOutput } from '../../editor/appUtils';
12
+ import { components } from '../../editor/component';
13
+ import ResolveConfig from '../helpers/ResolveConfig.svelte';
11
14
  export let id;
12
15
  export let componentInput;
13
16
  export let configuration;
@@ -17,13 +20,13 @@ export let horizontalAlignment = undefined;
17
20
  export let verticalAlignment = undefined;
18
21
  export let customCss = undefined;
19
22
  export let render;
20
- export const staticOutputs = ['loading', 'result'];
21
23
  const { app, worldStore } = getContext('AppViewerContext');
22
- let labelValue = 'Default label';
23
- let color;
24
- let size;
24
+ let outputs = initOutput($worldStore, id, {
25
+ result: undefined,
26
+ loading: false
27
+ });
28
+ let resolvedConfig = initConfig(components['formbuttoncomponent'].initialData.configuration, configuration);
25
29
  let runnableComponent;
26
- let disabled = undefined;
27
30
  let isLoading = false;
28
31
  let ownClick = false;
29
32
  let errors = {};
@@ -33,7 +36,6 @@ $: errorsMessage = Object.values(errors)
33
36
  .join('\n');
34
37
  $: noInputs =
35
38
  componentInput?.type != 'runnable' || Object.keys(componentInput?.fields ?? {}).length == 0;
36
- $: outputs = $worldStore?.outputsById[id];
37
39
  $: if (outputs?.loading != undefined) {
38
40
  outputs.loading.set(false, true);
39
41
  }
@@ -48,24 +50,24 @@ $: outputs?.loading.subscribe({
48
50
  });
49
51
  $: loading = isLoading && ownClick;
50
52
  $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
53
+ let runnableWrapper;
51
54
  </script>
52
55
 
53
- <InputValue {id} input={configuration.label} bind:value={labelValue} />
54
- <InputValue {id} input={configuration.color} bind:value={color} />
55
- <InputValue {id} input={configuration.size} bind:value={size} />
56
- <InputValue
57
- {id}
58
- input={configuration.disabled}
59
- bind:value={disabled}
60
- bind:error={errors.disabled}
61
- />
56
+ {#each Object.keys(components['formbuttoncomponent'].initialData.configuration) as key (key)}
57
+ <ResolveConfig
58
+ {id}
59
+ {key}
60
+ bind:resolvedConfig={resolvedConfig[key]}
61
+ configuration={configuration[key]}
62
+ />
63
+ {/each}
62
64
 
63
65
  <Portal>
64
66
  <Modal
65
67
  {open}
66
- title={labelValue}
67
- class={css?.popup.class}
68
- style={css?.popup.style}
68
+ title={resolvedConfig.label ?? ''}
69
+ class={css?.popup?.class}
70
+ style={css?.popup?.style}
69
71
  on:canceled={() => {
70
72
  open = false
71
73
  }}
@@ -74,6 +76,7 @@ $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
74
76
  }}
75
77
  >
76
78
  <RunnableWrapper
79
+ bind:this={runnableWrapper}
77
80
  {recomputeIds}
78
81
  {render}
79
82
  bind:runnableComponent
@@ -83,6 +86,8 @@ $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
83
86
  autoRefresh={false}
84
87
  forceSchemaDisplay={true}
85
88
  runnableClass="!block"
89
+ {outputs}
90
+ doOnSuccess={resolvedConfig.onSuccess}
86
91
  >
87
92
  <div class="flex flex-col gap-2 px-4 w-full">
88
93
  <div>
@@ -107,8 +112,11 @@ $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
107
112
  window.dispatchEvent(new Event('pointerup'))
108
113
  }}
109
114
  on:click={async () => {
110
- await runnableComponent?.runComponent()
111
-
115
+ if (!runnableComponent) {
116
+ runnableWrapper.onSuccess()
117
+ } else {
118
+ await runnableComponent?.runComponent()
119
+ }
112
120
  open = false
113
121
  }}
114
122
  size="xs"
@@ -127,15 +135,15 @@ $: css = concatCustomCss($app?.css?.formbuttoncomponent, customCss);
127
135
  <div class="text-red-500 text-xs">{errorsMessage}</div>
128
136
  {/if}
129
137
  <Button
130
- {disabled}
131
- {size}
132
- {color}
138
+ disabled={resolvedConfig.disabled ?? false}
139
+ size={resolvedConfig.size ?? 'md'}
140
+ color={resolvedConfig.color}
133
141
  btnClasses={css?.button?.class ?? ''}
134
142
  style={css?.button?.style ?? ''}
135
143
  on:click={(e) => {
136
144
  open = true
137
145
  }}
138
146
  >
139
- {labelValue}
147
+ {resolvedConfig.label}
140
148
  </Button>
141
149
  </AlignWrapper>
@@ -10,9 +10,8 @@ declare const __propDef: {
10
10
  extraQueryParams?: Record<string, any> | undefined;
11
11
  horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
12
12
  verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
13
- customCss?: ComponentCustomCSS<'button' | 'popup'> | undefined;
13
+ customCss?: ComponentCustomCSS<'formbuttoncomponent'> | undefined;
14
14
  render: boolean;
15
- staticOutputs?: string[] | undefined;
16
15
  };
17
16
  events: {
18
17
  [evt: string]: CustomEvent<any>;
@@ -23,6 +22,5 @@ export type AppFormButtonProps = typeof __propDef.props;
23
22
  export type AppFormButtonEvents = typeof __propDef.events;
24
23
  export type AppFormButtonSlots = typeof __propDef.slots;
25
24
  export default class AppFormButton extends SvelteComponentTyped<AppFormButtonProps, AppFormButtonEvents, AppFormButtonSlots> {
26
- get staticOutputs(): string[];
27
25
  }
28
26
  export {};
@@ -12,7 +12,7 @@ export let initializing = undefined;
12
12
  export let customCss = undefined;
13
13
  export let render;
14
14
  const { app, worldStore } = getContext('AppViewerContext');
15
- initOutput($worldStore, id, {
15
+ let outputs = initOutput($worldStore, id, {
16
16
  result: undefined,
17
17
  loading: false
18
18
  });
@@ -62,7 +62,7 @@ $: css = concatCustomCss($app.css?.barchartcomponent, customCss);
62
62
  <InputValue {id} input={configuration.theme} bind:value={theme} />
63
63
  <InputValue {id} input={configuration.line} bind:value={lineChart} />
64
64
 
65
- <RunnableWrapper {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
65
+ <RunnableWrapper {outputs} {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
66
66
  <div class="w-full h-full {css?.container?.class ?? ''}" style={css?.container?.style ?? ''}>
67
67
  {#if result}
68
68
  {#if lineChart}
@@ -7,7 +7,7 @@ declare const __propDef: {
7
7
  componentInput: AppInput | undefined;
8
8
  configuration: RichConfigurations;
9
9
  initializing?: boolean | undefined;
10
- customCss?: ComponentCustomCSS<'container'> | undefined;
10
+ customCss?: ComponentCustomCSS<'barchartcomponent'> | undefined;
11
11
  render: boolean;
12
12
  };
13
13
  events: {
@@ -12,13 +12,13 @@ export let render;
12
12
  const requireHtmlApproval = getContext(IS_APP_PUBLIC_CONTEXT_KEY);
13
13
  const { app, worldStore } = getContext('AppViewerContext');
14
14
  let result = undefined;
15
- initOutput($worldStore, id, {
15
+ const outputs = initOutput($worldStore, id, {
16
16
  result: undefined,
17
17
  loading: false
18
18
  });
19
19
  </script>
20
20
 
21
- <RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
21
+ <RunnableWrapper {outputs} {render} {componentInput} {id} bind:initializing bind:result>
22
22
  <div
23
23
  class={twMerge(
24
24
  'w-full border-b px-2 text-xs p-1 font-semibold bg-gray-500 text-white rounded-t-sm',
@@ -6,7 +6,7 @@ declare const __propDef: {
6
6
  id: string;
7
7
  componentInput: AppInput | undefined;
8
8
  initializing?: boolean | undefined;
9
- customCss?: ComponentCustomCSS<'header' | 'container'> | undefined;
9
+ customCss?: ComponentCustomCSS<'displaycomponent'> | undefined;
10
10
  render: boolean;
11
11
  };
12
12
  events: {
@@ -8,7 +8,7 @@ export let initializing = undefined;
8
8
  export let customCss = undefined;
9
9
  export let render;
10
10
  const { app, worldStore } = getContext('AppViewerContext');
11
- initOutput($worldStore, id, {
11
+ const outputs = initOutput($worldStore, id, {
12
12
  result: undefined,
13
13
  loading: false
14
14
  });
@@ -26,7 +26,15 @@ $: css = concatCustomCss($app.css?.htmlcomponent, customCss);
26
26
  bind:clientHeight={h}
27
27
  bind:clientWidth={w}
28
28
  >
29
- <RunnableWrapper {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
29
+ <RunnableWrapper
30
+ {outputs}
31
+ {render}
32
+ autoRefresh
33
+ {componentInput}
34
+ {id}
35
+ bind:initializing
36
+ bind:result
37
+ >
30
38
  {#key result}
31
39
  <iframe
32
40
  frameborder="0"
@@ -6,7 +6,7 @@ declare const __propDef: {
6
6
  id: string;
7
7
  componentInput: AppInput | undefined;
8
8
  initializing?: boolean | undefined;
9
- customCss?: ComponentCustomCSS<'container'> | undefined;
9
+ customCss?: ComponentCustomCSS<'htmlcomponent'> | undefined;
10
10
  render: boolean;
11
11
  };
12
12
  events: {