poe-svelte-ui-lib 1.6.13 → 1.6.15
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/Table/Table.svelte +62 -41
- package/dist/Table/Table.svelte.d.ts +3 -1
- package/package.json +1 -1
package/dist/Table/Table.svelte
CHANGED
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
let isDropdownOpen: { x: number; y: number } | null = $state(null)
|
|
41
41
|
let copiedCell: { x: number; y: number } | null = $state(null)
|
|
42
42
|
let tooltip = $state({ show: false, text: "", x: 0, y: 0 })
|
|
43
|
+
let isScrollable: boolean = $derived(container ? (container as HTMLElement).scrollHeight > (container as HTMLElement).clientHeight : false)
|
|
44
|
+
|
|
45
|
+
export const clearBuffer = async () => {
|
|
46
|
+
buffer = []
|
|
47
|
+
}
|
|
43
48
|
|
|
44
49
|
/* Сортировка столбцов */
|
|
45
50
|
const sortRows = (key: string) => {
|
|
@@ -147,61 +152,76 @@
|
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
$effect(() => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
;(async () => {
|
|
156
|
+
const currentType = type
|
|
157
|
+
if (currentType === "logger") {
|
|
158
|
+
header = [
|
|
159
|
+
{ key: "color", label: { name: "Type" }, width: "3rem" } as ITableHeader<any>,
|
|
160
|
+
{ key: "data", label: { name: "Data" }, width: "calc(100% - 3rem)" } as ITableHeader<any>,
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
await tick()
|
|
165
|
+
isScrollable = container ? container.scrollHeight > container.clientHeight : false
|
|
166
|
+
return () => (buffer = [])
|
|
167
|
+
})()
|
|
158
168
|
})
|
|
159
169
|
|
|
160
170
|
$effect(() => {
|
|
161
|
-
|
|
162
|
-
if (
|
|
163
|
-
|
|
171
|
+
;(async () => {
|
|
172
|
+
if (body && type == "logger") {
|
|
173
|
+
if (Array.isArray(body)) {
|
|
174
|
+
for (let i = 0; i < body.length; i++) {
|
|
175
|
+
buffer = [
|
|
176
|
+
...buffer,
|
|
177
|
+
{
|
|
178
|
+
type: Object.entries(body[i])[0][1] as string,
|
|
179
|
+
color: `<div class='size-6 rounded-full ${logTypeOptions.find((o) => o.value == Object.entries(body[i])[0][1])?.color}'></div>`,
|
|
180
|
+
data: Object.entries(body[i])[1][1] as string,
|
|
181
|
+
},
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
164
185
|
buffer = [
|
|
165
186
|
...buffer,
|
|
166
187
|
{
|
|
167
|
-
type: Object.entries(body
|
|
168
|
-
color: `<div class='size-6 rounded-full ${logTypeOptions.find((o) => o.value == Object.entries(body
|
|
169
|
-
data: Object.entries(body
|
|
188
|
+
type: Object.entries(body)[0][1] as string,
|
|
189
|
+
color: `<div class='size-6 rounded-full ${logTypeOptions.find((o) => o.value == Object.entries(body)[0][1])?.color}'></div>`,
|
|
190
|
+
data: Object.entries(body)[1][1] as string,
|
|
170
191
|
},
|
|
171
192
|
]
|
|
172
193
|
}
|
|
173
|
-
} else {
|
|
174
|
-
buffer = [
|
|
175
|
-
...buffer,
|
|
176
|
-
{
|
|
177
|
-
type: Object.entries(body)[0][1] as string,
|
|
178
|
-
color: `<div class='size-6 rounded-full ${logTypeOptions.find((o) => o.value == Object.entries(body)[0][1])?.color}'></div>`,
|
|
179
|
-
data: Object.entries(body)[1][1] as string,
|
|
180
|
-
},
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
194
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
195
|
+
if (dataBuffer && buffer.length > (dataBuffer.rowsAmmount ?? 10)) {
|
|
196
|
+
buffer = buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
197
|
+
}
|
|
187
198
|
|
|
188
|
-
|
|
189
|
-
|
|
199
|
+
body = null
|
|
200
|
+
|
|
201
|
+
await tick()
|
|
202
|
+
isScrollable = container ? container.scrollHeight > container.clientHeight : false
|
|
203
|
+
}
|
|
204
|
+
})()
|
|
190
205
|
})
|
|
191
206
|
|
|
192
207
|
$effect(() => {
|
|
193
|
-
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
|
|
208
|
+
;(async () => {
|
|
209
|
+
if (body && dataBuffer.stashData && type == "table") {
|
|
210
|
+
if (Array.isArray(body)) {
|
|
211
|
+
for (let i = 0; i < body.length; i++) {
|
|
212
|
+
buffer = [...buffer, body[i]]
|
|
213
|
+
}
|
|
214
|
+
} else buffer = [...buffer, body]
|
|
215
|
+
if (buffer.length > (dataBuffer.rowsAmmount ?? 10)) {
|
|
216
|
+
buffer = buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
197
217
|
}
|
|
198
|
-
} else buffer = [...buffer, body]
|
|
199
|
-
if (buffer.length > (dataBuffer.rowsAmmount ?? 10)) {
|
|
200
|
-
buffer = buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
201
|
-
}
|
|
202
218
|
|
|
203
|
-
|
|
204
|
-
|
|
219
|
+
body = null
|
|
220
|
+
|
|
221
|
+
await tick()
|
|
222
|
+
isScrollable = container ? container.scrollHeight > container.clientHeight : false
|
|
223
|
+
}
|
|
224
|
+
})()
|
|
205
225
|
})
|
|
206
226
|
|
|
207
227
|
onMount(() => {
|
|
@@ -209,6 +229,7 @@
|
|
|
209
229
|
container?.addEventListener("scroll", handleAutoScroll)
|
|
210
230
|
scrollToBottom()
|
|
211
231
|
}
|
|
232
|
+
isScrollable = container ? container.scrollHeight > container.clientHeight : false
|
|
212
233
|
|
|
213
234
|
if (type === "logger") {
|
|
214
235
|
header = [
|
|
@@ -270,7 +291,7 @@
|
|
|
270
291
|
>
|
|
271
292
|
<!-- Table Header -->
|
|
272
293
|
<div
|
|
273
|
-
class="grid font-semibold {
|
|
294
|
+
class="grid font-semibold {isScrollable ? 'border-r-8 border-(--bg-color)' : ''}"
|
|
274
295
|
style={`grid-template-columns: ${header.map((c) => c.width || "minmax(0, 1fr)").join(" ")};`}
|
|
275
296
|
>
|
|
276
297
|
{#each header as column, index (column)}
|
|
@@ -299,7 +320,7 @@
|
|
|
299
320
|
"absolute right-2 bg-(--back-color) rounded-full p-1 cursor-pointer [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full",
|
|
300
321
|
dataBuffer.clearClass,
|
|
301
322
|
)}
|
|
302
|
-
onclick={
|
|
323
|
+
onclick={clearBuffer}
|
|
303
324
|
>
|
|
304
325
|
<ButtonClear />
|
|
305
326
|
</button>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ITableProps } from "../types";
|
|
2
|
-
declare const Table: import("svelte").Component<ITableProps<any>, {
|
|
2
|
+
declare const Table: import("svelte").Component<ITableProps<any>, {
|
|
3
|
+
clearBuffer: () => Promise<void>;
|
|
4
|
+
}, "body" | "modalData">;
|
|
3
5
|
type Table = ReturnType<typeof Table>;
|
|
4
6
|
export default Table;
|