poe-svelte-ui-lib 1.1.15 → 1.1.17
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 +6 -6
- package/dist/Button/Button.svelte +37 -11
- package/dist/Button/ButtonProps.svelte +3 -3
- package/dist/ColorPicker/ColorPicker.svelte +1 -1
- package/dist/ColorPicker/ColorPickerProps.svelte +2 -2
- package/dist/ComponentExample.svelte +3 -3
- package/dist/FileAttach/FileAttach.svelte +4 -4
- package/dist/Graph/Graph.svelte +2 -2
- package/dist/Graph/GraphProps.svelte +0 -2
- package/dist/Input/Input.svelte +8 -8
- package/dist/Input/InputProps.svelte +135 -3
- package/dist/Modal.svelte +3 -3
- package/dist/ProgressBar/ProgressBar.svelte +3 -2
- package/dist/ProgressBar/ProgressBarProps.svelte +67 -3
- package/dist/Select/Select.svelte +8 -8
- package/dist/Select/SelectProps.svelte +160 -13
- package/dist/Slider/Slider.svelte +6 -6
- package/dist/Slider/SliderProps.svelte +86 -3
- package/dist/Switch/Switch.svelte +5 -5
- package/dist/Switch/SwitchProps.svelte +69 -4
- package/dist/Table/Table.svelte +9 -9
- package/dist/Table/TableProps.svelte +264 -13
- package/dist/TextField/TextField.svelte +1 -4
- package/dist/TextField/TextFieldProps.svelte +82 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/locales/translations.js +24 -1
- package/dist/options.d.ts +10 -0
- package/dist/options.js +23 -1
- package/dist/types.d.ts +4 -1
- package/package.json +3 -3
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
{id}
|
|
22
22
|
class={twMerge(
|
|
23
23
|
`${outline ? 'border-none' : 'rounded-xl hover:shadow-md'} w-full
|
|
24
|
-
border border-
|
|
24
|
+
border border-(--border-color) bg-(--container-color) p-0 transition-shadow duration-250`,
|
|
25
25
|
wrapperClass,
|
|
26
26
|
)}
|
|
27
27
|
transition:slide={{ duration: 250 }}
|
|
28
28
|
>
|
|
29
29
|
<button
|
|
30
30
|
class="flex w-full cursor-pointer items-center justify-between p-4 transition-shadow duration-250
|
|
31
|
-
{outline ? 'border-b border-
|
|
31
|
+
{outline ? 'border-b border-(--border-color)' : ''}"
|
|
32
32
|
onclick={toggle}
|
|
33
33
|
>
|
|
34
34
|
<div class="flex w-full items-center">
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
{#if isOpen}
|
|
69
69
|
<div
|
|
70
|
-
class="grid w-full p-4 sm:p-3 {image ? 'gap-x-2' : 'gap-2'} {outline ? '' : 'border-t border-
|
|
70
|
+
class="grid w-full p-4 sm:p-3 {image ? 'gap-x-2' : 'gap-2'} {outline ? '' : 'border-t border-(--border-color)'}"
|
|
71
71
|
transition:slide={{ duration: 250 }}
|
|
72
72
|
style="grid-template-columns: repeat({size.width || 10}, minmax(0, 1fr));
|
|
73
73
|
grid-template-rows: repeat({size.height || 2}, {image ? 'minmax(6.5rem, auto)' : 'auto'});
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
const initialType = $derived($optionsStore.ACCORDION_TYPE_OPTIONS.find((t) => t.value === component.properties.outline))
|
|
25
25
|
|
|
26
26
|
const initialAlign = $derived(
|
|
27
|
-
$optionsStore.
|
|
27
|
+
$optionsStore.TEXT_ALIGN_OPTIONS.find((a) =>
|
|
28
28
|
(a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
29
29
|
),
|
|
30
30
|
)
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
label={{ name: $t('constructor.props.align') }}
|
|
58
58
|
type="buttons"
|
|
59
59
|
value={initialAlign}
|
|
60
|
-
options={$optionsStore.
|
|
60
|
+
options={$optionsStore.TEXT_ALIGN_OPTIONS}
|
|
61
61
|
onUpdate={(option) => updateProperty('label.class', option.value as string, component, onPropertyChange)}
|
|
62
62
|
/>
|
|
63
63
|
</div>
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
{#snippet main()}
|
|
70
70
|
<div class="grid grid-cols-3">
|
|
71
71
|
{#each ICONS as category}
|
|
72
|
-
<div class="relative m-1.5 rounded-xl border-2 border-
|
|
73
|
-
<div class="absolute -top-3.5 bg-
|
|
72
|
+
<div class="relative m-1.5 rounded-xl border-2 border-(--border-color) p-3">
|
|
73
|
+
<div class="absolute -top-3.5 bg-(--back-color) px-1">{$t(`constructor.props.icon.${category[0]}`)}</div>
|
|
74
74
|
<div class="grid grid-cols-3 place-items-center gap-2">
|
|
75
75
|
{#each category[1] as icon}
|
|
76
76
|
<button
|
|
@@ -180,8 +180,8 @@
|
|
|
180
180
|
{#snippet main()}
|
|
181
181
|
<div class="grid grid-cols-3">
|
|
182
182
|
{#each ICONS as category}
|
|
183
|
-
<div class="relative m-1.5 rounded-xl border-2 border-
|
|
184
|
-
<div class="absolute -top-3.5 bg-
|
|
183
|
+
<div class="relative m-1.5 rounded-xl border-2 border-(--border-color) p-3">
|
|
184
|
+
<div class="absolute -top-3.5 bg-(--back-color) px-1">{$t(`constructor.props.icon.${category[0]}`)}</div>
|
|
185
185
|
<div class="grid grid-cols-3 place-items-center gap-2">
|
|
186
186
|
{#each category[1] as icon}
|
|
187
187
|
<button
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
disabled = false,
|
|
13
13
|
content = {
|
|
14
14
|
name: '',
|
|
15
|
-
info: '',
|
|
15
|
+
info: { text: '', side: 'top' },
|
|
16
16
|
icon: null,
|
|
17
17
|
},
|
|
18
18
|
keyBind,
|
|
@@ -64,25 +64,25 @@
|
|
|
64
64
|
})
|
|
65
65
|
</script>
|
|
66
66
|
|
|
67
|
-
<div class={twMerge(`relative flex w-full flex-col items-center`, wrapperClass)}>
|
|
67
|
+
<div class={twMerge(`relative flex w-full flex-col items-center `, wrapperClass)}>
|
|
68
68
|
<div class="relative flex w-full grow items-center">
|
|
69
69
|
<button
|
|
70
70
|
{id}
|
|
71
71
|
class="{twMerge(
|
|
72
72
|
`relative m-0 inline-block w-full items-center rounded-2xl
|
|
73
73
|
px-2 py-1 font-semibold transition duration-200 select-none
|
|
74
|
-
${content.icon && !content.name ? 'bg-transparent p-0' : 'bg-blue border border-
|
|
74
|
+
${content.icon && !content.name ? 'bg-transparent p-0' : 'bg-blue border border-(--bg-color) '}
|
|
75
75
|
${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer active:scale-97'} `,
|
|
76
76
|
componentClass,
|
|
77
|
-
)} bg-
|
|
77
|
+
)} bg-(--bg-color)"
|
|
78
78
|
onclick={handleClick}
|
|
79
79
|
{disabled}
|
|
80
80
|
aria-label={content.name}
|
|
81
81
|
onmouseenter={() => {
|
|
82
|
-
if (content.info) showInfo = true
|
|
82
|
+
if (content.info?.text) showInfo = true
|
|
83
83
|
}}
|
|
84
84
|
onmouseleave={() => {
|
|
85
|
-
if (content.info) showInfo = false
|
|
85
|
+
if (content.info?.text) showInfo = false
|
|
86
86
|
}}
|
|
87
87
|
>
|
|
88
88
|
<span class=" flex flex-row items-center justify-center gap-2">
|
|
@@ -113,15 +113,41 @@
|
|
|
113
113
|
</span>
|
|
114
114
|
</button>
|
|
115
115
|
|
|
116
|
-
{#if showInfo}
|
|
116
|
+
{#if showInfo && content.info?.side === 'top'}
|
|
117
117
|
<div
|
|
118
118
|
transition:fly={{ y: -15, duration: 300 }}
|
|
119
|
-
class="absolute bottom-full left-1/2 z-50 mb-2 w-
|
|
119
|
+
class="absolute bottom-full left-1/2 z-50 mb-2 max-w-min min-w-fit rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
|
|
120
120
|
style="transform: translateX(-50%);"
|
|
121
121
|
>
|
|
122
|
-
{content.info}
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
{content.info?.text}
|
|
123
|
+
<div class="absolute top-full left-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rotate-45 transform bg-(--container-color)"></div>
|
|
124
|
+
</div>
|
|
125
|
+
{:else if showInfo && content.info?.side === 'bottom'}
|
|
126
|
+
<div
|
|
127
|
+
transition:fly={{ y: 15, duration: 300 }}
|
|
128
|
+
class="absolute top-full left-1/2 z-50 mt-2 max-w-min min-w-fit rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
|
|
129
|
+
style="transform: translateX(-50%);"
|
|
130
|
+
>
|
|
131
|
+
{content.info?.text}
|
|
132
|
+
<div class="absolute bottom-full left-1/2 h-2 w-2 -translate-x-1/2 translate-y-1/2 rotate-45 transform bg-(--container-color)"></div>
|
|
133
|
+
</div>
|
|
134
|
+
{:else if showInfo && content.info?.side === 'left'}
|
|
135
|
+
<div
|
|
136
|
+
transition:fly={{ x: 15, duration: 300 }}
|
|
137
|
+
class="absolute top-1/2 right-full z-50 mr-2 max-w-min min-w-fit rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
|
|
138
|
+
style="transform: translateY(-50%);"
|
|
139
|
+
>
|
|
140
|
+
{content.info?.text}
|
|
141
|
+
<div class="absolute top-1/2 -right-2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rotate-45 transform bg-(--container-color)"></div>
|
|
142
|
+
</div>
|
|
143
|
+
{:else if showInfo && content.info?.side === 'right'}
|
|
144
|
+
<div
|
|
145
|
+
transition:fly={{ x: -15, duration: 300 }}
|
|
146
|
+
class="absolute top-1/2 left-full z-50 ml-2 max-w-min min-w-fit rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
|
|
147
|
+
style="transform: translateY(-50%);"
|
|
148
|
+
>
|
|
149
|
+
{content.info?.text}
|
|
150
|
+
<div class="absolute top-1/2 -left-2 h-2 w-2 translate-x-1/2 -translate-y-1/2 -rotate-45 transform bg-(--container-color)"></div>
|
|
125
151
|
</div>
|
|
126
152
|
{/if}
|
|
127
153
|
</div>
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
onUpdate={(value) => updateProperty('eventHandler.Argument', value as string, component, onPropertyChange)}
|
|
78
78
|
/>
|
|
79
79
|
|
|
80
|
-
{#if (component.properties.eventHandler.Argument !== 'Save' && component.properties.eventHandler.Argument !== 'NoSave') || Header.value
|
|
80
|
+
{#if (component.properties.eventHandler.Argument !== 'Save' && component.properties.eventHandler.Argument !== 'NoSave') || Header.value === 'SET'}
|
|
81
81
|
<UI.Input
|
|
82
82
|
label={{ name: $t('constructor.props.value') }}
|
|
83
83
|
value={component.properties.eventHandler.Value}
|
|
@@ -153,8 +153,8 @@
|
|
|
153
153
|
/>
|
|
154
154
|
<UI.Input
|
|
155
155
|
label={{ name: $t('constructor.props.info') }}
|
|
156
|
-
value={component.properties.content.info}
|
|
157
|
-
onUpdate={(value) => updateProperty('content.info', value as string, component, onPropertyChange)}
|
|
156
|
+
value={component.properties.content.info.text}
|
|
157
|
+
onUpdate={(value) => updateProperty('content.info.text', value as string, component, onPropertyChange)}
|
|
158
158
|
/>
|
|
159
159
|
<UI.Input
|
|
160
160
|
label={{ name: $t('constructor.props.svgicon') }}
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
tabindex={null}
|
|
190
190
|
onmousedown={(e) => handleDrag(e, 'white')}
|
|
191
191
|
>
|
|
192
|
-
<div class="absolute inset-0 bg-
|
|
192
|
+
<div class="absolute inset-0 bg-linear-to-r from-black to-white"></div>
|
|
193
193
|
{#if mode === 'white'}
|
|
194
194
|
<div
|
|
195
195
|
class="pointer-events-none absolute top-1/2 h-7 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
|
|
21
21
|
|
|
22
22
|
const initialAlign = $derived(
|
|
23
|
-
$optionsStore.
|
|
23
|
+
$optionsStore.TEXT_ALIGN_OPTIONS.find((a) =>
|
|
24
24
|
(a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
25
25
|
),
|
|
26
26
|
)
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
label={{ name: $t('constructor.props.align') }}
|
|
60
60
|
type="buttons"
|
|
61
61
|
value={initialAlign}
|
|
62
|
-
options={$optionsStore.
|
|
62
|
+
options={$optionsStore.TEXT_ALIGN_OPTIONS}
|
|
63
63
|
onUpdate={(option) => updateProperty('label.class', option.value as string, component, onPropertyChange)}
|
|
64
64
|
/>
|
|
65
65
|
</div>
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
<div class="flex-1 overflow-y-auto">
|
|
14
14
|
{@render component()}
|
|
15
15
|
</div>
|
|
16
|
-
<div class="
|
|
17
|
-
<div class="h-
|
|
16
|
+
<div class="border-t border-gray-500"></div>
|
|
17
|
+
<div class="max-h-[70%]" transition:fade={{ duration: 200 }}>
|
|
18
18
|
{@render componentProps()}
|
|
19
19
|
<div class="relative mt-3">
|
|
20
20
|
<UI.Button
|
|
21
21
|
wrapperClass="absolute top-3 right-5 w-6"
|
|
22
|
-
content={{ icon: isCopied ? '<div class="rounded-md bg-
|
|
22
|
+
content={{ icon: isCopied ? '<div class="rounded-md bg-(--green-color) shadow-lg px-1">✓</div>' : CopyButton }}
|
|
23
23
|
onClick={() => {
|
|
24
24
|
isCopied = true
|
|
25
25
|
setTimeout(() => (isCopied = false), 1000)
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
<div class="relative">
|
|
60
60
|
<button
|
|
61
61
|
class="flex items-center justify-center overflow-hidden {imageSize.form === 'circle' ? 'rounded-full' : 'rounded-2xl'}
|
|
62
|
-
bg-
|
|
62
|
+
bg-(--back-color) shadow-sm transition duration-250 hover:shadow-md
|
|
63
63
|
{disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}"
|
|
64
64
|
style={`height: ${imageSize.height}; width: ${imageSize.width}`}
|
|
65
65
|
onclick={triggerFileInput}
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
<input
|
|
86
86
|
{id}
|
|
87
87
|
type="file"
|
|
88
|
-
class={`h-8.5 w-full rounded-2xl bg-
|
|
89
|
-
${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'} file:h-full file:w-1/3
|
|
90
|
-
file:border-none file:bg-
|
|
88
|
+
class={`h-8.5 w-full rounded-2xl bg-(--back-color) font-semibold shadow-sm transition duration-250 hover:shadow-md
|
|
89
|
+
${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'} invalid:shadow-[0_0_6px(--red-color) file:h-full file:w-1/3
|
|
90
|
+
file:cursor-pointer file:border-none file:bg-(--blue-color) invalid:border-red-400`}
|
|
91
91
|
{accept}
|
|
92
92
|
{disabled}
|
|
93
93
|
onchange={handleFileChange}
|
package/dist/Graph/Graph.svelte
CHANGED
|
@@ -225,8 +225,8 @@
|
|
|
225
225
|
|
|
226
226
|
<div class="flex w-full flex-row gap-4">
|
|
227
227
|
<!-- График -->
|
|
228
|
-
<div bind:this={container} class="h-64
|
|
229
|
-
<canvas class="h-full w-full bg-
|
|
228
|
+
<div bind:this={container} class="h-64 grow overflow-hidden rounded-md border border-gray-200">
|
|
229
|
+
<canvas class="h-full w-full bg-(--back-color)" bind:this={canvas}></canvas>
|
|
230
230
|
</div>
|
|
231
231
|
|
|
232
232
|
<!-- Панель настроек -->
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import { t } from '../locales/i18n'
|
|
4
4
|
import { type UIComponent, type IGraphProps, updateProperty } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
|
-
import ButtonAdd from '../libIcons/ButtonAdd.svelte'
|
|
7
|
-
import ButtonDelete from '../libIcons/ButtonDelete.svelte'
|
|
8
6
|
|
|
9
7
|
const {
|
|
10
8
|
component,
|
package/dist/Input/Input.svelte
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
class={twMerge(
|
|
64
64
|
`w-full rounded-2xl border px-4 py-1 text-center transition-all duration-300 outline-none focus:border-blue-400
|
|
65
65
|
[&::-webkit-inner-spin-button]:hidden [&::-webkit-outer-spin-button]:hidden
|
|
66
|
-
${isValid ? 'border-
|
|
66
|
+
${isValid ? 'border-(--border-color)' : 'border-red-400 shadow-[0_0_6px_var(--red-color)]'}
|
|
67
67
|
${disabled ? 'opacity-50' : 'hover:shadow-md'}
|
|
68
68
|
${readonly ? '' : 'hover:shadow-md'}
|
|
69
69
|
${help?.info ? 'pl-8' : ''}
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
<textarea
|
|
88
88
|
bind:value
|
|
89
89
|
class={twMerge(
|
|
90
|
-
`h-full w-full resize-y rounded-2xl border border-
|
|
91
|
-
${isValid ? 'border-
|
|
90
|
+
`h-full w-full resize-y rounded-2xl border border-(--border-color) px-2 py-1 text-center font-mono transition-all duration-300 outline-none focus:border-blue-400
|
|
91
|
+
${isValid ? 'border-(--border-color)' : 'border-red-400 shadow-[0_0_6px_var(--red-color)]'}
|
|
92
92
|
${disabled ? 'opacity-50' : 'hover:shadow-md'}
|
|
93
93
|
${readonly ? '' : 'hover:shadow-md'}
|
|
94
94
|
${help?.info ? 'pl-8' : ''}
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
|
|
159
159
|
{#if isCopied}
|
|
160
160
|
<div
|
|
161
|
-
class="absolute top-1/2 right-10 -translate-y-1/2 transform rounded-md bg-
|
|
161
|
+
class="absolute top-1/2 right-10 -translate-y-1/2 transform rounded-md bg-(--green-color) px-2 py-1 text-sm shadow-lg"
|
|
162
162
|
transition:fly={{ x: 10, duration: 200 }}
|
|
163
163
|
>
|
|
164
164
|
✓
|
|
@@ -167,9 +167,9 @@
|
|
|
167
167
|
{/if}
|
|
168
168
|
|
|
169
169
|
{#if type === 'number' && !readonly && !disabled}
|
|
170
|
-
<div class="absolute right-0 flex h-full w-8 flex-col items-center justify-center rounded-r-2xl border-l border-
|
|
170
|
+
<div class="absolute right-0 flex h-full w-8 flex-col items-center justify-center rounded-r-2xl border-l border-(--border-color)">
|
|
171
171
|
<button
|
|
172
|
-
class="flex h-1/2 w-full items-center rounded-tr-2xl border-b border-
|
|
172
|
+
class="flex h-1/2 w-full items-center rounded-tr-2xl border-b border-(--border-color) pl-2 transition-colors duration-150 hover:bg-(--gray-color)/30 active:bg-(--gray-color)/10"
|
|
173
173
|
onclick={() => {
|
|
174
174
|
if (!number.maxNum || !number.step) return
|
|
175
175
|
if (Number(value) + number.step >= number.maxNum) {
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
>
|
|
185
185
|
|
|
186
186
|
<button
|
|
187
|
-
class="flex h-1/2 w-full items-center rounded-br-2xl pl-2 transition-colors duration-150 hover:bg-
|
|
187
|
+
class="flex h-1/2 w-full items-center rounded-br-2xl pl-2 transition-colors duration-150 hover:bg-(--gray-color)/30 active:bg-(--gray-color)/10"
|
|
188
188
|
onclick={() => {
|
|
189
189
|
if (number.minNum === null || number.minNum === undefined || !number.step) return
|
|
190
190
|
if (Number(value) - number.step <= number.minNum) {
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
{#if showInfo}
|
|
224
224
|
<div
|
|
225
225
|
transition:fly={{ x: -15, duration: 250 }}
|
|
226
|
-
class="absolute top-1/2 left-10 z-50 w-auto -translate-y-1/2 rounded bg-
|
|
226
|
+
class="absolute top-1/2 left-10 z-50 w-auto -translate-y-1/2 rounded bg-(--container-color) px-2 py-1 shadow-lg"
|
|
227
227
|
>
|
|
228
228
|
{help?.info}
|
|
229
229
|
</div>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
const initialAlign = $derived(
|
|
30
|
-
$optionsStore.
|
|
30
|
+
$optionsStore.TEXT_ALIGN_OPTIONS.find((a) =>
|
|
31
31
|
(a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
32
32
|
),
|
|
33
33
|
)
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
}
|
|
88
88
|
</script>
|
|
89
89
|
|
|
90
|
-
{#if
|
|
90
|
+
{#if forConstructor}
|
|
91
91
|
<div class="relative flex flex-row items-start justify-center">
|
|
92
92
|
<!-- Сообщение для отправки в ws по нажатию кнопки -->
|
|
93
93
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
label={{ name: $t('constructor.props.align') }}
|
|
179
179
|
type="buttons"
|
|
180
180
|
value={initialAlign}
|
|
181
|
-
options={$optionsStore.
|
|
181
|
+
options={$optionsStore.TEXT_ALIGN_OPTIONS}
|
|
182
182
|
onUpdate={(option) => updateProperty('label.class', twMerge(component.properties.label.class, option.value))}
|
|
183
183
|
/>
|
|
184
184
|
<UI.Select
|
|
@@ -191,4 +191,136 @@
|
|
|
191
191
|
/>
|
|
192
192
|
</div>
|
|
193
193
|
</div>
|
|
194
|
+
{:else}
|
|
195
|
+
<div class="relative flex flex-row items-start justify-center">
|
|
196
|
+
<!-- Сообщение для отправки в ws по нажатию кнопки -->
|
|
197
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
198
|
+
<UI.Input
|
|
199
|
+
label={{ name: $t('constructor.props.id') }}
|
|
200
|
+
value={component.properties.id}
|
|
201
|
+
onUpdate={(value) => updateProperty('id', value as string)}
|
|
202
|
+
/>
|
|
203
|
+
<UI.Input
|
|
204
|
+
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
205
|
+
value={component.properties.wrapperClass}
|
|
206
|
+
onUpdate={(value) => updateProperty('wrapperClass', value as string)}
|
|
207
|
+
/>
|
|
208
|
+
<UI.Input
|
|
209
|
+
label={{ name: $t('constructor.props.label') }}
|
|
210
|
+
value={component.properties.label.name}
|
|
211
|
+
onUpdate={(value) => updateProperty('label.name', value as string)}
|
|
212
|
+
/>
|
|
213
|
+
<UI.Input
|
|
214
|
+
label={{ name: $t('constructor.props.label.class') }}
|
|
215
|
+
value={component.properties.label.class}
|
|
216
|
+
onUpdate={(value) => updateProperty('label.class', value as string)}
|
|
217
|
+
/>
|
|
218
|
+
<UI.Input
|
|
219
|
+
label={{ name: $t('constructor.props.componentclass') }}
|
|
220
|
+
value={component.properties.componentClass}
|
|
221
|
+
onUpdate={(value) => updateProperty('componentClass', value as string)}
|
|
222
|
+
/>
|
|
223
|
+
<UI.Select
|
|
224
|
+
wrapperClass="h-14"
|
|
225
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
226
|
+
type="buttons"
|
|
227
|
+
options={$optionsStore.COLOR_OPTIONS}
|
|
228
|
+
value={initialColor}
|
|
229
|
+
onUpdate={(option) => handleOptionColorChange(option.value as string)}
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
233
|
+
<UI.Input
|
|
234
|
+
label={{ name: $t('constructor.props.value') }}
|
|
235
|
+
value={component.properties.value}
|
|
236
|
+
onUpdate={(value) => updateProperty('value', value as string)}
|
|
237
|
+
/>
|
|
238
|
+
<UI.Select
|
|
239
|
+
label={{ name: $t('constructor.props.type') }}
|
|
240
|
+
options={$optionsStore.INPUT_TYPE_OPTIONS}
|
|
241
|
+
type="buttons"
|
|
242
|
+
value={$optionsStore.INPUT_TYPE_OPTIONS.find((opt) => opt.value === (component.properties.type || 'text'))}
|
|
243
|
+
onUpdate={(selectedOption) => updateProperty('type', selectedOption.value as string)}
|
|
244
|
+
/>
|
|
245
|
+
{#if component.properties.type === 'text' || component.properties.type === 'password' || component.properties.type === 'text-area'}
|
|
246
|
+
<UI.Input
|
|
247
|
+
label={{ name: $t('constructor.props.maxlenght') }}
|
|
248
|
+
value={component.properties.maxlength}
|
|
249
|
+
onUpdate={(value) => updateProperty('maxlength', value as string)}
|
|
250
|
+
/>
|
|
251
|
+
<UI.Input
|
|
252
|
+
label={{ name: $t('constructor.props.regexp') }}
|
|
253
|
+
value={component.properties.help.regExp}
|
|
254
|
+
maxlength={150}
|
|
255
|
+
help={{ info: $t('constructor.props.regexp.info') }}
|
|
256
|
+
componentClass={isValidRegExp === false ? '!border-2 !border-red-400' : ''}
|
|
257
|
+
onUpdate={(value) => updateProperty('help.regExp', value)}
|
|
258
|
+
/>
|
|
259
|
+
{#if component.properties.type === 'text-area'}
|
|
260
|
+
<UI.Input
|
|
261
|
+
label={{ name: $t('constructor.props.textarea.rows') }}
|
|
262
|
+
value={component.properties.textareaRows}
|
|
263
|
+
onUpdate={(value) => updateProperty('textareaRows', value as string)}
|
|
264
|
+
/>
|
|
265
|
+
{/if}
|
|
266
|
+
{:else if component.properties.type === 'number' && !component.properties.readonly && !component.properties.disabled}
|
|
267
|
+
<UI.Input
|
|
268
|
+
label={{ name: $t('constructor.props.minnum') }}
|
|
269
|
+
value={component.properties.number.minNum as number}
|
|
270
|
+
type="number"
|
|
271
|
+
onUpdate={(value) => {
|
|
272
|
+
updateProperty('number.minNum', Number(value))
|
|
273
|
+
}}
|
|
274
|
+
/>
|
|
275
|
+
<UI.Input
|
|
276
|
+
label={{ name: $t('constructor.props.maxnum') }}
|
|
277
|
+
value={component.properties.number.maxNum as number}
|
|
278
|
+
type="number"
|
|
279
|
+
onUpdate={(value) => {
|
|
280
|
+
updateProperty('number.maxNum', Number(value))
|
|
281
|
+
}}
|
|
282
|
+
/>
|
|
283
|
+
<UI.Input
|
|
284
|
+
label={{ name: $t('constructor.props.step') }}
|
|
285
|
+
value={component.properties.number.step as number}
|
|
286
|
+
type="number"
|
|
287
|
+
onUpdate={(value) => updateProperty('number.step', Number(value))}
|
|
288
|
+
/>
|
|
289
|
+
{/if}
|
|
290
|
+
</div>
|
|
291
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
292
|
+
<UI.Input
|
|
293
|
+
label={{ name: $t('constructor.props.placeholder') }}
|
|
294
|
+
value={component.properties.placeholder as string}
|
|
295
|
+
onUpdate={(value) => updateProperty('placeholder', value)}
|
|
296
|
+
/>
|
|
297
|
+
<UI.Input
|
|
298
|
+
label={{ name: $t('constructor.props.info') }}
|
|
299
|
+
value={component.properties.help.info as string}
|
|
300
|
+
onUpdate={(value) => updateProperty('help.info', value)}
|
|
301
|
+
/>
|
|
302
|
+
<UI.Select
|
|
303
|
+
label={{ name: $t('constructor.props.autocomplete') }}
|
|
304
|
+
options={$optionsStore.AUTOCOMPLETE_OPTIONS}
|
|
305
|
+
value={$optionsStore.AUTOCOMPLETE_OPTIONS.find((opt) => opt.value === (component.properties.help.autocomplete || 'off'))}
|
|
306
|
+
onUpdate={(selectedOption) => updateProperty('help.autocomplete', selectedOption.value as string)}
|
|
307
|
+
/>
|
|
308
|
+
|
|
309
|
+
<UI.Switch
|
|
310
|
+
label={{ name: $t('constructor.props.readonly') }}
|
|
311
|
+
value={component.properties.readonly ? 2 : 1}
|
|
312
|
+
onChange={(value) => updateProperty('readonly', value === 2)}
|
|
313
|
+
/>
|
|
314
|
+
<UI.Switch
|
|
315
|
+
label={{ name: $t('constructor.props.copy') }}
|
|
316
|
+
value={component.properties.help.copyButton ? 2 : 1}
|
|
317
|
+
onChange={(value) => updateProperty('help.copyButton', value === 2)}
|
|
318
|
+
/>
|
|
319
|
+
<UI.Switch
|
|
320
|
+
label={{ name: $t('constructor.props.disabled') }}
|
|
321
|
+
value={component.properties.disabled ? 2 : 1}
|
|
322
|
+
onChange={(value) => updateProperty('disabled', value === 2)}
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
</div>
|
|
194
326
|
{/if}
|
package/dist/Modal.svelte
CHANGED
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
{#if isOpen}
|
|
37
37
|
<div class="fixed inset-0 z-60 flex items-center justify-center bg-black/50" transition:fade={{ duration: 200 }}>
|
|
38
38
|
<div
|
|
39
|
-
class={twMerge(`flex w-300 flex-col overflow-hidden rounded-2xl bg-
|
|
39
|
+
class={twMerge(`flex w-300 flex-col overflow-hidden rounded-2xl bg-(--back-color) text-center`, wrapperClass)}
|
|
40
40
|
transition:scale={{ duration: 250, start: 0.8 }}
|
|
41
41
|
>
|
|
42
|
-
<div class="flex items-end justify-between bg-
|
|
42
|
+
<div class="flex items-end justify-between bg-(--field-color) px-6 py-3">
|
|
43
43
|
<h4>{title}</h4>
|
|
44
44
|
<button class="h-6 w-6 cursor-pointer" onclick={onCancel}> <CrossIcon /> </button>
|
|
45
45
|
</div>
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
{@render main?.()}
|
|
49
49
|
</div>
|
|
50
50
|
{#if footer}
|
|
51
|
-
<div class="flex flex-row-reverse justify-between bg-
|
|
51
|
+
<div class="flex flex-row-reverse justify-between bg-(--field-color) p-1.5">
|
|
52
52
|
{@render footer?.()}
|
|
53
53
|
</div>
|
|
54
54
|
{/if}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
id = crypto.randomUUID(),
|
|
8
|
+
wrapperClass = '',
|
|
8
9
|
label = { name: '', class: '' },
|
|
9
10
|
value = $bindable(0),
|
|
10
11
|
number = {
|
|
@@ -12,7 +13,6 @@
|
|
|
12
13
|
maxNum: 100,
|
|
13
14
|
units: '%',
|
|
14
15
|
},
|
|
15
|
-
wrapperClass = '',
|
|
16
16
|
}: IProgressBarProps = $props()
|
|
17
17
|
|
|
18
18
|
const min = $derived(number.minNum ?? 0)
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
return Math.max(min, Math.min(max, value))
|
|
25
25
|
} else if (typeof value === 'string') {
|
|
26
26
|
const parsedValue = parseFloat(value)
|
|
27
|
+
console.log(value)
|
|
27
28
|
if (!isNaN(parsedValue)) {
|
|
28
29
|
return Math.max(min, Math.min(max, parsedValue))
|
|
29
30
|
}
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
|
|
48
49
|
<div class="flex w-full flex-col items-center">
|
|
49
50
|
<div class="relative h-2 w-full rounded bg-gray-400">
|
|
50
|
-
<div class="absolute top-0 left-0 h-full rounded bg-
|
|
51
|
+
<div class="absolute top-0 left-0 h-full rounded bg-(--bg-color)" style="width: {progressPercent()}%;"></div>
|
|
51
52
|
</div>
|
|
52
53
|
<span class="ml-2 font-semibold">{numericValue?.toFixed(2)}{number.units}</span>
|
|
53
54
|
</div>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
|
|
21
21
|
|
|
22
22
|
const initialAlign = $derived(
|
|
23
|
-
$optionsStore.
|
|
23
|
+
$optionsStore.TEXT_ALIGN_OPTIONS.find((a) =>
|
|
24
24
|
(a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
25
25
|
),
|
|
26
26
|
)
|
|
@@ -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
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
label={{ name: $t('constructor.props.align') }}
|
|
97
97
|
type="buttons"
|
|
98
98
|
value={initialAlign}
|
|
99
|
-
options={$optionsStore.
|
|
99
|
+
options={$optionsStore.TEXT_ALIGN_OPTIONS}
|
|
100
100
|
onUpdate={(option) => updateProperty('label.class', twMerge(component.properties.label.class, option.value), component, onPropertyChange)}
|
|
101
101
|
/>
|
|
102
102
|
<UI.Select
|
|
@@ -109,4 +109,68 @@
|
|
|
109
109
|
/>
|
|
110
110
|
</div>
|
|
111
111
|
</div>
|
|
112
|
+
{:else}
|
|
113
|
+
<div class="relative flex flex-row items-start justify-center">
|
|
114
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
115
|
+
<UI.Input
|
|
116
|
+
label={{ name: $t('constructor.props.id') }}
|
|
117
|
+
value={component.properties.id}
|
|
118
|
+
onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
|
|
119
|
+
/>
|
|
120
|
+
<UI.Input
|
|
121
|
+
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
122
|
+
value={component.properties.wrapperClass}
|
|
123
|
+
onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
|
|
124
|
+
/>
|
|
125
|
+
<UI.Select
|
|
126
|
+
wrapperClass="!h-14"
|
|
127
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
128
|
+
type="buttons"
|
|
129
|
+
options={$optionsStore.COLOR_OPTIONS}
|
|
130
|
+
value={initialColor}
|
|
131
|
+
onUpdate={(option) => updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)}
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
135
|
+
<UI.Input
|
|
136
|
+
label={{ name: $t('constructor.props.label') }}
|
|
137
|
+
value={component.properties.label.name}
|
|
138
|
+
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
139
|
+
/>
|
|
140
|
+
<UI.Input
|
|
141
|
+
label={{ name: $t('constructor.props.label.class') }}
|
|
142
|
+
value={component.properties.label.class}
|
|
143
|
+
onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
|
|
144
|
+
/>
|
|
145
|
+
<UI.Input
|
|
146
|
+
label={{ name: $t('constructor.props.value') }}
|
|
147
|
+
value={component.properties.value}
|
|
148
|
+
onUpdate={(value) => updateProperty('value', value as string, component, onPropertyChange)}
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
152
|
+
<UI.Input
|
|
153
|
+
label={{ name: $t('constructor.props.min') }}
|
|
154
|
+
value={component.properties.number.minNum as number}
|
|
155
|
+
type="number"
|
|
156
|
+
onUpdate={(value) => {
|
|
157
|
+
updateProperty('number.minNum', Number(value), component, onPropertyChange)
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
<UI.Input
|
|
161
|
+
label={{ name: $t('constructor.props.max') }}
|
|
162
|
+
value={component.properties.number.maxNum as number}
|
|
163
|
+
type="number"
|
|
164
|
+
onUpdate={(value) => {
|
|
165
|
+
updateProperty('number.maxNum', Number(value), component, onPropertyChange)
|
|
166
|
+
}}
|
|
167
|
+
/>
|
|
168
|
+
|
|
169
|
+
<UI.Input
|
|
170
|
+
label={{ name: $t('constructor.props.units') }}
|
|
171
|
+
value={component.properties.number.units}
|
|
172
|
+
onUpdate={(value) => updateProperty('number.units', value, component, onPropertyChange)}
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
112
176
|
{/if}
|