windmill-components 1.78.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 (214) 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 +50 -70
  9. package/components/apps/components/buttons/AppButton.svelte.d.ts +8 -3
  10. package/components/apps/components/buttons/AppForm.svelte +22 -15
  11. package/components/apps/components/buttons/AppForm.svelte.d.ts +3 -3
  12. package/components/apps/components/buttons/AppFormButton.svelte +32 -24
  13. package/components/apps/components/buttons/AppFormButton.svelte.d.ts +3 -5
  14. package/components/apps/components/display/AppBarChart.svelte +2 -2
  15. package/components/apps/components/display/AppBarChart.svelte.d.ts +3 -3
  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 +3 -4
  22. package/components/apps/components/display/AppImage.svelte +28 -15
  23. package/components/apps/components/display/AppImage.svelte.d.ts +3 -4
  24. package/components/apps/components/display/AppMap.svelte +3 -3
  25. package/components/apps/components/display/AppMap.svelte.d.ts +3 -4
  26. package/components/apps/components/display/AppPdf.svelte +3 -2
  27. package/components/apps/components/display/AppPdf.svelte.d.ts +3 -4
  28. package/components/apps/components/display/AppPieChart.svelte +2 -2
  29. package/components/apps/components/display/AppPieChart.svelte.d.ts +3 -3
  30. package/components/apps/components/display/AppScatterChart.svelte +2 -2
  31. package/components/apps/components/display/AppScatterChart.svelte.d.ts +3 -3
  32. package/components/apps/components/display/AppText.svelte +35 -22
  33. package/components/apps/components/display/AppText.svelte.d.ts +3 -3
  34. package/components/apps/components/display/AppTimeseries.svelte +2 -2
  35. package/components/apps/components/display/AppTimeseries.svelte.d.ts +3 -3
  36. package/components/apps/components/display/PlotlyHtml.svelte +2 -2
  37. package/components/apps/components/display/VegaLiteHtml.svelte +2 -2
  38. package/components/apps/components/display/VegaLiteHtml.svelte.d.ts +2 -1
  39. package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
  40. package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +2 -1
  41. package/components/apps/components/display/table/AppTable.svelte +102 -34
  42. package/components/apps/components/display/table/AppTable.svelte.d.ts +3 -3
  43. package/components/apps/components/helpers/HiddenComponent.svelte +6 -3
  44. package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +1 -1
  45. package/components/apps/components/helpers/InputValue.svelte +11 -7
  46. package/components/apps/components/helpers/InputValue.svelte.d.ts +3 -1
  47. package/components/apps/components/helpers/Loader.svelte +18 -0
  48. package/components/apps/components/helpers/Loader.svelte.d.ts +18 -0
  49. package/components/apps/components/helpers/NonRunnableComponent.svelte +1 -12
  50. package/components/apps/components/helpers/ResolveConfig.svelte +29 -0
  51. package/components/apps/components/helpers/ResolveConfig.svelte.d.ts +21 -0
  52. package/components/apps/components/helpers/RunnableComponent.svelte +126 -93
  53. package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +13 -3
  54. package/components/apps/components/helpers/RunnableWrapper.svelte +48 -9
  55. package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +26 -2
  56. package/components/apps/components/helpers/eval.js +36 -1
  57. package/components/apps/components/inputs/AppCheckbox.svelte +1 -1
  58. package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +3 -4
  59. package/components/apps/components/inputs/AppDateInput.svelte.d.ts +3 -4
  60. package/components/apps/components/inputs/AppFileInput.svelte.d.ts +3 -4
  61. package/components/apps/components/inputs/AppMultiSelect.svelte +0 -1
  62. package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +3 -4
  63. package/components/apps/components/inputs/AppNumberInput.svelte +1 -1
  64. package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +3 -6
  65. package/components/apps/components/inputs/AppRangeInput.svelte +7 -1
  66. package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +4 -4
  67. package/components/apps/components/inputs/AppSelect.svelte +8 -2
  68. package/components/apps/components/inputs/AppSelect.svelte.d.ts +3 -4
  69. package/components/apps/components/inputs/AppSliderInputs.svelte +7 -1
  70. package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +4 -4
  71. package/components/apps/components/inputs/AppTextInput.svelte +4 -4
  72. package/components/apps/components/inputs/AppTextInput.svelte.d.ts +3 -6
  73. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +17 -19
  74. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +3 -4
  75. package/components/apps/components/layout/AppContainer.svelte +7 -5
  76. package/components/apps/components/layout/AppContainer.svelte.d.ts +1 -3
  77. package/components/apps/components/layout/AppDivider.svelte +4 -1
  78. package/components/apps/components/layout/AppDivider.svelte.d.ts +3 -4
  79. package/components/apps/components/layout/AppDrawer.svelte +7 -4
  80. package/components/apps/components/layout/AppDrawer.svelte.d.ts +3 -4
  81. package/components/apps/components/layout/AppSplitpanes.svelte +34 -25
  82. package/components/apps/components/layout/AppSplitpanes.svelte.d.ts +1 -5
  83. package/components/apps/components/layout/AppTabs.svelte +22 -37
  84. package/components/apps/components/layout/AppTabs.svelte.d.ts +3 -5
  85. package/components/apps/editor/AppEditor.svelte +6 -3
  86. package/components/apps/editor/AppEditorHeader.svelte +4 -5
  87. package/components/apps/editor/AppInputs.svelte +13 -14
  88. package/components/apps/editor/AppPreview.svelte +12 -16
  89. package/components/apps/editor/ComponentHeader.svelte +58 -57
  90. package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -2
  91. package/components/apps/editor/GridEditor.svelte +21 -50
  92. package/components/apps/editor/GridEditor.svelte.d.ts +0 -2
  93. package/components/apps/editor/RecomputeAllComponents.svelte +13 -2
  94. package/components/apps/editor/SettingsPanel.svelte +104 -30
  95. package/components/apps/editor/SubGridEditor.svelte +34 -43
  96. package/components/apps/editor/SubGridEditor.svelte.d.ts +2 -3
  97. package/components/apps/editor/appUtils.d.ts +49 -6
  98. package/components/apps/editor/appUtils.js +145 -37
  99. package/components/apps/editor/component/Component.svelte +37 -22
  100. package/components/apps/editor/component/Component.svelte.d.ts +1 -2
  101. package/components/apps/editor/component/ComponentNavigation.svelte +28 -12
  102. package/components/apps/editor/component/components.d.ts +1550 -16
  103. package/components/apps/editor/component/components.js +295 -304
  104. package/components/apps/editor/component/default-codes.d.ts +1 -1
  105. package/components/apps/editor/component/default-codes.js +25 -25
  106. package/components/apps/editor/componentsPanel/ComponentList.svelte +18 -3
  107. package/components/apps/editor/componentsPanel/CssProperty.svelte +5 -3
  108. package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +3 -1
  109. package/components/apps/editor/componentsPanel/CssSettings.svelte +48 -90
  110. package/components/apps/editor/componentsPanel/ListItem.svelte +3 -0
  111. package/components/apps/editor/componentsPanel/ListItem.svelte.d.ts +2 -0
  112. package/components/apps/editor/contextPanel/ContextPanel.svelte +4 -5
  113. package/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte +0 -1
  114. package/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte.d.ts +1 -3
  115. package/components/apps/editor/contextPanel/components/OutputHeader.svelte +12 -2
  116. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +2 -2
  117. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +158 -129
  118. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +2 -1
  119. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +31 -3
  120. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
  121. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +42 -74
  122. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +68 -18
  123. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte.d.ts +1 -3
  124. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +27 -0
  125. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte.d.ts +17 -0
  126. package/components/apps/editor/inlineScriptsPanel/utils.d.ts +2 -0
  127. package/components/apps/editor/inlineScriptsPanel/utils.js +6 -5
  128. package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +10 -2
  129. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +37 -31
  130. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +4 -104
  131. package/components/apps/editor/settingsPanel/ComponentPanel.svelte +108 -87
  132. package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +5 -3
  133. package/components/apps/editor/settingsPanel/GridTab.svelte +0 -1
  134. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +128 -13
  135. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +14 -2
  136. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +35 -100
  137. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +3 -2
  138. package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +52 -0
  139. package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte.d.ts +28 -0
  140. package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +73 -25
  141. package/components/apps/editor/settingsPanel/SelectedRunnable.svelte.d.ts +2 -0
  142. package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +7 -5
  143. package/components/apps/editor/settingsPanel/SubTypeEditor.svelte.d.ts +3 -2
  144. package/components/apps/editor/settingsPanel/TableActionLabel.svelte.d.ts +2 -2
  145. package/components/apps/editor/settingsPanel/TableActions.svelte +8 -63
  146. package/components/apps/editor/settingsPanel/common/PanelSection.svelte +1 -2
  147. package/components/apps/editor/settingsPanel/common/PanelSection.svelte.d.ts +0 -1
  148. package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +2 -4
  149. package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +3 -1
  150. package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte.d.ts +2 -4
  151. package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +5 -5
  152. package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte.d.ts +2 -0
  153. package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +59 -37
  154. package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +8 -2
  155. package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte +46 -0
  156. package/components/apps/editor/settingsPanel/inputEditor/TabSelectInput.svelte.d.ts +20 -0
  157. package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +7 -0
  158. package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte.d.ts +1 -0
  159. package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte +31 -0
  160. package/components/apps/editor/settingsPanel/triggerLists/BackgroundScriptTriggerList.svelte.d.ts +22 -0
  161. package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +24 -0
  162. package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte.d.ts +21 -0
  163. package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte +156 -0
  164. package/components/apps/editor/settingsPanel/triggerLists/TriggerBadgesList.svelte.d.ts +22 -0
  165. package/components/apps/editor/settingsPanel/triggerLists/triggerListUtils.d.ts +2 -0
  166. package/components/apps/editor/settingsPanel/triggerLists/triggerListUtils.js +11 -0
  167. package/components/apps/gridUtils.js +1 -1
  168. package/components/apps/inputType.d.ts +23 -18
  169. package/components/apps/rx.d.ts +2 -0
  170. package/components/apps/rx.js +10 -3
  171. package/components/apps/svelte-grid/Grid.svelte +1 -5
  172. package/components/apps/svelte-grid/Grid.svelte.d.ts +1 -1
  173. package/components/apps/svelte-grid/MoveResize.svelte +24 -30
  174. package/components/apps/svelte-grid/MoveResize.svelte.d.ts +0 -4
  175. package/components/apps/svelte-grid/types.d.ts +1 -7
  176. package/components/apps/svelte-grid/utils/helper.js +6 -10
  177. package/components/apps/types.d.ts +32 -15
  178. package/components/apps/utils.d.ts +2 -2
  179. package/components/apps/utils.js +13 -11
  180. package/components/common/skeleton/Skeleton.svelte +1 -1
  181. package/components/flows/flowStateUtils.js +8 -1
  182. package/components/flows/flowStore.js +1 -1
  183. package/components/graph/FlowGraph.svelte +0 -2
  184. package/components/graph/FlowGraph.svelte.d.ts +0 -1
  185. package/components/graph/svelvet/container/views/GraphView.svelte +3 -28
  186. package/components/graph/svelvet/container/views/GraphView.svelte.d.ts +0 -3
  187. package/components/graph/svelvet/container/views/Svelvet.svelte +1 -17
  188. package/components/graph/svelvet/container/views/Svelvet.svelte.d.ts +0 -8
  189. package/components/graph/svelvet/customCss/controllers/getCss.js +0 -11
  190. package/components/graph/svelvet/edges/controllers/util.js +1 -2
  191. package/components/graph/svelvet/edges/views/Edges/SmoothStepEdge.svelte.d.ts +2 -2
  192. package/components/graph/svelvet/nodes/controllers/util.js +1 -1
  193. package/components/graph/svelvet/nodes/models/Node.d.ts +0 -4
  194. package/components/graph/svelvet/nodes/models/Node.js +3 -41
  195. package/components/graph/svelvet/store/controllers/storeApi.js +2 -7
  196. package/components/graph/svelvet/store/controllers/util.d.ts +0 -7
  197. package/components/graph/svelvet/store/controllers/util.js +4 -36
  198. package/components/graph/svelvet/store/types/types.d.ts +0 -5
  199. package/components/home/ItemsList.svelte +1 -1
  200. package/package.json +13 -8
  201. package/utils.d.ts +2 -0
  202. package/utils.js +6 -0
  203. package/components/apps/editor/GridPanel.svelte +0 -31
  204. package/components/apps/editor/GridPanel.svelte.d.ts +0 -18
  205. package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +0 -12
  206. package/components/apps/editor/componentsPanel/componentStaticValues.js +0 -25
  207. package/components/graph/svelvet/nodes/views/EditNode.svelte +0 -147
  208. package/components/graph/svelvet/nodes/views/EditNode.svelte.d.ts +0 -33
  209. package/components/graph/svelvet/resizableNodes/controllers/util.d.ts +0 -11
  210. package/components/graph/svelvet/resizableNodes/controllers/util.js +0 -24
  211. package/components/graph/svelvet/resizableNodes/models/ResizeNode.d.ts +0 -33
  212. package/components/graph/svelvet/resizableNodes/models/ResizeNode.js +0 -71
  213. package/components/graph/svelvet/resizableNodes/views/ResizeNode.svelte +0 -81
  214. package/components/graph/svelvet/resizableNodes/views/ResizeNode.svelte.d.ts +0 -20
@@ -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,12 +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';
7
+ import { initConfig, initOutput } from '../../editor/appUtils';
8
+ import { components } from '../../editor/component';
9
+ import ResolveConfig from '../helpers/ResolveConfig.svelte';
10
10
  export let id;
11
11
  export let componentInput;
12
12
  export let configuration;
@@ -18,40 +18,37 @@ export let noWFull = false;
18
18
  export let preclickAction = undefined;
19
19
  export let customCss = undefined;
20
20
  export let render;
21
- export let initializing = true;
22
- const { worldStore, app } = getContext('AppViewerContext');
23
- let labelValue;
24
- let color;
25
- let size;
21
+ export let initializing = false;
22
+ export let extraKey = undefined;
23
+ export let controls = undefined;
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
+ });
31
+ if (controls) {
32
+ $componentControl[id] = controls;
33
+ }
26
34
  let runnableComponent;
27
- let disabled = undefined;
28
- let fillContainer = undefined;
29
- let gotoUrl = undefined;
30
- let gotoNewTab = undefined;
31
35
  let isLoading = false;
32
36
  let ownClick = false;
33
- let triggerOnAppLoad = false;
34
- let beforeIcon = undefined;
35
- let afterIcon = undefined;
36
37
  let beforeIconComponent;
37
38
  let afterIconComponent;
38
- $: beforeIcon && handleBeforeIcon();
39
- $: afterIcon && handleAfterIcon();
39
+ $: resolvedConfig.beforeIcon && handleBeforeIcon();
40
+ $: resolvedConfig.afterIcon && handleAfterIcon();
40
41
  async function handleBeforeIcon() {
41
- if (beforeIcon) {
42
- beforeIconComponent = await loadIcon(beforeIcon);
42
+ if (resolvedConfig.beforeIcon) {
43
+ beforeIconComponent = await loadIcon(resolvedConfig.beforeIcon);
43
44
  }
44
45
  }
45
46
  async function handleAfterIcon() {
46
- if (afterIcon) {
47
- afterIconComponent = await loadIcon(afterIcon);
47
+ if (resolvedConfig.afterIcon) {
48
+ afterIconComponent = await loadIcon(resolvedConfig.afterIcon);
48
49
  }
49
50
  }
50
- let outputs = initOutput($worldStore, id, {
51
- result: undefined,
52
- loading: false
53
- });
54
- $: triggerOnAppLoad && runnableComponent?.runComponent();
51
+ $: resolvedConfig?.triggerOnAppLoad && runnableComponent?.runComponent();
55
52
  $: if (outputs?.loading != undefined) {
56
53
  outputs.loading.set(false, true);
57
54
  }
@@ -69,22 +66,17 @@ let errors = {};
69
66
  $: errorsMessage = Object.values(errors)
70
67
  .filter((x) => x != '')
71
68
  .join('\n');
69
+ let runnableWrapper;
72
70
  async function handleClick(event) {
73
71
  event?.stopPropagation();
74
72
  event?.preventDefault();
73
+ $selectedComponent = id;
75
74
  if (preclickAction) {
76
75
  await preclickAction();
77
76
  }
78
77
  ownClick = true;
79
78
  if (!runnableComponent) {
80
- if (gotoUrl) {
81
- if (gotoNewTab) {
82
- window.open(gotoUrl, '_blank');
83
- }
84
- else {
85
- goto(gotoUrl);
86
- }
87
- }
79
+ runnableWrapper.onSuccess();
88
80
  }
89
81
  else {
90
82
  await runnableComponent?.runComponent();
@@ -92,67 +84,55 @@ async function handleClick(event) {
92
84
  }
93
85
  </script>
94
86
 
95
- <InputValue
96
- on:done={() => initializing && (initializing = false)}
97
- {id}
98
- input={configuration.label}
99
- bind:value={labelValue}
100
- />
101
- <InputValue {id} input={configuration.goto} bind:value={gotoUrl} />
102
- <InputValue {id} input={configuration.color} bind:value={color} />
103
- <InputValue {id} input={configuration.size} bind:value={size} />
104
- <InputValue {id} input={configuration.beforeIcon} bind:value={beforeIcon} />
105
- <InputValue {id} input={configuration.afterIcon} bind:value={afterIcon} />
106
- <InputValue {id} input={configuration.triggerOnAppLoad} bind:value={triggerOnAppLoad} />
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
+ />
95
+ {/each}
107
96
 
108
- <InputValue
109
- {id}
110
- input={configuration.disabled}
111
- extraContext={extraQueryParams}
112
- bind:value={disabled}
113
- bind:error={errors.disabled}
114
- />
115
- <InputValue {id} input={configuration.fillContainer} bind:value={fillContainer} />
116
- <InputValue {id} input={configuration.gotoNewTab} bind:value={gotoNewTab} />
97
+ <!-- gotoNewTab={resolvedConfig.onSuccess.selected == 'goto'} -->
117
98
 
118
99
  <RunnableWrapper
100
+ bind:this={runnableWrapper}
119
101
  {recomputeIds}
120
102
  bind:runnableComponent
121
103
  {componentInput}
104
+ doOnSuccess={resolvedConfig.onSuccess}
122
105
  {id}
123
106
  {extraQueryParams}
124
107
  autoRefresh={false}
125
- goto={gotoUrl}
126
- {gotoNewTab}
127
108
  {render}
109
+ {outputs}
110
+ {extraKey}
128
111
  >
129
112
  <AlignWrapper {noWFull} {horizontalAlignment} {verticalAlignment}>
130
113
  {#if errorsMessage}
131
114
  <div class="text-red-500 text-xs">{errorsMessage}</div>
132
115
  {/if}
133
116
  <Button
117
+ on:pointerdown={(e) => e.stopPropagation()}
134
118
  btnClasses={twMerge(
135
119
  $app.css?.['buttoncomponent']?.['button']?.class,
136
- customCss?.button.class,
137
- fillContainer ? 'w-full h-full' : ''
120
+ customCss?.button?.class,
121
+ resolvedConfig.fillContainer ? 'w-full h-full' : ''
138
122
  )}
139
- style={[$app.css?.['buttoncomponent']?.['button']?.style, customCss?.button.style].join(';')}
140
- {disabled}
141
- on:pointerdown={(e) => {
142
- e?.stopPropagation()
143
- window.dispatchEvent(new Event('pointerup'))
144
- }}
123
+ style={[$app.css?.['buttoncomponent']?.['button']?.style, customCss?.button?.style].join(';')}
124
+ disabled={resolvedConfig.disabled}
145
125
  on:click={handleClick}
146
- {size}
147
- {color}
126
+ size={resolvedConfig.size}
127
+ color={resolvedConfig.color}
148
128
  {loading}
149
129
  >
150
130
  <span class="truncate inline-flex gap-2 items-center">
151
- {#if beforeIcon && beforeIconComponent}
131
+ {#if resolvedConfig.beforeIcon && beforeIconComponent}
152
132
  <svelte:component this={beforeIconComponent} size={14} />
153
133
  {/if}
154
- <div>{labelValue}</div>
155
- {#if afterIcon && afterIconComponent}
134
+ <div>{resolvedConfig.label}</div>
135
+ {#if resolvedConfig.afterIcon && afterIconComponent}
156
136
  <svelte:component this={afterIconComponent} size={14} />
157
137
  {/if}
158
138
  </span>
@@ -1,20 +1,25 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { AppInput } from '../../inputType';
3
- import type { ComponentCustomCSS } from '../../types';
3
+ import type { ComponentCustomCSS, RichConfigurations } from '../../types';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  id: string;
7
7
  componentInput: AppInput | undefined;
8
- configuration: Record<string, AppInput>;
8
+ configuration: RichConfigurations;
9
9
  recomputeIds?: string[] | undefined;
10
10
  extraQueryParams?: Record<string, any> | undefined;
11
11
  horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
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;
19
+ controls?: {
20
+ left: () => boolean;
21
+ right: () => boolean | string;
22
+ } | undefined;
18
23
  };
19
24
  events: {
20
25
  [evt: string]: CustomEvent<any>;
@@ -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>
@@ -1,15 +1,15 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { AppInput } from '../../inputType';
3
- import type { ComponentCustomCSS } from '../../types';
3
+ import type { ComponentCustomCSS, RichConfigurations } from '../../types';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  id: string;
7
7
  componentInput: AppInput | undefined;
8
- configuration: Record<string, AppInput>;
8
+ configuration: RichConfigurations;
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>
@@ -1,18 +1,17 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { AppInput } from '../../inputType';
3
- import type { ComponentCustomCSS } from '../../types';
3
+ import type { ComponentCustomCSS, RichConfigurations } from '../../types';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  id: string;
7
7
  componentInput: AppInput | undefined;
8
- configuration: Record<string, AppInput>;
8
+ configuration: RichConfigurations;
9
9
  recomputeIds?: string[] | undefined;
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 {};