poe-svelte-ui-lib 0.1.0 → 0.3.0
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 +53 -0
- package/dist/Accordion/Accordion.svelte.d.ts +14 -0
- package/dist/Accordion/AccordionProps.svelte +70 -0
- package/dist/Accordion/AccordionProps.svelte.d.ts +14 -0
- package/{src/lib → dist/Button}/Button.svelte +34 -45
- package/dist/Button/Button.svelte.d.ts +14 -0
- package/dist/Button/ButtonProps.svelte +200 -0
- package/dist/Button/ButtonProps.svelte.d.ts +14 -0
- package/dist/ColorPicker/ColorPicker.svelte +207 -0
- package/dist/ColorPicker/ColorPicker.svelte.d.ts +14 -0
- package/dist/ColorPicker/ColorPickerProps.svelte +100 -0
- package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +14 -0
- package/dist/FileAttach/FileAttach.svelte +103 -0
- package/dist/FileAttach/FileAttach.svelte.d.ts +14 -0
- package/dist/Graph/Graph.svelte +270 -0
- package/dist/Graph/Graph.svelte.d.ts +14 -0
- package/dist/Graph/GraphProps.svelte +56 -0
- package/dist/Graph/GraphProps.svelte.d.ts +14 -0
- package/dist/Input/Input.svelte +239 -0
- package/dist/Input/Input.svelte.d.ts +14 -0
- package/dist/Input/InputProps.svelte +221 -0
- package/dist/Input/InputProps.svelte.d.ts +14 -0
- package/dist/Loader.svelte +12 -0
- package/dist/Loader.svelte.d.ts +14 -0
- package/dist/MessageModal.svelte +54 -0
- package/dist/MessageModal.svelte.d.ts +14 -0
- package/dist/ProgressBar/ProgressBar.svelte +48 -0
- package/dist/ProgressBar/ProgressBar.svelte.d.ts +14 -0
- package/dist/ProgressBar/ProgressBarProps.svelte +145 -0
- package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +14 -0
- package/dist/Select/Select.svelte +187 -0
- package/dist/Select/Select.svelte.d.ts +14 -0
- package/dist/Select/SelectProps.svelte +260 -0
- package/dist/Select/SelectProps.svelte.d.ts +14 -0
- package/dist/Slider/Slider.svelte +260 -0
- package/dist/Slider/Slider.svelte.d.ts +14 -0
- package/dist/Slider/SliderProps.svelte +161 -0
- package/dist/Slider/SliderProps.svelte.d.ts +14 -0
- package/dist/Switch/Switch.svelte +83 -0
- package/dist/Switch/Switch.svelte.d.ts +14 -0
- package/dist/Switch/SwitchProps.svelte +144 -0
- package/dist/Switch/SwitchProps.svelte.d.ts +14 -0
- package/dist/Table/Table.svelte +276 -0
- package/dist/Table/Table.svelte.d.ts +14 -0
- package/dist/Table/TableProps.svelte +286 -0
- package/dist/Table/TableProps.svelte.d.ts +14 -0
- package/dist/TextField/TextField.svelte +22 -0
- package/dist/TextField/TextField.svelte.d.ts +14 -0
- package/dist/TextField/TextFieldProps.svelte +92 -0
- package/dist/TextField/TextFieldProps.svelte.d.ts +14 -0
- package/dist/appIcons/ButtonAdd.svelte +10 -0
- package/dist/appIcons/ButtonAdd.svelte.d.ts +14 -0
- package/dist/appIcons/ButtonDelete.svelte +13 -0
- package/dist/appIcons/ButtonDelete.svelte.d.ts +14 -0
- package/dist/appIcons/LoaderRotate.svelte +9 -0
- package/dist/appIcons/LoaderRotate.svelte.d.ts +14 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +26 -0
- package/dist/locales/CircleFlagsEn.svelte +14 -0
- package/dist/locales/CircleFlagsEn.svelte.d.ts +23 -0
- package/dist/locales/CircleFlagsRu.svelte +8 -0
- package/dist/locales/CircleFlagsRu.svelte.d.ts +23 -0
- package/dist/locales/CircleFlagsZh.svelte +8 -0
- package/dist/locales/CircleFlagsZh.svelte.d.ts +23 -0
- package/dist/locales/i18n.d.ts +10 -0
- package/dist/locales/i18n.js +36 -0
- package/dist/locales/translations.d.ts +7 -0
- package/dist/locales/translations.js +450 -0
- package/dist/options.d.ts +78 -0
- package/dist/options.js +71 -0
- package/dist/types.d.ts +284 -0
- package/dist/types.js +1 -0
- package/package.json +44 -34
- package/dist/svelte-ui-lib.es.js +0 -1451
- package/dist/svelte-ui-lib.umd.js +0 -9
- package/src/lib/index.ts +0 -2
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
<!-- $lib/ElementsUI/TableProps.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { getContext } from 'svelte'
|
|
4
|
+
import { t } from '../locales/i18n'
|
|
5
|
+
import type { UIComponent, ITableProps, ITableHeader } from '../types'
|
|
6
|
+
import * as UI from '../index'
|
|
7
|
+
import ButtonDelete from '../appIcons/ButtonDelete.svelte'
|
|
8
|
+
import ButtonAdd from '../appIcons/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.map((variable: { value: string; name: string }) => ({
|
|
19
|
+
id: variable.name,
|
|
20
|
+
value: variable.value,
|
|
21
|
+
name: `${variable.value} | ${variable.name}`,
|
|
22
|
+
})),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const initialColor = $derived(
|
|
26
|
+
$optionsStore.COLOR_OPTIONS.find((c) =>
|
|
27
|
+
(c.value as string).includes(component.properties.wrapperClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
const initialAlign = $derived(
|
|
32
|
+
$optionsStore.ALIGN_OPTIONS.find((a) =>
|
|
33
|
+
(a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
34
|
+
),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
/* Добавление цветов через селект */
|
|
38
|
+
const handleOptionColorChange = (color: string) => {
|
|
39
|
+
let componentClass = component.properties.componentClass || ''
|
|
40
|
+
componentClass = componentClass
|
|
41
|
+
.split(' ')
|
|
42
|
+
.filter((cls: string) => !cls.startsWith('bg-'))
|
|
43
|
+
.join(' ')
|
|
44
|
+
if (color) {
|
|
45
|
+
componentClass += ` ${color}`
|
|
46
|
+
}
|
|
47
|
+
updateProperty('wrapperClass', componentClass)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const handleLabelAlign = (align: string) => {
|
|
51
|
+
let labelClass = component.properties.label.class || ''
|
|
52
|
+
labelClass = labelClass
|
|
53
|
+
.split(' ')
|
|
54
|
+
.filter((cls: string) => !cls.startsWith('text-'))
|
|
55
|
+
.join(' ')
|
|
56
|
+
if (align) {
|
|
57
|
+
labelClass += ` ${align}`
|
|
58
|
+
}
|
|
59
|
+
updateProperty('label.class', labelClass)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Обновление свойства */
|
|
63
|
+
const updateProperty = (path: string, value: string | object) => {
|
|
64
|
+
const newProperties = JSON.parse(JSON.stringify(component.properties))
|
|
65
|
+
const parts = path.split('.')
|
|
66
|
+
let obj = newProperties
|
|
67
|
+
|
|
68
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
69
|
+
const part = parts[i]
|
|
70
|
+
if (!obj[part]) obj[part] = {}
|
|
71
|
+
obj = obj[part]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
obj[parts[parts.length - 1]] = value
|
|
75
|
+
onPropertyChange(newProperties)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const updateTableHeader = (index: number, field: keyof ITableHeader<any>, value: any) => {
|
|
79
|
+
const headers = [...component.properties.tableHeader]
|
|
80
|
+
headers[index] = { ...headers[index], [field]: value }
|
|
81
|
+
updateProperty('tableHeader', headers)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const updateButtonProperty = (columnIndex: number, buttonIndex: number, field: string, value: any) => {
|
|
85
|
+
const headers = [...component.properties.tableHeader]
|
|
86
|
+
const buttons = [...headers[columnIndex].buttons]
|
|
87
|
+
buttons[buttonIndex] = { ...buttons[buttonIndex], [field]: value }
|
|
88
|
+
headers[columnIndex].buttons = buttons
|
|
89
|
+
updateProperty('tableHeader', headers)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const removeButtonFromColumn = (columnIndex: number, buttonIndex: number) => {
|
|
93
|
+
const headers = [...component.properties.tableHeader]
|
|
94
|
+
const buttons = [...headers[columnIndex].buttons]
|
|
95
|
+
buttons.splice(buttonIndex, 1)
|
|
96
|
+
headers[columnIndex].buttons = buttons.length ? buttons : undefined
|
|
97
|
+
updateProperty('tableHeader', headers)
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
{#if component && component.properties}
|
|
102
|
+
<div class="relative flex flex-row items-start justify-center">
|
|
103
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
104
|
+
<UI.Select
|
|
105
|
+
label={{ name: $t('service.constructor.props.variable') }}
|
|
106
|
+
options={VARIABLE_OPTIONS}
|
|
107
|
+
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id.value)}
|
|
108
|
+
onUpdate={(value) => {
|
|
109
|
+
updateProperty('id.name', (value.name as string).split('|')[1].trim())
|
|
110
|
+
updateProperty('id.value', value.value as string)
|
|
111
|
+
updateProperty('eventHandler.Variables', value.value as string)
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
116
|
+
<UI.Select
|
|
117
|
+
wrapperClass="!h-14"
|
|
118
|
+
label={{ name: $t('service.constructor.props.colors') }}
|
|
119
|
+
type="buttons"
|
|
120
|
+
options={$optionsStore.COLOR_OPTIONS}
|
|
121
|
+
value={initialColor}
|
|
122
|
+
onUpdate={(option) => handleOptionColorChange(option.value as string)}
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
126
|
+
<UI.Input
|
|
127
|
+
wrapperClass="w-full"
|
|
128
|
+
label={{ name: $t('service.constructor.props.label') }}
|
|
129
|
+
value={component.properties.label.name}
|
|
130
|
+
type="text"
|
|
131
|
+
componentClass="w-full"
|
|
132
|
+
onUpdate={(value) => updateProperty('label.name', value as string)}
|
|
133
|
+
/>
|
|
134
|
+
<UI.Select
|
|
135
|
+
wrapperClass="w-full"
|
|
136
|
+
label={{ name: $t('service.constructor.props.align') }}
|
|
137
|
+
type="buttons"
|
|
138
|
+
value={initialAlign}
|
|
139
|
+
options={$optionsStore.ALIGN_OPTIONS}
|
|
140
|
+
onUpdate={(option) => handleLabelAlign(option.value as string)}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<hr class="border-gray-400" />
|
|
146
|
+
|
|
147
|
+
<!-- Настройки столбцов таблицы -->
|
|
148
|
+
<div class="space-y-4">
|
|
149
|
+
<div class="m-0 flex items-center justify-center gap-2">
|
|
150
|
+
<h4>{$t('service.constructor.props.table.columns')}</h4>
|
|
151
|
+
<UI.Button
|
|
152
|
+
wrapperClass="!w-10"
|
|
153
|
+
icon={{ component: ButtonAdd, properties: { height: '1.5rem', width: '1.5rem' } }}
|
|
154
|
+
componentClass="h-10 border-none hover:shadow-none"
|
|
155
|
+
onClick={() => {
|
|
156
|
+
const newColumn: ITableHeader<any> = {
|
|
157
|
+
key: `column${(component.properties.tableHeader?.length || 0) + 1}`,
|
|
158
|
+
label: `Column ${(component.properties.tableHeader?.length || 0) + 1}`,
|
|
159
|
+
width: '100px',
|
|
160
|
+
sortable: false,
|
|
161
|
+
}
|
|
162
|
+
const headers = [...(component.properties.tableHeader || []), newColumn]
|
|
163
|
+
updateProperty('tableHeader', headers)
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
{#each component.properties.tableHeader as column, columnIndex}
|
|
169
|
+
<div class="m-0 flex items-end justify-around gap-2">
|
|
170
|
+
<UI.Input
|
|
171
|
+
label={{ name: $t('service.constructor.props.table.columns.key') }}
|
|
172
|
+
wrapperClass="!w-2/10"
|
|
173
|
+
value={column.key}
|
|
174
|
+
type="text"
|
|
175
|
+
regExp={/^[0-9a-zA-Z_-]{0,16}$/}
|
|
176
|
+
onUpdate={(value) => updateTableHeader(columnIndex, 'key', value)}
|
|
177
|
+
/>
|
|
178
|
+
<UI.Input
|
|
179
|
+
label={{ name: $t('service.constructor.props.table.columns.label') }}
|
|
180
|
+
wrapperClass="!w-2/10"
|
|
181
|
+
value={column.label}
|
|
182
|
+
type="text"
|
|
183
|
+
onUpdate={(value) => updateTableHeader(columnIndex, 'label', value)}
|
|
184
|
+
/>
|
|
185
|
+
<UI.Input
|
|
186
|
+
label={{ name: $t('service.constructor.props.table.columns.width') }}
|
|
187
|
+
wrapperClass="!w-2/10"
|
|
188
|
+
value={column.width}
|
|
189
|
+
type="text"
|
|
190
|
+
onUpdate={(value) => updateTableHeader(columnIndex, 'width', value)}
|
|
191
|
+
/>
|
|
192
|
+
<UI.Switch
|
|
193
|
+
wrapperClass="!w-1/10"
|
|
194
|
+
label={{ name: $t('service.constructor.props.table.columns.sortable') }}
|
|
195
|
+
value={column.sortable ? 2 : 1}
|
|
196
|
+
onChange={(value) => updateTableHeader(columnIndex, 'sortable', value === 2)}
|
|
197
|
+
/>
|
|
198
|
+
<UI.Button
|
|
199
|
+
wrapperClass="!w-1/20"
|
|
200
|
+
icon={{ component: ButtonAdd, properties: { height: '1.5rem', width: '1.5rem' } }}
|
|
201
|
+
componentClass="h-10 w-10 border-none hover:shadow-none"
|
|
202
|
+
info={$t('service.constructor.props.table.addaction')}
|
|
203
|
+
onClick={() => {
|
|
204
|
+
const newButton = {
|
|
205
|
+
name: `button${(component.properties.tableHeader[columnIndex].buttons || 0) + 1}`,
|
|
206
|
+
class: 'bg-blue',
|
|
207
|
+
eventHandler: { Header: 'SET', Argument: 'Save', Variables: [] },
|
|
208
|
+
onClick: () => {},
|
|
209
|
+
}
|
|
210
|
+
const buttons = [...(component.properties.tableHeader[columnIndex].buttons || []), newButton]
|
|
211
|
+
updateTableHeader(columnIndex, 'buttons', buttons)
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
<UI.Button
|
|
215
|
+
wrapperClass="!w-1/20"
|
|
216
|
+
icon={{ component: ButtonDelete, properties: { height: '1.5rem', width: '1.5rem' } }}
|
|
217
|
+
componentClass="h-10 w-10 border-none hover:shadow-none"
|
|
218
|
+
info={$t('service.constructor.props.table.deletecolumn')}
|
|
219
|
+
onClick={() => {
|
|
220
|
+
const headers = [...(component.properties.tableHeader || [])]
|
|
221
|
+
headers.splice(columnIndex, 1)
|
|
222
|
+
updateProperty('tableHeader', headers)
|
|
223
|
+
}}
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
226
|
+
{#if column.buttons && column.buttons.length > 0}
|
|
227
|
+
<div class="m-2 rounded-lg bg-[var(--field-color)] p-2">
|
|
228
|
+
{#each column.buttons as button, buttonIndex}
|
|
229
|
+
<div class="flex items-end justify-around gap-2">
|
|
230
|
+
<UI.Input
|
|
231
|
+
label={{ name: $t('service.constructor.props.name') }}
|
|
232
|
+
wrapperClass="!w-2/10"
|
|
233
|
+
value={button.name}
|
|
234
|
+
type="text"
|
|
235
|
+
onUpdate={(value) => updateButtonProperty(columnIndex, buttonIndex, 'name', value)}
|
|
236
|
+
/>
|
|
237
|
+
<UI.Select
|
|
238
|
+
wrapperClass="!w-3/10"
|
|
239
|
+
label={{ name: $t('service.constructor.props.header') }}
|
|
240
|
+
type="buttons"
|
|
241
|
+
value={$optionsStore.HEADER_OPTIONS.find((h) => h.value === button.eventHandler?.Header)}
|
|
242
|
+
options={$optionsStore.HEADER_OPTIONS}
|
|
243
|
+
onUpdate={(option) => {
|
|
244
|
+
const handler = button.eventHandler
|
|
245
|
+
handler.Header = option.value as string
|
|
246
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
247
|
+
}}
|
|
248
|
+
/>
|
|
249
|
+
<UI.Input
|
|
250
|
+
wrapperClass="!w-2/10"
|
|
251
|
+
label={{ name: $t('service.constructor.props.argument') }}
|
|
252
|
+
value={button.eventHandler?.Argument}
|
|
253
|
+
type="text"
|
|
254
|
+
onUpdate={(value) => {
|
|
255
|
+
const handler = button.eventHandler
|
|
256
|
+
handler.Argument = value as string
|
|
257
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
258
|
+
}}
|
|
259
|
+
/>
|
|
260
|
+
<UI.Input
|
|
261
|
+
wrapperClass="!w-2/10"
|
|
262
|
+
label={{ name: $t('service.constructor.props.table.keys') }}
|
|
263
|
+
value={button.eventHandler?.Variables.join(' ')}
|
|
264
|
+
type="text"
|
|
265
|
+
maxlength={500}
|
|
266
|
+
regExp={/^[a-zA-Z0-9\-_ ]{0,500}$/}
|
|
267
|
+
help={{ info: $t('service.constructor.props.table.keys.info') }}
|
|
268
|
+
onUpdate={(value) => {
|
|
269
|
+
const handler = { ...button.eventHandler }
|
|
270
|
+
handler.Variables = (value as string).trim().split(/\s+/)
|
|
271
|
+
updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
<UI.Button
|
|
275
|
+
wrapperClass="!w-1/20"
|
|
276
|
+
icon={{ component: ButtonDelete, properties: { height: '1.5rem', width: '1.5rem' } }}
|
|
277
|
+
componentClass="h-10 w-10 border-none hover:shadow-none"
|
|
278
|
+
onClick={() => removeButtonFromColumn(columnIndex, buttonIndex)}
|
|
279
|
+
/>
|
|
280
|
+
</div>
|
|
281
|
+
{/each}
|
|
282
|
+
</div>
|
|
283
|
+
{/if}
|
|
284
|
+
{/each}
|
|
285
|
+
</div>
|
|
286
|
+
{/if}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type TablePropsProps = typeof __propDef.props;
|
|
10
|
+
export type TablePropsEvents = typeof __propDef.events;
|
|
11
|
+
export type TablePropsSlots = typeof __propDef.slots;
|
|
12
|
+
export default class TableProps extends SvelteComponentTyped<TablePropsProps, TablePropsEvents, TablePropsSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ITextFieldProps } from '../types'
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
id = { value: crypto.randomUUID(), name: '' },
|
|
6
|
+
wrapperClass = '',
|
|
7
|
+
label = { name: '', class: '' },
|
|
8
|
+
type = 'small',
|
|
9
|
+
bold = false,
|
|
10
|
+
italic = false,
|
|
11
|
+
}: ITextFieldProps = $props()
|
|
12
|
+
|
|
13
|
+
const textSize = {
|
|
14
|
+
small: 'text-base',
|
|
15
|
+
medium: 'text-xl',
|
|
16
|
+
xlarge: 'text-2xl',
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div id={id.value} class="relative flex w-full flex-col items-center {wrapperClass}">
|
|
21
|
+
<p class="w-full text-center {label.class} {textSize[type]} {bold ? 'font-bold' : ''} {italic ? 'italic' : ''}">{label.name}</p>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type TextFieldProps = typeof __propDef.props;
|
|
10
|
+
export type TextFieldEvents = typeof __propDef.events;
|
|
11
|
+
export type TextFieldSlots = typeof __propDef.slots;
|
|
12
|
+
export default class TextField extends SvelteComponentTyped<TextFieldProps, TextFieldEvents, TextFieldSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<!-- $lib/ElementsUI/GridAccordionProps.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { t } from '../locales/i18n'
|
|
4
|
+
import type { ITextFieldProps, UIComponent } from '../types'
|
|
5
|
+
import * as UI from '../index'
|
|
6
|
+
import { optionsStore } from '../options'
|
|
7
|
+
|
|
8
|
+
const { component, onPropertyChange } = $props<{
|
|
9
|
+
component: UIComponent & { properties: Partial<ITextFieldProps> }
|
|
10
|
+
onPropertyChange: (value: string | object) => void
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
let currentType = $derived($optionsStore.TEXTFIELD_SIZE_OPTIONS.find((t) => t.value === component.properties.type))
|
|
14
|
+
|
|
15
|
+
const initialAlign = $derived(
|
|
16
|
+
$optionsStore.ALIGN_OPTIONS.find((a) =>
|
|
17
|
+
(a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
|
|
18
|
+
),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const handleLabelAlign = (align: string) => {
|
|
22
|
+
let labelClass = component.properties.label.class || ''
|
|
23
|
+
labelClass = labelClass
|
|
24
|
+
.split(' ')
|
|
25
|
+
.filter((cls: string) => !cls.startsWith('text-'))
|
|
26
|
+
.join(' ')
|
|
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
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
{#if component && component.properties}
|
|
51
|
+
<div class="relative flex flex-row items-start justify-center">
|
|
52
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
53
|
+
<UI.Input
|
|
54
|
+
label={{ name: $t('service.constructor.props.label') }}
|
|
55
|
+
value={component.properties.label.name}
|
|
56
|
+
onUpdate={(value) => updateProperty('label.name', value as string)}
|
|
57
|
+
type="text"
|
|
58
|
+
/>
|
|
59
|
+
<UI.Select
|
|
60
|
+
label={{ name: $t('service.constructor.props.type') }}
|
|
61
|
+
type="buttons"
|
|
62
|
+
value={currentType}
|
|
63
|
+
options={$optionsStore.TEXTFIELD_SIZE_OPTIONS}
|
|
64
|
+
onUpdate={(item) => updateProperty('type', item.value as string)}
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
68
|
+
<UI.Select
|
|
69
|
+
wrapperClass="w-full"
|
|
70
|
+
label={{ name: $t('service.constructor.props.align') }}
|
|
71
|
+
type="buttons"
|
|
72
|
+
value={initialAlign}
|
|
73
|
+
options={$optionsStore.ALIGN_OPTIONS}
|
|
74
|
+
onUpdate={(option) => handleLabelAlign(option.value as string)}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
78
|
+
<UI.Switch
|
|
79
|
+
wrapperClass="w-full"
|
|
80
|
+
label={{ name: $t('service.constructor.props.bold') }}
|
|
81
|
+
value={component.properties.bold ? 2 : 1}
|
|
82
|
+
onChange={(value) => updateProperty('bold', value === 2)}
|
|
83
|
+
/>
|
|
84
|
+
<UI.Switch
|
|
85
|
+
wrapperClass="w-full"
|
|
86
|
+
label={{ name: $t('service.constructor.props.italic') }}
|
|
87
|
+
value={component.properties.italic ? 2 : 1}
|
|
88
|
+
onChange={(value) => updateProperty('italic', value === 2)}
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
{/if}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type TextFieldPropsProps = typeof __propDef.props;
|
|
10
|
+
export type TextFieldPropsEvents = typeof __propDef.events;
|
|
11
|
+
export type TextFieldPropsSlots = typeof __propDef.slots;
|
|
12
|
+
export default class TextFieldProps extends SvelteComponentTyped<TextFieldPropsProps, TextFieldPropsEvents, TextFieldPropsSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
+
><path fill="currentColor" 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" /><path
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
fill-rule="evenodd"
|
|
7
|
+
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"
|
|
8
|
+
clip-rule="evenodd"
|
|
9
|
+
/></svg
|
|
10
|
+
>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type ButtonAddProps = typeof __propDef.props;
|
|
10
|
+
export type ButtonAddEvents = typeof __propDef.events;
|
|
11
|
+
export type ButtonAddSlots = typeof __propDef.slots;
|
|
12
|
+
export default class ButtonAdd extends SvelteComponentTyped<ButtonAddProps, ButtonAddEvents, ButtonAddSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
+
><path
|
|
5
|
+
fill="none"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
stroke-linecap="round"
|
|
8
|
+
stroke-linejoin="round"
|
|
9
|
+
stroke-width="1.5"
|
|
10
|
+
d="m19.5 5.5l-.62 10.025c-.158 2.561-.237 3.842-.88 4.763a4 4 0 0 1-1.2 1.128c-.957.584-2.24.584-4.806.584c-2.57 0-3.855 0-4.814-.585a4 4 0 0 1-1.2-1.13c-.642-.922-.72-2.205-.874-4.77L4.5 5.5M3 5.5h18m-4.944 0l-.683-1.408c-.453-.936-.68-1.403-1.071-1.695a2 2 0 0 0-.275-.172C13.594 2 13.074 2 12.035 2c-1.066 0-1.599 0-2.04.234a2 2 0 0 0-.278.18c-.395.303-.616.788-1.058 1.757L8.053 5.5m1.447 11v-6m5 6v-6"
|
|
11
|
+
color="currentColor"
|
|
12
|
+
/></svg
|
|
13
|
+
>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type ButtonDeleteProps = typeof __propDef.props;
|
|
10
|
+
export type ButtonDeleteEvents = typeof __propDef.events;
|
|
11
|
+
export type ButtonDeleteSlots = typeof __propDef.slots;
|
|
12
|
+
export default class ButtonDelete extends SvelteComponentTyped<ButtonDeleteProps, ButtonDeleteEvents, ButtonDeleteSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="5em" height="5em" viewBox="0 0 24 24" class="opacity-70"
|
|
4
|
+
><path fill="currentColor" d="M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z" opacity=".4" /><path
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
d="M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"
|
|
7
|
+
><animateTransform attributeName="transform" dur="0.8s" from="0 12 12" repeatCount="indefinite" to="360 12 12" type="rotate" /></path
|
|
8
|
+
></svg
|
|
9
|
+
>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type LoaderRotateProps = typeof __propDef.props;
|
|
10
|
+
export type LoaderRotateEvents = typeof __propDef.events;
|
|
11
|
+
export type LoaderRotateSlots = typeof __propDef.slots;
|
|
12
|
+
export default class LoaderRotate extends SvelteComponentTyped<LoaderRotateProps, LoaderRotateEvents, LoaderRotateSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { default as Accordion } from './Accordion/Accordion.svelte';
|
|
2
|
+
export { default as AccordionProps } from './Accordion/AccordionProps.svelte';
|
|
3
|
+
export { default as Button } from './Button/Button.svelte';
|
|
4
|
+
export { default as ButtonProps } from './Button/ButtonProps.svelte';
|
|
5
|
+
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
6
|
+
export { default as ColorPickerProps } from './ColorPicker/ColorPickerProps.svelte';
|
|
7
|
+
export { default as FileAttach } from './FileAttach/FileAttach.svelte';
|
|
8
|
+
export { default as Graph } from './Graph/Graph.svelte';
|
|
9
|
+
export { default as GraphProps } from './Graph/GraphProps.svelte';
|
|
10
|
+
export { default as Input } from './Input/Input.svelte';
|
|
11
|
+
export { default as InputProps } from './Input/InputProps.svelte';
|
|
12
|
+
export { default as ProgressBar } from './ProgressBar/ProgressBar.svelte';
|
|
13
|
+
export { default as ProgressBarProps } from './ProgressBar/ProgressBarProps.svelte';
|
|
14
|
+
export { default as Select } from './Select/Select.svelte';
|
|
15
|
+
export { default as SelectProps } from './Select/SelectProps.svelte';
|
|
16
|
+
export { default as Slider } from './Slider/Slider.svelte';
|
|
17
|
+
export { default as SliderProps } from './Slider/SliderProps.svelte';
|
|
18
|
+
export { default as Switch } from './Switch/Switch.svelte';
|
|
19
|
+
export { default as SwitchProps } from './Switch/SwitchProps.svelte';
|
|
20
|
+
export { default as Table } from './Table/Table.svelte';
|
|
21
|
+
export { default as TableProps } from './Table/TableProps.svelte';
|
|
22
|
+
export { default as TextField } from './TextField/TextField.svelte';
|
|
23
|
+
export { default as TextFieldProps } from './TextField/TextFieldProps.svelte';
|
|
24
|
+
export { default as Loader } from './Loader.svelte';
|
|
25
|
+
export { default as MessageModal } from './MessageModal.svelte';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* Реэкспорт всех UI компонентов для удобного импорта */
|
|
2
|
+
export { default as Accordion } from './Accordion/Accordion.svelte';
|
|
3
|
+
export { default as AccordionProps } from './Accordion/AccordionProps.svelte';
|
|
4
|
+
export { default as Button } from './Button/Button.svelte';
|
|
5
|
+
export { default as ButtonProps } from './Button/ButtonProps.svelte';
|
|
6
|
+
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
7
|
+
export { default as ColorPickerProps } from './ColorPicker/ColorPickerProps.svelte';
|
|
8
|
+
export { default as FileAttach } from './FileAttach/FileAttach.svelte';
|
|
9
|
+
export { default as Graph } from './Graph/Graph.svelte';
|
|
10
|
+
export { default as GraphProps } from './Graph/GraphProps.svelte';
|
|
11
|
+
export { default as Input } from './Input/Input.svelte';
|
|
12
|
+
export { default as InputProps } from './Input/InputProps.svelte';
|
|
13
|
+
export { default as ProgressBar } from './ProgressBar/ProgressBar.svelte';
|
|
14
|
+
export { default as ProgressBarProps } from './ProgressBar/ProgressBarProps.svelte';
|
|
15
|
+
export { default as Select } from './Select/Select.svelte';
|
|
16
|
+
export { default as SelectProps } from './Select/SelectProps.svelte';
|
|
17
|
+
export { default as Slider } from './Slider/Slider.svelte';
|
|
18
|
+
export { default as SliderProps } from './Slider/SliderProps.svelte';
|
|
19
|
+
export { default as Switch } from './Switch/Switch.svelte';
|
|
20
|
+
export { default as SwitchProps } from './Switch/SwitchProps.svelte';
|
|
21
|
+
export { default as Table } from './Table/Table.svelte';
|
|
22
|
+
export { default as TableProps } from './Table/TableProps.svelte';
|
|
23
|
+
export { default as TextField } from './TextField/TextField.svelte';
|
|
24
|
+
export { default as TextFieldProps } from './TextField/TextFieldProps.svelte';
|
|
25
|
+
export { default as Loader } from './Loader.svelte';
|
|
26
|
+
export { default as MessageModal } from './MessageModal.svelte';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512"
|
|
2
|
+
><clipPath id="svgIDa"><circle cx="256" cy="256" r="256" /></clipPath><g clip-path="url(#svgIDa)"
|
|
3
|
+
><path
|
|
4
|
+
fill="#eee"
|
|
5
|
+
d="m0 0l8 16l-8 15v16l32 65l-32 64v32l32 48l-32 48v32l32 64l-32 65v47l16-8l15 8h16l65-32l64 32h32l48-32l48 32h32l64-32l65 32h47l-8-15l8-16v-16l-32-65l32-64v-32l-32-48l32-48v-32l-32-64l32-65V0l-15 8l-16-8h-16l-65 32l-64-32h-32l-48 32l-48-32h-32l-64 32L47 0H0z"
|
|
6
|
+
/><path
|
|
7
|
+
fill="#0052b4"
|
|
8
|
+
d="m47 0l129 129V0Zm289 0v129L465 0ZM0 47v129h129Zm512 0L383 176h129ZM0 336v129l129-129Zm383 0l129 129V336Zm-47 47v129h129zm-160 0L47 512h129Z"
|
|
9
|
+
/><path fill="#d80027" d="M208 0v208H0v96h208v208h96V304h208v-96H304V0h-96z" /><path
|
|
10
|
+
fill="#d80027"
|
|
11
|
+
d="m336 336l176 176v-31L367 336Zm0-160L512 0h-31L336 145Zm-160 0L0 0v31l145 145zm0 160L0 512h31l145-145Z"
|
|
12
|
+
/></g
|
|
13
|
+
></svg
|
|
14
|
+
>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} CircleFlagsEnProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} CircleFlagsEnEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} CircleFlagsEnSlots */
|
|
4
|
+
export default class CircleFlagsEn extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type CircleFlagsEnProps = typeof __propDef.props;
|
|
11
|
+
export type CircleFlagsEnEvents = typeof __propDef.events;
|
|
12
|
+
export type CircleFlagsEnSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512"
|
|
2
|
+
><mask id="circleFlagsRu0"><circle cx="256" cy="256" r="256" fill="#fff" /></mask><g mask="url(#circleFlagsRu0)"
|
|
3
|
+
><path fill="#0052b4" d="M512 170v172l-256 32L0 342V170l256-32z" /><path fill="#eee" d="M512 0v170H0V0Z" /><path
|
|
4
|
+
fill="#d80027"
|
|
5
|
+
d="M512 342v170H0V342Z"
|
|
6
|
+
/></g
|
|
7
|
+
></svg
|
|
8
|
+
>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} CircleFlagsRuProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} CircleFlagsRuEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} CircleFlagsRuSlots */
|
|
4
|
+
export default class CircleFlagsRu extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type CircleFlagsRuProps = typeof __propDef.props;
|
|
11
|
+
export type CircleFlagsRuEvents = typeof __propDef.events;
|
|
12
|
+
export type CircleFlagsRuSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|