poe-svelte-ui-lib 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,16 +11,8 @@
11
11
  onPropertyChange: (value: string | object, name?: string) => void
12
12
  }>()
13
13
 
14
- const DeviceVariables = getContext<string[]>('DeviceVariables')
15
- let VARIABLE_OPTIONS = $derived(
16
- DeviceVariables && Array.isArray(DeviceVariables)
17
- ? DeviceVariables.map((variable) => ({
18
- id: variable,
19
- value: variable,
20
- name: variable,
21
- }))
22
- : [],
23
- )
14
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
15
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
24
16
 
25
17
  const initialAlign = $derived(
26
18
  $optionsStore.ALIGN_OPTIONS.find((a) =>
@@ -7,19 +7,11 @@
7
7
 
8
8
  const { component, onPropertyChange } = $props<{
9
9
  component: UIComponent & { properties: Partial<IGraphProps> }
10
- onPropertyChange: (value: string | object) => void
10
+ onPropertyChange: (value: string | object, name?: string) => void
11
11
  }>()
12
12
 
13
- const DeviceVariables = getContext<string[]>('DeviceVariables')
14
- let VARIABLE_OPTIONS = $derived(
15
- DeviceVariables && Array.isArray(DeviceVariables)
16
- ? DeviceVariables.map((variable) => ({
17
- id: variable,
18
- value: variable,
19
- name: variable,
20
- }))
21
- : [],
22
- )
13
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
14
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
23
15
  </script>
24
16
 
25
17
  {#if component && component.properties}
@@ -31,7 +23,8 @@
31
23
  options={VARIABLE_OPTIONS}
32
24
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
33
25
  onUpdate={(value) => {
34
- updateProperty('id', value.value as string, component, onPropertyChange)
26
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
27
+ updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
35
28
  }}
36
29
  />
37
30
  </div>
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IGraphProps>;
5
5
  };
6
- onPropertyChange: (value: string | object) => void;
6
+ onPropertyChange: (value: string | object, name?: string) => void;
7
7
  };
8
8
  declare const GraphProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
9
  type GraphProps = ReturnType<typeof GraphProps>;
@@ -9,20 +9,12 @@
9
9
 
10
10
  const { component, onPropertyChange } = $props<{
11
11
  component: UIComponent & { properties: Partial<IInputProps> }
12
- onPropertyChange: (value: string | object) => void
12
+ onPropertyChange: (value: string | object, name?: string) => void
13
13
  }>()
14
14
 
15
15
  let isValidRegExp = $state(true)
16
- const DeviceVariables = getContext<string[]>('DeviceVariables')
17
- let VARIABLE_OPTIONS = $derived(
18
- DeviceVariables && Array.isArray(DeviceVariables)
19
- ? DeviceVariables.map((variable) => ({
20
- id: variable,
21
- value: variable,
22
- name: variable,
23
- }))
24
- : [],
25
- )
16
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
17
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
26
18
 
27
19
  const initialColor = $derived(
28
20
  $optionsStore.COLOR_OPTIONS.find((c) =>
@@ -37,7 +29,7 @@
37
29
  )
38
30
 
39
31
  /* Обновление свойства */
40
- const updateProperty = (path: string, value: string | object | boolean | number | RegExp) => {
32
+ const updateProperty = (path: string, value: string | object | boolean | number | RegExp, name?: string) => {
41
33
  const newProperties = JSON.parse(JSON.stringify(component.properties))
42
34
  if (path === 'regExp') {
43
35
  try {
@@ -72,7 +64,7 @@
72
64
  }
73
65
 
74
66
  obj[parts[parts.length - 1]] = value
75
- onPropertyChange(newProperties)
67
+ onPropertyChange(newProperties, name)
76
68
  }
77
69
 
78
70
  const handleOptionColorChange = (color: string) => {
@@ -99,11 +91,9 @@
99
91
  label={{ name: $t('constructor.props.variable') }}
100
92
  options={VARIABLE_OPTIONS}
101
93
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
102
- onUpdate={(selectedOption) => {
103
- if (selectedOption && selectedOption.name) {
104
- updateProperty('id', selectedOption.value as string)
105
- updateProperty('eventHandler.Variables', selectedOption.value as string)
106
- }
94
+ onUpdate={(value) => {
95
+ updateProperty('id', value.value as string, value.name?.split('|')[1].trim())
96
+ updateProperty('eventHandler.Variables', value.value as string)
107
97
  }}
108
98
  />
109
99
  <UI.Select
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IInputProps>;
5
5
  };
6
- onPropertyChange: (value: string | object) => void;
6
+ onPropertyChange: (value: string | object, name?: string) => void;
7
7
  };
8
8
  declare const InputProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
9
  type InputProps = ReturnType<typeof InputProps>;
@@ -9,19 +9,11 @@
9
9
 
10
10
  const { component, onPropertyChange } = $props<{
11
11
  component: UIComponent & { properties: Partial<IProgressBarProps> }
12
- onPropertyChange: (value: string | object) => void
12
+ onPropertyChange: (value: string | object, name?: string) => void
13
13
  }>()
14
14
 
15
- const DeviceVariables = getContext<string[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS = $derived(
17
- DeviceVariables && Array.isArray(DeviceVariables)
18
- ? DeviceVariables.map((variable) => ({
19
- id: variable,
20
- value: variable,
21
- name: variable,
22
- }))
23
- : [],
24
- )
15
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
16
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
25
17
 
26
18
  const initialAlign = $derived(
27
19
  $optionsStore.ALIGN_OPTIONS.find((a) =>
@@ -44,7 +36,8 @@
44
36
  options={VARIABLE_OPTIONS}
45
37
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
46
38
  onUpdate={(value) => {
47
- updateProperty('id', value.value as string, component, onPropertyChange)
39
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
40
+ updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
48
41
  }}
49
42
  />
50
43
  </div>
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IProgressBarProps>;
5
5
  };
6
- onPropertyChange: (value: string | object) => void;
6
+ onPropertyChange: (value: string | object, name?: string) => void;
7
7
  };
8
8
  declare const ProgressBarProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
9
  type ProgressBarProps = ReturnType<typeof ProgressBarProps>;
@@ -11,19 +11,11 @@
11
11
 
12
12
  const { component, onPropertyChange } = $props<{
13
13
  component: UIComponent & { properties: Partial<ISelectProps> }
14
- onPropertyChange: (path: string, value: string | object) => void
14
+ onPropertyChange: (value: string | object, name?: string) => void
15
15
  }>()
16
16
 
17
- const DeviceVariables = getContext<string[]>('DeviceVariables')
18
- let VARIABLE_OPTIONS = $derived(
19
- DeviceVariables && Array.isArray(DeviceVariables)
20
- ? DeviceVariables.map((variable) => ({
21
- id: variable,
22
- value: variable,
23
- name: variable,
24
- }))
25
- : [],
26
- )
17
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
18
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
27
19
 
28
20
  type ValueTypeOption = {
29
21
  id: string
@@ -67,13 +59,12 @@
67
59
  <div class="relative mb-4 flex flex-row items-start justify-center">
68
60
  <div class="flex w-1/3 flex-col items-center px-2">
69
61
  <UI.Select
70
- label={{ name: $t('constructor.props.argument') }}
71
- type="buttons"
72
- value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument) ??
73
- $optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === '')}
74
- options={$optionsStore.FULL_ARGUMENT_OPTION}
75
- onUpdate={(option) => {
76
- updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
62
+ label={{ name: $t('constructor.props.variable') }}
63
+ options={VARIABLE_OPTIONS}
64
+ value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
65
+ onUpdate={(value) => {
66
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
67
+ updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
77
68
  }}
78
69
  />
79
70
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISelectProps>;
5
5
  };
6
- onPropertyChange: (path: string, value: string | object) => void;
6
+ onPropertyChange: (value: string | object, name?: string) => void;
7
7
  };
8
8
  declare const SelectProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
9
  type SelectProps = ReturnType<typeof SelectProps>;
@@ -9,19 +9,11 @@
9
9
 
10
10
  const { component, onPropertyChange } = $props<{
11
11
  component: UIComponent & { properties: Partial<ISliderProps> }
12
- onPropertyChange: (value: string | object) => void
12
+ onPropertyChange: (value: string | object, name?: string) => void
13
13
  }>()
14
14
 
15
- const DeviceVariables = getContext<string[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS = $derived(
17
- DeviceVariables && Array.isArray(DeviceVariables)
18
- ? DeviceVariables.map((variable) => ({
19
- id: variable,
20
- value: variable,
21
- name: variable,
22
- }))
23
- : [],
24
- )
15
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
16
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
25
17
 
26
18
  const initialAlign = $derived(
27
19
  $optionsStore.ALIGN_OPTIONS.find((a) =>
@@ -44,7 +36,7 @@
44
36
  options={VARIABLE_OPTIONS}
45
37
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
46
38
  onUpdate={(value) => {
47
- updateProperty('id', value.value as string, component, onPropertyChange)
39
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
48
40
  updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
49
41
  }}
50
42
  />
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISliderProps>;
5
5
  };
6
- onPropertyChange: (value: string | object) => void;
6
+ onPropertyChange: (value: string | object, name?: string) => void;
7
7
  };
8
8
  declare const SliderProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
9
  type SliderProps = ReturnType<typeof SliderProps>;
@@ -9,19 +9,12 @@
9
9
 
10
10
  const { component, onPropertyChange } = $props<{
11
11
  component: UIComponent & { properties: Partial<ISwitchProps> }
12
- onPropertyChange: (value: string | object) => void
12
+ onPropertyChange: (value: string | object, name?: string) => void
13
13
  }>()
14
14
 
15
- const DeviceVariables = getContext<string[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS = $derived(
17
- DeviceVariables && Array.isArray(DeviceVariables)
18
- ? DeviceVariables.map((variable) => ({
19
- id: variable,
20
- value: variable,
21
- name: variable,
22
- }))
23
- : [],
24
- )
15
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
16
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
17
+
25
18
  const initialColor = $derived(
26
19
  $optionsStore.COLOR_OPTIONS.find((c) =>
27
20
  (c.value as string).includes(component.properties.wrapperClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
@@ -38,7 +31,7 @@
38
31
  options={VARIABLE_OPTIONS}
39
32
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
40
33
  onUpdate={(value) => {
41
- updateProperty('id', value.value as string, component, onPropertyChange)
34
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
42
35
  updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
43
36
  }}
44
37
  />
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISwitchProps>;
5
5
  };
6
- onPropertyChange: (value: string | object) => void;
6
+ onPropertyChange: (value: string | object, name?: string) => void;
7
7
  };
8
8
  declare const SwitchProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
9
  type SwitchProps = ReturnType<typeof SwitchProps>;
@@ -11,19 +11,11 @@
11
11
 
12
12
  const { component, onPropertyChange } = $props<{
13
13
  component: UIComponent & { properties: Partial<ITableProps<object>> }
14
- onPropertyChange: (value: string | object) => void
14
+ onPropertyChange: (value: string | object, name?: string) => void
15
15
  }>()
16
16
 
17
- const DeviceVariables = getContext<string[]>('DeviceVariables')
18
- let VARIABLE_OPTIONS = $derived(
19
- DeviceVariables && Array.isArray(DeviceVariables)
20
- ? DeviceVariables.map((variable) => ({
21
- id: variable,
22
- value: variable,
23
- name: variable,
24
- }))
25
- : [],
26
- )
17
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
18
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
27
19
 
28
20
  const initialColor = $derived(
29
21
  $optionsStore.COLOR_OPTIONS.find((c) =>
@@ -74,17 +66,15 @@
74
66
 
75
67
  {#if component && component.properties}
76
68
  <div class="relative flex flex-row items-start justify-center">
77
- <div class="flex w-1/3 flex-col items-center px-2">
78
- <UI.Select
79
- label={{ name: $t('constructor.props.variable') }}
80
- options={VARIABLE_OPTIONS}
81
- value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
82
- onUpdate={(value) => {
83
- updateProperty('id', value.value as string, component, onPropertyChange)
84
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
85
- }}
86
- />
87
- </div>
69
+ <UI.Select
70
+ label={{ name: $t('constructor.props.variable') }}
71
+ options={VARIABLE_OPTIONS}
72
+ value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
73
+ onUpdate={(value) => {
74
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
75
+ updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
76
+ }}
77
+ />
88
78
  <div class="flex w-1/3 flex-col px-2">
89
79
  <UI.Select
90
80
  wrapperClass="!h-14"
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITableProps<object>>;
5
5
  };
6
- onPropertyChange: (value: string | object) => void;
6
+ onPropertyChange: (value: string | object, name?: string) => void;
7
7
  };
8
8
  declare const TableProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
9
  type TableProps = ReturnType<typeof TableProps>;
@@ -9,19 +9,12 @@
9
9
 
10
10
  const { component, onPropertyChange } = $props<{
11
11
  component: UIComponent & { properties: Partial<ITextFieldProps> }
12
- onPropertyChange: (value: string | object) => void
12
+ onPropertyChange: (value: string | object, name?: string) => void
13
13
  }>()
14
14
 
15
- const DeviceVariables = getContext<string[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS = $derived(
17
- DeviceVariables && Array.isArray(DeviceVariables)
18
- ? DeviceVariables.map((variable) => ({
19
- id: variable,
20
- value: variable,
21
- name: variable,
22
- }))
23
- : [],
24
- )
15
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
16
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
17
+
25
18
  let currentType = $derived($optionsStore.TEXTFIELD_SIZE_OPTIONS.find((t) => t.value === component.properties.content.size))
26
19
 
27
20
  const initialAlign = $derived(
@@ -46,7 +39,7 @@
46
39
  options={VARIABLE_OPTIONS}
47
40
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
48
41
  onUpdate={(value) => {
49
- updateProperty('id', value.value as string, component, onPropertyChange)
42
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
50
43
  updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
51
44
  }}
52
45
  />
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITextFieldProps>;
5
5
  };
6
- onPropertyChange: (value: string | object) => void;
6
+ onPropertyChange: (value: string | object, name?: string) => void;
7
7
  };
8
8
  declare const TextFieldProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
9
  type TextFieldProps = ReturnType<typeof TextFieldProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {