windmill-components 1.82.4 → 1.82.5
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.
- package/common.d.ts +2 -2
- package/components/ArgInput.svelte +72 -52
- package/components/ArgInput.svelte.d.ts +3 -1
- package/components/DisplayResult.svelte +17 -17
- package/components/Editor.svelte +3 -0
- package/components/Editor.svelte.d.ts +1 -0
- package/components/FieldHeader.svelte +1 -0
- package/components/FieldHeader.svelte.d.ts +4 -0
- package/components/FlowBuilder.svelte +0 -6
- package/components/FlowStatusViewer.svelte +4 -7
- package/components/FlowStatusViewer.svelte.d.ts +0 -1
- package/components/FlowViewer.svelte +1 -0
- package/components/InputTransformForm.svelte +1 -0
- package/components/LightweightArgInput.svelte +14 -1
- package/components/LightweightArgInput.svelte.d.ts +3 -1
- package/components/Multiselect.svelte.d.ts +2 -2
- package/components/SimpleEditor.svelte +1 -0
- package/components/SimpleEditor.svelte.d.ts +1 -0
- package/components/TemplateEditor.svelte +1 -0
- package/components/Toggle.svelte +1 -1
- package/components/Toggle.svelte.d.ts +1 -0
- package/components/apps/components/buttons/AppButton.svelte +17 -3
- package/components/apps/components/buttons/AppForm.svelte +10 -2
- package/components/apps/components/buttons/AppFormButton.svelte +82 -58
- package/components/apps/components/display/AppDisplayComponent.svelte +17 -23
- package/components/apps/components/display/AppHtml.svelte +1 -7
- package/components/apps/components/display/AppHtml.svelte.d.ts +0 -2
- package/components/apps/components/display/AppMap.svelte +1 -1
- package/components/apps/components/display/AppPdf.svelte +1 -1
- package/components/apps/components/display/PlotlyHtml.svelte +3 -20
- package/components/apps/components/display/PlotlyHtml.svelte.d.ts +0 -2
- package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
- package/components/apps/components/display/table/AppTable.svelte +49 -75
- package/components/apps/components/display/table/AppTable.svelte.d.ts +1 -1
- package/components/apps/components/display/table/AppTableFooter.svelte +1 -2
- package/components/apps/components/display/table/AppTableFooter.svelte.d.ts +0 -1
- package/components/apps/components/display/table/tableOptions.js +1 -1
- package/components/apps/components/helpers/DebouncedInput.svelte +0 -1
- package/components/apps/components/helpers/DebouncedInput.svelte.d.ts +0 -2
- package/components/apps/components/helpers/HiddenComponent.svelte +2 -3
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +1 -2
- package/components/apps/components/helpers/InputValue.svelte +3 -3
- package/components/apps/components/helpers/RefreshButton.svelte +10 -3
- package/components/apps/components/helpers/RefreshButton.svelte.d.ts +0 -1
- package/components/apps/components/helpers/RunnableComponent.svelte +15 -19
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +1 -2
- package/components/apps/components/helpers/RunnableWrapper.svelte +1 -3
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +0 -1
- package/components/apps/components/helpers/eval.d.ts +2 -4
- package/components/apps/components/helpers/eval.js +4 -6
- package/components/apps/components/inputs/AppCheckbox.svelte +4 -0
- package/components/apps/components/inputs/AppDateInput.svelte +2 -2
- package/components/apps/components/inputs/AppMultiSelect.svelte +5 -13
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +2 -0
- package/components/apps/components/inputs/AppNumberInput.svelte +3 -3
- package/components/apps/components/inputs/AppSelect.svelte +4 -11
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +2 -0
- package/components/apps/components/inputs/AppSliderInputs.svelte +1 -1
- package/components/apps/components/inputs/AppTextInput.svelte +43 -53
- package/components/apps/components/inputs/AppTextInput.svelte.d.ts +1 -1
- package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +1 -1
- package/components/apps/components/layout/AppContainer.svelte +2 -2
- package/components/apps/components/layout/AppDrawer.svelte +2 -1
- package/components/apps/components/layout/AppSplitpanes.svelte +3 -3
- package/components/apps/components/layout/AppTabs.svelte +1 -1
- package/components/apps/editor/AppEditor.svelte +21 -49
- package/components/apps/editor/AppEditorHeader.svelte +0 -5
- package/components/apps/editor/AppPreview.svelte +7 -18
- package/components/apps/editor/ComponentHeader.svelte +0 -1
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -1
- package/components/apps/editor/GridEditor.svelte +12 -22
- package/components/apps/editor/GridViewer.svelte +2 -2
- package/components/apps/editor/GridViewer.svelte.d.ts +1 -1
- package/components/apps/editor/RecomputeAllComponents.svelte +7 -5
- package/components/apps/editor/SettingsPanel.svelte +4 -4
- package/components/apps/editor/SubGridEditor.svelte +12 -13
- package/components/apps/editor/appUtils.d.ts +0 -1
- package/components/apps/editor/appUtils.js +0 -19
- package/components/apps/editor/component/Component.svelte +8 -19
- package/components/apps/editor/component/Component.svelte.d.ts +1 -1
- package/components/apps/editor/component/ComponentNavigation.svelte +47 -57
- package/components/apps/editor/component/README.md +0 -4
- package/components/apps/editor/component/components.d.ts +28 -45
- package/components/apps/editor/component/components.js +27 -41
- package/components/apps/editor/component/sets.js +1 -2
- package/components/apps/editor/componentsPanel/ComponentList.svelte +1 -1
- package/components/apps/editor/componentsPanel/CssProperty.svelte +48 -62
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +2 -3
- package/components/apps/editor/componentsPanel/CssSettings.svelte +0 -1
- package/components/apps/editor/componentsPanel/store.js +4 -4
- package/components/apps/editor/contextPanel/ComponentOutput.svelte +26 -2
- package/components/apps/editor/contextPanel/ComponentOutput.svelte.d.ts +1 -0
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +6 -8
- package/components/apps/editor/contextPanel/ContextPanel.svelte +14 -7
- package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte +25 -2
- package/components/apps/editor/contextPanel/components/MinMaxButton.svelte +25 -0
- package/components/apps/editor/contextPanel/components/MinMaxButton.svelte.d.ts +16 -0
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +40 -29
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte.d.ts +2 -1
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +7 -2
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +11 -10
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +3 -4
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +0 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +2 -2
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +0 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +19 -22
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +13 -42
- package/components/apps/editor/settingsPanel/GridTab.svelte +2 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +1 -2
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +0 -4
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +0 -1
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +2 -1
- package/components/apps/editor/settingsPanel/TableActions.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte +12 -12
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte.d.ts +2 -3
- package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +1 -5
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +2 -3
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +1 -4
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +3 -3
- package/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +1 -1
- package/components/apps/inputType.d.ts +2 -2
- package/components/apps/rx.d.ts +2 -2
- package/components/apps/svelte-grid/Grid.svelte +34 -50
- package/components/apps/svelte-grid/Grid.svelte.d.ts +9 -14
- package/components/apps/svelte-grid/MoveResize.svelte +55 -76
- package/components/apps/svelte-grid/MoveResize.svelte.d.ts +9 -15
- package/components/apps/svelte-grid/utils/helper.d.ts +1 -0
- package/components/apps/svelte-grid/utils/helper.js +3 -0
- package/components/apps/types.d.ts +5 -9
- package/components/apps/utils.d.ts +0 -2
- package/components/apps/utils.js +1 -33
- package/components/common/button/ButtonPopup.svelte +2 -5
- package/components/common/button/ButtonPopup.svelte.d.ts +1 -5
- package/components/common/button/ButtonPopupItem.svelte +1 -2
- package/components/common/button/ButtonPopupItem.svelte.d.ts +0 -1
- package/components/common/index.d.ts +0 -1
- package/components/common/index.js +0 -1
- package/components/common/kbd/Kbd.svelte +1 -4
- package/components/common/kbd/Kbd.svelte.d.ts +14 -6
- package/components/common/menu/Menu.svelte +2 -8
- package/components/common/menu/Menu.svelte.d.ts +1 -4
- package/components/flows/map/MapItem.svelte +3 -3
- package/components/propertyPicker/ObjectViewer.svelte +3 -0
- package/components/scriptEditor/LogPanel.svelte +3 -3
- package/infer.js +1 -6
- package/package.json +2 -11
- package/utils.d.ts +0 -1
- package/utils.js +0 -3
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +0 -170
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte.d.ts +0 -18
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte +0 -130
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte.d.ts +0 -21
- package/components/apps/editor/componentsPanel/quickStyleProperties.d.ts +0 -535
- package/components/apps/editor/componentsPanel/quickStyleProperties.js +0 -598
- package/components/apps/editor/settingsPanel/StylePanel.svelte +0 -61
- package/components/apps/editor/settingsPanel/StylePanel.svelte.d.ts +0 -17
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte +0 -47
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte.d.ts +0 -14
- package/components/apps/editor/settingsPanel/secondaryMenu/index.d.ts +0 -2
- package/components/apps/editor/settingsPanel/secondaryMenu/index.js +0 -2
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.d.ts +0 -12
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.js +0 -10
- package/components/common/clearableInput/ClearableInput.svelte +0 -56
- package/components/common/clearableInput/ClearableInput.svelte.d.ts +0 -28
- package/components/common/modal/AlwaysMountedModal.svelte +0 -109
- package/components/common/modal/AlwaysMountedModal.svelte.d.ts +0 -22
|
@@ -12,8 +12,7 @@ export let gap = [10, 10];
|
|
|
12
12
|
export let fastStart = false;
|
|
13
13
|
export let throttleUpdate = 100;
|
|
14
14
|
export let throttleResize = 100;
|
|
15
|
-
export let
|
|
16
|
-
export let allIdsInPath;
|
|
15
|
+
export let onTopId = undefined;
|
|
17
16
|
export let containerWidth = undefined;
|
|
18
17
|
export let scroller = undefined;
|
|
19
18
|
export let sensor = 20;
|
|
@@ -24,6 +23,12 @@ $: [gapX, gapY] = gap;
|
|
|
24
23
|
let xPerPx = 0;
|
|
25
24
|
let yPerPx = rowHeight;
|
|
26
25
|
$: containerHeight = getContainerHeight(items, yPerPx, getComputedCols);
|
|
26
|
+
const pointerup = (ev) => {
|
|
27
|
+
dispatch('pointerup', {
|
|
28
|
+
id: ev.detail.id,
|
|
29
|
+
cols: getComputedCols
|
|
30
|
+
});
|
|
31
|
+
};
|
|
27
32
|
const onResize = throttle(() => {
|
|
28
33
|
items = specifyUndefinedColumns(items, getComputedCols, cols);
|
|
29
34
|
dispatch('resize', {
|
|
@@ -79,28 +84,23 @@ const updateMatrix = ({ detail }) => {
|
|
|
79
84
|
}
|
|
80
85
|
citems = JSON.parse(JSON.stringify(initItems));
|
|
81
86
|
}
|
|
82
|
-
let
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
for (let id of nselectedIds ?? []) {
|
|
101
|
-
if (detail.activate) {
|
|
102
|
-
moveResizes?.[id]?.inActivate();
|
|
103
|
-
}
|
|
87
|
+
let activeItem = getItemById(detail.id, citems);
|
|
88
|
+
if (activeItem) {
|
|
89
|
+
activeItem = {
|
|
90
|
+
...activeItem,
|
|
91
|
+
[getComputedCols]: {
|
|
92
|
+
...activeItem[getComputedCols],
|
|
93
|
+
...detail.shadow
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
sortedItems = moveItem(activeItem, citems, getComputedCols, getItemById(detail.id, citems));
|
|
97
|
+
if (detail.onUpdate)
|
|
98
|
+
detail.onUpdate();
|
|
99
|
+
dispatch('change', {
|
|
100
|
+
unsafeItem: activeItem,
|
|
101
|
+
id: activeItem.id,
|
|
102
|
+
cols: getComputedCols
|
|
103
|
+
});
|
|
104
104
|
}
|
|
105
105
|
if (isPointerUp) {
|
|
106
106
|
dispatch('redraw', sortGridItemsPosition(JSON.parse(JSON.stringify(sortedItems)), getComputedCols));
|
|
@@ -115,35 +115,15 @@ const handleRepaint = ({ detail }) => {
|
|
|
115
115
|
updateMatrix({ detail });
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
let moveResizes = {};
|
|
119
|
-
let shadows = {};
|
|
120
|
-
export function handleMove({ detail }) {
|
|
121
|
-
Object.entries(moveResizes).forEach(([id, moveResize]) => {
|
|
122
|
-
if (selectedIds?.includes(id)) {
|
|
123
|
-
moveResize?.updateMove(JSON.parse(JSON.stringify(detail.cordDiff)), detail.eventY);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
throttleMatrix({ detail: { isPointerUp: false, activate: false } });
|
|
127
|
-
}
|
|
128
|
-
export function handleInitMove({ detail }) {
|
|
129
|
-
Object.entries(moveResizes).forEach(([id, moveResize]) => {
|
|
130
|
-
if (selectedIds?.includes(id)) {
|
|
131
|
-
moveResize?.initmove();
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
118
|
</script>
|
|
136
119
|
|
|
137
120
|
<div class="svlt-grid-container" style="height: {containerHeight}px" bind:this={container}>
|
|
138
121
|
{#if xPerPx || !fastStart}
|
|
139
122
|
{#each sortedItems as item (item.id)}
|
|
140
123
|
<MoveResize
|
|
141
|
-
on:initmove={handleInitMove}
|
|
142
|
-
on:move={handleMove}
|
|
143
|
-
bind:shadow={shadows[item.id]}
|
|
144
|
-
bind:this={moveResizes[item.id]}
|
|
145
124
|
on:repaint={handleRepaint}
|
|
146
|
-
|
|
125
|
+
on:pointerup={pointerup}
|
|
126
|
+
onTop={item.id == onTopId}
|
|
147
127
|
id={item.id}
|
|
148
128
|
{xPerPx}
|
|
149
129
|
{yPerPx}
|
|
@@ -160,9 +140,16 @@ export function handleInitMove({ detail }) {
|
|
|
160
140
|
{sensor}
|
|
161
141
|
container={scroller}
|
|
162
142
|
nativeContainer={container}
|
|
143
|
+
let:resizePointerDown
|
|
144
|
+
let:movePointerDown
|
|
163
145
|
>
|
|
164
146
|
{#if item[getComputedCols]}
|
|
165
|
-
<slot
|
|
147
|
+
<slot
|
|
148
|
+
{movePointerDown}
|
|
149
|
+
{resizePointerDown}
|
|
150
|
+
dataItem={item}
|
|
151
|
+
item={item[getComputedCols]}
|
|
152
|
+
/>
|
|
166
153
|
{/if}
|
|
167
154
|
</MoveResize>
|
|
168
155
|
{/each}
|
|
@@ -173,7 +160,4 @@ export function handleInitMove({ detail }) {
|
|
|
173
160
|
.svlt-grid-container {
|
|
174
161
|
position: relative;
|
|
175
162
|
width: 100%;
|
|
176
|
-
-webkit-user-select: none;
|
|
177
|
-
-moz-user-select: none;
|
|
178
|
-
user-select: none;
|
|
179
163
|
}</style>
|
|
@@ -9,28 +9,29 @@ declare class __sveltets_Render<T> {
|
|
|
9
9
|
fastStart?: boolean | undefined;
|
|
10
10
|
throttleUpdate?: number | undefined;
|
|
11
11
|
throttleResize?: number | undefined;
|
|
12
|
-
|
|
13
|
-
allIdsInPath: string[] | undefined;
|
|
12
|
+
onTopId?: string | undefined;
|
|
14
13
|
containerWidth?: number | undefined;
|
|
15
14
|
scroller?: HTMLElement | undefined;
|
|
16
15
|
sensor?: number | undefined;
|
|
17
16
|
parentWidth?: number | undefined;
|
|
18
|
-
handleMove?: (({ detail }: {
|
|
19
|
-
detail: any;
|
|
20
|
-
}) => void) | undefined;
|
|
21
|
-
handleInitMove?: (({ detail }: {
|
|
22
|
-
detail: any;
|
|
23
|
-
}) => void) | undefined;
|
|
24
17
|
};
|
|
25
18
|
events(): {
|
|
19
|
+
pointerup: CustomEvent<any>;
|
|
26
20
|
resize: CustomEvent<any>;
|
|
27
21
|
mount: CustomEvent<any>;
|
|
22
|
+
change: CustomEvent<any>;
|
|
28
23
|
redraw: CustomEvent<any>;
|
|
29
24
|
} & {
|
|
30
25
|
[evt: string]: CustomEvent<any>;
|
|
31
26
|
};
|
|
32
27
|
slots(): {
|
|
33
28
|
default: {
|
|
29
|
+
movePointerDown: ({ clientX, clientY, target }: {
|
|
30
|
+
clientX: any;
|
|
31
|
+
clientY: any;
|
|
32
|
+
target: any;
|
|
33
|
+
}) => void;
|
|
34
|
+
resizePointerDown: (e: any) => void;
|
|
34
35
|
dataItem: FilledItem<T>;
|
|
35
36
|
item: Required<import("./types").ItemLayout>;
|
|
36
37
|
};
|
|
@@ -40,11 +41,5 @@ export type GridProps<T> = ReturnType<__sveltets_Render<T>['props']>;
|
|
|
40
41
|
export type GridEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
|
|
41
42
|
export type GridSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
|
|
42
43
|
export default class Grid<T> extends SvelteComponentTyped<GridProps<T>, GridEvents<T>, GridSlots<T>> {
|
|
43
|
-
get handleMove(): ({ detail }: {
|
|
44
|
-
detail: any;
|
|
45
|
-
}) => void;
|
|
46
|
-
get handleInitMove(): ({ detail }: {
|
|
47
|
-
detail: any;
|
|
48
|
-
}) => void;
|
|
49
44
|
}
|
|
50
45
|
export {};
|
|
@@ -15,9 +15,8 @@ export let item;
|
|
|
15
15
|
export let cols;
|
|
16
16
|
export let nativeContainer;
|
|
17
17
|
export let onTop;
|
|
18
|
-
export let shadow = undefined;
|
|
19
|
-
const divId = `component-${id}`;
|
|
20
18
|
let shadowElement;
|
|
19
|
+
let shadow = undefined;
|
|
21
20
|
let active = false;
|
|
22
21
|
let initX, initY;
|
|
23
22
|
let capturePos = {
|
|
@@ -28,7 +27,7 @@ let cordDiff = { x: 0, y: 0 };
|
|
|
28
27
|
let newSize = { width, height };
|
|
29
28
|
let trans = false;
|
|
30
29
|
let anima;
|
|
31
|
-
|
|
30
|
+
const inActivate = () => {
|
|
32
31
|
if (shadowElement && shadow != undefined) {
|
|
33
32
|
let subgrid = shadowElement.closest('.subgrid');
|
|
34
33
|
let irect = shadowElement.getBoundingClientRect();
|
|
@@ -58,14 +57,18 @@ export function inActivate() {
|
|
|
58
57
|
clearTimeout(anima);
|
|
59
58
|
anima = setTimeout(() => {
|
|
60
59
|
trans = false;
|
|
61
|
-
},
|
|
60
|
+
}, 100);
|
|
61
|
+
dispatch('pointerup', {
|
|
62
|
+
id
|
|
63
|
+
});
|
|
62
64
|
}
|
|
63
|
-
}
|
|
64
|
-
let repaint = (
|
|
65
|
+
};
|
|
66
|
+
let repaint = (cb, isPointerUp) => {
|
|
65
67
|
dispatch('repaint', {
|
|
66
68
|
id,
|
|
69
|
+
shadow,
|
|
67
70
|
isPointerUp,
|
|
68
|
-
|
|
71
|
+
onUpdate: cb
|
|
69
72
|
});
|
|
70
73
|
};
|
|
71
74
|
// Autoscroll
|
|
@@ -75,7 +78,7 @@ let rect;
|
|
|
75
78
|
let scrollElement;
|
|
76
79
|
const getContainerFrame = (element) => {
|
|
77
80
|
if (element === document.documentElement || !element) {
|
|
78
|
-
const { top, bottom } = nativeContainer.getBoundingClientRect();
|
|
81
|
+
const { height, top, right, bottom, left } = nativeContainer.getBoundingClientRect();
|
|
79
82
|
return {
|
|
80
83
|
top: Math.max(0, top),
|
|
81
84
|
bottom: Math.min(window.innerHeight, bottom)
|
|
@@ -84,13 +87,11 @@ const getContainerFrame = (element) => {
|
|
|
84
87
|
return element.getBoundingClientRect();
|
|
85
88
|
};
|
|
86
89
|
const getScroller = (element) => (!element ? document.documentElement : element);
|
|
87
|
-
function computeRect() {
|
|
88
|
-
let gridItem =
|
|
89
|
-
if (!gridItem)
|
|
90
|
-
return;
|
|
90
|
+
function computeRect(target) {
|
|
91
|
+
let gridItem = target.closest('.svlt-grid-item');
|
|
91
92
|
let subgrid = gridItem.closest('.subgrid');
|
|
92
93
|
let irect = gridItem.getBoundingClientRect();
|
|
93
|
-
if (subgrid
|
|
94
|
+
if (subgrid) {
|
|
94
95
|
let subGridParent = subgrid.parentElement;
|
|
95
96
|
let subGridParentRect = subGridParent.getBoundingClientRect();
|
|
96
97
|
let prect = subgrid.getBoundingClientRect();
|
|
@@ -108,28 +109,25 @@ function computeRect() {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
let dragClosure = undefined;
|
|
111
|
-
const pointerdown = ({ clientX, clientY }) => {
|
|
112
|
+
const pointerdown = ({ clientX, clientY, target }) => {
|
|
112
113
|
dragClosure = () => {
|
|
113
114
|
dragClosure = undefined;
|
|
114
115
|
initX = clientX;
|
|
115
116
|
initY = clientY;
|
|
116
|
-
|
|
117
|
+
capturePos = { x: left, y: top };
|
|
118
|
+
shadow = { x: item.x, y: item.y, w: item.w, h: item.h };
|
|
119
|
+
newSize = { width, height };
|
|
120
|
+
containerFrame = getContainerFrame(container);
|
|
121
|
+
scrollElement = getScroller(container);
|
|
122
|
+
cordDiff = { x: 0, y: 0 };
|
|
123
|
+
active = true;
|
|
124
|
+
trans = false;
|
|
125
|
+
computeRect(target);
|
|
126
|
+
_scrollTop = scrollElement.scrollTop;
|
|
117
127
|
};
|
|
118
128
|
window.addEventListener('pointermove', pointermove);
|
|
119
129
|
window.addEventListener('pointerup', pointerup);
|
|
120
130
|
};
|
|
121
|
-
export function initmove() {
|
|
122
|
-
computeRect();
|
|
123
|
-
newSize = { width, height };
|
|
124
|
-
capturePos = { x: left, y: top };
|
|
125
|
-
shadow = { x: item.x, y: item.y, w: item.w, h: item.h };
|
|
126
|
-
cordDiff = { x: 0, y: 0 };
|
|
127
|
-
active = true;
|
|
128
|
-
trans = false;
|
|
129
|
-
containerFrame = getContainerFrame(container);
|
|
130
|
-
scrollElement = getScroller(container);
|
|
131
|
-
_scrollTop = scrollElement.scrollTop;
|
|
132
|
-
}
|
|
133
131
|
let sign = { x: 0, y: 0 };
|
|
134
132
|
let vel = { x: 0, y: 0 };
|
|
135
133
|
let intervalId = undefined;
|
|
@@ -140,8 +138,8 @@ const stopAutoscroll = () => {
|
|
|
140
138
|
vel = { x: 0, y: 0 };
|
|
141
139
|
};
|
|
142
140
|
const update = () => {
|
|
141
|
+
const _newScrollTop = scrollElement.scrollTop - _scrollTop;
|
|
143
142
|
const boundX = capturePos.x + cordDiff.x;
|
|
144
|
-
const _newScrollTop = (scrollElement?.scrollTop ?? 0) - (_scrollTop ?? 0);
|
|
145
143
|
const boundY = capturePos.y + (cordDiff.y + _newScrollTop);
|
|
146
144
|
let gridX = Math.round(boundX / xPerPx);
|
|
147
145
|
let gridY = Math.round(boundY / yPerPx);
|
|
@@ -149,6 +147,7 @@ const update = () => {
|
|
|
149
147
|
shadow.x = Math.max(Math.min(gridX, cols - shadow.w), 0);
|
|
150
148
|
shadow.y = Math.max(gridY, 0);
|
|
151
149
|
}
|
|
150
|
+
repaint(undefined, false);
|
|
152
151
|
};
|
|
153
152
|
const pointermove = (event) => {
|
|
154
153
|
dragClosure && dragClosure();
|
|
@@ -156,68 +155,49 @@ const pointermove = (event) => {
|
|
|
156
155
|
event.stopPropagation();
|
|
157
156
|
event.stopImmediatePropagation();
|
|
158
157
|
const { clientX, clientY } = event;
|
|
159
|
-
|
|
160
|
-
dispatch('move', { cordDiff, clientY });
|
|
161
|
-
};
|
|
162
|
-
export function updateMove(newCoordDiff, clientY) {
|
|
163
|
-
if (!active) {
|
|
164
|
-
active = true;
|
|
165
|
-
}
|
|
166
|
-
if (trans) {
|
|
167
|
-
trans = false;
|
|
168
|
-
}
|
|
169
|
-
cordDiff = newCoordDiff;
|
|
170
|
-
// console.log(cordDiff, id, 'B')
|
|
158
|
+
cordDiff = { x: clientX - initX, y: clientY - initY };
|
|
171
159
|
const Y_SENSOR = sensor;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}, 10);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
else if (intervalId) {
|
|
190
|
-
stopAutoscroll();
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
update();
|
|
160
|
+
let velocityTop = Math.max(0, (containerFrame.top + Y_SENSOR - clientY) / Y_SENSOR);
|
|
161
|
+
let velocityBottom = Math.max(0, (clientY - (containerFrame.bottom - Y_SENSOR)) / Y_SENSOR);
|
|
162
|
+
const topSensor = velocityTop > 0 && velocityBottom === 0;
|
|
163
|
+
const bottomSensor = velocityBottom > 0 && velocityTop === 0;
|
|
164
|
+
sign.y = topSensor ? -1 : bottomSensor ? 1 : 0;
|
|
165
|
+
vel.y = sign.y === -1 ? velocityTop : velocityBottom;
|
|
166
|
+
if (vel.y > 0) {
|
|
167
|
+
if (!intervalId) {
|
|
168
|
+
// Start scrolling
|
|
169
|
+
// TODO Use requestAnimationFrame
|
|
170
|
+
intervalId = setInterval(() => {
|
|
171
|
+
scrollElement.scrollTop += 2 * (vel.y + Math.sign(vel.y)) * sign.y;
|
|
172
|
+
update();
|
|
173
|
+
}, 10);
|
|
194
174
|
}
|
|
195
175
|
}
|
|
176
|
+
else if (intervalId) {
|
|
177
|
+
stopAutoscroll();
|
|
178
|
+
}
|
|
196
179
|
else {
|
|
197
180
|
update();
|
|
198
181
|
}
|
|
199
|
-
}
|
|
182
|
+
};
|
|
200
183
|
const pointerup = (e) => {
|
|
184
|
+
dragClosure = undefined;
|
|
201
185
|
stopAutoscroll();
|
|
202
186
|
window.removeEventListener('pointerdown', pointerdown);
|
|
203
187
|
window.removeEventListener('pointermove', pointermove);
|
|
204
188
|
window.removeEventListener('pointerup', pointerup);
|
|
205
|
-
|
|
206
|
-
repaint(true, true);
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
dragClosure = undefined;
|
|
210
|
-
}
|
|
189
|
+
repaint(inActivate, true);
|
|
211
190
|
};
|
|
191
|
+
// Resize
|
|
212
192
|
let resizeInitPos = { x: 0, y: 0 };
|
|
213
193
|
let initSize = { width: 0, height: 0 };
|
|
214
194
|
const resizePointerDown = (e) => {
|
|
215
195
|
e.stopPropagation();
|
|
216
|
-
const { pageX, pageY } = e;
|
|
196
|
+
const { pageX, pageY, target } = e;
|
|
217
197
|
resizeInitPos = { x: pageX, y: pageY };
|
|
218
198
|
initSize = { width, height };
|
|
219
199
|
cordDiff = { x: 0, y: 0 };
|
|
220
|
-
computeRect();
|
|
200
|
+
computeRect(target);
|
|
221
201
|
newSize = { width, height };
|
|
222
202
|
active = true;
|
|
223
203
|
trans = false;
|
|
@@ -239,12 +219,12 @@ const resizePointerMove = ({ pageX, pageY }) => {
|
|
|
239
219
|
// Limit col & row
|
|
240
220
|
shadow.w = Math.round((newSize.width + gapX * 2) / xPerPx);
|
|
241
221
|
shadow.h = Math.round((newSize.height + gapY * 2) / yPerPx);
|
|
242
|
-
repaint(
|
|
222
|
+
repaint(undefined, false);
|
|
243
223
|
}
|
|
244
224
|
};
|
|
245
225
|
const resizePointerUp = (e) => {
|
|
246
226
|
e.stopPropagation();
|
|
247
|
-
repaint(
|
|
227
|
+
repaint(inActivate, true);
|
|
248
228
|
window.removeEventListener('pointermove', resizePointerMove);
|
|
249
229
|
window.removeEventListener('pointerup', resizePointerUp);
|
|
250
230
|
};
|
|
@@ -254,19 +234,18 @@ const resizePointerUp = (e) => {
|
|
|
254
234
|
<div
|
|
255
235
|
draggable="false"
|
|
256
236
|
on:pointerdown|stopPropagation|preventDefault={pointerdown}
|
|
257
|
-
id={divId}
|
|
258
237
|
class="svlt-grid-item"
|
|
259
238
|
class:svlt-grid-active={active || (trans && rect)}
|
|
260
239
|
style="width: {active ? newSize.width : width}px; height:{active
|
|
261
240
|
? newSize.height
|
|
262
241
|
: height}px; {onTop ? 'z-index: 1000;' : ''}
|
|
263
|
-
{active
|
|
242
|
+
{active
|
|
264
243
|
? `transform: translate(${cordDiff.x}px, ${cordDiff.y}px);top:${rect.top}px;left:${rect.left}px;`
|
|
265
244
|
: trans
|
|
266
245
|
? `transform: translate(${cordDiff.x}px, ${cordDiff.y}px); position:absolute; transition: width 0.2s, height 0.2s;`
|
|
267
246
|
: `transition: transform 0.1s, opacity 0.1s; transform: translate(${left}px, ${top}px); `} "
|
|
268
247
|
>
|
|
269
|
-
<slot />
|
|
248
|
+
<slot movePointerDown={pointerdown} {resizePointerDown} />
|
|
270
249
|
<div class="svlt-grid-resizer" on:pointerdown={resizePointerDown} />
|
|
271
250
|
</div>
|
|
272
251
|
|
|
@@ -16,33 +16,27 @@ declare const __propDef: {
|
|
|
16
16
|
cols: any;
|
|
17
17
|
nativeContainer: any;
|
|
18
18
|
onTop: any;
|
|
19
|
-
shadow?: {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
w: number;
|
|
23
|
-
h: number;
|
|
24
|
-
} | undefined;
|
|
25
|
-
inActivate?: (() => void) | undefined;
|
|
26
|
-
initmove?: (() => void) | undefined;
|
|
27
|
-
updateMove?: ((newCoordDiff: any, clientY: any) => void) | undefined;
|
|
28
19
|
};
|
|
29
20
|
events: {
|
|
21
|
+
pointerup: CustomEvent<any>;
|
|
30
22
|
repaint: CustomEvent<any>;
|
|
31
|
-
initmove: CustomEvent<any>;
|
|
32
|
-
move: CustomEvent<any>;
|
|
33
23
|
} & {
|
|
34
24
|
[evt: string]: CustomEvent<any>;
|
|
35
25
|
};
|
|
36
26
|
slots: {
|
|
37
|
-
default: {
|
|
27
|
+
default: {
|
|
28
|
+
movePointerDown: ({ clientX, clientY, target }: {
|
|
29
|
+
clientX: any;
|
|
30
|
+
clientY: any;
|
|
31
|
+
target: any;
|
|
32
|
+
}) => void;
|
|
33
|
+
resizePointerDown: (e: any) => void;
|
|
34
|
+
};
|
|
38
35
|
};
|
|
39
36
|
};
|
|
40
37
|
export type MoveResizeProps = typeof __propDef.props;
|
|
41
38
|
export type MoveResizeEvents = typeof __propDef.events;
|
|
42
39
|
export type MoveResizeSlots = typeof __propDef.slots;
|
|
43
40
|
export default class MoveResize extends SvelteComponentTyped<MoveResizeProps, MoveResizeEvents, MoveResizeSlots> {
|
|
44
|
-
get inActivate(): () => void;
|
|
45
|
-
get initmove(): () => void;
|
|
46
|
-
get updateMove(): (newCoordDiff: any, clientY: any) => void;
|
|
47
41
|
}
|
|
48
42
|
export {};
|
|
@@ -63,7 +63,6 @@ export type InlineScript = {
|
|
|
63
63
|
key: string;
|
|
64
64
|
}[];
|
|
65
65
|
};
|
|
66
|
-
export type AppCssItemName = 'viewer' | 'grid' | AppComponent['type'];
|
|
67
66
|
export type App = {
|
|
68
67
|
grid: GridItem[];
|
|
69
68
|
fullscreen: boolean;
|
|
@@ -79,7 +78,7 @@ export type App = {
|
|
|
79
78
|
autoRefresh?: boolean;
|
|
80
79
|
doNotRecomputeOnInputChanged?: boolean;
|
|
81
80
|
}>;
|
|
82
|
-
css?: Partial<Record<
|
|
81
|
+
css?: Partial<Record<'viewer' | 'grid' | AppComponent['type'], Record<string, ComponentCssProperty>>>;
|
|
83
82
|
subgrids?: Record<string, GridItem[]>;
|
|
84
83
|
};
|
|
85
84
|
export type ConnectingInput = {
|
|
@@ -92,14 +91,11 @@ export type AppViewerContext = {
|
|
|
92
91
|
worldStore: Writable<World>;
|
|
93
92
|
app: Writable<App>;
|
|
94
93
|
summary: Writable<string>;
|
|
95
|
-
selectedComponent: Writable<string
|
|
94
|
+
selectedComponent: Writable<string | undefined>;
|
|
96
95
|
mode: Writable<EditorMode>;
|
|
97
96
|
connectingInput: Writable<ConnectingInput>;
|
|
98
97
|
breakpoint: Writable<EditorBreakpoint>;
|
|
99
|
-
runnableComponents: Writable<Record<string,
|
|
100
|
-
autoRefresh: boolean;
|
|
101
|
-
cb: (inlineScript?: InlineScript) => Promise<void>;
|
|
102
|
-
}>>;
|
|
98
|
+
runnableComponents: Writable<Record<string, (inlineScript?: InlineScript) => Promise<void>>>;
|
|
103
99
|
staticExporter: Writable<Record<string, () => any>>;
|
|
104
100
|
appPath: string;
|
|
105
101
|
workspace: string;
|
|
@@ -125,14 +121,13 @@ export type AppViewerContext = {
|
|
|
125
121
|
setTab?: (index: number) => void;
|
|
126
122
|
}>>;
|
|
127
123
|
hoverStore: Writable<string | undefined>;
|
|
128
|
-
allIdsInPath: Writable<string[]>;
|
|
129
124
|
};
|
|
130
125
|
export type AppEditorContext = {
|
|
131
126
|
history: History<App> | undefined;
|
|
132
127
|
pickVariableCallback: Writable<((path: string) => void) | undefined>;
|
|
133
128
|
ontextfocus: Writable<(() => void) | undefined>;
|
|
134
129
|
selectedComponentInEditor: Writable<string | undefined>;
|
|
135
|
-
|
|
130
|
+
movingcomponent: Writable<string | undefined>;
|
|
136
131
|
};
|
|
137
132
|
export type FocusedGrid = {
|
|
138
133
|
parentComponentId: string;
|
|
@@ -145,6 +140,7 @@ type ComponentID = string;
|
|
|
145
140
|
export type ContextPanelContext = {
|
|
146
141
|
search: Writable<string>;
|
|
147
142
|
manuallyOpened: Writable<Record<string, boolean>>;
|
|
143
|
+
expanded: Writable<boolean>;
|
|
148
144
|
hasResult: Writable<Record<string, boolean>>;
|
|
149
145
|
};
|
|
150
146
|
export {};
|
|
@@ -2,8 +2,6 @@ import type { Schema } from '../../common';
|
|
|
2
2
|
import type { App, ComponentCssProperty, GridItem } from './types';
|
|
3
3
|
import type { AppInput, InputType, ResultAppInput, StaticAppInput } from './inputType';
|
|
4
4
|
import type { Output } from './rx';
|
|
5
|
-
import { type Writable } from 'svelte/store';
|
|
6
|
-
export declare function selectId(e: PointerEvent, id: string, selectedComponent: Writable<string[] | undefined>, app: App): void;
|
|
7
5
|
export declare function allItems(grid: GridItem[], subgrids: Record<string, GridItem[]> | undefined): GridItem[];
|
|
8
6
|
export declare function loadSchema(workspace: string, path: string, runType: 'script' | 'flow' | 'hubscript'): Promise<Schema>;
|
|
9
7
|
export declare function schemaToInputsSpec(schema: Schema, defaultUserInput: boolean): Record<string, StaticAppInput>;
|
package/components/apps/utils.js
CHANGED
|
@@ -1,36 +1,7 @@
|
|
|
1
1
|
import { FlowService, ScriptService } from '../../gen';
|
|
2
2
|
import { inferArgs } from '../../infer';
|
|
3
|
-
import { emptySchema
|
|
3
|
+
import { emptySchema } from '../../utils';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import { get } from 'svelte/store';
|
|
6
|
-
import { findGridItemParentGrid } from './editor/appUtils';
|
|
7
|
-
export function selectId(e, id, selectedComponent, app) {
|
|
8
|
-
if (e.shiftKey) {
|
|
9
|
-
selectedComponent.update((old) => {
|
|
10
|
-
if (old && old?.[0]) {
|
|
11
|
-
if (findGridItemParentGrid(app, old[0]) != findGridItemParentGrid(app, id)) {
|
|
12
|
-
sendUserToast('Cannot multi select items from different grids', true);
|
|
13
|
-
return old;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (old == undefined) {
|
|
17
|
-
return [id];
|
|
18
|
-
}
|
|
19
|
-
if (old.includes(id)) {
|
|
20
|
-
return old;
|
|
21
|
-
}
|
|
22
|
-
return [...old, id];
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
if (get(selectedComponent)?.includes(id)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
selectedComponent.set([id]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
5
|
export function allItems(grid, subgrids) {
|
|
35
6
|
if (subgrids == undefined) {
|
|
36
7
|
return grid;
|
|
@@ -102,8 +73,6 @@ export function fieldTypeToTsType(inputType) {
|
|
|
102
73
|
switch (inputType) {
|
|
103
74
|
case 'number':
|
|
104
75
|
return 'number';
|
|
105
|
-
case 'integer':
|
|
106
|
-
return 'number';
|
|
107
76
|
case 'boolean':
|
|
108
77
|
return 'boolean';
|
|
109
78
|
case 'object':
|
|
@@ -165,7 +134,6 @@ ${hasRows ? 'declare const row: Record<string, any>;' : ''}
|
|
|
165
134
|
${goto
|
|
166
135
|
? `declare async function goto(path: string, newTab?: boolean): Promise<void>;
|
|
167
136
|
declare function setTab(id: string, index: string): void;
|
|
168
|
-
declare function recompute(id: string): void;
|
|
169
137
|
`
|
|
170
138
|
: ''}
|
|
171
139
|
declare const state: ${JSON.stringify(state)};
|
|
@@ -7,7 +7,6 @@ export let color = 'blue';
|
|
|
7
7
|
export let variant = 'contained';
|
|
8
8
|
export let mainClasses = '';
|
|
9
9
|
export let toggleClasses = '';
|
|
10
|
-
export let listClasses = '';
|
|
11
10
|
export let disabled = false;
|
|
12
11
|
export let href = undefined;
|
|
13
12
|
export let target = '_self';
|
|
@@ -60,16 +59,14 @@ $: commonProps = {
|
|
|
60
59
|
{#if ref}
|
|
61
60
|
<Popup
|
|
62
61
|
{ref}
|
|
63
|
-
let:open
|
|
64
|
-
let:close
|
|
65
62
|
options={{
|
|
66
63
|
placement: $$slots.main ? 'bottom-end' : 'bottom',
|
|
67
64
|
strategy: 'absolute',
|
|
68
65
|
modifiers: [{ name: 'offset', options: { offset: [0, 0] } }]
|
|
69
66
|
}}
|
|
70
67
|
>
|
|
71
|
-
<ul class="bg-white rounded-t border pt-1 pb-2 max-h-40 overflow-auto
|
|
72
|
-
<slot
|
|
68
|
+
<ul class="bg-white rounded-t border pt-1 pb-2 max-h-40 overflow-auto">
|
|
69
|
+
<slot />
|
|
73
70
|
</ul>
|
|
74
71
|
</Popup>
|
|
75
72
|
{/if}
|
|
@@ -8,7 +8,6 @@ declare const __propDef: {
|
|
|
8
8
|
variant?: ButtonType.Variant | undefined;
|
|
9
9
|
mainClasses?: string | undefined;
|
|
10
10
|
toggleClasses?: string | undefined;
|
|
11
|
-
listClasses?: string | undefined;
|
|
12
11
|
disabled?: boolean | undefined;
|
|
13
12
|
href?: string | undefined;
|
|
14
13
|
target?: ButtonType.Target | undefined;
|
|
@@ -25,10 +24,7 @@ declare const __propDef: {
|
|
|
25
24
|
slots: {
|
|
26
25
|
main: {};
|
|
27
26
|
toggle: {};
|
|
28
|
-
default: {
|
|
29
|
-
open: () => void;
|
|
30
|
-
close: () => void;
|
|
31
|
-
};
|
|
27
|
+
default: {};
|
|
32
28
|
};
|
|
33
29
|
};
|
|
34
30
|
export type ButtonPopupProps = typeof __propDef.props;
|