poe-svelte-ui-lib 1.8.21 → 1.8.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 +0 -1
- package/dist/Button/Button.svelte +1 -2
- package/dist/FileAttach/FileAttachProps.svelte +1 -0
- package/dist/Input/InputProps.svelte +6 -6
- package/dist/Joystick/Joystick.svelte +3 -3
- package/dist/ProgressBar/ProgressBar.svelte +14 -16
- package/dist/ProgressBar/ProgressBarProps.svelte +6 -7
- package/dist/Select/Select.svelte +4 -8
- package/dist/Table/Table.svelte +28 -0
- package/dist/Table/TableProps.svelte +75 -10
- package/dist/Tabs/Tabs.svelte +0 -7
- package/dist/locales/translations.js +3 -3
- package/dist/options.js +1 -0
- package/dist/types.d.ts +6 -1
- package/package.json +2 -2
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as UI from ".."
|
|
6
6
|
import { optionsStore } from "../options"
|
|
7
7
|
import { ICONS } from "../icons"
|
|
8
|
-
import Modal from "../Modal.svelte"
|
|
9
8
|
import Button from "../Button/Button.svelte"
|
|
10
9
|
import CrossIcon from "../libIcons/CrossIcon.svelte"
|
|
11
10
|
import CommonSnippets from "../CommonSnippets.svelte"
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
/* Подписка на события клавиатуры */
|
|
86
86
|
onMount(() => {
|
|
87
87
|
if (keyBind) window.addEventListener("keydown", handleKeyDown)
|
|
88
|
-
|
|
89
88
|
return () => {
|
|
90
89
|
if (keyBind) window.removeEventListener("keydown", handleKeyDown)
|
|
91
90
|
}
|
|
@@ -128,7 +127,7 @@
|
|
|
128
127
|
{/if}
|
|
129
128
|
|
|
130
129
|
{#if content.name?.trim()}
|
|
131
|
-
<div class="flex-1">
|
|
130
|
+
<div class="flex-1 truncate">
|
|
132
131
|
{content.name}
|
|
133
132
|
{#if keyBind.key && keyBind.showHint}
|
|
134
133
|
<div class="text-xs opacity-70">
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
<UI.Input
|
|
33
33
|
label={{ name: $t("constructor.props.file.accept") }}
|
|
34
34
|
value={component.properties.accept}
|
|
35
|
+
help={{ info: $t("constructor.props.file.accept.help") }}
|
|
35
36
|
onUpdate={(value) => updateProperty("accept", value as string, component, onPropertyChange)}
|
|
36
37
|
/>
|
|
37
38
|
{/snippet}
|
|
@@ -165,21 +165,21 @@
|
|
|
165
165
|
{:else if !component.properties.bitMode && component.properties.type === "number" && !component.properties.readonly && !component.properties.disabled}
|
|
166
166
|
<div class="flex">
|
|
167
167
|
<UI.Input
|
|
168
|
-
label={{ name: $t("constructor.props.
|
|
169
|
-
value={component.properties.number.
|
|
168
|
+
label={{ name: $t("constructor.props.min") }}
|
|
169
|
+
value={component.properties.number.minNum as number}
|
|
170
170
|
type="number"
|
|
171
171
|
readonly={component.properties.bitMode}
|
|
172
172
|
onUpdate={(value) => {
|
|
173
|
-
updateProperty("number.
|
|
173
|
+
updateProperty("number.minNum", Number(value))
|
|
174
174
|
}}
|
|
175
175
|
/>
|
|
176
176
|
<UI.Input
|
|
177
|
-
label={{ name: $t("constructor.props.
|
|
178
|
-
value={component.properties.number.
|
|
177
|
+
label={{ name: $t("constructor.props.max") }}
|
|
178
|
+
value={component.properties.number.maxNum as number}
|
|
179
179
|
type="number"
|
|
180
180
|
readonly={component.properties.bitMode}
|
|
181
181
|
onUpdate={(value) => {
|
|
182
|
-
updateProperty("number.
|
|
182
|
+
updateProperty("number.maxNum", Number(value))
|
|
183
183
|
}}
|
|
184
184
|
/>
|
|
185
185
|
<UI.Input
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
{#each directions as direction, index}
|
|
137
137
|
<button class="pointer-events-none absolute top-1/2 left-1/2 block w-1/2 -translate-y-1/2 cursor-pointer" onclick={direction.onClick} title="">
|
|
138
138
|
<span
|
|
139
|
-
class="relative flex w-full origin-left items-center justify-center pl-[60%] pointer-events-auto
|
|
139
|
+
class="relative flex w-full origin-left items-center justify-center pl-[60%] pointer-events-auto active:scale-98 transition duration-200
|
|
140
140
|
{direction.mainButton ? 'bg-(--bg-color)' : ''}
|
|
141
141
|
"
|
|
142
142
|
style=" height: {direction.mainButton
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
style="background: color-mix(in srgb, var(--bg-color), var(--shadow-color) 10%)"
|
|
205
205
|
>
|
|
206
206
|
<button
|
|
207
|
-
class="h-full cursor-pointer rounded-l-full px-3.5"
|
|
207
|
+
class="h-full cursor-pointer rounded-l-full px-3.5 active:scale-98 transition duration-200"
|
|
208
208
|
title=""
|
|
209
209
|
onclick={() => {
|
|
210
210
|
if (value[0] - sensitivity <= (axes[0].minNum ?? -360)) {
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
</div></button
|
|
231
231
|
>
|
|
232
232
|
<button
|
|
233
|
-
class="h-full cursor-pointer rounded-r-full px-3.5"
|
|
233
|
+
class="h-full cursor-pointer rounded-r-full px-3.5 active:scale-97 transition duration-200"
|
|
234
234
|
title=""
|
|
235
235
|
onclick={() => {
|
|
236
236
|
if (value[0] + sensitivity >= (axes[0].maxNum ?? 360)) {
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/ProgressBar.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { twMerge } from "tailwind-merge"
|
|
4
|
-
import type { IProgressBarProps } from "../types"
|
|
4
|
+
import type { IProgressBarProps, IReceivingDataObject } from "../types"
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
id = crypto.randomUUID(),
|
|
8
8
|
wrapperClass = "",
|
|
9
9
|
items = [{ name: "Label", class: "" }],
|
|
10
|
-
value
|
|
11
|
-
{ Name: "Label 1", Value: 50 },
|
|
12
|
-
{ Name: "Label 2", Value: 50 },
|
|
13
|
-
{ Name: "Label 3", Value: 50 },
|
|
14
|
-
],
|
|
10
|
+
value,
|
|
15
11
|
type = "horizontal",
|
|
16
12
|
number = {
|
|
17
13
|
minNum: 0,
|
|
@@ -37,9 +33,7 @@
|
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
const progressPercent = (value: number) => {
|
|
40
|
-
if (value)
|
|
41
|
-
return (((Math.min(Math.max(value, min), max) - min) / (max - min)) * 100) as number
|
|
42
|
-
}
|
|
36
|
+
if (value) return (((Math.min(Math.max(value, min), max) - min) / (max - min)) * 100) as number
|
|
43
37
|
}
|
|
44
38
|
|
|
45
39
|
const roundToClean = (num: number): number => {
|
|
@@ -61,7 +55,7 @@
|
|
|
61
55
|
>
|
|
62
56
|
{#each items as progress, index}
|
|
63
57
|
<div class="flex flex-col {type == 'vertical' ? 'items-center' : `w-full`}">
|
|
64
|
-
<h5 class={type == "vertical" ? "" : "px-4 mt-2"}>{value[index]
|
|
58
|
+
<h5 class={type == "vertical" ? "" : "px-4 mt-2"}>{(value as IReceivingDataObject[])[index].Name || progress.name}</h5>
|
|
65
59
|
<div
|
|
66
60
|
class="{twMerge(
|
|
67
61
|
`flex ${type == 'vertical' ? 'h-full w-fit min-w-16 flex-col p-2' : 'h-7 w-full px-2'} items-center gap-2 rounded-full shadow-sm`,
|
|
@@ -72,22 +66,26 @@
|
|
|
72
66
|
<div class="relative my-auto h-[80%] w-[70%] rounded-full bg-(--back-color)/40">
|
|
73
67
|
<div
|
|
74
68
|
class="absolute bottom-0 left-0 flex w-full rounded-full bg-(--field-color)"
|
|
75
|
-
style="height: {progressPercent((value[index]?.Value as number) ?? 0)}%;"
|
|
69
|
+
style="height: {progressPercent(((value as IReceivingDataObject[])[index]?.Value as number) ?? 0)}%;"
|
|
76
70
|
></div>
|
|
77
71
|
</div>
|
|
78
|
-
<span class="m-auto font-semibold"
|
|
72
|
+
<span class="m-auto font-semibold"
|
|
73
|
+
>{roundToClean(Number(numericValue(((value as IReceivingDataObject[])[index]?.Value as number) || 0)))}{number.units}</span
|
|
74
|
+
>
|
|
79
75
|
{:else}
|
|
80
|
-
<span class="m-auto w-20 font-semibold"
|
|
76
|
+
<span class="m-auto w-20 font-semibold"
|
|
77
|
+
>{roundToClean(Number(numericValue(((value as IReceivingDataObject[])[index]?.Value as number) || 0)))}{number.units}</span
|
|
78
|
+
>
|
|
81
79
|
<div class="relative my-auto h-3.5 flex-1 rounded-full bg-(--back-color)/40">
|
|
82
80
|
<div
|
|
83
81
|
class="absolute top-0 left-0 flex h-full rounded-full bg-(--field-color)"
|
|
84
|
-
style="width: {progressPercent((value[index]?.Value as number) ?? 0)}%;"
|
|
82
|
+
style="width: {progressPercent(((value as IReceivingDataObject[])[index]?.Value as number) ?? 0)}%;"
|
|
85
83
|
></div>
|
|
86
84
|
</div>
|
|
87
85
|
{/if}
|
|
88
86
|
</div>
|
|
89
|
-
{#if value[index]?.Info}
|
|
90
|
-
<span>{value[index]?.Info}</span>
|
|
87
|
+
{#if (value as IReceivingDataObject[])[index]?.Info}
|
|
88
|
+
<span>{(value as IReceivingDataObject[])[index]?.Info}</span>
|
|
91
89
|
{/if}
|
|
92
90
|
</div>
|
|
93
91
|
{/each}
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
{#snippet ProgressBarMinMax()}
|
|
38
38
|
<div class="flex">
|
|
39
39
|
<UI.Input
|
|
40
|
-
label={{ name: $t("constructor.props.
|
|
41
|
-
value={component.properties.number.
|
|
40
|
+
label={{ name: $t("constructor.props.min") }}
|
|
41
|
+
value={component.properties.number.minNum as number}
|
|
42
42
|
type="number"
|
|
43
43
|
readonly={component.properties.bitMode}
|
|
44
44
|
onUpdate={(value) => {
|
|
45
|
-
updateProperty("number.
|
|
45
|
+
updateProperty("number.minNum", Number(value), component, onPropertyChange)
|
|
46
46
|
let newValue = component.properties.value?.map((pr: UI.IReceivingDataObject) => {
|
|
47
47
|
return { ...pr, Value: component.properties.number.minNum + (component.properties.number.maxNum - component.properties.number.minNum) / 2 }
|
|
48
48
|
})
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
}}
|
|
51
51
|
/>
|
|
52
52
|
<UI.Input
|
|
53
|
-
label={{ name: $t("constructor.props.
|
|
54
|
-
value={component.properties.number.
|
|
53
|
+
label={{ name: $t("constructor.props.max") }}
|
|
54
|
+
value={component.properties.number.maxNum as number}
|
|
55
55
|
type="number"
|
|
56
56
|
readonly={component.properties.bitMode}
|
|
57
57
|
onUpdate={(value) => {
|
|
58
|
-
updateProperty("number.
|
|
58
|
+
updateProperty("number.maxNum", Number(value), component, onPropertyChange)
|
|
59
59
|
let newValue = component.properties.value?.map((pr: UI.IReceivingDataObject) => {
|
|
60
60
|
return { ...pr, Value: component.properties.number.minNum + (component.properties.number.maxNum - component.properties.number.minNum) / 2 }
|
|
61
61
|
})
|
|
@@ -195,7 +195,6 @@
|
|
|
195
195
|
<div class="flex w-1/3 flex-col px-2">
|
|
196
196
|
<CommonSnippets snippet="WrapperClass" {component} {onPropertyChange} />
|
|
197
197
|
{@render ProgressBarMinMax()}
|
|
198
|
-
|
|
199
198
|
{@render ProgressBarUnits()}
|
|
200
199
|
</div>
|
|
201
200
|
<div class="flex w-1/3 flex-col px-2">
|
|
@@ -55,10 +55,7 @@
|
|
|
55
55
|
|
|
56
56
|
const toggleDropdown = (event: MouseEvent) => {
|
|
57
57
|
event.stopPropagation()
|
|
58
|
-
if (!disabled)
|
|
59
|
-
isDropdownOpen = !isDropdownOpen
|
|
60
|
-
filteredOptions = []
|
|
61
|
-
}
|
|
58
|
+
if (!disabled) isDropdownOpen = !isDropdownOpen
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
const isSelected = (option: IOption<any>) => {
|
|
@@ -103,10 +100,9 @@
|
|
|
103
100
|
filteredOptions = [
|
|
104
101
|
...filteredOptions,
|
|
105
102
|
...options.filter((option) => {
|
|
106
|
-
return !filteredOptions.
|
|
103
|
+
return !filteredOptions.some((filtered) => filtered.id === option.id)
|
|
107
104
|
}),
|
|
108
105
|
]
|
|
109
|
-
|
|
110
106
|
isDropdownOpen = filteredOptions.length > 0
|
|
111
107
|
|
|
112
108
|
const selectedFromList = options.find((option) => option.name?.toString() === searchValue)
|
|
@@ -214,9 +210,9 @@
|
|
|
214
210
|
id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
|
|
215
211
|
{disabled}
|
|
216
212
|
oninput={(e) => handleSearch((e.currentTarget as HTMLInputElement).value)}
|
|
217
|
-
onclick={() => {
|
|
213
|
+
onclick={(e) => {
|
|
218
214
|
if (searchValue == "") filteredOptions = options
|
|
219
|
-
|
|
215
|
+
toggleDropdown(e)
|
|
220
216
|
}}
|
|
221
217
|
/>
|
|
222
218
|
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -155,6 +155,24 @@
|
|
|
155
155
|
return !!src
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
const progressPercent = (column: ITableHeader<any>, value: number) => {
|
|
159
|
+
let min = column.progressBar?.minNum ?? 0
|
|
160
|
+
let max = column.progressBar?.maxNum ?? 100
|
|
161
|
+
if (value) return (((Math.min(Math.max(value, min), max) - min) / (max - min)) * 100) as number
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const roundToClean = (num: number): number => {
|
|
165
|
+
if (Number.isInteger(num)) return num
|
|
166
|
+
|
|
167
|
+
const rounded1 = Number(num.toFixed(1))
|
|
168
|
+
if (Math.abs(rounded1 - num) < 1e-10) return rounded1
|
|
169
|
+
|
|
170
|
+
const rounded2 = Number(num.toFixed(2))
|
|
171
|
+
if (Math.abs(rounded2 - num) < 1e-10) return rounded2
|
|
172
|
+
|
|
173
|
+
return rounded2
|
|
174
|
+
}
|
|
175
|
+
|
|
158
176
|
$effect(() => {
|
|
159
177
|
isScrollable = container ? container.scrollHeight > container.clientHeight : false
|
|
160
178
|
return () => (buffer = [])
|
|
@@ -368,6 +386,16 @@
|
|
|
368
386
|
{/if}
|
|
369
387
|
{/if}
|
|
370
388
|
</div>
|
|
389
|
+
{:else if column.type == "progressBar" && column.progressBar}
|
|
390
|
+
<div class="grid grid-cols-[3.5rem_1fr] h-7 w-full px-2 items-center gap-2 rounded-full shadow-sm bg-(--bg-color)">
|
|
391
|
+
<span class="m-auto font-semibold">{roundToClean(Number(row[column.key] ?? 0))}{column.progressBar?.units}</span>
|
|
392
|
+
<div class="relative my-auto h-3.5 rounded-full bg-(--back-color)/40">
|
|
393
|
+
<div
|
|
394
|
+
class="absolute top-0 left-0 flex h-full rounded-full bg-(--field-color)"
|
|
395
|
+
style="width: {progressPercent(column, row[column.key] as number)}%;"
|
|
396
|
+
></div>
|
|
397
|
+
</div>
|
|
398
|
+
</div>
|
|
371
399
|
{:else}
|
|
372
400
|
{@const text =
|
|
373
401
|
Array.isArray(row[column.key]) && row[column.key][0] && "value" in row[column.key][0]
|
|
@@ -77,6 +77,34 @@
|
|
|
77
77
|
})
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
const changeColumnType = (type: UI.IOption<string> | UI.IOption<string>[], columnIndex: number) => {
|
|
82
|
+
const currentActiveValues = $optionsStore.TABLE_CONTENT_TYPE_OPTIONS.filter((opt) => {
|
|
83
|
+
if (!opt?.value) return false
|
|
84
|
+
return Object.hasOwn(component.properties.header[columnIndex], opt.value)
|
|
85
|
+
}).map((opt) => opt.value)
|
|
86
|
+
|
|
87
|
+
let newHeader = component.properties.header
|
|
88
|
+
|
|
89
|
+
if (Array.isArray(type)) {
|
|
90
|
+
type.forEach((opt) => {
|
|
91
|
+
if (opt?.value) {
|
|
92
|
+
if (opt.value == "buttons") {
|
|
93
|
+
newHeader[columnIndex][opt.value] = []
|
|
94
|
+
addNewButton(columnIndex)
|
|
95
|
+
} else newHeader[columnIndex][opt.value] = {}
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
currentActiveValues.forEach((activeValue) => {
|
|
100
|
+
if (!type.some((opt) => opt?.value === activeValue)) {
|
|
101
|
+
newHeader[columnIndex] = Object.fromEntries(Object.entries(newHeader[columnIndex]).filter((h) => h[0] !== activeValue))
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
updateProperty("header", newHeader, component, onPropertyChange)
|
|
106
|
+
}
|
|
107
|
+
|
|
80
108
|
const updateTableHeader = (index: number, field: string, value: any) => {
|
|
81
109
|
const headers = [...component.properties.header]
|
|
82
110
|
headers[index] = { ...headers[index], [field]: value }
|
|
@@ -116,6 +144,15 @@
|
|
|
116
144
|
updateProperty("header", headers, component, onPropertyChange)
|
|
117
145
|
}
|
|
118
146
|
|
|
147
|
+
const updateProgressBarProperty = (columnIndex: number, field: string, value: any) => {
|
|
148
|
+
const headers = [...component.properties.header]
|
|
149
|
+
let progressBar = headers[columnIndex].progressBar
|
|
150
|
+
|
|
151
|
+
progressBar = { ...progressBar, [field]: value }
|
|
152
|
+
headers[columnIndex].progressBar = progressBar
|
|
153
|
+
updateProperty("header", headers, component, onPropertyChange)
|
|
154
|
+
}
|
|
155
|
+
|
|
119
156
|
const removeButtonFromColumn = (columnIndex: number, buttonIndex: number) => {
|
|
120
157
|
const headers = [...component.properties.header]
|
|
121
158
|
const buttons = [...headers[columnIndex].buttons]
|
|
@@ -128,11 +165,12 @@
|
|
|
128
165
|
const addNewButton = (columnIndex: number) => {
|
|
129
166
|
const newButton = {
|
|
130
167
|
name: `button${(component.properties.header[columnIndex].buttons ? component.properties.header[columnIndex].buttons.length : 0) + 1}`,
|
|
131
|
-
class: "bg-blue
|
|
168
|
+
class: "bg-blue",
|
|
132
169
|
eventHandler: { Header: "SET", Argument: "Save", Variables: [] },
|
|
133
170
|
onClick: () => {},
|
|
134
171
|
}
|
|
135
172
|
const buttons = [...(component.properties.header[columnIndex].buttons || []), newButton]
|
|
173
|
+
console.log(buttons)
|
|
136
174
|
|
|
137
175
|
updateTableHeader(columnIndex, "buttons", buttons)
|
|
138
176
|
}
|
|
@@ -176,7 +214,7 @@
|
|
|
176
214
|
key: `column${(component.properties.header?.length || 0) + 1}`,
|
|
177
215
|
label: { name: `Column ${(component.properties.header?.length || 0) + 1}`, class: "" },
|
|
178
216
|
width: "10%",
|
|
179
|
-
|
|
217
|
+
text: {},
|
|
180
218
|
}
|
|
181
219
|
const headers = [...(component.properties.header || []), newColumn]
|
|
182
220
|
updateProperty("header", headers, component, onPropertyChange)
|
|
@@ -197,7 +235,7 @@
|
|
|
197
235
|
|
|
198
236
|
{#each component.properties.header as column, columnIndex (columnIndex)}
|
|
199
237
|
<div class="flex flex-col pb-3 {columnIndex !== component.properties.header.length - 1 ? 'border-b border-(--border-color)/50 ' : ''}">
|
|
200
|
-
<div class="p-2 pr-0 grid grid-cols-[1fr_1fr_minmax(5rem,10rem)_minmax(10rem,21rem)_minmax(10rem,
|
|
238
|
+
<div class="p-2 pr-0 grid grid-cols-[1fr_1fr_minmax(5rem,10rem)_minmax(10rem,21rem)_minmax(10rem,28rem)_2rem] items-end gap-2">
|
|
201
239
|
<UI.Input
|
|
202
240
|
label={{ name: $t("constructor.props.table.columns.key") }}
|
|
203
241
|
value={column.key}
|
|
@@ -231,11 +269,18 @@
|
|
|
231
269
|
<UI.Select
|
|
232
270
|
label={{ name: $t("constructor.props.table.content.type") }}
|
|
233
271
|
type="buttons"
|
|
234
|
-
|
|
272
|
+
// multiSelect
|
|
273
|
+
options={forConstructor ? $optionsStore.TABLE_CONTENT_TYPE_OPTIONS.slice(0, 4) : $optionsStore.TABLE_CONTENT_TYPE_OPTIONS}
|
|
274
|
+
// value={$optionsStore.TABLE_CONTENT_TYPE_OPTIONS.filter((opt) => Object.hasOwn(component.properties.header[columnIndex], opt.value))}
|
|
235
275
|
value={$optionsStore.TABLE_CONTENT_TYPE_OPTIONS.find((h) => h.value === column.type) || $optionsStore.TABLE_CONTENT_TYPE_OPTIONS[0]}
|
|
236
276
|
onUpdate={(value) => {
|
|
237
277
|
column.type = (value as UI.IOption).value
|
|
238
278
|
if ((value as UI.IOption).value == "buttons" && (!column.buttons || column.buttons.length == 0)) addNewButton(columnIndex)
|
|
279
|
+
if ((value as UI.IOption).value == "progressBar" && !column.progressBar) column.progressBar = {}
|
|
280
|
+
|
|
281
|
+
// changeColumnType(value, columnIndex)
|
|
282
|
+
// if ((value as UI.IOption).value == "buttons" && (!column.buttons || column.buttons.length == 0)) addNewButton(columnIndex)
|
|
283
|
+
// if ((value as UI.IOption).value == "progressBar" && !column.progressBar) column.progressBar = {}
|
|
239
284
|
}}
|
|
240
285
|
/>
|
|
241
286
|
<UI.Button
|
|
@@ -249,7 +294,7 @@
|
|
|
249
294
|
/>
|
|
250
295
|
</div>
|
|
251
296
|
|
|
252
|
-
{#if column.
|
|
297
|
+
{#if column.buttons}
|
|
253
298
|
<div class="flex gap-2 items-end">
|
|
254
299
|
<div class="pl-2 w-12">
|
|
255
300
|
<UI.Button
|
|
@@ -336,7 +381,7 @@
|
|
|
336
381
|
{/each}
|
|
337
382
|
</div>
|
|
338
383
|
</div>
|
|
339
|
-
{:else if column.
|
|
384
|
+
{:else if column.select}
|
|
340
385
|
<div class="mx-auto">
|
|
341
386
|
<UI.Input
|
|
342
387
|
wrapperClass="w-70"
|
|
@@ -349,7 +394,7 @@
|
|
|
349
394
|
}}
|
|
350
395
|
/>
|
|
351
396
|
</div>
|
|
352
|
-
{:else if column.
|
|
397
|
+
{:else if column.image}
|
|
353
398
|
<div class="ml-14 flex items-end gap-2">
|
|
354
399
|
<div class="w-1/2">
|
|
355
400
|
<CommonSnippets
|
|
@@ -388,7 +433,7 @@
|
|
|
388
433
|
label={{ name: $t("constructor.props.table.columns.image.width"), class: "px-0" }}
|
|
389
434
|
type="number"
|
|
390
435
|
number={{ minNum: 0, maxNum: 1000, step: 1 }}
|
|
391
|
-
value={Number(column.image?.width
|
|
436
|
+
value={Number(column.image?.width?.replace("rem", "") ?? 0)}
|
|
392
437
|
onUpdate={(value) => {
|
|
393
438
|
updateTableHeader(columnIndex, "image", {
|
|
394
439
|
class: column.image?.class,
|
|
@@ -403,7 +448,7 @@
|
|
|
403
448
|
label={{ name: $t("constructor.props.table.columns.image.height"), class: "px-0" }}
|
|
404
449
|
type="number"
|
|
405
450
|
number={{ minNum: 0, maxNum: 1000, step: 1 }}
|
|
406
|
-
value={Number(column.image?.height
|
|
451
|
+
value={Number(column.image?.height?.replace("rem", "") ?? 0)}
|
|
407
452
|
onUpdate={(value) => {
|
|
408
453
|
updateTableHeader(columnIndex, "image", {
|
|
409
454
|
class: column.image?.class,
|
|
@@ -414,7 +459,7 @@
|
|
|
414
459
|
}}
|
|
415
460
|
/>
|
|
416
461
|
</div>
|
|
417
|
-
{:else if column.
|
|
462
|
+
{:else if column.text}
|
|
418
463
|
<div class="mx-auto">
|
|
419
464
|
<UI.Select
|
|
420
465
|
wrapperClass="w-250"
|
|
@@ -430,6 +475,26 @@
|
|
|
430
475
|
}}
|
|
431
476
|
/>
|
|
432
477
|
</div>
|
|
478
|
+
{:else if column.progressBar}
|
|
479
|
+
<div class="w-3/5 flex mx-auto items-end gap-2">
|
|
480
|
+
<UI.Input
|
|
481
|
+
label={{ name: $t("constructor.props.min") }}
|
|
482
|
+
value={(column.progressBar?.minNum as number) ?? 0}
|
|
483
|
+
type="number"
|
|
484
|
+
onUpdate={(value) => updateProgressBarProperty(columnIndex, "minNum", value as string)}
|
|
485
|
+
/>
|
|
486
|
+
<UI.Input
|
|
487
|
+
label={{ name: $t("constructor.props.max") }}
|
|
488
|
+
value={(column.progressBar?.maxNum as number) ?? 100}
|
|
489
|
+
type="number"
|
|
490
|
+
onUpdate={(value) => updateProgressBarProperty(columnIndex, "maxNum", value as string)}
|
|
491
|
+
/>
|
|
492
|
+
<UI.Input
|
|
493
|
+
label={{ name: $t("constructor.props.units") }}
|
|
494
|
+
value={column.progressBar?.units}
|
|
495
|
+
onUpdate={(value) => updateProgressBarProperty(columnIndex, "units", value as string)}
|
|
496
|
+
/>
|
|
497
|
+
</div>
|
|
433
498
|
{/if}
|
|
434
499
|
</div>
|
|
435
500
|
{/each}
|
package/dist/Tabs/Tabs.svelte
CHANGED
|
@@ -33,13 +33,6 @@
|
|
|
33
33
|
class="{twMerge(`z-40 flex h-fit items-center rounded-t-xl overflow-x-auto px-1 `, wrapperClass)}
|
|
34
34
|
bg-(--bg-color)"
|
|
35
35
|
>
|
|
36
|
-
<!-- `text-${
|
|
37
|
-
wrapperClass
|
|
38
|
-
?.split(" ")
|
|
39
|
-
.find((cls: string) => cls.startsWith("bg-"))
|
|
40
|
-
?.slice(3)
|
|
41
|
-
.split("-")[0]
|
|
42
|
-
}-500` -->
|
|
43
36
|
{#each items as item, index}
|
|
44
37
|
<button
|
|
45
38
|
class={twMerge(
|
|
@@ -58,6 +58,7 @@ const translations = {
|
|
|
58
58
|
"constructor.props.open": "Разворачивание",
|
|
59
59
|
"constructor.props.defaultcolor": "Первоначальный цвет",
|
|
60
60
|
"constructor.props.file.accept": "Допустимые файлы",
|
|
61
|
+
"constructor.props.file.accept.help": "'audio/*', 'video/*', 'image/*' или расширения файлов через запятую в формате '.pdf'",
|
|
61
62
|
"constructor.props.imageSize.height": "Высота, rem",
|
|
62
63
|
"constructor.props.imageSize.width": "Ширина, rem",
|
|
63
64
|
"constructor.props.fitmode": "Вид",
|
|
@@ -96,8 +97,6 @@ const translations = {
|
|
|
96
97
|
"constructor.props.maxlength": "Максимальная длина",
|
|
97
98
|
"constructor.props.regexp": "Выражение валидации",
|
|
98
99
|
"constructor.props.regexp.info": "Введите RegExp без /.../ (например: ^\\d+$)",
|
|
99
|
-
"constructor.props.minnum": "Минимальное значение",
|
|
100
|
-
"constructor.props.maxnum": "Максимальное значение",
|
|
101
100
|
"constructor.props.min": "Мин.",
|
|
102
101
|
"constructor.props.max": "Макс.",
|
|
103
102
|
"constructor.props.units": "Единица измерения",
|
|
@@ -172,7 +171,7 @@ const translations = {
|
|
|
172
171
|
"constructor.props.table.keys": "Перечень ключей",
|
|
173
172
|
"constructor.props.table.keys.info": "Ключи колонок, значения которых будут возвращаться",
|
|
174
173
|
"constructor.props.table.select.keys": "Ключ строки",
|
|
175
|
-
"constructor.props.table.select.keys.info": "Ключ колонки, содержащей серийный номер модуля; поле
|
|
174
|
+
"constructor.props.table.select.keys.info": "Ключ колонки, содержащей серийный номер модуля; если поле пустое - применяется серийный номер изделия",
|
|
176
175
|
"constructor.props.table.stashData": "Накопление данных",
|
|
177
176
|
"constructor.props.table.buffersize": "Размер буфера",
|
|
178
177
|
"constructor.props.table.clearButton": "Кнопка очистки",
|
|
@@ -180,6 +179,7 @@ const translations = {
|
|
|
180
179
|
"constructor.props.table.type.buttons": "Кнопки",
|
|
181
180
|
"constructor.props.table.type.select": "Селектор",
|
|
182
181
|
"constructor.props.table.type.icon": "Иконка",
|
|
182
|
+
"constructor.props.table.type.progressbar": "Прогресс",
|
|
183
183
|
"constructor.props.table.timestamp": "Время",
|
|
184
184
|
"constructor.props.table.visibleRows": "Видимые строки",
|
|
185
185
|
"constructor.props.table.logger": "Добавление строк",
|
package/dist/options.js
CHANGED
|
@@ -174,6 +174,7 @@ export const optionsStore = derived(t, ($t) => {
|
|
|
174
174
|
{ id: id(), value: "text", name: $t("constructor.props.table.type.text") },
|
|
175
175
|
{ id: id(), value: "select", name: $t("constructor.props.table.type.select") },
|
|
176
176
|
{ id: id(), value: "buttons", name: $t("constructor.props.table.type.buttons") },
|
|
177
|
+
{ id: id(), value: "progressBar", name: $t("constructor.props.table.type.progressbar") },
|
|
177
178
|
{ id: id(), value: "image", name: $t("constructor.props.table.type.icon") },
|
|
178
179
|
],
|
|
179
180
|
INPUT_SETTING_OPTIONS: [
|
package/dist/types.d.ts
CHANGED
|
@@ -309,7 +309,7 @@ export interface ITableHeader<T extends object> {
|
|
|
309
309
|
key: keyof T;
|
|
310
310
|
width?: string;
|
|
311
311
|
align?: "left" | "center" | "right";
|
|
312
|
-
type?: "buttons" | "select" | "text" | "image";
|
|
312
|
+
type?: "buttons" | "select" | "text" | "image" | "progressBar";
|
|
313
313
|
disableSelect?: boolean;
|
|
314
314
|
text?: {
|
|
315
315
|
sortable?: boolean;
|
|
@@ -319,6 +319,11 @@ export interface ITableHeader<T extends object> {
|
|
|
319
319
|
copy?: boolean;
|
|
320
320
|
modal?: boolean;
|
|
321
321
|
};
|
|
322
|
+
progressBar?: {
|
|
323
|
+
minNum?: number;
|
|
324
|
+
maxNum?: number;
|
|
325
|
+
units?: string;
|
|
326
|
+
};
|
|
322
327
|
buttons?: ITableButtons<T>[] | ((row: T) => ITableButtons<T>[]);
|
|
323
328
|
select?: {
|
|
324
329
|
key: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-svelte-ui-lib",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.22",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"prettier-plugin-svelte": "^3.5.1",
|
|
48
48
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
49
49
|
"publint": "^0.3.18",
|
|
50
|
-
"svelte": "^5.54.
|
|
50
|
+
"svelte": "^5.54.1",
|
|
51
51
|
"tailwindcss": "^4.2.2",
|
|
52
52
|
"tsx": "^4.21.0",
|
|
53
53
|
"typescript": "^5.9.3",
|