poe-svelte-ui-lib 1.5.11 → 1.5.13
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 +1 -1
- package/dist/Table/TableProps.svelte +145 -142
- package/package.json +2 -2
package/dist/Table/Table.svelte
CHANGED
|
@@ -100,6 +100,8 @@
|
|
|
100
100
|
onUpdate={(option) => {
|
|
101
101
|
updateProperty('type', option.value as string, component, onPropertyChange)
|
|
102
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)
|
|
103
105
|
}}
|
|
104
106
|
/>
|
|
105
107
|
</div>
|
|
@@ -140,7 +142,7 @@
|
|
|
140
142
|
options={$optionsStore.TEXT_ALIGN_OPTIONS}
|
|
141
143
|
onUpdate={(option) => updateProperty('label.class', twMerge(component.properties.label.class, option.value), component, onPropertyChange)}
|
|
142
144
|
/>
|
|
143
|
-
{#if component.properties.stashData}
|
|
145
|
+
{#if component.properties.dataBuffer.stashData}
|
|
144
146
|
<UI.Input
|
|
145
147
|
label={{ name: $t('constructor.props.table.buffersize') }}
|
|
146
148
|
type="number"
|
|
@@ -150,160 +152,161 @@
|
|
|
150
152
|
{/if}
|
|
151
153
|
</div>
|
|
152
154
|
</div>
|
|
155
|
+
{#if component.properties.type === 'table'}
|
|
156
|
+
<hr class="border-(--border-color)" />
|
|
153
157
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<div class=" flex items-center justify-center gap-2">
|
|
159
|
-
<h4>{$t('constructor.props.table.columns')}</h4>
|
|
160
|
-
<UI.Button
|
|
161
|
-
wrapperClass="w-8"
|
|
162
|
-
content={{ icon: ButtonAdd }}
|
|
163
|
-
onClick={() => {
|
|
164
|
-
const newColumn: ITableHeader<any> = {
|
|
165
|
-
key: `column${(component.properties.header?.length || 0) + 1}`,
|
|
166
|
-
label: { name: `Column ${(component.properties.header?.length || 0) + 1}`, class: '' },
|
|
167
|
-
width: '10%',
|
|
168
|
-
sortable: false,
|
|
169
|
-
}
|
|
170
|
-
const headers = [...(component.properties.header || []), newColumn]
|
|
171
|
-
updateProperty('header', headers, component, onPropertyChange)
|
|
172
|
-
headers.forEach((h) => {
|
|
173
|
-
updateTableHeader(headers.indexOf(h), 'width', `${(100 / headers.length).toFixed(2)}%`)
|
|
174
|
-
})
|
|
175
|
-
updateTableBody()
|
|
176
|
-
}}
|
|
177
|
-
/>
|
|
178
|
-
</div>
|
|
179
|
-
|
|
180
|
-
{#each component.properties.header as column, columnIndex (columnIndex)}
|
|
181
|
-
<div class="mr-2 grid grid-cols-[minmax(5rem,10rem)_1fr_minmax(5rem,10rem)_minmax(10rem,21rem)_6rem_6rem_2rem_2rem] items-end gap-6">
|
|
182
|
-
<UI.Input
|
|
183
|
-
label={{ name: $t('constructor.props.table.columns.key') }}
|
|
184
|
-
value={column.key}
|
|
185
|
-
help={{ regExp: /^[0-9a-zA-Z_-]{0,16}$/ }}
|
|
186
|
-
onUpdate={(value) => {
|
|
187
|
-
updateTableHeader(columnIndex, 'key', value)
|
|
188
|
-
updateTableBody()
|
|
189
|
-
}}
|
|
190
|
-
/>
|
|
191
|
-
<UI.Input
|
|
192
|
-
label={{ name: $t('constructor.props.table.columns.label') }}
|
|
193
|
-
value={column.label.name}
|
|
194
|
-
onUpdate={(value) => {
|
|
195
|
-
updateTableHeader(columnIndex, 'label', { ['name']: value })
|
|
196
|
-
}}
|
|
197
|
-
/>
|
|
198
|
-
<UI.Input
|
|
199
|
-
label={{ name: $t('constructor.props.table.columns.width') }}
|
|
200
|
-
type="number"
|
|
201
|
-
value={Number(column.width.replace('%', ''))}
|
|
202
|
-
onUpdate={(value) => updateTableHeader(columnIndex, 'width', `${value}%`)}
|
|
203
|
-
/>
|
|
204
|
-
<UI.Select
|
|
205
|
-
label={{ name: $t('constructor.props.align.content') }}
|
|
206
|
-
type="buttons"
|
|
207
|
-
value={$optionsStore.ALIGN_OPTIONS.find((a) => (a.value as string).includes(column.align))}
|
|
208
|
-
options={$optionsStore.ALIGN_OPTIONS}
|
|
209
|
-
onUpdate={(option) => updateTableHeader(columnIndex, 'align', option.value)}
|
|
210
|
-
/>
|
|
211
|
-
<UI.Switch
|
|
212
|
-
label={{ name: $t('constructor.props.table.columns.sortable'), class: 'px-0' }}
|
|
213
|
-
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
214
|
-
value={column.sortable}
|
|
215
|
-
onChange={(value) => updateTableHeader(columnIndex, 'sortable', value)}
|
|
216
|
-
/>
|
|
217
|
-
<UI.Switch
|
|
218
|
-
label={{ name: $t('constructor.props.copy'), class: 'px-0' }}
|
|
219
|
-
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
220
|
-
value={column.overflow?.copy}
|
|
221
|
-
onChange={(value) => updateTableHeader(columnIndex, 'overflow', { copy: value })}
|
|
222
|
-
/>
|
|
158
|
+
<!-- Настройки столбцов таблицы -->
|
|
159
|
+
<div>
|
|
160
|
+
<div class=" flex items-center justify-center gap-2">
|
|
161
|
+
<h4>{$t('constructor.props.table.columns')}</h4>
|
|
223
162
|
<UI.Button
|
|
224
163
|
wrapperClass="w-8"
|
|
225
|
-
content={{ icon: ButtonAdd
|
|
164
|
+
content={{ icon: ButtonAdd }}
|
|
226
165
|
onClick={() => {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
class: '
|
|
230
|
-
|
|
231
|
-
|
|
166
|
+
const newColumn: ITableHeader<any> = {
|
|
167
|
+
key: `column${(component.properties.header?.length || 0) + 1}`,
|
|
168
|
+
label: { name: `Column ${(component.properties.header?.length || 0) + 1}`, class: '' },
|
|
169
|
+
width: '10%',
|
|
170
|
+
sortable: false,
|
|
232
171
|
}
|
|
233
|
-
const
|
|
234
|
-
updateTableHeader(columnIndex, 'buttons', buttons)
|
|
235
|
-
}}
|
|
236
|
-
/>
|
|
237
|
-
<UI.Button
|
|
238
|
-
wrapperClass="w-8"
|
|
239
|
-
content={{ icon: ButtonDelete }}
|
|
240
|
-
onClick={() => {
|
|
241
|
-
const headers = [...(component.properties.header || [])]
|
|
242
|
-
headers.splice(columnIndex, 1)
|
|
172
|
+
const headers = [...(component.properties.header || []), newColumn]
|
|
243
173
|
updateProperty('header', headers, component, onPropertyChange)
|
|
244
174
|
headers.forEach((h) => {
|
|
245
175
|
updateTableHeader(headers.indexOf(h), 'width', `${(100 / headers.length).toFixed(2)}%`)
|
|
246
176
|
})
|
|
177
|
+
updateTableBody()
|
|
247
178
|
}}
|
|
248
179
|
/>
|
|
249
180
|
</div>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
181
|
+
|
|
182
|
+
{#each component.properties.header as column, columnIndex (columnIndex)}
|
|
183
|
+
<div class="mr-2 grid grid-cols-[minmax(5rem,10rem)_1fr_minmax(5rem,10rem)_minmax(10rem,21rem)_6rem_6rem_2rem_2rem] items-end gap-6">
|
|
184
|
+
<UI.Input
|
|
185
|
+
label={{ name: $t('constructor.props.table.columns.key') }}
|
|
186
|
+
value={column.key}
|
|
187
|
+
help={{ regExp: /^[0-9a-zA-Z_-]{0,16}$/ }}
|
|
188
|
+
onUpdate={(value) => {
|
|
189
|
+
updateTableHeader(columnIndex, 'key', value)
|
|
190
|
+
updateTableBody()
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
193
|
+
<UI.Input
|
|
194
|
+
label={{ name: $t('constructor.props.table.columns.label') }}
|
|
195
|
+
value={column.label.name}
|
|
196
|
+
onUpdate={(value) => {
|
|
197
|
+
updateTableHeader(columnIndex, 'label', { ['name']: value })
|
|
198
|
+
}}
|
|
199
|
+
/>
|
|
200
|
+
<UI.Input
|
|
201
|
+
label={{ name: $t('constructor.props.table.columns.width') }}
|
|
202
|
+
type="number"
|
|
203
|
+
value={Number(column.width.replace('%', ''))}
|
|
204
|
+
onUpdate={(value) => updateTableHeader(columnIndex, 'width', `${value}%`)}
|
|
205
|
+
/>
|
|
206
|
+
<UI.Select
|
|
207
|
+
label={{ name: $t('constructor.props.align.content') }}
|
|
208
|
+
type="buttons"
|
|
209
|
+
value={$optionsStore.ALIGN_OPTIONS.find((a) => (a.value as string).includes(column.align))}
|
|
210
|
+
options={$optionsStore.ALIGN_OPTIONS}
|
|
211
|
+
onUpdate={(option) => updateTableHeader(columnIndex, 'align', option.value)}
|
|
212
|
+
/>
|
|
213
|
+
<UI.Switch
|
|
214
|
+
label={{ name: $t('constructor.props.table.columns.sortable'), class: 'px-0' }}
|
|
215
|
+
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
216
|
+
value={column.sortable}
|
|
217
|
+
onChange={(value) => updateTableHeader(columnIndex, 'sortable', value)}
|
|
218
|
+
/>
|
|
219
|
+
<UI.Switch
|
|
220
|
+
label={{ name: $t('constructor.props.copy'), class: 'px-0' }}
|
|
221
|
+
options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
|
|
222
|
+
value={column.overflow?.copy}
|
|
223
|
+
onChange={(value) => updateTableHeader(columnIndex, 'overflow', { copy: value })}
|
|
224
|
+
/>
|
|
225
|
+
<UI.Button
|
|
226
|
+
wrapperClass="w-8"
|
|
227
|
+
content={{ icon: ButtonAdd, info: { text: $t('constructor.props.table.addaction'), side: 'top' } }}
|
|
228
|
+
onClick={() => {
|
|
229
|
+
const newButton = {
|
|
230
|
+
name: `button${(component.properties.header[columnIndex].buttons ? component.properties.header[columnIndex].buttons.length : 0) + 1}`,
|
|
231
|
+
class: 'bg-blue',
|
|
232
|
+
eventHandler: { Header: 'SET', Argument: 'Save', Variables: [] },
|
|
233
|
+
onClick: () => {},
|
|
234
|
+
}
|
|
235
|
+
const buttons = [...(component.properties.header[columnIndex].buttons || []), newButton]
|
|
236
|
+
updateTableHeader(columnIndex, 'buttons', buttons)
|
|
237
|
+
}}
|
|
238
|
+
/>
|
|
239
|
+
<UI.Button
|
|
240
|
+
wrapperClass="w-8"
|
|
241
|
+
content={{ icon: ButtonDelete }}
|
|
242
|
+
onClick={() => {
|
|
243
|
+
const headers = [...(component.properties.header || [])]
|
|
244
|
+
headers.splice(columnIndex, 1)
|
|
245
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
246
|
+
headers.forEach((h) => {
|
|
247
|
+
updateTableHeader(headers.indexOf(h), 'width', `${(100 / headers.length).toFixed(2)}%`)
|
|
248
|
+
})
|
|
249
|
+
}}
|
|
250
|
+
/>
|
|
303
251
|
</div>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
252
|
+
{#if column.buttons && column.buttons.length > 0}
|
|
253
|
+
<div class="mb-5 rounded-lg py-1">
|
|
254
|
+
{#each column.buttons as button, buttonIndex (buttonIndex)}
|
|
255
|
+
<div class="ml-14 flex items-end justify-around gap-2">
|
|
256
|
+
<UI.Input
|
|
257
|
+
label={{ name: $t('constructor.props.name') }}
|
|
258
|
+
wrapperClass="!w-3/10"
|
|
259
|
+
value={button.name}
|
|
260
|
+
onUpdate={(value) => updateButtonProperty(columnIndex, buttonIndex, 'name', value)}
|
|
261
|
+
/>
|
|
262
|
+
<UI.Select
|
|
263
|
+
wrapperClass="!w-2/10"
|
|
264
|
+
label={{ name: $t('constructor.props.header') }}
|
|
265
|
+
type="buttons"
|
|
266
|
+
value={$optionsStore.HEADER_OPTIONS.find((h) => h.value === button.eventHandler?.Header)}
|
|
267
|
+
options={$optionsStore.HEADER_OPTIONS}
|
|
268
|
+
onUpdate={(option) => {
|
|
269
|
+
const handler = button.eventHandler
|
|
270
|
+
handler.Header = option.value as string
|
|
271
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
<UI.Input
|
|
275
|
+
wrapperClass="!w-2/10"
|
|
276
|
+
label={{ name: $t('constructor.props.argument') }}
|
|
277
|
+
value={button.eventHandler?.Argument}
|
|
278
|
+
onUpdate={(value) => {
|
|
279
|
+
const handler = button.eventHandler
|
|
280
|
+
handler.Argument = value as string
|
|
281
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
282
|
+
}}
|
|
283
|
+
/>
|
|
284
|
+
<UI.Input
|
|
285
|
+
wrapperClass="!w-2/10"
|
|
286
|
+
label={{ name: $t('constructor.props.table.keys') }}
|
|
287
|
+
value={button.eventHandler?.Variables.join(' ')}
|
|
288
|
+
maxlength={500}
|
|
289
|
+
help={{ info: $t('constructor.props.table.keys.info'), regExp: /^[a-zA-Z0-9\-_ ]{0,500}$/ }}
|
|
290
|
+
onUpdate={(value) => {
|
|
291
|
+
const handler = { ...button.eventHandler }
|
|
292
|
+
handler.Variables = (value as string).trim().split(/\s+/)
|
|
293
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
294
|
+
}}
|
|
295
|
+
/>
|
|
296
|
+
<UI.Button
|
|
297
|
+
wrapperClass="w-8"
|
|
298
|
+
content={{ icon: ButtonDelete }}
|
|
299
|
+
onClick={() => {
|
|
300
|
+
removeButtonFromColumn(columnIndex, buttonIndex)
|
|
301
|
+
}}
|
|
302
|
+
/>
|
|
303
|
+
</div>
|
|
304
|
+
{/each}
|
|
305
|
+
</div>
|
|
306
|
+
{/if}
|
|
307
|
+
{/each}
|
|
308
|
+
</div>
|
|
309
|
+
{/if}
|
|
307
310
|
{:else}
|
|
308
311
|
<div class="relative flex flex-row items-start justify-center pb-4">
|
|
309
312
|
<div class="flex w-1/3 flex-col px-2">
|
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.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@tailwindcss/vite": "^4.1.18",
|
|
36
|
-
"prettier": "^3.
|
|
36
|
+
"prettier": "^3.6.2",
|
|
37
37
|
"prettier-plugin-svelte": "^3.4.0",
|
|
38
38
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
39
39
|
"svelte-maplibre-gl": "^1.0.2",
|