poe-svelte-ui-lib 1.2.29 → 1.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/Accordion/AccordionProps.svelte +4 -4
  2. package/dist/Accordion/AccordionProps.svelte.d.ts +7 -2
  3. package/dist/Button/Button.svelte +0 -1
  4. package/dist/Button/ButtonProps.svelte +18 -19
  5. package/dist/Button/ButtonProps.svelte.d.ts +7 -2
  6. package/dist/ColorPicker/ColorPickerProps.svelte +7 -8
  7. package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +7 -2
  8. package/dist/FileAttach/FileAttach.svelte +2 -13
  9. package/dist/FileAttach/FileAttach.svelte.d.ts +2 -20
  10. package/dist/FileAttach/FileAttachProps.svelte +72 -5
  11. package/dist/FileAttach/FileAttachProps.svelte.d.ts +8 -4
  12. package/dist/Graph/GraphProps.svelte +27 -48
  13. package/dist/Graph/GraphProps.svelte.d.ts +7 -2
  14. package/dist/Input/Input.svelte +21 -21
  15. package/dist/Input/InputProps.svelte +10 -16
  16. package/dist/Input/InputProps.svelte.d.ts +7 -2
  17. package/dist/Joystick/Joystick.svelte +100 -105
  18. package/dist/Joystick/JoystickProps.svelte +347 -0
  19. package/dist/Joystick/JoystickProps.svelte.d.ts +15 -25
  20. package/dist/Map/Map.svelte +1 -1
  21. package/dist/Map/MapProps.svelte +17 -8
  22. package/dist/Map/MapProps.svelte.d.ts +7 -2
  23. package/dist/ProgressBar/ProgressBar.svelte +31 -6
  24. package/dist/ProgressBar/ProgressBarProps.svelte +4 -4
  25. package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +7 -2
  26. package/dist/Select/Select.svelte +0 -1
  27. package/dist/Select/SelectProps.svelte +51 -12
  28. package/dist/Select/SelectProps.svelte.d.ts +7 -2
  29. package/dist/Slider/Slider.svelte +7 -8
  30. package/dist/Slider/SliderProps.svelte +8 -7
  31. package/dist/Slider/SliderProps.svelte.d.ts +7 -2
  32. package/dist/Switch/Switch.svelte +1 -1
  33. package/dist/Switch/SwitchProps.svelte +49 -40
  34. package/dist/Switch/SwitchProps.svelte.d.ts +7 -2
  35. package/dist/Table/Table.svelte +7 -2
  36. package/dist/Table/TableProps.svelte +32 -12
  37. package/dist/Table/TableProps.svelte.d.ts +7 -2
  38. package/dist/Tabs/TabsProps.svelte +10 -11
  39. package/dist/Tabs/TabsProps.svelte.d.ts +7 -2
  40. package/dist/TextField/TextFieldProps.svelte +3 -5
  41. package/dist/TextField/TextFieldProps.svelte.d.ts +7 -2
  42. package/dist/index.d.ts +1 -0
  43. package/dist/index.js +1 -0
  44. package/dist/locales/translations.js +3 -0
  45. package/dist/types.d.ts +46 -11
  46. package/dist/types.js +10 -1
  47. 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: (value?: string | object, name?: string, access?: string) => void
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(null, null, option.value)}
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(null, null, option.value)}
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: (value?: string | object, name?: string, access?: string) => void;
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, {}, "">;
@@ -7,7 +7,6 @@
7
7
 
8
8
  let {
9
9
  id = crypto.randomUUID(),
10
-
11
10
  wrapperClass = '',
12
11
  componentClass = '',
13
12
  disabled = false,
@@ -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: (value?: string | object, name?: string, access?: string) => void
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.properties.eventHandler.Value)
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.properties.eventHandler.Header) ?? {
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
- updateProperty('eventHandler.Header', Header.value as string, component, onPropertyChange)
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.properties.eventHandler.Argument) ??
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
- updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
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.properties.eventHandler.Argument}
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) => updateProperty('eventHandler.Argument', value as string, component, onPropertyChange)}
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.properties.eventHandler.Argument !== 'Save' && component.properties.eventHandler.Argument !== 'NoSave') || Header.value === 'SET'}
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.properties.eventHandler.Value}
83
+ value={component.eventHandler.Value}
85
84
  help={{ info: $t('constructor.props.value.info') }}
86
85
  maxlength={500}
87
- onUpdate={(value) => updateProperty('eventHandler.Value', value as string, component, onPropertyChange)}
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.properties.eventHandler.Variables.join(' ')}
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
- updateProperty('eventHandler.Variables', parts, component, onPropertyChange)
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(null, null, option.value)}
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(null, null, option.value)}
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: (value?: string | object, name?: string, access?: string) => void;
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: (value?: string | object, name?: string, access?: string) => void
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
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
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.properties.eventHandler.Argument)}
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
- updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
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(null, null, option.value)}
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(null, null, option.value)}
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: (value?: string | object, name?: string, access?: string) => void;
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,18 +1,7 @@
1
1
  <script lang="ts">
2
+ import type { IFileAttachProps } from '../types'
2
3
  import { twMerge } from 'tailwind-merge'
3
4
 
4
- export interface IFileInputProps {
5
- id?: string
6
- wrapperClass?: string
7
- label?: { name?: string; class?: string }
8
- type?: 'file' | 'image'
9
- accept?: string
10
- imageSize?: { height?: string; width?: string; fitMode?: 'cover' | 'contain'; form?: 'square' | 'circle' }
11
- disabled?: boolean
12
- currentImage?: string | null
13
- onChange?: (event: Event, file: File | null) => void
14
- }
15
-
16
5
  let {
17
6
  id = crypto.randomUUID(),
18
7
  wrapperClass = '',
@@ -23,7 +12,7 @@
23
12
  disabled = false,
24
13
  currentImage = $bindable(''),
25
14
  onChange = () => {},
26
- }: IFileInputProps = $props()
15
+ }: IFileAttachProps = $props()
27
16
 
28
17
  let ID = `${id}-${crypto.randomUUID().slice(0, 6)}`
29
18
  let selectedFile = $state<File | null>(null)
@@ -1,22 +1,4 @@
1
- export interface IFileInputProps {
2
- id?: string;
3
- wrapperClass?: string;
4
- label?: {
5
- name?: string;
6
- class?: string;
7
- };
8
- type?: 'file' | 'image';
9
- accept?: string;
10
- imageSize?: {
11
- height?: string;
12
- width?: string;
13
- fitMode?: 'cover' | 'contain';
14
- form?: 'square' | 'circle';
15
- };
16
- disabled?: boolean;
17
- currentImage?: string | null;
18
- onChange?: (event: Event, file: File | null) => void;
19
- }
20
- declare const FileAttach: import("svelte").Component<IFileInputProps, {}, "currentImage">;
1
+ import type { IFileAttachProps } from '../types';
2
+ declare const FileAttach: import("svelte").Component<IFileAttachProps, {}, "currentImage">;
21
3
  type FileAttach = ReturnType<typeof FileAttach>;
22
4
  export default FileAttach;
@@ -1,23 +1,76 @@
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 IFileAttachProps, type IUIComponentHandler, type UIComponent, updateProperty } from '../types'
5
5
  import * as UI from '..'
6
6
  import { optionsStore } from '../options'
7
- import type { IFileInputProps } from './FileAttach.svelte'
7
+ import { getContext } from 'svelte'
8
+ import { twMerge } from 'tailwind-merge'
8
9
 
9
10
  const {
10
11
  component,
11
12
  onPropertyChange,
12
13
  forConstructor = true,
13
14
  } = $props<{
14
- component: UIComponent & { properties: Partial<IFileInputProps> }
15
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void
15
+ component: UIComponent & { properties: Partial<IFileAttachProps> }
16
+ onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
16
17
  forConstructor?: boolean
17
18
  }>()
19
+
20
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
21
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
22
+
23
+ const initialAlign = $derived(
24
+ $optionsStore.TEXT_ALIGN_OPTIONS.find((a) =>
25
+ (a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
26
+ ),
27
+ )
18
28
  </script>
19
29
 
20
- {#if !forConstructor}
30
+ {#if forConstructor}
31
+ <div class="relative flex flex-row items-start justify-center">
32
+ <!-- Сообщение для отправки в ws по нажатию кнопки -->
33
+ <div class="flex w-1/3 flex-col items-center px-2">
34
+ <UI.Select
35
+ label={{ name: $t('constructor.props.variable') }}
36
+ options={VARIABLE_OPTIONS}
37
+ value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
38
+ onUpdate={(value) => {
39
+ updateProperty('id', value.value as string, component, onPropertyChange)
40
+ onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
41
+ }}
42
+ />
43
+ <UI.Select
44
+ label={{ name: $t('constructor.props.access') }}
45
+ type="buttons"
46
+ options={$optionsStore.ACCESS_OPTION}
47
+ value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
48
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
49
+ />
50
+ </div>
51
+ <div class="flex w-1/3 flex-col px-2">
52
+ <UI.Input
53
+ label={{ name: $t('constructor.props.label') }}
54
+ value={component.properties.label.name}
55
+ onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
56
+ />
57
+ <UI.Select
58
+ label={{ name: $t('constructor.props.align') }}
59
+ type="buttons"
60
+ value={initialAlign}
61
+ options={$optionsStore.TEXT_ALIGN_OPTIONS}
62
+ onUpdate={(option) => updateProperty('label.class', twMerge(component.properties.label.class, option.value), component, onPropertyChange)}
63
+ />
64
+ </div>
65
+ <div class="flex w-1/3 flex-col px-2">
66
+ <UI.Input
67
+ label={{ name: $t('constructor.props.file.accept') }}
68
+ value={component.properties.accept}
69
+ onUpdate={(value) => updateProperty('accept', value as string, component, onPropertyChange)}
70
+ />
71
+ </div>
72
+ </div>
73
+ {:else}
21
74
  <div class="relative flex flex-row items-start justify-center">
22
75
  <!-- Сообщение для отправки в ws по нажатию кнопки -->
23
76
  <div class="flex w-1/3 flex-col items-center px-2">
@@ -26,6 +79,13 @@
26
79
  value={component.properties.id}
27
80
  onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
28
81
  />
82
+ <UI.Select
83
+ label={{ name: $t('constructor.props.access') }}
84
+ type="buttons"
85
+ options={$optionsStore.ACCESS_OPTION}
86
+ value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
87
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
88
+ />
29
89
  <UI.Input
30
90
  label={{ name: $t('constructor.props.wrapperclass') }}
31
91
  value={component.properties.wrapperClass}
@@ -43,6 +103,13 @@
43
103
  value={component.properties.label.class}
44
104
  onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
45
105
  />
106
+ <UI.Switch
107
+ wrapperClass="bg-blue"
108
+ label={{ name: $t('constructor.props.disabled') }}
109
+ value={component.properties.disabled}
110
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
111
+ onChange={(value) => updateProperty('disabled', value, component, onPropertyChange)}
112
+ />
46
113
  </div>
47
114
  <div class="flex w-1/3 flex-col px-2">
48
115
  <UI.Input
@@ -1,10 +1,14 @@
1
- import { type UIComponent } from '../types';
2
- import type { IFileInputProps } from './FileAttach.svelte';
1
+ import { type IFileAttachProps, type IUIComponentHandler, type UIComponent } from '../types';
3
2
  type $$ComponentProps = {
4
3
  component: UIComponent & {
5
- properties: Partial<IFileInputProps>;
4
+ properties: Partial<IFileAttachProps>;
6
5
  };
7
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
6
+ onPropertyChange: (updates: Partial<{
7
+ properties?: string | object;
8
+ name?: string;
9
+ access?: string;
10
+ eventHandler?: IUIComponentHandler;
11
+ }>) => void;
8
12
  forConstructor?: boolean;
9
13
  };
10
14
  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: (value?: string | object, name?: string, access?: string) => void
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
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
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"></div>
37
- <div class="flex w-1/3 flex-col px-2"></div>
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: (value?: string | object, name?: string, access?: string) => void;
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, {}, "">;
@@ -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
- type="button"
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
- <svg xmlns="http://www.w3.org/2000/svg" width="1.3em" height="1.3em" viewBox="0 0 24 24">
154
- <g fill="none" stroke="currentColor" stroke-width="1.5">
155
- <path
156
- 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"
157
- />
158
- <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" />
159
- </g>
160
- </svg>
161
- </button>
162
-
163
- {#if isCopied}
164
- <div
165
- class="absolute top-1/2 right-10 -translate-y-1/2 transform rounded-md bg-(--green-color) px-2 py-1 text-sm shadow-lg"
166
- transition:fly={{ x: 10, duration: 200 }}
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
- {/if}
170
+ </button>
171
171
  {/if}
172
172
 
173
173
  {#if type === 'number' && !readonly && !disabled}