poe-svelte-ui-lib 1.6.6 → 1.6.7
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/Carousel/Carousel.svelte +3 -3
- package/dist/Table/Table.svelte +23 -71
- package/package.json +3 -3
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
{#if !isAtStart}
|
|
48
48
|
<button
|
|
49
49
|
transition:slide={{ axis: "x" }}
|
|
50
|
-
class="absolute z-10 size-10 translate-y-1/2 cursor-pointer left-1 p-2 rounded-full bg-(--field-color) [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full shadow-[0_0_6px_var(--shadow-color)] rotate-180"
|
|
50
|
+
class="absolute z-10 size-10 -translate-y-1/2 cursor-pointer top-1/2 left-1 p-2 rounded-full bg-(--field-color) [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full shadow-[0_0_6px_var(--shadow-color)] rotate-180"
|
|
51
51
|
onclick={() => scrollCarousel(-scrollValue)}>
|
|
52
52
|
<ArrowIcon />
|
|
53
53
|
</button>
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
{#if !isAtEnd}
|
|
56
56
|
<button
|
|
57
57
|
transition:slide={{ axis: "x" }}
|
|
58
|
-
class="absolute z-10 size-10 translate-y-1/2 cursor-pointer right-1 p-2 rounded-full bg-(--field-color) [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full shadow-[0_0_6px_var(--shadow-color)]"
|
|
58
|
+
class="absolute z-10 size-10 -translate-y-1/2 cursor-pointer top-1/2 right-1 p-2 rounded-full bg-(--field-color) [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full shadow-[0_0_6px_var(--shadow-color)]"
|
|
59
59
|
onclick={() => scrollCarousel(scrollValue)}>
|
|
60
60
|
<ArrowIcon />
|
|
61
61
|
</button>
|
|
62
62
|
{/if}
|
|
63
63
|
|
|
64
|
-
<div {id} bind:this={carouselRef} class="flex overflow-
|
|
64
|
+
<div {id} bind:this={carouselRef} class="flex overflow-hidden gap-2 p-2">
|
|
65
65
|
{@render children?.()}
|
|
66
66
|
</div>
|
|
67
67
|
</div>
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -32,13 +32,7 @@
|
|
|
32
32
|
buffer = []
|
|
33
33
|
}
|
|
34
34
|
/* Сортировка */
|
|
35
|
-
let sortState: {
|
|
36
|
-
key: string | null
|
|
37
|
-
direction: "asc" | "desc" | null
|
|
38
|
-
} = {
|
|
39
|
-
key: null,
|
|
40
|
-
direction: null,
|
|
41
|
-
}
|
|
35
|
+
let sortState: { key: string | null; direction: "asc" | "desc" | null } = { key: null, direction: null }
|
|
42
36
|
|
|
43
37
|
let isAutoscroll = $state(false)
|
|
44
38
|
|
|
@@ -73,9 +67,7 @@
|
|
|
73
67
|
const numB = strB.match(/\d+/g)?.[0] || ""
|
|
74
68
|
if (numA && numB) {
|
|
75
69
|
const numCompare = parseInt(numA, 10) - parseInt(numB, 10)
|
|
76
|
-
if (numCompare !== 0)
|
|
77
|
-
return sortState.direction === "asc" ? numCompare : -numCompare
|
|
78
|
-
}
|
|
70
|
+
if (numCompare !== 0) return sortState.direction === "asc" ? numCompare : -numCompare
|
|
79
71
|
}
|
|
80
72
|
const stringCompare = strA.localeCompare(strB)
|
|
81
73
|
return sortState.direction === "asc" ? stringCompare : -stringCompare
|
|
@@ -95,19 +87,14 @@
|
|
|
95
87
|
/* Обработчик автоскролла */
|
|
96
88
|
const handleAutoScroll = () => {
|
|
97
89
|
if (!container) return
|
|
98
|
-
|
|
99
90
|
isAutoscroll = !(container.scrollHeight - container.scrollTop <= container.clientHeight + 50)
|
|
100
91
|
}
|
|
101
92
|
const scrollToBottom = () => {
|
|
102
|
-
if (!isAutoscroll && container)
|
|
103
|
-
container.scrollTop = container.scrollHeight
|
|
104
|
-
}
|
|
93
|
+
if (!isAutoscroll && container) container.scrollTop = container.scrollHeight
|
|
105
94
|
}
|
|
106
95
|
|
|
107
96
|
$effect(() => {
|
|
108
|
-
if (autoscroll && buffer && buffer.length > 0)
|
|
109
|
-
scrollToBottom()
|
|
110
|
-
}
|
|
97
|
+
if (autoscroll && buffer && buffer.length > 0) scrollToBottom()
|
|
111
98
|
})
|
|
112
99
|
|
|
113
100
|
function buttonClick(row: any, button: any) {
|
|
@@ -115,41 +102,27 @@
|
|
|
115
102
|
else if (button.eventHandler && onClick) {
|
|
116
103
|
let value: Record<string, boolean | string | number | number[] | object | null> = {}
|
|
117
104
|
button.eventHandler.Variables.forEach((v: string) => {
|
|
118
|
-
if (header.some(h => h.key === v && h.action?.type === "select"))
|
|
119
|
-
|
|
120
|
-
} else {
|
|
121
|
-
value[v] = row[v]
|
|
122
|
-
}
|
|
123
|
-
button.eventHandler.Value = JSON.stringify(value)
|
|
124
|
-
onClick(button.eventHandler)
|
|
105
|
+
if (header.some(h => h.key === v && h.action?.type === "select")) value[v] = row[v][0]
|
|
106
|
+
else value[v] = row[v]
|
|
125
107
|
})
|
|
108
|
+
button.eventHandler.Value = JSON.stringify(value)
|
|
109
|
+
onClick(button.eventHandler)
|
|
126
110
|
}
|
|
127
111
|
}
|
|
128
112
|
|
|
129
113
|
let isDropdownOpen: number | null = $state(null)
|
|
130
|
-
let changedOptions: { index: number; options: ISelectOption<string | number>[] | null }[] = $state([])
|
|
131
114
|
|
|
132
|
-
const selectOption = (index: number,
|
|
115
|
+
const selectOption = (index: number, key: any, option: ISelectOption<string | number>, event: MouseEvent) => {
|
|
133
116
|
event.stopPropagation()
|
|
134
117
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (existingItem) {
|
|
138
|
-
existingItem.options = [option, ...options.filter(opt => opt.id !== option.id)]
|
|
139
|
-
} else {
|
|
140
|
-
changedOptions = [...changedOptions, { index, options: [option, ...options.filter(opt => opt.id !== option.id)] }]
|
|
141
|
-
}
|
|
142
|
-
|
|
118
|
+
let existingItem = body[index][key]
|
|
143
119
|
isDropdownOpen = null
|
|
120
|
+
|
|
121
|
+
if (existingItem) body[index][key] = [option.value, ...existingItem.filter((opt: string | number) => opt !== option.value)]
|
|
144
122
|
}
|
|
145
123
|
|
|
146
124
|
let copiedCell = $state({ x: "", y: -1 })
|
|
147
|
-
let tooltip = $state({
|
|
148
|
-
show: false,
|
|
149
|
-
text: "",
|
|
150
|
-
x: 0,
|
|
151
|
-
y: 0,
|
|
152
|
-
})
|
|
125
|
+
let tooltip = $state({ show: false, text: "", x: 0, y: 0 })
|
|
153
126
|
|
|
154
127
|
const showModal = async (text: string, formatting?: (text: string) => string) => {
|
|
155
128
|
modalData = {
|
|
@@ -183,21 +156,11 @@
|
|
|
183
156
|
const currentType = type
|
|
184
157
|
if (currentType === "logger") {
|
|
185
158
|
header = [
|
|
186
|
-
{
|
|
187
|
-
|
|
188
|
-
label: { name: "Type" },
|
|
189
|
-
width: "3rem",
|
|
190
|
-
} as ITableHeader<any>,
|
|
191
|
-
{
|
|
192
|
-
key: "data",
|
|
193
|
-
label: { name: "Data" },
|
|
194
|
-
width: "calc(100% - 3rem)",
|
|
195
|
-
} as ITableHeader<any>,
|
|
159
|
+
{ key: "color", label: { name: "Type" }, width: "3rem" } as ITableHeader<any>,
|
|
160
|
+
{ key: "data", label: { name: "Data" }, width: "calc(100% - 3rem)" } as ITableHeader<any>,
|
|
196
161
|
]
|
|
197
162
|
}
|
|
198
|
-
return () =>
|
|
199
|
-
buffer = []
|
|
200
|
-
}
|
|
163
|
+
return () => (buffer = [])
|
|
201
164
|
})
|
|
202
165
|
|
|
203
166
|
$effect(() => {
|
|
@@ -255,23 +218,13 @@
|
|
|
255
218
|
|
|
256
219
|
if (type === "logger") {
|
|
257
220
|
header = [
|
|
258
|
-
{
|
|
259
|
-
|
|
260
|
-
label: { name: "Type" },
|
|
261
|
-
width: "3rem",
|
|
262
|
-
} as ITableHeader<any>,
|
|
263
|
-
{
|
|
264
|
-
key: "data",
|
|
265
|
-
label: { name: "Data" },
|
|
266
|
-
width: "calc(100% - 3rem)",
|
|
267
|
-
} as ITableHeader<any>,
|
|
221
|
+
{ key: "color", label: { name: "Type" }, width: "3rem" } as ITableHeader<any>,
|
|
222
|
+
{ key: "data", label: { name: "Data" }, width: "calc(100% - 3rem)" } as ITableHeader<any>,
|
|
268
223
|
]
|
|
269
224
|
}
|
|
270
225
|
|
|
271
226
|
return () => {
|
|
272
|
-
if (autoscroll)
|
|
273
|
-
container?.removeEventListener("scroll", handleAutoScroll)
|
|
274
|
-
}
|
|
227
|
+
if (autoscroll) container?.removeEventListener("scroll", handleAutoScroll)
|
|
275
228
|
}
|
|
276
229
|
})
|
|
277
230
|
</script>
|
|
@@ -356,7 +309,7 @@
|
|
|
356
309
|
{/if}
|
|
357
310
|
|
|
358
311
|
{#if body || buffer}
|
|
359
|
-
{@const isSliced = buffer.length - (dataBuffer.rowsAmmount ?? 10) > 0 ? buffer.length - ((dataBuffer.rowsAmmount ?? 10) % 2) !== 0 : false}
|
|
312
|
+
<!-- {@const isSliced = buffer.length - (dataBuffer.rowsAmmount ?? 10) > 0 ? buffer.length - ((dataBuffer.rowsAmmount ?? 10) % 2) !== 0 : false} -->
|
|
360
313
|
{@const rows =
|
|
361
314
|
type == "logger"
|
|
362
315
|
? buffer.filter(str => logType.includes(str.type)).slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
@@ -392,8 +345,7 @@
|
|
|
392
345
|
{/each}
|
|
393
346
|
</div>
|
|
394
347
|
{:else if column.action?.type == "select" && column.action?.select}
|
|
395
|
-
{@const
|
|
396
|
-
{@const defaultOptions = Array.isArray(row[column.key])
|
|
348
|
+
{@const options = Array.isArray(row[column.key])
|
|
397
349
|
? row[column.key].map((option: string | number) => ({
|
|
398
350
|
id: crypto.randomUUID(),
|
|
399
351
|
value: option,
|
|
@@ -402,7 +354,7 @@
|
|
|
402
354
|
disabled: false,
|
|
403
355
|
}))
|
|
404
356
|
: []}
|
|
405
|
-
|
|
357
|
+
|
|
406
358
|
<div class="relative w-full">
|
|
407
359
|
<button
|
|
408
360
|
class={`w-full rounded-2xl border border-(--blue-color) bg-(--back-color) p-1 text-center shadow-[0_0_3px_rgb(0_0_0_/0.25)] transition duration-200
|
|
@@ -425,7 +377,7 @@
|
|
|
425
377
|
${option_index === options.length - 1 ? "rounded-b-2xl" : ""} `,
|
|
426
378
|
option.class,
|
|
427
379
|
)}
|
|
428
|
-
onclick={e => selectOption(index,
|
|
380
|
+
onclick={e => selectOption(index, column.key, option, e)}>
|
|
429
381
|
{option.name}
|
|
430
382
|
</button>
|
|
431
383
|
{/each}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-svelte-ui-lib",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
47
47
|
"@sveltejs/kit": "^2.49.3",
|
|
48
48
|
"@sveltejs/package": "^2.5.7",
|
|
49
|
-
"@sveltejs/vite-plugin-svelte": "^6.2.
|
|
49
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.3",
|
|
50
50
|
"@types/node": "^25.0.3",
|
|
51
51
|
"publint": "^0.3.16",
|
|
52
52
|
"svelte": "^5.46.1",
|
|
53
53
|
"svelte-preprocess": "^6.0.3",
|
|
54
|
-
"vite": "^7.3.
|
|
54
|
+
"vite": "^7.3.1",
|
|
55
55
|
"vite-plugin-compression": "^0.5.1"
|
|
56
56
|
}
|
|
57
57
|
}
|