poe-svelte-ui-lib 1.0.2 → 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 (47) hide show
  1. package/README.md +1 -0
  2. package/dist/Button/Button.svelte +5 -38
  3. package/dist/Button/Button.svelte.d.ts +1 -34
  4. package/dist/ColorPicker/ColorPicker.svelte +1 -3
  5. package/dist/FileAttach/FileAttach.svelte +3 -3
  6. package/dist/Input/Input.svelte +21 -20
  7. package/dist/Select/Select.svelte +4 -6
  8. package/dist/Switch/Switch.svelte +3 -2
  9. package/dist/Table/Table.svelte +5 -6
  10. package/dist/index.d.ts +0 -11
  11. package/dist/index.js +0 -11
  12. package/dist/options.d.ts +11 -11
  13. package/dist/options.js +27 -27
  14. package/dist/types.d.ts +1 -1
  15. package/package.json +8 -9
  16. package/dist/Accordion/AccordionProps.svelte +0 -70
  17. package/dist/Accordion/AccordionProps.svelte.d.ts +0 -10
  18. package/dist/Button/ButtonProps.svelte +0 -200
  19. package/dist/Button/ButtonProps.svelte.d.ts +0 -10
  20. package/dist/ColorPicker/ColorPickerProps.svelte +0 -100
  21. package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +0 -10
  22. package/dist/Graph/GraphProps.svelte +0 -56
  23. package/dist/Graph/GraphProps.svelte.d.ts +0 -10
  24. package/dist/Input/InputProps.svelte +0 -221
  25. package/dist/Input/InputProps.svelte.d.ts +0 -10
  26. package/dist/ProgressBar/ProgressBarProps.svelte +0 -145
  27. package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +0 -10
  28. package/dist/Select/SelectProps.svelte +0 -260
  29. package/dist/Select/SelectProps.svelte.d.ts +0 -10
  30. package/dist/Slider/SliderProps.svelte +0 -161
  31. package/dist/Slider/SliderProps.svelte.d.ts +0 -10
  32. package/dist/Switch/SwitchProps.svelte +0 -144
  33. package/dist/Switch/SwitchProps.svelte.d.ts +0 -10
  34. package/dist/Table/TableProps.svelte +0 -286
  35. package/dist/Table/TableProps.svelte.d.ts +0 -10
  36. package/dist/TextField/TextFieldProps.svelte +0 -92
  37. package/dist/TextField/TextFieldProps.svelte.d.ts +0 -10
  38. package/dist/locales/CircleFlagsEn.svelte +0 -14
  39. package/dist/locales/CircleFlagsEn.svelte.d.ts +0 -26
  40. package/dist/locales/CircleFlagsRu.svelte +0 -8
  41. package/dist/locales/CircleFlagsRu.svelte.d.ts +0 -26
  42. package/dist/locales/CircleFlagsZh.svelte +0 -8
  43. package/dist/locales/CircleFlagsZh.svelte.d.ts +0 -26
  44. package/dist/locales/i18n.d.ts +0 -10
  45. package/dist/locales/i18n.js +0 -36
  46. package/dist/locales/translations.d.ts +0 -7
  47. package/dist/locales/translations.js +0 -450
@@ -1,161 +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, ISliderProps } from '../types'
6
- import * as UI from '../index'
7
- import { optionsStore } from '../options'
8
-
9
- const { component, onPropertyChange } = $props<{
10
- component: UIComponent & { properties: Partial<ISliderProps> }
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 initialColor = $derived(
30
- $optionsStore.COLOR_OPTIONS.find((c) =>
31
- (c.value as string).includes(component.properties.wrapperClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
32
- ),
33
- )
34
-
35
- const handleLabelAlign = (align: string) => {
36
- let labelClass = component.properties.label.class || ''
37
- labelClass = labelClass
38
- .split(' ')
39
- .filter((cls: string) => !cls.startsWith('text-'))
40
- .join(' ')
41
- if (align) {
42
- labelClass += ` ${align}`
43
- }
44
- updateProperty('label.class', labelClass)
45
- }
46
-
47
- const handleOptionColorChange = (color: string) => {
48
- let wrapperClass = component.properties.wrapperClass || ''
49
- wrapperClass = wrapperClass
50
- .split(' ')
51
- .filter((cls: string) => !cls.startsWith('bg-'))
52
- .join(' ')
53
- if (color) {
54
- wrapperClass += ` ${color}`
55
- }
56
- updateProperty('wrapperClass', wrapperClass)
57
- }
58
-
59
- /* Обновление свойства */
60
- const updateProperty = (path: string, value: number | string | object) => {
61
- const newProperties = JSON.parse(JSON.stringify(component.properties))
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
- </script>
75
-
76
- {#if component && component.properties}
77
- <div class="relative flex flex-row items-start justify-center">
78
- <div class="flex w-1/3 flex-col items-center px-2">
79
- <UI.Select
80
- label={{ name: $t('service.constructor.props.variable') }}
81
- options={VARIABLE_OPTIONS}
82
- value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id.value)}
83
- onUpdate={(value) => {
84
- updateProperty('id.name', (value.name as string).split('|')[1].trim())
85
- updateProperty('id.value', value.value as string)
86
- updateProperty('eventHandler.Variables', value.value as string)
87
- }}
88
- />
89
- <UI.Select
90
- wrapperClass="w-full"
91
- label={{ name: $t('service.constructor.props.action') }}
92
- type="buttons"
93
- value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument)}
94
- options={$optionsStore.SHORT_ARGUMENT_OPTION}
95
- onUpdate={(option) => {
96
- updateProperty('eventHandler.Argument', option.value as string)
97
- }}
98
- />
99
- </div>
100
- <div class="flex w-1/3 flex-col px-2">
101
- <UI.Select
102
- wrapperClass="w-full"
103
- label={{ name: $t('service.constructor.props.type') }}
104
- type="buttons"
105
- value={$optionsStore.SLIDER_TYPE_OPTIONS.find((opt) => opt.value === (component.properties.type || 'single'))}
106
- options={$optionsStore.SLIDER_TYPE_OPTIONS}
107
- onUpdate={(type) => {
108
- updateProperty('value', type.value === 'single' ? 5 : [2, 7])
109
- updateProperty('type', type.value as string)
110
- }}
111
- />
112
- <UI.Input
113
- wrapperClass="w-full"
114
- label={{ name: $t('service.constructor.props.minnum') }}
115
- value={component.properties.number.minNum as number}
116
- type="number"
117
- onUpdate={(value) => updateProperty('number.minNum', Number(value))}
118
- />
119
- <UI.Input
120
- wrapperClass="w-full"
121
- label={{ name: $t('service.constructor.props.maxnum') }}
122
- value={component.properties.number.maxNum as number}
123
- type="number"
124
- onUpdate={(value) => updateProperty('number.maxNum', Number(value))}
125
- />
126
- <UI.Input
127
- wrapperClass="w-full"
128
- label={{ name: $t('service.constructor.props.step') }}
129
- value={component.properties.number.step as number}
130
- type="number"
131
- onUpdate={(value) => updateProperty('number.step', Number(value))}
132
- />
133
- </div>
134
- <div class="flex w-1/3 flex-col px-2">
135
- <UI.Input
136
- wrapperClass="w-full"
137
- label={{ name: $t('service.constructor.props.label') }}
138
- value={component.properties.label.name}
139
- type="text"
140
- componentClass="w-full"
141
- onUpdate={(value) => updateProperty('label.name', value as string)}
142
- />
143
- <UI.Select
144
- wrapperClass="w-full"
145
- label={{ name: $t('service.constructor.props.align') }}
146
- type="buttons"
147
- value={initialAlign}
148
- options={$optionsStore.ALIGN_OPTIONS}
149
- onUpdate={(option) => handleLabelAlign(option.value as string)}
150
- />
151
- <UI.Select
152
- wrapperClass="!h-14"
153
- label={{ name: $t('service.constructor.props.colors') }}
154
- type="buttons"
155
- options={$optionsStore.COLOR_OPTIONS}
156
- value={initialColor}
157
- onUpdate={(option) => handleOptionColorChange(option.value as string)}
158
- />
159
- </div>
160
- </div>
161
- {/if}
@@ -1,10 +0,0 @@
1
- import type { UIComponent, ISliderProps } from '../types';
2
- type $$ComponentProps = {
3
- component: UIComponent & {
4
- properties: Partial<ISliderProps>;
5
- };
6
- onPropertyChange: (value: string | object) => void;
7
- };
8
- declare const SliderProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type SliderProps = ReturnType<typeof SliderProps>;
10
- export default SliderProps;
@@ -1,144 +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, ISwitchProps } from '../types'
6
- import * as UI from '../index'
7
- import { optionsStore } from '../options'
8
-
9
- const { component, onPropertyChange } = $props<{
10
- component: UIComponent & { properties: Partial<ISwitchProps> }
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 initialColor = $derived(
24
- $optionsStore.COLOR_OPTIONS.find((c) =>
25
- (c.value as string).includes(component.properties.wrapperClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
26
- ),
27
- )
28
-
29
- const initialAlign = $derived(
30
- $optionsStore.ALIGN_OPTIONS.find((a) =>
31
- (a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
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('wrapperClass', 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
- /* Обновление свойства */
61
- const updateProperty = (path: string, value: string | object | boolean | number) => {
62
- const newProperties = JSON.parse(JSON.stringify(component.properties))
63
- const parts = path.split('.')
64
- let obj = newProperties
65
-
66
- for (let i = 0; i < parts.length - 1; i++) {
67
- const part = parts[i]
68
- if (!obj[part]) obj[part] = {}
69
- obj = obj[part]
70
- }
71
-
72
- obj[parts[parts.length - 1]] = value
73
- onPropertyChange(newProperties)
74
- }
75
- </script>
76
-
77
- {#if component && component.properties}
78
- <div class="relative flex flex-row items-start justify-center">
79
- <!-- Сообщение для отправки в ws по нажатию кнопки -->
80
- <div class="flex w-1/3 flex-col items-center px-2">
81
- <UI.Select
82
- label={{ name: $t('service.constructor.props.variable') }}
83
- options={VARIABLE_OPTIONS}
84
- value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id.value)}
85
- onUpdate={(value) => {
86
- updateProperty('id.name', (value.name as string).split('|')[1].trim())
87
- updateProperty('id.value', value.value as string)
88
- updateProperty('eventHandler.Variables', value.value as string)
89
- }}
90
- />
91
- <UI.Select
92
- label={{ name: $t('service.constructor.props.action') }}
93
- type="buttons"
94
- value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument)}
95
- options={$optionsStore.SHORT_ARGUMENT_OPTION}
96
- onUpdate={(option) => {
97
- updateProperty('eventHandler.Argument', option.value as string)
98
- }}
99
- />
100
- </div>
101
- <div class="flex w-1/3 flex-col px-2">
102
- <UI.Input
103
- label={{ name: $t('service.constructor.props.caption.left') }}
104
- value={component.properties.label.captionLeft}
105
- type="text"
106
- onUpdate={(value) => updateProperty('label.captionLeft', value as string)}
107
- />
108
- <UI.Input
109
- label={{ name: $t('service.constructor.props.caption.right') }}
110
- value={component.properties.label.captionRight}
111
- type="text"
112
- onUpdate={(value) => updateProperty('label.captionRight', value as string)}
113
- />
114
- <UI.Switch
115
- label={{ name: $t('service.constructor.props.disabled') }}
116
- value={component.properties.disabled ? 2 : 1}
117
- onChange={(value) => updateProperty('disabled', value === 2)}
118
- />
119
- </div>
120
- <div class="flex w-1/3 flex-col px-2">
121
- <UI.Input
122
- label={{ name: $t('service.constructor.props.label') }}
123
- value={component.properties.label.name}
124
- type="text"
125
- onUpdate={(value) => updateProperty('label.name', value as string)}
126
- />
127
- <UI.Select
128
- label={{ name: $t('service.constructor.props.align') }}
129
- type="buttons"
130
- value={initialAlign}
131
- options={$optionsStore.ALIGN_OPTIONS}
132
- onUpdate={(option) => handleLabelAlign(option.value as string)}
133
- />
134
- <UI.Select
135
- wrapperClass="!h-14"
136
- label={{ name: $t('service.constructor.props.colors') }}
137
- type="buttons"
138
- options={$optionsStore.COLOR_OPTIONS}
139
- value={initialColor}
140
- onUpdate={(option) => handleOptionColorChange(option.value as string)}
141
- />
142
- </div>
143
- </div>
144
- {/if}
@@ -1,10 +0,0 @@
1
- import type { UIComponent, ISwitchProps } from '../types';
2
- type $$ComponentProps = {
3
- component: UIComponent & {
4
- properties: Partial<ISwitchProps>;
5
- };
6
- onPropertyChange: (value: string | object) => void;
7
- };
8
- declare const SwitchProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type SwitchProps = ReturnType<typeof SwitchProps>;
10
- export default SwitchProps;
@@ -1,286 +0,0 @@
1
- <!-- $lib/ElementsUI/TableProps.svelte -->
2
- <script lang="ts">
3
- import { getContext } from 'svelte'
4
- import { t } from '../locales/i18n'
5
- import type { UIComponent, ITableProps, ITableHeader } from '../types'
6
- import * as UI from '../index'
7
- import ButtonDelete from '../libIcons/ButtonDelete.svelte'
8
- import ButtonAdd from '../libIcons/ButtonAdd.svelte'
9
- import { optionsStore } from '../options'
10
-
11
- const { component, onPropertyChange } = $props<{
12
- component: UIComponent & { properties: Partial<ITableProps<object>> }
13
- onPropertyChange: (value: string | object) => void
14
- }>()
15
-
16
- const DeviceVariables = getContext<{ value: string; name: string }[]>('DeviceVariables')
17
- let VARIABLE_OPTIONS = $derived(
18
- DeviceVariables.map((variable: { value: string; name: string }) => ({
19
- id: variable.name,
20
- value: variable.value,
21
- name: `${variable.value} | ${variable.name}`,
22
- })),
23
- )
24
-
25
- const initialColor = $derived(
26
- $optionsStore.COLOR_OPTIONS.find((c) =>
27
- (c.value as string).includes(component.properties.wrapperClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
28
- ),
29
- )
30
-
31
- const initialAlign = $derived(
32
- $optionsStore.ALIGN_OPTIONS.find((a) =>
33
- (a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
34
- ),
35
- )
36
-
37
- /* Добавление цветов через селект */
38
- const handleOptionColorChange = (color: string) => {
39
- let componentClass = component.properties.componentClass || ''
40
- componentClass = componentClass
41
- .split(' ')
42
- .filter((cls: string) => !cls.startsWith('bg-'))
43
- .join(' ')
44
- if (color) {
45
- componentClass += ` ${color}`
46
- }
47
- updateProperty('wrapperClass', componentClass)
48
- }
49
-
50
- const handleLabelAlign = (align: string) => {
51
- let labelClass = component.properties.label.class || ''
52
- labelClass = labelClass
53
- .split(' ')
54
- .filter((cls: string) => !cls.startsWith('text-'))
55
- .join(' ')
56
- if (align) {
57
- labelClass += ` ${align}`
58
- }
59
- updateProperty('label.class', labelClass)
60
- }
61
-
62
- /* Обновление свойства */
63
- const updateProperty = (path: string, value: string | object) => {
64
- const newProperties = JSON.parse(JSON.stringify(component.properties))
65
- const parts = path.split('.')
66
- let obj = newProperties
67
-
68
- for (let i = 0; i < parts.length - 1; i++) {
69
- const part = parts[i]
70
- if (!obj[part]) obj[part] = {}
71
- obj = obj[part]
72
- }
73
-
74
- obj[parts[parts.length - 1]] = value
75
- onPropertyChange(newProperties)
76
- }
77
-
78
- const updateTableHeader = (index: number, field: keyof ITableHeader<any>, value: any) => {
79
- const headers = [...component.properties.tableHeader]
80
- headers[index] = { ...headers[index], [field]: value }
81
- updateProperty('tableHeader', headers)
82
- }
83
-
84
- const updateButtonProperty = (columnIndex: number, buttonIndex: number, field: string, value: any) => {
85
- const headers = [...component.properties.tableHeader]
86
- const buttons = [...headers[columnIndex].buttons]
87
- buttons[buttonIndex] = { ...buttons[buttonIndex], [field]: value }
88
- headers[columnIndex].buttons = buttons
89
- updateProperty('tableHeader', headers)
90
- }
91
-
92
- const removeButtonFromColumn = (columnIndex: number, buttonIndex: number) => {
93
- const headers = [...component.properties.tableHeader]
94
- const buttons = [...headers[columnIndex].buttons]
95
- buttons.splice(buttonIndex, 1)
96
- headers[columnIndex].buttons = buttons.length ? buttons : undefined
97
- updateProperty('tableHeader', headers)
98
- }
99
- </script>
100
-
101
- {#if component && component.properties}
102
- <div class="relative flex flex-row items-start justify-center">
103
- <div class="flex w-1/3 flex-col items-center px-2">
104
- <UI.Select
105
- label={{ name: $t('service.constructor.props.variable') }}
106
- options={VARIABLE_OPTIONS}
107
- value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id.value)}
108
- onUpdate={(value) => {
109
- updateProperty('id.name', (value.name as string).split('|')[1].trim())
110
- updateProperty('id.value', value.value as string)
111
- updateProperty('eventHandler.Variables', value.value as string)
112
- }}
113
- />
114
- </div>
115
- <div class="flex w-1/3 flex-col px-2">
116
- <UI.Select
117
- wrapperClass="!h-14"
118
- label={{ name: $t('service.constructor.props.colors') }}
119
- type="buttons"
120
- options={$optionsStore.COLOR_OPTIONS}
121
- value={initialColor}
122
- onUpdate={(option) => handleOptionColorChange(option.value as string)}
123
- />
124
- </div>
125
- <div class="flex w-1/3 flex-col px-2">
126
- <UI.Input
127
- wrapperClass="w-full"
128
- label={{ name: $t('service.constructor.props.label') }}
129
- value={component.properties.label.name}
130
- type="text"
131
- componentClass="w-full"
132
- onUpdate={(value) => updateProperty('label.name', value as string)}
133
- />
134
- <UI.Select
135
- wrapperClass="w-full"
136
- label={{ name: $t('service.constructor.props.align') }}
137
- type="buttons"
138
- value={initialAlign}
139
- options={$optionsStore.ALIGN_OPTIONS}
140
- onUpdate={(option) => handleLabelAlign(option.value as string)}
141
- />
142
- </div>
143
- </div>
144
-
145
- <hr class="border-gray-400" />
146
-
147
- <!-- Настройки столбцов таблицы -->
148
- <div class="space-y-4">
149
- <div class="m-0 flex items-center justify-center gap-2">
150
- <h4>{$t('service.constructor.props.table.columns')}</h4>
151
- <UI.Button
152
- wrapperClass="!w-10"
153
- icon={{ component: ButtonAdd, properties: { height: '1.5rem', width: '1.5rem' } }}
154
- componentClass="h-10 border-none hover:shadow-none"
155
- onClick={() => {
156
- const newColumn: ITableHeader<any> = {
157
- key: `column${(component.properties.tableHeader?.length || 0) + 1}`,
158
- label: `Column ${(component.properties.tableHeader?.length || 0) + 1}`,
159
- width: '100px',
160
- sortable: false,
161
- }
162
- const headers = [...(component.properties.tableHeader || []), newColumn]
163
- updateProperty('tableHeader', headers)
164
- }}
165
- />
166
- </div>
167
-
168
- {#each component.properties.tableHeader as column, columnIndex}
169
- <div class="m-0 flex items-end justify-around gap-2">
170
- <UI.Input
171
- label={{ name: $t('service.constructor.props.table.columns.key') }}
172
- wrapperClass="!w-2/10"
173
- value={column.key}
174
- type="text"
175
- regExp={/^[0-9a-zA-Z_-]{0,16}$/}
176
- onUpdate={(value) => updateTableHeader(columnIndex, 'key', value)}
177
- />
178
- <UI.Input
179
- label={{ name: $t('service.constructor.props.table.columns.label') }}
180
- wrapperClass="!w-2/10"
181
- value={column.label}
182
- type="text"
183
- onUpdate={(value) => updateTableHeader(columnIndex, 'label', value)}
184
- />
185
- <UI.Input
186
- label={{ name: $t('service.constructor.props.table.columns.width') }}
187
- wrapperClass="!w-2/10"
188
- value={column.width}
189
- type="text"
190
- onUpdate={(value) => updateTableHeader(columnIndex, 'width', value)}
191
- />
192
- <UI.Switch
193
- wrapperClass="!w-1/10"
194
- label={{ name: $t('service.constructor.props.table.columns.sortable') }}
195
- value={column.sortable ? 2 : 1}
196
- onChange={(value) => updateTableHeader(columnIndex, 'sortable', value === 2)}
197
- />
198
- <UI.Button
199
- wrapperClass="!w-1/20"
200
- icon={{ component: ButtonAdd, properties: { height: '1.5rem', width: '1.5rem' } }}
201
- componentClass="h-10 w-10 border-none hover:shadow-none"
202
- info={$t('service.constructor.props.table.addaction')}
203
- onClick={() => {
204
- const newButton = {
205
- name: `button${(component.properties.tableHeader[columnIndex].buttons || 0) + 1}`,
206
- class: 'bg-blue',
207
- eventHandler: { Header: 'SET', Argument: 'Save', Variables: [] },
208
- onClick: () => {},
209
- }
210
- const buttons = [...(component.properties.tableHeader[columnIndex].buttons || []), newButton]
211
- updateTableHeader(columnIndex, 'buttons', buttons)
212
- }}
213
- />
214
- <UI.Button
215
- wrapperClass="!w-1/20"
216
- icon={{ component: ButtonDelete, properties: { height: '1.5rem', width: '1.5rem' } }}
217
- componentClass="h-10 w-10 border-none hover:shadow-none"
218
- info={$t('service.constructor.props.table.deletecolumn')}
219
- onClick={() => {
220
- const headers = [...(component.properties.tableHeader || [])]
221
- headers.splice(columnIndex, 1)
222
- updateProperty('tableHeader', headers)
223
- }}
224
- />
225
- </div>
226
- {#if column.buttons && column.buttons.length > 0}
227
- <div class="m-2 rounded-lg bg-[var(--field-color)] p-2">
228
- {#each column.buttons as button, buttonIndex}
229
- <div class="flex items-end justify-around gap-2">
230
- <UI.Input
231
- label={{ name: $t('service.constructor.props.name') }}
232
- wrapperClass="!w-2/10"
233
- value={button.name}
234
- type="text"
235
- onUpdate={(value) => updateButtonProperty(columnIndex, buttonIndex, 'name', value)}
236
- />
237
- <UI.Select
238
- wrapperClass="!w-3/10"
239
- label={{ name: $t('service.constructor.props.header') }}
240
- type="buttons"
241
- value={$optionsStore.HEADER_OPTIONS.find((h) => h.value === button.eventHandler?.Header)}
242
- options={$optionsStore.HEADER_OPTIONS}
243
- onUpdate={(option) => {
244
- const handler = button.eventHandler
245
- handler.Header = option.value as string
246
- updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
247
- }}
248
- />
249
- <UI.Input
250
- wrapperClass="!w-2/10"
251
- label={{ name: $t('service.constructor.props.argument') }}
252
- value={button.eventHandler?.Argument}
253
- type="text"
254
- onUpdate={(value) => {
255
- const handler = button.eventHandler
256
- handler.Argument = value as string
257
- updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
258
- }}
259
- />
260
- <UI.Input
261
- wrapperClass="!w-2/10"
262
- label={{ name: $t('service.constructor.props.table.keys') }}
263
- value={button.eventHandler?.Variables.join(' ')}
264
- type="text"
265
- maxlength={500}
266
- regExp={/^[a-zA-Z0-9\-_ ]{0,500}$/}
267
- help={{ info: $t('service.constructor.props.table.keys.info') }}
268
- onUpdate={(value) => {
269
- const handler = { ...button.eventHandler }
270
- handler.Variables = (value as string).trim().split(/\s+/)
271
- updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
272
- }}
273
- />
274
- <UI.Button
275
- wrapperClass="!w-1/20"
276
- icon={{ component: ButtonDelete, properties: { height: '1.5rem', width: '1.5rem' } }}
277
- componentClass="h-10 w-10 border-none hover:shadow-none"
278
- onClick={() => removeButtonFromColumn(columnIndex, buttonIndex)}
279
- />
280
- </div>
281
- {/each}
282
- </div>
283
- {/if}
284
- {/each}
285
- </div>
286
- {/if}
@@ -1,10 +0,0 @@
1
- import type { UIComponent, ITableProps } from '../types';
2
- type $$ComponentProps = {
3
- component: UIComponent & {
4
- properties: Partial<ITableProps<object>>;
5
- };
6
- onPropertyChange: (value: string | object) => void;
7
- };
8
- declare const TableProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type TableProps = ReturnType<typeof TableProps>;
10
- export default TableProps;