windmill-components 1.305.7 → 1.306.8

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 (31) hide show
  1. package/package/assets/app.css +21 -0
  2. package/package/components/apps/components/display/AppMap.svelte +62 -70
  3. package/package/components/apps/components/display/AppMap.svelte.d.ts +1 -0
  4. package/package/components/apps/components/display/table/AppAggridTable.svelte +110 -9
  5. package/package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +2 -0
  6. package/package/components/apps/components/display/table/AppAggridTableActions.svelte +232 -0
  7. package/package/components/apps/components/display/table/AppAggridTableActions.svelte.d.ts +30 -0
  8. package/package/components/apps/components/display/table/AppAggridTableEe.svelte +10 -1
  9. package/package/components/apps/components/display/table/AppAggridTableEe.svelte.d.ts +2 -0
  10. package/package/components/apps/components/display/table/AppTable.svelte +0 -1
  11. package/package/components/apps/components/inputs/AppCheckbox.svelte +1 -0
  12. package/package/components/apps/editor/AppEditorHeader.svelte +4 -0
  13. package/package/components/apps/editor/AppInputs.svelte +11 -0
  14. package/package/components/apps/editor/SettingsPanel.svelte +17 -0
  15. package/package/components/apps/editor/appUtils.js +30 -0
  16. package/package/components/apps/editor/component/Component.svelte +2 -0
  17. package/package/components/apps/editor/component/ComponentCallbacks.svelte +4 -0
  18. package/package/components/apps/editor/component/components.d.ts +25 -2
  19. package/package/components/apps/editor/component/components.js +12 -0
  20. package/package/components/apps/editor/contextPanel/components/OutputHeader.svelte +13 -0
  21. package/package/components/apps/editor/contextPanel/components/TableActionsOutput.svelte +7 -0
  22. package/package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +14 -0
  23. package/package/components/apps/editor/inlineScriptsPanel/utils.js +8 -0
  24. package/package/components/apps/editor/settingsPanel/ComponentPanel.svelte +3 -0
  25. package/package/components/apps/editor/settingsPanel/TableActions.svelte +86 -72
  26. package/package/components/apps/editor/settingsPanel/TableActions.svelte.d.ts +1 -1
  27. package/package/components/apps/utils.js +9 -0
  28. package/package/components/common/fileInput/FileInput.svelte +16 -0
  29. package/package/components/common/fileUpload/FileUpload.svelte +19 -19
  30. package/package/user.js +1 -1
  31. package/package.json +8 -1
@@ -117,3 +117,24 @@
117
117
  }
118
118
  }
119
119
  }
120
+
121
+ .grid-cell-centered {
122
+ display: flex;
123
+ align-items: center;
124
+ justify-content: center;
125
+ }
126
+ .grid-cell-centered .svelte-select {
127
+ height: 32px !important;
128
+ }
129
+
130
+ .grid-cell-centered .selected-item {
131
+ margin-top: -4px;
132
+ }
133
+
134
+ .ol-overlaycontainer-stopevent {
135
+ @apply flex flex-col justify-start items-end;
136
+ }
137
+ .ol-control button {
138
+ @apply w-7 h-7 center-center bg-surface border text-secondary
139
+ rounded mt-1 mr-1 shadow duration-200 hover:bg-surface-hover focus:bg-surface-hover;
140
+ }
@@ -1,6 +1,5 @@
1
1
  <script>import { getContext } from 'svelte';
2
2
  import { initCss } from '../../utils';
3
- import { InputValue } from '../helpers';
4
3
  import { twMerge } from 'tailwind-merge';
5
4
  import { Map, View, Feature } from 'ol';
6
5
  import { useGeographic } from 'ol/proj';
@@ -8,9 +7,12 @@ import { OSM, Vector as VectorSource } from 'ol/source';
8
7
  import { Vector as VectorLayer, Tile as TileLayer } from 'ol/layer';
9
8
  import { Point } from 'ol/geom';
10
9
  import { defaults as defaultControls } from 'ol/control';
11
- import { findGridItem, initOutput } from '../../editor/appUtils';
10
+ import { findGridItem, initConfig, initOutput } from '../../editor/appUtils';
12
11
  import InitializeComponent from '../helpers/InitializeComponent.svelte';
13
12
  import ResolveStyle from '../helpers/ResolveStyle.svelte';
13
+ import { components } from '../../editor/component';
14
+ import ResolveConfig from '../helpers/ResolveConfig.svelte';
15
+ import { Style, Circle, Fill, Stroke, Text } from 'ol/style';
14
16
  const LAYER_NAME = {
15
17
  MARKER: 'Marker'
16
18
  };
@@ -18,7 +20,9 @@ export let id;
18
20
  export let configuration;
19
21
  export let customCss = undefined;
20
22
  export let render;
23
+ export let extraKey = undefined;
21
24
  const { app, worldStore, selectedComponent, connectingInput, focusedGrid, mode } = getContext('AppViewerContext');
25
+ const resolvedConfig = initConfig(components['mapcomponent'].initialData.configuration, configuration);
22
26
  let outputs = initOutput($worldStore, id, {
23
27
  mapRegion: {
24
28
  topLeft: { lat: 0, lon: 0 },
@@ -27,18 +31,13 @@ let outputs = initOutput($worldStore, id, {
27
31
  });
28
32
  let map = undefined;
29
33
  let mapElement = undefined;
30
- let longitude = undefined;
31
- let latitude = undefined;
32
- let zoom = undefined;
33
- // If string, it's a JSON file read as text
34
- let markers = undefined;
35
- $: if (map && longitude && latitude) {
36
- map.getView().setCenter([longitude, latitude]);
34
+ $: if (map && resolvedConfig.longitude && resolvedConfig.latitude) {
35
+ map.getView().setCenter([resolvedConfig.longitude, resolvedConfig.latitude]);
37
36
  }
38
- $: if (map && zoom) {
39
- map.getView().setZoom(zoom);
37
+ $: if (map && resolvedConfig.zoom) {
38
+ map.getView().setZoom(resolvedConfig.zoom);
40
39
  }
41
- $: if (map && markers) {
40
+ $: if (map && resolvedConfig.markers) {
42
41
  updateMarkers();
43
42
  }
44
43
  function selectComponent() {
@@ -56,12 +55,12 @@ function getLayersByName(name) {
56
55
  function getMarkerArray() {
57
56
  let array = undefined;
58
57
  try {
59
- if (typeof markers === 'string') {
60
- const json = JSON.parse(markers);
58
+ if (typeof resolvedConfig.markers === 'string') {
59
+ const json = JSON.parse(resolvedConfig.markers);
61
60
  array = Array.isArray(json) ? json : [json];
62
61
  }
63
62
  else {
64
- array = markers;
63
+ array = resolvedConfig.markers;
65
64
  }
66
65
  return array?.filter((m) => !isNaN(+m.lat) && !isNaN(+m.lon));
67
66
  }
@@ -73,24 +72,34 @@ function getMarkerArray() {
73
72
  function createMarkerLayers() {
74
73
  const markerArray = getMarkerArray();
75
74
  return markerArray?.map((m) => {
75
+ const feature = new Feature({
76
+ geometry: new Point([+m.lon, +m.lat]),
77
+ name: m.title
78
+ });
79
+ feature.setStyle(new Style({
80
+ image: new Circle({
81
+ radius: m.radius ?? 7,
82
+ fill: new Fill({ color: m.color ?? '#dc2626' }),
83
+ stroke: new Stroke({ width: m.strokeWidth ?? 3, color: m.strokeColor ?? '#fca5a5' })
84
+ }),
85
+ text: new Text({
86
+ text: m.title,
87
+ font: '12px Calibri,sans-serif',
88
+ fill: new Fill({ color: '#000' }),
89
+ stroke: new Stroke({
90
+ color: '#fff',
91
+ width: 2
92
+ }),
93
+ offsetY: -15
94
+ })
95
+ }));
76
96
  return new VectorLayer({
77
97
  properties: {
78
98
  name: LAYER_NAME.MARKER
79
99
  },
80
100
  source: new VectorSource({
81
- features: [
82
- new Feature({
83
- geometry: new Point([+m.lon, +m.lat]),
84
- name: m.title
85
- })
86
- ]
87
- }),
88
- style: {
89
- 'circle-radius': m.radius ?? 7,
90
- 'circle-fill-color': m.color ?? '#dc2626',
91
- 'circle-stroke-width': m.strokeWidth ?? 3,
92
- 'circle-stroke-color': m.strokeColor ?? '#fca5a5'
93
- }
101
+ features: [feature]
102
+ })
94
103
  });
95
104
  });
96
105
  }
@@ -116,8 +125,8 @@ $: if (!map && mapElement) {
116
125
  ...(createMarkerLayers() || [])
117
126
  ],
118
127
  view: new View({
119
- center: [longitude ?? 0, latitude ?? 0],
120
- zoom: zoom ?? 2
128
+ center: [resolvedConfig.longitude ?? 0, resolvedConfig.latitude ?? 0],
129
+ zoom: resolvedConfig.zoom ?? 2
121
130
  }),
122
131
  controls: defaultControls({
123
132
  attribution: false
@@ -125,9 +134,21 @@ $: if (!map && mapElement) {
125
134
  });
126
135
  updateRegionOutput();
127
136
  }
137
+ let previousLock = undefined;
138
+ function updateInteractions(map) {
139
+ if (previousLock === resolvedConfig.lock) {
140
+ return;
141
+ }
142
+ previousLock = resolvedConfig.lock;
143
+ map.getInteractions().forEach((i) => {
144
+ i.setActive(!resolvedConfig.lock);
145
+ });
146
+ map.changed();
147
+ }
148
+ $: map && resolvedConfig && updateInteractions(map);
128
149
  let css = initCss($app.css?.mapcomponent, customCss);
129
150
  function updateRegionOutput() {
130
- if (map) {
151
+ if (map && !resolvedConfig.lock) {
131
152
  let extent = map.getView().calculateExtent(map.getSize());
132
153
  const [left, bottom, right, top] = extent;
133
154
  if (outputs?.mapRegion) {
@@ -162,10 +183,16 @@ function handleSyncRegion() {
162
183
  }
163
184
  </script>
164
185
 
165
- <InputValue key="longitude" {id} input={configuration.longitude} bind:value={longitude} />
166
- <InputValue key="latitude" {id} input={configuration.latitude} bind:value={latitude} />
167
- <InputValue key="zoom" {id} input={configuration.zoom} bind:value={zoom} />
168
- <InputValue key="markers" {id} input={configuration.markers} bind:value={markers} />
186
+ {#each Object.entries(components['mapcomponent'].initialData.configuration) as [key, initialConfig] (key)}
187
+ <ResolveConfig
188
+ {id}
189
+ {extraKey}
190
+ {key}
191
+ bind:resolvedConfig={resolvedConfig[key]}
192
+ configuration={configuration[key]}
193
+ {initialConfig}
194
+ />
195
+ {/each}
169
196
 
170
197
  <InitializeComponent {id} />
171
198
 
@@ -201,38 +228,3 @@ function handleSyncRegion() {
201
228
  {/if}
202
229
  </div>
203
230
  {/if}
204
-
205
- <style global>
206
- :global(.ol-overlaycontainer-stopevent) {
207
- display: flex;
208
- flex-direction: column;
209
- align-items: flex-end;
210
- justify-content: flex-start
211
- }
212
- :global(.ol-control) :global(button) {
213
- margin-top: 0.25rem;
214
- margin-right: 0.25rem;
215
- height: 1.75rem;
216
- width: 1.75rem;
217
- border-radius: 0.25rem;
218
- border-width: 1px;
219
- --tw-bg-opacity: 1;
220
- background-color: rgb(var(--color-surface) / var(--tw-bg-opacity));
221
- --tw-text-opacity: 1;
222
- color: rgb(var(--color-text-secondary) / var(--tw-text-opacity));
223
- --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
224
- --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
225
- box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
226
- transition-duration: 200ms;
227
- display: flex;
228
- justify-content: center;
229
- align-items: center
230
- }
231
- :global(.ol-control) :global(button:hover) {
232
- --tw-bg-opacity: 1;
233
- background-color: rgb(var(--color-surface-hover) / var(--tw-bg-opacity))
234
- }
235
- :global(.ol-control) :global(button:focus) {
236
- --tw-bg-opacity: 1;
237
- background-color: rgb(var(--color-surface-hover) / var(--tw-bg-opacity))
238
- }</style>
@@ -6,6 +6,7 @@ declare const __propDef: {
6
6
  configuration: RichConfigurations;
7
7
  customCss?: ComponentCustomCSS<'mapcomponent'> | undefined;
8
8
  render: boolean;
9
+ extraKey?: string | undefined;
9
10
  };
10
11
  events: {
11
12
  [evt: string]: CustomEvent<any>;
@@ -1,6 +1,6 @@
1
1
  <script>import { GridApi, createGrid } from 'ag-grid-community';
2
2
  import { isObject, sendUserToast } from '../../../../../utils';
3
- import { getContext } from 'svelte';
3
+ import { SvelteComponent, getContext, onDestroy } from 'svelte';
4
4
  import RunnableWrapper from '../../helpers/RunnableWrapper.svelte';
5
5
  import { initConfig, initOutput } from '../../../editor/appUtils';
6
6
  import { components } from '../../../editor/component';
@@ -13,6 +13,7 @@ import { Loader2 } from 'lucide-svelte';
13
13
  import { twMerge } from 'tailwind-merge';
14
14
  import { initCss } from '../../../utils';
15
15
  import ResolveStyle from '../../helpers/ResolveStyle.svelte';
16
+ import AppAggridTableActions from './AppAggridTableActions.svelte';
16
17
  // import 'ag-grid-community/dist/styles/ag-theme-alpine-dark.css'
17
18
  export let id;
18
19
  export let componentInput;
@@ -20,7 +21,11 @@ export let configuration;
20
21
  export let initializing = undefined;
21
22
  export let render;
22
23
  export let customCss = undefined;
23
- const { app, worldStore, selectedComponent, componentControl, darkMode } = getContext('AppViewerContext');
24
+ export let actions = undefined;
25
+ const context = getContext('AppViewerContext');
26
+ const iterContext = getContext('ListWrapperContext');
27
+ const listInputs = getContext('ListInputs');
28
+ const { app, worldStore, selectedComponent, componentControl, darkMode } = context;
24
29
  const rowHeights = {
25
30
  normal: 40,
26
31
  compact: 30,
@@ -59,6 +64,7 @@ let outputs = initOutput($worldStore, id, {
59
64
  page: 0,
60
65
  newChange: { row: 0, column: '', value: undefined },
61
66
  ready: undefined,
67
+ inputs: {},
62
68
  filters: {},
63
69
  displayedRowCount: 0
64
70
  });
@@ -75,8 +81,14 @@ function toggleRow(row) {
75
81
  if (!deepEqual(outputs?.selectedRow?.peak(), data)) {
76
82
  outputs?.selectedRow.set(data);
77
83
  }
84
+ if (iterContext && listInputs) {
85
+ listInputs.set(id, { selectedRow: data, selectedRowIndex: selectedRowIndex });
86
+ }
78
87
  }
79
88
  }
89
+ onDestroy(() => {
90
+ listInputs?.remove(id);
91
+ });
80
92
  function toggleRows(rows) {
81
93
  if (rows.length === 0) {
82
94
  outputs?.selectedRows.set([]);
@@ -111,16 +123,93 @@ function onCellValueChanged(event) {
111
123
  let extraConfig = resolvedConfig.extraConfig;
112
124
  let api = undefined;
113
125
  let eGui;
114
- $: loaded && eGui && mountGrid();
115
126
  let state = undefined;
127
+ $: loaded && eGui && mountGrid();
128
+ const cachedDivs = new Map();
129
+ function refreshActions(actions) {
130
+ if (!deepEqual(actions, lastActions)) {
131
+ lastActions = [...actions];
132
+ cachedDivs.forEach((cachedDiv) => {
133
+ cachedDiv.svelteComponent.$destroy();
134
+ cachedDiv.div.remove();
135
+ });
136
+ cachedDivs.clear();
137
+ updateOptions();
138
+ }
139
+ }
140
+ let lastActions = undefined;
141
+ $: actions && refreshActions(actions);
142
+ let inputs = {};
143
+ function actionRenderer(params) {
144
+ const { rowIndex, data: row } = params;
145
+ if (rowIndex === -1 || actions == undefined || actions?.length == 0) {
146
+ return null;
147
+ }
148
+ if (cachedDivs.has(rowIndex)) {
149
+ return cachedDivs.get(rowIndex)?.div;
150
+ }
151
+ const div = document.createElement('div');
152
+ div.classList.add('flex', 'flex-row', 'items-center', 'w-full', 'h-full');
153
+ const svelteComponent = new AppAggridTableActions({
154
+ target: div,
155
+ props: {
156
+ id: id,
157
+ actions,
158
+ rowIndex,
159
+ row,
160
+ render,
161
+ wrapActions: resolvedConfig.wrapActions,
162
+ onSet: (id, value) => {
163
+ if (!inputs[id]) {
164
+ inputs[id] = { [rowIndex]: value };
165
+ }
166
+ else {
167
+ inputs[id] = { ...inputs[id], [rowIndex]: value };
168
+ }
169
+ outputs?.inputs.set(inputs, true);
170
+ },
171
+ onRemove: (id) => {
172
+ if (inputs?.[id] == undefined) {
173
+ return;
174
+ }
175
+ delete inputs[id][rowIndex];
176
+ inputs[id] = { ...inputs[id] };
177
+ if (Object.keys(inputs?.[id] ?? {}).length == 0) {
178
+ delete inputs[id];
179
+ inputs = { ...inputs };
180
+ }
181
+ outputs?.inputs.set(inputs, true);
182
+ }
183
+ },
184
+ context: new Map([['AppViewerContext', context]])
185
+ });
186
+ cachedDivs.set(rowIndex, {
187
+ div,
188
+ actions,
189
+ svelteComponent
190
+ });
191
+ return div;
192
+ }
116
193
  function mountGrid() {
117
194
  if (eGui) {
118
195
  try {
196
+ let columnDefs = Array.isArray(resolvedConfig?.columnDefs) && resolvedConfig.columnDefs.every(isObject)
197
+ ? [...resolvedConfig?.columnDefs] // Clone to avoid direct mutation
198
+ : [];
199
+ // Add the action column if actions are defined
200
+ if (actions && actions.length > 0) {
201
+ columnDefs.push({
202
+ headerName: 'Actions',
203
+ cellRenderer: actionRenderer,
204
+ autoHeight: true,
205
+ cellStyle: { textAlign: 'center' },
206
+ cellClass: 'grid-cell-centered',
207
+ ...(!resolvedConfig?.wrapActions ? { minWidth: 130 * actions?.length } : {})
208
+ });
209
+ }
119
210
  createGrid(eGui, {
120
211
  rowData: value,
121
- columnDefs: Array.isArray(resolvedConfig?.columnDefs) && resolvedConfig.columnDefs.every(isObject)
122
- ? resolvedConfig?.columnDefs
123
- : [],
212
+ columnDefs: columnDefs,
124
213
  pagination: resolvedConfig?.pagination,
125
214
  paginationAutoPageSize: resolvedConfig?.pagination,
126
215
  defaultColDef: {
@@ -215,11 +304,23 @@ function updateValue() {
215
304
  }
216
305
  function updateOptions() {
217
306
  try {
307
+ const columnDefs = Array.isArray(resolvedConfig?.columnDefs) && resolvedConfig.columnDefs.every(isObject)
308
+ ? [...resolvedConfig?.columnDefs] // Clone to avoid direct mutation
309
+ : [];
310
+ // Add the action column if actions are defined
311
+ if (actions && actions.length > 0) {
312
+ columnDefs.push({
313
+ headerName: 'Actions',
314
+ cellRenderer: actionRenderer,
315
+ autoHeight: true,
316
+ cellStyle: { textAlign: 'center' },
317
+ cellClass: 'grid-cell-centered',
318
+ ...(!resolvedConfig?.wrapActions ? { minWidth: 130 * actions?.length } : {})
319
+ });
320
+ }
218
321
  api?.updateGridOptions({
219
322
  rowData: value,
220
- columnDefs: Array.isArray(resolvedConfig?.columnDefs) && resolvedConfig.columnDefs.every(isObject)
221
- ? resolvedConfig?.columnDefs
222
- : undefined,
323
+ columnDefs: columnDefs,
223
324
  pagination: resolvedConfig?.pagination,
224
325
  paginationAutoPageSize: resolvedConfig?.pagination,
225
326
  defaultColDef: {
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import type { AppInput } from '../../../inputType';
3
3
  import type { ComponentCustomCSS, RichConfigurations } from '../../../types';
4
+ import { type TableAction } from '../../../editor/component';
4
5
  import 'ag-grid-community/styles/ag-grid.css';
5
6
  import 'ag-grid-community/styles/ag-theme-alpine.css';
6
7
  declare const __propDef: {
@@ -11,6 +12,7 @@ declare const __propDef: {
11
12
  initializing?: boolean | undefined;
12
13
  render: boolean;
13
14
  customCss?: ComponentCustomCSS<'aggridcomponent'> | undefined;
15
+ actions?: TableAction[] | undefined;
14
16
  };
15
17
  events: {
16
18
  [evt: string]: CustomEvent<any>;
@@ -0,0 +1,232 @@
1
+ <script>import { createEventDispatcher, getContext } from 'svelte';
2
+ import 'ag-grid-community/styles/ag-grid.css';
3
+ import 'ag-grid-community/styles/ag-theme-alpine.css';
4
+ import AppButton from '../../buttons/AppButton.svelte';
5
+ import { AppCheckbox, AppSelect } from '../..';
6
+ import { twMerge } from 'tailwind-merge';
7
+ import { Popup } from '../../../../common';
8
+ import { Plug2 } from 'lucide-svelte';
9
+ import ComponentOutputViewer from '../../../editor/contextPanel/ComponentOutputViewer.svelte';
10
+ import { connectOutput } from '../../../editor/appUtils';
11
+ import RowWrapper from '../../layout/RowWrapper.svelte';
12
+ export let id;
13
+ export let render;
14
+ export let actions = [];
15
+ export let rowIndex;
16
+ export let row;
17
+ export let onSet;
18
+ export let onRemove;
19
+ export let wrapActions = undefined;
20
+ const dispatch = createEventDispatcher();
21
+ const { selectedComponent, hoverStore, mode, connectingInput } = getContext('AppViewerContext');
22
+ </script>
23
+
24
+ <RowWrapper value={row} index={rowIndex} {onSet} {onRemove}>
25
+ <div
26
+ class={twMerge(
27
+ 'flex flex-row justify-center items-center gap-4 h-full px-4 py-1',
28
+ !wrapActions ? 'flex-wrap' : ''
29
+ )}
30
+ >
31
+ {#each actions as action, actionIndex}
32
+ <!-- svelte-ignore a11y-mouse-events-have-key-events -->
33
+ <!-- svelte-ignore missing-declaration -->
34
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
35
+ <div
36
+ on:mouseover|stopPropagation={() => {
37
+ if (action.id !== $hoverStore) {
38
+ $hoverStore = action.id
39
+ }
40
+ }}
41
+ on:mouseout|stopPropagation={() => {
42
+ if ($hoverStore !== undefined) {
43
+ $hoverStore = undefined
44
+ }
45
+ }}
46
+ on:pointerdown|stopPropagation={() => {
47
+ $selectedComponent = [action.id]
48
+ }}
49
+ class={twMerge(
50
+ ($selectedComponent?.includes(action.id) || $hoverStore === action.id) &&
51
+ $mode !== 'preview'
52
+ ? 'outline outline-indigo-500 outline-1 outline-offset-1 relative z-50'
53
+ : 'relative'
54
+ )}
55
+ >
56
+ {#if $mode !== 'preview'}
57
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
58
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
59
+ <div
60
+ title={`Id: ${action.id}`}
61
+ class={twMerge(
62
+ 'px-2 text-2xs font-bold absolute shadow -top-2 -left-4 border z-50 rounded-sm w-8 !h-5 flex justify-center items-center',
63
+ 'bg-indigo-500/90 border-indigo-600 text-white',
64
+ $selectedComponent?.includes(action.id) || $hoverStore === action.id
65
+ ? 'opacity-100'
66
+ : 'opacity-0'
67
+ )}
68
+ on:click|stopPropagation={() => {
69
+ $selectedComponent = [action.id]
70
+ }}
71
+ >
72
+ {action.id}
73
+ </div>
74
+
75
+ {#if $connectingInput.opened}
76
+ <div class="absolute z-50 left-8 -top-[10px]">
77
+ <Popup
78
+ floatingConfig={{
79
+ strategy: 'absolute',
80
+ placement: 'bottom-start'
81
+ }}
82
+ >
83
+ <svelte:fragment slot="button">
84
+ <button
85
+ class="bg-red-500/70 border border-red-600 px-1 py-0.5"
86
+ title="Outputs"
87
+ aria-label="Open output"><Plug2 size={12} /></button
88
+ >
89
+ </svelte:fragment>
90
+ <ComponentOutputViewer
91
+ suffix="table"
92
+ on:select={({ detail }) =>
93
+ connectOutput(connectingInput, 'buttoncomponent', action.id, detail)}
94
+ componentId={action.id}
95
+ />
96
+ </Popup>
97
+ </div>
98
+ {/if}
99
+ {/if}
100
+ {#if rowIndex === 0}
101
+ {@const controls = {
102
+ left: () => {
103
+ if (actionIndex === 0) {
104
+ $selectedComponent = [id]
105
+ return true
106
+ } else if (actionIndex > 0) {
107
+ $selectedComponent = [actions[actionIndex - 1].id]
108
+ return true
109
+ }
110
+ return false
111
+ },
112
+ right: () => {
113
+ if (actionIndex === actions.length - 1) {
114
+ return id
115
+ } else if (actionIndex < actions.length - 1) {
116
+ $selectedComponent = [actions[actionIndex + 1].id]
117
+ return true
118
+ }
119
+ return false
120
+ }
121
+ }}
122
+ {#if action.type == 'buttoncomponent'}
123
+ <AppButton
124
+ noInitialize
125
+ extraKey={'idx' + rowIndex}
126
+ {render}
127
+ noWFull
128
+ preclickAction={async () => {
129
+ dispatch('toggleRow')
130
+ }}
131
+ id={action.id}
132
+ customCss={action.customCss}
133
+ configuration={action.configuration}
134
+ recomputeIds={action.recomputeIds}
135
+ extraQueryParams={{
136
+ row
137
+ }}
138
+ componentInput={action.componentInput}
139
+ verticalAlignment="center"
140
+ {controls}
141
+ />
142
+ {:else if action.type == 'checkboxcomponent'}
143
+ <AppCheckbox
144
+ noInitialize
145
+ extraKey={'idx' + rowIndex}
146
+ {render}
147
+ id={action.id}
148
+ customCss={action.customCss}
149
+ configuration={action.configuration}
150
+ recomputeIds={action.recomputeIds}
151
+ onToggle={action.onToggle}
152
+ preclickAction={async () => {
153
+ dispatch('toggleRow')
154
+ }}
155
+ verticalAlignment="center"
156
+ {controls}
157
+ />
158
+ {:else if action.type == 'selectcomponent'}
159
+ <div class="w-40">
160
+ <AppSelect
161
+ noDefault
162
+ noInitialize
163
+ extraKey={'idx' + rowIndex}
164
+ {render}
165
+ --font-size="10px"
166
+ id={action.id}
167
+ customCss={action.customCss}
168
+ configuration={action.configuration}
169
+ recomputeIds={action.recomputeIds}
170
+ onSelect={action.onSelect}
171
+ preclickAction={async () => {
172
+ dispatch('toggleRow')
173
+ }}
174
+ {controls}
175
+ />
176
+ </div>
177
+ {/if}
178
+ {:else if action.type == 'buttoncomponent'}
179
+ <AppButton
180
+ noInitialize
181
+ extraKey={'idx' + rowIndex}
182
+ {render}
183
+ preclickAction={async () => {
184
+ dispatch('toggleRow')
185
+ }}
186
+ noWFull
187
+ id={action.id}
188
+ customCss={action.customCss}
189
+ configuration={action.configuration}
190
+ recomputeIds={action.recomputeIds}
191
+ extraQueryParams={{
192
+ row
193
+ }}
194
+ componentInput={action.componentInput}
195
+ />
196
+ {:else if action.type == 'checkboxcomponent'}
197
+ <AppCheckbox
198
+ noInitialize
199
+ extraKey={'idx' + rowIndex}
200
+ {render}
201
+ id={action.id}
202
+ customCss={action.customCss}
203
+ configuration={action.configuration}
204
+ recomputeIds={action.recomputeIds}
205
+ onToggle={action.onToggle}
206
+ preclickAction={async () => {
207
+ dispatch('toggleRow')
208
+ }}
209
+ />
210
+ {:else if action.type == 'selectcomponent'}
211
+ <div class="w-40">
212
+ <AppSelect
213
+ noDefault
214
+ noInitialize
215
+ extraKey={'idx' + rowIndex}
216
+ {render}
217
+ --font-size="10px"
218
+ id={action.id}
219
+ customCss={action.customCss}
220
+ configuration={action.configuration}
221
+ recomputeIds={action.recomputeIds}
222
+ onSelect={action.onSelect}
223
+ preclickAction={async () => {
224
+ dispatch('toggleRow')
225
+ }}
226
+ />
227
+ </div>
228
+ {/if}
229
+ </div>
230
+ {/each}
231
+ </div>
232
+ </RowWrapper>
@@ -0,0 +1,30 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { TableAction } from '../../../editor/component';
3
+ import 'ag-grid-community/styles/ag-grid.css';
4
+ import 'ag-grid-community/styles/ag-theme-alpine.css';
5
+ declare const __propDef: {
6
+ props: {
7
+ id: string;
8
+ render: boolean;
9
+ actions?: TableAction[] | undefined;
10
+ rowIndex: number;
11
+ row: {
12
+ original: Record<string, any>;
13
+ };
14
+ onSet: (id: string, value: any) => void;
15
+ onRemove: (id: string) => void;
16
+ wrapActions?: boolean | undefined;
17
+ };
18
+ events: {
19
+ toggleRow: CustomEvent<any>;
20
+ } & {
21
+ [evt: string]: CustomEvent<any>;
22
+ };
23
+ slots: {};
24
+ };
25
+ export type AppAggridTableActionsProps = typeof __propDef.props;
26
+ export type AppAggridTableActionsEvents = typeof __propDef.events;
27
+ export type AppAggridTableActionsSlots = typeof __propDef.slots;
28
+ export default class AppAggridTableActions extends SvelteComponent<AppAggridTableActionsProps, AppAggridTableActionsEvents, AppAggridTableActionsSlots> {
29
+ }
30
+ export {};