poe-svelte-ui-lib 1.0.1 → 1.0.4

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 (61) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +1 -0
  3. package/dist/Accordion/Accordion.svelte +53 -53
  4. package/dist/Button/Button.svelte +111 -144
  5. package/dist/Button/Button.svelte.d.ts +1 -34
  6. package/dist/ColorPicker/ColorPicker.svelte +205 -207
  7. package/dist/FileAttach/FileAttach.svelte +103 -103
  8. package/dist/Graph/Graph.svelte +270 -270
  9. package/dist/Input/Input.svelte +240 -239
  10. package/dist/Loader.svelte +12 -12
  11. package/dist/MessageModal.svelte +54 -54
  12. package/dist/ProgressBar/ProgressBar.svelte +48 -48
  13. package/dist/Select/Select.svelte +189 -191
  14. package/dist/Slider/Slider.svelte +260 -260
  15. package/dist/Switch/Switch.svelte +84 -83
  16. package/dist/Table/Table.svelte +275 -276
  17. package/dist/TextField/TextField.svelte +22 -22
  18. package/dist/index.d.ts +0 -11
  19. package/dist/index.js +0 -11
  20. package/dist/{appIcons → libIcons}/ButtonAdd.svelte +10 -10
  21. package/dist/{appIcons → libIcons}/ButtonDelete.svelte +13 -13
  22. package/dist/{appIcons → libIcons}/LoaderRotate.svelte +9 -9
  23. package/dist/options.d.ts +11 -11
  24. package/dist/options.js +27 -27
  25. package/dist/types.d.ts +1 -1
  26. package/package.json +48 -47
  27. package/dist/Accordion/AccordionProps.svelte +0 -70
  28. package/dist/Accordion/AccordionProps.svelte.d.ts +0 -10
  29. package/dist/Button/ButtonProps.svelte +0 -200
  30. package/dist/Button/ButtonProps.svelte.d.ts +0 -10
  31. package/dist/ColorPicker/ColorPickerProps.svelte +0 -100
  32. package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +0 -10
  33. package/dist/Graph/GraphProps.svelte +0 -56
  34. package/dist/Graph/GraphProps.svelte.d.ts +0 -10
  35. package/dist/Input/InputProps.svelte +0 -221
  36. package/dist/Input/InputProps.svelte.d.ts +0 -10
  37. package/dist/ProgressBar/ProgressBarProps.svelte +0 -145
  38. package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +0 -10
  39. package/dist/Select/SelectProps.svelte +0 -260
  40. package/dist/Select/SelectProps.svelte.d.ts +0 -10
  41. package/dist/Slider/SliderProps.svelte +0 -161
  42. package/dist/Slider/SliderProps.svelte.d.ts +0 -10
  43. package/dist/Switch/SwitchProps.svelte +0 -144
  44. package/dist/Switch/SwitchProps.svelte.d.ts +0 -10
  45. package/dist/Table/TableProps.svelte +0 -286
  46. package/dist/Table/TableProps.svelte.d.ts +0 -10
  47. package/dist/TextField/TextFieldProps.svelte +0 -92
  48. package/dist/TextField/TextFieldProps.svelte.d.ts +0 -10
  49. package/dist/locales/CircleFlagsEn.svelte +0 -14
  50. package/dist/locales/CircleFlagsEn.svelte.d.ts +0 -26
  51. package/dist/locales/CircleFlagsRu.svelte +0 -8
  52. package/dist/locales/CircleFlagsRu.svelte.d.ts +0 -26
  53. package/dist/locales/CircleFlagsZh.svelte +0 -8
  54. package/dist/locales/CircleFlagsZh.svelte.d.ts +0 -26
  55. package/dist/locales/i18n.d.ts +0 -10
  56. package/dist/locales/i18n.js +0 -36
  57. package/dist/locales/translations.d.ts +0 -7
  58. package/dist/locales/translations.js +0 -450
  59. /package/dist/{appIcons → libIcons}/ButtonAdd.svelte.d.ts +0 -0
  60. /package/dist/{appIcons → libIcons}/ButtonDelete.svelte.d.ts +0 -0
  61. /package/dist/{appIcons → libIcons}/LoaderRotate.svelte.d.ts +0 -0
@@ -1,200 +0,0 @@
1
- <!-- $lib/ElementsUI/ButtonProps.svelte -->
2
- <script lang="ts">
3
- import { t } from '../locales/i18n'
4
- import type { UIComponent, IButtonProps, ISelectOption } from '../types'
5
- import * as UI from '../index'
6
- import { optionsStore } from '../options'
7
-
8
- const { component, onPropertyChange } = $props<{
9
- component: UIComponent & { properties: Partial<IButtonProps> }
10
- onPropertyChange: (value: string | object) => void
11
- }>()
12
-
13
- let Header: ISelectOption = $derived(
14
- $optionsStore.HEADER_OPTIONS.find((h) => h.value === component.properties.eventHandler.Header) ?? { id: '', name: '', value: '', class: '!w-1/4' },
15
- )
16
-
17
- const initialColor = $derived(
18
- $optionsStore.COLOR_OPTIONS.find((c) =>
19
- (c.value as string).includes(component.properties.componentClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
20
- ),
21
- )
22
-
23
- const initialAlign = $derived(
24
- $optionsStore.ALIGN_OPTIONS.find((a) =>
25
- (a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
26
- ),
27
- )
28
-
29
- const initialHeight = $derived(
30
- $optionsStore.HEIGHT_OPTIONS.find((h) =>
31
- (h.value as string).includes(component.properties.componentClass?.split(' ').find((cls: string) => cls.startsWith('py-'))),
32
- ),
33
- )
34
-
35
- /* Добавление цветов через селект */
36
- const handleOptionColorChange = (color: string) => {
37
- let componentClass = component.properties.componentClass || ''
38
- componentClass = componentClass
39
- .split(' ')
40
- .filter((cls: string) => !cls.startsWith('bg-'))
41
- .join(' ')
42
- if (color) {
43
- componentClass += ` ${color}`
44
- }
45
- updateProperty('componentClass', componentClass)
46
- }
47
-
48
- const handleLabelAlign = (align: string) => {
49
- let labelClass = component.properties.label.class || ''
50
- labelClass = labelClass
51
- .split(' ')
52
- .filter((cls: string) => !cls.startsWith('text-'))
53
- .join(' ')
54
- if (align) {
55
- labelClass += ` ${align}`
56
- }
57
- updateProperty('label.class', labelClass)
58
- }
59
-
60
- const handleButtonHeight = (height: string) => {
61
- let buttonClass = component.properties.componentClass || ''
62
- buttonClass = buttonClass
63
- .split(' ')
64
- .filter((cls: string) => !cls.startsWith('py-'))
65
- .join(' ')
66
- if (height) {
67
- buttonClass += ` ${height}`
68
- }
69
- updateProperty('componentClass', buttonClass)
70
- }
71
-
72
- /* Обновление свойства */
73
- const updateProperty = (path: string, value: string | object | string[]) => {
74
- const newProperties = JSON.parse(JSON.stringify(component.properties))
75
- const parts = path.split('.')
76
- let obj = newProperties
77
- for (let i = 0; i < parts.length - 1; i++) {
78
- const part = parts[i]
79
- if (!obj[part]) obj[part] = {}
80
- obj = obj[part]
81
- }
82
- obj[parts[parts.length - 1]] = value
83
- onPropertyChange(newProperties)
84
- }
85
- </script>
86
-
87
- {#if component && component.properties}
88
- <div class="relative flex flex-row items-start justify-center">
89
- <!-- Сообщение для отправки в ws по нажатию кнопки -->
90
- <div class="flex w-1/3 flex-col items-center px-2">
91
- <UI.Select
92
- wrapperClass="w-full"
93
- label={{ name: $t('service.constructor.props.header') }}
94
- type="buttons"
95
- value={Header}
96
- options={$optionsStore.HEADER_OPTIONS}
97
- onUpdate={(option) => {
98
- Header = option
99
- updateProperty('eventHandler.Header', Header.value as string)
100
- }}
101
- />
102
- {#if Header.value === 'SET'}
103
- <UI.Select
104
- wrapperClass="w-full"
105
- label={{ name: $t('service.constructor.props.argument') }}
106
- type="buttons"
107
- value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument)}
108
- options={$optionsStore.FULL_ARGUMENT_OPTION}
109
- onUpdate={(option) => {
110
- updateProperty('eventHandler.Argument', option.value as string)
111
- }}
112
- />
113
- {/if}
114
- {#if (component.properties.eventHandler.Argument !== 'Save' && component.properties.eventHandler.Argument !== 'NoSave') || Header.value !== 'SET'}
115
- <UI.Input
116
- wrapperClass="w-full {Header.value === 'SET' ? 'mt-1' : ''} "
117
- label={{ name: Header.value === 'SET' ? '' : $t('service.constructor.props.argument') }}
118
- value={component.properties.eventHandler.Argument}
119
- type="text"
120
- autocomplete="on"
121
- componentClass="w-full"
122
- maxlength={32}
123
- regExp={/^[a-zA-Z0-9\-_]{0,32}$/}
124
- help={{ info: $t('service.constructor.props.argument.info') }}
125
- onUpdate={(value) => updateProperty('eventHandler.Argument', value as string)}
126
- />
127
- <UI.Input
128
- wrapperClass="w-full"
129
- label={{ name: $t('service.constructor.props.value') }}
130
- value={component.properties.eventHandler.Value}
131
- type="text"
132
- autocomplete="on"
133
- componentClass="w-full"
134
- maxlength={500}
135
- regExp={/^[a-zA-Z0-9\-_ ":{}]{0,500}$/}
136
- help={{ info: $t('service.constructor.props.value.info') }}
137
- onUpdate={(value) => updateProperty('eventHandler.Value', value as string)}
138
- />
139
- {/if}
140
- <UI.Input
141
- wrapperClass="w-full"
142
- label={{ name: $t('service.constructor.props.variables') }}
143
- value={component.properties.eventHandler.Variables.join(' ')}
144
- type="text"
145
- autocomplete="on"
146
- componentClass="w-full"
147
- maxlength={500}
148
- regExp={/^[a-zA-Z0-9\-_ ]{0,500}$/}
149
- help={{ info: $t('service.constructor.props.variables.info') }}
150
- onUpdate={(value) => {
151
- const parts = (value as string).trim().split(/\s+/)
152
- updateProperty('eventHandler.Variables', parts)
153
- }}
154
- />
155
- </div>
156
- <div class="flex w-1/3 flex-col px-2">
157
- <UI.Input
158
- wrapperClass="w-full"
159
- label={{ name: $t('service.constructor.props.name') }}
160
- value={component.properties.name}
161
- type="text"
162
- onUpdate={(value) => updateProperty('name', value as string)}
163
- />
164
- <UI.Select
165
- wrapperClass="w-full"
166
- label={{ name: $t('service.constructor.props.height') }}
167
- type="buttons"
168
- options={$optionsStore.HEIGHT_OPTIONS}
169
- value={initialHeight}
170
- onUpdate={(option) => handleButtonHeight(option.value as string)}
171
- />
172
- <UI.Select
173
- wrapperClass="w-full h-14"
174
- label={{ name: $t('service.constructor.props.colors') }}
175
- type="buttons"
176
- options={$optionsStore.COLOR_OPTIONS}
177
- value={initialColor}
178
- onUpdate={(option) => handleOptionColorChange(option.value as string)}
179
- />
180
- </div>
181
- <div class="flex w-1/3 flex-col px-2">
182
- <UI.Input
183
- wrapperClass="w-full"
184
- label={{ name: $t('service.constructor.props.label') }}
185
- value={component.properties.label.name}
186
- type="text"
187
- componentClass="w-full"
188
- onUpdate={(value) => updateProperty('label.name', value as string)}
189
- />
190
- <UI.Select
191
- wrapperClass="w-full"
192
- label={{ name: $t('service.constructor.props.align') }}
193
- type="buttons"
194
- value={initialAlign}
195
- options={$optionsStore.ALIGN_OPTIONS}
196
- onUpdate={(option) => handleLabelAlign(option.value as string)}
197
- />
198
- </div>
199
- </div>
200
- {/if}
@@ -1,10 +0,0 @@
1
- import type { UIComponent, IButtonProps } from '../types';
2
- type $$ComponentProps = {
3
- component: UIComponent & {
4
- properties: Partial<IButtonProps>;
5
- };
6
- onPropertyChange: (value: string | object) => void;
7
- };
8
- declare const ButtonProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type ButtonProps = ReturnType<typeof ButtonProps>;
10
- export default ButtonProps;
@@ -1,100 +0,0 @@
1
- <!-- $lib/ElementsUI/ButtonProps.svelte -->
2
- <script lang="ts">
3
- import { t } from '../locales/i18n'
4
- import type { UIComponent, IColorPickerProps } from '../types'
5
- import * as UI from '../index'
6
- import { getContext } from 'svelte'
7
- import { optionsStore } from '../options'
8
-
9
- const { component, onPropertyChange } = $props<{
10
- component: UIComponent & { properties: Partial<IColorPickerProps> }
11
- onPropertyChange: (value: string | object) => void
12
- }>()
13
-
14
- const DeviceVariables = getContext<{ value: string; name: string }[]>('DeviceVariables')
15
- let VARIABLE_OPTIONS = $derived(
16
- DeviceVariables.map((variable: { value: string; name: string }) => ({
17
- id: variable.name,
18
- value: variable.value,
19
- name: `${variable.value} | ${variable.name}`,
20
- })),
21
- )
22
-
23
- const initialAlign = $derived(
24
- $optionsStore.ALIGN_OPTIONS.find((a) =>
25
- (a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
26
- ),
27
- )
28
-
29
- const handleLabelAlign = (align: string) => {
30
- let labelClass = component.properties.label.class || ''
31
- labelClass = labelClass
32
- .split(' ')
33
- .filter((cls: string) => !cls.startsWith('text-'))
34
- .join(' ')
35
- if (align) {
36
- labelClass += ` ${align}`
37
- }
38
- updateProperty('label.class', labelClass)
39
- }
40
-
41
- /* Обновление свойства */
42
- const updateProperty = (path: string, value: string | object | string[]) => {
43
- const newProperties = JSON.parse(JSON.stringify(component.properties))
44
- const parts = path.split('.')
45
- let obj = newProperties
46
- for (let i = 0; i < parts.length - 1; i++) {
47
- const part = parts[i]
48
- if (!obj[part]) obj[part] = {}
49
- obj = obj[part]
50
- }
51
- obj[parts[parts.length - 1]] = value
52
- onPropertyChange(newProperties)
53
- }
54
- </script>
55
-
56
- {#if component && component.properties}
57
- <div class="relative flex flex-row items-start justify-center">
58
- <!-- Сообщение для отправки в ws по нажатию кнопки -->
59
- <div class="flex w-1/3 flex-col items-center px-2">
60
- <UI.Select
61
- label={{ name: $t('service.constructor.props.variable') }}
62
- options={VARIABLE_OPTIONS}
63
- value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id.value)}
64
- onUpdate={(value) => {
65
- updateProperty('id.name', (value.name as string).split('|')[1].trim())
66
- updateProperty('id.value', value.value as string)
67
- updateProperty('eventHandler.Variables', value.value as string)
68
- }}
69
- />
70
- <UI.Select
71
- wrapperClass="w-full"
72
- label={{ name: $t('service.constructor.props.action') }}
73
- type="buttons"
74
- value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument)}
75
- options={$optionsStore.SHORT_ARGUMENT_OPTION}
76
- onUpdate={(option) => {
77
- updateProperty('eventHandler.Argument', option.value as string)
78
- }}
79
- />
80
- </div>
81
- <div class="flex w-1/3 flex-col px-2">
82
- <UI.Input
83
- wrapperClass="w-full"
84
- label={{ name: $t('service.constructor.props.label') }}
85
- value={component.properties.label.name}
86
- type="text"
87
- componentClass="w-full"
88
- onUpdate={(value) => updateProperty('label.name', value as string)}
89
- />
90
- <UI.Select
91
- wrapperClass="w-full"
92
- label={{ name: $t('service.constructor.props.align') }}
93
- type="buttons"
94
- value={initialAlign}
95
- options={$optionsStore.ALIGN_OPTIONS}
96
- onUpdate={(option) => handleLabelAlign(option.value as string)}
97
- />
98
- </div>
99
- </div>
100
- {/if}
@@ -1,10 +0,0 @@
1
- import type { UIComponent, IColorPickerProps } from '../types';
2
- type $$ComponentProps = {
3
- component: UIComponent & {
4
- properties: Partial<IColorPickerProps>;
5
- };
6
- onPropertyChange: (value: string | object) => void;
7
- };
8
- declare const ColorPickerProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type ColorPickerProps = ReturnType<typeof ColorPickerProps>;
10
- export default ColorPickerProps;
@@ -1,56 +0,0 @@
1
- <!-- $lib/ElementsUI/SwitchProps.svelte -->
2
- <script lang="ts">
3
- import { getContext } from 'svelte'
4
- import { t } from '../locales/i18n'
5
- import type { UIComponent, IGraphProps } from '../types'
6
- import * as UI from '../index'
7
-
8
- const { component, onPropertyChange } = $props<{
9
- component: UIComponent & { properties: Partial<IGraphProps> }
10
- onPropertyChange: (value: string | object) => void
11
- }>()
12
-
13
- const DeviceVariables = getContext<{ value: string; name: string }[]>('DeviceVariables')
14
- let VARIABLE_OPTIONS = $derived(
15
- DeviceVariables.map((variable: { value: string; name: string }) => ({
16
- id: variable.name,
17
- value: variable.value,
18
- name: `${variable.value} | ${variable.name}`,
19
- })),
20
- )
21
-
22
- /* Обновление свойства */
23
- const updateProperty = (path: string, value: string | object) => {
24
- const newProperties = JSON.parse(JSON.stringify(component.properties))
25
- const parts = path.split('.')
26
- let obj = newProperties
27
-
28
- for (let i = 0; i < parts.length - 1; i++) {
29
- const part = parts[i]
30
- if (!obj[part]) obj[part] = {}
31
- obj = obj[part]
32
- }
33
-
34
- obj[parts[parts.length - 1]] = value
35
- onPropertyChange(newProperties)
36
- }
37
- </script>
38
-
39
- {#if component && component.properties}
40
- <div class="relative flex flex-row items-start justify-center">
41
- <!-- Сообщение для отправки в ws по нажатию кнопки -->
42
- <div class="flex w-1/3 flex-col items-center px-2">
43
- <UI.Select
44
- label={{ name: $t('service.constructor.props.variable') }}
45
- options={VARIABLE_OPTIONS}
46
- value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id.value)}
47
- onUpdate={(value) => {
48
- updateProperty('id.name', (value.name as string).split('|')[1].trim())
49
- updateProperty('id.value', value.value as string)
50
- }}
51
- />
52
- </div>
53
- <div class="flex w-1/3 flex-col px-2"></div>
54
- <div class="flex w-1/3 flex-col px-2"></div>
55
- </div>
56
- {/if}
@@ -1,10 +0,0 @@
1
- import type { UIComponent, IGraphProps } from '../types';
2
- type $$ComponentProps = {
3
- component: UIComponent & {
4
- properties: Partial<IGraphProps>;
5
- };
6
- onPropertyChange: (value: string | object) => void;
7
- };
8
- declare const GraphProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type GraphProps = ReturnType<typeof GraphProps>;
10
- export default GraphProps;
@@ -1,221 +0,0 @@
1
- <!-- $lib/ElementsUI/InputProps.svelte -->
2
- <script lang="ts">
3
- import { getContext } from 'svelte'
4
- import { t } from '../locales/i18n'
5
- import type { IInputProps, UIComponent, ISelectOption } from '../types'
6
- import * as UI from '../index'
7
- import { optionsStore } from '../options'
8
-
9
- const { component, onPropertyChange } = $props<{
10
- component: UIComponent & { properties: Partial<IInputProps> }
11
- onPropertyChange: (value: string | object) => void
12
- }>()
13
-
14
- let isValidRegExp = $state(true)
15
- const DeviceVariables = getContext<{ value: string; name: string }[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS: ISelectOption<string>[] = $derived(
17
- DeviceVariables.map((variable: { value: string; name: string }) => ({
18
- id: variable.name,
19
- value: variable.value,
20
- name: `${variable.value} | ${variable.name}`,
21
- })),
22
- )
23
-
24
- const initialColor = $derived(
25
- $optionsStore.COLOR_OPTIONS.find((c) =>
26
- (c.value as string).includes(component.properties.componentClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
27
- ),
28
- )
29
-
30
- const initialAlign = $derived(
31
- $optionsStore.ALIGN_OPTIONS.find((a) =>
32
- (a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
33
- ),
34
- )
35
-
36
- /* Обновление свойства */
37
- const updateProperty = (path: string, value: string | object | boolean | number | RegExp) => {
38
- const newProperties = JSON.parse(JSON.stringify(component.properties))
39
- if (path === 'regExp') {
40
- try {
41
- let regex: RegExp
42
- if (typeof value === 'string') {
43
- const pattern = value.match(/^\/(.*)\/([gimsuy]*)$/)
44
-
45
- regex = pattern ? new RegExp(pattern[1], pattern[2]) : new RegExp(value)
46
- if (pattern === null) return
47
- regex.test('')
48
- } else {
49
- throw new Error('Invalid RegExp type')
50
- }
51
-
52
- newProperties.regExp = regex
53
- isValidRegExp = true
54
- } catch (error) {
55
- console.warn('Invalid RegExp:', error)
56
- newProperties.regExp = typeof value === 'string' ? value : String(value)
57
- isValidRegExp = false
58
- return
59
- }
60
- }
61
-
62
- const parts = path.split('.')
63
- let obj = newProperties
64
-
65
- for (let i = 0; i < parts.length - 1; i++) {
66
- const part = parts[i]
67
- if (!obj[part]) obj[part] = {}
68
- obj = obj[part]
69
- }
70
-
71
- obj[parts[parts.length - 1]] = value
72
- onPropertyChange(newProperties)
73
- }
74
-
75
- const handleOptionColorChange = (color: string) => {
76
- let componentClass = component.properties.componentClass || ''
77
-
78
- componentClass = componentClass
79
- .split(' ')
80
- .filter((cls: string) => !cls.startsWith('bg-'))
81
- .join(' ')
82
-
83
- if (color) {
84
- componentClass += ` ${color}`
85
- }
86
-
87
- updateProperty('componentClass', componentClass)
88
- }
89
-
90
- const handleLabelAlign = (align: string) => {
91
- let labelClass = component.properties.label.class || ''
92
-
93
- labelClass = labelClass
94
- .split(' ')
95
- .filter((cls: string) => !cls.startsWith('text-'))
96
- .join(' ')
97
- if (align) {
98
- labelClass += ` ${align}`
99
- }
100
- updateProperty('label.class', labelClass)
101
- }
102
- </script>
103
-
104
- {#if component && component.properties}
105
- <div class="relative flex flex-row items-start justify-center">
106
- <!-- Сообщение для отправки в ws по нажатию кнопки -->
107
- <div class="flex w-1/3 flex-col items-center px-2">
108
- <UI.Select
109
- label={{ name: $t('service.constructor.props.variable') }}
110
- options={VARIABLE_OPTIONS}
111
- value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id.value)}
112
- onUpdate={(selectedOption) => {
113
- if (selectedOption && selectedOption.name) {
114
- updateProperty('id.name', selectedOption.name.split('|')[1].trim())
115
- updateProperty('id.value', selectedOption.value as string)
116
- updateProperty('eventHandler.Variables', selectedOption.value as string)
117
- }
118
- }}
119
- />
120
- <UI.Select
121
- label={{ name: $t('service.constructor.props.type') }}
122
- options={$optionsStore.INPUT_TYPE_OPTIONS}
123
- value={$optionsStore.INPUT_TYPE_OPTIONS.find((opt) => opt.value === (component.properties.type || 'text'))}
124
- onUpdate={(selectedOption) => updateProperty('type', selectedOption.value as string)}
125
- />
126
- {#if component.properties.type === 'text' || component.properties.type === 'password'}
127
- <UI.Input
128
- label={{ name: $t('service.constructor.props.maxlenght') }}
129
- value={component.properties.maxlength}
130
- type="text"
131
- onUpdate={(value) => updateProperty('maxlength', value as string)}
132
- />
133
- <UI.Input
134
- label={{ name: $t('service.constructor.props.regexp') }}
135
- value={component.properties.regExp}
136
- type="text"
137
- maxlength={150}
138
- help={{ info: $t('service.constructor.props.regexp_info') }}
139
- componentClass={isValidRegExp === false ? '!border-2 !border-red-400' : ''}
140
- onUpdate={(value) => updateProperty('regExp', value)}
141
- />
142
- {:else if component.properties.type === 'number' && !component.properties.readonly && !component.properties.disabled}
143
- <UI.Input
144
- label={{ name: $t('service.constructor.props.minnum') }}
145
- value={component.properties.number.minNum as number}
146
- type="number"
147
- onUpdate={(value) => updateProperty('number.minNum', Number(value))}
148
- />
149
- <UI.Input
150
- label={{ name: $t('service.constructor.props.maxnum') }}
151
- value={component.properties.number.maxNum as number}
152
- type="number"
153
- onUpdate={(value) => updateProperty('number.maxNum', Number(value))}
154
- />
155
- <UI.Input
156
- label={{ name: $t('service.constructor.props.step') }}
157
- value={component.properties.number.step as number}
158
- type="number"
159
- onUpdate={(value) => updateProperty('number.step', Number(value))}
160
- />
161
- {:else if component.properties.type === 'text-area'}
162
- <UI.Input
163
- label={{ name: $t('service.constructor.props.regexp') }}
164
- value={component.properties.regExp}
165
- type="text"
166
- maxlength={150}
167
- help={{ info: $t('service.constructor.props.regexp_info') }}
168
- componentClass={isValidRegExp === false ? '!border-2 !border-red-400' : ''}
169
- onUpdate={(value) => updateProperty('regExp', value)}
170
- />
171
- {/if}
172
- </div>
173
- <div class="flex w-1/3 flex-col px-2">
174
- <UI.Input
175
- label={{ name: $t('service.constructor.props.placeholder') }}
176
- value={component.properties.help.placeholder as string}
177
- type="text"
178
- onUpdate={(value) => updateProperty('help.placeholder', value)}
179
- />
180
- <UI.Input
181
- label={{ name: $t('service.constructor.props.info') }}
182
- value={component.properties.help.info as string}
183
- type="text"
184
- onUpdate={(value) => updateProperty('help.info', value)}
185
- />
186
- <UI.Switch
187
- label={{ name: $t('service.constructor.props.readonly') }}
188
- value={component.properties.readonly ? 2 : 1}
189
- onChange={(value) => updateProperty('readonly', value === 2)}
190
- />
191
- <UI.Switch
192
- label={{ name: $t('service.constructor.props.copy') }}
193
- value={component.properties.copyButton ? 2 : 1}
194
- onChange={(value) => updateProperty('copyButton', value === 2)}
195
- />
196
- </div>
197
- <div class="flex w-1/3 flex-col px-2">
198
- <UI.Input
199
- label={{ name: $t('service.constructor.props.label') }}
200
- value={component.properties.label.name}
201
- type="text"
202
- onUpdate={(value) => updateProperty('label.name', value as string)}
203
- />
204
- <UI.Select
205
- label={{ name: $t('service.constructor.props.align') }}
206
- type="buttons"
207
- value={initialAlign}
208
- options={$optionsStore.ALIGN_OPTIONS}
209
- onUpdate={(option) => handleLabelAlign(option.value as string)}
210
- />
211
- <UI.Select
212
- wrapperClass="h-14"
213
- label={{ name: $t('service.constructor.props.colors') }}
214
- type="buttons"
215
- options={$optionsStore.COLOR_OPTIONS}
216
- value={initialColor}
217
- onUpdate={(option) => handleOptionColorChange(option.value as string)}
218
- />
219
- </div>
220
- </div>
221
- {/if}
@@ -1,10 +0,0 @@
1
- import type { IInputProps, UIComponent } from '../types';
2
- type $$ComponentProps = {
3
- component: UIComponent & {
4
- properties: Partial<IInputProps>;
5
- };
6
- onPropertyChange: (value: string | object) => void;
7
- };
8
- declare const InputProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type InputProps = ReturnType<typeof InputProps>;
10
- export default InputProps;