poe-svelte-ui-lib 1.2.29 → 1.2.30
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/dist/Accordion/AccordionProps.svelte +4 -4
- package/dist/Accordion/AccordionProps.svelte.d.ts +7 -2
- package/dist/Button/Button.svelte +0 -1
- package/dist/Button/ButtonProps.svelte +18 -19
- package/dist/Button/ButtonProps.svelte.d.ts +7 -2
- package/dist/ColorPicker/ColorPickerProps.svelte +7 -8
- package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +7 -2
- package/dist/FileAttach/FileAttachProps.svelte +2 -2
- package/dist/FileAttach/FileAttachProps.svelte.d.ts +7 -2
- package/dist/Graph/GraphProps.svelte +27 -48
- package/dist/Graph/GraphProps.svelte.d.ts +7 -2
- package/dist/Input/Input.svelte +21 -21
- package/dist/Input/InputProps.svelte +8 -14
- package/dist/Input/InputProps.svelte.d.ts +7 -2
- package/dist/Joystick/Joystick.svelte +59 -56
- package/dist/Joystick/JoystickProps.svelte +215 -0
- package/dist/Joystick/JoystickProps.svelte.d.ts +15 -25
- package/dist/Map/Map.svelte +1 -1
- package/dist/Map/MapProps.svelte +17 -8
- package/dist/Map/MapProps.svelte.d.ts +7 -2
- package/dist/ProgressBar/ProgressBarProps.svelte +4 -4
- package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +7 -2
- package/dist/Select/Select.svelte +0 -1
- package/dist/Select/SelectProps.svelte +51 -12
- package/dist/Select/SelectProps.svelte.d.ts +7 -2
- package/dist/Slider/Slider.svelte +3 -2
- package/dist/Slider/SliderProps.svelte +8 -7
- package/dist/Slider/SliderProps.svelte.d.ts +7 -2
- package/dist/Switch/Switch.svelte +1 -1
- package/dist/Switch/SwitchProps.svelte +49 -40
- package/dist/Switch/SwitchProps.svelte.d.ts +7 -2
- package/dist/Table/Table.svelte +7 -2
- package/dist/Table/TableProps.svelte +32 -12
- package/dist/Table/TableProps.svelte.d.ts +7 -2
- package/dist/Tabs/TabsProps.svelte +10 -11
- package/dist/Tabs/TabsProps.svelte.d.ts +7 -2
- package/dist/TextField/TextFieldProps.svelte +3 -5
- package/dist/TextField/TextFieldProps.svelte.d.ts +7 -2
- package/dist/types.d.ts +24 -8
- package/dist/types.js +10 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/AccordionProps.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { t } from '../locales/i18n'
|
|
4
|
-
import { updateProperty, type IAccordionProps, type UIComponent } from '../types'
|
|
4
|
+
import { updateProperty, type IAccordionProps, type IUIComponentHandler, type UIComponent } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
6
|
import { optionsStore } from '../options'
|
|
7
7
|
import { ICONS } from '../icons'
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
forConstructor = true,
|
|
16
16
|
} = $props<{
|
|
17
17
|
component: UIComponent & { properties: Partial<IAccordionProps> }
|
|
18
|
-
onPropertyChange: (
|
|
18
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
19
19
|
forConstructor?: boolean
|
|
20
20
|
}>()
|
|
21
21
|
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
type="buttons"
|
|
54
54
|
options={$optionsStore.ACCESS_OPTION}
|
|
55
55
|
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
56
|
-
onUpdate={(option) => onPropertyChange(
|
|
56
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
57
57
|
/>
|
|
58
58
|
<UI.Input
|
|
59
59
|
label={{ name: $t('constructor.props.label') }}
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
type="buttons"
|
|
150
150
|
options={$optionsStore.ACCESS_OPTION}
|
|
151
151
|
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
152
|
-
onUpdate={(option) => onPropertyChange(
|
|
152
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
153
153
|
/>
|
|
154
154
|
<UI.Select
|
|
155
155
|
label={{ name: $t('constructor.props.type') }}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { type IAccordionProps, type UIComponent } from '../types';
|
|
1
|
+
import { type IAccordionProps, type IUIComponentHandler, type UIComponent } from '../types';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<IAccordionProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (
|
|
6
|
+
onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void;
|
|
7
12
|
forConstructor?: boolean;
|
|
8
13
|
};
|
|
9
14
|
declare const AccordionProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/ButtonProps.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { Language, t } from '../locales/i18n'
|
|
4
|
-
import { type UIComponent, type IButtonProps, type ISelectOption, updateProperty } from '../types'
|
|
4
|
+
import { type UIComponent, type IButtonProps, type ISelectOption, updateProperty, type IUIComponentHandler } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
6
|
import { optionsStore } from '../options'
|
|
7
7
|
import { twMerge } from 'tailwind-merge'
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
forConstructor = true,
|
|
13
13
|
} = $props<{
|
|
14
14
|
component: UIComponent & { properties: Partial<IButtonProps> }
|
|
15
|
-
onPropertyChange: (
|
|
15
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
16
16
|
forConstructor?: boolean
|
|
17
17
|
}>()
|
|
18
18
|
|
|
19
|
-
let hasValue: boolean = $derived(component.
|
|
19
|
+
let hasValue: boolean = $derived(component.eventHandler.Value)
|
|
20
20
|
|
|
21
21
|
let Header: ISelectOption = $derived(
|
|
22
|
-
$optionsStore.HEADER_OPTIONS.find((h) => h.value === component.
|
|
22
|
+
$optionsStore.HEADER_OPTIONS.find((h) => h.value === component.eventHandler.Header) ?? {
|
|
23
23
|
id: '',
|
|
24
24
|
name: '',
|
|
25
25
|
value: '',
|
|
@@ -50,52 +50,51 @@
|
|
|
50
50
|
value={Header}
|
|
51
51
|
options={$optionsStore.HEADER_OPTIONS}
|
|
52
52
|
onUpdate={(option) => {
|
|
53
|
-
Header = option
|
|
54
|
-
|
|
53
|
+
Header = { ...option }
|
|
54
|
+
onPropertyChange({ eventHandler: { Header: Header.value as string } })
|
|
55
55
|
}}
|
|
56
56
|
/>
|
|
57
57
|
{#if Header.value === 'SET'}
|
|
58
58
|
<UI.Select
|
|
59
59
|
label={{ name: $t('constructor.props.argument') }}
|
|
60
60
|
type="buttons"
|
|
61
|
-
value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.
|
|
61
|
+
value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.eventHandler.Argument) ??
|
|
62
62
|
$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === '')}
|
|
63
63
|
options={$optionsStore.FULL_ARGUMENT_OPTION}
|
|
64
64
|
onUpdate={(option) => {
|
|
65
|
-
|
|
65
|
+
onPropertyChange({ eventHandler: { Argument: option.value as string } })
|
|
66
66
|
}}
|
|
67
67
|
/>
|
|
68
68
|
{/if}
|
|
69
69
|
<UI.Input
|
|
70
70
|
label={{ name: Header.value !== 'SET' ? $t('constructor.props.argument') : '' }}
|
|
71
71
|
wrapperClass="{Header.value === 'SET' ? 'mt-1' : ''} "
|
|
72
|
-
value={component.
|
|
72
|
+
value={component.eventHandler.Argument}
|
|
73
73
|
maxlength={32}
|
|
74
|
-
disabled={Header.value === 'SET' &&
|
|
75
|
-
(component.properties.eventHandler.Argument == 'Save' || component.properties.eventHandler.Argument == 'NoSave')}
|
|
74
|
+
disabled={Header.value === 'SET' && (component.eventHandler.Argument == 'Save' || component.eventHandler.Argument == 'NoSave')}
|
|
76
75
|
help={{ info: $t('constructor.props.argument.info'), autocomplete: 'on', regExp: /^[a-zA-Z0-9\-_]{0,32}$/ }}
|
|
77
|
-
onUpdate={(value) =>
|
|
76
|
+
onUpdate={(value) => onPropertyChange({ eventHandler: { Argument: value as string } })}
|
|
78
77
|
/>
|
|
79
78
|
</div>
|
|
80
79
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
81
|
-
{#if (component.
|
|
80
|
+
{#if (component.eventHandler.Argument !== 'Save' && component.eventHandler.Argument !== 'NoSave') || Header.value === 'SET'}
|
|
82
81
|
<UI.Input
|
|
83
82
|
label={{ name: $t('constructor.props.value') }}
|
|
84
|
-
value={component.
|
|
83
|
+
value={component.eventHandler.Value}
|
|
85
84
|
help={{ info: $t('constructor.props.value.info') }}
|
|
86
85
|
maxlength={500}
|
|
87
|
-
onUpdate={(value) =>
|
|
86
|
+
onUpdate={(value) => onPropertyChange({ eventHandler: { Value: value as string } })}
|
|
88
87
|
/>
|
|
89
88
|
{/if}
|
|
90
89
|
<UI.Input
|
|
91
90
|
label={{ name: $t('constructor.props.variables') }}
|
|
92
91
|
disabled={hasValue}
|
|
93
|
-
value={component.
|
|
92
|
+
value={component.eventHandler.Variables.join(' ')}
|
|
94
93
|
help={{ info: $t('constructor.props.variables.info'), autocomplete: 'on', regExp: /^[a-zA-Z0-9\-_ ":{}]{0,500}$/ }}
|
|
95
94
|
maxlength={500}
|
|
96
95
|
onUpdate={(value) => {
|
|
97
96
|
const parts = (value as string).trim().split(/\s+/)
|
|
98
|
-
|
|
97
|
+
onPropertyChange({ eventHandler: { Variables: parts } })
|
|
99
98
|
}}
|
|
100
99
|
/>
|
|
101
100
|
<UI.Select
|
|
@@ -103,7 +102,7 @@
|
|
|
103
102
|
type="buttons"
|
|
104
103
|
options={$optionsStore.ACCESS_OPTION}
|
|
105
104
|
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
106
|
-
onUpdate={(option) => onPropertyChange(
|
|
105
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
107
106
|
/>
|
|
108
107
|
</div>
|
|
109
108
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
@@ -145,7 +144,7 @@
|
|
|
145
144
|
type="buttons"
|
|
146
145
|
options={$optionsStore.ACCESS_OPTION}
|
|
147
146
|
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
148
|
-
onUpdate={(option) => onPropertyChange(
|
|
147
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
149
148
|
/>
|
|
150
149
|
<UI.Input
|
|
151
150
|
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { type UIComponent, type IButtonProps } from '../types';
|
|
1
|
+
import { type UIComponent, type IButtonProps, type IUIComponentHandler } from '../types';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<IButtonProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (
|
|
6
|
+
onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void;
|
|
7
12
|
forConstructor?: boolean;
|
|
8
13
|
};
|
|
9
14
|
declare const ButtonProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/ButtonProps.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { t } from '../locales/i18n'
|
|
4
|
-
import { type UIComponent, type IColorPickerProps, updateProperty } from '../types'
|
|
4
|
+
import { type UIComponent, type IColorPickerProps, updateProperty, type IUIComponentHandler } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
6
|
import { getContext } from 'svelte'
|
|
7
7
|
import { optionsStore } from '../options'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
forConstructor = true,
|
|
13
13
|
} = $props<{
|
|
14
14
|
component: UIComponent & { properties: Partial<IColorPickerProps> }
|
|
15
|
-
onPropertyChange: (
|
|
15
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
16
16
|
forConstructor?: boolean
|
|
17
17
|
}>()
|
|
18
18
|
|
|
@@ -36,17 +36,16 @@
|
|
|
36
36
|
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
37
37
|
onUpdate={(value) => {
|
|
38
38
|
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
39
|
-
|
|
40
|
-
onPropertyChange(null, value.name?.split('—')[1].trim(), null)
|
|
39
|
+
onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
|
|
41
40
|
}}
|
|
42
41
|
/>
|
|
43
42
|
<UI.Select
|
|
44
43
|
label={{ name: $t('constructor.props.action') }}
|
|
45
44
|
type="buttons"
|
|
46
|
-
value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.
|
|
45
|
+
value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.eventHandler.Argument)}
|
|
47
46
|
options={$optionsStore.SHORT_ARGUMENT_OPTION}
|
|
48
47
|
onUpdate={(option) => {
|
|
49
|
-
|
|
48
|
+
onPropertyChange({ eventHandler: { Argument: option.value as string } })
|
|
50
49
|
}}
|
|
51
50
|
/>
|
|
52
51
|
</div>
|
|
@@ -56,7 +55,7 @@
|
|
|
56
55
|
type="buttons"
|
|
57
56
|
options={$optionsStore.ACCESS_OPTION}
|
|
58
57
|
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
59
|
-
onUpdate={(option) => onPropertyChange(
|
|
58
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
60
59
|
/>
|
|
61
60
|
</div>
|
|
62
61
|
<div class="flex w-1/3 flex-col px-2">
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
type="buttons"
|
|
89
88
|
options={$optionsStore.ACCESS_OPTION}
|
|
90
89
|
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
91
|
-
onUpdate={(option) => onPropertyChange(
|
|
90
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
92
91
|
/>
|
|
93
92
|
</div>
|
|
94
93
|
<div class="flex w-1/3 flex-col px-2">
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { type UIComponent, type IColorPickerProps } from '../types';
|
|
1
|
+
import { type UIComponent, type IColorPickerProps, type IUIComponentHandler } from '../types';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<IColorPickerProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (
|
|
6
|
+
onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void;
|
|
7
12
|
forConstructor?: boolean;
|
|
8
13
|
};
|
|
9
14
|
declare const ColorPickerProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/ButtonProps.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { t } from '../locales/i18n'
|
|
4
|
-
import { type UIComponent, updateProperty } from '../types'
|
|
4
|
+
import { type IUIComponentHandler, type UIComponent, updateProperty } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
6
|
import { optionsStore } from '../options'
|
|
7
7
|
import type { IFileInputProps } from './FileAttach.svelte'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
forConstructor = true,
|
|
13
13
|
} = $props<{
|
|
14
14
|
component: UIComponent & { properties: Partial<IFileInputProps> }
|
|
15
|
-
onPropertyChange: (
|
|
15
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
16
16
|
forConstructor?: boolean
|
|
17
17
|
}>()
|
|
18
18
|
</script>
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { type UIComponent } from '../types';
|
|
1
|
+
import { type IUIComponentHandler, type UIComponent } from '../types';
|
|
2
2
|
import type { IFileInputProps } from './FileAttach.svelte';
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
component: UIComponent & {
|
|
5
5
|
properties: Partial<IFileInputProps>;
|
|
6
6
|
};
|
|
7
|
-
onPropertyChange: (
|
|
7
|
+
onPropertyChange: (updates: Partial<{
|
|
8
|
+
properties?: string | object;
|
|
9
|
+
name?: string;
|
|
10
|
+
access?: string;
|
|
11
|
+
eventHandler?: IUIComponentHandler;
|
|
12
|
+
}>) => void;
|
|
8
13
|
forConstructor?: boolean;
|
|
9
14
|
};
|
|
10
15
|
declare const FileAttachProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getContext } from 'svelte'
|
|
3
3
|
import { t } from '../locales/i18n'
|
|
4
|
-
import { type UIComponent, type IGraphProps, updateProperty } from '../types'
|
|
4
|
+
import { type UIComponent, type IGraphProps, updateProperty, type IUIComponentHandler } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
|
+
import { optionsStore } from '../options'
|
|
7
|
+
import { twMerge } from 'tailwind-merge'
|
|
6
8
|
|
|
7
9
|
const {
|
|
8
10
|
component,
|
|
@@ -10,12 +12,18 @@
|
|
|
10
12
|
forConstructor = true,
|
|
11
13
|
} = $props<{
|
|
12
14
|
component: UIComponent & { properties: Partial<IGraphProps> }
|
|
13
|
-
onPropertyChange: (
|
|
15
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
14
16
|
forConstructor?: boolean
|
|
15
17
|
}>()
|
|
16
18
|
|
|
17
19
|
const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
|
|
18
20
|
let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
|
|
21
|
+
|
|
22
|
+
const initialAlign = $derived(
|
|
23
|
+
$optionsStore.TEXT_ALIGN_OPTIONS.find((a) =>
|
|
24
|
+
(a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
25
|
+
),
|
|
26
|
+
)
|
|
19
27
|
</script>
|
|
20
28
|
|
|
21
29
|
{#if forConstructor}
|
|
@@ -28,13 +36,26 @@
|
|
|
28
36
|
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
29
37
|
onUpdate={(value) => {
|
|
30
38
|
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
31
|
-
|
|
32
|
-
onPropertyChange(null, value.name?.split('—')[1].trim(), null)
|
|
39
|
+
onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
|
|
33
40
|
}}
|
|
34
41
|
/>
|
|
35
42
|
</div>
|
|
36
|
-
<div class="flex w-1/3 flex-col px-2"
|
|
37
|
-
|
|
43
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
44
|
+
<UI.Input
|
|
45
|
+
label={{ name: $t('constructor.props.label') }}
|
|
46
|
+
value={component.properties.label.name}
|
|
47
|
+
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
51
|
+
<UI.Select
|
|
52
|
+
label={{ name: $t('constructor.props.align') }}
|
|
53
|
+
type="buttons"
|
|
54
|
+
value={initialAlign}
|
|
55
|
+
options={$optionsStore.TEXT_ALIGN_OPTIONS}
|
|
56
|
+
onUpdate={(option) => updateProperty('label.class', twMerge(component.properties.label.class, option.value), component, onPropertyChange)}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
38
59
|
</div>
|
|
39
60
|
{:else}
|
|
40
61
|
<div class="relative mb-2 flex flex-row items-start justify-center">
|
|
@@ -74,46 +95,4 @@
|
|
|
74
95
|
/>
|
|
75
96
|
</div>
|
|
76
97
|
</div>
|
|
77
|
-
<!-- <hr class="border-gray-400" />
|
|
78
|
-
<div class="space-y-4">
|
|
79
|
-
<div class="m-0 flex items-center justify-center gap-2">
|
|
80
|
-
<h4>{$t('constructor.props.graphdata.title')}</h4>
|
|
81
|
-
<UI.Button wrapperClass="w-8" content={{ icon: ButtonAdd }} />
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
{#each component.properties.streamingData.data || [] as option, index (option.name)}
|
|
85
|
-
<div class="m-0 flex items-end justify-around gap-2 border-gray-400">
|
|
86
|
-
<UI.Input
|
|
87
|
-
label={{ name: $t('constructor.props.optionname') }}
|
|
88
|
-
wrapperClass="!w-3/10"
|
|
89
|
-
value={option.name}
|
|
90
|
-
onUpdate={(value) => {
|
|
91
|
-
const options = [...(component.properties?.streamingData.data || [])]
|
|
92
|
-
options[index]['name'] = value as string
|
|
93
|
-
updateProperty('streamingData.data', options, component, onPropertyChange)
|
|
94
|
-
}}
|
|
95
|
-
/>
|
|
96
|
-
<UI.Input
|
|
97
|
-
label={{ name: $t('constructor.props.optionvalue') }}
|
|
98
|
-
wrapperClass="!w-3/10"
|
|
99
|
-
type="number"
|
|
100
|
-
value={option.value}
|
|
101
|
-
onUpdate={(value) => {
|
|
102
|
-
const options = [...(component.properties?.streamingData.data || [])]
|
|
103
|
-
options[index]['value'] = value as number
|
|
104
|
-
updateProperty('streamingData.data', options, component, onPropertyChange)
|
|
105
|
-
}}
|
|
106
|
-
/>
|
|
107
|
-
<UI.Button
|
|
108
|
-
wrapperClass="w-8"
|
|
109
|
-
content={{ icon: ButtonDelete }}
|
|
110
|
-
onClick={() => {
|
|
111
|
-
const options = [...(component.properties?.streamingData.data || [])]
|
|
112
|
-
options.splice(index, 1)
|
|
113
|
-
updateProperty('streamingData.data', options, component, onPropertyChange)
|
|
114
|
-
}}
|
|
115
|
-
/>
|
|
116
|
-
</div>
|
|
117
|
-
{/each}
|
|
118
|
-
</div> -->
|
|
119
98
|
{/if}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { type UIComponent, type IGraphProps } from '../types';
|
|
1
|
+
import { type UIComponent, type IGraphProps, type IUIComponentHandler } from '../types';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<IGraphProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (
|
|
6
|
+
onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void;
|
|
7
12
|
forConstructor?: boolean;
|
|
8
13
|
};
|
|
9
14
|
declare const GraphProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
package/dist/Input/Input.svelte
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/Input.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
|
-
import { fly } from 'svelte/transition'
|
|
3
|
+
import { fade, fly } from 'svelte/transition'
|
|
4
4
|
import type { IInputProps } from '../types'
|
|
5
5
|
import { twMerge } from 'tailwind-merge'
|
|
6
6
|
|
|
7
7
|
let {
|
|
8
8
|
id = crypto.randomUUID(),
|
|
9
|
-
|
|
10
9
|
wrapperClass = '',
|
|
11
10
|
label = { name: '', class: '' },
|
|
12
11
|
disabled = false,
|
|
@@ -140,8 +139,7 @@
|
|
|
140
139
|
|
|
141
140
|
{#if help.copyButton && (type === 'text' || type === 'text-area')}
|
|
142
141
|
<button
|
|
143
|
-
|
|
144
|
-
class="absolute right-2 flex cursor-pointer border-none bg-transparent {type === 'text-area' ? 'top-2' : ''}"
|
|
142
|
+
class="absolute right-3 flex cursor-pointer border-none bg-transparent {type === 'text-area' ? 'top-2' : ''}"
|
|
145
143
|
onclick={(e) => {
|
|
146
144
|
e.preventDefault()
|
|
147
145
|
navigator.clipboard.writeText(value as string)
|
|
@@ -150,24 +148,26 @@
|
|
|
150
148
|
}}
|
|
151
149
|
aria-label="Копировать текст"
|
|
152
150
|
>
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
151
|
+
<div class=" size-5 text-sm [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full">
|
|
152
|
+
{#if isCopied}
|
|
153
|
+
<div
|
|
154
|
+
class="right-1..5 absolute top-1/2 -translate-y-1/2 transform rounded-md bg-(--green-color) px-1.5 py-1 shadow-lg"
|
|
155
|
+
transition:fade={{ duration: 200 }}
|
|
156
|
+
>
|
|
157
|
+
✓
|
|
158
|
+
</div>
|
|
159
|
+
{:else}
|
|
160
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
161
|
+
<g fill="none" stroke="currentColor" stroke-width="1.5">
|
|
162
|
+
<path
|
|
163
|
+
d="M6 11c0-2.828 0-4.243.879-5.121C7.757 5 9.172 5 12 5h3c2.828 0 4.243 0 5.121.879C21 6.757 21 8.172 21 11v5c0 2.828 0 4.243-.879 5.121C19.243 22 17.828 22 15 22h-3c-2.828 0-4.243 0-5.121-.879C6 20.243 6 18.828 6 16z"
|
|
164
|
+
/>
|
|
165
|
+
<path d="M6 19a3 3 0 0 1-3-3v-6c0-3.771 0-5.657 1.172-6.828S7.229 2 11 2h4a3 3 0 0 1 3 3" />
|
|
166
|
+
</g>
|
|
167
|
+
</svg>
|
|
168
|
+
{/if}
|
|
169
169
|
</div>
|
|
170
|
-
|
|
170
|
+
</button>
|
|
171
171
|
{/if}
|
|
172
172
|
|
|
173
173
|
{#if type === 'number' && !readonly && !disabled}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getContext } from 'svelte'
|
|
3
3
|
import { t } from '../locales/i18n'
|
|
4
|
-
import type { IInputProps, UIComponent, ISelectOption } from '../types'
|
|
4
|
+
import type { IInputProps, UIComponent, ISelectOption, IUIComponentHandler } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
6
|
import { optionsStore } from '../options'
|
|
7
7
|
import { twMerge } from 'tailwind-merge'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
forConstructor = true,
|
|
13
13
|
} = $props<{
|
|
14
14
|
component: UIComponent & { properties: Partial<IInputProps> }
|
|
15
|
-
onPropertyChange: (
|
|
15
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
16
16
|
forConstructor?: boolean
|
|
17
17
|
}>()
|
|
18
18
|
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
obj[parts[parts.length - 1]] = value
|
|
71
|
-
onPropertyChange(newProperties, name)
|
|
71
|
+
onPropertyChange({ properties: newProperties, name })
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
const handleOptionColorChange = (color: string) => {
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
98
98
|
onUpdate={(value) => {
|
|
99
99
|
updateProperty('id', value.value as string, value.name?.split('—')[1].trim())
|
|
100
|
-
|
|
100
|
+
onPropertyChange({ eventHandler: { Variables: value.value as string } })
|
|
101
101
|
}}
|
|
102
102
|
/>
|
|
103
103
|
<UI.Select
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
type="buttons"
|
|
106
106
|
options={$optionsStore.ACCESS_OPTION}
|
|
107
107
|
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
108
|
-
onUpdate={(option) => onPropertyChange(
|
|
108
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
109
109
|
/>
|
|
110
110
|
<UI.Select
|
|
111
111
|
label={{ name: $t('constructor.props.type') }}
|
|
@@ -128,10 +128,7 @@
|
|
|
128
128
|
maxlength={150}
|
|
129
129
|
help={{ info: $t('constructor.props.regexp.info') }}
|
|
130
130
|
componentClass={isValidRegExp === false ? '!border-2 !border-red-400' : ''}
|
|
131
|
-
onUpdate={(value) =>
|
|
132
|
-
console.log(value)
|
|
133
|
-
updateProperty('help.regExp', value as string)
|
|
134
|
-
}}
|
|
131
|
+
onUpdate={(value) => updateProperty('help.regExp', value as string)}
|
|
135
132
|
/>
|
|
136
133
|
{:else if component.properties.type === 'number' && !component.properties.readonly && !component.properties.disabled}
|
|
137
134
|
<UI.Input
|
|
@@ -173,10 +170,7 @@
|
|
|
173
170
|
label={{ name: $t('constructor.props.readonly') }}
|
|
174
171
|
value={component.properties.readonly}
|
|
175
172
|
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
176
|
-
onChange={(value) =>
|
|
177
|
-
updateProperty('readonly', value)
|
|
178
|
-
console.log(component.properties)
|
|
179
|
-
}}
|
|
173
|
+
onChange={(value) => updateProperty('readonly', value)}
|
|
180
174
|
/>
|
|
181
175
|
<UI.Switch
|
|
182
176
|
label={{ name: $t('constructor.props.copy') }}
|
|
@@ -258,7 +252,7 @@
|
|
|
258
252
|
type="buttons"
|
|
259
253
|
options={$optionsStore.ACCESS_OPTION}
|
|
260
254
|
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
261
|
-
onUpdate={(option) => onPropertyChange(
|
|
255
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
262
256
|
/>
|
|
263
257
|
<UI.Input
|
|
264
258
|
label={{ name: $t('constructor.props.value') }}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import type { IInputProps, UIComponent } from '../types';
|
|
1
|
+
import type { IInputProps, UIComponent, IUIComponentHandler } from '../types';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<IInputProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (
|
|
6
|
+
onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void;
|
|
7
12
|
forConstructor?: boolean;
|
|
8
13
|
};
|
|
9
14
|
declare const InputProps: import("svelte").Component<$$ComponentProps, {}, "">;
|