poe-svelte-ui-lib 1.2.29 → 1.2.30
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 +4 -4
- package/dist/Accordion/AccordionProps.svelte.d.ts +7 -2
- package/dist/Button/Button.svelte +0 -1
- package/dist/Button/ButtonProps.svelte +18 -19
- package/dist/Button/ButtonProps.svelte.d.ts +7 -2
- package/dist/ColorPicker/ColorPickerProps.svelte +7 -8
- package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +7 -2
- package/dist/FileAttach/FileAttachProps.svelte +2 -2
- package/dist/FileAttach/FileAttachProps.svelte.d.ts +7 -2
- package/dist/Graph/GraphProps.svelte +27 -48
- package/dist/Graph/GraphProps.svelte.d.ts +7 -2
- package/dist/Input/Input.svelte +21 -21
- package/dist/Input/InputProps.svelte +8 -14
- package/dist/Input/InputProps.svelte.d.ts +7 -2
- package/dist/Joystick/Joystick.svelte +59 -56
- package/dist/Joystick/JoystickProps.svelte +215 -0
- package/dist/Joystick/JoystickProps.svelte.d.ts +15 -25
- package/dist/Map/Map.svelte +1 -1
- package/dist/Map/MapProps.svelte +17 -8
- package/dist/Map/MapProps.svelte.d.ts +7 -2
- package/dist/ProgressBar/ProgressBarProps.svelte +4 -4
- package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +7 -2
- package/dist/Select/Select.svelte +0 -1
- package/dist/Select/SelectProps.svelte +51 -12
- package/dist/Select/SelectProps.svelte.d.ts +7 -2
- package/dist/Slider/Slider.svelte +3 -2
- package/dist/Slider/SliderProps.svelte +8 -7
- package/dist/Slider/SliderProps.svelte.d.ts +7 -2
- package/dist/Switch/Switch.svelte +1 -1
- package/dist/Switch/SwitchProps.svelte +49 -40
- package/dist/Switch/SwitchProps.svelte.d.ts +7 -2
- package/dist/Table/Table.svelte +7 -2
- package/dist/Table/TableProps.svelte +32 -12
- package/dist/Table/TableProps.svelte.d.ts +7 -2
- package/dist/Tabs/TabsProps.svelte +10 -11
- package/dist/Tabs/TabsProps.svelte.d.ts +7 -2
- package/dist/TextField/TextFieldProps.svelte +3 -5
- package/dist/TextField/TextFieldProps.svelte.d.ts +7 -2
- package/dist/types.d.ts +24 -8
- package/dist/types.js +10 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { t } from '../locales/i18n'
|
|
3
|
-
import { updateProperty, type ISelectOption, type ITabsProps, type UIComponent } from '../types'
|
|
3
|
+
import { updateProperty, type ISelectOption, type ITabsProps, type IUIComponentHandler, type UIComponent } from '../types'
|
|
4
4
|
import * as UI from '..'
|
|
5
5
|
import { optionsStore } from '../options'
|
|
6
6
|
import { ICONS } from '../icons'
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
forConstructor = true,
|
|
18
18
|
} = $props<{
|
|
19
19
|
component: UIComponent & { properties: Partial<ITabsProps> }
|
|
20
|
-
onPropertyChange: (
|
|
20
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
21
21
|
forConstructor?: boolean
|
|
22
22
|
}>()
|
|
23
23
|
|
|
@@ -62,13 +62,12 @@
|
|
|
62
62
|
<div class="flex items-center justify-center gap-8">
|
|
63
63
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
64
64
|
<UI.Select
|
|
65
|
-
label={{ name: $t('constructor.props.
|
|
65
|
+
label={{ name: $t('constructor.props.access') }}
|
|
66
66
|
type="buttons"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
onUpdate={(option) =>
|
|
67
|
+
options={$optionsStore.ACCESS_OPTION}
|
|
68
|
+
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
69
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
70
70
|
/>
|
|
71
|
-
|
|
72
71
|
<UI.Select
|
|
73
72
|
wrapperClass="h-14"
|
|
74
73
|
label={{ name: $t('constructor.props.colors') }}
|
|
@@ -245,11 +244,11 @@
|
|
|
245
244
|
</div>
|
|
246
245
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
247
246
|
<UI.Select
|
|
248
|
-
label={{ name: $t('constructor.props.
|
|
247
|
+
label={{ name: $t('constructor.props.access') }}
|
|
249
248
|
type="buttons"
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
onUpdate={(option) =>
|
|
249
|
+
options={$optionsStore.ACCESS_OPTION}
|
|
250
|
+
value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
|
|
251
|
+
onUpdate={(option) => onPropertyChange({ access: option.value })}
|
|
253
252
|
/>
|
|
254
253
|
|
|
255
254
|
<UI.Select
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { type ITabsProps, type UIComponent } from '../types';
|
|
1
|
+
import { type ITabsProps, type IUIComponentHandler, type UIComponent } from '../types';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<ITabsProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (
|
|
6
|
+
onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void;
|
|
7
12
|
forConstructor?: boolean;
|
|
8
13
|
};
|
|
9
14
|
declare const TabsProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { t } from '../locales/i18n'
|
|
3
|
-
import { updateProperty, type ITextFieldProps, type UIComponent } from '../types'
|
|
3
|
+
import { updateProperty, type ITextFieldProps, type IUIComponentHandler, type UIComponent } from '../types'
|
|
4
4
|
import * as UI from '../index'
|
|
5
5
|
import { optionsStore } from '../options'
|
|
6
6
|
import { getContext } from 'svelte'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
forConstructor = true,
|
|
13
13
|
} = $props<{
|
|
14
14
|
component: UIComponent & { properties: Partial<ITextFieldProps> }
|
|
15
|
-
onPropertyChange: (
|
|
15
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
16
16
|
forConstructor?: boolean
|
|
17
17
|
}>()
|
|
18
18
|
const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
|
|
44
44
|
onUpdate={(value) => {
|
|
45
45
|
updateProperty('id', value.value as string, component, onPropertyChange)
|
|
46
|
-
|
|
47
|
-
onPropertyChange(null, value.name?.split('—')[1].trim(), null)
|
|
46
|
+
onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
|
|
48
47
|
}}
|
|
49
48
|
/>
|
|
50
49
|
<UI.Input
|
|
@@ -78,7 +77,6 @@
|
|
|
78
77
|
/>
|
|
79
78
|
</div>
|
|
80
79
|
<div class="flex w-1/3 flex-col px-2">
|
|
81
|
-
<!-- <p>{component.properties.content?.class?.split(' ').includes((cls: string) => cls.startsWith('font-bold'))}</p> -->
|
|
82
80
|
<UI.Switch
|
|
83
81
|
label={{ name: $t('constructor.props.bold') }}
|
|
84
82
|
value={initialBold}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { type ITextFieldProps, type UIComponent } from '../types';
|
|
1
|
+
import { type ITextFieldProps, type IUIComponentHandler, type UIComponent } from '../types';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
component: UIComponent & {
|
|
4
4
|
properties: Partial<ITextFieldProps>;
|
|
5
5
|
};
|
|
6
|
-
onPropertyChange: (
|
|
6
|
+
onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void;
|
|
7
12
|
forConstructor?: boolean;
|
|
8
13
|
};
|
|
9
14
|
declare const TextFieldProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,27 @@ import type { Writable } from 'svelte/store';
|
|
|
3
3
|
import type { IFileInputProps } from './FileAttach/FileAttach.svelte';
|
|
4
4
|
export declare const updateProperty: (path: string, value: string | number | boolean | object | string[], component: UIComponent & {
|
|
5
5
|
properties: Partial<UIComponent["properties"]>;
|
|
6
|
-
}, onPropertyChange: (
|
|
6
|
+
}, onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void) => void;
|
|
12
|
+
export declare const updateComponent: (component: UIComponent, updates: Partial<{
|
|
13
|
+
name: string;
|
|
14
|
+
access: "full" | "viewOnly" | "hidden";
|
|
15
|
+
properties: Partial<UIComponent["properties"]>;
|
|
16
|
+
eventHandler: IUIComponentHandler;
|
|
17
|
+
}>) => {
|
|
18
|
+
access: "full" | "viewOnly" | "hidden" | undefined;
|
|
19
|
+
name: string | undefined;
|
|
20
|
+
properties: IFileInputProps | IAccordionProps | IButtonProps | IInputProps | ISelectProps<unknown> | ISwitchProps | IColorPickerProps | ISliderProps | ITextFieldProps | IProgressBarProps | IGraphProps | ITableProps<object> | ITabsProps | IJoystickProps | IMapProps;
|
|
21
|
+
eventHandler: IUIComponentHandler | undefined;
|
|
22
|
+
id: string;
|
|
23
|
+
type: "Button" | "Accordion" | "Input" | "Select" | "Switch" | "ColorPicker" | "Slider" | "TextField" | "Joystick" | "ProgressBar" | "Graph" | "Table" | "Tabs" | "FileAttach" | "Map";
|
|
24
|
+
position: Position;
|
|
25
|
+
parentId: string;
|
|
26
|
+
};
|
|
7
27
|
export interface UIComponent {
|
|
8
28
|
id: string;
|
|
9
29
|
name?: string;
|
|
@@ -12,6 +32,7 @@ export interface UIComponent {
|
|
|
12
32
|
properties: IAccordionProps | IButtonProps | IInputProps | ISelectProps | ISwitchProps | IColorPickerProps | ISliderProps | ITextFieldProps | IProgressBarProps | IGraphProps | ITableProps<object> | ITabsProps | IFileInputProps | IJoystickProps | IMapProps;
|
|
13
33
|
position: Position;
|
|
14
34
|
parentId: string;
|
|
35
|
+
eventHandler?: IUIComponentHandler;
|
|
15
36
|
}
|
|
16
37
|
export interface Position {
|
|
17
38
|
row: number;
|
|
@@ -45,7 +66,6 @@ export interface IButtonProps {
|
|
|
45
66
|
altKey?: boolean;
|
|
46
67
|
metaKey?: boolean;
|
|
47
68
|
};
|
|
48
|
-
eventHandler?: IUIComponentHandler;
|
|
49
69
|
onClick?: () => void;
|
|
50
70
|
}
|
|
51
71
|
export interface IAccordionProps {
|
|
@@ -92,7 +112,6 @@ export interface IInputProps {
|
|
|
92
112
|
regExp?: string | RegExp;
|
|
93
113
|
autocomplete?: 'on' | 'off' | 'given-name' | 'family-name' | 'nickname' | 'username' | 'new-password' | 'current-password' | 'organization-title' | 'country-name' | 'address-level1' | 'address-level2' | 'street-address' | 'postal-code' | 'email' | 'tel' | null;
|
|
94
114
|
};
|
|
95
|
-
eventHandler?: IUIComponentHandler;
|
|
96
115
|
onUpdate?: (value: string | number) => void;
|
|
97
116
|
}
|
|
98
117
|
export interface ISelectProps<T = unknown> {
|
|
@@ -112,7 +131,6 @@ export interface ISelectProps<T = unknown> {
|
|
|
112
131
|
start: number;
|
|
113
132
|
end: number;
|
|
114
133
|
};
|
|
115
|
-
eventHandler?: IUIComponentHandler;
|
|
116
134
|
onUpdate?: (value: ISelectOption<T>) => void;
|
|
117
135
|
}
|
|
118
136
|
export interface ISelectOption<T = unknown> {
|
|
@@ -137,7 +155,6 @@ export interface ISwitchProps {
|
|
|
137
155
|
bitMode?: boolean;
|
|
138
156
|
type?: 'horizontal' | 'vertical' | 'checkbox';
|
|
139
157
|
value?: number;
|
|
140
|
-
eventHandler?: IUIComponentHandler;
|
|
141
158
|
onChange?: (value: number) => void;
|
|
142
159
|
}
|
|
143
160
|
export interface IColorPickerProps {
|
|
@@ -148,7 +165,6 @@ export interface IColorPickerProps {
|
|
|
148
165
|
class?: string;
|
|
149
166
|
};
|
|
150
167
|
value?: number[];
|
|
151
|
-
eventHandler?: IUIComponentHandler;
|
|
152
168
|
onChange?: (value: number[]) => void;
|
|
153
169
|
}
|
|
154
170
|
export interface ISliderProps {
|
|
@@ -166,7 +182,6 @@ export interface ISliderProps {
|
|
|
166
182
|
step: number;
|
|
167
183
|
};
|
|
168
184
|
disabled?: boolean;
|
|
169
|
-
eventHandler?: IUIComponentHandler;
|
|
170
185
|
onUpdate?: (value: number | [number, number]) => void;
|
|
171
186
|
}
|
|
172
187
|
export interface ITextFieldProps {
|
|
@@ -232,7 +247,6 @@ export interface ITableHeader<T extends object> {
|
|
|
232
247
|
buttons?: {
|
|
233
248
|
name: string | ((row: T) => string);
|
|
234
249
|
class?: string | ((row: T) => string);
|
|
235
|
-
eventHandler?: IUIComponentHandler;
|
|
236
250
|
onClick?: (row: T) => void;
|
|
237
251
|
}[];
|
|
238
252
|
image?: {
|
|
@@ -291,12 +305,14 @@ export interface IJoystickProps {
|
|
|
291
305
|
name?: string;
|
|
292
306
|
class?: string;
|
|
293
307
|
};
|
|
308
|
+
axesName?: [string, string, string?];
|
|
294
309
|
value?: number[];
|
|
295
310
|
limits?: {
|
|
296
311
|
minNum: number;
|
|
297
312
|
maxNum: number;
|
|
298
313
|
}[];
|
|
299
314
|
onUpdate?: (value: number[]) => void;
|
|
315
|
+
onClick?: (value: number[]) => void;
|
|
300
316
|
}
|
|
301
317
|
export interface IDeviceGNSS {
|
|
302
318
|
NavLat: number;
|
package/dist/types.js
CHANGED
|
@@ -9,5 +9,14 @@ export const updateProperty = (path, value, component, onPropertyChange) => {
|
|
|
9
9
|
obj = obj[part];
|
|
10
10
|
}
|
|
11
11
|
obj[parts[parts.length - 1]] = value;
|
|
12
|
-
onPropertyChange(newProperties);
|
|
12
|
+
onPropertyChange({ properties: newProperties });
|
|
13
|
+
};
|
|
14
|
+
export const updateComponent = (component, updates) => {
|
|
15
|
+
return {
|
|
16
|
+
...component,
|
|
17
|
+
access: updates.access ?? component.access,
|
|
18
|
+
name: updates.name ?? component.name,
|
|
19
|
+
properties: updates.properties ? { ...component.properties, ...updates.properties } : component.properties,
|
|
20
|
+
eventHandler: updates.eventHandler ? { ...component.eventHandler, ...updates.eventHandler } : component.eventHandler,
|
|
21
|
+
};
|
|
13
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-svelte-ui-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.30",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
50
50
|
"@types/node": "^24.10.1",
|
|
51
51
|
"publint": "^0.3.15",
|
|
52
|
-
"svelte": "^5.
|
|
52
|
+
"svelte": "^5.44.0",
|
|
53
53
|
"svelte-preprocess": "^6.0.3",
|
|
54
54
|
"vite": "^7.2.4",
|
|
55
55
|
"vite-plugin-compression": "^0.5.1"
|