poe-svelte-ui-lib 1.0.6 → 1.0.8
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/Accordion.svelte +51 -40
- package/dist/Accordion/AccordionProps.svelte +76 -0
- package/dist/Accordion/AccordionProps.svelte.d.ts +10 -0
- package/dist/Button/Button.svelte +28 -34
- package/dist/Button/ButtonProps.svelte +113 -0
- package/dist/Button/ButtonProps.svelte.d.ts +10 -0
- package/dist/ColorPicker/ColorPicker.svelte +27 -14
- package/dist/ColorPicker/ColorPickerProps.svelte +71 -0
- package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +10 -0
- package/dist/{FileAttach/FileAttach.svelte → FileAttach.svelte} +3 -11
- package/dist/{FileAttach/FileAttach.svelte.d.ts → FileAttach.svelte.d.ts} +1 -1
- package/dist/Graph/Graph.svelte +3 -3
- package/dist/Graph/GraphProps.svelte +41 -0
- package/dist/Graph/GraphProps.svelte.d.ts +10 -0
- package/dist/Input/Input.svelte +42 -48
- package/dist/Input/InputProps.svelte +205 -0
- package/dist/Input/InputProps.svelte.d.ts +10 -0
- package/dist/Modal.svelte +54 -0
- package/dist/Modal.svelte.d.ts +12 -0
- package/dist/ProgressBar/ProgressBar.svelte +23 -21
- package/dist/ProgressBar/ProgressBarProps.svelte +114 -0
- package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +10 -0
- package/dist/Select/Select.svelte +38 -23
- package/dist/Select/SelectProps.svelte +216 -0
- package/dist/Select/SelectProps.svelte.d.ts +10 -0
- package/dist/Slider/Slider.svelte +17 -10
- package/dist/Slider/SliderProps.svelte +113 -0
- package/dist/Slider/SliderProps.svelte.d.ts +10 -0
- package/dist/Switch/Switch.svelte +15 -10
- package/dist/Switch/SwitchProps.svelte +99 -0
- package/dist/Switch/SwitchProps.svelte.d.ts +10 -0
- package/dist/Table/Table.svelte +62 -38
- package/dist/Table/Table.svelte.d.ts +1 -1
- package/dist/Table/TableProps.svelte +233 -0
- package/dist/Table/TableProps.svelte.d.ts +10 -0
- package/dist/TextField/TextField.svelte +15 -9
- package/dist/TextField/TextFieldProps.svelte +44 -44
- package/dist/TextField/TextFieldProps.svelte.d.ts +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.js +12 -3
- package/dist/libIcons/ButtonAdd.svelte +5 -2
- package/dist/libIcons/ButtonDelete.svelte +1 -1
- package/dist/libIcons/CrossIcon.svelte +9 -0
- package/dist/libIcons/CrossIcon.svelte.d.ts +18 -0
- package/dist/locales/translations.js +81 -6
- package/dist/options.d.ts +7 -12
- package/dist/options.js +44 -33
- package/dist/types.d.ts +50 -89
- package/dist/types.js +13 -1
- package/package.json +7 -3
- package/dist/Loader.svelte +0 -12
- package/dist/Loader.svelte.d.ts +0 -5
- package/dist/MessageModal.svelte +0 -54
- package/dist/MessageModal.svelte.d.ts +0 -10
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
<!-- $lib/ElementsUI/TableProps.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { getContext } from 'svelte'
|
|
4
|
+
import { t } from '../locales/i18n'
|
|
5
|
+
import { type UIComponent, type ITableProps, type ITableHeader, updateProperty } from '../types'
|
|
6
|
+
import * as UI from '..'
|
|
7
|
+
import ButtonDelete from '../libIcons/ButtonDelete.svelte'
|
|
8
|
+
import ButtonAdd from '../libIcons/ButtonAdd.svelte'
|
|
9
|
+
import { optionsStore } from '../options'
|
|
10
|
+
|
|
11
|
+
const { component, onPropertyChange } = $props<{
|
|
12
|
+
component: UIComponent & { properties: Partial<ITableProps<object>> }
|
|
13
|
+
onPropertyChange: (value: string | object) => void
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const DeviceVariables = getContext<{ value: string; name: string }[]>('DeviceVariables')
|
|
17
|
+
let VARIABLE_OPTIONS = $derived(
|
|
18
|
+
DeviceVariables && Array.isArray(DeviceVariables)
|
|
19
|
+
? DeviceVariables.map((variable) => ({
|
|
20
|
+
id: variable.name,
|
|
21
|
+
value: variable.value,
|
|
22
|
+
name: `${variable.value} | ${variable.name}`,
|
|
23
|
+
}))
|
|
24
|
+
: [],
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const initialColor = $derived(
|
|
28
|
+
$optionsStore.COLOR_OPTIONS.find((c) =>
|
|
29
|
+
(c.value as string).includes(component.properties.wrapperClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const initialAlign = $derived(
|
|
34
|
+
$optionsStore.ALIGN_OPTIONS.find((a) =>
|
|
35
|
+
(a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
const updateTableHeader = (index: number, field: string, value: any) => {
|
|
40
|
+
const headers = [...component.properties.header]
|
|
41
|
+
headers[index] = { ...headers[index], [field]: value }
|
|
42
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const updateButtonProperty = (columnIndex: number, buttonIndex: number, field: string, value: any) => {
|
|
46
|
+
const headers = [...component.properties.header]
|
|
47
|
+
const buttons = [...headers[columnIndex].buttons]
|
|
48
|
+
buttons[buttonIndex] = { ...buttons[buttonIndex], [field]: value }
|
|
49
|
+
headers[columnIndex].buttons = buttons
|
|
50
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const removeButtonFromColumn = (columnIndex: number, buttonIndex: number) => {
|
|
54
|
+
const headers = [...component.properties.header]
|
|
55
|
+
const buttons = [...headers[columnIndex].buttons]
|
|
56
|
+
buttons.splice(buttonIndex, 1)
|
|
57
|
+
headers[columnIndex].buttons = buttons.length ? buttons : undefined
|
|
58
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
{#if component && component.properties}
|
|
63
|
+
<div class="relative flex flex-row items-start justify-center">
|
|
64
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
65
|
+
<UI.Select
|
|
66
|
+
label={{ name: $t('constructor.props.variable') }}
|
|
67
|
+
options={VARIABLE_OPTIONS}
|
|
68
|
+
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id.value)}
|
|
69
|
+
onUpdate={(value) => {
|
|
70
|
+
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
71
|
+
updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
76
|
+
<UI.Select
|
|
77
|
+
wrapperClass="!h-14"
|
|
78
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
79
|
+
type="buttons"
|
|
80
|
+
options={$optionsStore.COLOR_OPTIONS}
|
|
81
|
+
value={initialColor}
|
|
82
|
+
onUpdate={(option) => updateProperty('wrapperClass', `${component.properties.wrapperClass} ${option.value}`, component, onPropertyChange)}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
86
|
+
<UI.Input
|
|
87
|
+
label={{ name: $t('constructor.props.label') }}
|
|
88
|
+
value={component.properties.label.name}
|
|
89
|
+
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
90
|
+
/>
|
|
91
|
+
<UI.Select
|
|
92
|
+
label={{ name: $t('constructor.props.align') }}
|
|
93
|
+
type="buttons"
|
|
94
|
+
value={initialAlign}
|
|
95
|
+
options={$optionsStore.ALIGN_OPTIONS}
|
|
96
|
+
onUpdate={(option) => updateProperty('label.class', `${component.properties.label.class} ${option.value}`, component, onPropertyChange)}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<hr class="border-[var(--border-color)]" />
|
|
102
|
+
|
|
103
|
+
<!-- Настройки столбцов таблицы -->
|
|
104
|
+
<div class="space-y-4">
|
|
105
|
+
<div class="m-0 flex items-center justify-center gap-2">
|
|
106
|
+
<h4>{$t('constructor.props.table.columns')}</h4>
|
|
107
|
+
<UI.Button
|
|
108
|
+
wrapperClass="!w-10"
|
|
109
|
+
content={{ icon: ButtonAdd }}
|
|
110
|
+
componentClass="bg-transparent h-10 border-none !shadow-none hover:shadow-none"
|
|
111
|
+
onClick={() => {
|
|
112
|
+
const newColumn: ITableHeader<any> = {
|
|
113
|
+
key: `column${(component.properties.header?.length || 0) + 1}`,
|
|
114
|
+
label: { name: `Column ${(component.properties.header?.length || 0) + 1}`, class: '' },
|
|
115
|
+
width: '100px',
|
|
116
|
+
sortable: false,
|
|
117
|
+
}
|
|
118
|
+
const headers = [...(component.properties.header || []), newColumn]
|
|
119
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
{#each component.properties.header as column, columnIndex (columnIndex)}
|
|
125
|
+
<div class="m-0 flex items-end justify-around gap-2">
|
|
126
|
+
<UI.Input
|
|
127
|
+
label={{ name: $t('constructor.props.table.columns.key') }}
|
|
128
|
+
wrapperClass="!w-2/10"
|
|
129
|
+
value={column.key}
|
|
130
|
+
help={{ regExp: /^[0-9a-zA-Z_-]{0,16}$/ }}
|
|
131
|
+
onUpdate={(value) => updateTableHeader(columnIndex, 'key', value)}
|
|
132
|
+
/>
|
|
133
|
+
<UI.Input
|
|
134
|
+
label={{ name: $t('constructor.props.table.columns.label') }}
|
|
135
|
+
wrapperClass="!w-2/10"
|
|
136
|
+
value={column.label.name}
|
|
137
|
+
onUpdate={(value) => updateTableHeader(columnIndex, 'label.name', value)}
|
|
138
|
+
/>
|
|
139
|
+
<UI.Input
|
|
140
|
+
label={{ name: $t('constructor.props.table.columns.width') }}
|
|
141
|
+
wrapperClass="!w-2/10"
|
|
142
|
+
value={column.width}
|
|
143
|
+
onUpdate={(value) => updateTableHeader(columnIndex, 'width', value)}
|
|
144
|
+
/>
|
|
145
|
+
<UI.Switch
|
|
146
|
+
wrapperClass="!w-1/10 bg-blue"
|
|
147
|
+
label={{ name: $t('constructor.props.table.columns.sortable') }}
|
|
148
|
+
value={column.sortable ? 2 : 1}
|
|
149
|
+
onChange={(value) => updateTableHeader(columnIndex, 'sortable', value === 2)}
|
|
150
|
+
/>
|
|
151
|
+
<UI.Button
|
|
152
|
+
wrapperClass="w-10"
|
|
153
|
+
content={{ icon: ButtonAdd, info: $t('constructor.props.table.addaction') }}
|
|
154
|
+
componentClass="bg-transparent h-10 w-10 border-none !shadow-none hover:shadow-none"
|
|
155
|
+
onClick={() => {
|
|
156
|
+
const newButton = {
|
|
157
|
+
name: `button${(component.properties.header[columnIndex].buttons.length || 0) + 1}`,
|
|
158
|
+
class: 'bg-blue',
|
|
159
|
+
eventHandler: { Header: 'SET', Argument: 'Save', Variables: [] },
|
|
160
|
+
onClick: () => {},
|
|
161
|
+
}
|
|
162
|
+
const buttons = [...(component.properties.header[columnIndex].buttons || []), newButton]
|
|
163
|
+
updateTableHeader(columnIndex, 'buttons', buttons)
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
<UI.Button
|
|
167
|
+
wrapperClass="w-10"
|
|
168
|
+
content={{ icon: ButtonDelete, info: $t('constructor.props.table.deletecolumn') }}
|
|
169
|
+
componentClass=" bg-transparent h-10 w-10 border-none !shadow-none hover:shadow-none"
|
|
170
|
+
onClick={() => {
|
|
171
|
+
const headers = [...(component.properties.header || [])]
|
|
172
|
+
headers.splice(columnIndex, 1)
|
|
173
|
+
updateProperty('header', headers, component, onPropertyChange)
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
{#if column.buttons && column.buttons.length > 0}
|
|
178
|
+
<div class="mb-5 rounded-lg p-1">
|
|
179
|
+
{#each column.buttons as button, buttonIndex (buttonIndex)}
|
|
180
|
+
<div class="mx-14 flex items-end justify-around gap-2">
|
|
181
|
+
<UI.Input
|
|
182
|
+
label={{ name: $t('constructor.props.name') }}
|
|
183
|
+
wrapperClass="!w-3/10"
|
|
184
|
+
value={button.name}
|
|
185
|
+
onUpdate={(value) => updateButtonProperty(columnIndex, buttonIndex, 'name', value)}
|
|
186
|
+
/>
|
|
187
|
+
<UI.Select
|
|
188
|
+
wrapperClass="!w-2/10"
|
|
189
|
+
label={{ name: $t('constructor.props.header') }}
|
|
190
|
+
type="buttons"
|
|
191
|
+
value={$optionsStore.HEADER_OPTIONS.find((h) => h.value === button.eventHandler?.Header)}
|
|
192
|
+
options={$optionsStore.HEADER_OPTIONS}
|
|
193
|
+
onUpdate={(option) => {
|
|
194
|
+
const handler = button.eventHandler
|
|
195
|
+
handler.Header = option.value as string
|
|
196
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
<UI.Input
|
|
200
|
+
wrapperClass="!w-2/10"
|
|
201
|
+
label={{ name: $t('constructor.props.argument') }}
|
|
202
|
+
value={button.eventHandler?.Argument}
|
|
203
|
+
onUpdate={(value) => {
|
|
204
|
+
const handler = button.eventHandler
|
|
205
|
+
handler.Argument = value as string
|
|
206
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
209
|
+
<UI.Input
|
|
210
|
+
wrapperClass="!w-2/10"
|
|
211
|
+
label={{ name: $t('constructor.props.table.keys') }}
|
|
212
|
+
value={button.eventHandler?.Variables.join(' ')}
|
|
213
|
+
maxlength={500}
|
|
214
|
+
help={{ info: $t('constructor.props.table.keys.info'), regExp: /^[a-zA-Z0-9\-_ ]{0,500}$/ }}
|
|
215
|
+
onUpdate={(value) => {
|
|
216
|
+
const handler = { ...button.eventHandler }
|
|
217
|
+
handler.Variables = (value as string).trim().split(/\s+/)
|
|
218
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
<UI.Button
|
|
222
|
+
wrapperClass="w-10 m"
|
|
223
|
+
content={{ icon: ButtonDelete }}
|
|
224
|
+
componentClass="bg-transparent h-10 w-10 border-none !shadow-none hover:shadow-none"
|
|
225
|
+
onClick={() => removeButtonFromColumn(columnIndex, buttonIndex)}
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
{/each}
|
|
229
|
+
</div>
|
|
230
|
+
{/if}
|
|
231
|
+
{/each}
|
|
232
|
+
</div>
|
|
233
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type UIComponent, type ITableProps } from '../types';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
component: UIComponent & {
|
|
4
|
+
properties: Partial<ITableProps<object>>;
|
|
5
|
+
};
|
|
6
|
+
onPropertyChange: (value: string | object) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const TableProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type TableProps = ReturnType<typeof TableProps>;
|
|
10
|
+
export default TableProps;
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { twMerge } from 'tailwind-merge'
|
|
2
3
|
import type { ITextFieldProps } from '../types'
|
|
3
4
|
|
|
4
|
-
let { id = crypto.randomUUID(), wrapperClass = '',
|
|
5
|
+
let { id = crypto.randomUUID(), wrapperClass = '', background = false, content = { name: '', class: '', size: 'base' } }: ITextFieldProps = $props()
|
|
5
6
|
|
|
6
7
|
const textSize = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
large: 'text-xl',
|
|
11
|
-
xlarge: 'text-2xl',
|
|
12
|
-
xxlarge: 'text-3xl',
|
|
8
|
+
small: 'text-sm',
|
|
9
|
+
base: 'text-base',
|
|
10
|
+
large: 'text-2xl',
|
|
13
11
|
huge: 'text-4xl',
|
|
14
12
|
massive: 'text-5xl',
|
|
15
13
|
} as const
|
|
16
14
|
</script>
|
|
17
15
|
|
|
18
|
-
<div
|
|
19
|
-
|
|
16
|
+
<div
|
|
17
|
+
{id}
|
|
18
|
+
class="{twMerge(
|
|
19
|
+
`relative flex w-full flex-col items-center ${background ? 'rounded-2xl bg-[var(--container-color)] px-6 py-2' : ''}`,
|
|
20
|
+
wrapperClass,
|
|
21
|
+
)} "
|
|
22
|
+
>
|
|
23
|
+
<p class={twMerge(`w-full text-center ${textSize[content.size ?? 'base']}`, content.class)}>
|
|
24
|
+
{content.name}
|
|
25
|
+
</p>
|
|
20
26
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- $lib/ElementsUI/GridAccordionProps.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { t } from '../locales/i18n'
|
|
4
|
-
import type
|
|
4
|
+
import { updateProperty, type ITextFieldProps, type UIComponent } from '../types'
|
|
5
5
|
import * as UI from '../index'
|
|
6
6
|
import { optionsStore } from '../options'
|
|
7
7
|
|
|
@@ -10,41 +10,20 @@
|
|
|
10
10
|
onPropertyChange: (value: string | object) => void
|
|
11
11
|
}>()
|
|
12
12
|
|
|
13
|
-
let currentType = $derived($optionsStore.TEXTFIELD_SIZE_OPTIONS.find((t) => t.value === component.properties.
|
|
13
|
+
let currentType = $derived($optionsStore.TEXTFIELD_SIZE_OPTIONS.find((t) => t.value === component.properties.content.size))
|
|
14
14
|
|
|
15
15
|
const initialAlign = $derived(
|
|
16
16
|
$optionsStore.ALIGN_OPTIONS.find((a) =>
|
|
17
|
-
(a.value as string).includes(component.properties.
|
|
17
|
+
(a.value as string).includes(component.properties.content?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
18
18
|
),
|
|
19
19
|
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (align) {
|
|
28
|
-
labelClass += ` ${align}`
|
|
29
|
-
}
|
|
30
|
-
updateProperty('label.class', labelClass)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/* Обновление свойства */
|
|
34
|
-
const updateProperty = (path: string, value: string | object | boolean) => {
|
|
35
|
-
const newProperties = JSON.parse(JSON.stringify(component.properties))
|
|
36
|
-
const parts = path.split('.')
|
|
37
|
-
let obj = newProperties
|
|
38
|
-
|
|
39
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
40
|
-
const part = parts[i]
|
|
41
|
-
if (!obj[part]) obj[part] = {}
|
|
42
|
-
obj = obj[part]
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
obj[parts[parts.length - 1]] = value
|
|
46
|
-
onPropertyChange(newProperties)
|
|
47
|
-
}
|
|
20
|
+
const initialColor = $derived(
|
|
21
|
+
$optionsStore.TEXT_COLOR_OPTIONS.find((c) =>
|
|
22
|
+
(c.value as string).includes(component.properties.wrapperClass?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
23
|
+
),
|
|
24
|
+
)
|
|
25
|
+
const initialBold = $derived(component.properties.content?.class?.split(' ').find((cls: string) => cls.startsWith('font-bold')))
|
|
26
|
+
const initialItalic = $derived(component.properties.content?.class?.split(' ').find((cls: string) => cls.startsWith('italic')))
|
|
48
27
|
</script>
|
|
49
28
|
|
|
50
29
|
{#if component && component.properties}
|
|
@@ -52,40 +31,61 @@
|
|
|
52
31
|
<div class="flex w-1/3 flex-col px-2">
|
|
53
32
|
<UI.Input
|
|
54
33
|
label={{ name: $t('constructor.props.label') }}
|
|
55
|
-
value={component.properties.
|
|
56
|
-
onUpdate={(value) => updateProperty('
|
|
57
|
-
type="text"
|
|
34
|
+
value={component.properties.content.name}
|
|
35
|
+
onUpdate={(value) => updateProperty('content.name', value as string, component, onPropertyChange)}
|
|
58
36
|
/>
|
|
59
37
|
<UI.Select
|
|
60
|
-
label={{ name: $t('constructor.props.
|
|
38
|
+
label={{ name: $t('constructor.props.size') }}
|
|
61
39
|
type="buttons"
|
|
62
40
|
value={currentType}
|
|
63
41
|
options={$optionsStore.TEXTFIELD_SIZE_OPTIONS}
|
|
64
|
-
onUpdate={(item) => updateProperty('
|
|
42
|
+
onUpdate={(item) => updateProperty('content.size', item.value as string, component, onPropertyChange)}
|
|
65
43
|
/>
|
|
66
44
|
</div>
|
|
67
45
|
<div class="flex w-1/3 flex-col px-2">
|
|
68
46
|
<UI.Select
|
|
69
|
-
wrapperClass="w-full"
|
|
70
47
|
label={{ name: $t('constructor.props.align') }}
|
|
71
48
|
type="buttons"
|
|
72
49
|
value={initialAlign}
|
|
73
50
|
options={$optionsStore.ALIGN_OPTIONS}
|
|
74
|
-
onUpdate={(option) =>
|
|
51
|
+
onUpdate={(option) => updateProperty('content.class', `${component.properties.content.class} ${option.value}`, component, onPropertyChange)}
|
|
52
|
+
/>
|
|
53
|
+
<UI.Select
|
|
54
|
+
wrapperClass="!h-14"
|
|
55
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
56
|
+
type="buttons"
|
|
57
|
+
options={$optionsStore.TEXT_COLOR_OPTIONS}
|
|
58
|
+
value={initialColor}
|
|
59
|
+
onUpdate={(option) => updateProperty('wrapperClass', `${component.properties.wrapperClass} ${option.value}`, component, onPropertyChange)}
|
|
75
60
|
/>
|
|
76
61
|
</div>
|
|
77
62
|
<div class="flex w-1/3 flex-col px-2">
|
|
78
63
|
<UI.Switch
|
|
79
|
-
wrapperClass="w-full bg-blue"
|
|
80
64
|
label={{ name: $t('constructor.props.bold') }}
|
|
81
|
-
value={
|
|
82
|
-
onChange={(value) =>
|
|
65
|
+
value={initialBold ? 2 : 1}
|
|
66
|
+
onChange={(value) =>
|
|
67
|
+
updateProperty(
|
|
68
|
+
'content.class',
|
|
69
|
+
`${component.properties.content.class} ${value === 2 ? 'font-bold' : 'font-normal'}`,
|
|
70
|
+
component,
|
|
71
|
+
onPropertyChange,
|
|
72
|
+
)}
|
|
83
73
|
/>
|
|
84
74
|
<UI.Switch
|
|
85
|
-
wrapperClass="w-full bg-blue"
|
|
86
75
|
label={{ name: $t('constructor.props.italic') }}
|
|
87
|
-
value={
|
|
88
|
-
onChange={(value) =>
|
|
76
|
+
value={initialItalic ? 2 : 1}
|
|
77
|
+
onChange={(value) =>
|
|
78
|
+
updateProperty(
|
|
79
|
+
'content.class',
|
|
80
|
+
`${component.properties.content.class} ${value === 2 ? 'italic' : 'not-italic'}`,
|
|
81
|
+
component,
|
|
82
|
+
onPropertyChange,
|
|
83
|
+
)}
|
|
84
|
+
/>
|
|
85
|
+
<UI.Switch
|
|
86
|
+
label={{ name: $t('constructor.props.background') }}
|
|
87
|
+
value={component.properties.background ? 2 : 1}
|
|
88
|
+
onChange={(value) => updateProperty('background', value === 2, component, onPropertyChange)}
|
|
89
89
|
/>
|
|
90
90
|
</div>
|
|
91
91
|
</div>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
export { default as Accordion } from './Accordion/Accordion.svelte';
|
|
2
|
+
export { default as AccordionProps } from './Accordion/AccordionProps.svelte';
|
|
2
3
|
export { default as Button } from './Button/Button.svelte';
|
|
4
|
+
export { default as ButtonProps } from './Button/ButtonProps.svelte';
|
|
3
5
|
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
4
|
-
export { default as
|
|
6
|
+
export { default as ColorPickerProps } from './ColorPicker/ColorPickerProps.svelte';
|
|
7
|
+
export { default as FileAttach } from './FileAttach.svelte';
|
|
5
8
|
export { default as Graph } from './Graph/Graph.svelte';
|
|
9
|
+
export { default as GraphProps } from './Graph/GraphProps.svelte';
|
|
6
10
|
export { default as Input } from './Input/Input.svelte';
|
|
11
|
+
export { default as InputProps } from './Input/InputProps.svelte';
|
|
12
|
+
export { default as Modal } from './Modal.svelte';
|
|
7
13
|
export { default as ProgressBar } from './ProgressBar/ProgressBar.svelte';
|
|
14
|
+
export { default as ProgressBarProps } from './ProgressBar/ProgressBarProps.svelte';
|
|
8
15
|
export { default as Select } from './Select/Select.svelte';
|
|
16
|
+
export { default as SelectProps } from './Select/SelectProps.svelte';
|
|
9
17
|
export { default as Slider } from './Slider/Slider.svelte';
|
|
18
|
+
export { default as SliderProps } from './Slider/SliderProps.svelte';
|
|
10
19
|
export { default as Switch } from './Switch/Switch.svelte';
|
|
20
|
+
export { default as SwitchProps } from './Switch/SwitchProps.svelte';
|
|
11
21
|
export { default as Table } from './Table/Table.svelte';
|
|
22
|
+
export { default as TableProps } from './Table/TableProps.svelte';
|
|
12
23
|
export { default as TextField } from './TextField/TextField.svelte';
|
|
13
24
|
export { default as TextFieldProps } from './TextField/TextFieldProps.svelte';
|
|
14
|
-
export { default as Loader } from './Loader.svelte';
|
|
15
|
-
export { default as MessageModal } from './MessageModal.svelte';
|
|
16
25
|
export { type UIComponent, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type ISelectOption, type ISwitchProps, type IColorPickerProps, type ISliderProps, type ITextFieldProps, type IProgressBarProps, type IGraphProps, type IGraphDataObject, type ITableHeader, type ITableProps, } from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
/* Реэкспорт всех UI компонентов для удобного импорта */
|
|
2
2
|
export { default as Accordion } from './Accordion/Accordion.svelte';
|
|
3
|
+
export { default as AccordionProps } from './Accordion/AccordionProps.svelte';
|
|
3
4
|
export { default as Button } from './Button/Button.svelte';
|
|
5
|
+
export { default as ButtonProps } from './Button/ButtonProps.svelte';
|
|
4
6
|
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
5
|
-
export { default as
|
|
7
|
+
export { default as ColorPickerProps } from './ColorPicker/ColorPickerProps.svelte';
|
|
8
|
+
export { default as FileAttach } from './FileAttach.svelte';
|
|
6
9
|
export { default as Graph } from './Graph/Graph.svelte';
|
|
10
|
+
export { default as GraphProps } from './Graph/GraphProps.svelte';
|
|
7
11
|
export { default as Input } from './Input/Input.svelte';
|
|
12
|
+
export { default as InputProps } from './Input/InputProps.svelte';
|
|
13
|
+
export { default as Modal } from './Modal.svelte';
|
|
8
14
|
export { default as ProgressBar } from './ProgressBar/ProgressBar.svelte';
|
|
15
|
+
export { default as ProgressBarProps } from './ProgressBar/ProgressBarProps.svelte';
|
|
9
16
|
export { default as Select } from './Select/Select.svelte';
|
|
17
|
+
export { default as SelectProps } from './Select/SelectProps.svelte';
|
|
10
18
|
export { default as Slider } from './Slider/Slider.svelte';
|
|
19
|
+
export { default as SliderProps } from './Slider/SliderProps.svelte';
|
|
11
20
|
export { default as Switch } from './Switch/Switch.svelte';
|
|
21
|
+
export { default as SwitchProps } from './Switch/SwitchProps.svelte';
|
|
12
22
|
export { default as Table } from './Table/Table.svelte';
|
|
23
|
+
export { default as TableProps } from './Table/TableProps.svelte';
|
|
13
24
|
export { default as TextField } from './TextField/TextField.svelte';
|
|
14
25
|
export { default as TextFieldProps } from './TextField/TextFieldProps.svelte';
|
|
15
|
-
export { default as Loader } from './Loader.svelte';
|
|
16
|
-
export { default as MessageModal } from './MessageModal.svelte';
|
|
17
26
|
export {} from './types';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="
|
|
4
|
-
><path
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"
|
|
4
|
+
><path
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
d="M12.75 9a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25V15a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25z"
|
|
7
|
+
/><path
|
|
5
8
|
fill="currentColor"
|
|
6
9
|
fill-rule="evenodd"
|
|
7
10
|
d="M12.057 1.25h-.114c-2.309 0-4.118 0-5.53.19c-1.444.194-2.584.6-3.479 1.494c-.895.895-1.3 2.035-1.494 3.48c-.19 1.411-.19 3.22-.19 5.529v.114c0 2.309 0 4.118.19 5.53c.194 1.444.6 2.584 1.494 3.479c.895.895 2.035 1.3 3.48 1.494c1.411.19 3.22.19 5.529.19h.114c2.309 0 4.118 0 5.53-.19c1.444-.194 2.584-.6 3.479-1.494c.895-.895 1.3-2.035 1.494-3.48c.19-1.411.19-3.22.19-5.529v-.114c0-2.309 0-4.118-.19-5.53c-.194-1.444-.6-2.584-1.494-3.479c-.895-.895-2.035-1.3-3.48-1.494c-1.411-.19-3.22-.19-5.529-.19M3.995 3.995c.57-.57 1.34-.897 2.619-1.069c1.3-.174 3.008-.176 5.386-.176s4.086.002 5.386.176c1.279.172 2.05.5 2.62 1.069c.569.57.896 1.34 1.068 2.619c.174 1.3.176 3.008.176 5.386s-.002 4.086-.176 5.386c-.172 1.279-.5 2.05-1.069 2.62c-.57.569-1.34.896-2.619 1.068c-1.3.174-3.008.176-5.386.176s-4.086-.002-5.386-.176c-1.279-.172-2.05-.5-2.62-1.069c-.569-.57-.896-1.34-1.068-2.619c-.174-1.3-.176-3.008-.176-5.386s.002-4.086.176-5.386c.172-1.279.5-2.05 1.069-2.62"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24"
|
|
4
|
+
><g fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"
|
|
5
|
+
><path d="M5.47 5.47a.75.75 0 0 1 1.06 0l12 12a.75.75 0 1 1-1.06 1.06l-12-12a.75.75 0 0 1 0-1.06" /><path
|
|
6
|
+
d="M18.53 5.47a.75.75 0 0 1 0 1.06l-12 12a.75.75 0 0 1-1.06-1.06l12-12a.75.75 0 0 1 1.06 0"
|
|
7
|
+
/></g
|
|
8
|
+
></svg
|
|
9
|
+
>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const CrossIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type CrossIcon = InstanceType<typeof CrossIcon>;
|
|
18
|
+
export default CrossIcon;
|
|
@@ -1,16 +1,91 @@
|
|
|
1
1
|
const translations = {
|
|
2
2
|
ru: {
|
|
3
|
+
'common.select_tag': 'Сделайте выбор',
|
|
4
|
+
'debug.baud_rate_data': 'Данные',
|
|
5
|
+
/* Опции рeдактора свойств */
|
|
6
|
+
'constructor.props.action.update': 'Обновить',
|
|
7
|
+
'constructor.props.action.save': 'Сохранить',
|
|
8
|
+
'constructor.props.action.nosend': 'Без отправки',
|
|
9
|
+
'constructor.props.action.custom': 'Свой аргумент',
|
|
10
|
+
'constructor.props.height.small': 'Авто',
|
|
11
|
+
'constructor.props.height.medium': 'Средняя',
|
|
12
|
+
'constructor.props.height.large': 'Большая',
|
|
13
|
+
'constructor.props.align.left': 'Слева',
|
|
14
|
+
'constructor.props.align.center': 'По центру',
|
|
15
|
+
'constructor.props.align.right': 'Справа',
|
|
16
|
+
'constructor.props.type.main': 'Основной',
|
|
17
|
+
'constructor.props.type.sub': 'Вложенный',
|
|
18
|
+
'constructor.props.type.text': 'Текст',
|
|
19
|
+
'constructor.props.type.password': 'Пароль',
|
|
20
|
+
'constructor.props.type.number': 'Число',
|
|
21
|
+
'constructor.props.type.textarea': 'Область ',
|
|
22
|
+
'constructor.props.type.single': 'Простой',
|
|
23
|
+
'constructor.props.type.range': 'Диапазон',
|
|
24
|
+
'constructor.props.type.small': 'XS',
|
|
25
|
+
'constructor.props.type.base': 'S',
|
|
26
|
+
'constructor.props.type.large': 'M',
|
|
27
|
+
'constructor.props.type.huge': 'L',
|
|
28
|
+
'constructor.props.type.massive': 'XL',
|
|
29
|
+
'constructor.props.type.select': 'Список',
|
|
30
|
+
'constructor.props.type.buttons': 'Группа кнопок',
|
|
31
|
+
'constructor.props.type.selectput': 'Список+ввод',
|
|
32
|
+
'constructor.props.valuetype.text': 'Строка',
|
|
33
|
+
'constructor.props.valuetype.number': 'Число',
|
|
34
|
+
/* Общие для редактора свойств */
|
|
3
35
|
'constructor.props.label': 'Текст надписи',
|
|
4
36
|
'constructor.props.type': 'Тип',
|
|
37
|
+
'constructor.props.size': 'Размер',
|
|
38
|
+
'constructor.props.header': 'Заголовок пакета',
|
|
39
|
+
'constructor.props.argument': 'Аргумент',
|
|
40
|
+
'constructor.props.argument.info': 'Пользовтельский аргумент (a-z, A-Z, 0-9, -_!)',
|
|
41
|
+
'constructor.props.variables': 'Перечень переменных',
|
|
42
|
+
'constructor.props.variables.info': 'Поле для ввода имён переменных, разделенных пробелами',
|
|
43
|
+
'constructor.props.value': 'Значение',
|
|
44
|
+
'constructor.props.value.info': 'Поле для ввода Value пакета',
|
|
5
45
|
'constructor.props.align': 'Выравнивание',
|
|
46
|
+
'constructor.props.image': 'Фоновое изображение',
|
|
47
|
+
'constructor.props.removeimage': 'Удалить изображение',
|
|
48
|
+
'constructor.props.name': 'Текст',
|
|
49
|
+
'constructor.props.height': 'Высота',
|
|
50
|
+
'constructor.props.colors': 'Цвет фона',
|
|
51
|
+
'constructor.props.maxlenght': 'Максимальная длина',
|
|
52
|
+
'constructor.props.regexp': 'Выражение валидации',
|
|
53
|
+
'constructor.props.regexp.info': 'Введите RegExp без /.../ (например: ^\\d+$)',
|
|
54
|
+
'constructor.props.minnum': 'Минимальное значение',
|
|
55
|
+
'constructor.props.maxnum': 'Максимальное значение',
|
|
56
|
+
'constructor.props.step': 'Шаг',
|
|
57
|
+
'constructor.props.rows': 'Количество строк',
|
|
58
|
+
'constructor.props.placeholder': 'Заполнитель',
|
|
59
|
+
'constructor.props.info': 'Подсказка',
|
|
60
|
+
'constructor.props.disabled': 'Отключить',
|
|
61
|
+
'constructor.props.readonly': 'Только для чтения',
|
|
62
|
+
'constructor.props.variable': 'Имя переменной',
|
|
63
|
+
'constructor.props.widthMode': 'Ширина кнопок',
|
|
64
|
+
'constructor.props.options.title': 'Опции компонента',
|
|
65
|
+
'constructor.props.valuetype': 'Тип значения',
|
|
66
|
+
'constructor.props.action': 'Действие при переключении',
|
|
67
|
+
'constructor.props.caption.left': 'Надпись слева',
|
|
68
|
+
'constructor.props.caption.right': 'Надпись справа',
|
|
6
69
|
'constructor.props.bold': 'Жирный',
|
|
7
70
|
'constructor.props.italic': 'Курсив',
|
|
8
|
-
'constructor.props.
|
|
9
|
-
'constructor.props.
|
|
10
|
-
'constructor.props.
|
|
11
|
-
'constructor.props.
|
|
12
|
-
'constructor.props.
|
|
13
|
-
'constructor.props.
|
|
71
|
+
'constructor.props.background': 'Фон',
|
|
72
|
+
'constructor.props.min': 'Минимальное значение',
|
|
73
|
+
'constructor.props.max': 'Максимальное значение',
|
|
74
|
+
'constructor.props.units': 'Единица измерения',
|
|
75
|
+
'constructor.props.optionclass': 'Стили кнопки',
|
|
76
|
+
'constructor.props.optionvalue': 'Значение',
|
|
77
|
+
'constructor.props.optionname': 'Текст',
|
|
78
|
+
'constructor.props.copy': 'Копирование',
|
|
79
|
+
'constructor.props.table.columns': 'Колонки таблицы',
|
|
80
|
+
'constructor.props.table.columns.key': 'Имя ключа',
|
|
81
|
+
'constructor.props.table.columns.label': 'Название',
|
|
82
|
+
'constructor.props.table.columns.width': 'Ширина',
|
|
83
|
+
'constructor.props.table.columns.sortable': 'Сортировка',
|
|
84
|
+
'constructor.props.table.deletecolumn': 'Удалить колонку',
|
|
85
|
+
'constructor.props.table.deletebutton': 'Удалить кнопку',
|
|
86
|
+
'constructor.props.table.addaction': 'Добавить кнопку',
|
|
87
|
+
'constructor.props.table.keys': 'Перечень ключей',
|
|
88
|
+
'constructor.props.table.keys.info': 'Ключи таблицы, значения которых будут возвращаться',
|
|
14
89
|
},
|
|
15
90
|
en: {},
|
|
16
91
|
zh: {},
|