poe-svelte-ui-lib 1.9.20 → 1.9.22
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/CommonSnippets.svelte +15 -0
- package/dist/CommonSnippets.svelte.d.ts +1 -1
- package/dist/Input/InputProps.svelte +3 -0
- package/dist/Modal.svelte +16 -17
- package/dist/ModalStackStore.d.ts +0 -2
- package/dist/ModalStackStore.js +1 -9
- package/dist/Select/SelectProps.svelte +2 -1
- package/dist/Table/Table.svelte +2 -2
- package/dist/TextField/TextField.svelte +1 -1
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
| "EventHandlerArgument"
|
|
34
34
|
| "IconsLib"
|
|
35
35
|
| "Readonly"
|
|
36
|
+
| "BitModeInfo"
|
|
36
37
|
| "MinMaxStep"
|
|
37
38
|
| ""
|
|
38
39
|
|
|
@@ -203,6 +204,18 @@
|
|
|
203
204
|
/>
|
|
204
205
|
{/snippet}
|
|
205
206
|
|
|
207
|
+
{#snippet BitModeInfo()}
|
|
208
|
+
{#if (component.properties as UI.IInputProps).type === "bitMode" || (component.properties as UI.ISelectProps).bitMode || (component.properties as UI.ISwitchProps).bitMode}
|
|
209
|
+
<UI.TextField
|
|
210
|
+
wrapperClass="mt-5 shadow-(--border-shadow-color) bg-(--blue-color)/20"
|
|
211
|
+
content={{
|
|
212
|
+
name: "Выберите битовый диапазон в рамках глобальной переменной для данного компонента.",
|
|
213
|
+
}}
|
|
214
|
+
background
|
|
215
|
+
/>
|
|
216
|
+
{/if}
|
|
217
|
+
{/snippet}
|
|
218
|
+
|
|
206
219
|
{#snippet MinMaxStep(initialValue: {
|
|
207
220
|
number: { minNum: number; maxNum: number; step?: number }
|
|
208
221
|
bitMode?: boolean
|
|
@@ -301,6 +314,8 @@
|
|
|
301
314
|
{@render EventHandlerArgument()}
|
|
302
315
|
{:else if snippet === "Readonly"}
|
|
303
316
|
{@render Readonly()}
|
|
317
|
+
{:else if snippet === "BitModeInfo"}
|
|
318
|
+
{@render BitModeInfo()}
|
|
304
319
|
{:else if snippet === "IconsLib"}
|
|
305
320
|
{@render IconsLib(initialValue)}
|
|
306
321
|
{:else if snippet === "MinMaxStep"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as UI from "./";
|
|
2
|
-
type snippetNames = "Variable" | "Access" | "Colors" | "Label" | "LabelAlign" | "LabelClass" | "Identificator" | "WrapperClass" | "Disabled" | "EventHandlerArgument" | "IconsLib" | "Readonly" | "MinMaxStep" | "";
|
|
2
|
+
type snippetNames = "Variable" | "Access" | "Colors" | "Label" | "LabelAlign" | "LabelClass" | "Identificator" | "WrapperClass" | "Disabled" | "EventHandlerArgument" | "IconsLib" | "Readonly" | "BitModeInfo" | "MinMaxStep" | "";
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
snippet: snippetNames;
|
|
5
5
|
component: UI.UIComponent;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { optionsStore } from "../options"
|
|
7
7
|
import { twMerge } from "tailwind-merge"
|
|
8
8
|
import Library from "../libIcons/Library.svelte"
|
|
9
|
+
import CommonSnippets from "../CommonSnippets.svelte"
|
|
9
10
|
|
|
10
11
|
const {
|
|
11
12
|
component,
|
|
@@ -381,6 +382,7 @@
|
|
|
381
382
|
{@render InputPlaceholder()}
|
|
382
383
|
{@render InputInfo()}
|
|
383
384
|
{@render InputSettings()}
|
|
385
|
+
<CommonSnippets snippet="BitModeInfo" {component} {onPropertyChange} />
|
|
384
386
|
</div>
|
|
385
387
|
<div class="flex w-1/3 flex-col px-2">
|
|
386
388
|
{@render InputLabel()}
|
|
@@ -403,6 +405,7 @@
|
|
|
403
405
|
{@render InputAccess()}
|
|
404
406
|
{@render InputValue()}
|
|
405
407
|
{@render InputType()}
|
|
408
|
+
<CommonSnippets snippet="BitModeInfo" {component} {onPropertyChange} />
|
|
406
409
|
</div>
|
|
407
410
|
<div class="flex w-1/3 flex-col px-2">
|
|
408
411
|
{@render InputPlaceholder()}
|
package/dist/Modal.svelte
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { browser } from "$app/environment"
|
|
3
2
|
import { type Snippet } from "svelte"
|
|
4
3
|
import { fade, scale } from "svelte/transition"
|
|
5
4
|
import { twMerge } from "tailwind-merge"
|
|
@@ -36,29 +35,22 @@
|
|
|
36
35
|
|
|
37
36
|
let isTopmost = $derived($ModalStack.at(-1) === modalId)
|
|
38
37
|
|
|
38
|
+
// Открытие/закрытие модалки + Escape
|
|
39
39
|
$effect(() => {
|
|
40
|
-
if (!browser) return
|
|
41
|
-
|
|
42
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
43
|
-
if (e.key === "Escape" && isTopmost) {
|
|
44
|
-
isOpen = false
|
|
45
|
-
onCancel()
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
40
|
if (isOpen) {
|
|
50
41
|
ModalStack.open(modalId)
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return () => {
|
|
55
|
-
document.removeEventListener("keydown", handleKeyDown)
|
|
42
|
+
} else {
|
|
56
43
|
ModalStack.close(modalId)
|
|
57
44
|
}
|
|
58
45
|
})
|
|
59
46
|
|
|
60
47
|
$effect(() => {
|
|
61
|
-
|
|
48
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
49
|
+
if (e.key === "Escape" && isTopmost) {
|
|
50
|
+
isOpen = false
|
|
51
|
+
onCancel()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
62
54
|
|
|
63
55
|
const handleClickOutside = (e: MouseEvent) => {
|
|
64
56
|
const target = e.target as HTMLElement
|
|
@@ -68,8 +60,15 @@
|
|
|
68
60
|
}
|
|
69
61
|
}
|
|
70
62
|
|
|
63
|
+
if (!isOpen) return
|
|
64
|
+
|
|
65
|
+
document.addEventListener("keydown", handleKeyDown)
|
|
71
66
|
document.addEventListener("mousedown", handleClickOutside)
|
|
72
|
-
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
document.removeEventListener("keydown", handleKeyDown)
|
|
70
|
+
document.removeEventListener("mousedown", handleClickOutside)
|
|
71
|
+
}
|
|
73
72
|
})
|
|
74
73
|
</script>
|
|
75
74
|
|
|
@@ -2,6 +2,4 @@ export declare const ModalStack: {
|
|
|
2
2
|
subscribe: (this: void, run: import("svelte/store").Subscriber<string[]>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
3
3
|
open: (id: string) => void;
|
|
4
4
|
close: (id: string) => void;
|
|
5
|
-
getTopmost: () => string;
|
|
6
|
-
isInStack: (id: string) => boolean;
|
|
7
5
|
};
|
package/dist/ModalStackStore.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writable
|
|
1
|
+
import { writable } from "svelte/store";
|
|
2
2
|
const ModalStore = writable([]);
|
|
3
3
|
export const ModalStack = {
|
|
4
4
|
subscribe: ModalStore.subscribe,
|
|
@@ -8,12 +8,4 @@ export const ModalStack = {
|
|
|
8
8
|
close: (id) => {
|
|
9
9
|
ModalStore.update((state) => state.filter((item) => item !== id));
|
|
10
10
|
},
|
|
11
|
-
getTopmost: () => {
|
|
12
|
-
const state = get(ModalStore);
|
|
13
|
-
return state[state.length - 1];
|
|
14
|
-
},
|
|
15
|
-
isInStack: (id) => {
|
|
16
|
-
const state = get(ModalStore);
|
|
17
|
-
return state.includes(id);
|
|
18
|
-
},
|
|
19
11
|
};
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import ButtonDelete from "../libIcons/ButtonDelete.svelte"
|
|
7
7
|
import ButtonAdd from "../libIcons/ButtonAdd.svelte"
|
|
8
8
|
import { optionsStore } from "../options.js"
|
|
9
|
-
import { twMerge } from "tailwind-merge"
|
|
10
9
|
import CommonSnippets from "../CommonSnippets.svelte"
|
|
11
10
|
|
|
12
11
|
const {
|
|
@@ -265,6 +264,7 @@
|
|
|
265
264
|
<div class="flex w-1/3 flex-col px-2">
|
|
266
265
|
{@render SelectType()}
|
|
267
266
|
{@render SelectValueType()}
|
|
267
|
+
<CommonSnippets snippet="BitModeInfo" {component} {onPropertyChange} />
|
|
268
268
|
</div>
|
|
269
269
|
<div class="flex w-1/3 flex-col px-2">
|
|
270
270
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
@@ -284,6 +284,7 @@
|
|
|
284
284
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
285
285
|
<CommonSnippets snippet="LabelClass" {component} {onPropertyChange} />
|
|
286
286
|
<CommonSnippets snippet="Disabled" {component} {onPropertyChange} />
|
|
287
|
+
<CommonSnippets snippet="BitModeInfo" {component} {onPropertyChange} />
|
|
287
288
|
</div>
|
|
288
289
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
289
290
|
{@render SelectType()}
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
column.label?.class,
|
|
267
267
|
)}
|
|
268
268
|
>
|
|
269
|
-
<span>{column.label?.name}</span>
|
|
269
|
+
<span>{$t(column.label?.name ?? "")}</span>
|
|
270
270
|
|
|
271
271
|
{#if typeof column.content !== "function" && (column.content as ITableContent<any>[])?.some((c) => c.type === "text" && c.data.sortable)}
|
|
272
272
|
<button
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
{/if}
|
|
349
349
|
</span>
|
|
350
350
|
{/if}
|
|
351
|
-
{typeof button.name === "function" ? button.name(row) : button.name}
|
|
351
|
+
{typeof button.name === "function" ? $t(button.name(row)) : $t(button.name ?? "")}
|
|
352
352
|
</button>
|
|
353
353
|
{:else if content.type === "select"}
|
|
354
354
|
{@const select = content.data}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<div
|
|
17
17
|
id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
|
|
18
|
-
class={twMerge(`relative flex w-full flex-col items-center
|
|
18
|
+
class={twMerge(`relative flex w-full flex-col items-center ${background ? "rounded-2xl bg-max px-6 py-2" : ""}`, wrapperClass)}
|
|
19
19
|
>
|
|
20
20
|
<p class={twMerge(`w-full text-center ${textSize[content.size ?? "base"]}`, content.class)}>
|
|
21
21
|
{content.name}
|