poe-svelte-ui-lib 1.5.9 → 1.5.11
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 +28 -20
- package/dist/Table/TableProps.svelte +34 -19
- package/dist/libIcons/ButtonClear.svelte +12 -0
- package/dist/libIcons/ButtonClear.svelte.d.ts +18 -0
- package/dist/locales/translations.js +1 -0
- package/dist/options.d.ts +5 -0
- package/dist/options.js +7 -0
- package/dist/types.d.ts +6 -2
- package/package.json +6 -6
package/dist/Table/Table.svelte
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { fade, fly } from 'svelte/transition'
|
|
6
6
|
import { twMerge } from 'tailwind-merge'
|
|
7
7
|
import { onMount } from 'svelte'
|
|
8
|
+
import ButtonClear from '../libIcons/ButtonClear.svelte'
|
|
8
9
|
|
|
9
10
|
let {
|
|
10
11
|
id = crypto.randomUUID(),
|
|
@@ -13,9 +14,8 @@
|
|
|
13
14
|
body = $bindable(),
|
|
14
15
|
header = [],
|
|
15
16
|
footer = '',
|
|
16
|
-
|
|
17
|
+
dataBuffer = { stashData: false, rowsAmmount: 10, clearButton: true, clearClass: '' },
|
|
17
18
|
type = 'table',
|
|
18
|
-
rowsAmmount = 10,
|
|
19
19
|
outline = false,
|
|
20
20
|
cursor = null,
|
|
21
21
|
loader,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
onClick,
|
|
26
26
|
}: ITableProps<any> = $props()
|
|
27
27
|
|
|
28
|
-
let
|
|
28
|
+
let buffer: any[] = $state([])
|
|
29
29
|
|
|
30
30
|
/* Сортировка */
|
|
31
31
|
let sortState: {
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
$effect(() => {
|
|
104
|
-
if (autoscroll &&
|
|
104
|
+
if (autoscroll && buffer && buffer.length > 0) {
|
|
105
105
|
scrollToBottom()
|
|
106
106
|
}
|
|
107
107
|
})
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
|
|
157
157
|
$effect(() => {
|
|
158
158
|
if (body && type == 'logger') {
|
|
159
|
-
|
|
160
|
-
...
|
|
159
|
+
buffer = [
|
|
160
|
+
...buffer,
|
|
161
161
|
{
|
|
162
162
|
type: Object.entries(body)[0][1] as string,
|
|
163
163
|
color: `<div class='size-6 rounded-full ${logTypeOptions.find((o) => o.value == body.logLevel)?.color}'></div>`,
|
|
@@ -165,8 +165,8 @@
|
|
|
165
165
|
},
|
|
166
166
|
]
|
|
167
167
|
|
|
168
|
-
if (dataBuffer.length > rowsAmmount
|
|
169
|
-
|
|
168
|
+
if (dataBuffer && buffer.length > (dataBuffer.rowsAmmount ?? 10)) {
|
|
169
|
+
buffer = buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
body = null
|
|
@@ -174,10 +174,10 @@
|
|
|
174
174
|
})
|
|
175
175
|
|
|
176
176
|
$effect(() => {
|
|
177
|
-
if (body && stashData && type == 'table') {
|
|
178
|
-
|
|
179
|
-
if (
|
|
180
|
-
|
|
177
|
+
if (body && dataBuffer.stashData && type == 'table') {
|
|
178
|
+
buffer = [...buffer, body]
|
|
179
|
+
if (buffer.length > (dataBuffer.rowsAmmount ?? 10)) {
|
|
180
|
+
buffer = buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
body = null
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
]
|
|
202
202
|
}
|
|
203
203
|
return () => {
|
|
204
|
-
|
|
204
|
+
buffer = []
|
|
205
205
|
}
|
|
206
206
|
})
|
|
207
207
|
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
|
|
237
237
|
<div
|
|
238
238
|
id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
|
|
239
|
-
class={twMerge(`bg-blue flex h-full w-full gap-2
|
|
239
|
+
class={twMerge(`bg-blue flex h-full w-full items-center ${type == 'logger' ? 'gap-2' : ''} flex-col overflow-hidden`, wrapperClass)}
|
|
240
240
|
>
|
|
241
241
|
{#if label.name}
|
|
242
242
|
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
{/if}
|
|
279
279
|
|
|
280
280
|
<div
|
|
281
|
-
class="flex h-full w-full flex-col overflow-hidden rounded-xl border shadow-sm transition duration-200 hover:shadow-md {outline
|
|
281
|
+
class="relative flex h-full w-full flex-col overflow-hidden rounded-xl border shadow-sm transition duration-200 hover:shadow-md {outline
|
|
282
282
|
? ' border-(--border-color)'
|
|
283
283
|
: 'border-transparent'} "
|
|
284
284
|
>
|
|
@@ -309,14 +309,22 @@
|
|
|
309
309
|
</div>
|
|
310
310
|
{/each}
|
|
311
311
|
</div>
|
|
312
|
+
{#if dataBuffer.clearButton}
|
|
313
|
+
<button
|
|
314
|
+
class={twMerge('absolute right-2 bg-(--back-color) rounded-full p-1 cursor-pointer', dataBuffer.clearClass)}
|
|
315
|
+
onclick={() => (buffer = [])}
|
|
316
|
+
>
|
|
317
|
+
<ButtonClear />
|
|
318
|
+
</button>
|
|
319
|
+
{/if}
|
|
312
320
|
|
|
313
|
-
{#if body ||
|
|
314
|
-
{@const isSliced =
|
|
321
|
+
{#if body || buffer}
|
|
322
|
+
{@const isSliced = buffer.length - (dataBuffer.rowsAmmount ?? 10) > 0 ? buffer.length - ((dataBuffer.rowsAmmount ?? 10) % 2) !== 0 : false}
|
|
315
323
|
{@const rows =
|
|
316
324
|
type == 'logger'
|
|
317
|
-
?
|
|
318
|
-
: stashData
|
|
319
|
-
?
|
|
325
|
+
? buffer.filter((str) => logType.includes(str.type)).slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
326
|
+
: dataBuffer.stashData
|
|
327
|
+
? buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
320
328
|
: body}
|
|
321
329
|
|
|
322
330
|
<!-- Table Body с прокруткой -->
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
value={$optionsStore.TABLE_TYPE_OPTIONS.find((o) => o.value === component.properties.type)}
|
|
100
100
|
onUpdate={(option) => {
|
|
101
101
|
updateProperty('type', option.value as string, component, onPropertyChange)
|
|
102
|
-
if (option.value === 'logger') updateProperty('stashData', true, component, onPropertyChange)
|
|
102
|
+
if (option.value === 'logger') updateProperty('dataBuffer.stashData', true, component, onPropertyChange)
|
|
103
103
|
}}
|
|
104
104
|
/>
|
|
105
105
|
</div>
|
|
@@ -120,10 +120,10 @@
|
|
|
120
120
|
/>
|
|
121
121
|
<UI.Switch
|
|
122
122
|
label={{ name: $t('constructor.props.table.stashData') }}
|
|
123
|
-
value={component.properties.stashData}
|
|
123
|
+
value={component.properties.dataBuffer.stashData}
|
|
124
124
|
options={[{ id: crypto.randomUUID(), value: 0, class: '', disabled: component.properties.type === 'logger' }]}
|
|
125
125
|
onChange={(value) => {
|
|
126
|
-
updateProperty('stashData', value, component, onPropertyChange)
|
|
126
|
+
updateProperty('dataBuffer.stashData', value, component, onPropertyChange)
|
|
127
127
|
}}
|
|
128
128
|
/>
|
|
129
129
|
</div>
|
|
@@ -144,8 +144,8 @@
|
|
|
144
144
|
<UI.Input
|
|
145
145
|
label={{ name: $t('constructor.props.table.buffersize') }}
|
|
146
146
|
type="number"
|
|
147
|
-
value={component.properties.rowsAmmount}
|
|
148
|
-
onUpdate={(value) => updateProperty('rowsAmmount', value as string, component, onPropertyChange)}
|
|
147
|
+
value={component.properties.dataBuffer.rowsAmmount}
|
|
148
|
+
onUpdate={(value) => updateProperty('dataBuffer.rowsAmmount', value as string, component, onPropertyChange)}
|
|
149
149
|
/>
|
|
150
150
|
{/if}
|
|
151
151
|
</div>
|
|
@@ -373,23 +373,38 @@
|
|
|
373
373
|
value={$optionsStore.TABLE_TYPE_OPTIONS.find((o) => o.value === component.properties.type)}
|
|
374
374
|
onUpdate={(option) => {
|
|
375
375
|
updateProperty('type', option.value as string, component, onPropertyChange)
|
|
376
|
-
if (option.value === 'logger') updateProperty('stashData', true, component, onPropertyChange)
|
|
376
|
+
if (option.value === 'logger') updateProperty('dataBuffer.stashData', true, component, onPropertyChange)
|
|
377
|
+
if (option.value === 'table') updateProperty('dataBuffer.clearButton', false, component, onPropertyChange)
|
|
377
378
|
}}
|
|
378
379
|
/>
|
|
379
|
-
<
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
380
|
+
<div class="flex">
|
|
381
|
+
<UI.Switch
|
|
382
|
+
label={{ name: $t('constructor.props.table.stashData') }}
|
|
383
|
+
value={component.properties.dataBuffer.stashData}
|
|
384
|
+
options={[{ id: crypto.randomUUID(), value: 0, class: '', disabled: component.properties.type === 'logger' }]}
|
|
385
|
+
onChange={(value) => {
|
|
386
|
+
updateProperty('dataBuffer.stashData', value, component, onPropertyChange)
|
|
387
|
+
}}
|
|
388
|
+
/>
|
|
389
|
+
{#if component.properties.type === 'logger'}
|
|
390
|
+
<UI.Switch
|
|
391
|
+
label={{ name: $t('constructor.props.table.clearButton') }}
|
|
392
|
+
value={component.properties.dataBuffer.clearButton}
|
|
393
|
+
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
394
|
+
onChange={(value) => {
|
|
395
|
+
updateProperty('dataBuffer.clearButton', value, component, onPropertyChange)
|
|
396
|
+
}}
|
|
397
|
+
/>
|
|
398
|
+
{/if}
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
{#if component.properties.dataBuffer.stashData}
|
|
402
|
+
<UI.Select
|
|
389
403
|
label={{ name: $t('constructor.props.table.buffersize') }}
|
|
390
|
-
type="
|
|
391
|
-
|
|
392
|
-
|
|
404
|
+
type="buttons"
|
|
405
|
+
options={$optionsStore.BUFFER_SIFE_OPTIONS}
|
|
406
|
+
value={$optionsStore.BUFFER_SIFE_OPTIONS.find((o) => o.value === component.properties.dataBuffer.rowsAmmount)}
|
|
407
|
+
onUpdate={(value) => updateProperty('dataBuffer.rowsAmmount', value.value as number, component, onPropertyChange)}
|
|
393
408
|
/>
|
|
394
409
|
{/if}
|
|
395
410
|
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 24 24"
|
|
4
|
+
><g fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="1.5"
|
|
5
|
+
><path
|
|
6
|
+
stroke-linecap="round"
|
|
7
|
+
d="m12 13l3 2m-3-2c-4.48 2.746-7.118 1.78-9 .85c0 2.08.681 3.82 1.696 5.15M12 13l3-4.586M15 15c-.219 2.037-1.573 6.185-4.844 7c-1.815 0-3.988-1.07-5.46-3M15 15l2.598-5m0 0l3.278-6.31a1.166 1.166 0 0 0-.524-1.567a1.174 1.174 0 0 0-1.544.47L15 8.414M17.598 10L15 8.414M4.696 19c1.038.167 3.584.2 5.46-1"
|
|
8
|
+
/><path
|
|
9
|
+
d="m6 4l.221.597c.29.784.435 1.176.72 1.461c.286.286.678.431 1.462.72L9 7l-.597.221c-.784.29-1.176.435-1.461.72c-.286.286-.431.678-.72 1.462L6 10l-.221-.597c-.29-.784-.435-1.176-.72-1.461c-.286-.286-.678-.431-1.462-.72L3 7l.597-.221c.784-.29 1.176-.435 1.461-.72c.286-.286.431-.678.72-1.462z"
|
|
10
|
+
/></g
|
|
11
|
+
></svg
|
|
12
|
+
>
|
|
@@ -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 ButtonClear: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ButtonClear = InstanceType<typeof ButtonClear>;
|
|
18
|
+
export default ButtonClear;
|
|
@@ -153,6 +153,7 @@ const translations = {
|
|
|
153
153
|
'constructor.props.table.keys.info': 'Ключи таблицы, значения которых будут возвращаться',
|
|
154
154
|
'constructor.props.table.stashData': 'Накопление данных',
|
|
155
155
|
'constructor.props.table.buffersize': 'Размер буфера',
|
|
156
|
+
'constructor.props.table.clearButton': 'Кнопка очистки',
|
|
156
157
|
'constructor.props.icon.access': 'Доступ',
|
|
157
158
|
'constructor.props.icon.common': 'Общее',
|
|
158
159
|
'constructor.props.icon.scenarios': 'Сценарии',
|
package/dist/options.d.ts
CHANGED
|
@@ -120,6 +120,11 @@ export declare const optionsStore: import("svelte/store").Readable<{
|
|
|
120
120
|
value: string;
|
|
121
121
|
name: string;
|
|
122
122
|
}[];
|
|
123
|
+
BUFFER_SIFE_OPTIONS: {
|
|
124
|
+
id: `${string}-${string}-${string}-${string}-${string}`;
|
|
125
|
+
value: number;
|
|
126
|
+
name: string;
|
|
127
|
+
}[];
|
|
123
128
|
AUTOCOMPLETE_CONSTRUCTOR_OPTIONS: {
|
|
124
129
|
id: string;
|
|
125
130
|
value: string;
|
package/dist/options.js
CHANGED
|
@@ -128,6 +128,13 @@ export const optionsStore = derived(t, ($t) => {
|
|
|
128
128
|
{ id: id(), value: 'table', name: $t('constructor.props.table.type.table') },
|
|
129
129
|
{ id: id(), value: 'logger', name: $t('constructor.props.table.type.logger') },
|
|
130
130
|
],
|
|
131
|
+
BUFFER_SIFE_OPTIONS: [
|
|
132
|
+
{ id: crypto.randomUUID(), value: 10, name: '10' },
|
|
133
|
+
{ id: crypto.randomUUID(), value: 50, name: '50' },
|
|
134
|
+
{ id: crypto.randomUUID(), value: 100, name: '100' },
|
|
135
|
+
{ id: crypto.randomUUID(), value: 500, name: '500' },
|
|
136
|
+
{ id: crypto.randomUUID(), value: 1000, name: '1000' },
|
|
137
|
+
],
|
|
131
138
|
AUTOCOMPLETE_CONSTRUCTOR_OPTIONS: [
|
|
132
139
|
{ id: id(), value: 'on', name: $t('constructor.props.autocomplete.on') },
|
|
133
140
|
{ id: id(), value: 'off', name: $t('constructor.props.autocomplete.off') },
|
package/dist/types.d.ts
CHANGED
|
@@ -267,8 +267,12 @@ export interface ITableProps<T extends object> {
|
|
|
267
267
|
body: T[] | T | null;
|
|
268
268
|
footer?: string;
|
|
269
269
|
type?: 'table' | 'logger';
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
dataBuffer?: {
|
|
271
|
+
stashData?: boolean;
|
|
272
|
+
rowsAmmount?: number;
|
|
273
|
+
clearButton?: boolean;
|
|
274
|
+
clearClass?: string;
|
|
275
|
+
};
|
|
272
276
|
outline?: boolean;
|
|
273
277
|
cursor?: string | null;
|
|
274
278
|
loader?: Writable<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-svelte-ui-lib",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"svelte": "^5.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tailwindcss/vite": "^4.1.
|
|
36
|
-
"prettier": "^3.
|
|
35
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
36
|
+
"prettier": "^3.7.4",
|
|
37
37
|
"prettier-plugin-svelte": "^3.4.0",
|
|
38
38
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
39
39
|
"svelte-maplibre-gl": "^1.0.2",
|
|
40
40
|
"tailwind-merge": "^3.4.0",
|
|
41
|
-
"tailwindcss": "^4.1.
|
|
41
|
+
"tailwindcss": "^4.1.18",
|
|
42
42
|
"tsx": "^4.21.0",
|
|
43
43
|
"typescript": "^5.9.3"
|
|
44
44
|
},
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"@sveltejs/kit": "^2.49.2",
|
|
48
48
|
"@sveltejs/package": "^2.5.7",
|
|
49
49
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
50
|
-
"@types/node": "^
|
|
50
|
+
"@types/node": "^25.0.1",
|
|
51
51
|
"publint": "^0.3.16",
|
|
52
|
-
"svelte": "^5.45.
|
|
52
|
+
"svelte": "^5.45.10",
|
|
53
53
|
"svelte-preprocess": "^6.0.3",
|
|
54
54
|
"vite": "^7.2.7",
|
|
55
55
|
"vite-plugin-compression": "^0.5.1"
|