poe-svelte-ui-lib 1.5.14 → 1.5.16
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/Button.svelte +33 -32
- package/dist/Button/ButtonProps.svelte +0 -1
- package/dist/Table/Table.svelte +46 -32
- package/dist/Table/TableProps.svelte +31 -18
- package/package.json +6 -6
|
@@ -21,6 +21,33 @@
|
|
|
21
21
|
|
|
22
22
|
let showInfo = $state(false)
|
|
23
23
|
|
|
24
|
+
let tooltipConfig = $derived({
|
|
25
|
+
top: {
|
|
26
|
+
pos: 'bottom-full left-1/2 mb-2',
|
|
27
|
+
tr: 'translateX(-50%)',
|
|
28
|
+
arr: 'top-full left-1/2 -translate-x-1/2 -translate-y-1/2 rotate-45',
|
|
29
|
+
off: 'y:-15',
|
|
30
|
+
},
|
|
31
|
+
bottom: {
|
|
32
|
+
pos: 'top-full left-1/2 mt-2',
|
|
33
|
+
tr: 'translateX(-50%)',
|
|
34
|
+
arr: 'bottom-full left-1/2 -translate-x-1/2 translate-y-1/2 rotate-45',
|
|
35
|
+
off: 'y:15',
|
|
36
|
+
},
|
|
37
|
+
left: {
|
|
38
|
+
pos: 'top-1/2 right-full mr-2',
|
|
39
|
+
tr: 'translateY(-50%)',
|
|
40
|
+
arr: 'top-1/2 -right-2 -translate-x-1/2 -translate-y-1/2 rotate-45',
|
|
41
|
+
off: 'x:15',
|
|
42
|
+
},
|
|
43
|
+
right: {
|
|
44
|
+
pos: 'top-1/2 left-full ml-2',
|
|
45
|
+
tr: 'translateY(-50%)',
|
|
46
|
+
arr: 'top-1/2 -left-2 translate-x-1/2 -translate-y-1/2 rotate-45 ',
|
|
47
|
+
off: 'x:-15',
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
24
51
|
const svgSize = $derived(() => {
|
|
25
52
|
const widthClass = twMerge(
|
|
26
53
|
wrapperClass.split(' ').find((cls: string) => cls.startsWith('w-')),
|
|
@@ -113,41 +140,15 @@
|
|
|
113
140
|
</div>
|
|
114
141
|
</button>
|
|
115
142
|
|
|
116
|
-
{#if showInfo && content.info?.side
|
|
117
|
-
|
|
118
|
-
transition:fly={{ y: -15, duration: 300 }}
|
|
119
|
-
class="absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
|
|
120
|
-
style="transform: translateX(-50%);"
|
|
121
|
-
>
|
|
122
|
-
{content.info?.text}
|
|
123
|
-
<div class="absolute top-full left-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rotate-45 transform bg-(--container-color)"></div>
|
|
124
|
-
</div>
|
|
125
|
-
{:else if showInfo && content.info?.side === 'bottom'}
|
|
126
|
-
<div
|
|
127
|
-
transition:fly={{ y: 15, duration: 300 }}
|
|
128
|
-
class="absolute top-full left-1/2 z-50 mt-2 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
|
|
129
|
-
style="transform: translateX(-50%);"
|
|
130
|
-
>
|
|
131
|
-
{content.info?.text}
|
|
132
|
-
<div class="absolute bottom-full left-1/2 h-2 w-2 -translate-x-1/2 translate-y-1/2 rotate-45 transform bg-(--container-color)"></div>
|
|
133
|
-
</div>
|
|
134
|
-
{:else if showInfo && content.info?.side === 'left'}
|
|
135
|
-
<div
|
|
136
|
-
transition:fly={{ x: 15, duration: 300 }}
|
|
137
|
-
class="absolute top-1/2 right-full z-50 mr-2 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
|
|
138
|
-
style="transform: translateY(-50%);"
|
|
139
|
-
>
|
|
140
|
-
{content.info?.text}
|
|
141
|
-
<div class="absolute top-1/2 -right-2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rotate-45 transform bg-(--container-color)"></div>
|
|
142
|
-
</div>
|
|
143
|
-
{:else if showInfo && content.info?.side === 'right'}
|
|
143
|
+
{#if showInfo && content.info?.side && tooltipConfig[content.info?.side]}
|
|
144
|
+
{@const config = tooltipConfig[content.info?.side]}
|
|
144
145
|
<div
|
|
145
|
-
transition:fly={{
|
|
146
|
-
class=
|
|
147
|
-
style=
|
|
146
|
+
transition:fly={{ [config.off.split(':')[0]]: parseInt(config.off.split(':')[1]), duration: 300 }}
|
|
147
|
+
class={`absolute z-50 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg ${config.pos}`}
|
|
148
|
+
style={`transform: ${config.tr};`}
|
|
148
149
|
>
|
|
149
150
|
{content.info?.text}
|
|
150
|
-
<div class=
|
|
151
|
+
<div class={`absolute ${config.arr} h-2 w-2 transform bg-(--container-color)`}></div>
|
|
151
152
|
</div>
|
|
152
153
|
{/if}
|
|
153
154
|
</div>
|
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)
|
|
@@ -311,7 +324,10 @@
|
|
|
311
324
|
</div>
|
|
312
325
|
{#if dataBuffer.clearButton}
|
|
313
326
|
<button
|
|
314
|
-
class={twMerge(
|
|
327
|
+
class={twMerge(
|
|
328
|
+
'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',
|
|
329
|
+
dataBuffer.clearClass,
|
|
330
|
+
)}
|
|
315
331
|
onclick={() => (buffer = [])}
|
|
316
332
|
>
|
|
317
333
|
<ButtonClear />
|
|
@@ -326,7 +342,6 @@
|
|
|
326
342
|
: dataBuffer.stashData
|
|
327
343
|
? buffer.slice(-(dataBuffer.rowsAmmount ?? 10))
|
|
328
344
|
: body}
|
|
329
|
-
|
|
330
345
|
<!-- Table Body с прокруткой -->
|
|
331
346
|
<div class="flex-1 overflow-y-auto bg-(--container-color)/50" bind:this={container} onscroll={handleScroll}>
|
|
332
347
|
<div class="grid min-w-0" style={`grid-template-columns: ${header.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
|
|
@@ -460,7 +475,6 @@
|
|
|
460
475
|
{@html tooltip.text}
|
|
461
476
|
</div>
|
|
462
477
|
{/if}
|
|
463
|
-
|
|
464
478
|
<!-- Нижнее поле для сводной информации -->
|
|
465
479
|
{#if footer}
|
|
466
480
|
<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,7 +117,6 @@
|
|
|
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) => {
|
|
101
|
-
updateProperty('type', option.value as string, component, onPropertyChange)
|
|
102
120
|
if (option.value === 'logger') {
|
|
103
121
|
updateProperty('dataBuffer.stashData', true, component, onPropertyChange)
|
|
104
122
|
updateProperty('dataBuffer.clearButton', true, component, onPropertyChange)
|
|
@@ -116,7 +134,9 @@
|
|
|
116
134
|
} as ITableHeader<any>,
|
|
117
135
|
]
|
|
118
136
|
updateProperty('header', headers, component, onPropertyChange)
|
|
137
|
+
updateTableBody(true, true)
|
|
119
138
|
} else {
|
|
139
|
+
updateProperty('dataBuffer.stashData', false, component, onPropertyChange)
|
|
120
140
|
updateProperty('dataBuffer.clearButton', false, component, onPropertyChange)
|
|
121
141
|
const headers = [
|
|
122
142
|
{
|
|
@@ -146,7 +166,9 @@
|
|
|
146
166
|
} as ITableHeader<any>,
|
|
147
167
|
]
|
|
148
168
|
updateProperty('header', headers, component, onPropertyChange)
|
|
169
|
+
updateTableBody(true, false)
|
|
149
170
|
}
|
|
171
|
+
updateProperty('type', option.value as string, component, onPropertyChange)
|
|
150
172
|
}}
|
|
151
173
|
/>
|
|
152
174
|
</div>
|
|
@@ -165,14 +187,6 @@
|
|
|
165
187
|
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
166
188
|
onChange={(value) => updateProperty('outline', value, component, onPropertyChange)}
|
|
167
189
|
/>
|
|
168
|
-
<UI.Switch
|
|
169
|
-
label={{ name: $t('constructor.props.table.stashData') }}
|
|
170
|
-
value={component.properties.dataBuffer.stashData}
|
|
171
|
-
options={[{ id: crypto.randomUUID(), value: 0, class: '', disabled: component.properties.type === 'logger' }]}
|
|
172
|
-
onChange={(value) => {
|
|
173
|
-
updateProperty('dataBuffer.stashData', value, component, onPropertyChange)
|
|
174
|
-
}}
|
|
175
|
-
/>
|
|
176
190
|
</div>
|
|
177
191
|
<div class="flex w-1/3 flex-col px-2">
|
|
178
192
|
<UI.Input
|
|
@@ -717,7 +731,6 @@
|
|
|
717
731
|
onUpdate={(value) => {
|
|
718
732
|
const handler = { ...button.eventHandler }
|
|
719
733
|
handler.Variables = (value as string).trim().split(/\s+/)
|
|
720
|
-
console.log(handler)
|
|
721
734
|
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
722
735
|
}}
|
|
723
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.16",
|
|
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"
|