windmill-components 1.56.5 → 1.57.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/assets/app.css +5 -1
  2. package/components/ArgInput.svelte +6 -6
  3. package/components/DisplayResult.svelte +1 -1
  4. package/components/Dropdown.svelte +1 -1
  5. package/components/Dropdown.svelte.d.ts +1 -0
  6. package/components/Editor.svelte +5 -3
  7. package/components/Editor.svelte.d.ts +2 -0
  8. package/components/EditorBar.svelte +15 -1
  9. package/components/FlowBuilder.svelte +18 -10
  10. package/components/GroupEditor.svelte +1 -0
  11. package/components/IconedResourceType.svelte +2 -2
  12. package/components/InputTransformForm.svelte +7 -5
  13. package/components/ItemPicker.svelte +63 -57
  14. package/components/ItemPicker.svelte.d.ts +1 -2
  15. package/components/LogViewer.svelte +7 -9
  16. package/components/ModulePreview.svelte +4 -13
  17. package/components/MoveDrawer.svelte +40 -16
  18. package/components/MoveDrawer.svelte.d.ts +2 -2
  19. package/components/PageHeader.svelte +1 -1
  20. package/components/Path.svelte +5 -2
  21. package/components/Popover.svelte +6 -4
  22. package/components/Popover.svelte.d.ts +2 -0
  23. package/components/ResourcePicker.svelte +1 -0
  24. package/components/RunChart.svelte +0 -1
  25. package/components/SchemaForm.svelte +2 -1
  26. package/components/SchemaForm.svelte.d.ts +1 -0
  27. package/components/ScriptBuilder.svelte +2 -1
  28. package/components/ScriptEditor.svelte +86 -80
  29. package/components/ShareModal.svelte.d.ts +2 -2
  30. package/components/SimpleEditor.svelte +17 -0
  31. package/components/StringTypeNarrowing.svelte +30 -8
  32. package/components/TemplateEditor.svelte +18 -2
  33. package/components/TestJobLoader.svelte +83 -74
  34. package/components/Tooltip.svelte +1 -1
  35. package/components/VariableEditor.svelte +4 -3
  36. package/components/VariableEditor.svelte.d.ts +2 -2
  37. package/components/apps/components/buttons/AppButton.svelte +3 -7
  38. package/components/apps/components/dataDisplay/AppBarChart.svelte +10 -6
  39. package/components/apps/components/dataDisplay/AppHtml.svelte +23 -0
  40. package/components/apps/components/dataDisplay/AppHtml.svelte.d.ts +23 -0
  41. package/components/apps/components/dataDisplay/AppPieChart.svelte +10 -6
  42. package/components/apps/components/dataDisplay/AppScatterChart.svelte +46 -0
  43. package/components/apps/components/dataDisplay/AppScatterChart.svelte.d.ts +21 -0
  44. package/components/apps/components/dataDisplay/AppText.svelte +48 -7
  45. package/components/apps/components/dataDisplay/AppText.svelte.d.ts +1 -0
  46. package/components/apps/components/dataDisplay/AppTimeseries.svelte +57 -0
  47. package/components/apps/components/dataDisplay/AppTimeseries.svelte.d.ts +22 -0
  48. package/components/apps/components/form/AppForm.svelte +33 -28
  49. package/components/apps/components/helpers/InputValue.svelte +10 -16
  50. package/components/apps/components/helpers/InputValue.svelte.d.ts +2 -0
  51. package/components/apps/components/helpers/NonRunnableComponent.svelte +4 -6
  52. package/components/apps/components/helpers/NonRunnableComponent.svelte.d.ts +1 -1
  53. package/components/apps/components/helpers/RefreshButton.svelte +1 -1
  54. package/components/apps/components/helpers/RunnableComponent.svelte +120 -119
  55. package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +1 -0
  56. package/components/apps/components/helpers/RunnableWrapper.svelte +11 -1
  57. package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +1 -0
  58. package/components/apps/components/selectInputs/AppSelect.svelte +2 -0
  59. package/components/apps/components/table/AppTable.svelte +22 -17
  60. package/components/apps/components/table/AppTableFooter.svelte +2 -1
  61. package/components/apps/components/table/tableOptions.d.ts +2 -9
  62. package/components/apps/components/table/tableOptions.js +5 -2
  63. package/components/apps/components/textInputs/AppTextInput.svelte +0 -1
  64. package/components/apps/editor/AppEditor.svelte +133 -102
  65. package/components/apps/editor/AppEditor.svelte.d.ts +1 -0
  66. package/components/apps/editor/AppEditorHeader.svelte +355 -50
  67. package/components/apps/editor/AppEditorHeader.svelte.d.ts +2 -4
  68. package/components/apps/editor/AppExportButton.svelte +34 -0
  69. package/components/apps/editor/AppExportButton.svelte.d.ts +17 -0
  70. package/components/apps/editor/AppPreview.svelte +19 -6
  71. package/components/apps/editor/AppPreview.svelte.d.ts +5 -0
  72. package/components/apps/editor/AppPublishButton.svelte +46 -0
  73. package/components/apps/editor/AppPublishButton.svelte.d.ts +19 -0
  74. package/components/apps/editor/ComponentEditor.svelte +35 -3
  75. package/components/apps/editor/ComponentHeader.svelte +23 -16
  76. package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -0
  77. package/components/apps/editor/GridEditor.svelte +71 -48
  78. package/components/apps/editor/RecomputeAllComponents.svelte +80 -13
  79. package/components/apps/editor/componentsPanel/ComponentList.svelte +30 -28
  80. package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +2 -1
  81. package/components/apps/editor/componentsPanel/componentStaticValues.js +3 -2
  82. package/components/apps/editor/componentsPanel/data.js +191 -77
  83. package/components/apps/editor/contextPanel/ContextPanel.svelte +60 -41
  84. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +6 -2
  85. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -0
  86. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +47 -10
  87. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +1 -0
  88. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +11 -4
  89. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
  90. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +29 -21
  91. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +10 -6
  92. package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +38 -33
  93. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +3 -2
  94. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +1 -10
  95. package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +27 -9
  96. package/components/apps/editor/settingsPanel/ComponentPanel.svelte +8 -6
  97. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +6 -16
  98. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +0 -1
  99. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +46 -21
  100. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +3 -1
  101. package/components/apps/editor/settingsPanel/PickInlineScript.svelte +0 -1
  102. package/components/apps/editor/settingsPanel/Recompute.svelte +1 -1
  103. package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +8 -7
  104. package/components/apps/editor/settingsPanel/TableActions.svelte +10 -10
  105. package/components/apps/editor/settingsPanel/common/PanelSection.svelte +1 -0
  106. package/components/apps/editor/settingsPanel/common/PanelSection.svelte.d.ts +1 -0
  107. package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +55 -49
  108. package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte.d.ts +2 -2
  109. package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +24 -0
  110. package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +17 -0
  111. package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +8 -11
  112. package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +35 -7
  113. package/components/apps/editorUtils.d.ts +1 -0
  114. package/components/apps/editorUtils.js +11 -0
  115. package/components/apps/gridUtils.js +1 -1
  116. package/components/apps/inputType.d.ts +5 -4
  117. package/components/apps/rx.d.ts +1 -1
  118. package/components/apps/rx.js +6 -2
  119. package/components/apps/store.d.ts +2 -0
  120. package/components/apps/store.js +2 -0
  121. package/components/apps/types.d.ts +19 -3
  122. package/components/apps/utils.d.ts +2 -2
  123. package/components/apps/utils.js +22 -8
  124. package/components/common/button/Button.svelte +6 -8
  125. package/components/common/button/Button.svelte.d.ts +1 -0
  126. package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +4 -1
  127. package/components/common/popup/Popup.svelte +1 -1
  128. package/components/common/table/AppRow.svelte +26 -3
  129. package/components/common/table/AppRow.svelte.d.ts +4 -0
  130. package/components/common/table/FlowRow.svelte +4 -4
  131. package/components/common/table/RowIcon.svelte +1 -1
  132. package/components/common/table/ScriptRow.svelte +2 -2
  133. package/components/common/tabs/Tabs.svelte +1 -1
  134. package/components/common/toggleButton/ToggleButton.svelte +2 -0
  135. package/components/common/toggleButton/ToggleButton.svelte.d.ts +1 -0
  136. package/components/common/toggleButton/ToggleButtonGroup.svelte +3 -3
  137. package/components/flows/CreateActionsApp.svelte +43 -0
  138. package/components/flows/CreateActionsApp.svelte.d.ts +14 -0
  139. package/components/flows/CreateActionsFlow.svelte +6 -1
  140. package/components/flows/content/DynamicInputHelpBox.svelte +1 -1
  141. package/components/flows/content/FlowConstants.svelte +23 -9
  142. package/components/flows/content/FlowInputs.svelte +2 -2
  143. package/components/flows/content/FlowModuleHeader.svelte +6 -5
  144. package/components/flows/content/FlowSettings.svelte +1 -1
  145. package/components/flows/header/FlowImportExportMenu.svelte +1 -1
  146. package/components/flows/map/FlowConstantsItem.svelte +5 -7
  147. package/components/flows/map/FlowModuleSchemaMap.svelte +1 -5
  148. package/components/flows/map/FlowSettingsItem.svelte +5 -7
  149. package/components/flows/pickers/PickHubApp.svelte +73 -0
  150. package/components/flows/pickers/PickHubApp.svelte.d.ts +20 -0
  151. package/components/flows/pickers/PickHubFlow.svelte +3 -1
  152. package/components/flows/pickers/PickHubScript.svelte +1 -0
  153. package/components/flows/propPicker/PropPickerWrapper.svelte +42 -31
  154. package/components/home/ItemsList.svelte +6 -4
  155. package/components/icons/ClickhouseIcon.svelte +22 -0
  156. package/components/icons/ClickhouseIcon.svelte.d.ts +17 -0
  157. package/components/icons/FaunadbIcon.svelte +19 -0
  158. package/components/icons/FaunadbIcon.svelte.d.ts +17 -0
  159. package/components/icons/OpenaiIcon.svelte +18 -0
  160. package/components/icons/OpenaiIcon.svelte.d.ts +17 -0
  161. package/components/icons/index.d.ts +7 -1
  162. package/components/icons/index.js +8 -2
  163. package/components/propertyPicker/ObjectViewer.svelte +11 -4
  164. package/components/propertyPicker/PropPicker.svelte +1 -1
  165. package/components/scriptEditor/LogPanel.svelte +26 -22
  166. package/components/sidebar/WorkspaceMenu.svelte +2 -3
  167. package/components/splitPanes/SplitPanesWrapper.svelte +1 -5
  168. package/components/splitPanes/SplitPanesWrapper.svelte.d.ts +0 -1
  169. package/editorUtils.js +2 -0
  170. package/gen/core/OpenAPI.js +1 -1
  171. package/gen/models/Policy.d.ts +1 -0
  172. package/gen/services/AppService.d.ts +50 -0
  173. package/gen/services/AppService.js +55 -0
  174. package/gen/services/GranularAclService.d.ts +3 -3
  175. package/gen/services/ResourceService.d.ts +15 -0
  176. package/gen/services/ResourceService.js +17 -0
  177. package/infer.js +4 -0
  178. package/package.json +18 -9
  179. package/stores.d.ts +1 -0
  180. package/stores.js +13 -5
  181. package/utils.d.ts +9 -1
  182. package/utils.js +28 -11
  183. package/components/apps/CreateApp.svelte +0 -68
  184. package/components/apps/CreateApp.svelte.d.ts +0 -14
  185. package/components/apps/editor/settingsPanel/SectionPanel.svelte +0 -70
  186. package/components/apps/editor/settingsPanel/SectionPanel.svelte.d.ts +0 -19
  187. package/components/apps/editor/settingsPanel/UserInputEditor.svelte +0 -2
  188. package/components/apps/editor/settingsPanel/UserInputEditor.svelte.d.ts +0 -14
@@ -3,6 +3,7 @@ const inputs = {
3
3
  title: 'Inputs',
4
4
  components: [
5
5
  {
6
+ softWrap: true,
6
7
  verticalAlignment: 'center',
7
8
  id: 'textinputcomponent',
8
9
  type: 'textinputcomponent',
@@ -12,28 +13,45 @@ const inputs = {
12
13
  type: 'static',
13
14
  value: 'Type...',
14
15
  fieldType: 'text',
15
- defaultValue: 'Type...'
16
+ onlyStatic: true,
16
17
  },
17
18
  },
18
19
  card: false
19
20
  },
20
21
  {
22
+ softWrap: true,
21
23
  verticalAlignment: 'center',
22
24
  id: 'passwordinputcomponent',
23
25
  type: 'passwordinputcomponent',
24
26
  componentInput: undefined,
25
- configuration: {},
27
+ configuration: {
28
+ placeholder: {
29
+ type: 'static',
30
+ value: 'Password',
31
+ fieldType: 'text',
32
+ onlyStatic: true,
33
+ },
34
+ },
26
35
  card: false
27
36
  },
28
37
  {
38
+ softWrap: true,
29
39
  verticalAlignment: 'center',
30
40
  id: 'numberinputcomponent',
31
41
  type: 'numberinputcomponent',
32
42
  componentInput: undefined,
33
- configuration: {},
43
+ configuration: {
44
+ placeholder: {
45
+ type: 'static',
46
+ value: 'Type...',
47
+ fieldType: 'text',
48
+ onlyStatic: true,
49
+ },
50
+ },
34
51
  card: false
35
52
  },
36
53
  {
54
+ softWrap: true,
37
55
  verticalAlignment: 'center',
38
56
  id: 'dateinputcomponent',
39
57
  type: 'dateinputcomponent',
@@ -43,20 +61,18 @@ const inputs = {
43
61
  type: 'static',
44
62
  value: '',
45
63
  fieldType: 'date',
46
- defaultValue: ''
47
64
  },
48
65
  maxDate: {
49
66
  type: 'static',
50
67
  value: '',
51
68
  fieldType: 'date',
52
- defaultValue: ''
53
69
  }
54
70
  },
55
71
  card: false,
56
- softWrap: true
57
72
  },
58
73
  {
59
74
  ...defaultAlignement,
75
+ softWrap: true,
60
76
  id: 'checkboxcomponent',
61
77
  type: 'checkboxcomponent',
62
78
  componentInput: undefined,
@@ -65,7 +81,6 @@ const inputs = {
65
81
  type: 'static',
66
82
  value: 'Label',
67
83
  fieldType: 'text',
68
- defaultValue: 'Label'
69
84
  }
70
85
  },
71
86
  card: false
@@ -80,10 +95,6 @@ const inputs = {
80
95
  type: 'static',
81
96
  fieldType: 'array',
82
97
  subFieldType: 'object',
83
- defaultValue: [
84
- { value: 'foo', label: 'Foo' },
85
- { value: 'bar', label: 'Bar' }
86
- ],
87
98
  value: [
88
99
  { value: 'foo', label: 'Foo' },
89
100
  { value: 'bar', label: 'Bar' }
@@ -92,7 +103,6 @@ const inputs = {
92
103
  itemKey: {
93
104
  type: 'static',
94
105
  fieldType: 'text',
95
- defaultValue: 'value',
96
106
  value: 'value'
97
107
  }
98
108
  },
@@ -106,6 +116,7 @@ const buttons = {
106
116
  components: [
107
117
  {
108
118
  ...defaultAlignement,
119
+ softWrap: true,
109
120
  id: 'buttoncomponent',
110
121
  type: 'buttoncomponent',
111
122
  componentInput: {
@@ -113,29 +124,27 @@ const buttons = {
113
124
  fieldType: 'any',
114
125
  fields: {},
115
126
  runnable: undefined,
116
- defaultValue: undefined
117
127
  },
118
128
  recomputeIds: undefined,
119
129
  configuration: {
120
130
  label: {
121
131
  type: 'static',
122
- value: 'Lorem ipsum',
123
132
  fieldType: 'text',
124
- defaultValue: 'Lorem ipsum'
133
+ value: 'Press me'
125
134
  },
126
135
  color: {
127
136
  fieldType: 'select',
128
137
  type: 'static',
129
- value: 'blue',
138
+ onlyStatic: true,
130
139
  optionValuesKey: 'buttonColorOptions',
131
- defaultValue: 'blue'
140
+ value: 'blue'
132
141
  },
133
142
  size: {
134
143
  fieldType: 'select',
135
144
  type: 'static',
136
- value: 'xs',
145
+ onlyStatic: true,
137
146
  optionValuesKey: 'buttonSizeOptions',
138
- defaultValue: 'xs'
147
+ value: 'xs'
139
148
  }
140
149
  },
141
150
  card: false
@@ -149,7 +158,6 @@ const buttons = {
149
158
  fieldType: 'any',
150
159
  fields: {},
151
160
  runnable: undefined,
152
- defaultValue: undefined
153
161
  },
154
162
  recomputeIds: undefined,
155
163
  configuration: {
@@ -157,21 +165,20 @@ const buttons = {
157
165
  type: 'static',
158
166
  value: 'Submit',
159
167
  fieldType: 'text',
160
- defaultValue: 'formcomponent'
161
168
  },
162
169
  color: {
163
170
  fieldType: 'select',
164
171
  type: 'static',
172
+ onlyStatic: true,
165
173
  value: 'dark',
166
174
  optionValuesKey: 'buttonColorOptions',
167
- defaultValue: 'dark'
168
175
  },
169
176
  size: {
170
177
  fieldType: 'select',
171
178
  type: 'static',
172
179
  value: 'xs',
180
+ onlyStatic: true,
173
181
  optionValuesKey: 'buttonSizeOptions',
174
- defaultValue: 'xs'
175
182
  }
176
183
  },
177
184
  card: true
@@ -182,16 +189,48 @@ const display = {
182
189
  title: 'Display',
183
190
  components: [
184
191
  {
185
- ...defaultAlignement,
192
+ softWrap: false,
193
+ id: 'htmlcomponent',
194
+ type: 'htmlcomponent',
195
+ componentInput: {
196
+ type: 'static',
197
+ fieldType: 'template',
198
+ value: `<img
199
+ src="https://images.unsplash.com/photo-1554629947-334ff61d85dc?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=1024&amp;h=1280&amp;q=80"
200
+ >
201
+ <div class="absolute top-4 left-2 text-white">
202
+ Hello \${ctx.username}
203
+ </div>
204
+ `,
205
+ },
206
+ configuration: {},
207
+ card: false
208
+ },
209
+ {
210
+ softWrap: true,
211
+ horizontalAlignment: 'left',
212
+ verticalAlignment: 'top',
186
213
  id: 'textcomponent',
187
214
  type: 'textcomponent',
188
215
  componentInput: {
189
216
  type: 'static',
190
- value: 'Lorem ipsum',
191
- fieldType: 'textarea',
192
- defaultValue: 'Lorem ipsum'
217
+ fieldType: 'template',
218
+ value: 'Hello ${ctx.username}',
219
+ },
220
+ configuration: {
221
+ style: {
222
+ fieldType: 'select',
223
+ type: 'static',
224
+ onlyStatic: true,
225
+ optionValuesKey: 'textStyleOptions',
226
+ value: 'Body'
227
+ },
228
+ extraStyle: {
229
+ type: 'static',
230
+ fieldType: 'text',
231
+ value: '',
232
+ },
193
233
  },
194
- configuration: {},
195
234
  card: false
196
235
  },
197
236
  {
@@ -201,45 +240,27 @@ const display = {
201
240
  search: {
202
241
  fieldType: 'select',
203
242
  type: 'static',
204
- value: 'Disabled',
243
+ onlyStatic: true,
205
244
  optionValuesKey: 'tableSearchOptions',
206
- defaultValue: 'Disabled'
207
- },
208
- pagination: {
209
- type: 'static',
210
- value: false,
211
- fieldType: 'boolean',
212
- defaultValue: false
245
+ value: 'Disabled'
213
246
  }
214
247
  },
215
248
  componentInput: {
216
249
  type: 'static',
217
250
  fieldType: 'array',
218
251
  subFieldType: 'object',
219
- defaultValue: [
220
- {
221
- id: 1,
222
- name: 'Lorem ipsum',
223
- age: 42
224
- },
225
- {
226
- id: 2,
227
- name: 'Lorem ipsum',
228
- age: 42
229
- }
230
- ],
231
252
  value: [
232
253
  {
233
254
  id: 1,
234
- name: 'Lorem ipsum',
255
+ name: 'A cell with a long name',
235
256
  age: 42
236
257
  },
237
258
  {
238
259
  id: 2,
239
- name: 'Lorem ipsum',
240
- age: 42
260
+ name: 'A briefer cell',
261
+ age: 84
241
262
  }
242
- ]
263
+ ],
243
264
  },
244
265
  card: true,
245
266
  actionButtons: []
@@ -250,25 +271,22 @@ const display = {
250
271
  configuration: {
251
272
  theme: {
252
273
  type: 'static',
253
- value: 'theme1',
274
+ onlyStatic: true,
254
275
  fieldType: 'select',
255
276
  optionValuesKey: 'chartThemeOptions',
256
- defaultValue: 'theme1'
277
+ value: 'theme1'
257
278
  },
258
- labels: {
279
+ doughnutStyle: {
259
280
  type: 'static',
260
- value: ['First', 'Second', 'Third'],
261
- fieldType: 'array',
262
- subFieldType: 'text',
263
- defaultValue: ['First', 'Second', 'Third']
281
+ onlyStatic: true,
282
+ fieldType: 'boolean',
283
+ value: false
264
284
  }
265
285
  },
266
286
  componentInput: {
267
287
  type: 'static',
268
- fieldType: 'array',
269
- subFieldType: 'number',
270
- defaultValue: [25, 50, 25],
271
- value: [25, 50, 25]
288
+ fieldType: 'object',
289
+ value: { data: [25, 50, 25], labels: ['Pie', 'Charts', '<3'] }
272
290
  },
273
291
  card: true
274
292
  },
@@ -278,25 +296,122 @@ const display = {
278
296
  configuration: {
279
297
  theme: {
280
298
  type: 'static',
281
- value: 'theme1',
299
+ onlyStatic: true,
282
300
  fieldType: 'select',
283
301
  optionValuesKey: 'chartThemeOptions',
284
- defaultValue: 'theme1'
302
+ value: 'theme1'
285
303
  },
286
- labels: {
304
+ line: {
287
305
  type: 'static',
288
- value: ['Lorem ipsum', 'Lorem ipsum', 'Lorem ipsum'],
289
- fieldType: 'array',
290
- subFieldType: 'text',
291
- defaultValue: ['Lorem ipsum', 'Lorem ipsum', 'Lorem ipsum']
306
+ onlyStatic: true,
307
+ fieldType: 'boolean',
308
+ value: false
292
309
  }
293
310
  },
311
+ componentInput: {
312
+ type: 'static',
313
+ fieldType: 'object',
314
+ value: { data: [25, 50, 25], labels: ['Bar', 'Charts', '<3'] }
315
+ },
316
+ card: true
317
+ },
318
+ {
319
+ id: 'scatterchartcomponent',
320
+ type: 'scatterchartcomponent',
321
+ configuration: {
322
+ zoomable: {
323
+ type: 'static',
324
+ onlyStatic: true,
325
+ fieldType: 'boolean',
326
+ value: false
327
+ },
328
+ pannable: {
329
+ type: 'static',
330
+ onlyStatic: true,
331
+ fieldType: 'boolean',
332
+ value: false
333
+ },
334
+ },
335
+ componentInput: {
336
+ type: 'static',
337
+ fieldType: 'array',
338
+ subFieldType: 'object',
339
+ value: [{
340
+ label: 'foo',
341
+ data: [
342
+ { x: 25, y: 50 },
343
+ { x: 23, y: 23 },
344
+ { x: 12, y: 37 }
345
+ ],
346
+ backgroundColor: 'rgb(255, 12, 137)'
347
+ },
348
+ {
349
+ label: 'foobar',
350
+ data: [
351
+ { x: 32, y: 32 },
352
+ { x: 25, y: 42 },
353
+ { x: 3, y: 27 }
354
+ ],
355
+ backgroundColor: 'orange'
356
+ }]
357
+ },
358
+ card: true
359
+ },
360
+ {
361
+ id: 'timeseriescomponent',
362
+ type: 'timeseriescomponent',
363
+ configuration: {
364
+ logarithmicScale: {
365
+ type: 'static',
366
+ onlyStatic: true,
367
+ fieldType: 'boolean',
368
+ value: false
369
+ },
370
+ zoomable: {
371
+ type: 'static',
372
+ onlyStatic: true,
373
+ fieldType: 'boolean',
374
+ value: false
375
+ },
376
+ pannable: {
377
+ type: 'static',
378
+ onlyStatic: true,
379
+ fieldType: 'boolean',
380
+ value: false
381
+ },
382
+ },
294
383
  componentInput: {
295
384
  type: 'static',
296
385
  fieldType: 'array',
297
- subFieldType: 'number',
298
- defaultValue: [25, 50, 25],
299
- value: [25, 50, 25]
386
+ subFieldType: 'object',
387
+ value: [{
388
+ label: 'foo',
389
+ data: [{
390
+ x: '2021-11-06 23:39:30',
391
+ y: 50
392
+ }, {
393
+ x: '2021-11-07 01:00:28',
394
+ y: 60
395
+ }, {
396
+ x: '2021-11-07 09:00:28',
397
+ y: 20
398
+ }],
399
+ backgroundColor: 'rgb(255, 12, 137)'
400
+ },
401
+ {
402
+ label: 'foobar',
403
+ data: [{
404
+ x: '2021-11-06 23:39:30',
405
+ y: 20
406
+ }, {
407
+ x: '2021-11-07 01:00:28',
408
+ y: 13
409
+ }, {
410
+ x: '2021-11-07 09:00:28',
411
+ y: 45
412
+ }],
413
+ backgroundColor: 'orange'
414
+ }]
300
415
  },
301
416
  card: true
302
417
  },
@@ -305,13 +420,12 @@ const display = {
305
420
  type: 'displaycomponent',
306
421
  componentInput: {
307
422
  type: 'static',
308
- fieldType: 'text',
309
- defaultValue: 'Lorem Ipsum',
310
- value: 'Lorem Ipsum'
423
+ fieldType: 'object',
424
+ value: { "foo": 42 },
311
425
  },
312
426
  configuration: {},
313
427
  card: false
314
- }
428
+ },
315
429
  ]
316
430
  };
317
431
  const componentSets = [buttons, inputs, display];
@@ -1,5 +1,6 @@
1
1
  <script>import { classNames } from '../../../../utils';
2
2
  import { getContext } from 'svelte';
3
+ import { key } from 'svelte-awesome/icons';
3
4
  import { displayData } from '../../utils';
4
5
  import PanelSection from '../settingsPanel/common/PanelSection.svelte';
5
6
  import ComponentOutputViewer from './ComponentOutputViewer.svelte';
@@ -14,66 +15,84 @@ function connectInput(componentId, path) {
14
15
  path
15
16
  },
16
17
  type: 'connected'
17
- }
18
+ },
19
+ hoveredComponent: undefined
18
20
  };
19
21
  }
20
22
  }
21
23
  function getComponentNameById(componentId) {
22
- const component = $app.grid.find((c) => c.data.id === componentId);
24
+ const component = $app.grid.find((c) => c?.data?.id === componentId);
23
25
  if (component?.data.type) {
24
26
  return displayData[component?.data.type].name;
25
27
  }
28
+ else if (componentId == 'ctx') {
29
+ return 'Context';
30
+ }
26
31
  else {
27
32
  return 'Table action';
28
33
  }
29
34
  }
35
+ $: panels = [['ctx', ['email', 'username']]].concat(Object.entries($staticOutputs));
30
36
  </script>
31
37
 
32
38
  <PanelSection noPadding titlePadding="px-4 pt-2" title="Outputs">
33
- <div class="overflow-auto border-t w-full relative flex flex-col gap-2 px-4">
34
- {#each Object.entries($staticOutputs) as [componentId, outputs] (componentId)}
39
+ <div
40
+ class="overflow-auto min-w-[150px] border-t w-full relative flex flex-col gap-4 px-2 pt-4 pb-2"
41
+ >
42
+ {#each panels as [componentId, outputs] (componentId)}
35
43
  {#if outputs.length > 0 && $worldStore?.outputsById[componentId]}
36
- <div class="flex flex-row justify-between w-full -mb-2">
37
- <button
38
- on:click|stopPropagation|preventDefault={$connectingInput.opened
39
- ? undefined
40
- : () => ($selectedComponent = componentId)}
41
- class={classNames(
42
- 'px-2 text-2xs py-0.5 font-bold rounded-t-sm w-fit',
43
- $selectedComponent === componentId
44
- ? ' bg-indigo-500 text-white'
45
- : 'bg-gray-200 text-gray-500'
46
- )}
44
+ <div>
45
+ <div
46
+ class="flex {$connectingInput?.opened
47
+ ? 'bg-white z-50'
48
+ : ''} flex-row justify-between w-full"
47
49
  >
48
- {componentId}
49
- </button>
50
- <span
50
+ <button
51
+ on:click|stopPropagation|preventDefault={$connectingInput.opened
52
+ ? undefined
53
+ : () => ($selectedComponent = componentId)}
54
+ class={classNames(
55
+ 'px-2 text-2xs py-0.5 border border-gray-300 font-bold rounded-t-sm w-fit',
56
+ $selectedComponent === componentId
57
+ ? ' bg-indigo-500 text-white'
58
+ : 'bg-gray-200 text-gray-500'
59
+ )}
60
+ >
61
+ {componentId}
62
+ </button>
63
+ <span
64
+ class={classNames(
65
+ 'px-1 text-2xs py-0.5 font-bold rounded-t-sm w-fit',
66
+ 'bg-gray-500 text-white'
67
+ )}
68
+ >
69
+ {getComponentNameById(componentId)}
70
+ </span>
71
+ </div>
72
+
73
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
74
+ <div
51
75
  class={classNames(
52
- 'px-1 text-2xs py-0.5 font-bold rounded-t-sm w-fit',
53
- 'bg-gray-500 text-white'
76
+ $connectingInput?.opened ? 'bg-white z-50' : '',
77
+ `w-full py-2 grow border relative break-all `,
78
+ $selectedComponent === componentId ? 'border border-blue-500 ' : '',
79
+ $connectingInput.hoveredComponent === componentId ? 'outline outline-blue-500' : ''
54
80
  )}
55
81
  >
56
- {getComponentNameById(componentId)}
57
- </span>
58
- </div>
59
-
60
- <!-- svelte-ignore a11y-click-events-have-key-events -->
61
- <div
62
- class={classNames(
63
- 'w-full py-2 border relative',
64
- $selectedComponent === componentId ? 'border border-blue-500 ' : ''
65
- )}
66
- >
67
- {#if $selectedComponent === componentId && $connectingInput?.opened}
68
- <div class="absolute top-0 left-0 w-full h-full bg-gray-500 bg-opacity-50 z-10" />
69
- {/if}
70
- <ComponentOutputViewer
71
- {outputs}
72
- {componentId}
73
- on:select={({ detail }) => {
74
- connectInput(componentId, detail)
75
- }}
76
- />
82
+ {#key $selectedComponent}
83
+ {#key $connectingInput?.opened}
84
+ <ComponentOutputViewer
85
+ outputs={$connectingInput?.opened && $selectedComponent === componentId
86
+ ? ['search']
87
+ : outputs}
88
+ {componentId}
89
+ on:select={({ detail }) => {
90
+ connectInput(componentId, detail)
91
+ }}
92
+ />
93
+ {/key}
94
+ {/key}
95
+ </div>
77
96
  </div>
78
97
  {/if}
79
98
  {/each}
@@ -5,8 +5,10 @@ import { initialCode } from '../../../../script_helpers';
5
5
  import { emptySchema } from '../../../../utils';
6
6
  import { createEventDispatcher, getContext } from 'svelte';
7
7
  import { fly } from 'svelte/transition';
8
+ import { defaultCode } from '../../editorUtils';
8
9
  export let name;
9
- const { appPath } = getContext('AppEditorContext');
10
+ export let id;
11
+ const { appPath, app } = getContext('AppEditorContext');
10
12
  const dispatch = createEventDispatcher();
11
13
  async function inferInlineScriptSchema(language, content, schema) {
12
14
  try {
@@ -18,8 +20,10 @@ async function inferInlineScriptSchema(language, content, schema) {
18
20
  return schema;
19
21
  }
20
22
  async function createInlineScriptByLanguage(language, path, subkind = undefined) {
23
+ const componentType = $app.grid.find((c) => c.data.id === id)?.data?.type;
21
24
  const fullPath = `${appPath}/inline-script/${path}`;
22
- const content = initialCode(language, Script.kind.SCRIPT, subkind ?? 'flow');
25
+ const content = defaultCode(componentType, language) ??
26
+ initialCode(language, Script.kind.SCRIPT, subkind ?? 'flow');
23
27
  let schema = emptySchema();
24
28
  schema = await inferInlineScriptSchema(language, content, schema);
25
29
  const newInlineScript = {
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  name: string;
5
+ id: string;
5
6
  };
6
7
  events: {
7
8
  new: CustomEvent<any>;