windmill-components 1.82.6 → 1.82.7
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 +52 -72
- package/components/ArgInput.svelte.d.ts +1 -3
- package/components/DisplayResult.svelte +17 -17
- package/components/Editor.svelte +0 -3
- package/components/Editor.svelte.d.ts +0 -1
- package/components/FieldHeader.svelte +0 -1
- package/components/FieldHeader.svelte.d.ts +0 -4
- package/components/FlowBuilder.svelte +5 -0
- package/components/FlowViewer.svelte +0 -1
- package/components/InputTransformForm.svelte +0 -1
- package/components/LightweightArgInput.svelte +1 -14
- package/components/LightweightArgInput.svelte.d.ts +1 -3
- package/components/Multiselect.svelte.d.ts +2 -2
- package/components/SimpleEditor.svelte +0 -1
- package/components/SimpleEditor.svelte.d.ts +0 -1
- package/components/TemplateEditor.svelte +0 -1
- package/components/Toggle.svelte +1 -1
- package/components/Toggle.svelte.d.ts +0 -1
- package/components/apps/components/buttons/AppButton.svelte +3 -17
- package/components/apps/components/buttons/AppForm.svelte +2 -10
- package/components/apps/components/buttons/AppFormButton.svelte +58 -82
- package/components/apps/components/display/AppDisplayComponent.svelte +23 -17
- package/components/apps/components/display/AppHtml.svelte +7 -1
- package/components/apps/components/display/AppHtml.svelte.d.ts +2 -0
- 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 +20 -3
- package/components/apps/components/display/PlotlyHtml.svelte.d.ts +2 -0
- package/components/apps/components/display/table/AppAggridTable.svelte +1 -1
- package/components/apps/components/display/table/AppTable.svelte +21 -14
- package/components/apps/components/helpers/HiddenComponent.svelte +3 -2
- package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +2 -1
- package/components/apps/components/helpers/InputValue.svelte +3 -3
- package/components/apps/components/helpers/RefreshButton.svelte +3 -10
- package/components/apps/components/helpers/RefreshButton.svelte.d.ts +1 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +19 -15
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +2 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte +3 -1
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +1 -0
- package/components/apps/components/helpers/eval.d.ts +3 -1
- package/components/apps/components/helpers/eval.js +4 -2
- package/components/apps/components/inputs/AppCheckbox.svelte +0 -4
- package/components/apps/components/inputs/AppDateInput.svelte +2 -2
- package/components/apps/components/inputs/AppMultiSelect.svelte +13 -5
- package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppNumberInput.svelte +3 -3
- package/components/apps/components/inputs/AppSelect.svelte +11 -4
- package/components/apps/components/inputs/AppSelect.svelte.d.ts +0 -2
- package/components/apps/components/inputs/AppSliderInputs.svelte +1 -1
- package/components/apps/components/inputs/AppTextInput.svelte +53 -43
- 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 +1 -2
- package/components/apps/components/layout/AppSplitpanes.svelte +3 -3
- package/components/apps/components/layout/AppTabs.svelte +1 -1
- package/components/apps/editor/AppEditor.svelte +49 -21
- package/components/apps/editor/AppEditorHeader.svelte +5 -0
- package/components/apps/editor/AppPreview.svelte +18 -7
- package/components/apps/editor/ComponentHeader.svelte +1 -0
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -1
- package/components/apps/editor/GridEditor.svelte +22 -12
- package/components/apps/editor/GridViewer.svelte +2 -2
- package/components/apps/editor/GridViewer.svelte.d.ts +1 -1
- package/components/apps/editor/RecomputeAllComponents.svelte +5 -7
- package/components/apps/editor/SettingsPanel.svelte +4 -4
- package/components/apps/editor/SubGridEditor.svelte +13 -12
- package/components/apps/editor/appUtils.d.ts +1 -0
- package/components/apps/editor/appUtils.js +19 -0
- package/components/apps/editor/component/Component.svelte +19 -8
- package/components/apps/editor/component/Component.svelte.d.ts +1 -1
- package/components/apps/editor/component/ComponentNavigation.svelte +57 -47
- package/components/apps/editor/component/README.md +4 -0
- package/components/apps/editor/component/components.d.ts +38 -28
- package/components/apps/editor/component/components.js +34 -27
- package/components/apps/editor/component/sets.js +2 -1
- package/components/apps/editor/componentsPanel/ComponentList.svelte +1 -1
- package/components/apps/editor/componentsPanel/CssProperty.svelte +62 -48
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +3 -2
- package/components/apps/editor/componentsPanel/CssSettings.svelte +1 -0
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +170 -0
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte.d.ts +18 -0
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte +130 -0
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte.d.ts +21 -0
- package/components/apps/editor/componentsPanel/quickStyleProperties.d.ts +535 -0
- package/components/apps/editor/componentsPanel/quickStyleProperties.js +598 -0
- package/components/apps/editor/componentsPanel/store.js +4 -4
- package/components/apps/editor/contextPanel/ComponentOutput.svelte +2 -26
- package/components/apps/editor/contextPanel/ComponentOutput.svelte.d.ts +0 -1
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +8 -6
- package/components/apps/editor/contextPanel/ContextPanel.svelte +7 -14
- package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte +2 -25
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +29 -40
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte.d.ts +1 -2
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +2 -7
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +10 -11
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +4 -3
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +0 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +2 -2
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +2 -0
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +22 -19
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +42 -13
- package/components/apps/editor/settingsPanel/GridTab.svelte +1 -2
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +2 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +4 -0
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -0
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +1 -2
- package/components/apps/editor/settingsPanel/StylePanel.svelte +61 -0
- package/components/apps/editor/settingsPanel/StylePanel.svelte.d.ts +17 -0
- 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 +3 -2
- package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +5 -1
- package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +3 -3
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +3 -2
- package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +4 -1
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +2 -2
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte +47 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte.d.ts +14 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/index.d.ts +2 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/index.js +2 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.d.ts +12 -0
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.js +10 -0
- 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 +50 -34
- package/components/apps/svelte-grid/Grid.svelte.d.ts +14 -9
- package/components/apps/svelte-grid/MoveResize.svelte +76 -55
- package/components/apps/svelte-grid/MoveResize.svelte.d.ts +15 -9
- package/components/apps/svelte-grid/utils/helper.d.ts +0 -1
- package/components/apps/svelte-grid/utils/helper.js +0 -3
- package/components/apps/types.d.ts +9 -5
- package/components/apps/utils.d.ts +2 -0
- package/components/apps/utils.js +31 -1
- package/components/common/button/ButtonPopup.svelte +5 -2
- package/components/common/button/ButtonPopup.svelte.d.ts +5 -1
- package/components/common/button/ButtonPopupItem.svelte +2 -1
- package/components/common/button/ButtonPopupItem.svelte.d.ts +1 -0
- package/components/common/clearableInput/ClearableInput.svelte +56 -0
- package/components/common/clearableInput/ClearableInput.svelte.d.ts +28 -0
- package/components/common/index.d.ts +1 -0
- package/components/common/index.js +1 -0
- package/components/common/kbd/Kbd.svelte +4 -1
- package/components/common/kbd/Kbd.svelte.d.ts +6 -14
- package/components/common/menu/Menu.svelte +8 -2
- package/components/common/menu/Menu.svelte.d.ts +4 -1
- package/components/common/modal/AlwaysMountedModal.svelte +109 -0
- package/components/common/modal/AlwaysMountedModal.svelte.d.ts +22 -0
- package/components/flows/map/MapItem.svelte +3 -3
- package/components/scriptEditor/LogPanel.svelte +3 -3
- package/infer.js +6 -1
- package/package.json +11 -2
- package/utils.d.ts +1 -0
- package/utils.js +3 -0
- package/components/apps/editor/contextPanel/components/MinMaxButton.svelte +0 -25
- package/components/apps/editor/contextPanel/components/MinMaxButton.svelte.d.ts +0 -16
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script>import Button from '../../../common/button/Button.svelte';
|
|
2
2
|
import Toggle from '../../../Toggle.svelte';
|
|
3
3
|
import Tooltip from '../../../Tooltip.svelte';
|
|
4
|
-
import { faClose
|
|
5
|
-
import { includes } from 'lodash';
|
|
4
|
+
import { faClose } from '@fortawesome/free-solid-svg-icons';
|
|
6
5
|
import { getContext } from 'svelte';
|
|
7
6
|
import { clearResultAppInput } from '../../utils';
|
|
8
7
|
import ComponentTriggerList from './triggerLists/ComponentTriggerList.svelte';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script>import { Button } from '../../../common';
|
|
2
|
+
import { sendUserToast } from '../../../../utils';
|
|
3
|
+
import { Copy } from 'lucide-svelte';
|
|
4
|
+
import { getContext } from 'svelte';
|
|
5
|
+
import { ccomponents } from '../component';
|
|
6
|
+
import CssProperty from '../componentsPanel/CssProperty.svelte';
|
|
7
|
+
import { quickStyleProperties } from '../componentsPanel/quickStyleProperties';
|
|
8
|
+
export let component;
|
|
9
|
+
const { app } = getContext('AppViewerContext');
|
|
10
|
+
function applyToAllInstances() {
|
|
11
|
+
if (component) {
|
|
12
|
+
if (!$app.css) {
|
|
13
|
+
$app.css = {};
|
|
14
|
+
}
|
|
15
|
+
let componentType = component?.type;
|
|
16
|
+
if (!$app.css[componentType]) {
|
|
17
|
+
$app.css[componentType] = {};
|
|
18
|
+
}
|
|
19
|
+
Object.keys(ccomponents[component.type].customCss ?? {}).forEach((name) => {
|
|
20
|
+
if (!$app.css[componentType][name]) {
|
|
21
|
+
$app.css[componentType][name] = {};
|
|
22
|
+
}
|
|
23
|
+
if (component) {
|
|
24
|
+
let nstyle = component.customCss[name];
|
|
25
|
+
if (nstyle.style) {
|
|
26
|
+
$app.css[componentType][name].style = nstyle.style;
|
|
27
|
+
}
|
|
28
|
+
if (nstyle.class) {
|
|
29
|
+
$app.css[componentType][name].class = nstyle.class;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
sendUserToast(`Applied style to all instances of the ${componentType.replace('component', '')} component`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<Button
|
|
39
|
+
variant="border"
|
|
40
|
+
color="light"
|
|
41
|
+
size="xs"
|
|
42
|
+
aria-label="Apply to all instances of this component"
|
|
43
|
+
on:click={applyToAllInstances}
|
|
44
|
+
>
|
|
45
|
+
Copy style to global CSS <Copy size={18} />
|
|
46
|
+
</Button>
|
|
47
|
+
|
|
48
|
+
{#if component && component.customCss !== undefined}
|
|
49
|
+
{#each Object.keys(ccomponents[component.type].customCss ?? {}) as name}
|
|
50
|
+
<div class="w-full">
|
|
51
|
+
<CssProperty
|
|
52
|
+
quickStyleProperties={quickStyleProperties?.[component.type]?.[name]}
|
|
53
|
+
forceStyle={ccomponents[component.type].customCss[name].style !== undefined}
|
|
54
|
+
forceClass={ccomponents[component.type].customCss[name].class !== undefined}
|
|
55
|
+
{name}
|
|
56
|
+
bind:value={component.customCss[name]}
|
|
57
|
+
on:change={() => app.set($app)}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
{/each}
|
|
61
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { type AppComponent } from '../component';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
component: AppComponent | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type StylePanelProps = typeof __propDef.props;
|
|
13
|
+
export type StylePanelEvents = typeof __propDef.events;
|
|
14
|
+
export type StylePanelSlots = typeof __propDef.slots;
|
|
15
|
+
export default class StylePanel extends SvelteComponentTyped<StylePanelProps, StylePanelEvents, StylePanelSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -24,7 +24,7 @@ function deleteComponent(cid) {
|
|
|
24
24
|
components = components.filter((x) => x.id !== cid);
|
|
25
25
|
$errorByComponent = clearErrorByComponentId(cid, $errorByComponent);
|
|
26
26
|
$jobs = clearJobsByComponentId(cid, $jobs);
|
|
27
|
-
$selectedComponent = id;
|
|
27
|
+
$selectedComponent = [id];
|
|
28
28
|
$app = $app;
|
|
29
29
|
}
|
|
30
30
|
</script>
|
|
@@ -49,10 +49,10 @@ function deleteComponent(cid) {
|
|
|
49
49
|
class={classNames(
|
|
50
50
|
'w-full text-xs font-bold gap-1 truncate py-1.5 px-2 cursor-pointer transition-all justify-between flex items-center border border-gray-3 rounded-md',
|
|
51
51
|
'bg-white border-gray-300 hover:bg-gray-100 focus:bg-gray-100 text-gray-700',
|
|
52
|
-
$selectedComponent
|
|
52
|
+
$selectedComponent?.includes(component.id) ? 'outline outline-blue-500 bg-red-400' : ''
|
|
53
53
|
)}
|
|
54
54
|
on:click={() => {
|
|
55
|
-
$selectedComponent = component.id
|
|
55
|
+
$selectedComponent = [component.id]
|
|
56
56
|
}}
|
|
57
57
|
on:keypress
|
|
58
58
|
>
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
import ColorPicker, { ChromeVariant } from 'svelte-awesome-color-picker';
|
|
3
|
+
import { ClearableInput } from '../../../../common';
|
|
4
|
+
export let value = '#fff';
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
3
6
|
let isOpen = false;
|
|
7
|
+
$: dispatch('change', value);
|
|
4
8
|
</script>
|
|
5
9
|
|
|
6
|
-
<div class="color-picker-input">
|
|
7
|
-
<
|
|
8
|
-
type="text"
|
|
9
|
-
readonly
|
|
10
|
-
value={componentInput.value}
|
|
11
|
-
on:focus|preventDefault|stopPropagation={() => (isOpen = true)}
|
|
12
|
-
/>
|
|
10
|
+
<div class="color-picker-input grow">
|
|
11
|
+
<ClearableInput readonly bind:value on:focus={() => (isOpen = true)} />
|
|
13
12
|
<ColorPicker
|
|
14
13
|
bind:isOpen
|
|
15
|
-
bind:hex={
|
|
16
|
-
label={
|
|
14
|
+
bind:hex={value}
|
|
15
|
+
label={value}
|
|
17
16
|
canChangeMode={false}
|
|
18
17
|
components={ChromeVariant}
|
|
19
18
|
toRight
|
|
@@ -22,7 +21,7 @@ let isOpen = false;
|
|
|
22
21
|
</div>
|
|
23
22
|
|
|
24
23
|
<style global>
|
|
25
|
-
:global(.color-picker-input) :global(span) > :global(label
|
|
24
|
+
:global(.color-picker-input) :global(span) > :global(label) {
|
|
26
25
|
display: none;
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -30,6 +29,7 @@ let isOpen = false;
|
|
|
30
29
|
box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.25) !important;
|
|
31
30
|
border-style: none !important;
|
|
32
31
|
border-radius: 0.375rem !important;
|
|
32
|
+
z-index: 20;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
:global(.color-picker-input) :global(.slider-wrapper) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { StaticInput } from '../../../inputType';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
|
-
|
|
4
|
+
value?: string | undefined;
|
|
6
5
|
};
|
|
7
6
|
events: {
|
|
7
|
+
change: CustomEvent<any>;
|
|
8
|
+
} & {
|
|
8
9
|
[evt: string]: CustomEvent<any>;
|
|
9
10
|
};
|
|
10
11
|
slots: {};
|
|
@@ -5,7 +5,6 @@ export let componentInput;
|
|
|
5
5
|
export let id;
|
|
6
6
|
export let hasRows = false;
|
|
7
7
|
const { onchange, worldStore, state } = getContext('AppViewerContext');
|
|
8
|
-
$: componentInput && onchange?.();
|
|
9
8
|
$: extraLib =
|
|
10
9
|
componentInput?.expr && $worldStore
|
|
11
10
|
? buildExtraLib($worldStore?.outputsById ?? {}, id, hasRows, $state, false)
|
|
@@ -20,6 +19,11 @@ $: extraLib =
|
|
|
20
19
|
shouldBindKey={false}
|
|
21
20
|
{extraLib}
|
|
22
21
|
autoHeight
|
|
22
|
+
on:change={() => {
|
|
23
|
+
if (onchange) {
|
|
24
|
+
onchange()
|
|
25
|
+
}
|
|
26
|
+
}}
|
|
23
27
|
/>
|
|
24
28
|
</div>
|
|
25
29
|
{/if}
|
|
@@ -37,9 +37,9 @@ function formatName(name) {
|
|
|
37
37
|
}
|
|
38
38
|
function select(label) {
|
|
39
39
|
componentInput.value = label;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const elem = document.activeElement;
|
|
41
|
+
if (elem.blur) {
|
|
42
|
+
elem.blur();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
</script>
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
export let code;
|
|
3
3
|
export let value = undefined;
|
|
4
4
|
export let error = '';
|
|
5
|
+
export let editor = undefined;
|
|
5
6
|
function parseJson() {
|
|
6
7
|
try {
|
|
7
|
-
value = JSON.parse(code);
|
|
8
|
+
value = JSON.parse(code ?? '');
|
|
8
9
|
error = '';
|
|
9
10
|
}
|
|
10
11
|
catch (e) {
|
|
@@ -16,7 +17,7 @@ $: code && parseJson();
|
|
|
16
17
|
|
|
17
18
|
<div class="flex flex-col w-full">
|
|
18
19
|
<div class="border border-gray-300 w-full">
|
|
19
|
-
<SimpleEditor on:change autoHeight lang="json" bind:code />
|
|
20
|
+
<SimpleEditor on:focus bind:this={editor} on:change autoHeight lang="json" bind:code />
|
|
20
21
|
</div>
|
|
21
22
|
{#if error != ''}
|
|
22
23
|
<span class="text-red-600 text-xs">{error}</span>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import SimpleEditor from '../../../../SimpleEditor.svelte';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
|
-
code: string;
|
|
5
|
+
code: string | undefined;
|
|
5
6
|
value?: any;
|
|
6
7
|
error?: string | undefined;
|
|
8
|
+
editor?: SimpleEditor | undefined;
|
|
7
9
|
};
|
|
8
10
|
events: {
|
|
11
|
+
focus: CustomEvent<any>;
|
|
9
12
|
change: CustomEvent<any>;
|
|
10
13
|
} & {
|
|
11
14
|
[evt: string]: CustomEvent<any>;
|
|
@@ -74,8 +74,8 @@ $: componentInput && onchange?.();
|
|
|
74
74
|
Inconsistent labeled resource object
|
|
75
75
|
{/if}
|
|
76
76
|
{:else if fieldType === 'color'}
|
|
77
|
-
<ColorInput bind:componentInput />
|
|
78
|
-
{:else if fieldType === 'object'}
|
|
77
|
+
<ColorInput bind:value={componentInput.value} />
|
|
78
|
+
{:else if fieldType === 'object' || fieldType == 'labeledselect'}
|
|
79
79
|
{#if format?.startsWith('resource-')}
|
|
80
80
|
<ResourcePicker
|
|
81
81
|
initialValue={componentInput.value?.split('$res:')[1] || ''}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script>import { fly } from 'svelte/transition';
|
|
2
|
+
import { faChevronLeft } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { Badge, Button } from '../../../../common';
|
|
4
|
+
import { secondaryMenu, SECONDARY_MENU_ID } from './';
|
|
5
|
+
import { getContext } from 'svelte';
|
|
6
|
+
const { selectedComponent } = getContext('AppViewerContext');
|
|
7
|
+
let width;
|
|
8
|
+
let lastSelected = $selectedComponent;
|
|
9
|
+
$: if (lastSelected !== $selectedComponent) {
|
|
10
|
+
secondaryMenu.close();
|
|
11
|
+
lastSelected = $selectedComponent;
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
bind:clientWidth={width}
|
|
17
|
+
class="absolute z-50 inset-0 overflow-hidden"
|
|
18
|
+
class:pointer-events-none={!$secondaryMenu.isOpen}
|
|
19
|
+
>
|
|
20
|
+
{#if $secondaryMenu.isOpen && $secondaryMenu.component}
|
|
21
|
+
<div
|
|
22
|
+
transition:fly|local={{ duration: 300, x: width, y: 0, opacity: 1 }}
|
|
23
|
+
id={SECONDARY_MENU_ID}
|
|
24
|
+
class="flex flex-col w-full h-full bg-white"
|
|
25
|
+
>
|
|
26
|
+
<div class="flex justify-between items-center bg-white gap-1 p-3">
|
|
27
|
+
<Button
|
|
28
|
+
color="light"
|
|
29
|
+
size="xs"
|
|
30
|
+
variant="border"
|
|
31
|
+
startIcon={{ icon: faChevronLeft }}
|
|
32
|
+
on:click={secondaryMenu.close}
|
|
33
|
+
>
|
|
34
|
+
Back
|
|
35
|
+
</Button>
|
|
36
|
+
<Badge color="blue">{$selectedComponent}</Badge>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="relative h-full overflow-y-auto px-3 pb-3">
|
|
39
|
+
{#if typeof $secondaryMenu.component === 'string'}
|
|
40
|
+
{@html $secondaryMenu.component}
|
|
41
|
+
{:else}
|
|
42
|
+
<svelte:component this={$secondaryMenu.component} {...$secondaryMenu.props} />
|
|
43
|
+
{/if}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
{/if}
|
|
47
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type SecondaryMenuProps = typeof __propDef.props;
|
|
10
|
+
export type SecondaryMenuEvents = typeof __propDef.events;
|
|
11
|
+
export type SecondaryMenuSlots = typeof __propDef.slots;
|
|
12
|
+
export default class SecondaryMenu extends SvelteComponentTyped<SecondaryMenuProps, SecondaryMenuEvents, SecondaryMenuSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SvelteComponent } from 'svelte';
|
|
2
|
+
export declare const SECONDARY_MENU_ID: "app-secondary-menu";
|
|
3
|
+
export interface SecondaryMenuStore {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
component?: typeof SvelteComponent | string;
|
|
6
|
+
props: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
export declare const secondaryMenu: {
|
|
9
|
+
readonly subscribe: (this: void, run: import("svelte/store").Subscriber<SecondaryMenuStore>, invalidate?: ((value?: SecondaryMenuStore | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
|
|
10
|
+
readonly open: (component: SecondaryMenuStore['component'], props?: SecondaryMenuStore['props']) => void;
|
|
11
|
+
readonly close: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { writable } from 'svelte/store';
|
|
2
|
+
export const SECONDARY_MENU_ID = 'app-secondary-menu';
|
|
3
|
+
const store = writable({ isOpen: false, component: undefined, props: {} });
|
|
4
|
+
export const secondaryMenu = {
|
|
5
|
+
subscribe: store.subscribe,
|
|
6
|
+
open: (component, props = {}) => {
|
|
7
|
+
store.set({ isOpen: true, component, props });
|
|
8
|
+
},
|
|
9
|
+
close: () => store.set({ isOpen: false, component: undefined, props: {} })
|
|
10
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReadFileAs } from '../common/fileInput/model';
|
|
2
2
|
import type { InlineScript } from './types';
|
|
3
|
-
export type InputType = 'text' | 'textarea' | 'template' | 'number' | 'boolean' | 'select' | 'icon-select' | 'color' | 'date' | 'time' | 'datetime' | 'object' | 'array' | 'any' | 'labeledresource' | 'tab-select';
|
|
3
|
+
export type InputType = 'text' | 'textarea' | 'template' | 'number' | 'boolean' | 'select' | 'icon-select' | 'color' | 'date' | 'time' | 'datetime' | 'object' | 'array' | 'any' | 'labeledresource' | 'labeledselect' | 'tab-select';
|
|
4
4
|
export type InputConnection = {
|
|
5
5
|
componentId: string;
|
|
6
6
|
path: string;
|
|
@@ -81,7 +81,7 @@ export type StaticOptions = {
|
|
|
81
81
|
label: string;
|
|
82
82
|
}[];
|
|
83
83
|
};
|
|
84
|
-
export type AppInput = AppInputSpec<'text', string> | AppInputSpec<'textarea', string> | AppInputSpec<'template', string> | AppInputSpec<'number', number> | AppInputSpec<'boolean', boolean> | AppInputSpec<'date', string> | AppInputSpec<'time', string> | AppInputSpec<'datetime', string> | AppInputSpec<'any', any> | AppInputSpec<'object', Record<string | number, any>> | AppInputSpec<'object', string> | (AppInputSpec<'select', string> & StaticOptions) | AppInputSpec<'icon-select', string> | AppInputSpec<'color', string> | AppInputSpec<'array', string[], 'text'> | AppInputSpec<'array', string[], 'textarea'> | AppInputSpec<'array', number[], 'number'> | AppInputSpec<'array', boolean[], 'boolean'> | AppInputSpec<'array', string[], 'date'> | AppInputSpec<'array', string[], 'time'> | AppInputSpec<'array', string[], 'datetime'> | AppInputSpec<'array', object[], 'object'> | (AppInputSpec<'array', string[], 'select'> & StaticOptions) | AppInputSpec<'array', object[], 'labeledresource'> | AppInputSpec<'labeledresource', object> | AppInputSpec<'array', object[], 'tab-select'>;
|
|
84
|
+
export type AppInput = AppInputSpec<'text', string> | AppInputSpec<'textarea', string> | AppInputSpec<'template', string> | AppInputSpec<'number', number> | AppInputSpec<'boolean', boolean> | AppInputSpec<'date', string> | AppInputSpec<'time', string> | AppInputSpec<'datetime', string> | AppInputSpec<'any', any> | AppInputSpec<'object', Record<string | number, any>> | AppInputSpec<'object', string> | (AppInputSpec<'select', string> & StaticOptions) | AppInputSpec<'icon-select', string> | AppInputSpec<'color', string> | AppInputSpec<'array', string[], 'text'> | AppInputSpec<'array', string[], 'textarea'> | AppInputSpec<'array', number[], 'number'> | AppInputSpec<'array', boolean[], 'boolean'> | AppInputSpec<'array', string[], 'date'> | AppInputSpec<'array', string[], 'time'> | AppInputSpec<'array', string[], 'datetime'> | AppInputSpec<'array', object[], 'object'> | (AppInputSpec<'array', string[], 'select'> & StaticOptions) | AppInputSpec<'array', object[], 'labeledresource'> | AppInputSpec<'array', object[], 'labeledselect'> | AppInputSpec<'labeledselect', object> | AppInputSpec<'labeledresource', object> | AppInputSpec<'array', object[], 'tab-select'>;
|
|
85
85
|
export type RowAppInput = Extract<AppInput, {
|
|
86
86
|
type: 'row';
|
|
87
87
|
}>;
|
package/components/apps/rx.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import type { AppInput } from './inputType';
|
|
|
2
2
|
import { type Writable } from 'svelte/store';
|
|
3
3
|
export interface Subscriber<T> {
|
|
4
4
|
id?: string;
|
|
5
|
-
next(v: T):
|
|
5
|
+
next(v: T): void;
|
|
6
6
|
}
|
|
7
7
|
export interface Observable<T> {
|
|
8
|
-
subscribe(x: Subscriber<T>):
|
|
8
|
+
subscribe(x: Subscriber<T>): void;
|
|
9
9
|
}
|
|
10
10
|
export interface Output<T> extends Observable<T> {
|
|
11
11
|
set(x: T, force?: boolean): void;
|
|
@@ -12,7 +12,8 @@ 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
|
|
15
|
+
export let selectedIds;
|
|
16
|
+
export let allIdsInPath;
|
|
16
17
|
export let containerWidth = undefined;
|
|
17
18
|
export let scroller = undefined;
|
|
18
19
|
export let sensor = 20;
|
|
@@ -23,12 +24,6 @@ $: [gapX, gapY] = gap;
|
|
|
23
24
|
let xPerPx = 0;
|
|
24
25
|
let yPerPx = rowHeight;
|
|
25
26
|
$: containerHeight = getContainerHeight(items, yPerPx, getComputedCols);
|
|
26
|
-
const pointerup = (ev) => {
|
|
27
|
-
dispatch('pointerup', {
|
|
28
|
-
id: ev.detail.id,
|
|
29
|
-
cols: getComputedCols
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
27
|
const onResize = throttle(() => {
|
|
33
28
|
items = specifyUndefinedColumns(items, getComputedCols, cols);
|
|
34
29
|
dispatch('resize', {
|
|
@@ -84,23 +79,28 @@ const updateMatrix = ({ detail }) => {
|
|
|
84
79
|
}
|
|
85
80
|
citems = JSON.parse(JSON.stringify(initItems));
|
|
86
81
|
}
|
|
87
|
-
let
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
82
|
+
let nselectedIds = selectedIds ?? [];
|
|
83
|
+
if (detail.id && !selectedIds?.includes(detail.id)) {
|
|
84
|
+
nselectedIds = [detail.id, ...(selectedIds ?? [])];
|
|
85
|
+
}
|
|
86
|
+
sortedItems = citems;
|
|
87
|
+
for (let id of nselectedIds) {
|
|
88
|
+
let activeItem = getItemById(id, sortedItems);
|
|
89
|
+
if (activeItem) {
|
|
90
|
+
activeItem = {
|
|
91
|
+
...activeItem,
|
|
92
|
+
[getComputedCols]: {
|
|
93
|
+
...activeItem[getComputedCols],
|
|
94
|
+
...shadows[id]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
sortedItems = moveItem(activeItem, sortedItems, getComputedCols, getItemById(id, sortedItems));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (let id of nselectedIds ?? []) {
|
|
101
|
+
if (detail.activate) {
|
|
102
|
+
moveResizes?.[id]?.inActivate();
|
|
103
|
+
}
|
|
104
104
|
}
|
|
105
105
|
if (isPointerUp) {
|
|
106
106
|
dispatch('redraw', sortGridItemsPosition(JSON.parse(JSON.stringify(sortedItems)), getComputedCols));
|
|
@@ -115,15 +115,35 @@ 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
|
+
}
|
|
118
135
|
</script>
|
|
119
136
|
|
|
120
137
|
<div class="svlt-grid-container" style="height: {containerHeight}px" bind:this={container}>
|
|
121
138
|
{#if xPerPx || !fastStart}
|
|
122
139
|
{#each sortedItems as item (item.id)}
|
|
123
140
|
<MoveResize
|
|
141
|
+
on:initmove={handleInitMove}
|
|
142
|
+
on:move={handleMove}
|
|
143
|
+
bind:shadow={shadows[item.id]}
|
|
144
|
+
bind:this={moveResizes[item.id]}
|
|
124
145
|
on:repaint={handleRepaint}
|
|
125
|
-
|
|
126
|
-
onTop={item.id == onTopId}
|
|
146
|
+
onTop={Boolean(allIdsInPath?.includes(item.id))}
|
|
127
147
|
id={item.id}
|
|
128
148
|
{xPerPx}
|
|
129
149
|
{yPerPx}
|
|
@@ -140,16 +160,9 @@ const handleRepaint = ({ detail }) => {
|
|
|
140
160
|
{sensor}
|
|
141
161
|
container={scroller}
|
|
142
162
|
nativeContainer={container}
|
|
143
|
-
let:resizePointerDown
|
|
144
|
-
let:movePointerDown
|
|
145
163
|
>
|
|
146
164
|
{#if item[getComputedCols]}
|
|
147
|
-
<slot
|
|
148
|
-
{movePointerDown}
|
|
149
|
-
{resizePointerDown}
|
|
150
|
-
dataItem={item}
|
|
151
|
-
item={item[getComputedCols]}
|
|
152
|
-
/>
|
|
165
|
+
<slot dataItem={item} item={item[getComputedCols]} />
|
|
153
166
|
{/if}
|
|
154
167
|
</MoveResize>
|
|
155
168
|
{/each}
|
|
@@ -160,4 +173,7 @@ const handleRepaint = ({ detail }) => {
|
|
|
160
173
|
.svlt-grid-container {
|
|
161
174
|
position: relative;
|
|
162
175
|
width: 100%;
|
|
176
|
+
-webkit-user-select: none;
|
|
177
|
+
-moz-user-select: none;
|
|
178
|
+
user-select: none;
|
|
163
179
|
}</style>
|
|
@@ -9,29 +9,28 @@ declare class __sveltets_Render<T> {
|
|
|
9
9
|
fastStart?: boolean | undefined;
|
|
10
10
|
throttleUpdate?: number | undefined;
|
|
11
11
|
throttleResize?: number | undefined;
|
|
12
|
-
|
|
12
|
+
selectedIds: string[] | undefined;
|
|
13
|
+
allIdsInPath: string[] | undefined;
|
|
13
14
|
containerWidth?: number | undefined;
|
|
14
15
|
scroller?: HTMLElement | undefined;
|
|
15
16
|
sensor?: number | undefined;
|
|
16
17
|
parentWidth?: number | undefined;
|
|
18
|
+
handleMove?: (({ detail }: {
|
|
19
|
+
detail: any;
|
|
20
|
+
}) => void) | undefined;
|
|
21
|
+
handleInitMove?: (({ detail }: {
|
|
22
|
+
detail: any;
|
|
23
|
+
}) => void) | undefined;
|
|
17
24
|
};
|
|
18
25
|
events(): {
|
|
19
|
-
pointerup: CustomEvent<any>;
|
|
20
26
|
resize: CustomEvent<any>;
|
|
21
27
|
mount: CustomEvent<any>;
|
|
22
|
-
change: CustomEvent<any>;
|
|
23
28
|
redraw: CustomEvent<any>;
|
|
24
29
|
} & {
|
|
25
30
|
[evt: string]: CustomEvent<any>;
|
|
26
31
|
};
|
|
27
32
|
slots(): {
|
|
28
33
|
default: {
|
|
29
|
-
movePointerDown: ({ clientX, clientY, target }: {
|
|
30
|
-
clientX: any;
|
|
31
|
-
clientY: any;
|
|
32
|
-
target: any;
|
|
33
|
-
}) => void;
|
|
34
|
-
resizePointerDown: (e: any) => void;
|
|
35
34
|
dataItem: FilledItem<T>;
|
|
36
35
|
item: Required<import("./types").ItemLayout>;
|
|
37
36
|
};
|
|
@@ -41,5 +40,11 @@ export type GridProps<T> = ReturnType<__sveltets_Render<T>['props']>;
|
|
|
41
40
|
export type GridEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
|
|
42
41
|
export type GridSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
|
|
43
42
|
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;
|
|
44
49
|
}
|
|
45
50
|
export {};
|