poe-svelte-ui-lib 1.9.6 → 1.9.8
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 +6 -7
- package/dist/Button/ButtonProps.svelte +21 -21
- package/dist/CommonSnippets.svelte +3 -3
- package/dist/Input/InputProps.svelte +39 -10
- package/dist/Joystick/Joystick.svelte +15 -13
- package/dist/Joystick/JoystickProps.svelte +25 -40
- package/dist/Map/MapProps.svelte +2 -7
- package/dist/Modal.svelte +15 -1
- package/dist/ProgressBar/ProgressBarProps.svelte +2 -0
- package/dist/Select/SelectProps.svelte +1 -1
- package/dist/Slider/Slider.svelte +7 -0
- package/dist/Slider/SliderProps.svelte +3 -3
- package/dist/Switch/SwitchProps.svelte +14 -22
- package/dist/Table/TableProps.svelte +38 -144
- package/dist/Widget/Widget.svelte +5 -4
- package/dist/Widget/WidgetProps.svelte +1 -1
- package/dist/libIcons/Library.svelte +8 -0
- package/dist/libIcons/Library.svelte.d.ts +18 -0
- package/dist/locales/translations.js +17 -3
- package/dist/options.d.ts +5 -0
- package/dist/options.js +18 -0
- package/package.json +6 -6
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
<div class="flex items-start justify-center gap-8">
|
|
96
96
|
<div class="flex w-1/3 flex-col px-2">
|
|
97
97
|
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
98
|
-
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
99
|
-
<CommonSnippets snippet="LabelAlign" initialValue={initialAlign} {component} {onPropertyChange} />
|
|
100
98
|
</div>
|
|
101
99
|
<div class="flex w-1/3 flex-col px-2">
|
|
100
|
+
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
101
|
+
<CommonSnippets snippet="LabelAlign" initialValue={initialAlign} {component} {onPropertyChange} />
|
|
102
102
|
<CommonSnippets
|
|
103
103
|
snippet="IconsLib"
|
|
104
104
|
initialValue={{
|
|
@@ -120,12 +120,12 @@
|
|
|
120
120
|
<div class="flex w-1/3 flex-col px-2">
|
|
121
121
|
<CommonSnippets snippet="Identificator" {component} {onPropertyChange} />
|
|
122
122
|
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
123
|
-
|
|
123
|
+
<CommonSnippets snippet="WrapperClass" {component} {onPropertyChange} />
|
|
124
124
|
{@render AccordionSize()}
|
|
125
|
-
{@render AccordionIsOpen()}
|
|
126
125
|
</div>
|
|
127
126
|
<div class="flex w-1/3 flex-col px-2">
|
|
128
|
-
<CommonSnippets snippet="
|
|
127
|
+
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
128
|
+
<CommonSnippets snippet="LabelClass" initialValue={initialAlign} {component} {onPropertyChange} />
|
|
129
129
|
<CommonSnippets
|
|
130
130
|
snippet="IconsLib"
|
|
131
131
|
initialValue={{
|
|
@@ -137,8 +137,7 @@
|
|
|
137
137
|
{component}
|
|
138
138
|
{onPropertyChange}
|
|
139
139
|
/>
|
|
140
|
-
|
|
141
|
-
<CommonSnippets snippet="LabelClass" initialValue={initialAlign} {component} {onPropertyChange} />
|
|
140
|
+
{@render AccordionIsOpen()}
|
|
142
141
|
</div>
|
|
143
142
|
<div class="flex w-1/3 flex-col items-center gap-2 px-2">
|
|
144
143
|
{@render AccordionBackgroundImage()}
|
|
@@ -152,27 +152,6 @@
|
|
|
152
152
|
</div>
|
|
153
153
|
<div class="flex w-1/3 flex-col px-2">
|
|
154
154
|
{@render ButtonVariables()}
|
|
155
|
-
<CommonSnippets
|
|
156
|
-
snippet="IconsLib"
|
|
157
|
-
initialValue={{
|
|
158
|
-
name: $t("constructor.props.buttonIcon"),
|
|
159
|
-
icon: component.properties.content.icon,
|
|
160
|
-
updateProperty: (icon: string) => {
|
|
161
|
-
updateProperty("content.icon", icon as string, component, onPropertyChange)
|
|
162
|
-
if (component.properties.content.icon && !component.properties.content.name?.trim())
|
|
163
|
-
updateProperty("componentClass", twMerge((component.properties as UI.IButtonProps).componentClass, "w-fit"), component, onPropertyChange)
|
|
164
|
-
else if (!component.properties.content.icon && !component.properties.content.name?.trim())
|
|
165
|
-
updateProperty("componentClass", twMerge((component.properties as UI.IButtonProps).componentClass, "w-full"), component, onPropertyChange)
|
|
166
|
-
},
|
|
167
|
-
icons: { array: ICONS },
|
|
168
|
-
}}
|
|
169
|
-
{component}
|
|
170
|
-
{onPropertyChange}
|
|
171
|
-
/>
|
|
172
|
-
</div>
|
|
173
|
-
<div class="flex w-1/3 flex-col px-2">
|
|
174
|
-
{@render ButtonName()}
|
|
175
|
-
{@render ButtonHeight()}
|
|
176
155
|
<CommonSnippets
|
|
177
156
|
snippet="Colors"
|
|
178
157
|
initialValue={{
|
|
@@ -201,6 +180,27 @@
|
|
|
201
180
|
{onPropertyChange}
|
|
202
181
|
/>
|
|
203
182
|
</div>
|
|
183
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
184
|
+
{@render ButtonName()}
|
|
185
|
+
<CommonSnippets
|
|
186
|
+
snippet="IconsLib"
|
|
187
|
+
initialValue={{
|
|
188
|
+
name: $t("constructor.props.buttonIcon"),
|
|
189
|
+
icon: component.properties.content.icon,
|
|
190
|
+
updateProperty: (icon: string) => {
|
|
191
|
+
updateProperty("content.icon", icon as string, component, onPropertyChange)
|
|
192
|
+
if (component.properties.content.icon && !component.properties.content.name?.trim())
|
|
193
|
+
updateProperty("componentClass", twMerge((component.properties as UI.IButtonProps).componentClass, "w-fit"), component, onPropertyChange)
|
|
194
|
+
else if (!component.properties.content.icon && !component.properties.content.name?.trim())
|
|
195
|
+
updateProperty("componentClass", twMerge((component.properties as UI.IButtonProps).componentClass, "w-full"), component, onPropertyChange)
|
|
196
|
+
},
|
|
197
|
+
icons: { array: ICONS },
|
|
198
|
+
}}
|
|
199
|
+
{component}
|
|
200
|
+
{onPropertyChange}
|
|
201
|
+
/>
|
|
202
|
+
{@render ButtonHeight()}
|
|
203
|
+
</div>
|
|
204
204
|
</div>
|
|
205
205
|
{:else}
|
|
206
206
|
<div class="relative flex flex-row items-start justify-center">
|
|
@@ -212,14 +212,14 @@
|
|
|
212
212
|
<div class="flex">
|
|
213
213
|
<UI.Input
|
|
214
214
|
label={{ name: $t("constructor.props.min") }}
|
|
215
|
-
value={initialValue.number
|
|
215
|
+
value={initialValue.number?.minNum}
|
|
216
216
|
type="number"
|
|
217
217
|
readonly={initialValue.bitMode}
|
|
218
218
|
onUpdate={(value) => initialValue.updateProperty(value as number, "number.minNum")}
|
|
219
219
|
/>
|
|
220
220
|
<UI.Input
|
|
221
221
|
label={{ name: $t("constructor.props.max") }}
|
|
222
|
-
value={initialValue.number
|
|
222
|
+
value={initialValue.number?.maxNum}
|
|
223
223
|
type="number"
|
|
224
224
|
readonly={initialValue.bitMode}
|
|
225
225
|
onUpdate={(value) => initialValue.updateProperty(value as number, "number.maxNum")}
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
{#if component.type !== "ProgressBar"}
|
|
228
228
|
<UI.Input
|
|
229
229
|
label={{ name: $t("constructor.props.step") }}
|
|
230
|
-
value={initialValue.number
|
|
230
|
+
value={initialValue.number?.step}
|
|
231
231
|
type="number"
|
|
232
232
|
readonly={initialValue.bitMode}
|
|
233
233
|
onUpdate={(value) => initialValue.updateProperty(value as number, "number.step")}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as UI from ".."
|
|
6
6
|
import { optionsStore } from "../options"
|
|
7
7
|
import { twMerge } from "tailwind-merge"
|
|
8
|
+
import Library from "../libIcons/Library.svelte"
|
|
8
9
|
|
|
9
10
|
const {
|
|
10
11
|
component,
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
}>()
|
|
18
19
|
|
|
19
20
|
let isValidRegExp = $state(true)
|
|
21
|
+
let showRegExpLibrary = $state(false)
|
|
20
22
|
const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>("DeviceVariables")
|
|
21
23
|
let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
|
|
22
24
|
|
|
@@ -146,14 +148,41 @@
|
|
|
146
148
|
value={component.properties.maxlength}
|
|
147
149
|
onUpdate={(value) => updateProperty("maxlength", value as string)}
|
|
148
150
|
/>
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
<div class="flex items-end">
|
|
152
|
+
<UI.Input
|
|
153
|
+
label={{ name: $t("constructor.props.regexp") }}
|
|
154
|
+
value={component.properties.help.regExp}
|
|
155
|
+
maxlength={150}
|
|
156
|
+
componentClass={isValidRegExp === false ? "!border-2 !border-red-400" : ""}
|
|
157
|
+
onUpdate={(value) => updateProperty("help.regExp", value as string)}
|
|
158
|
+
/>
|
|
159
|
+
<UI.Button
|
|
160
|
+
wrapperClass="w-8"
|
|
161
|
+
content={{ icon: Library, info: { text: $t("constructor.props.regexp.library.info"), side: "top" } }}
|
|
162
|
+
onClick={() => {
|
|
163
|
+
showRegExpLibrary = !showRegExpLibrary
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
{#if showRegExpLibrary}
|
|
167
|
+
<UI.Modal bind:isOpen={showRegExpLibrary} wrapperClass="w-200 h-[80%]">
|
|
168
|
+
{#snippet main()}
|
|
169
|
+
{#each $optionsStore.INPUT_REGEXP_OPTIONS as regexp}
|
|
170
|
+
<div
|
|
171
|
+
class="flex flex-col items-start justify-start m-1.5 rounded-xl border-2 border-(--border-color) p-3 cursor-pointer hover:bg-(--gray-color)/30 transition duration-150"
|
|
172
|
+
role="button"
|
|
173
|
+
tabindex={null}
|
|
174
|
+
onkeydown={null}
|
|
175
|
+
onclick={() => (component.properties.help.regExp = regexp.value)}
|
|
176
|
+
>
|
|
177
|
+
<h5>{regexp.name}</h5>
|
|
178
|
+
<span>{regexp.value}</span>
|
|
179
|
+
</div>
|
|
180
|
+
{/each}
|
|
181
|
+
{/snippet}
|
|
182
|
+
</UI.Modal>
|
|
183
|
+
{/if}
|
|
184
|
+
</div>
|
|
185
|
+
|
|
157
186
|
{#if component.properties.type === "text-area"}
|
|
158
187
|
<UI.Input
|
|
159
188
|
label={{ name: $t("constructor.props.textarea.rows") }}
|
|
@@ -210,7 +239,7 @@
|
|
|
210
239
|
|
|
211
240
|
{#snippet InputSettings()}
|
|
212
241
|
<UI.Select
|
|
213
|
-
|
|
242
|
+
wrapperClass="mt-5"
|
|
214
243
|
options={$optionsStore.INPUT_SETTING_OPTIONS.map((o) =>
|
|
215
244
|
(component.properties.type === "password" || component.properties.type === "number") && o.value == "help.copyButton" ? { ...o, disabled: true } : o,
|
|
216
245
|
)}
|
|
@@ -334,8 +363,8 @@
|
|
|
334
363
|
{#if forConstructor}
|
|
335
364
|
<div class="relative flex flex-row items-start justify-center">
|
|
336
365
|
<div class="flex w-1/3 flex-col px-2">
|
|
337
|
-
{@render InputVariable()}
|
|
338
366
|
{@render InputAccess()}
|
|
367
|
+
{@render InputVariable()}
|
|
339
368
|
{@render InputType()}
|
|
340
369
|
</div>
|
|
341
370
|
<div class="flex w-1/3 flex-col px-2">
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
|
|
127
127
|
<div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class={twMerge(`bg-blue relative flex w-full flex-col items-center`, wrapperClass)}>
|
|
128
128
|
{#if label.name}
|
|
129
|
-
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}
|
|
129
|
+
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
130
130
|
{/if}
|
|
131
131
|
|
|
132
132
|
{#if !readonly}
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
</div>
|
|
210
210
|
</div>
|
|
211
211
|
<!-- Боковые кнопки (ось roll) -->
|
|
212
|
-
{#if axes.
|
|
212
|
+
{#if axes[1].name !== ""}
|
|
213
213
|
<div
|
|
214
214
|
class="absolute flex h-15 w-65 items-center justify-between rounded-full shadow-[0_0_15px_rgb(0_0_0_/0.25)]"
|
|
215
215
|
style="background: color-mix(in srgb, var(--bg-color), var(--shadow-color) 10%)"
|
|
@@ -300,21 +300,23 @@
|
|
|
300
300
|
</div>
|
|
301
301
|
{/if}
|
|
302
302
|
|
|
303
|
-
<div class="flex justify-around">
|
|
303
|
+
<div class="flex justify-around items-end gap-2">
|
|
304
304
|
{#each axes as axe, index}
|
|
305
|
-
|
|
306
|
-
<
|
|
307
|
-
|
|
308
|
-
|
|
305
|
+
{#if axe.name !== "" || index !== 1}
|
|
306
|
+
<div>
|
|
307
|
+
<h5 class="px-2 text-center">{axe.name}</h5>
|
|
308
|
+
<input
|
|
309
|
+
class={`w-20 rounded-2xl border border-(--border-color) px-4 py-1 text-center transition-all duration-300 outline-none
|
|
309
310
|
hover:shadow-md
|
|
310
311
|
[&::-webkit-inner-spin-button]:hidden
|
|
311
312
|
[&::-webkit-outer-spin-button]:hidden`}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
313
|
+
style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
|
|
314
|
+
value={value[index]}
|
|
315
|
+
id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
|
|
316
|
+
readonly
|
|
317
|
+
/>
|
|
318
|
+
</div>
|
|
319
|
+
{/if}
|
|
318
320
|
{/each}
|
|
319
321
|
</div>
|
|
320
322
|
</div>
|
|
@@ -33,56 +33,43 @@
|
|
|
33
33
|
)
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
|
-
{#snippet JoystickAxesNames()}
|
|
37
|
-
<UI.Input
|
|
38
|
-
label={{ name: $t("constructor.props.joystick.axes") }}
|
|
39
|
-
value={component.properties.axes.map((axe: any) => axe.name).join(" ")}
|
|
40
|
-
help={{ info: $t("constructor.props.joystick.axes.info"), regExp: /^[\p{L}0-9\-_":{}]+ +[\p{L}0-9\-_":{}]+(?: +[\p{L}0-9\-_":{}]+)?$/u }}
|
|
41
|
-
maxlength={100}
|
|
42
|
-
onUpdate={(value) => {
|
|
43
|
-
const stringValue = value as string
|
|
44
|
-
const spaceCount = (stringValue.match(/\s/g) || []).length
|
|
45
|
-
if (spaceCount > 2) {
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
const parts = stringValue.trim().split(/\s+/)
|
|
49
|
-
updateProperty(
|
|
50
|
-
"axes",
|
|
51
|
-
parts.map((a: any, index: number) => {
|
|
52
|
-
let axeIndex = parts.length == 2 && component.properties.axes.length === 3 ? index + 1 : index
|
|
53
|
-
return {
|
|
54
|
-
name: a,
|
|
55
|
-
minNum: component.properties.axes[axeIndex] ? component.properties.axes[axeIndex].minNum : -100,
|
|
56
|
-
maxNum: component.properties.axes[axeIndex] ? component.properties.axes[axeIndex].maxNum : 100,
|
|
57
|
-
}
|
|
58
|
-
}),
|
|
59
|
-
component,
|
|
60
|
-
onPropertyChange,
|
|
61
|
-
)
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
{/snippet}
|
|
65
|
-
|
|
66
36
|
{#snippet JoystickAxesMinMax()}
|
|
67
37
|
<div class="mt-2 flex w-full justify-around gap-2">
|
|
68
38
|
{#each component.properties.axes as axe, index}
|
|
69
|
-
|
|
70
|
-
|
|
39
|
+
{@const axesOptions = [
|
|
40
|
+
{ name: $t("constructor.props.joystick.pitch.axe"), info: "", regExp: /^[\p{L}0-9\-_"':{}]+$/u },
|
|
41
|
+
{ name: $t("constructor.props.joystick.roll.axe"), info: $t("constructor.props.joystick.axes.info"), regExp: /^[\p{L}0-9\-_"':{}]*$/u },
|
|
42
|
+
{ name: $t("constructor.props.joystick.yaw.axe"), info: "", regExp: /^[\p{L}0-9\-_"':{}]+$/u },
|
|
43
|
+
]}
|
|
44
|
+
<div class="flex flex-col gap-1">
|
|
45
|
+
<UI.Input
|
|
46
|
+
label={{ name: axesOptions[index].name }}
|
|
47
|
+
value={component.properties.axes[index].name}
|
|
48
|
+
help={{ info: axesOptions[index].info, regExp: axesOptions[index].regExp }}
|
|
49
|
+
maxlength={20}
|
|
50
|
+
onUpdate={(value) => {
|
|
51
|
+
updateProperty(
|
|
52
|
+
"axes",
|
|
53
|
+
component.properties.axes.map((a: any, i: number) => (i === index ? { ...a, name: value } : a)),
|
|
54
|
+
component,
|
|
55
|
+
onPropertyChange,
|
|
56
|
+
)
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
|
|
71
60
|
<UI.Slider
|
|
72
61
|
type="range"
|
|
73
62
|
number={{ minNum: -360, maxNum: 360, step: 10 }}
|
|
63
|
+
disabled={index == 1 && axe.name == ""}
|
|
74
64
|
value={[component.properties.axes[index].minNum, component.properties.axes[index].maxNum]}
|
|
75
65
|
onUpdate={(value) => {
|
|
76
|
-
if (Array.isArray(value))
|
|
77
|
-
const axes = component.properties.axes
|
|
78
|
-
|
|
66
|
+
if (Array.isArray(value))
|
|
79
67
|
updateProperty(
|
|
80
68
|
"axes",
|
|
81
|
-
axes.map((a: any, i: number) => (i === index ? { ...a, minNum: value[0], maxNum: value[1] } : a)),
|
|
69
|
+
component.properties.axes.map((a: any, i: number) => (i === index ? { ...a, minNum: value[0], maxNum: value[1] } : a)),
|
|
82
70
|
component,
|
|
83
71
|
onPropertyChange,
|
|
84
72
|
)
|
|
85
|
-
}
|
|
86
73
|
}}
|
|
87
74
|
/>
|
|
88
75
|
</div>
|
|
@@ -104,9 +91,9 @@
|
|
|
104
91
|
<div>
|
|
105
92
|
<div class="relative flex flex-row items-start justify-center">
|
|
106
93
|
<div class="flex w-1/3 flex-col px-2">
|
|
94
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
107
95
|
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
108
96
|
<CommonSnippets snippet="EventHandlerArgument" {component} {onPropertyChange} />
|
|
109
|
-
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
110
97
|
</div>
|
|
111
98
|
<div class="flex w-1/3 flex-col px-2">
|
|
112
99
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
@@ -125,7 +112,6 @@
|
|
|
125
112
|
{component}
|
|
126
113
|
{onPropertyChange}
|
|
127
114
|
/>
|
|
128
|
-
{@render JoystickAxesNames()}
|
|
129
115
|
<CommonSnippets snippet="Colors" initialValue={{ color: initialColor }} {component} {onPropertyChange} />
|
|
130
116
|
</div>
|
|
131
117
|
</div>
|
|
@@ -156,7 +142,6 @@
|
|
|
156
142
|
{component}
|
|
157
143
|
{onPropertyChange}
|
|
158
144
|
/>
|
|
159
|
-
{@render JoystickAxesNames()}
|
|
160
145
|
<CommonSnippets snippet="Colors" initialValue={{ color: initialColor }} {component} {onPropertyChange} />
|
|
161
146
|
</div>
|
|
162
147
|
</div>
|
package/dist/Map/MapProps.svelte
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { t } from "../locales/i18n"
|
|
3
3
|
import { type UIComponent, type IGraphProps, updateProperty, type IUIComponentHandler } from "../types"
|
|
4
|
-
import * as UI from ".."
|
|
5
|
-
import Modal from "../Modal.svelte"
|
|
6
4
|
import { ICONS } from "../icons"
|
|
7
|
-
import Button from "../Button/Button.svelte"
|
|
8
|
-
import CrossIcon from "../libIcons/CrossIcon.svelte"
|
|
9
5
|
import { optionsStore } from "../options"
|
|
10
|
-
import { twMerge } from "tailwind-merge"
|
|
11
6
|
import { getContext } from "svelte"
|
|
12
7
|
import CommonSnippets from "../CommonSnippets.svelte"
|
|
13
8
|
|
|
@@ -21,8 +16,6 @@
|
|
|
21
16
|
forConstructor?: boolean
|
|
22
17
|
}>()
|
|
23
18
|
|
|
24
|
-
let showIconLib = $state(false)
|
|
25
|
-
|
|
26
19
|
const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>("DeviceVariables")
|
|
27
20
|
let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
|
|
28
21
|
|
|
@@ -36,6 +29,7 @@
|
|
|
36
29
|
{#if forConstructor}
|
|
37
30
|
<div class="relative flex flex-row items-start justify-center">
|
|
38
31
|
<div class="flex w-1/3 flex-col px-2">
|
|
32
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
39
33
|
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
40
34
|
</div>
|
|
41
35
|
<div class="flex w-1/3 flex-col px-2">
|
|
@@ -59,6 +53,7 @@
|
|
|
59
53
|
{:else}
|
|
60
54
|
<div class="relative mb-2 flex flex-row items-start justify-center">
|
|
61
55
|
<div class="flex w-1/3 flex-col px-2">
|
|
56
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
62
57
|
<CommonSnippets snippet="Identificator" {component} {onPropertyChange} />
|
|
63
58
|
</div>
|
|
64
59
|
<div class="flex w-1/3 flex-col px-2">
|
package/dist/Modal.svelte
CHANGED
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
onCancel?: () => void
|
|
25
25
|
} = $props()
|
|
26
26
|
|
|
27
|
+
let modalWrapper: HTMLDivElement | null = $state(null)
|
|
28
|
+
|
|
27
29
|
const handleKeyDown = (event: KeyboardEvent) => {
|
|
28
30
|
if (event.key === "Escape") {
|
|
29
31
|
isOpen = false
|
|
@@ -31,15 +33,27 @@
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
37
|
+
if (modalWrapper && !modalWrapper.contains(event.target as Node)) {
|
|
38
|
+
isOpen = false
|
|
39
|
+
onCancel()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
onMount(() => {
|
|
35
44
|
document.addEventListener("keydown", handleKeyDown)
|
|
36
|
-
|
|
45
|
+
document.addEventListener("mousedown", handleClickOutside)
|
|
46
|
+
return () => {
|
|
47
|
+
document.removeEventListener("keydown", handleKeyDown)
|
|
48
|
+
document.removeEventListener("mousedown", handleClickOutside)
|
|
49
|
+
}
|
|
37
50
|
})
|
|
38
51
|
</script>
|
|
39
52
|
|
|
40
53
|
{#if isOpen}
|
|
41
54
|
<div class="fixed inset-0 z-100 flex items-center justify-center bg-black/50" transition:fade={{ duration: 200, delay: 1 }}>
|
|
42
55
|
<div
|
|
56
|
+
bind:this={modalWrapper}
|
|
43
57
|
class={twMerge(`flex w-300 flex-col overflow-hidden rounded-2xl bg-(--back-color) text-center`, wrapperClass)}
|
|
44
58
|
style="width: {width};"
|
|
45
59
|
transition:scale={{ duration: 250, start: 0.8 }}
|
|
@@ -155,6 +155,7 @@
|
|
|
155
155
|
{#if forConstructor}
|
|
156
156
|
<div class="relative flex flex-row items-start justify-center">
|
|
157
157
|
<div class="flex w-1/3 flex-col px-2">
|
|
158
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
158
159
|
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
159
160
|
{@render ProgressBarType()}
|
|
160
161
|
</div>
|
|
@@ -184,6 +185,7 @@
|
|
|
184
185
|
{:else}
|
|
185
186
|
<div class="relative flex flex-row items-start justify-center">
|
|
186
187
|
<div class="flex w-1/3 flex-col px-2">
|
|
188
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
187
189
|
<CommonSnippets snippet="Identificator" {component} {onPropertyChange} />
|
|
188
190
|
{@render ProgressBarType()}
|
|
189
191
|
</div>
|
|
@@ -252,11 +252,11 @@
|
|
|
252
252
|
{#if forConstructor}
|
|
253
253
|
<div class="relative mb-4 flex flex-row items-start justify-center">
|
|
254
254
|
<div class="flex w-1/3 flex-col px-2">
|
|
255
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
255
256
|
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
256
257
|
{@render SelectArgument()}
|
|
257
258
|
</div>
|
|
258
259
|
<div class="flex w-1/3 flex-col px-2">
|
|
259
|
-
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
260
260
|
{@render SelectType()}
|
|
261
261
|
{@render SelectValueType()}
|
|
262
262
|
</div>
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
[&::-webkit-slider-thumb]:relative
|
|
114
114
|
[&::-webkit-slider-thumb]:size-4
|
|
115
115
|
[&::-webkit-slider-thumb]:cursor-pointer
|
|
116
|
+
${disabled ? "[&::-webkit-slider-thumb]:cursor-not-allowed" : ""}
|
|
116
117
|
[&::-webkit-slider-thumb]:rounded-full
|
|
117
118
|
[&::-webkit-slider-thumb]:shadow-[var(--focus-shadow),]
|
|
118
119
|
${
|
|
@@ -124,6 +125,7 @@
|
|
|
124
125
|
[&::-moz-range-thumb]:ml-[-0.4rem]
|
|
125
126
|
[&::-moz-range-thumb]:size-4
|
|
126
127
|
[&::-moz-range-thumb]:cursor-pointer
|
|
128
|
+
${disabled ? "[&::-moz-range-thumb]:cursor-not-allowed" : ""}
|
|
127
129
|
[&::-moz-range-thumb]:rounded-full
|
|
128
130
|
[&::-moz-range-thumb]:shadow-[var(--focus-shadow),]
|
|
129
131
|
[&::-moz-range-thumb]:ring-[6px]
|
|
@@ -160,6 +162,7 @@
|
|
|
160
162
|
[&::-webkit-slider-thumb]:relative
|
|
161
163
|
[&::-webkit-slider-thumb]:size-4
|
|
162
164
|
[&::-webkit-slider-thumb]:cursor-pointer
|
|
165
|
+
${disabled ? "[&::-webkit-slider-thumb]:cursor-not-allowed" : ""}
|
|
163
166
|
[&::-webkit-slider-thumb]:rounded-full
|
|
164
167
|
[&::-webkit-slider-thumb]:shadow-[var(--focus-shadow),]
|
|
165
168
|
${
|
|
@@ -171,6 +174,7 @@
|
|
|
171
174
|
[&::-moz-range-thumb]:ml-[-0.4rem]
|
|
172
175
|
[&::-moz-range-thumb]:size-4
|
|
173
176
|
[&::-moz-range-thumb]:cursor-pointer
|
|
177
|
+
${disabled ? "[&::-moz-range-thumb]:cursor-not-allowed" : ""}
|
|
174
178
|
[&::-moz-range-thumb]:rounded-full
|
|
175
179
|
[&::-moz-range-thumb]:shadow-[var(--focus-shadow),]
|
|
176
180
|
[&::-moz-range-thumb]:ring-[6px]
|
|
@@ -193,6 +197,7 @@
|
|
|
193
197
|
max={number.maxNum}
|
|
194
198
|
step={number.step}
|
|
195
199
|
bind:value={singleValue}
|
|
200
|
+
{disabled}
|
|
196
201
|
oninput={() => onUpdate(singleValue)}
|
|
197
202
|
class={twMerge(
|
|
198
203
|
`h-8 w-full appearance-none overflow-hidden rounded-full accent-(--back-color)
|
|
@@ -205,6 +210,7 @@
|
|
|
205
210
|
[&::-webkit-slider-thumb]:h-4
|
|
206
211
|
[&::-webkit-slider-thumb]:w-4
|
|
207
212
|
[&::-webkit-slider-thumb]:cursor-pointer
|
|
213
|
+
${disabled ? "[&::-webkit-slider-thumb]:cursor-not-allowed" : ""}
|
|
208
214
|
[&::-webkit-slider-thumb]:rounded-full
|
|
209
215
|
[&::-webkit-slider-thumb]:shadow-[var(--focus-shadow),]
|
|
210
216
|
${
|
|
@@ -216,6 +222,7 @@
|
|
|
216
222
|
[&::-moz-range-thumb]:ml-[-0.4rem]
|
|
217
223
|
[&::-moz-range-thumb]:size-4
|
|
218
224
|
[&::-moz-range-thumb]:cursor-pointer
|
|
225
|
+
${disabled ? "[&::-moz-range-thumb]:cursor-not-allowed" : ""}
|
|
219
226
|
[&::-moz-range-thumb]:rounded-full
|
|
220
227
|
[&::-moz-range-thumb]:shadow-[var(--focus-shadow),]
|
|
221
228
|
[&::-moz-range-thumb]:ring-[6px]
|
|
@@ -56,21 +56,21 @@
|
|
|
56
56
|
{#if forConstructor}
|
|
57
57
|
<div class="relative flex flex-row items-start justify-center">
|
|
58
58
|
<div class="flex w-1/3 flex-col px-2">
|
|
59
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
59
60
|
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
60
61
|
<CommonSnippets snippet="EventHandlerArgument" {component} {onPropertyChange} />
|
|
61
|
-
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
62
62
|
</div>
|
|
63
63
|
<div class="flex w-1/3 flex-col px-2">
|
|
64
64
|
{@render SliderType()}
|
|
65
65
|
<CommonSnippets
|
|
66
66
|
snippet="MinMaxStep"
|
|
67
|
-
initialValue=
|
|
67
|
+
initialValue={{
|
|
68
68
|
number: component.properties.number,
|
|
69
69
|
bitMode: component.properties.bitMode,
|
|
70
70
|
updateProperty: (value: number, property: string) => {
|
|
71
71
|
updateProperty(property, Number(value), component, onPropertyChange)
|
|
72
72
|
},
|
|
73
|
-
}}
|
|
73
|
+
}}
|
|
74
74
|
{component}
|
|
75
75
|
{onPropertyChange}
|
|
76
76
|
/>
|
|
@@ -36,16 +36,18 @@
|
|
|
36
36
|
{/snippet}
|
|
37
37
|
|
|
38
38
|
{#snippet SwitchCaptions()}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
{#if component.properties.type == "horizontal"}
|
|
40
|
+
<UI.Input
|
|
41
|
+
label={{ name: $t("constructor.props.caption.left") }}
|
|
42
|
+
value={component.properties.label.captionLeft}
|
|
43
|
+
onUpdate={(value) => updateProperty("label.captionLeft", value as string, component, onPropertyChange)}
|
|
44
|
+
/>
|
|
45
|
+
<UI.Input
|
|
46
|
+
label={{ name: $t("constructor.props.caption.right") }}
|
|
47
|
+
value={component.properties.label.captionRight}
|
|
48
|
+
onUpdate={(value) => updateProperty("label.captionRight", value as string, component, onPropertyChange)}
|
|
49
|
+
/>
|
|
50
|
+
{/if}
|
|
49
51
|
{/snippet}
|
|
50
52
|
|
|
51
53
|
{#snippet SwitchDisabled()}
|
|
@@ -62,15 +64,6 @@
|
|
|
62
64
|
/>
|
|
63
65
|
{/snippet}
|
|
64
66
|
|
|
65
|
-
{#snippet SwitchColors()}
|
|
66
|
-
<UI.Select
|
|
67
|
-
wrapperClass="!h-14"
|
|
68
|
-
label={{ name: $t("constructor.props.colors") }}
|
|
69
|
-
type="buttons"
|
|
70
|
-
options={$optionsStore.COLOR_OPTIONS.filter((option) => option.value !== "bg-max" && option.value !== "bg-gray")}
|
|
71
|
-
/>
|
|
72
|
-
{/snippet}
|
|
73
|
-
|
|
74
67
|
{#snippet SwitchBitmode()}
|
|
75
68
|
<UI.Switch
|
|
76
69
|
wrapperClass="bg-blue"
|
|
@@ -193,9 +186,9 @@
|
|
|
193
186
|
{#if forConstructor}
|
|
194
187
|
<div class="relative flex flex-row items-start justify-center">
|
|
195
188
|
<div class="flex w-1/3 flex-col px-2">
|
|
189
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
196
190
|
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
197
191
|
<CommonSnippets snippet="EventHandlerArgument" {component} {onPropertyChange} />
|
|
198
|
-
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
199
192
|
</div>
|
|
200
193
|
|
|
201
194
|
<div class="flex w-1/3 flex-col px-2">
|
|
@@ -258,11 +251,10 @@
|
|
|
258
251
|
</div>
|
|
259
252
|
<div class="flex w-1/3 flex-col px-2">
|
|
260
253
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
261
|
-
|
|
254
|
+
{@render SwitchType()}
|
|
262
255
|
{#if !component.properties.bitMode}
|
|
263
256
|
{@render SwitchCaptions()}
|
|
264
257
|
{/if}
|
|
265
|
-
{@render SwitchType()}
|
|
266
258
|
</div>
|
|
267
259
|
<div class="flex w-1/3 flex-col px-2">
|
|
268
260
|
{@render SwitchHeight()}
|
|
@@ -230,9 +230,9 @@
|
|
|
230
230
|
<div class="flex flex-col gap-2" bind:this={settingsContainer[columnIndex]}>
|
|
231
231
|
{#if typeof column.content !== "function"}
|
|
232
232
|
{#each column.content as content, index}
|
|
233
|
-
{
|
|
234
|
-
{
|
|
235
|
-
|
|
233
|
+
<div id={`item-${index}-${columnIndex}`} class="relative bg-(--container-color)/50 rounded-2xl p-2">
|
|
234
|
+
{#if content.type == "text"}
|
|
235
|
+
{@const text = content.data}
|
|
236
236
|
<div class="flex gap-2 mx-auto items-end" style="width: {forConstructor ? '65%' : '90%'}; ">
|
|
237
237
|
<UI.Input
|
|
238
238
|
wrapperClass="w-1/4"
|
|
@@ -245,7 +245,6 @@
|
|
|
245
245
|
"content",
|
|
246
246
|
column.content.map((textItem: any, i: number) => (i == index ? { ...textItem, data: { ...textItem.data, key: value } } : textItem)),
|
|
247
247
|
)
|
|
248
|
-
// updateTableBody()
|
|
249
248
|
}}
|
|
250
249
|
/>
|
|
251
250
|
<UI.Select
|
|
@@ -259,35 +258,8 @@
|
|
|
259
258
|
onUpdate={(value) => changeColumnSettings(value, columnIndex, index)}
|
|
260
259
|
/>
|
|
261
260
|
</div>
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
wrapperClass="absolute left-2 bottom-2"
|
|
265
|
-
container={settingsContainer[columnIndex]}
|
|
266
|
-
array={column.content}
|
|
267
|
-
elementIndex={index}
|
|
268
|
-
containerIndex={columnIndex}
|
|
269
|
-
onUpdate={(updatedArray, index) => {
|
|
270
|
-
if (index === columnIndex) {
|
|
271
|
-
const headers = [...component.properties.header]
|
|
272
|
-
headers[columnIndex].content = updatedArray
|
|
273
|
-
updateProperty("header", headers, component, onPropertyChange)
|
|
274
|
-
}
|
|
275
|
-
}}
|
|
276
|
-
/>
|
|
277
|
-
|
|
278
|
-
<UI.Button
|
|
279
|
-
wrapperClass="absolute right-2 bottom-2 w-8"
|
|
280
|
-
content={{ icon: ButtonDelete }}
|
|
281
|
-
onClick={() => {
|
|
282
|
-
const headers = [...(component.properties.header || [])]
|
|
283
|
-
;((headers as ITableHeader<object>[])[columnIndex].content as ITableContent<object>[]).splice(index, 1)
|
|
284
|
-
updateProperty("header", headers, component, onPropertyChange)
|
|
285
|
-
}}
|
|
286
|
-
/>
|
|
287
|
-
</div>
|
|
288
|
-
{:else if content.type == "select"}
|
|
289
|
-
{@const select = content.data}
|
|
290
|
-
<div id={`item-${index}-${columnIndex}`} class="relative bg-(--container-color)/50 rounded-2xl p-2">
|
|
261
|
+
{:else if content.type == "select"}
|
|
262
|
+
{@const select = content.data}
|
|
291
263
|
<div class="flex w-1/3 mx-auto gap-2">
|
|
292
264
|
<UI.Input
|
|
293
265
|
wrapperClass="w-1/2"
|
|
@@ -316,35 +288,8 @@
|
|
|
316
288
|
}}
|
|
317
289
|
/>
|
|
318
290
|
</div>
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
wrapperClass="absolute left-2 bottom-2"
|
|
322
|
-
container={settingsContainer[columnIndex]}
|
|
323
|
-
array={column.content}
|
|
324
|
-
elementIndex={index}
|
|
325
|
-
containerIndex={columnIndex}
|
|
326
|
-
onUpdate={(updatedArray, index) => {
|
|
327
|
-
if (index === columnIndex) {
|
|
328
|
-
const headers = [...component.properties.header]
|
|
329
|
-
headers[columnIndex].content = updatedArray
|
|
330
|
-
updateProperty("header", headers, component, onPropertyChange)
|
|
331
|
-
}
|
|
332
|
-
}}
|
|
333
|
-
/>
|
|
334
|
-
|
|
335
|
-
<UI.Button
|
|
336
|
-
wrapperClass="absolute right-2 bottom-2 w-8"
|
|
337
|
-
content={{ icon: ButtonDelete }}
|
|
338
|
-
onClick={() => {
|
|
339
|
-
const headers = [...(component.properties.header || [])]
|
|
340
|
-
;((headers as ITableHeader<object>[])[columnIndex].content as ITableContent<object>[]).splice(index, 1)
|
|
341
|
-
updateProperty("header", headers, component, onPropertyChange)
|
|
342
|
-
}}
|
|
343
|
-
/>
|
|
344
|
-
</div>
|
|
345
|
-
{:else if content.type == "button"}
|
|
346
|
-
{@const button = content.data}
|
|
347
|
-
<div id={`item-${index}-${columnIndex}`} class="relative w-full bg-(--container-color)/50 rounded-2xl p-2">
|
|
291
|
+
{:else if content.type == "button"}
|
|
292
|
+
{@const button = content.data}
|
|
348
293
|
<div class="flex w-[95%] mx-auto items-end justify-between gap-2">
|
|
349
294
|
<UI.Input
|
|
350
295
|
label={{ name: $t("constructor.props.name") }}
|
|
@@ -415,34 +360,8 @@
|
|
|
415
360
|
}}
|
|
416
361
|
/>
|
|
417
362
|
</div>
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
wrapperClass="absolute right-2 bottom-2 w-8"
|
|
421
|
-
content={{ icon: ButtonDelete }}
|
|
422
|
-
onClick={() => {
|
|
423
|
-
const headers = [...(component.properties.header || [])]
|
|
424
|
-
;((headers as ITableHeader<object>[])[columnIndex].content as ITableContent<object>[]).splice(index, 1)
|
|
425
|
-
updateProperty("header", headers, component, onPropertyChange)
|
|
426
|
-
}}
|
|
427
|
-
/>
|
|
428
|
-
<Dragging
|
|
429
|
-
wrapperClass="absolute left-2 bottom-2"
|
|
430
|
-
container={settingsContainer[columnIndex]}
|
|
431
|
-
array={column.content}
|
|
432
|
-
elementIndex={index}
|
|
433
|
-
containerIndex={columnIndex}
|
|
434
|
-
onUpdate={(updatedArray, index) => {
|
|
435
|
-
if (index === columnIndex) {
|
|
436
|
-
const headers = [...component.properties.header]
|
|
437
|
-
headers[columnIndex].content = updatedArray
|
|
438
|
-
updateProperty("header", headers, component, onPropertyChange)
|
|
439
|
-
}
|
|
440
|
-
}}
|
|
441
|
-
/>
|
|
442
|
-
</div>
|
|
443
|
-
{:else if content.type == "progressBar"}
|
|
444
|
-
{@const progressBar = content.data}
|
|
445
|
-
<div id={`item-${index}-${columnIndex}`} class="relative bg-(--container-color)/50 rounded-2xl p-2">
|
|
363
|
+
{:else if content.type == "progressBar"}
|
|
364
|
+
{@const progressBar = content.data}
|
|
446
365
|
<div class="w-3/5 flex mx-auto items-end gap-2">
|
|
447
366
|
<UI.Input
|
|
448
367
|
label={{ name: $t("constructor.props.table.progressBar.key") }}
|
|
@@ -477,34 +396,8 @@
|
|
|
477
396
|
onUpdate={(value) => updateContentProperty(columnIndex, index, "units", value as string)}
|
|
478
397
|
/>
|
|
479
398
|
</div>
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
wrapperClass="absolute left-2 bottom-2"
|
|
483
|
-
container={settingsContainer[columnIndex]}
|
|
484
|
-
array={column.content}
|
|
485
|
-
elementIndex={index}
|
|
486
|
-
containerIndex={columnIndex}
|
|
487
|
-
onUpdate={(updatedArray, index) => {
|
|
488
|
-
if (index === columnIndex) {
|
|
489
|
-
const headers = [...component.properties.header]
|
|
490
|
-
headers[columnIndex].content = updatedArray
|
|
491
|
-
updateProperty("header", headers, component, onPropertyChange)
|
|
492
|
-
}
|
|
493
|
-
}}
|
|
494
|
-
/>
|
|
495
|
-
<UI.Button
|
|
496
|
-
wrapperClass="absolute right-2 bottom-2 w-8"
|
|
497
|
-
content={{ icon: ButtonDelete }}
|
|
498
|
-
onClick={() => {
|
|
499
|
-
const headers = [...(component.properties.header || [])]
|
|
500
|
-
;((headers as ITableHeader<object>[])[columnIndex].content as ITableContent<object>[]).splice(index, 1)
|
|
501
|
-
updateProperty("header", headers, component, onPropertyChange)
|
|
502
|
-
}}
|
|
503
|
-
/>
|
|
504
|
-
</div>
|
|
505
|
-
{:else if !forConstructor && content.type == "image"}
|
|
506
|
-
{@const image = content.data}
|
|
507
|
-
<div id={`item-${index}-${columnIndex}`} class="relative bg-(--container-color)/50 rounded-2xl p-2">
|
|
399
|
+
{:else if !forConstructor && content.type == "image"}
|
|
400
|
+
{@const image = content.data}
|
|
508
401
|
<div class="flex items-end gap-2 w-[80%] mx-auto">
|
|
509
402
|
<CommonSnippets
|
|
510
403
|
snippet="IconsLib"
|
|
@@ -544,35 +437,36 @@
|
|
|
544
437
|
onUpdate={(value) => updateContentProperty(columnIndex, index, "height", `${value ?? 0}rem`)}
|
|
545
438
|
/>
|
|
546
439
|
</div>
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}
|
|
559
|
-
}}
|
|
560
|
-
/>
|
|
561
|
-
<UI.Button
|
|
562
|
-
wrapperClass="absolute right-2 bottom-2 w-8"
|
|
563
|
-
content={{ icon: ButtonDelete }}
|
|
564
|
-
onClick={() => {
|
|
565
|
-
const headers = [...(component.properties.header || [])]
|
|
566
|
-
;((headers as ITableHeader<object>[])[columnIndex].content as ITableContent<object>[]).splice(index, 1)
|
|
440
|
+
{/if}
|
|
441
|
+
<Dragging
|
|
442
|
+
wrapperClass="absolute left-2 bottom-2"
|
|
443
|
+
container={settingsContainer[columnIndex]}
|
|
444
|
+
array={column.content}
|
|
445
|
+
elementIndex={index}
|
|
446
|
+
containerIndex={columnIndex}
|
|
447
|
+
onUpdate={(updatedArray, index) => {
|
|
448
|
+
if (index === columnIndex) {
|
|
449
|
+
const headers = [...component.properties.header]
|
|
450
|
+
headers[columnIndex].content = updatedArray
|
|
567
451
|
updateProperty("header", headers, component, onPropertyChange)
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
452
|
+
}
|
|
453
|
+
}}
|
|
454
|
+
/>
|
|
455
|
+
|
|
456
|
+
<UI.Button
|
|
457
|
+
wrapperClass="absolute right-2 bottom-2 w-8"
|
|
458
|
+
content={{ icon: ButtonDelete }}
|
|
459
|
+
onClick={() => {
|
|
460
|
+
const headers = [...(component.properties.header || [])]
|
|
461
|
+
;((headers as ITableHeader<object>[])[columnIndex].content as ITableContent<object>[]).splice(index, 1)
|
|
462
|
+
updateProperty("header", headers, component, onPropertyChange)
|
|
463
|
+
}}
|
|
464
|
+
/>
|
|
465
|
+
</div>
|
|
572
466
|
{/each}
|
|
573
467
|
{/if}
|
|
574
|
-
<div id={`item-${column.content.length}-${columnIndex}`} class="min-h-2"></div>
|
|
575
468
|
</div>
|
|
469
|
+
<div id={`item-${column.content.length}-${columnIndex}`} class="min-h-2"></div>
|
|
576
470
|
</div>
|
|
577
471
|
{/each}
|
|
578
472
|
<div id={`column-${component.properties.header.length}`} class="min-h-4"></div>
|
|
@@ -625,8 +519,8 @@
|
|
|
625
519
|
{#if forConstructor}
|
|
626
520
|
<div class="relative flex flex-row items-start justify-center pb-4">
|
|
627
521
|
<div class="flex w-1/3 flex-col px-2">
|
|
628
|
-
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
629
522
|
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
523
|
+
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
630
524
|
{@render TableStashData()}
|
|
631
525
|
{#if component.properties.dataBuffer.stashData}
|
|
632
526
|
<div class="flex items-end">
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
6
|
id = crypto.randomUUID(),
|
|
7
|
+
wrapperClass,
|
|
7
8
|
label = { name: "", class: "" },
|
|
8
9
|
readonly = false,
|
|
9
10
|
settings = { label: "", number: { minNum: 0, maxNum: 1000, step: 1 } },
|
|
@@ -101,14 +102,14 @@
|
|
|
101
102
|
}
|
|
102
103
|
</script>
|
|
103
104
|
|
|
104
|
-
<div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class="w-full h-full p-1">
|
|
105
|
+
<div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class={twMerge("w-full h-full p-1", wrapperClass)}>
|
|
105
106
|
<div
|
|
106
107
|
class={`h-full grid grid-rows-[4fr_9fr_5fr] rounded-xl bg-(--container-color)
|
|
107
108
|
transition-shadow duration-250 p-1
|
|
108
109
|
shadow-[0_0_3px_rgb(0_0_0_/0.25)] hover:shadow-[0_0_6px_rgb(0_0_0_/0.25)]`}
|
|
109
110
|
>
|
|
110
|
-
<div class="grid gap-2 overflow-hidden items-center" style="grid-template-columns:{icons.array ? '3.5rem' : ''} 1fr;">
|
|
111
|
-
{#if icons.array}
|
|
111
|
+
<div class="grid gap-2 overflow-hidden items-center" style="grid-template-columns:{icons.array && icons.array.length !== 0 ? '3.5rem' : ''} 1fr;">
|
|
112
|
+
{#if icons.array && icons.array.length !== 0}
|
|
112
113
|
<div class="size-14 p-0.5 [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full {icons.class}">
|
|
113
114
|
{@html currentImage}
|
|
114
115
|
</div>
|
|
@@ -127,7 +128,7 @@
|
|
|
127
128
|
<span class="text-5xl">{currentValue === 0 ? (settings.switch?.captionLeft ?? "Off") : (settings.switch?.captionRight ?? "On")}</span>
|
|
128
129
|
{/if}
|
|
129
130
|
</div>
|
|
130
|
-
<div class="px-2">
|
|
131
|
+
<div class="flex flex-col items-center justify-center px-2">
|
|
131
132
|
{#if settings.label}
|
|
132
133
|
<h5>{settings.label}</h5>
|
|
133
134
|
{/if}
|
|
@@ -161,9 +161,9 @@
|
|
|
161
161
|
{#if forConstructor}
|
|
162
162
|
<div class="flex mb-4 items-start justify-center gap-8">
|
|
163
163
|
<div class="flex w-1/3 flex-col px-2">
|
|
164
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
164
165
|
<CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
|
|
165
166
|
<CommonSnippets snippet="EventHandlerArgument" {component} {onPropertyChange} />
|
|
166
|
-
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
167
167
|
</div>
|
|
168
168
|
<div class="flex w-1/3 flex-col px-2">
|
|
169
169
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 16 16"
|
|
4
|
+
><path
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
d="M1 3.25C1 2.56 1.56 2 2.249 2h.5c.69 0 1.248.56 1.248 1.25v9.495c0 .69-.559 1.25-1.248 1.25h-.5A1.25 1.25 0 0 1 1 12.744zM2.249 3a.25.25 0 0 0-.25.25v9.495c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25V3.249a.25.25 0 0 0-.25-.25zm2.748.25c0-.69.559-1.25 1.249-1.25h.5c.689 0 1.248.56 1.248 1.25v9.495c0 .69-.56 1.25-1.249 1.25h-.5a1.25 1.25 0 0 1-1.248-1.25zM6.246 3a.25.25 0 0 0-.25.25v9.495c0 .138.112.25.25.25h.5a.25.25 0 0 0 .249-.25V3.249a.25.25 0 0 0-.25-.25zm5.726 1.777a1.25 1.25 0 0 0-1.57-.713l-.583.204a1.25 1.25 0 0 0-.746 1.645l2.937 7.304c.249.62.94.933 1.571.713l.582-.204a1.25 1.25 0 0 0 .746-1.646zm-1.24.23a.25.25 0 0 1 .313.143l2.937 7.303a.25.25 0 0 1-.149.33l-.582.203a.25.25 0 0 1-.314-.142L10 5.54a.25.25 0 0 1 .149-.329z"
|
|
7
|
+
/></svg
|
|
8
|
+
>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Library: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Library = InstanceType<typeof Library>;
|
|
18
|
+
export default Library;
|
|
@@ -98,7 +98,19 @@ const translations = {
|
|
|
98
98
|
"constructor.props.autocomplete": "Автозаполнение",
|
|
99
99
|
"constructor.props.maxlength": "Максимальная длина",
|
|
100
100
|
"constructor.props.regexp": "Выражение валидации",
|
|
101
|
-
"constructor.props.regexp.info": "
|
|
101
|
+
"constructor.props.regexp.library.info": "Библиотека выражений",
|
|
102
|
+
"constructor.props.regexp.latin10": "Строка латинских символов с максимальной длиной 10",
|
|
103
|
+
"constructor.props.regexp.kiril10": "Строка букв русского алфавита с максимальной длиной 10",
|
|
104
|
+
"constructor.props.regexp.ipv4": "IPv4",
|
|
105
|
+
"constructor.props.regexp.ipv6": "IPv6",
|
|
106
|
+
"constructor.props.regexp.date": "Дата в формате ДД.ММ.ГГГГ",
|
|
107
|
+
"constructor.props.regexp.time": "Время (24-часовой формат)",
|
|
108
|
+
"constructor.props.regexp.email": "Электронная почта",
|
|
109
|
+
"constructor.props.regexp.url": "URL",
|
|
110
|
+
"constructor.props.regexp.numbers": "Целые числа и числа с плавающей точкой (разделитель точка)",
|
|
111
|
+
"constructor.props.regexp.colorhex": "Цвет HEX",
|
|
112
|
+
"constructor.props.regexp.devid": "ID устройства",
|
|
113
|
+
"constructor.props.regexp.serialnum": "Серийный номер устройства",
|
|
102
114
|
"constructor.props.min": "Мин.",
|
|
103
115
|
"constructor.props.max": "Макс.",
|
|
104
116
|
"constructor.props.units": "Единица измерения",
|
|
@@ -142,8 +154,10 @@ const translations = {
|
|
|
142
154
|
"constructor.props.multiselect": "Мультивыбор",
|
|
143
155
|
"constructor.props.access": "Доступ (не для владельца)",
|
|
144
156
|
"constructor.props.map.timeout": "Таймаут маркеров:",
|
|
145
|
-
"constructor.props.joystick.
|
|
146
|
-
"constructor.props.joystick.
|
|
157
|
+
"constructor.props.joystick.pitch.axe": "Ocь ⮃",
|
|
158
|
+
"constructor.props.joystick.roll.axe": "Ось ↶ ↷",
|
|
159
|
+
"constructor.props.joystick.yaw.axe": "Ось ⮂",
|
|
160
|
+
"constructor.props.joystick.axes.info": "Если поле пустое - ось не видна",
|
|
147
161
|
"constructor.props.joystick.homebutton": "Центральная кнопка сброса",
|
|
148
162
|
"constructor.props.file.select": "Выберите файл",
|
|
149
163
|
"constructor.props.file.notselected": "Файл не выбран",
|
package/dist/options.d.ts
CHANGED
|
@@ -155,6 +155,11 @@ export declare const optionsStore: import("svelte/store").Readable<{
|
|
|
155
155
|
value: string;
|
|
156
156
|
name: string;
|
|
157
157
|
}[];
|
|
158
|
+
INPUT_REGEXP_OPTIONS: {
|
|
159
|
+
id: string;
|
|
160
|
+
value: string;
|
|
161
|
+
name: string;
|
|
162
|
+
}[];
|
|
158
163
|
AUTOCOMPLETE_CONSTRUCTOR_OPTIONS: {
|
|
159
164
|
id: string;
|
|
160
165
|
value: string;
|
package/dist/options.js
CHANGED
|
@@ -199,6 +199,24 @@ export const optionsStore = derived(t, ($t) => {
|
|
|
199
199
|
{ id: id(), value: "slider", name: $t("constructor.props.slider") },
|
|
200
200
|
{ id: id(), value: "switch", name: $t("constructor.props.switch") },
|
|
201
201
|
],
|
|
202
|
+
INPUT_REGEXP_OPTIONS: [
|
|
203
|
+
{ id: id(), value: "/^[0-9a-z]{0,10}$/", name: $t("constructor.props.regexp.latin10") },
|
|
204
|
+
{ id: id(), value: "/^[а-яА-яЁё]{0,10}$/", name: $t("constructor.props.regexp.kiril10") },
|
|
205
|
+
{
|
|
206
|
+
id: id(),
|
|
207
|
+
value: "/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/",
|
|
208
|
+
name: $t("constructor.props.regexp.ipv4"),
|
|
209
|
+
},
|
|
210
|
+
{ id: id(), value: "/((^|:)([0-9a-fA-F]{0,4})){1,8}$/", name: $t("constructor.props.regexp.ipv6") },
|
|
211
|
+
{ id: id(), value: "/(0[1-9]|[12][0-9]|3[01])[.](0[1-9]|1[012])[.](19|20)\\d\\d/", name: $t("constructor.props.regexp.date") },
|
|
212
|
+
{ id: id(), value: "/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$/", name: $t("constructor.props.regexp.time") },
|
|
213
|
+
{ id: id(), value: "/^[a-zA-Z0-9.!#$%&'*+/=?^_{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)\\*$/", name: $t("constructor.props.regexp.email") },
|
|
214
|
+
{ id: id(), value: "/(https?):((//)|(\\\\))+[\\w\\d:#@%/$()~_?\\+-=\\\\\\.&]*/", name: $t("constructor.props.regexp.url") },
|
|
215
|
+
{ id: id(), value: "/^-?\\d+(\\.\\d+)?$/", name: $t("constructor.props.regexp.numbers") },
|
|
216
|
+
{ id: id(), value: "/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/", name: $t("constructor.props.regexp.colorhex") },
|
|
217
|
+
{ id: id(), value: "/^[0-9A-F]{0,4}$/", name: $t("constructor.props.regexp.devid") },
|
|
218
|
+
{ id: id(), value: "/^[0-9a-fA-F]{4}-[0-9a-fA-F]{24}[:][0-9a-fA-F]{2}$|^$/", name: $t("constructor.props.regexp.serialnum") },
|
|
219
|
+
],
|
|
202
220
|
AUTOCOMPLETE_CONSTRUCTOR_OPTIONS: [
|
|
203
221
|
{ id: id(), value: "on", name: $t("constructor.props.autocomplete.on") },
|
|
204
222
|
{ id: id(), value: "off", name: $t("constructor.props.autocomplete.off") },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-svelte-ui-lib",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
40
|
-
"@sveltejs/kit": "^2.
|
|
40
|
+
"@sveltejs/kit": "^2.57.1",
|
|
41
41
|
"@sveltejs/package": "^2.5.7",
|
|
42
42
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
43
43
|
"@tailwindcss/vite": "^4.2.2",
|
|
44
44
|
"@types/maplibre-gl": "^1.14.0",
|
|
45
|
-
"@types/node": "^25.
|
|
46
|
-
"prettier": "^3.8.
|
|
45
|
+
"@types/node": "^25.6.0",
|
|
46
|
+
"prettier": "^3.8.2",
|
|
47
47
|
"prettier-plugin-svelte": "^3.5.1",
|
|
48
48
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
49
49
|
"publint": "^0.3.18",
|
|
50
|
-
"svelte": "^5.55.
|
|
50
|
+
"svelte": "^5.55.2",
|
|
51
51
|
"tailwindcss": "^4.2.2",
|
|
52
52
|
"tsx": "^4.21.0",
|
|
53
53
|
"typescript": "^6.0.2",
|
|
54
|
-
"vite": "^8.0.
|
|
54
|
+
"vite": "^8.0.8",
|
|
55
55
|
"vite-plugin-compression": "^0.5.1"
|
|
56
56
|
}
|
|
57
57
|
}
|