poe-svelte-ui-lib 1.5.13 → 1.5.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/Button/ButtonProps.svelte +0 -1
- package/dist/Table/Table.svelte +42 -31
- package/dist/Table/TableProps.svelte +131 -26
- package/package.json +6 -6
package/dist/Table/Table.svelte
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
body = $bindable(),
|
|
15
15
|
header = [],
|
|
16
16
|
footer = '',
|
|
17
|
-
dataBuffer = { stashData: false, rowsAmmount: 10, clearButton:
|
|
17
|
+
dataBuffer = { stashData: false, rowsAmmount: 10, clearButton: false, clearClass: '' },
|
|
18
18
|
type = 'table',
|
|
19
19
|
outline = false,
|
|
20
20
|
cursor = null,
|
|
@@ -155,15 +155,49 @@
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
$effect(() => {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
const currentType = type
|
|
159
|
+
if (currentType === 'logger') {
|
|
160
|
+
header = [
|
|
161
|
+
{
|
|
162
|
+
key: 'color',
|
|
163
|
+
label: { name: 'Type' },
|
|
164
|
+
width: '3rem',
|
|
165
|
+
} as ITableHeader<any>,
|
|
161
166
|
{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
167
|
+
key: 'data',
|
|
168
|
+
label: { name: 'Data' },
|
|
169
|
+
width: 'calc(100% - 3rem)',
|
|
170
|
+
} as ITableHeader<any>,
|
|
166
171
|
]
|
|
172
|
+
}
|
|
173
|
+
return () => {
|
|
174
|
+
buffer = []
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
$effect(() => {
|
|
179
|
+
if (body && type == 'logger') {
|
|
180
|
+
if (Array.isArray(body)) {
|
|
181
|
+
for (let i = 0; i < body.length; i++) {
|
|
182
|
+
buffer = [
|
|
183
|
+
...buffer,
|
|
184
|
+
{
|
|
185
|
+
type: Object.entries(body[i])[0][1] as string,
|
|
186
|
+
color: `<div class='size-6 rounded-full ${logTypeOptions.find((o) => o.value == Object.entries(body[i])[0][1])?.color}'></div>`,
|
|
187
|
+
data: Object.entries(body[i])[1][1] as string,
|
|
188
|
+
},
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
buffer = [
|
|
193
|
+
...buffer,
|
|
194
|
+
{
|
|
195
|
+
type: Object.entries(body)[0][1] as string,
|
|
196
|
+
color: `<div class='size-6 rounded-full ${logTypeOptions.find((o) => o.value == Object.entries(body)[0][1])?.color}'></div>`,
|
|
197
|
+
data: Object.entries(body)[1][1] as string,
|
|
198
|
+
},
|
|
199
|
+
]
|
|
200
|
+
}
|
|
167
201
|
|
|
168
202
|
if (dataBuffer && buffer.length > (dataBuffer.rowsAmmount ?? 10)) {
|
|
169
203
|
buffer = buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
@@ -184,27 +218,6 @@
|
|
|
184
218
|
}
|
|
185
219
|
})
|
|
186
220
|
|
|
187
|
-
$effect(() => {
|
|
188
|
-
const currentType = type
|
|
189
|
-
if (currentType === 'logger') {
|
|
190
|
-
header = [
|
|
191
|
-
{
|
|
192
|
-
key: 'color',
|
|
193
|
-
label: { name: 'Type' },
|
|
194
|
-
width: '3rem',
|
|
195
|
-
} as ITableHeader<any>,
|
|
196
|
-
{
|
|
197
|
-
key: 'data',
|
|
198
|
-
label: { name: 'Data' },
|
|
199
|
-
width: 'calc(100% - 3rem)',
|
|
200
|
-
} as ITableHeader<any>,
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
return () => {
|
|
204
|
-
buffer = []
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
|
|
208
221
|
onMount(() => {
|
|
209
222
|
if (autoscroll) {
|
|
210
223
|
container?.addEventListener('scroll', handleAutoScroll)
|
|
@@ -326,7 +339,6 @@
|
|
|
326
339
|
: dataBuffer.stashData
|
|
327
340
|
? buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
328
341
|
: body}
|
|
329
|
-
|
|
330
342
|
<!-- Table Body с прокруткой -->
|
|
331
343
|
<div class="flex-1 overflow-y-auto bg-(--container-color)/50" bind:this={container} onscroll={handleScroll}>
|
|
332
344
|
<div class="grid min-w-0" style={`grid-template-columns: ${header.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
|
|
@@ -460,7 +472,6 @@
|
|
|
460
472
|
{@html tooltip.text}
|
|
461
473
|
</div>
|
|
462
474
|
{/if}
|
|
463
|
-
|
|
464
475
|
<!-- Нижнее поле для сводной информации -->
|
|
465
476
|
{#if footer}
|
|
466
477
|
<div class="flex h-8 items-center justify-center bg-(--bg-color)">
|
|
@@ -44,15 +44,34 @@
|
|
|
44
44
|
updateProperty('header', headers, component, onPropertyChange)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const updateTableBody = () => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
const updateTableBody = (typeChange?: boolean, loggerType?: boolean) => {
|
|
48
|
+
let newBody
|
|
49
|
+
|
|
50
|
+
if (typeChange) {
|
|
51
|
+
newBody = []
|
|
52
|
+
if (loggerType) {
|
|
53
|
+
newBody.push({ loglevel: 'error', payload: 'error log' })
|
|
54
|
+
newBody.push({ loglevel: 'warning', payload: 'warning log' })
|
|
55
|
+
newBody.push({ loglevel: 'info', payload: 'info log' })
|
|
56
|
+
} else {
|
|
57
|
+
const newRow: { [key: string]: any } = {}
|
|
58
|
+
component.properties.header.forEach((col: ITableHeader<any>) => {
|
|
59
|
+
const key = col.key as string
|
|
60
|
+
newRow[key] = `Value of ${key}`
|
|
61
|
+
})
|
|
62
|
+
newBody.push(newRow)
|
|
63
|
+
newBody.push(newRow)
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
newBody = component.properties.body.map((row: object) => {
|
|
67
|
+
const newRow: Partial<object> = {}
|
|
68
|
+
component.properties.header.forEach((col: ITableHeader<any>) => {
|
|
69
|
+
const key = col.key as keyof object
|
|
70
|
+
newRow[key] = row[key] ?? `Value of ${key}`
|
|
71
|
+
})
|
|
72
|
+
return newRow
|
|
53
73
|
})
|
|
54
|
-
|
|
55
|
-
})
|
|
74
|
+
}
|
|
56
75
|
updateProperty('body', newBody, component, onPropertyChange)
|
|
57
76
|
}
|
|
58
77
|
|
|
@@ -98,10 +117,58 @@
|
|
|
98
117
|
options={$optionsStore.TABLE_TYPE_OPTIONS}
|
|
99
118
|
value={$optionsStore.TABLE_TYPE_OPTIONS.find((o) => o.value === component.properties.type)}
|
|
100
119
|
onUpdate={(option) => {
|
|
120
|
+
if (option.value === 'logger') {
|
|
121
|
+
updateProperty('dataBuffer.stashData', true, component, onPropertyChange)
|
|
122
|
+
updateProperty('dataBuffer.clearButton', true, component, onPropertyChange)
|
|
123
|
+
|
|
124
|
+
const headers = [
|
|
125
|
+
{
|
|
126
|
+
key: 'color',
|
|
127
|
+
label: { name: 'Type' },
|
|
128
|
+
width: '3rem',
|
|
129
|
+
} as ITableHeader<any>,
|
|
130
|
+
{
|
|
131
|
+
key: 'data',
|
|
132
|
+
label: { name: 'Data' },
|
|
133
|
+
width: 'calc(100% - 3rem)',
|
|
134
|
+
} as ITableHeader<any>,
|
|
135
|
+
]
|
|
136
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
137
|
+
updateTableBody(true, true)
|
|
138
|
+
} else {
|
|
139
|
+
updateProperty('dataBuffer.stashData', false, component, onPropertyChange)
|
|
140
|
+
updateProperty('dataBuffer.clearButton', false, component, onPropertyChange)
|
|
141
|
+
const headers = [
|
|
142
|
+
{
|
|
143
|
+
key: 'id',
|
|
144
|
+
label: { name: 'ID' },
|
|
145
|
+
width: '40%',
|
|
146
|
+
sortable: true,
|
|
147
|
+
image: {
|
|
148
|
+
width: '0rem',
|
|
149
|
+
height: '0rem',
|
|
150
|
+
},
|
|
151
|
+
align: 'left',
|
|
152
|
+
} as ITableHeader<any>,
|
|
153
|
+
{
|
|
154
|
+
key: 'device',
|
|
155
|
+
label: { name: 'Device' },
|
|
156
|
+
width: '60%',
|
|
157
|
+
sortable: false,
|
|
158
|
+
image: {
|
|
159
|
+
width: '0rem',
|
|
160
|
+
height: '0rem',
|
|
161
|
+
},
|
|
162
|
+
align: 'left',
|
|
163
|
+
overflow: {
|
|
164
|
+
truncated: true,
|
|
165
|
+
},
|
|
166
|
+
} as ITableHeader<any>,
|
|
167
|
+
]
|
|
168
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
169
|
+
updateTableBody(true, false)
|
|
170
|
+
}
|
|
101
171
|
updateProperty('type', option.value as string, component, onPropertyChange)
|
|
102
|
-
if (option.value === 'logger') updateProperty('dataBuffer.stashData', true, component, onPropertyChange)
|
|
103
|
-
if (option.value === 'logger') updateProperty('dataBuffer.clearButton', true, component, onPropertyChange)
|
|
104
|
-
if (option.value === 'table') updateProperty('dataBuffer.clearButton', false, component, onPropertyChange)
|
|
105
172
|
}}
|
|
106
173
|
/>
|
|
107
174
|
</div>
|
|
@@ -120,14 +187,6 @@
|
|
|
120
187
|
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
121
188
|
onChange={(value) => updateProperty('outline', value, component, onPropertyChange)}
|
|
122
189
|
/>
|
|
123
|
-
<UI.Switch
|
|
124
|
-
label={{ name: $t('constructor.props.table.stashData') }}
|
|
125
|
-
value={component.properties.dataBuffer.stashData}
|
|
126
|
-
options={[{ id: crypto.randomUUID(), value: 0, class: '', disabled: component.properties.type === 'logger' }]}
|
|
127
|
-
onChange={(value) => {
|
|
128
|
-
updateProperty('dataBuffer.stashData', value, component, onPropertyChange)
|
|
129
|
-
}}
|
|
130
|
-
/>
|
|
131
190
|
</div>
|
|
132
191
|
<div class="flex w-1/3 flex-col px-2">
|
|
133
192
|
<UI.Input
|
|
@@ -143,11 +202,12 @@
|
|
|
143
202
|
onUpdate={(option) => updateProperty('label.class', twMerge(component.properties.label.class, option.value), component, onPropertyChange)}
|
|
144
203
|
/>
|
|
145
204
|
{#if component.properties.dataBuffer.stashData}
|
|
146
|
-
<UI.
|
|
205
|
+
<UI.Select
|
|
147
206
|
label={{ name: $t('constructor.props.table.buffersize') }}
|
|
148
|
-
type="
|
|
149
|
-
|
|
150
|
-
|
|
207
|
+
type="buttons"
|
|
208
|
+
options={$optionsStore.BUFFER_SIFE_OPTIONS}
|
|
209
|
+
value={$optionsStore.BUFFER_SIFE_OPTIONS.find((o) => o.value === component.properties.dataBuffer.rowsAmmount)}
|
|
210
|
+
onUpdate={(value) => updateProperty('dataBuffer.rowsAmmount', value.value as number, component, onPropertyChange)}
|
|
151
211
|
/>
|
|
152
212
|
{/if}
|
|
153
213
|
</div>
|
|
@@ -376,8 +436,54 @@
|
|
|
376
436
|
value={$optionsStore.TABLE_TYPE_OPTIONS.find((o) => o.value === component.properties.type)}
|
|
377
437
|
onUpdate={(option) => {
|
|
378
438
|
updateProperty('type', option.value as string, component, onPropertyChange)
|
|
379
|
-
if (option.value === 'logger')
|
|
380
|
-
|
|
439
|
+
if (option.value === 'logger') {
|
|
440
|
+
updateProperty('dataBuffer.stashData', true, component, onPropertyChange)
|
|
441
|
+
updateProperty('dataBuffer.clearButton', true, component, onPropertyChange)
|
|
442
|
+
|
|
443
|
+
const headers = [
|
|
444
|
+
{
|
|
445
|
+
key: 'color',
|
|
446
|
+
label: { name: 'Type' },
|
|
447
|
+
width: '3rem',
|
|
448
|
+
} as ITableHeader<any>,
|
|
449
|
+
{
|
|
450
|
+
key: 'data',
|
|
451
|
+
label: { name: 'Data' },
|
|
452
|
+
width: 'calc(100% - 3rem)',
|
|
453
|
+
} as ITableHeader<any>,
|
|
454
|
+
]
|
|
455
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
456
|
+
} else {
|
|
457
|
+
updateProperty('dataBuffer.clearButton', false, component, onPropertyChange)
|
|
458
|
+
const headers = [
|
|
459
|
+
{
|
|
460
|
+
key: 'id',
|
|
461
|
+
label: { name: 'ID' },
|
|
462
|
+
width: '40%',
|
|
463
|
+
sortable: true,
|
|
464
|
+
image: {
|
|
465
|
+
width: '0rem',
|
|
466
|
+
height: '0rem',
|
|
467
|
+
},
|
|
468
|
+
align: 'left',
|
|
469
|
+
} as ITableHeader<any>,
|
|
470
|
+
{
|
|
471
|
+
key: 'device',
|
|
472
|
+
label: { name: 'Device' },
|
|
473
|
+
width: '60%',
|
|
474
|
+
sortable: false,
|
|
475
|
+
image: {
|
|
476
|
+
width: '0rem',
|
|
477
|
+
height: '0rem',
|
|
478
|
+
},
|
|
479
|
+
align: 'left',
|
|
480
|
+
overflow: {
|
|
481
|
+
truncated: true,
|
|
482
|
+
},
|
|
483
|
+
} as ITableHeader<any>,
|
|
484
|
+
]
|
|
485
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
486
|
+
}
|
|
381
487
|
}}
|
|
382
488
|
/>
|
|
383
489
|
<div class="flex">
|
|
@@ -625,7 +731,6 @@
|
|
|
625
731
|
onUpdate={(value) => {
|
|
626
732
|
const handler = { ...button.eventHandler }
|
|
627
733
|
handler.Variables = (value as string).trim().split(/\s+/)
|
|
628
|
-
console.log(handler)
|
|
629
734
|
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
630
735
|
}}
|
|
631
736
|
/>
|
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.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "vite build",
|
|
9
9
|
"preview": "vite preview",
|
|
10
10
|
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
11
|
-
"CheckUpdate": "npx npm-check-updates -u && npm install
|
|
11
|
+
"CheckUpdate": "npx npm-check-updates -u && npm install",
|
|
12
12
|
"UpdateIconsLib": "tsx src/lib/IconsCatalog/iconsLib.ts"
|
|
13
13
|
},
|
|
14
14
|
"svelte": "./dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@tailwindcss/vite": "^4.1.18",
|
|
36
|
-
"prettier": "^3.
|
|
37
|
-
"prettier-plugin-svelte": "^3.4.
|
|
36
|
+
"prettier": "^3.7.4",
|
|
37
|
+
"prettier-plugin-svelte": "^3.4.1",
|
|
38
38
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
39
39
|
"svelte-maplibre-gl": "^1.0.2",
|
|
40
40
|
"tailwind-merge": "^3.4.0",
|
|
@@ -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": "^25.0.
|
|
50
|
+
"@types/node": "^25.0.2",
|
|
51
51
|
"publint": "^0.3.16",
|
|
52
|
-
"svelte": "^5.
|
|
52
|
+
"svelte": "^5.46.0",
|
|
53
53
|
"svelte-preprocess": "^6.0.3",
|
|
54
54
|
"vite": "^7.2.7",
|
|
55
55
|
"vite-plugin-compression": "^0.5.1"
|