poe-svelte-ui-lib 1.2.23 → 1.2.25

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.
@@ -15,7 +15,7 @@
15
15
  forConstructor = true,
16
16
  } = $props<{
17
17
  component: UIComponent & { properties: Partial<IAccordionProps> }
18
- onPropertyChange: (value: string | object, name?: string) => void
18
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
19
19
  forConstructor?: boolean
20
20
  }>()
21
21
 
@@ -48,6 +48,13 @@
48
48
  {#if forConstructor}
49
49
  <div class="flex items-center justify-center gap-8">
50
50
  <div class="flex w-1/3 flex-col items-center px-2">
51
+ <UI.Select
52
+ label={{ name: $t('constructor.props.icon.access') }}
53
+ type="buttons"
54
+ options={$optionsStore.ACCESS_OPTION}
55
+ value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
56
+ onUpdate={(option) => onPropertyChange(null, null, option.value)}
57
+ />
51
58
  <UI.Input
52
59
  label={{ name: $t('constructor.props.label') }}
53
60
  value={component.properties.label.name}
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IAccordionProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const AccordionProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -12,7 +12,7 @@
12
12
  forConstructor = true,
13
13
  } = $props<{
14
14
  component: UIComponent & { properties: Partial<IButtonProps> }
15
- onPropertyChange: (value: string | object, name?: string) => void
15
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IButtonProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const ButtonProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -12,7 +12,7 @@
12
12
  forConstructor = true,
13
13
  } = $props<{
14
14
  component: UIComponent & { properties: Partial<IColorPickerProps> }
15
- onPropertyChange: (value: string | object, name?: string) => void
15
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IColorPickerProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const ColorPickerProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -12,7 +12,7 @@
12
12
  forConstructor = true,
13
13
  } = $props<{
14
14
  component: UIComponent & { properties: Partial<IFileInputProps> }
15
- onPropertyChange: (value: string | object, name?: string) => void
15
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
  </script>
@@ -4,7 +4,7 @@ type $$ComponentProps = {
4
4
  component: UIComponent & {
5
5
  properties: Partial<IFileInputProps>;
6
6
  };
7
- onPropertyChange: (value: string | object, name?: string) => void;
7
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
8
8
  forConstructor?: boolean;
9
9
  };
10
10
  declare const FileAttachProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -10,7 +10,7 @@
10
10
  forConstructor = true,
11
11
  } = $props<{
12
12
  component: UIComponent & { properties: Partial<IGraphProps> }
13
- onPropertyChange: (value: string | object, name?: string) => void
13
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
14
14
  forConstructor?: boolean
15
15
  }>()
16
16
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IGraphProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const GraphProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -12,7 +12,7 @@
12
12
  forConstructor = true,
13
13
  } = $props<{
14
14
  component: UIComponent & { properties: Partial<IInputProps> }
15
- onPropertyChange: (value: string | object, name?: string) => void
15
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IInputProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const InputProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -12,7 +12,7 @@
12
12
  forConstructor = true,
13
13
  } = $props<{
14
14
  component: UIComponent & { properties: Partial<IProgressBarProps> }
15
- onPropertyChange: (value: string | object, name?: string) => void
15
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IProgressBarProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const ProgressBarProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -21,6 +21,7 @@
21
21
  type = 'select',
22
22
  value = $bindable(),
23
23
  bitMode = false,
24
+ range = { start: 0, end: 31 },
24
25
  options = [],
25
26
  onUpdate,
26
27
  }: ISelectProps<T> = $props()
@@ -14,7 +14,7 @@
14
14
  forConstructor = true,
15
15
  } = $props<{
16
16
  component: UIComponent & { properties: Partial<ISelectProps> }
17
- onPropertyChange: (value: string | object, name?: string) => void
17
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
18
18
  forConstructor?: boolean
19
19
  }>()
20
20
 
@@ -46,10 +46,8 @@
46
46
 
47
47
  let currentType = $derived($optionsStore.SELECT_TYPE_OPTIONS.find((t) => t.value === component.properties.type))
48
48
 
49
- let range = $state({ start: 0, end: 0 })
50
-
51
- const generateBitOptions = () => {
52
- const bitsNeeded = range.end - range.start + 1
49
+ const generateBitOptions = (start: number, end: number) => {
50
+ const bitsNeeded = end - start + 1
53
51
  const count = Math.pow(2, bitsNeeded)
54
52
 
55
53
  const options: ISelectOption<number>[] = []
@@ -59,7 +57,7 @@
59
57
 
60
58
  options.push({
61
59
  id: crypto.randomUUID(),
62
- value: parseInt(binary, 2) << range.start,
60
+ value: parseInt(binary, 2) << start,
63
61
  name: binary,
64
62
  class: 'bg-max',
65
63
  })
@@ -136,10 +134,10 @@
136
134
  <div class="flex w-full gap-4">
137
135
  <UI.Input
138
136
  label={{ name: $t('constructor.props.range.start') }}
139
- value={range.start}
137
+ value={component.properties.range.start}
140
138
  onUpdate={(value) => {
141
- range.start = value as number
142
- generateBitOptions()
139
+ updateProperty('range.start', value as number, component, onPropertyChange)
140
+ generateBitOptions(component.properties.range.start, component.properties.range.end)
143
141
  }}
144
142
  number={{ minNum: 0, maxNum: 31, step: 1 }}
145
143
  help={{ info: $t('constructor.props.range.start.help') }}
@@ -147,10 +145,10 @@
147
145
  />
148
146
  <UI.Input
149
147
  label={{ name: $t('constructor.props.range.end') }}
150
- value={range.end}
148
+ value={component.properties.range.end}
151
149
  onUpdate={(value) => {
152
- range.end = value as number
153
- generateBitOptions()
150
+ updateProperty('range.end', value as number, component, onPropertyChange)
151
+ generateBitOptions(component.properties.range.start, component.properties.range.end)
154
152
  }}
155
153
  number={{ minNum: 0, maxNum: 31, step: 1 }}
156
154
  help={{ info: $t('constructor.props.range.end.help') }}
@@ -187,7 +185,7 @@
187
185
  else option.value = option.value !== undefined ? String(option.value) : ''
188
186
  })
189
187
  updateProperty('options', options, component, onPropertyChange)
190
- if (value) generateBitOptions()
188
+ if (value) generateBitOptions(component.properties.range.start, component.properties.range.end)
191
189
  }}
192
190
  />
193
191
  </div>
@@ -231,6 +229,7 @@
231
229
  label={{ name: $t('constructor.props.optionvalue') }}
232
230
  wrapperClass="!w-3/10"
233
231
  value={option.value}
232
+ readonly={component.properties.bitMode}
234
233
  type={currentValueType.value}
235
234
  onUpdate={(value) => {
236
235
  const options = [...(component.properties?.options || [])]
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISelectProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const SelectProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -12,7 +12,7 @@
12
12
  forConstructor = true,
13
13
  } = $props<{
14
14
  component: UIComponent & { properties: Partial<ISliderProps> }
15
- onPropertyChange: (value: string | object, name?: string) => void
15
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISliderProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const SliderProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -57,7 +57,7 @@
57
57
  {#if label.name}
58
58
  <h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
59
59
  {/if}
60
- <div class="flex w-full flex-wrap justify-center gap-5">
60
+ <div class="flex w-full flex-wrap items-end justify-around gap-5">
61
61
  {#each localOptions as option, index}
62
62
  <div class={twMerge(`bg-blue flex flex-col`, option.class)}>
63
63
  {#if option.name}
@@ -14,7 +14,7 @@
14
14
  forConstructor = true,
15
15
  } = $props<{
16
16
  component: UIComponent & { properties: Partial<ISwitchProps> }
17
- onPropertyChange: (value: string | object, name?: string) => void
17
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
18
18
  forConstructor?: boolean
19
19
  }>()
20
20
  const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
@@ -133,7 +133,7 @@
133
133
  onClick={() => {
134
134
  const newOption: ISelectOption = {
135
135
  id: crypto.randomUUID(),
136
- name: ``,
136
+ name: component.properties?.options.length,
137
137
  value: component.properties?.options.length,
138
138
  class: 'bg-blue',
139
139
  }
@@ -149,6 +149,7 @@
149
149
  label={{ name: $t('constructor.props.optionname') }}
150
150
  wrapperClass="!w-3/10"
151
151
  value={option.name}
152
+ maxlength={4}
152
153
  onUpdate={(value) => {
153
154
  const options = [...(component.properties?.options || [])]
154
155
  options[index]['name'] = value
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISwitchProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const SwitchProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -17,7 +17,7 @@
17
17
  forConstructor = true,
18
18
  } = $props<{
19
19
  component: UIComponent & { properties: Partial<ITableProps<object>> }
20
- onPropertyChange: (value: string | object, name?: string) => void
20
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
21
21
  forConstructor?: boolean
22
22
  }>()
23
23
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITableProps<object>>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const TableProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -17,7 +17,7 @@
17
17
  forConstructor = true,
18
18
  } = $props<{
19
19
  component: UIComponent & { properties: Partial<ITabsProps> }
20
- onPropertyChange: (value: string | object, name?: string) => void
20
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
21
21
  forConstructor?: boolean
22
22
  }>()
23
23
 
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITabsProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const TabsProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -12,7 +12,7 @@
12
12
  forConstructor = true,
13
13
  } = $props<{
14
14
  component: UIComponent & { properties: Partial<ITextFieldProps> }
15
- onPropertyChange: (value: string | object, name?: string) => void
15
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
  const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
@@ -3,7 +3,7 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITextFieldProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
7
7
  forConstructor?: boolean;
8
8
  };
9
9
  declare const TextFieldProps: import("svelte").Component<$$ComponentProps, {}, "">;
package/dist/types.d.ts CHANGED
@@ -3,10 +3,11 @@ 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: (value: string | object, name?: string) => void, name?: string) => void;
6
+ }, onPropertyChange: (value?: string | object, name?: string, access?: string) => void) => void;
7
7
  export interface UIComponent {
8
8
  id: string;
9
9
  name?: string;
10
+ access?: 'full' | 'viewOnly' | 'hidden';
10
11
  type: 'Button' | 'Accordion' | 'Input' | 'Select' | 'Switch' | 'ColorPicker' | 'Slider' | 'TextField' | 'Joystick' | 'ProgressBar' | 'Graph' | 'Table' | 'Tabs' | 'FileAttach';
11
12
  properties: IAccordionProps | IButtonProps | IInputProps | ISelectProps | ISwitchProps | IColorPickerProps | ISliderProps | ITextFieldProps | IProgressBarProps | IGraphProps | ITableProps<object> | ITabsProps | IFileInputProps | IJoystickProps;
12
13
  position: Position;
@@ -107,6 +108,10 @@ export interface ISelectProps<T = unknown> {
107
108
  value?: ISelectOption<T> | null;
108
109
  options?: ISelectOption<T>[];
109
110
  bitMode?: boolean;
111
+ range?: {
112
+ start: number;
113
+ end: number;
114
+ };
110
115
  eventHandler?: IUIComponentHandler;
111
116
  onUpdate?: (value: ISelectOption<T>) => void;
112
117
  }
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- export const updateProperty = (path, value, component, onPropertyChange, name) => {
1
+ export const updateProperty = (path, value, component, onPropertyChange) => {
2
2
  const newProperties = JSON.parse(JSON.stringify(component.properties));
3
3
  const parts = path.split('.');
4
4
  let obj = newProperties;
@@ -9,5 +9,5 @@ export const updateProperty = (path, value, component, onPropertyChange, name) =
9
9
  obj = obj[part];
10
10
  }
11
11
  obj[parts[parts.length - 1]] = value;
12
- onPropertyChange(newProperties, name);
12
+ onPropertyChange(newProperties);
13
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.2.23",
3
+ "version": "1.2.25",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {