poe-svelte-ui-lib 1.5.14 → 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.
@@ -102,7 +102,6 @@
102
102
  const parts = (value as string).trim().split(/\s+/)
103
103
 
104
104
  onPropertyChange({ eventHandler: { Variables: parts } })
105
- console.log(component.eventHandler)
106
105
  }}
107
106
  />
108
107
  <UI.Select
@@ -14,7 +14,7 @@
14
14
  body = $bindable(),
15
15
  header = [],
16
16
  footer = '',
17
- dataBuffer = { stashData: false, rowsAmmount: 10, clearButton: true, clearClass: '' },
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
- if (body && type == 'logger') {
159
- buffer = [
160
- ...buffer,
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
- type: Object.entries(body)[0][1] as string,
163
- color: `<div class='size-6 rounded-full ${logTypeOptions.find((o) => o.value == body.logLevel)?.color}'></div>`,
164
- data: Object.entries(body)[1][1] as string,
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
- const newBody = component.properties.body.map((row: object) => {
49
- const newRow: Partial<object> = {}
50
- component.properties.header.forEach((col: ITableHeader<any>) => {
51
- const key = col.key as keyof object
52
- newRow[key] = row[key] ?? `Value of ${key}`
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
- return newRow
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.14",
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 && npm install prettier@3.6.2",
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.6.2",
37
- "prettier-plugin-svelte": "^3.4.0",
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.1",
50
+ "@types/node": "^25.0.2",
51
51
  "publint": "^0.3.16",
52
- "svelte": "^5.45.10",
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"