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
|
@@ -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'});
|
|
@@ -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
|
|
@@ -71,10 +71,10 @@
|
|
|
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}
|
|
@@ -116,12 +116,12 @@
|
|
|
116
116
|
{#if showInfo}
|
|
117
117
|
<div
|
|
118
118
|
transition:fly={{ y: -15, duration: 300 }}
|
|
119
|
-
class="absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-xs rounded-md bg-
|
|
119
|
+
class="absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
|
|
120
120
|
style="transform: translateX(-50%);"
|
|
121
121
|
>
|
|
122
122
|
{content.info}
|
|
123
123
|
<!-- Треугольная стрелка -->
|
|
124
|
-
<div class="absolute top-full left-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rotate-45 transform bg-
|
|
124
|
+
<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>
|
|
125
125
|
</div>
|
|
126
126
|
{/if}
|
|
127
127
|
</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}
|
|
@@ -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"
|
|
@@ -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}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/ButtonProps.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { t } from '../locales/i18n'
|
|
4
|
-
import { type UIComponent,
|
|
4
|
+
import { type UIComponent, updateProperty } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
|
-
import { getContext } from 'svelte'
|
|
7
6
|
import { optionsStore } from '../options'
|
|
8
7
|
import type { IFileInputProps } from './FileAttach.svelte'
|
|
9
8
|
|
|
@@ -44,6 +43,11 @@
|
|
|
44
43
|
/>
|
|
45
44
|
</div>
|
|
46
45
|
<div class="flex w-1/3 flex-col px-2">
|
|
46
|
+
<UI.Input
|
|
47
|
+
label={{ name: $t('constructor.props.file.accept') }}
|
|
48
|
+
value={component.properties.accept}
|
|
49
|
+
onUpdate={(value) => updateProperty('accept', value as string, component, onPropertyChange)}
|
|
50
|
+
/>
|
|
47
51
|
<UI.Select
|
|
48
52
|
label={{ name: $t('constructor.props.type') }}
|
|
49
53
|
type="buttons"
|
|
@@ -51,11 +55,7 @@
|
|
|
51
55
|
options={$optionsStore.FILE_ATTACH_TYPE_OPTIONS}
|
|
52
56
|
onUpdate={(option) => updateProperty('type', option.value as string, component, onPropertyChange)}
|
|
53
57
|
/>
|
|
54
|
-
|
|
55
|
-
label={{ name: $t('constructor.props.file.accept') }}
|
|
56
|
-
value={component.properties.accept}
|
|
57
|
-
onUpdate={(value) => updateProperty('accept', value as string, component, onPropertyChange)}
|
|
58
|
-
/>
|
|
58
|
+
|
|
59
59
|
{#if component.properties.type === 'image'}
|
|
60
60
|
<div class="flex gap-4">
|
|
61
61
|
<UI.Input
|
|
@@ -87,12 +87,5 @@
|
|
|
87
87
|
</div>
|
|
88
88
|
{/if}
|
|
89
89
|
</div>
|
|
90
|
-
<div class="flex w-1/3 flex-col px-2">
|
|
91
|
-
<UI.Input
|
|
92
|
-
label={{ name: $t('constructor.props.currentImage') }}
|
|
93
|
-
value={component.properties.currentImage}
|
|
94
|
-
onUpdate={(value) => updateProperty('currentImage', value as string, component, onPropertyChange)}
|
|
95
|
-
/>
|
|
96
|
-
</div>
|
|
97
90
|
</div>
|
|
98
91
|
{/if}
|
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
|
<!-- Панель настроек -->
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
forConstructor?: boolean
|
|
15
15
|
}>()
|
|
16
16
|
|
|
17
|
+
console.log(component.properties.streamingData)
|
|
18
|
+
|
|
17
19
|
const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
|
|
18
20
|
let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
|
|
19
21
|
</script>
|
|
20
22
|
|
|
21
|
-
{#if
|
|
23
|
+
{#if forConstructor}
|
|
22
24
|
<div class="relative flex flex-row items-start justify-center">
|
|
23
25
|
<!-- Сообщение для отправки в ws по нажатию кнопки -->
|
|
24
26
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
@@ -35,4 +37,83 @@
|
|
|
35
37
|
<div class="flex w-1/3 flex-col px-2"></div>
|
|
36
38
|
<div class="flex w-1/3 flex-col px-2"></div>
|
|
37
39
|
</div>
|
|
40
|
+
{:else}
|
|
41
|
+
<div class="relative mb-2 flex flex-row items-start justify-center">
|
|
42
|
+
<!-- Сообщение для отправки в ws по нажатию кнопки -->
|
|
43
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
44
|
+
<UI.Input
|
|
45
|
+
label={{ name: $t('constructor.props.id') }}
|
|
46
|
+
value={component.properties.id}
|
|
47
|
+
onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
|
|
48
|
+
/>
|
|
49
|
+
<UI.Input
|
|
50
|
+
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
51
|
+
value={component.properties.wrapperClass}
|
|
52
|
+
onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
56
|
+
<UI.Input
|
|
57
|
+
label={{ name: $t('constructor.props.label') }}
|
|
58
|
+
value={component.properties.label.name}
|
|
59
|
+
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
60
|
+
/>
|
|
61
|
+
<UI.Input
|
|
62
|
+
label={{ name: $t('constructor.props.label.class') }}
|
|
63
|
+
value={component.properties.label.class}
|
|
64
|
+
onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
69
|
+
<UI.Switch
|
|
70
|
+
wrapperClass="bg-blue"
|
|
71
|
+
label={{ name: $t('constructor.props.istest') }}
|
|
72
|
+
value={component.properties.isTest ? 2 : 1}
|
|
73
|
+
onChange={(value) => updateProperty('isTest', value === 2, component, onPropertyChange)}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<!-- <hr class="border-gray-400" />
|
|
78
|
+
<div class="space-y-4">
|
|
79
|
+
<div class="m-0 flex items-center justify-center gap-2">
|
|
80
|
+
<h4>{$t('constructor.props.graphdata.title')}</h4>
|
|
81
|
+
<UI.Button wrapperClass="w-8" content={{ icon: ButtonAdd }} />
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
{#each component.properties.streamingData.data || [] as option, index (option.name)}
|
|
85
|
+
<div class="m-0 flex items-end justify-around gap-2 border-gray-400">
|
|
86
|
+
<UI.Input
|
|
87
|
+
label={{ name: $t('constructor.props.optionname') }}
|
|
88
|
+
wrapperClass="!w-3/10"
|
|
89
|
+
value={option.name}
|
|
90
|
+
onUpdate={(value) => {
|
|
91
|
+
const options = [...(component.properties?.streamingData.data || [])]
|
|
92
|
+
options[index]['name'] = value as string
|
|
93
|
+
updateProperty('streamingData.data', options, component, onPropertyChange)
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
<UI.Input
|
|
97
|
+
label={{ name: $t('constructor.props.optionvalue') }}
|
|
98
|
+
wrapperClass="!w-3/10"
|
|
99
|
+
type="number"
|
|
100
|
+
value={option.value}
|
|
101
|
+
onUpdate={(value) => {
|
|
102
|
+
const options = [...(component.properties?.streamingData.data || [])]
|
|
103
|
+
options[index]['value'] = value as number
|
|
104
|
+
updateProperty('streamingData.data', options, component, onPropertyChange)
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
107
|
+
<UI.Button
|
|
108
|
+
wrapperClass="w-8"
|
|
109
|
+
content={{ icon: ButtonDelete }}
|
|
110
|
+
onClick={() => {
|
|
111
|
+
const options = [...(component.properties?.streamingData.data || [])]
|
|
112
|
+
options.splice(index, 1)
|
|
113
|
+
updateProperty('streamingData.data', options, component, onPropertyChange)
|
|
114
|
+
}}
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
{/each}
|
|
118
|
+
</div> -->
|
|
38
119
|
{/if}
|
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>
|
|
@@ -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">
|
|
@@ -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
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
{#if isOpen}
|
|
37
|
-
<div class="fixed inset-0 z-
|
|
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>
|
|
@@ -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
|
|
@@ -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}
|