poe-svelte-ui-lib 1.1.14 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.svelte +3 -3
- package/dist/Accordion/AccordionProps.svelte +4 -4
- package/dist/Button/Button.svelte +4 -4
- package/dist/Button/ButtonProps.svelte +1 -1
- package/dist/ColorPicker/ColorPicker.svelte +1 -1
- package/dist/ComponentExample.svelte +3 -3
- package/dist/FileAttach/FileAttach.svelte +4 -4
- package/dist/FileAttach/FileAttachProps.svelte +7 -14
- package/dist/Graph/Graph.svelte +2 -2
- package/dist/Graph/GraphProps.svelte +82 -1
- package/dist/Input/Input.svelte +8 -8
- package/dist/Input/InputProps.svelte +133 -1
- package/dist/Modal.svelte +4 -4
- package/dist/ProgressBar/ProgressBar.svelte +3 -2
- package/dist/ProgressBar/ProgressBarProps.svelte +65 -1
- package/dist/Select/Select.svelte +8 -8
- package/dist/Select/SelectProps.svelte +158 -11
- package/dist/Slider/Slider.svelte +6 -6
- package/dist/Slider/SliderProps.svelte +84 -1
- package/dist/Switch/Switch.svelte +5 -5
- package/dist/Switch/SwitchProps.svelte +69 -4
- package/dist/Table/Table.svelte +11 -29
- package/dist/Table/Table.svelte.d.ts +1 -1
- package/dist/Table/TableProps.svelte +189 -11
- package/dist/TextField/TextField.svelte +1 -4
- package/dist/TextField/TextFieldProps.svelte +80 -1
- package/dist/locales/translations.js +20 -0
- package/dist/options.d.ts +5 -0
- package/dist/options.js +17 -0
- package/package.json +6 -6
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
{id}
|
|
96
96
|
value={value?.value ? String(value.value) : ''}
|
|
97
97
|
class={twMerge(
|
|
98
|
-
`w-full rounded-2xl border border-
|
|
98
|
+
`w-full rounded-2xl border border-(--border-color) p-1 text-center duration-250
|
|
99
99
|
${disabled ? 'opacity-50' : 'cursor-pointer hover:shadow-lg'}`,
|
|
100
100
|
value?.class,
|
|
101
101
|
)}
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
|
|
111
111
|
{#if isDropdownOpen}
|
|
112
112
|
<div
|
|
113
|
-
class="absolute top-full left-1/2 z-50 -translate-x-1/2 rounded-b-2xl border border-t-0 border-
|
|
113
|
+
class="absolute top-full left-1/2 z-50 -translate-x-1/2 rounded-b-2xl border border-t-0 border-(--border-color)"
|
|
114
114
|
style="width: calc(100% - 1.8rem);"
|
|
115
115
|
transition:slide={{ duration: 250 }}
|
|
116
116
|
>
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
id={option.id}
|
|
120
120
|
value={option?.value ? String(option.value) : ''}
|
|
121
121
|
class={twMerge(
|
|
122
|
-
`flex h-full w-full cursor-pointer items-center justify-center p-1 duration-250 hover
|
|
122
|
+
`flex h-full w-full cursor-pointer items-center justify-center p-1 duration-250 hover:bg-(--field-color)
|
|
123
123
|
${index === options.length - 1 ? 'rounded-b-2xl' : ''} `,
|
|
124
124
|
option.class,
|
|
125
125
|
)}
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
</div>
|
|
134
134
|
{/if}
|
|
135
135
|
{:else if type === 'buttons'}
|
|
136
|
-
<div {id} class="flex h-full w-full flex-row justify-center rounded-full border border-
|
|
136
|
+
<div {id} class="flex h-full w-full flex-row justify-center rounded-full border border-(--bg-color)">
|
|
137
137
|
{#each options as option, index (option.id)}
|
|
138
138
|
<button
|
|
139
139
|
id={option.id}
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
${option.value === value?.value && value !== null ? 'z-10 py-1 shadow-[0_0_10px_var(--shadow-color)] hover:shadow-[0_0_15px_var(--shadow-color)]' : ''}
|
|
144
144
|
${options.length > 0 && index === 0 ? 'rounded-l-2xl' : ''} ${index === options.length - 1 ? 'rounded-r-2xl' : ''}`,
|
|
145
145
|
option.class,
|
|
146
|
-
)} bg-
|
|
146
|
+
)} bg-(--bg-color)"
|
|
147
147
|
onclick={(e) => selectOption(option, e)}
|
|
148
148
|
disabled={option.disabled}
|
|
149
149
|
>
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
class="w-full appearance-none rounded-2xl border px-4 py-1 text-center transition-shadow
|
|
164
164
|
outline-none hover:shadow-md focus:border-blue-400
|
|
165
165
|
[&::-webkit-inner-spin-button]:hidden [&::-webkit-outer-spin-button]:hidden
|
|
166
|
-
{disabled ? 'cursor-not-allowed opacity-50' : 'cursor-text'} border-
|
|
166
|
+
{disabled ? 'cursor-not-allowed opacity-50' : 'cursor-text'} border-(--border-color)"
|
|
167
167
|
style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
|
|
168
168
|
{id}
|
|
169
169
|
{disabled}
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
|
|
179
179
|
{#if isDropdownOpen}
|
|
180
180
|
<div
|
|
181
|
-
class="absolute top-full left-1/2 z-50 -translate-x-1/2 rounded-b-2xl border border-t-0 border-
|
|
181
|
+
class="absolute top-full left-1/2 z-50 -translate-x-1/2 rounded-b-2xl border border-t-0 border-(--border-color)"
|
|
182
182
|
style="width: calc(100% - 1.8rem);"
|
|
183
183
|
transition:slide={{ duration: 250 }}
|
|
184
184
|
>
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
id={option.id}
|
|
188
188
|
value={option?.value ? String(option.value) : ''}
|
|
189
189
|
class={twMerge(
|
|
190
|
-
`flex h-full w-full cursor-pointer items-center justify-center p-1 duration-250 hover
|
|
190
|
+
`flex h-full w-full cursor-pointer items-center justify-center p-1 duration-250 hover:bg-(--field-color)
|
|
191
191
|
${index === filteredOptions.length - 1 ? 'rounded-b-2xl' : ''} `,
|
|
192
192
|
option.class,
|
|
193
193
|
)}
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
)
|
|
60
60
|
</script>
|
|
61
61
|
|
|
62
|
-
{#if
|
|
62
|
+
{#if forConstructor}
|
|
63
63
|
<div class="relative mb-4 flex flex-row items-start justify-center">
|
|
64
64
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
65
65
|
<UI.Select
|
|
@@ -67,10 +67,20 @@
|
|
|
67
67
|
options={VARIABLE_OPTIONS}
|
|
68
68
|
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
69
69
|
onUpdate={(value) => {
|
|
70
|
-
updateProperty('id', value.value as string, component, onPropertyChange
|
|
70
|
+
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
71
71
|
updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
|
|
72
72
|
}}
|
|
73
73
|
/>
|
|
74
|
+
<UI.Select
|
|
75
|
+
label={{ name: $t('constructor.props.argument') }}
|
|
76
|
+
type="buttons"
|
|
77
|
+
value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument) ??
|
|
78
|
+
$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === '')}
|
|
79
|
+
options={$optionsStore.FULL_ARGUMENT_OPTION}
|
|
80
|
+
onUpdate={(option) => {
|
|
81
|
+
updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
74
84
|
|
|
75
85
|
<UI.Input
|
|
76
86
|
wrapperClass="{Header.value === 'SET' ? 'mt-1' : ''} "
|
|
@@ -80,15 +90,7 @@
|
|
|
80
90
|
help={{ info: $t('constructor.props.argument.info'), autocomplete: 'on', regExp: /^[a-zA-Z0-9\-_]{0,32}$/ }}
|
|
81
91
|
onUpdate={(value) => updateProperty('eventHandler.Argument', value as string, component, onPropertyChange)}
|
|
82
92
|
/>
|
|
83
|
-
|
|
84
|
-
label={{ name: $t('constructor.props.variable') }}
|
|
85
|
-
options={VARIABLE_OPTIONS}
|
|
86
|
-
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
87
|
-
onUpdate={(value) => {
|
|
88
|
-
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
89
|
-
updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
|
|
90
|
-
}}
|
|
91
|
-
/>
|
|
93
|
+
|
|
92
94
|
<UI.Select
|
|
93
95
|
label={{ name: $t('constructor.props.type') }}
|
|
94
96
|
type="buttons"
|
|
@@ -149,6 +151,151 @@
|
|
|
149
151
|
|
|
150
152
|
<hr class="border-gray-400" />
|
|
151
153
|
|
|
154
|
+
<!-- Настройки опций -->
|
|
155
|
+
<div class="space-y-4">
|
|
156
|
+
<div class="m-0 flex items-center justify-center gap-2">
|
|
157
|
+
<h4>{$t('constructor.props.options.title')}</h4>
|
|
158
|
+
<UI.Button
|
|
159
|
+
wrapperClass="w-8"
|
|
160
|
+
content={{ icon: ButtonAdd }}
|
|
161
|
+
onClick={() => {
|
|
162
|
+
const newOption: ISelectOption = {
|
|
163
|
+
id: crypto.randomUUID(),
|
|
164
|
+
name: 'New Button',
|
|
165
|
+
class: 'bg-max',
|
|
166
|
+
}
|
|
167
|
+
const options = [...(component.properties?.options || []), newOption]
|
|
168
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
169
|
+
}}
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
{#each component.properties.options || [] as option, index (option.id)}
|
|
174
|
+
<div class="m-0 flex items-end justify-around gap-2 border-gray-400">
|
|
175
|
+
<UI.Input
|
|
176
|
+
label={{ name: $t('constructor.props.optionname') }}
|
|
177
|
+
wrapperClass="!w-3/10"
|
|
178
|
+
value={option.name}
|
|
179
|
+
onUpdate={(value) => {
|
|
180
|
+
const options = [...(component.properties?.options || [])]
|
|
181
|
+
options[index]['name'] = value
|
|
182
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
183
|
+
}}
|
|
184
|
+
/>
|
|
185
|
+
<UI.Input
|
|
186
|
+
label={{ name: $t('constructor.props.optionvalue') }}
|
|
187
|
+
wrapperClass="!w-3/10"
|
|
188
|
+
value={option.value}
|
|
189
|
+
type={currentValueType.value}
|
|
190
|
+
onUpdate={(value) => {
|
|
191
|
+
const options = [...(component.properties?.options || [])]
|
|
192
|
+
options[index]['value'] = value
|
|
193
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
194
|
+
}}
|
|
195
|
+
/>
|
|
196
|
+
<UI.Select
|
|
197
|
+
wrapperClass="w-80 h-14.5"
|
|
198
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
199
|
+
type="buttons"
|
|
200
|
+
options={$optionsStore.COLOR_OPTIONS}
|
|
201
|
+
value={$optionsStore.COLOR_OPTIONS.find((c) =>
|
|
202
|
+
(c.value as string).includes(option.class.split(' ').find((cls: string) => cls.startsWith('bg-'))),
|
|
203
|
+
)}
|
|
204
|
+
onUpdate={(option) => {
|
|
205
|
+
const options = [...(component.properties?.options || [])]
|
|
206
|
+
options[index]['class'] = option.value
|
|
207
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
208
|
+
}}
|
|
209
|
+
/>
|
|
210
|
+
<UI.Button
|
|
211
|
+
wrapperClass="w-8"
|
|
212
|
+
content={{ icon: ButtonDelete }}
|
|
213
|
+
onClick={() => {
|
|
214
|
+
const options = [...(component.properties?.options || [])]
|
|
215
|
+
options.splice(index, 1)
|
|
216
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
217
|
+
}}
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
220
|
+
{/each}
|
|
221
|
+
</div>
|
|
222
|
+
{:else}
|
|
223
|
+
<div class="relative mb-4 flex flex-row items-start justify-center">
|
|
224
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
225
|
+
<UI.Input
|
|
226
|
+
label={{ name: $t('constructor.props.id') }}
|
|
227
|
+
value={component.properties.id}
|
|
228
|
+
onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
|
|
229
|
+
/>
|
|
230
|
+
<UI.Input
|
|
231
|
+
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
232
|
+
value={component.properties.wrapperClass}
|
|
233
|
+
onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
|
|
234
|
+
/>
|
|
235
|
+
<UI.Select
|
|
236
|
+
wrapperClass=" h-14"
|
|
237
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
238
|
+
type="buttons"
|
|
239
|
+
options={$optionsStore.COLOR_OPTIONS}
|
|
240
|
+
value={initialColor}
|
|
241
|
+
onUpdate={(option) => {
|
|
242
|
+
updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)
|
|
243
|
+
const options = [...(component.properties?.options || [])]
|
|
244
|
+
options.forEach((o) => {
|
|
245
|
+
o['class'] = option.value
|
|
246
|
+
})
|
|
247
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
248
|
+
}}
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
252
|
+
<UI.Input
|
|
253
|
+
label={{ name: $t('constructor.props.label') }}
|
|
254
|
+
value={component.properties.label.name}
|
|
255
|
+
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
256
|
+
/>
|
|
257
|
+
<UI.Input
|
|
258
|
+
label={{ name: $t('constructor.props.label.class') }}
|
|
259
|
+
value={component.properties.label.class}
|
|
260
|
+
onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
|
|
261
|
+
/>
|
|
262
|
+
</div>
|
|
263
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
264
|
+
<UI.Select
|
|
265
|
+
label={{ name: $t('constructor.props.type') }}
|
|
266
|
+
type="buttons"
|
|
267
|
+
value={currentType}
|
|
268
|
+
options={$optionsStore.SELECT_TYPE_OPTIONS}
|
|
269
|
+
onUpdate={(item) => updateProperty('type', item.value as string, component, onPropertyChange)}
|
|
270
|
+
/>
|
|
271
|
+
<UI.Select
|
|
272
|
+
wrapperClass="h-14"
|
|
273
|
+
label={{ name: $t('constructor.props.valuetype') }}
|
|
274
|
+
type="buttons"
|
|
275
|
+
options={$optionsStore.SELECT_VALUE_TYPE_OPTIONS}
|
|
276
|
+
value={currentValueType}
|
|
277
|
+
onUpdate={(value) => {
|
|
278
|
+
currentValueType = value as ValueTypeOption
|
|
279
|
+
const options = [...(component.properties?.options || [])]
|
|
280
|
+
const newType = value.value
|
|
281
|
+
options.forEach((option) => {
|
|
282
|
+
if (newType === 'number') option.value = option.value !== undefined ? Number(option.value) : 0
|
|
283
|
+
else option.value = option.value !== undefined ? String(option.value) : ''
|
|
284
|
+
})
|
|
285
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
286
|
+
}}
|
|
287
|
+
/>
|
|
288
|
+
<UI.Switch
|
|
289
|
+
wrapperClass="bg-blue"
|
|
290
|
+
label={{ name: $t('constructor.props.disabled') }}
|
|
291
|
+
value={component.properties.disabled ? 2 : 1}
|
|
292
|
+
onChange={(value) => updateProperty('disabled', value === 2, component, onPropertyChange)}
|
|
293
|
+
/>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
|
|
297
|
+
<hr class="border-gray-400" />
|
|
298
|
+
|
|
152
299
|
<!-- Настройки опций -->
|
|
153
300
|
<div class="space-y-4">
|
|
154
301
|
<div class="m-0 flex items-center justify-center gap-2">
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
{#if isRange}
|
|
103
103
|
<!-- Трек и активная зона -->
|
|
104
104
|
<div
|
|
105
|
-
class={`absolute h-full w-full rounded-full bg-
|
|
105
|
+
class={`absolute h-full w-full rounded-full bg-(--gray-color) ${disabled ? '' : 'cursor-pointer'}`}
|
|
106
106
|
role="button"
|
|
107
107
|
tabindex={null}
|
|
108
108
|
onkeydown={null}
|
|
109
109
|
onclick={disabled ? undefined : handleTrackClick}
|
|
110
110
|
>
|
|
111
|
-
<div class="absolute h-full rounded-full bg-
|
|
111
|
+
<div class="absolute h-full rounded-full bg-(--bg-color)" style={`left: ${lowerPosition}%; right: ${100 - upperPosition}%;`}></div>
|
|
112
112
|
</div>
|
|
113
113
|
|
|
114
114
|
<!-- Ползунки -->
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
class={`absolute h-full w-full appearance-none bg-transparent ${activeThumb === 'lower' ? 'z-30' : 'z-20'}`}
|
|
131
131
|
/>
|
|
132
132
|
<div
|
|
133
|
-
class="pointer-events-none absolute z-40 rounded-full bg-
|
|
133
|
+
class="pointer-events-none absolute z-40 rounded-full bg-(--field-color)"
|
|
134
134
|
style={`left: calc(${lowerPosition}% + 0rem); top: 50%; transform: translateY(-50%)`}
|
|
135
135
|
>
|
|
136
136
|
<IconGripVerticalLeft />
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
class={`absolute h-full w-full appearance-none bg-transparent ${activeThumb === 'upper' ? 'z-30' : 'z-20'}`}
|
|
155
155
|
/>
|
|
156
156
|
<div
|
|
157
|
-
class="pointer-events-none absolute z-40 rounded-full bg-
|
|
157
|
+
class="pointer-events-none absolute z-40 rounded-full bg-(--field-color)"
|
|
158
158
|
style={`left: calc(${upperPosition}% - 2rem); top: 50%; transform: translateY(-50%)`}
|
|
159
159
|
>
|
|
160
160
|
<IconGripVerticalRight />
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
{:else}
|
|
163
163
|
<!-- Одиночный слайдер -->
|
|
164
164
|
<div
|
|
165
|
-
class={`absolute h-full w-full rounded-full bg-
|
|
165
|
+
class={`absolute h-full w-full rounded-full bg-(--gray-color) ${disabled ? '' : 'cursor-pointer'}`}
|
|
166
166
|
role="button"
|
|
167
167
|
tabindex={null}
|
|
168
168
|
onkeydown={null}
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
class="absolute z-20 h-full w-full appearance-none"
|
|
191
191
|
/>
|
|
192
192
|
<div
|
|
193
|
-
class="pointer-events-none absolute z-30 rounded-full bg-
|
|
193
|
+
class="pointer-events-none absolute z-30 rounded-full bg-(--field-color)"
|
|
194
194
|
style={`left: clamp(1rem, ${singlePosition}%, calc(100% - 1rem)); top: 50%; transform: translate(-50%, -50%)`}
|
|
195
195
|
>
|
|
196
196
|
<IconGripVerticalDual />
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
)
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
|
-
{#if
|
|
35
|
+
{#if forConstructor}
|
|
36
36
|
<div class="relative flex flex-row items-start justify-center">
|
|
37
37
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
38
38
|
<UI.Select
|
|
@@ -107,4 +107,87 @@
|
|
|
107
107
|
/>
|
|
108
108
|
</div>
|
|
109
109
|
</div>
|
|
110
|
+
{:else}
|
|
111
|
+
<div class="relative flex flex-row items-start justify-center">
|
|
112
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
113
|
+
<UI.Input
|
|
114
|
+
label={{ name: $t('constructor.props.id') }}
|
|
115
|
+
value={component.properties.id}
|
|
116
|
+
onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
|
|
117
|
+
/>
|
|
118
|
+
<UI.Input
|
|
119
|
+
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
120
|
+
value={component.properties.wrapperClass}
|
|
121
|
+
onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
|
|
122
|
+
/>
|
|
123
|
+
<UI.Select
|
|
124
|
+
wrapperClass=" h-14"
|
|
125
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
126
|
+
type="buttons"
|
|
127
|
+
options={$optionsStore.COLOR_OPTIONS}
|
|
128
|
+
value={initialColor}
|
|
129
|
+
onUpdate={(option) => {
|
|
130
|
+
updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)
|
|
131
|
+
const options = [...(component.properties?.options || [])]
|
|
132
|
+
options.forEach((o) => {
|
|
133
|
+
o['class'] = option.value
|
|
134
|
+
})
|
|
135
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
<UI.Switch
|
|
139
|
+
wrapperClass="bg-blue"
|
|
140
|
+
label={{ name: $t('constructor.props.disabled') }}
|
|
141
|
+
value={component.properties.disabled ? 2 : 1}
|
|
142
|
+
onChange={(value) => updateProperty('disabled', value === 2, component, onPropertyChange)}
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
146
|
+
<UI.Input
|
|
147
|
+
label={{ name: $t('constructor.props.label') }}
|
|
148
|
+
value={component.properties.label.name}
|
|
149
|
+
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
150
|
+
/>
|
|
151
|
+
<UI.Input
|
|
152
|
+
label={{ name: $t('constructor.props.label.class') }}
|
|
153
|
+
value={component.properties.label.class}
|
|
154
|
+
onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
|
|
155
|
+
/>
|
|
156
|
+
<UI.Input
|
|
157
|
+
label={{ name: $t('constructor.props.value') }}
|
|
158
|
+
value={component.properties.value}
|
|
159
|
+
onUpdate={(value) => updateProperty('value', value as string, component, onPropertyChange)}
|
|
160
|
+
/>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
163
|
+
<UI.Select
|
|
164
|
+
label={{ name: $t('constructor.props.type') }}
|
|
165
|
+
type="buttons"
|
|
166
|
+
value={$optionsStore.SLIDER_TYPE_OPTIONS.find((opt) => opt.value === (component.properties.type || 'single'))}
|
|
167
|
+
options={$optionsStore.SLIDER_TYPE_OPTIONS}
|
|
168
|
+
onUpdate={(type) => {
|
|
169
|
+
updateProperty('value', type.value === 'single' ? 5 : [2, 7], component, onPropertyChange)
|
|
170
|
+
updateProperty('type', type.value as string, component, onPropertyChange)
|
|
171
|
+
}}
|
|
172
|
+
/>
|
|
173
|
+
<UI.Input
|
|
174
|
+
label={{ name: $t('constructor.props.minnum') }}
|
|
175
|
+
value={component.properties.number.minNum as number}
|
|
176
|
+
type="number"
|
|
177
|
+
onUpdate={(value) => updateProperty('number.minNum', Number(value), component, onPropertyChange)}
|
|
178
|
+
/>
|
|
179
|
+
<UI.Input
|
|
180
|
+
label={{ name: $t('constructor.props.maxnum') }}
|
|
181
|
+
value={component.properties.number.maxNum as number}
|
|
182
|
+
type="number"
|
|
183
|
+
onUpdate={(value) => updateProperty('number.maxNum', Number(value), component, onPropertyChange)}
|
|
184
|
+
/>
|
|
185
|
+
<UI.Input
|
|
186
|
+
label={{ name: $t('constructor.props.step') }}
|
|
187
|
+
value={component.properties.number.step as number}
|
|
188
|
+
type="number"
|
|
189
|
+
onUpdate={(value) => updateProperty('number.step', Number(value), component, onPropertyChange)}
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
110
193
|
{/if}
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
<h5 class={`w-full px-4 text-center`}>{label.name}</h5>
|
|
50
50
|
{/if}
|
|
51
51
|
|
|
52
|
-
<div class="relative flex w-full grow items-center justify-center
|
|
52
|
+
<div class="relative flex w-full grow items-center justify-center bg-transparent">
|
|
53
53
|
<button
|
|
54
54
|
class="mr-2 {disabled ? 'opacity-60' : 'cursor-pointer'}"
|
|
55
55
|
style="width: {maxCaptionWidth}; text-align: end;"
|
|
56
56
|
onclick={() => handleCaptionClick(1)}>{label.captionLeft}</button
|
|
57
57
|
>
|
|
58
58
|
<label
|
|
59
|
-
class="relative flex items-center justify-between rounded-full border
|
|
60
|
-
{checked ? '
|
|
59
|
+
class="relative flex items-center justify-between rounded-full border
|
|
60
|
+
{checked ? 'border-(--bg-color)' : 'border-(--gray-color)'}
|
|
61
61
|
{disabled ? 'opacity-60' : ''}"
|
|
62
62
|
>
|
|
63
63
|
<input
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
/>
|
|
71
71
|
<span
|
|
72
72
|
class="relative flex items-center rounded-full transition-all duration-250
|
|
73
|
-
{checked ? '
|
|
73
|
+
{checked ? 'bg-(--bg-color)' : 'bg-(--gray-color)'}
|
|
74
74
|
{disabled ? '' : 'cursor-pointer'}"
|
|
75
75
|
style="width: {`calc(${height} * 2)`}; height: {height};"
|
|
76
76
|
>
|
|
77
77
|
<span
|
|
78
|
-
class="absolute rounded-full bg-
|
|
78
|
+
class="absolute rounded-full bg-(--back-color) transition-all duration-250
|
|
79
79
|
{disabled ? 'opacity-60' : 'cursor-pointer'}"
|
|
80
80
|
style="width: {`calc(${height} * 0.75)`}; height: {`calc(${height} * 0.75)`}; margin: 0 {`calc(${height} * 0.1)`}; transform: {knobTransform};"
|
|
81
81
|
></span>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
)
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
|
-
{#if
|
|
28
|
+
{#if forConstructor}
|
|
29
29
|
<div class="relative flex flex-row items-start justify-center">
|
|
30
30
|
<!-- Сообщение для отправки в ws по нажатию кнопки -->
|
|
31
31
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
@@ -52,13 +52,11 @@
|
|
|
52
52
|
<UI.Input
|
|
53
53
|
label={{ name: $t('constructor.props.caption.left') }}
|
|
54
54
|
value={component.properties.label.captionLeft}
|
|
55
|
-
type="text"
|
|
56
55
|
onUpdate={(value) => updateProperty('label.captionLeft', value as string, component, onPropertyChange)}
|
|
57
56
|
/>
|
|
58
57
|
<UI.Input
|
|
59
58
|
label={{ name: $t('constructor.props.caption.right') }}
|
|
60
59
|
value={component.properties.label.captionRight}
|
|
61
|
-
type="text"
|
|
62
60
|
onUpdate={(value) => updateProperty('label.captionRight', value as string, component, onPropertyChange)}
|
|
63
61
|
/>
|
|
64
62
|
<UI.Switch
|
|
@@ -72,7 +70,6 @@
|
|
|
72
70
|
<UI.Input
|
|
73
71
|
label={{ name: $t('constructor.props.label') }}
|
|
74
72
|
value={component.properties.label.name}
|
|
75
|
-
type="text"
|
|
76
73
|
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
77
74
|
/>
|
|
78
75
|
<UI.Select
|
|
@@ -85,4 +82,72 @@
|
|
|
85
82
|
/>
|
|
86
83
|
</div>
|
|
87
84
|
</div>
|
|
85
|
+
{:else}
|
|
86
|
+
<div class="relative flex flex-row items-start justify-center">
|
|
87
|
+
<!-- Сообщение для отправки в ws по нажатию кнопки -->
|
|
88
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
89
|
+
<UI.Input
|
|
90
|
+
label={{ name: $t('constructor.props.id') }}
|
|
91
|
+
value={component.properties.id}
|
|
92
|
+
onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
|
|
93
|
+
/>
|
|
94
|
+
<UI.Input
|
|
95
|
+
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
96
|
+
value={component.properties.wrapperClass}
|
|
97
|
+
onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
|
|
98
|
+
/>
|
|
99
|
+
<UI.Select
|
|
100
|
+
wrapperClass=" h-14"
|
|
101
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
102
|
+
type="buttons"
|
|
103
|
+
options={$optionsStore.COLOR_OPTIONS}
|
|
104
|
+
value={initialColor}
|
|
105
|
+
onUpdate={(option) => {
|
|
106
|
+
updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)
|
|
107
|
+
const options = [...(component.properties?.options || [])]
|
|
108
|
+
options.forEach((o) => {
|
|
109
|
+
o['class'] = option.value
|
|
110
|
+
})
|
|
111
|
+
updateProperty('options', options, component, onPropertyChange)
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
116
|
+
<UI.Input
|
|
117
|
+
label={{ name: $t('constructor.props.label') }}
|
|
118
|
+
value={component.properties.label.name}
|
|
119
|
+
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
120
|
+
/>
|
|
121
|
+
<UI.Input
|
|
122
|
+
label={{ name: $t('constructor.props.caption.left') }}
|
|
123
|
+
value={component.properties.label.captionLeft}
|
|
124
|
+
onUpdate={(value) => updateProperty('label.captionLeft', value as string, component, onPropertyChange)}
|
|
125
|
+
/>
|
|
126
|
+
<UI.Input
|
|
127
|
+
label={{ name: $t('constructor.props.caption.right') }}
|
|
128
|
+
value={component.properties.label.captionRight}
|
|
129
|
+
onUpdate={(value) => updateProperty('label.captionRight', value as string, component, onPropertyChange)}
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
133
|
+
<UI.Input
|
|
134
|
+
label={{ name: $t('constructor.props.height') }}
|
|
135
|
+
value={component.properties.height}
|
|
136
|
+
onUpdate={(value) => updateProperty('height', value as string, component, onPropertyChange)}
|
|
137
|
+
/>
|
|
138
|
+
<UI.Input
|
|
139
|
+
label={{ name: $t('constructor.props.value') }}
|
|
140
|
+
value={component.properties.value}
|
|
141
|
+
type="number"
|
|
142
|
+
number={{ minNum: 1, maxNum: 2, step: 1 }}
|
|
143
|
+
onUpdate={(value) => updateProperty('value', value as number, component, onPropertyChange)}
|
|
144
|
+
/>
|
|
145
|
+
<UI.Switch
|
|
146
|
+
wrapperClass="bg-blue"
|
|
147
|
+
label={{ name: $t('constructor.props.disabled') }}
|
|
148
|
+
value={component.properties.disabled ? 2 : 1}
|
|
149
|
+
onChange={(value) => updateProperty('disabled', value === 2, component, onPropertyChange)}
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
88
153
|
{/if}
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import type { ITableHeader, ITableProps } from '../types'
|
|
5
5
|
import { fly } from 'svelte/transition'
|
|
6
6
|
import { twMerge } from 'tailwind-merge'
|
|
7
|
-
import { Button, Modal } from '..'
|
|
8
|
-
import { t } from '../locales/i18n'
|
|
9
7
|
|
|
10
8
|
let {
|
|
11
9
|
id = crypto.randomUUID(),
|
|
@@ -17,11 +15,10 @@
|
|
|
17
15
|
cursor = null,
|
|
18
16
|
loader,
|
|
19
17
|
getData = () => {},
|
|
18
|
+
modalData = $bindable(),
|
|
20
19
|
onClick,
|
|
21
20
|
}: ITableProps<any> = $props()
|
|
22
21
|
|
|
23
|
-
let modalData = $state({ isOpen: false, rawData: '', formattedData: '' })
|
|
24
|
-
|
|
25
22
|
/* Сортировка */
|
|
26
23
|
let sortState: {
|
|
27
24
|
key: string | null
|
|
@@ -100,6 +97,7 @@
|
|
|
100
97
|
rawData: text,
|
|
101
98
|
formattedData: formatting ? formatting(text) : (text ?? ''),
|
|
102
99
|
}
|
|
100
|
+
// console.log(modalData)
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
const showTooltip = (event: MouseEvent, text: string, formatting?: (text: string) => string) => {
|
|
@@ -128,11 +126,11 @@
|
|
|
128
126
|
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
129
127
|
{/if}
|
|
130
128
|
|
|
131
|
-
<div class="flex h-full flex-col overflow-hidden rounded-xl border-
|
|
129
|
+
<div class="flex h-full flex-col overflow-hidden rounded-xl border-(--border-color)">
|
|
132
130
|
<!-- Table Header -->
|
|
133
131
|
<div class="grid font-semibold" style={`grid-template-columns: ${header.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
|
|
134
132
|
{#each header as column (column)}
|
|
135
|
-
<div class={twMerge(`justify-center bg-
|
|
133
|
+
<div class={twMerge(`justify-center bg-(--bg-color) p-2 text-left`, column.label?.class)}>
|
|
136
134
|
<span>{column.label?.name}</span>
|
|
137
135
|
{#if column.sortable}
|
|
138
136
|
<button
|
|
@@ -147,13 +145,13 @@
|
|
|
147
145
|
</div>
|
|
148
146
|
|
|
149
147
|
<!-- Table Body с прокруткой -->
|
|
150
|
-
<div class="flex-1 overflow-y-auto bg-
|
|
148
|
+
<div class="flex-1 overflow-y-auto bg-(--container-color)/50" bind:this={container} onscroll={handleScroll}>
|
|
151
149
|
<div class="grid min-w-0" style={`grid-template-columns: ${header.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
|
|
152
150
|
{#each body as row, index (row)}
|
|
153
151
|
{#each header as column (column)}
|
|
154
152
|
<div
|
|
155
|
-
class="relative flex w-full min-w-0 items-center px-2 py-1 break-
|
|
156
|
-
{index % 2 ? '
|
|
153
|
+
class="relative flex w-full min-w-0 items-center px-2 py-1 wrap-break-word
|
|
154
|
+
{index % 2 ? 'bg-(--back-color)/40' : 'bg-[#edeef3] dark:bg-[#1f2a3a]'}
|
|
157
155
|
{column.align === 'center'
|
|
158
156
|
? 'flex justify-center text-center'
|
|
159
157
|
: column.align === 'right'
|
|
@@ -166,7 +164,7 @@
|
|
|
166
164
|
<button
|
|
167
165
|
class="{twMerge(`cursor-pointer rounded-full
|
|
168
166
|
px-4 py-1 font-medium transition-shadow outline-none select-none hover:shadow-md
|
|
169
|
-
${typeof button.class === 'function' ? button.class(row) : button.class}`)} bg-
|
|
167
|
+
${typeof button.class === 'function' ? button.class(row) : button.class}`)} bg-(--bg-color)"
|
|
170
168
|
onclick={() => buttonClick(row, button)}
|
|
171
169
|
>
|
|
172
170
|
{typeof button.name === 'function' ? button.name(row) : button.name}
|
|
@@ -191,7 +189,7 @@
|
|
|
191
189
|
</div>
|
|
192
190
|
{:else}
|
|
193
191
|
<div
|
|
194
|
-
class="w-full max-w-full break-
|
|
192
|
+
class="w-full max-w-full wrap-break-word {column.overflow?.truncated
|
|
195
193
|
? 'overflow-hidden text-ellipsis whitespace-nowrap'
|
|
196
194
|
: 'whitespace-normal'}"
|
|
197
195
|
onmouseenter={column.overflow?.truncated ? (e) => showTooltip(e, row[column.key], column.overflow?.formatting) : undefined}
|
|
@@ -233,7 +231,7 @@
|
|
|
233
231
|
>
|
|
234
232
|
<div class=" size-5 text-sm [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full">
|
|
235
233
|
{#if copiedCell.y === index && copiedCell.x === column.key}
|
|
236
|
-
<div class="rounded-md bg-
|
|
234
|
+
<div class="rounded-md bg-(--green-color) shadow-lg">✓</div>
|
|
237
235
|
{:else}
|
|
238
236
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
239
237
|
<g fill="none" stroke="currentColor" stroke-width="1.5">
|
|
@@ -268,25 +266,9 @@
|
|
|
268
266
|
|
|
269
267
|
<!-- Нижнее поле для сводной информации -->
|
|
270
268
|
{#if footer}
|
|
271
|
-
<div class="flex h-8 items-center justify-center bg-
|
|
269
|
+
<div class="flex h-8 items-center justify-center bg-(--bg-color)">
|
|
272
270
|
<h5>{footer}</h5>
|
|
273
271
|
</div>
|
|
274
272
|
{/if}
|
|
275
273
|
</div>
|
|
276
274
|
</div>
|
|
277
|
-
|
|
278
|
-
<Modal isOpen={modalData.isOpen} title={$t('debug.baud_rate_data')}>
|
|
279
|
-
{#snippet main()}
|
|
280
|
-
{@html modalData.formattedData}
|
|
281
|
-
{/snippet}
|
|
282
|
-
{#snippet footer()}
|
|
283
|
-
<Button
|
|
284
|
-
content={{ name: 'Copy' }}
|
|
285
|
-
wrapperClass="w-20 bg-pink"
|
|
286
|
-
onClick={() => {
|
|
287
|
-
navigator.clipboard.writeText(modalData.rawData)
|
|
288
|
-
modalData.isOpen = false
|
|
289
|
-
}}
|
|
290
|
-
/>
|
|
291
|
-
{/snippet}
|
|
292
|
-
</Modal>
|