poe-svelte-ui-lib 1.2.23 → 1.2.24
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/Select/Select.svelte +1 -0
- package/dist/Select/SelectProps.svelte +10 -12
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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) <<
|
|
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
|
|
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
|
|
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>
|
package/dist/types.d.ts
CHANGED
|
@@ -107,6 +107,10 @@ export interface ISelectProps<T = unknown> {
|
|
|
107
107
|
value?: ISelectOption<T> | null;
|
|
108
108
|
options?: ISelectOption<T>[];
|
|
109
109
|
bitMode?: boolean;
|
|
110
|
+
range?: {
|
|
111
|
+
start: number;
|
|
112
|
+
end: number;
|
|
113
|
+
};
|
|
110
114
|
eventHandler?: IUIComponentHandler;
|
|
111
115
|
onUpdate?: (value: ISelectOption<T>) => void;
|
|
112
116
|
}
|