poe-svelte-ui-lib 1.1.20 → 1.1.22
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/Accordion/AccordionProps.svelte +3 -3
- package/dist/FileAttach/FileAttach.svelte +0 -1
- package/dist/Graph/GraphProps.svelte +0 -2
- package/dist/{Accordion/IconsLib → IconsLib}/common.edit.svg +5 -4
- package/dist/{Accordion/IconsLib → IconsLib}/iconsLib.js +2 -2
- package/dist/{Accordion/IconsLib → IconsLib}/settings.debug.svg +1 -1
- package/dist/{Accordion/IconsLib → IconsLib}/settings.save.svg +5 -4
- package/dist/Input/Input.svelte +1 -1
- package/dist/ProgressBar/ProgressBar.svelte +4 -5
- package/dist/ProgressBar/ProgressBarProps.svelte +2 -0
- package/dist/Select/SelectProps.svelte +12 -41
- package/dist/Switch/Switch.svelte +2 -2
- package/dist/Table/Table.svelte +33 -14
- package/dist/Table/TableProps.svelte +240 -145
- package/dist/TextField/TextFieldProps.svelte +3 -9
- package/dist/{Accordion/icons.js → icons.js} +22 -22
- package/dist/locales/translations.js +66 -20
- package/dist/options.js +61 -9
- package/dist/types.d.ts +9 -4
- package/package.json +5 -5
- /package/dist/{Accordion/IconsLib → IconsLib}/access.card.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/access.key.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/access.lock.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/common.battery.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/common.block.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/common.list.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/common.search.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/common.trash.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/common.warning.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/iconsLib.d.ts +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/info.bell.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/info.clock.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/info.graph.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/info.info.svg +0 -0
- /package/dist/{Accordion/IconsLib/image.camera.svg → IconsLib/media.camera.svg} +0 -0
- /package/dist/{Accordion/IconsLib/image.movie.svg → IconsLib/media.movie.svg} +0 -0
- /package/dist/{Accordion/IconsLib/electronic.sound.svg → IconsLib/media.sound.svg} +0 -0
- /package/dist/{Accordion/IconsLib/image.webcam.svg → IconsLib/media.webcam.svg} +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/network.cellular.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/network.cloud.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/network.globe.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/network.link.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/network.radio.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/network.share.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/network.wifi.svg +0 -0
- /package/dist/{Accordion/IconsLib/electronic.board.svg → IconsLib/periphery.board.svg} +0 -0
- /package/dist/{Accordion/IconsLib/electronic.chip.svg → IconsLib/periphery.chip.svg} +0 -0
- /package/dist/{Accordion/IconsLib/electronic.magnit.svg → IconsLib/periphery.magnit.svg} +0 -0
- /package/dist/{Accordion/IconsLib/electronic.memory.svg → IconsLib/periphery.memory.svg} +0 -0
- /package/dist/{Accordion/IconsLib/electronic.volume.svg → IconsLib/periphery.volume.svg} +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/power.jeck.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/power.power.svg +0 -0
- /package/dist/{Accordion/IconsLib/control.point.svg → IconsLib/scenarios.point.svg} +0 -0
- /package/dist/{Accordion/IconsLib/control.speed.svg → IconsLib/scenarios.speed.svg} +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/settings.hammer.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/settings.list.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/settings.settings.svg +0 -0
- /package/dist/{Accordion/IconsLib → IconsLib}/settings.spanner.svg +0 -0
- /package/dist/{Accordion/IconsLib/electronic.terminal.svg → IconsLib/settings.terminal.svg} +0 -0
- /package/dist/{Accordion/icons.d.ts → icons.d.ts} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { updateProperty, type IAccordionProps, type UIComponent } from '../types'
|
|
5
5
|
import * as UI from '..'
|
|
6
6
|
import { optionsStore } from '../options'
|
|
7
|
-
import { ICONS } from '
|
|
7
|
+
import { ICONS } from '../icons'
|
|
8
8
|
import Modal from '../Modal.svelte'
|
|
9
9
|
import Button from '../Button/Button.svelte'
|
|
10
10
|
import CrossIcon from '../libIcons/CrossIcon.svelte'
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
</div>
|
|
64
64
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
65
65
|
<div class="relative mt-6 flex w-full gap-2">
|
|
66
|
-
<UI.Button content={{ name: '
|
|
66
|
+
<UI.Button content={{ name: $t('constructor.props.labelicon') }} onClick={() => (showIconLib = true)} />
|
|
67
67
|
{#if showIconLib}
|
|
68
68
|
<Modal bind:isOpen={showIconLib} wrapperClass="w-130">
|
|
69
69
|
{#snippet main()}
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
|
|
175
175
|
/>
|
|
176
176
|
<div class="relative mt-5 flex w-full gap-2">
|
|
177
|
-
<UI.Button content={{ name: '
|
|
177
|
+
<UI.Button content={{ name: $t('constructor.props.labelicon') }} onClick={() => (showIconLib = true)} />
|
|
178
178
|
{#if showIconLib}
|
|
179
179
|
<Modal bind:isOpen={showIconLib} wrapperClass="w-130">
|
|
180
180
|
{#snippet main()}
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
forConstructor?: boolean
|
|
15
15
|
}>()
|
|
16
16
|
|
|
17
|
-
console.log(component.properties.streamingData)
|
|
18
|
-
|
|
19
17
|
const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
|
|
20
18
|
let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
|
|
21
19
|
</script>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="
|
|
2
|
-
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"
|
|
2
|
+
>
|
|
3
|
+
<path
|
|
3
4
|
fill="none"
|
|
4
5
|
stroke="currentColor"
|
|
5
6
|
stroke-linecap="round"
|
|
6
7
|
stroke-linejoin="round"
|
|
7
8
|
stroke-width="1.5"
|
|
8
9
|
d="M14.44 5.78L4.198 16.02a2 2 0 0 0-.565 1.125l-.553 3.774l3.775-.553A2 2 0 0 0 7.98 19.8L18.22 9.56m-3.78-3.78l2.229-2.23a1.6 1.6 0 0 1 2.263 0l1.518 1.518a1.6 1.6 0 0 1 0 2.263l-2.23 2.23M14.44 5.78l3.78 3.78"
|
|
9
|
-
|
|
10
|
-
>
|
|
10
|
+
/>
|
|
11
|
+
</svg>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
const scanAllIcons = async () => {
|
|
4
|
-
const dirPath = 'src/lib/
|
|
4
|
+
const dirPath = 'src/lib/IconsLib';
|
|
5
5
|
const files = fs.readdirSync(dirPath);
|
|
6
6
|
const categories = {};
|
|
7
7
|
files
|
|
@@ -31,7 +31,7 @@ ${Object.entries(categories)
|
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
`;
|
|
34
|
-
fs.writeFileSync('src/lib/
|
|
34
|
+
fs.writeFileSync('src/lib/icons.ts', content);
|
|
35
35
|
console.log('icons.ts создан:', Object.keys(categories));
|
|
36
36
|
};
|
|
37
37
|
scanAllIcons();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="
|
|
2
|
-
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"
|
|
2
|
+
>
|
|
3
|
+
<path
|
|
3
4
|
fill="currentColor"
|
|
4
5
|
d="M3 5.75A2.75 2.75 0 0 1 5.75 3h9.965a3.25 3.25 0 0 1 2.298.952l2.035 2.035c.61.61.952 1.437.952 2.299v9.964A2.75 2.75 0 0 1 18.25 21H5.75A2.75 2.75 0 0 1 3 18.25zM5.75 4.5c-.69 0-1.25.56-1.25 1.25v12.5c0 .69.56 1.25 1.25 1.25H6v-5.25A2.25 2.25 0 0 1 8.25 12h7.5A2.25 2.25 0 0 1 18 14.25v5.25h.25c.69 0 1.25-.56 1.25-1.25V8.286c0-.465-.184-.91-.513-1.238l-2.035-2.035a1.75 1.75 0 0 0-.952-.49V7.25a2.25 2.25 0 0 1-2.25 2.25h-4.5A2.25 2.25 0 0 1 7 7.25V4.5zm10.75 15v-5.25a.75.75 0 0 0-.75-.75h-7.5a.75.75 0 0 0-.75.75v5.25zm-8-15v2.75c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75V4.5z"
|
|
5
|
-
|
|
6
|
-
>
|
|
6
|
+
/>
|
|
7
|
+
</svg>
|
package/dist/Input/Input.svelte
CHANGED
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
{#if showInfo}
|
|
224
224
|
<div
|
|
225
225
|
transition:fly={{ x: -15, duration: 250 }}
|
|
226
|
-
class="absolute top-
|
|
226
|
+
class="absolute top-5 left-10 z-50 w-auto -translate-y-1/2 rounded bg-(--container-color) px-2 py-1 shadow-lg"
|
|
227
227
|
>
|
|
228
228
|
{help?.info}
|
|
229
229
|
</div>
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
return Math.max(min, Math.min(max, value))
|
|
25
25
|
} else if (typeof value === 'string') {
|
|
26
26
|
const parsedValue = parseFloat(value)
|
|
27
|
-
console.log(value)
|
|
28
27
|
if (!isNaN(parsedValue)) {
|
|
29
28
|
return Math.max(min, Math.min(max, parsedValue))
|
|
30
29
|
}
|
|
@@ -46,10 +45,10 @@
|
|
|
46
45
|
<h5 class={twMerge(` w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
47
46
|
{/if}
|
|
48
47
|
|
|
49
|
-
<div class="flex w-full
|
|
50
|
-
<
|
|
51
|
-
|
|
48
|
+
<div class="flex h-7 w-full items-center gap-2 rounded-full bg-(--bg-color) px-2">
|
|
49
|
+
<span class="m-auto font-semibold">{numericValue?.toFixed(2)}{number.units}</span>
|
|
50
|
+
<div class="relative my-auto h-3.5 w-[85%] rounded-full bg-(--back-color)/40">
|
|
51
|
+
<div class="absolute top-0 left-0 flex h-full rounded-full bg-(--field-color)" style="width: {progressPercent()}%;"></div>
|
|
52
52
|
</div>
|
|
53
|
-
<span class="ml-2 font-semibold">{numericValue?.toFixed(2)}{number.units}</span>
|
|
54
53
|
</div>
|
|
55
54
|
</div>
|
|
@@ -144,6 +144,8 @@
|
|
|
144
144
|
/>
|
|
145
145
|
<UI.Input
|
|
146
146
|
label={{ name: $t('constructor.props.value') }}
|
|
147
|
+
type="number"
|
|
148
|
+
number={{ minNum: component.properties.number.minNum, maxNum: component.properties.number.maxNum, step: 1 }}
|
|
147
149
|
value={component.properties.value}
|
|
148
150
|
onUpdate={(value) => updateProperty('value', value as string, component, onPropertyChange)}
|
|
149
151
|
/>
|
|
@@ -90,7 +90,8 @@
|
|
|
90
90
|
help={{ info: $t('constructor.props.argument.info'), autocomplete: 'on', regExp: /^[a-zA-Z0-9\-_]{0,32}$/ }}
|
|
91
91
|
onUpdate={(value) => updateProperty('eventHandler.Argument', value as string, component, onPropertyChange)}
|
|
92
92
|
/>
|
|
93
|
-
|
|
93
|
+
</div>
|
|
94
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
94
95
|
<UI.Select
|
|
95
96
|
label={{ name: $t('constructor.props.type') }}
|
|
96
97
|
type="buttons"
|
|
@@ -98,8 +99,6 @@
|
|
|
98
99
|
options={$optionsStore.SELECT_TYPE_OPTIONS}
|
|
99
100
|
onUpdate={(item) => updateProperty('type', item.value as string, component, onPropertyChange)}
|
|
100
101
|
/>
|
|
101
|
-
</div>
|
|
102
|
-
<div class="flex w-1/3 flex-col items-center px-2">
|
|
103
102
|
<UI.Select
|
|
104
103
|
wrapperClass="h-14"
|
|
105
104
|
label={{ name: $t('constructor.props.valuetype') }}
|
|
@@ -117,21 +116,6 @@
|
|
|
117
116
|
updateProperty('options', options, component, onPropertyChange)
|
|
118
117
|
}}
|
|
119
118
|
/>
|
|
120
|
-
<UI.Select
|
|
121
|
-
wrapperClass=" h-14"
|
|
122
|
-
label={{ name: $t('constructor.props.colors') }}
|
|
123
|
-
type="buttons"
|
|
124
|
-
options={$optionsStore.COLOR_OPTIONS}
|
|
125
|
-
value={initialColor}
|
|
126
|
-
onUpdate={(option) => {
|
|
127
|
-
updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)
|
|
128
|
-
const options = [...(component.properties?.options || [])]
|
|
129
|
-
options.forEach((o) => {
|
|
130
|
-
o['class'] = option.value
|
|
131
|
-
})
|
|
132
|
-
updateProperty('options', options, component, onPropertyChange)
|
|
133
|
-
}}
|
|
134
|
-
/>
|
|
135
119
|
</div>
|
|
136
120
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
137
121
|
<UI.Input
|
|
@@ -161,7 +145,8 @@
|
|
|
161
145
|
onClick={() => {
|
|
162
146
|
const newOption: ISelectOption = {
|
|
163
147
|
id: crypto.randomUUID(),
|
|
164
|
-
name:
|
|
148
|
+
name: `Option ${component.properties?.options.length + 1}`,
|
|
149
|
+
value: component.properties?.options.length + 1,
|
|
165
150
|
class: 'bg-max',
|
|
166
151
|
}
|
|
167
152
|
const options = [...(component.properties?.options || []), newOption]
|
|
@@ -232,21 +217,6 @@
|
|
|
232
217
|
value={component.properties.wrapperClass}
|
|
233
218
|
onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
|
|
234
219
|
/>
|
|
235
|
-
<UI.Select
|
|
236
|
-
wrapperClass=" h-14"
|
|
237
|
-
label={{ name: $t('constructor.props.colors') }}
|
|
238
|
-
type="buttons"
|
|
239
|
-
options={$optionsStore.COLOR_OPTIONS}
|
|
240
|
-
value={initialColor}
|
|
241
|
-
onUpdate={(option) => {
|
|
242
|
-
updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)
|
|
243
|
-
const options = [...(component.properties?.options || [])]
|
|
244
|
-
options.forEach((o) => {
|
|
245
|
-
o['class'] = option.value
|
|
246
|
-
})
|
|
247
|
-
updateProperty('options', options, component, onPropertyChange)
|
|
248
|
-
}}
|
|
249
|
-
/>
|
|
250
220
|
</div>
|
|
251
221
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
252
222
|
<UI.Input
|
|
@@ -259,6 +229,12 @@
|
|
|
259
229
|
value={component.properties.label.class}
|
|
260
230
|
onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
|
|
261
231
|
/>
|
|
232
|
+
<UI.Switch
|
|
233
|
+
wrapperClass="bg-blue"
|
|
234
|
+
label={{ name: $t('constructor.props.disabled') }}
|
|
235
|
+
value={component.properties.disabled ? 2 : 1}
|
|
236
|
+
onChange={(value) => updateProperty('disabled', value === 2, component, onPropertyChange)}
|
|
237
|
+
/>
|
|
262
238
|
</div>
|
|
263
239
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
264
240
|
<UI.Select
|
|
@@ -285,12 +261,6 @@
|
|
|
285
261
|
updateProperty('options', options, component, onPropertyChange)
|
|
286
262
|
}}
|
|
287
263
|
/>
|
|
288
|
-
<UI.Switch
|
|
289
|
-
wrapperClass="bg-blue"
|
|
290
|
-
label={{ name: $t('constructor.props.disabled') }}
|
|
291
|
-
value={component.properties.disabled ? 2 : 1}
|
|
292
|
-
onChange={(value) => updateProperty('disabled', value === 2, component, onPropertyChange)}
|
|
293
|
-
/>
|
|
294
264
|
</div>
|
|
295
265
|
</div>
|
|
296
266
|
|
|
@@ -306,7 +276,8 @@
|
|
|
306
276
|
onClick={() => {
|
|
307
277
|
const newOption: ISelectOption = {
|
|
308
278
|
id: crypto.randomUUID(),
|
|
309
|
-
name:
|
|
279
|
+
name: `Option ${component.properties?.options.length + 1}`,
|
|
280
|
+
value: component.properties?.options.length + 1,
|
|
310
281
|
class: 'bg-max',
|
|
311
282
|
}
|
|
312
283
|
const options = [...(component.properties?.options || []), newOption]
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
id = crypto.randomUUID(),
|
|
8
8
|
disabled = false,
|
|
9
9
|
wrapperClass = '',
|
|
10
|
-
label = { name: '', captionLeft: '', captionRight: '' },
|
|
10
|
+
label = { name: '', class: '', captionLeft: '', captionRight: '' },
|
|
11
11
|
height = '2rem',
|
|
12
12
|
value = $bindable(),
|
|
13
13
|
onChange = () => {},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
<div class={twMerge(`bg-blue relative flex w-full flex-col items-center justify-center`, wrapperClass)}>
|
|
48
48
|
{#if label.name}
|
|
49
|
-
<h5 class={`w-full px-4 text-center
|
|
49
|
+
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
50
50
|
{/if}
|
|
51
51
|
|
|
52
52
|
<div class="relative flex w-full grow items-center justify-center bg-transparent">
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
body = [],
|
|
13
13
|
header = [],
|
|
14
14
|
footer = '',
|
|
15
|
+
outline = false,
|
|
15
16
|
cursor = null,
|
|
16
17
|
loader,
|
|
17
18
|
getData = () => {},
|
|
@@ -97,7 +98,6 @@
|
|
|
97
98
|
rawData: text,
|
|
98
99
|
formattedData: formatting ? formatting(text) : (text ?? ''),
|
|
99
100
|
}
|
|
100
|
-
// console.log(modalData)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
const showTooltip = (event: MouseEvent, text: string, formatting?: (text: string) => string) => {
|
|
@@ -126,11 +126,22 @@
|
|
|
126
126
|
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
127
127
|
{/if}
|
|
128
128
|
|
|
129
|
-
<div class="flex h-full flex-col overflow-hidden rounded-xl border-(--border-color)">
|
|
129
|
+
<div class="flex h-full flex-col overflow-hidden rounded-xl border {outline ? ' border-(--border-color)' : 'border-transparent'} ">
|
|
130
130
|
<!-- Table Header -->
|
|
131
131
|
<div class="grid font-semibold" style={`grid-template-columns: ${header.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
|
|
132
|
-
{#each header as column (column)}
|
|
133
|
-
<div
|
|
132
|
+
{#each header as column, index (column)}
|
|
133
|
+
<div
|
|
134
|
+
class={twMerge(
|
|
135
|
+
`justify-center border-l ${outline && index !== 0 ? ' border-(--border-color)' : 'border-transparent'} ${
|
|
136
|
+
column.align?.header === 'center'
|
|
137
|
+
? 'flex justify-center text-center'
|
|
138
|
+
: column.align?.header === 'right'
|
|
139
|
+
? 'flex justify-end text-right'
|
|
140
|
+
: 'flex justify-start text-left'
|
|
141
|
+
} bg-(--bg-color) p-2 text-left`,
|
|
142
|
+
column.label?.class,
|
|
143
|
+
)}
|
|
144
|
+
>
|
|
134
145
|
<span>{column.label?.name}</span>
|
|
135
146
|
{#if column.sortable}
|
|
136
147
|
<button
|
|
@@ -148,21 +159,24 @@
|
|
|
148
159
|
<div class="flex-1 overflow-y-auto bg-(--container-color)/50" bind:this={container} onscroll={handleScroll}>
|
|
149
160
|
<div class="grid min-w-0" style={`grid-template-columns: ${header.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
|
|
150
161
|
{#each body as row, index (row)}
|
|
151
|
-
{#each header as column (column)}
|
|
162
|
+
{#each header as column, j (column)}
|
|
152
163
|
<div
|
|
153
164
|
class="relative flex w-full min-w-0 items-center px-2 py-1 wrap-break-word
|
|
154
165
|
{index % 2 ? 'bg-(--back-color)/40' : 'bg-[#edeef3] dark:bg-[#1f2a3a]'}
|
|
155
|
-
{column.align === 'center'
|
|
166
|
+
{column.align?.content === 'center'
|
|
156
167
|
? 'flex justify-center text-center'
|
|
157
|
-
: column.align === 'right'
|
|
168
|
+
: column.align?.content === 'right'
|
|
158
169
|
? 'flex justify-end text-right'
|
|
159
|
-
: 'flex justify-start text-left'}
|
|
170
|
+
: 'flex justify-start text-left'}
|
|
171
|
+
border-t
|
|
172
|
+
{j !== 0 ? ' border-l ' : ''}
|
|
173
|
+
{outline ? 'border-(--border-color)' : 'border-transparent'} "
|
|
160
174
|
>
|
|
161
175
|
{#if column.buttons}
|
|
162
176
|
<div class="flex w-full flex-col gap-1">
|
|
163
177
|
{#each column.buttons as button (button)}
|
|
164
178
|
<button
|
|
165
|
-
class="{twMerge(`cursor-pointer rounded-full
|
|
179
|
+
class="{twMerge(`cursor-pointer rounded-full
|
|
166
180
|
px-4 py-1 font-medium transition-shadow outline-none select-none hover:shadow-md
|
|
167
181
|
${typeof button.class === 'function' ? button.class(row) : button.class}`)} bg-(--bg-color)"
|
|
168
182
|
onclick={() => buttonClick(row, button)}
|
|
@@ -171,7 +185,7 @@
|
|
|
171
185
|
</button>
|
|
172
186
|
{/each}
|
|
173
187
|
</div>
|
|
174
|
-
{:else if column.image}
|
|
188
|
+
{:else if column.image?.src || column.image?.defaultIcon}
|
|
175
189
|
<div
|
|
176
190
|
class="flex items-center justify-center"
|
|
177
191
|
style={`width: ${column.image.width || '5rem'}; height: ${column.image.height || '5rem'};`}
|
|
@@ -184,14 +198,16 @@
|
|
|
184
198
|
loading="lazy"
|
|
185
199
|
/>
|
|
186
200
|
{:else if column.image.defaultIcon}
|
|
187
|
-
|
|
201
|
+
{#if typeof column.image.defaultIcon === 'string'}
|
|
202
|
+
{@html column.image.defaultIcon}
|
|
203
|
+
{:else}
|
|
204
|
+
<column.image.defaultIcon />
|
|
205
|
+
{/if}
|
|
188
206
|
{/if}
|
|
189
207
|
</div>
|
|
190
208
|
{:else}
|
|
191
209
|
<div
|
|
192
|
-
class="w-full max-w-full wrap-break-word {column.overflow?.truncated
|
|
193
|
-
? 'overflow-hidden text-ellipsis whitespace-nowrap'
|
|
194
|
-
: 'whitespace-normal'}"
|
|
210
|
+
class=" w-full max-w-full wrap-break-word {column.overflow?.truncated ? 'truncate' : ' whitespace-normal'}"
|
|
195
211
|
onmouseenter={column.overflow?.truncated ? (e) => showTooltip(e, row[column.key], column.overflow?.formatting) : undefined}
|
|
196
212
|
onmouseleave={column.overflow?.truncated ? hideTooltip : undefined}
|
|
197
213
|
onmousemove={column.overflow?.truncated
|
|
@@ -217,6 +233,9 @@
|
|
|
217
233
|
{@html row[column.key]}
|
|
218
234
|
{/if}
|
|
219
235
|
</div>
|
|
236
|
+
<!-- {#if column.overflow?.truncated}
|
|
237
|
+
<div class="whitespace-nowrap">{row[column.key].slice(-5)}</div>
|
|
238
|
+
{/if} -->
|
|
220
239
|
|
|
221
240
|
{#if column.overflow?.copy}
|
|
222
241
|
<button
|