poe-svelte-ui-lib 1.2.24 → 1.2.26
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/AccordionProps.svelte +18 -4
- package/dist/Accordion/AccordionProps.svelte.d.ts +1 -1
- package/dist/Button/ButtonProps.svelte +15 -7
- package/dist/Button/ButtonProps.svelte.d.ts +1 -1
- package/dist/ColorPicker/ColorPickerProps.svelte +17 -9
- package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +1 -1
- package/dist/FileAttach/FileAttach.svelte +4 -10
- package/dist/FileAttach/FileAttachProps.svelte +1 -1
- package/dist/FileAttach/FileAttachProps.svelte.d.ts +1 -1
- package/dist/Graph/GraphProps.svelte +3 -2
- package/dist/Graph/GraphProps.svelte.d.ts +1 -1
- package/dist/Input/InputProps.svelte +11 -4
- package/dist/Input/InputProps.svelte.d.ts +1 -1
- package/dist/Joystick/Joystick.svelte +1 -1
- package/dist/ProgressBar/ProgressBarProps.svelte +1 -1
- package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +1 -1
- package/dist/Select/SelectProps.svelte +27 -25
- package/dist/Select/SelectProps.svelte.d.ts +1 -1
- package/dist/Slider/Slider.svelte +168 -128
- package/dist/Slider/SliderProps.svelte +17 -2
- package/dist/Slider/SliderProps.svelte.d.ts +1 -1
- package/dist/Switch/Switch.svelte +1 -1
- package/dist/Switch/SwitchProps.svelte +26 -8
- package/dist/Switch/SwitchProps.svelte.d.ts +1 -1
- package/dist/Table/Table.svelte +2 -2
- package/dist/Table/TableProps.svelte +33 -7
- package/dist/Table/TableProps.svelte.d.ts +1 -1
- package/dist/Tabs/TabsProps.svelte +1 -1
- package/dist/Tabs/TabsProps.svelte.d.ts +1 -1
- package/dist/TextField/TextFieldProps.svelte +13 -6
- package/dist/TextField/TextFieldProps.svelte.d.ts +1 -1
- package/dist/locales/translations.js +4 -6
- package/dist/types.d.ts +2 -1
- package/dist/types.js +2 -2
- package/package.json +2 -2
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/Slider.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import type { ISliderProps } from '../types'
|
|
4
|
-
import IconGripVerticalLeft from '../libIcons/IconGripVerticalLeft.svelte'
|
|
5
|
-
import IconGripVerticalRight from '../libIcons/IconGripVerticalRight.svelte'
|
|
6
|
-
import IconGripVerticalDual from '../libIcons/IconGripVerticalDual.svelte'
|
|
7
4
|
import { twMerge } from 'tailwind-merge'
|
|
5
|
+
import { onDestroy, onMount } from 'svelte'
|
|
8
6
|
|
|
9
7
|
let {
|
|
10
8
|
id = crypto.randomUUID(),
|
|
@@ -27,11 +25,6 @@
|
|
|
27
25
|
let lowerValue = $derived(isRange && Array.isArray(value) ? value[0] : number.minNum)
|
|
28
26
|
let upperValue = $derived(isRange && Array.isArray(value) ? value[1] : number.maxNum)
|
|
29
27
|
|
|
30
|
-
/* Расчет позиций */
|
|
31
|
-
const singlePosition = $derived(((singleValue - number.minNum) / (number.maxNum - number.minNum)) * 100)
|
|
32
|
-
const lowerPosition = $derived(((lowerValue - number.minNum) / (number.maxNum - number.minNum)) * 100)
|
|
33
|
-
const upperPosition = $derived(((upperValue - number.minNum) / (number.maxNum - number.minNum)) * 100)
|
|
34
|
-
|
|
35
28
|
$effect(() => {
|
|
36
29
|
if (value === undefined || value === null) {
|
|
37
30
|
if (type === 'single' && !value) value = number.minNum
|
|
@@ -44,8 +37,10 @@
|
|
|
44
37
|
if (isRange && target !== 'single') {
|
|
45
38
|
if (target === 'lower') {
|
|
46
39
|
lowerValue = Math.max(number.minNum, Math.min(lowerValue + stepValue, upperValue))
|
|
40
|
+
lowerValue = lowerValue == upperValue ? upperValue - number.step : lowerValue
|
|
47
41
|
} else {
|
|
48
42
|
upperValue = Math.min(number.maxNum, Math.max(upperValue + stepValue, lowerValue))
|
|
43
|
+
upperValue = upperValue == lowerValue ? upperValue + number.step : upperValue
|
|
49
44
|
}
|
|
50
45
|
onUpdate([lowerValue, upperValue])
|
|
51
46
|
} else {
|
|
@@ -80,19 +75,65 @@
|
|
|
80
75
|
|
|
81
76
|
if (activeThumb === 'lower') {
|
|
82
77
|
lowerValue = Math.max(number.minNum, Math.min(clickValue, upperValue))
|
|
78
|
+
lowerValue = lowerValue == upperValue ? upperValue - number.step : lowerValue
|
|
83
79
|
} else {
|
|
84
80
|
upperValue = Math.min(number.maxNum, Math.max(clickValue, lowerValue))
|
|
81
|
+
upperValue = upperValue == lowerValue ? upperValue + number.step : upperValue
|
|
85
82
|
}
|
|
86
|
-
|
|
87
83
|
onUpdate([lowerValue, upperValue])
|
|
88
84
|
} else {
|
|
89
85
|
singleValue = Math.max(number.minNum, Math.min(clickValue, number.maxNum))
|
|
90
86
|
onUpdate(singleValue)
|
|
91
87
|
}
|
|
92
88
|
}
|
|
89
|
+
|
|
90
|
+
let rangeRefLower: HTMLElement | null = $state(null)
|
|
91
|
+
let rangeRefUpper: HTMLElement | null = $state(null)
|
|
92
|
+
let shadowWidth = $state()
|
|
93
|
+
|
|
94
|
+
const updateShadowWidth = () => {
|
|
95
|
+
let thumbCenterLower
|
|
96
|
+
let thumbCenterUpper
|
|
97
|
+
|
|
98
|
+
if (rangeRefLower) {
|
|
99
|
+
const rect = rangeRefLower.getBoundingClientRect()
|
|
100
|
+
const percent = (lowerValue - number.minNum) / (number.maxNum - number.minNum)
|
|
101
|
+
thumbCenterLower = rect.left + rect.width * percent
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (rangeRefUpper) {
|
|
105
|
+
const rect = rangeRefUpper.getBoundingClientRect()
|
|
106
|
+
const percent = (upperValue - number.minNum) / (number.maxNum - number.minNum)
|
|
107
|
+
thumbCenterUpper = rect.left + rect.width * percent
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (thumbCenterUpper && thumbCenterLower) {
|
|
111
|
+
shadowWidth = (thumbCenterUpper - thumbCenterLower) / 3.5
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
$effect(() => {
|
|
116
|
+
lowerValue
|
|
117
|
+
upperValue
|
|
118
|
+
updateShadowWidth()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
onMount(() => {
|
|
122
|
+
if (window.visualViewport) {
|
|
123
|
+
const handleResize = () => {
|
|
124
|
+
updateShadowWidth()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
window.visualViewport.addEventListener('resize', handleResize)
|
|
128
|
+
|
|
129
|
+
onDestroy(() => {
|
|
130
|
+
if (window.visualViewport) window.visualViewport.removeEventListener('resize', handleResize)
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
})
|
|
93
134
|
</script>
|
|
94
135
|
|
|
95
|
-
<div class={twMerge(`relative flex w-full flex-col items-center `, wrapperClass)}>
|
|
136
|
+
<div class={twMerge(`bg-blue relative flex w-full flex-col items-center `, wrapperClass)}>
|
|
96
137
|
{#if label.name}
|
|
97
138
|
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
98
139
|
{/if}
|
|
@@ -100,22 +141,24 @@
|
|
|
100
141
|
<!-- Слайдер -->
|
|
101
142
|
<div
|
|
102
143
|
id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
|
|
103
|
-
class="relative flex h-
|
|
144
|
+
class="relative flex h-9 w-full justify-center rounded-full {disabled ? 'cursor-not-allowed opacity-50' : ''}"
|
|
104
145
|
>
|
|
105
146
|
{#if isRange}
|
|
147
|
+
{@const userAgent = navigator.userAgent}
|
|
106
148
|
<!-- Трек и активная зона -->
|
|
107
149
|
<div
|
|
108
|
-
class={`absolute h-full w-full rounded-full bg-
|
|
150
|
+
class={`absolute z-10 h-full w-full rounded-full bg-transparent ${disabled ? '' : 'cursor-pointer'}`}
|
|
109
151
|
role="button"
|
|
110
152
|
tabindex={null}
|
|
111
153
|
onkeydown={null}
|
|
112
|
-
onclick={
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
154
|
+
onclick={(e) => {
|
|
155
|
+
disabled ? undefined : handleTrackClick(e)
|
|
156
|
+
}}
|
|
157
|
+
></div>
|
|
116
158
|
|
|
117
159
|
<!-- Ползунки -->
|
|
118
160
|
<input
|
|
161
|
+
bind:this={rangeRefLower}
|
|
119
162
|
type="range"
|
|
120
163
|
min={number.minNum}
|
|
121
164
|
max={number.maxNum}
|
|
@@ -126,20 +169,47 @@
|
|
|
126
169
|
: (e) => {
|
|
127
170
|
const newValue = Math.min(Number((e.target as HTMLInputElement).value), upperValue)
|
|
128
171
|
lowerValue = newValue
|
|
129
|
-
|
|
172
|
+
lowerValue = newValue == upperValue ? upperValue - number.step : newValue
|
|
130
173
|
}}
|
|
131
|
-
onmouseup={
|
|
174
|
+
onmouseup={(e) => {
|
|
175
|
+
handleTrackClick(e)
|
|
176
|
+
disabled ? undefined : () => onUpdate([lowerValue, upperValue])
|
|
177
|
+
}}
|
|
132
178
|
{disabled}
|
|
133
|
-
class={
|
|
179
|
+
class={twMerge(
|
|
180
|
+
`slider-bg absolute h-8 w-full appearance-none overflow-hidden rounded-full accent-(--back-color)
|
|
181
|
+
[&::-webkit-slider-runnable-track]:rounded-full
|
|
182
|
+
[&::-webkit-slider-runnable-track]:bg-(--gray-color)
|
|
183
|
+
[&::-webkit-slider-thumb]:relative
|
|
184
|
+
[&::-webkit-slider-thumb]:z-100
|
|
185
|
+
[&::-webkit-slider-thumb]:ml-[-0.4rem]
|
|
186
|
+
[&::-webkit-slider-thumb]:h-4
|
|
187
|
+
[&::-webkit-slider-thumb]:w-4
|
|
188
|
+
[&::-webkit-slider-thumb]:cursor-pointer
|
|
189
|
+
[&::-webkit-slider-thumb]:rounded-full
|
|
190
|
+
[&::-webkit-slider-thumb]:shadow-[var(--focus-shadow),]
|
|
191
|
+
${
|
|
192
|
+
userAgent.includes('iOS') || userAgent.includes('iPhone') || userAgent.includes('iPad')
|
|
193
|
+
? 'pl-3.5 [&::-webkit-slider-thumb]:ring-[6.5px]'
|
|
194
|
+
: 'pl-3 [&::-webkit-slider-thumb]:ring-[5px]'
|
|
195
|
+
}
|
|
196
|
+
[&::-moz-range-thumb]:relative
|
|
197
|
+
[&::-moz-range-thumb]:ml-[-0.4rem]
|
|
198
|
+
[&::-moz-range-thumb]:size-4
|
|
199
|
+
[&::-moz-range-thumb]:cursor-pointer
|
|
200
|
+
[&::-moz-range-thumb]:rounded-full
|
|
201
|
+
[&::-moz-range-thumb]:shadow-[var(--focus-shadow),]
|
|
202
|
+
[&::-moz-range-thumb]:ring-[6px]
|
|
203
|
+
[&::-moz-range-track]:rounded-full
|
|
204
|
+
[&::-moz-range-track]:bg-(--gray-color)
|
|
205
|
+
`,
|
|
206
|
+
`[&::-moz-range-thumb]:shadow-[calc(100rem*-1-0.5rem)_0_0_100rem]
|
|
207
|
+
[&::-webkit-slider-thumb]:shadow-[calc(${shadowWidth}px+0.5rem)_0_0_${shadowWidth}px]`,
|
|
208
|
+
)}
|
|
134
209
|
/>
|
|
135
|
-
<div
|
|
136
|
-
class="pointer-events-none absolute z-40 rounded-full bg-(--field-color)"
|
|
137
|
-
style={`left: calc(${lowerPosition}% + 0rem); top: 50%; transform: translateY(-50%)`}
|
|
138
|
-
>
|
|
139
|
-
<IconGripVerticalLeft />
|
|
140
|
-
</div>
|
|
141
210
|
|
|
142
211
|
<input
|
|
212
|
+
bind:this={rangeRefUpper}
|
|
143
213
|
type="range"
|
|
144
214
|
min={number.minNum}
|
|
145
215
|
max={number.maxNum}
|
|
@@ -150,59 +220,90 @@
|
|
|
150
220
|
: (e) => {
|
|
151
221
|
const newValue = Math.max(Number((e.target as HTMLInputElement).value), lowerValue)
|
|
152
222
|
upperValue = newValue
|
|
153
|
-
|
|
223
|
+
upperValue = newValue == lowerValue ? newValue + number.step : upperValue
|
|
154
224
|
}}
|
|
155
|
-
onmouseup={
|
|
225
|
+
onmouseup={(e) => {
|
|
226
|
+
handleTrackClick(e)
|
|
227
|
+
disabled ? undefined : () => onUpdate([lowerValue, upperValue])
|
|
228
|
+
}}
|
|
156
229
|
{disabled}
|
|
157
|
-
class={
|
|
230
|
+
class={twMerge(
|
|
231
|
+
`slider-bg absolute h-8 w-full appearance-none overflow-hidden rounded-full accent-(--back-color)
|
|
232
|
+
[&::-webkit-slider-runnable-track]:rounded-full
|
|
233
|
+
[&::-webkit-slider-thumb]:relative
|
|
234
|
+
[&::-webkit-slider-thumb]:z-100
|
|
235
|
+
[&::-webkit-slider-thumb]:ml-[-0.4rem]
|
|
236
|
+
[&::-webkit-slider-thumb]:h-4
|
|
237
|
+
[&::-webkit-slider-thumb]:w-4
|
|
238
|
+
[&::-webkit-slider-thumb]:cursor-pointer
|
|
239
|
+
[&::-webkit-slider-thumb]:rounded-full
|
|
240
|
+
[&::-webkit-slider-thumb]:shadow-[var(--focus-shadow),]
|
|
241
|
+
${
|
|
242
|
+
userAgent.includes('iOS') || userAgent.includes('iPhone') || userAgent.includes('iPad')
|
|
243
|
+
? 'pl-3.5 [&::-webkit-slider-thumb]:ring-[6.5px]'
|
|
244
|
+
: 'pl-3 [&::-webkit-slider-thumb]:ring-[5px]'
|
|
245
|
+
}
|
|
246
|
+
[&::-moz-range-thumb]:relative
|
|
247
|
+
[&::-moz-range-thumb]:ml-[-0.4rem]
|
|
248
|
+
[&::-moz-range-thumb]:size-4
|
|
249
|
+
[&::-moz-range-thumb]:cursor-pointer
|
|
250
|
+
[&::-moz-range-thumb]:rounded-full
|
|
251
|
+
[&::-moz-range-thumb]:shadow-[var(--focus-shadow),]
|
|
252
|
+
[&::-moz-range-thumb]:ring-[6px]
|
|
253
|
+
[&::-moz-range-track]:rounded-full
|
|
254
|
+
[&::-moz-range-track]:bg-(--gray-color)
|
|
255
|
+
`,
|
|
256
|
+
`[&::-moz-range-thumb]:shadow-[calc(100rem*-1-0.5rem)_0_0_100rem]
|
|
257
|
+
${shadowWidth ? '' : ''} [&::-webkit-slider-thumb]:shadow-[calc(${shadowWidth}px*-1-0.5rem)_0_0_${shadowWidth}px]`,
|
|
258
|
+
)}
|
|
158
259
|
/>
|
|
159
|
-
<div
|
|
160
|
-
class="pointer-events-none absolute z-40 rounded-full bg-(--field-color)"
|
|
161
|
-
style={`left: calc(${upperPosition}% - 2rem); top: 50%; transform: translateY(-50%)`}
|
|
162
|
-
>
|
|
163
|
-
<IconGripVerticalRight />
|
|
164
|
-
</div>
|
|
165
260
|
{:else}
|
|
261
|
+
{@const userAgent = navigator.userAgent}
|
|
166
262
|
<!-- Одиночный слайдер -->
|
|
167
|
-
<div
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
class="absolute z-10 h-full {singlePosition === 100 ? ' rounded-full' : 'rounded-l-full'}"
|
|
176
|
-
style={`width: ${singlePosition}%; background-color: var(--bg-color)`}
|
|
177
|
-
></div>
|
|
178
|
-
</div>
|
|
263
|
+
<div class="absolute h-full w-full">
|
|
264
|
+
<input
|
|
265
|
+
type="range"
|
|
266
|
+
class={twMerge(
|
|
267
|
+
`slider-bg h-8 w-full appearance-none overflow-hidden rounded-full accent-(--back-color)
|
|
268
|
+
[&::-webkit-slider-runnable-track]:rounded-full
|
|
269
|
+
[&::-webkit-slider-runnable-track]:bg-(--gray-color)
|
|
270
|
+
[&::-webkit-slider-thumb]:relative
|
|
179
271
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
272
|
+
[&::-webkit-slider-thumb]:ml-[-0.4rem]
|
|
273
|
+
[&::-webkit-slider-thumb]:h-4
|
|
274
|
+
[&::-webkit-slider-thumb]:w-4
|
|
275
|
+
[&::-webkit-slider-thumb]:cursor-pointer
|
|
276
|
+
[&::-webkit-slider-thumb]:rounded-full
|
|
277
|
+
[&::-webkit-slider-thumb]:shadow-[var(--focus-shadow),]
|
|
278
|
+
${
|
|
279
|
+
userAgent.includes('iOS') || userAgent.includes('iPhone') || userAgent.includes('iPad')
|
|
280
|
+
? 'pl-3.5 [&::-webkit-slider-thumb]:ring-[6.5px]'
|
|
281
|
+
: 'pl-3 [&::-webkit-slider-thumb]:ring-[5px]'
|
|
282
|
+
}
|
|
283
|
+
[&::-moz-range-thumb]:relative
|
|
284
|
+
[&::-moz-range-thumb]:ml-[-0.4rem]
|
|
285
|
+
[&::-moz-range-thumb]:size-4
|
|
286
|
+
[&::-moz-range-thumb]:cursor-pointer
|
|
287
|
+
[&::-moz-range-thumb]:rounded-full
|
|
288
|
+
[&::-moz-range-thumb]:shadow-[var(--focus-shadow),]
|
|
289
|
+
[&::-moz-range-thumb]:ring-[6px]
|
|
290
|
+
[&::-moz-range-track]:rounded-full
|
|
291
|
+
[&::-moz-range-track]:bg-(--gray-color)
|
|
292
|
+
`,
|
|
293
|
+
`[&::-moz-range-thumb]:shadow-[calc(100rem*-1-0.5rem)_0_0_100rem]
|
|
294
|
+
[&::-webkit-slider-thumb]:shadow-[calc(100rem*-1-0.5rem)_0_0_100rem]`,
|
|
295
|
+
)}
|
|
296
|
+
min={number.minNum}
|
|
297
|
+
max={number.maxNum}
|
|
298
|
+
step={number.step}
|
|
299
|
+
bind:value={singleValue}
|
|
300
|
+
/>
|
|
200
301
|
</div>
|
|
201
302
|
{/if}
|
|
202
303
|
</div>
|
|
203
304
|
|
|
204
305
|
<!-- Кнопки управления -->
|
|
205
|
-
<div class={`mt-
|
|
306
|
+
<div class={`mt-3 flex w-full ${isRange ? 'justify-between' : 'justify-center'} gap-2`}>
|
|
206
307
|
{#if isRange}
|
|
207
308
|
{#each ['lower', 'upper'] as type (type)}
|
|
208
309
|
<div
|
|
@@ -246,64 +347,3 @@
|
|
|
246
347
|
{/if}
|
|
247
348
|
</div>
|
|
248
349
|
</div>
|
|
249
|
-
|
|
250
|
-
<style>
|
|
251
|
-
input[type='range'] {
|
|
252
|
-
-webkit-appearance: none;
|
|
253
|
-
appearance: none;
|
|
254
|
-
margin: 0;
|
|
255
|
-
padding: 0;
|
|
256
|
-
pointer-events: none;
|
|
257
|
-
outline: none;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/* Webkit thumb */
|
|
261
|
-
input[type='range']::-webkit-slider-thumb {
|
|
262
|
-
-webkit-appearance: none;
|
|
263
|
-
appearance: none;
|
|
264
|
-
width: 2rem;
|
|
265
|
-
height: 2rem;
|
|
266
|
-
border-radius: 50%;
|
|
267
|
-
background: transparent;
|
|
268
|
-
cursor: pointer;
|
|
269
|
-
pointer-events: auto;
|
|
270
|
-
border: none;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/* Firefox thumb */
|
|
274
|
-
input[type='range']::-moz-range-thumb {
|
|
275
|
-
width: 2rem;
|
|
276
|
-
height: 2rem;
|
|
277
|
-
border-radius: 50%;
|
|
278
|
-
background: transparent;
|
|
279
|
-
cursor: pointer;
|
|
280
|
-
pointer-events: auto;
|
|
281
|
-
border: none;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/* Webkit track */
|
|
285
|
-
input[type='range']::-webkit-slider-runnable-track {
|
|
286
|
-
width: 100%;
|
|
287
|
-
height: 100%;
|
|
288
|
-
background: transparent;
|
|
289
|
-
border-radius: 0;
|
|
290
|
-
border: none;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/* Firefox track */
|
|
294
|
-
input[type='range']::-moz-range-track {
|
|
295
|
-
width: 100%;
|
|
296
|
-
height: 100%;
|
|
297
|
-
background: transparent;
|
|
298
|
-
border-radius: 0;
|
|
299
|
-
border: none;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
input[type='range']:disabled::-webkit-slider-thumb {
|
|
303
|
-
cursor: not-allowed;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
input[type='range']:disabled::-moz-range-thumb {
|
|
307
|
-
cursor: not-allowed;
|
|
308
|
-
}
|
|
309
|
-
</style>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
forConstructor = true,
|
|
13
13
|
} = $props<{
|
|
14
14
|
component: UIComponent & { properties: Partial<ISliderProps> }
|
|
15
|
-
onPropertyChange: (value
|
|
15
|
+
onPropertyChange: (value?: string | object, name?: string, access?: string) => void
|
|
16
16
|
forConstructor?: boolean
|
|
17
17
|
}>()
|
|
18
18
|
|
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
options={VARIABLE_OPTIONS}
|
|
41
41
|
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
42
42
|
onUpdate={(value) => {
|
|
43
|
-
updateProperty('id', value.value as string, component, onPropertyChange
|
|
43
|
+
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
44
44
|
updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
|
|
45
|
+
onPropertyChange(null, value.name?.split('—')[1].trim(), null)
|
|
45
46
|
}}
|
|
46
47
|
/>
|
|
47
48
|
<UI.Select
|
|
@@ -53,6 +54,13 @@
|
|
|
53
54
|
updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
|
|
54
55
|
}}
|
|
55
56
|
/>
|
|
57
|
+
<UI.Select
|
|
58
|
+
label={{ name: $t('constructor.props.access') }}
|
|
59
|
+
type="buttons"
|
|
60
|
+
options={$optionsStore.ACCESS_OPTION}
|
|
61
|
+
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
62
|
+
onUpdate={(option) => onPropertyChange(null, null, option.value)}
|
|
63
|
+
/>
|
|
56
64
|
</div>
|
|
57
65
|
<div class="flex w-1/3 flex-col px-2">
|
|
58
66
|
<UI.Select
|
|
@@ -144,6 +152,13 @@
|
|
|
144
152
|
/>
|
|
145
153
|
</div>
|
|
146
154
|
<div class="flex w-1/3 flex-col px-2">
|
|
155
|
+
<UI.Select
|
|
156
|
+
label={{ name: $t('constructor.props.access') }}
|
|
157
|
+
type="buttons"
|
|
158
|
+
options={$optionsStore.ACCESS_OPTION}
|
|
159
|
+
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
160
|
+
onUpdate={(option) => onPropertyChange(null, null, option.value)}
|
|
161
|
+
/>
|
|
147
162
|
<UI.Input
|
|
148
163
|
label={{ name: $t('constructor.props.label') }}
|
|
149
164
|
value={component.properties.label.name}
|
|
@@ -3,7 +3,7 @@ type $$ComponentProps = {
|
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<ISliderProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (value
|
|
6
|
+
onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
|
|
7
7
|
forConstructor?: boolean;
|
|
8
8
|
};
|
|
9
9
|
declare const SliderProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
{#if label.name}
|
|
58
58
|
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
59
59
|
{/if}
|
|
60
|
-
<div class="flex w-full flex-wrap justify-
|
|
60
|
+
<div class="flex w-full flex-wrap items-end justify-around gap-5">
|
|
61
61
|
{#each localOptions as option, index}
|
|
62
62
|
<div class={twMerge(`bg-blue flex flex-col`, option.class)}>
|
|
63
63
|
{#if option.name}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
forConstructor = true,
|
|
15
15
|
} = $props<{
|
|
16
16
|
component: UIComponent & { properties: Partial<ISwitchProps> }
|
|
17
|
-
onPropertyChange: (value
|
|
17
|
+
onPropertyChange: (value?: string | object, name?: string, access?: string) => void
|
|
18
18
|
forConstructor?: boolean
|
|
19
19
|
}>()
|
|
20
20
|
const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
options={VARIABLE_OPTIONS}
|
|
37
37
|
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
38
38
|
onUpdate={(value) => {
|
|
39
|
-
updateProperty('id', value.value as string, component, onPropertyChange
|
|
39
|
+
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
40
40
|
updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
|
|
41
|
+
onPropertyChange(null, value.name?.split('—')[1].trim(), null)
|
|
41
42
|
}}
|
|
42
43
|
/>
|
|
43
44
|
<UI.Select
|
|
@@ -49,6 +50,16 @@
|
|
|
49
50
|
updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
|
|
50
51
|
}}
|
|
51
52
|
/>
|
|
53
|
+
<UI.Select
|
|
54
|
+
label={{ name: $t('constructor.props.access') }}
|
|
55
|
+
type="buttons"
|
|
56
|
+
options={$optionsStore.ACCESS_OPTION}
|
|
57
|
+
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
58
|
+
onUpdate={(option) => onPropertyChange(null, null, option.value)}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
52
63
|
<UI.Select
|
|
53
64
|
wrapperClass="!h-14"
|
|
54
65
|
label={{ name: $t('constructor.props.type') }}
|
|
@@ -58,9 +69,7 @@
|
|
|
58
69
|
value={$optionsStore.SWITCH_OPTIONS.find((option) => option.value == component.properties.type)}
|
|
59
70
|
onUpdate={(option) => updateProperty('type', option.value as string, component, onPropertyChange)}
|
|
60
71
|
/>
|
|
61
|
-
|
|
62
|
-
{#if !component.properties.bitMode}
|
|
63
|
-
<div class="flex w-1/3 flex-col px-2">
|
|
72
|
+
{#if !component.properties.bitMode}
|
|
64
73
|
<UI.Input
|
|
65
74
|
label={{ name: $t('constructor.props.caption.left') }}
|
|
66
75
|
value={component.properties.label.captionLeft}
|
|
@@ -83,8 +92,9 @@
|
|
|
83
92
|
updateProperty('options', options, component, onPropertyChange)
|
|
84
93
|
}}
|
|
85
94
|
/>
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
{/if}
|
|
96
|
+
</div>
|
|
97
|
+
|
|
88
98
|
<div class="flex w-1/3 flex-col px-2">
|
|
89
99
|
<UI.Input
|
|
90
100
|
label={{ name: $t('constructor.props.label') }}
|
|
@@ -133,7 +143,7 @@
|
|
|
133
143
|
onClick={() => {
|
|
134
144
|
const newOption: ISelectOption = {
|
|
135
145
|
id: crypto.randomUUID(),
|
|
136
|
-
name:
|
|
146
|
+
name: component.properties?.options.length,
|
|
137
147
|
value: component.properties?.options.length,
|
|
138
148
|
class: 'bg-blue',
|
|
139
149
|
}
|
|
@@ -149,6 +159,7 @@
|
|
|
149
159
|
label={{ name: $t('constructor.props.optionname') }}
|
|
150
160
|
wrapperClass="!w-3/10"
|
|
151
161
|
value={option.name}
|
|
162
|
+
maxlength={4}
|
|
152
163
|
onUpdate={(value) => {
|
|
153
164
|
const options = [...(component.properties?.options || [])]
|
|
154
165
|
options[index]['name'] = value
|
|
@@ -214,6 +225,13 @@
|
|
|
214
225
|
value={component.properties.id}
|
|
215
226
|
onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
|
|
216
227
|
/>
|
|
228
|
+
<UI.Select
|
|
229
|
+
label={{ name: $t('constructor.props.access') }}
|
|
230
|
+
type="buttons"
|
|
231
|
+
options={$optionsStore.ACCESS_OPTION}
|
|
232
|
+
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
233
|
+
onUpdate={(option) => onPropertyChange(null, null, option.value)}
|
|
234
|
+
/>
|
|
217
235
|
<UI.Input
|
|
218
236
|
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
219
237
|
value={component.properties.wrapperClass}
|
|
@@ -3,7 +3,7 @@ type $$ComponentProps = {
|
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<ISwitchProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (value
|
|
6
|
+
onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
|
|
7
7
|
forConstructor?: boolean;
|
|
8
8
|
};
|
|
9
9
|
declare const SwitchProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -166,13 +166,13 @@
|
|
|
166
166
|
{#each header as column, index (column)}
|
|
167
167
|
<div
|
|
168
168
|
class={twMerge(
|
|
169
|
-
`justify-center border-l ${outline && index !== 0 ? ' border-(--border-color)' : 'border-transparent'} ${
|
|
169
|
+
`items-center justify-center border-l ${outline && index !== 0 ? ' border-(--border-color)' : 'border-transparent'} ${
|
|
170
170
|
column.align?.header === 'center'
|
|
171
171
|
? 'flex justify-center text-center'
|
|
172
172
|
: column.align?.header === 'right'
|
|
173
173
|
? 'flex justify-end text-right'
|
|
174
174
|
: 'flex justify-start text-left'
|
|
175
|
-
} bg-(--bg-color) p-2 text-left`,
|
|
175
|
+
} gap-1 bg-(--bg-color) p-2 text-left`,
|
|
176
176
|
column.label?.class,
|
|
177
177
|
)}
|
|
178
178
|
>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
forConstructor = true,
|
|
18
18
|
} = $props<{
|
|
19
19
|
component: UIComponent & { properties: Partial<ITableProps<object>> }
|
|
20
|
-
onPropertyChange: (value
|
|
20
|
+
onPropertyChange: (value?: string | object, name?: string, access?: string) => void
|
|
21
21
|
forConstructor?: boolean
|
|
22
22
|
}>()
|
|
23
23
|
|
|
@@ -81,10 +81,18 @@
|
|
|
81
81
|
options={VARIABLE_OPTIONS}
|
|
82
82
|
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
83
83
|
onUpdate={(value) => {
|
|
84
|
-
updateProperty('id', value.value as string, component, onPropertyChange
|
|
84
|
+
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
85
85
|
updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
|
|
86
|
+
onPropertyChange(null, value.name?.split('—')[1].trim(), null)
|
|
86
87
|
}}
|
|
87
88
|
/>
|
|
89
|
+
<UI.Select
|
|
90
|
+
label={{ name: $t('constructor.props.access') }}
|
|
91
|
+
type="buttons"
|
|
92
|
+
options={$optionsStore.ACCESS_OPTION}
|
|
93
|
+
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
94
|
+
onUpdate={(option) => onPropertyChange(null, null, option.value)}
|
|
95
|
+
/>
|
|
88
96
|
</div>
|
|
89
97
|
<div class="flex w-1/3 flex-col px-2">
|
|
90
98
|
<UI.Select
|
|
@@ -145,6 +153,7 @@
|
|
|
145
153
|
<div class="mr-2 flex items-end justify-around gap-6">
|
|
146
154
|
<UI.Input
|
|
147
155
|
label={{ name: $t('constructor.props.table.columns.key') }}
|
|
156
|
+
wrapperClass="w-170"
|
|
148
157
|
value={column.key}
|
|
149
158
|
help={{ regExp: /^[0-9a-zA-Z_-]{0,16}$/ }}
|
|
150
159
|
onUpdate={(value) => {
|
|
@@ -161,21 +170,30 @@
|
|
|
161
170
|
/>
|
|
162
171
|
<UI.Input
|
|
163
172
|
label={{ name: $t('constructor.props.table.columns.width') }}
|
|
164
|
-
wrapperClass="w-
|
|
173
|
+
wrapperClass="w-150"
|
|
165
174
|
type="number"
|
|
166
175
|
value={Number(column.width.replace('%', ''))}
|
|
167
176
|
onUpdate={(value) => updateTableHeader(columnIndex, 'width', `${value}%`)}
|
|
168
177
|
/>
|
|
178
|
+
<UI.Select
|
|
179
|
+
label={{ name: $t('constructor.props.align.content') }}
|
|
180
|
+
type="buttons"
|
|
181
|
+
value={$optionsStore.ALIGN_OPTIONS.find((a) => (a.value as string).includes(column.align?.content) || 'left')}
|
|
182
|
+
options={$optionsStore.ALIGN_OPTIONS}
|
|
183
|
+
onUpdate={(option) => {
|
|
184
|
+
updateTableHeader(columnIndex, 'align', { header: option.value, content: option.value })
|
|
185
|
+
}}
|
|
186
|
+
/>
|
|
169
187
|
<UI.Switch
|
|
170
|
-
wrapperClass="w-
|
|
171
|
-
label={{ name: $t('constructor.props.table.columns.sortable') }}
|
|
188
|
+
wrapperClass="w-30"
|
|
189
|
+
label={{ name: $t('constructor.props.table.columns.sortable'), class: 'px-0' }}
|
|
172
190
|
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
173
191
|
value={column.sortable}
|
|
174
192
|
onChange={(value) => updateTableHeader(columnIndex, 'sortable', value)}
|
|
175
193
|
/>
|
|
176
194
|
<UI.Switch
|
|
177
|
-
wrapperClass="w-
|
|
178
|
-
label={{ name: $t('constructor.props.copy') }}
|
|
195
|
+
wrapperClass="w-30"
|
|
196
|
+
label={{ name: $t('constructor.props.copy'), class: 'px-0' }}
|
|
179
197
|
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
180
198
|
value={column.overflow?.copy}
|
|
181
199
|
onChange={(value) => updateTableHeader(columnIndex, 'overflow', { copy: value })}
|
|
@@ -263,6 +281,7 @@
|
|
|
263
281
|
value={component.properties.id}
|
|
264
282
|
onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
|
|
265
283
|
/>
|
|
284
|
+
|
|
266
285
|
<UI.Input
|
|
267
286
|
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
268
287
|
value={component.properties.wrapperClass}
|
|
@@ -285,6 +304,13 @@
|
|
|
285
304
|
/>
|
|
286
305
|
</div>
|
|
287
306
|
<div class="flex w-1/3 flex-col px-2">
|
|
307
|
+
<UI.Select
|
|
308
|
+
label={{ name: $t('constructor.props.access') }}
|
|
309
|
+
type="buttons"
|
|
310
|
+
options={$optionsStore.ACCESS_OPTION}
|
|
311
|
+
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
312
|
+
onUpdate={(option) => onPropertyChange(null, null, option.value)}
|
|
313
|
+
/>
|
|
288
314
|
<UI.Input
|
|
289
315
|
label={{ name: $t('constructor.props.label') }}
|
|
290
316
|
value={component.properties.label.name}
|
|
@@ -3,7 +3,7 @@ type $$ComponentProps = {
|
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<ITableProps<object>>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (value
|
|
6
|
+
onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
|
|
7
7
|
forConstructor?: boolean;
|
|
8
8
|
};
|
|
9
9
|
declare const TableProps: import("svelte").Component<$$ComponentProps, {}, "">;
|