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.
Files changed (41) hide show
  1. package/dist/Accordion/AccordionProps.svelte +4 -4
  2. package/dist/Accordion/AccordionProps.svelte.d.ts +7 -2
  3. package/dist/Button/Button.svelte +0 -1
  4. package/dist/Button/ButtonProps.svelte +18 -19
  5. package/dist/Button/ButtonProps.svelte.d.ts +7 -2
  6. package/dist/ColorPicker/ColorPickerProps.svelte +7 -8
  7. package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +7 -2
  8. package/dist/FileAttach/FileAttachProps.svelte +2 -2
  9. package/dist/FileAttach/FileAttachProps.svelte.d.ts +7 -2
  10. package/dist/Graph/GraphProps.svelte +27 -48
  11. package/dist/Graph/GraphProps.svelte.d.ts +7 -2
  12. package/dist/Input/Input.svelte +21 -21
  13. package/dist/Input/InputProps.svelte +8 -14
  14. package/dist/Input/InputProps.svelte.d.ts +7 -2
  15. package/dist/Joystick/Joystick.svelte +59 -56
  16. package/dist/Joystick/JoystickProps.svelte +215 -0
  17. package/dist/Joystick/JoystickProps.svelte.d.ts +15 -25
  18. package/dist/Map/Map.svelte +1 -1
  19. package/dist/Map/MapProps.svelte +17 -8
  20. package/dist/Map/MapProps.svelte.d.ts +7 -2
  21. package/dist/ProgressBar/ProgressBarProps.svelte +4 -4
  22. package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +7 -2
  23. package/dist/Select/Select.svelte +0 -1
  24. package/dist/Select/SelectProps.svelte +51 -12
  25. package/dist/Select/SelectProps.svelte.d.ts +7 -2
  26. package/dist/Slider/Slider.svelte +3 -2
  27. package/dist/Slider/SliderProps.svelte +8 -7
  28. package/dist/Slider/SliderProps.svelte.d.ts +7 -2
  29. package/dist/Switch/Switch.svelte +1 -1
  30. package/dist/Switch/SwitchProps.svelte +49 -40
  31. package/dist/Switch/SwitchProps.svelte.d.ts +7 -2
  32. package/dist/Table/Table.svelte +7 -2
  33. package/dist/Table/TableProps.svelte +32 -12
  34. package/dist/Table/TableProps.svelte.d.ts +7 -2
  35. package/dist/Tabs/TabsProps.svelte +10 -11
  36. package/dist/Tabs/TabsProps.svelte.d.ts +7 -2
  37. package/dist/TextField/TextFieldProps.svelte +3 -5
  38. package/dist/TextField/TextFieldProps.svelte.d.ts +7 -2
  39. package/dist/types.d.ts +24 -8
  40. package/dist/types.js +10 -1
  41. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onMount } from 'svelte'
3
3
  import { t } from '../locales/i18n'
4
- import { type UIComponent, type ISelectProps, type ISelectOption, updateProperty } from '../types'
4
+ import { type UIComponent, type ISelectProps, type ISelectOption, updateProperty, type IUIComponentHandler } from '../types'
5
5
  import * as UI from '..'
6
6
  import ButtonDelete from '../libIcons/ButtonDelete.svelte'
7
7
  import ButtonAdd from '../libIcons/ButtonAdd.svelte'
@@ -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, access?: string) => void
17
+ onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
18
18
  forConstructor?: boolean
19
19
  }>()
20
20
 
@@ -36,7 +36,7 @@
36
36
  )
37
37
 
38
38
  let Header: ISelectOption = $derived(
39
- $optionsStore.HEADER_OPTIONS.find((h) => h.value === component.properties.eventHandler.Header) ?? {
39
+ $optionsStore.HEADER_OPTIONS.find((h) => h.value === component.eventHandler.Header) ?? {
40
40
  id: '',
41
41
  name: '',
42
42
  value: '',
@@ -81,27 +81,27 @@
81
81
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
82
82
  onUpdate={(value) => {
83
83
  updateProperty('id', value.value as string, component, onPropertyChange)
84
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
84
+ onPropertyChange({ eventHandler: { Variables: value.value as string } })
85
85
  }}
86
86
  />
87
87
  <UI.Select
88
88
  label={{ name: $t('constructor.props.argument') }}
89
89
  type="buttons"
90
- value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument) ??
90
+ value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.eventHandler.Argument) ??
91
91
  $optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === '')}
92
92
  options={$optionsStore.FULL_ARGUMENT_OPTION}
93
93
  onUpdate={(option) => {
94
- updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
94
+ onPropertyChange({ eventHandler: { Argument: option.value as string } })
95
95
  }}
96
96
  />
97
97
 
98
98
  <UI.Input
99
99
  wrapperClass="{Header.value === 'SET' ? 'mt-1' : ''} "
100
- value={component.properties.eventHandler.Argument}
100
+ value={component.eventHandler.Argument}
101
101
  maxlength={32}
102
- disabled={component.properties.eventHandler.Argument == 'Save' || component.properties.eventHandler.Argument == 'NoSave'}
102
+ disabled={component.eventHandler.Argument == 'Save' || component.eventHandler.Argument == 'NoSave'}
103
103
  help={{ info: $t('constructor.props.argument.info'), autocomplete: 'on', regExp: /^[a-zA-Z0-9\-_]{0,32}$/ }}
104
- onUpdate={(value) => updateProperty('eventHandler.Argument', value as string, component, onPropertyChange)}
104
+ onUpdate={(value) => onPropertyChange({ eventHandler: { Argument: value as string } })}
105
105
  />
106
106
  </div>
107
107
  <div class="flex w-1/3 flex-col items-center px-2">
@@ -110,7 +110,7 @@
110
110
  type="buttons"
111
111
  options={$optionsStore.ACCESS_OPTION}
112
112
  value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
113
- onUpdate={(option) => onPropertyChange(null, null, option.value)}
113
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
114
114
  />
115
115
  <UI.Select
116
116
  label={{ name: $t('constructor.props.type') }}
@@ -273,7 +273,7 @@
273
273
  type="buttons"
274
274
  options={$optionsStore.ACCESS_OPTION}
275
275
  value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
276
- onUpdate={(option) => onPropertyChange(null, null, option.value)}
276
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
277
277
  />
278
278
  <UI.Input
279
279
  label={{ name: $t('constructor.props.wrapperclass') }}
@@ -297,7 +297,9 @@
297
297
  label={{ name: $t('constructor.props.disabled') }}
298
298
  value={component.properties.disabled}
299
299
  options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
300
- onChange={(value) => updateProperty('disabled', value, component, onPropertyChange)}
300
+ onChange={(value) => {
301
+ updateProperty('disabled', value, component, onPropertyChange)
302
+ }}
301
303
  />
302
304
  </div>
303
305
  <div class="flex w-1/3 flex-col items-center px-2">
@@ -312,6 +314,7 @@
312
314
  wrapperClass="h-14"
313
315
  label={{ name: $t('constructor.props.valuetype') }}
314
316
  type="buttons"
317
+ disabled={component.properties.bitMode}
315
318
  options={$optionsStore.SELECT_VALUE_TYPE_OPTIONS}
316
319
  value={currentValueType}
317
320
  onUpdate={(value) => {
@@ -325,6 +328,41 @@
325
328
  updateProperty('options', options, component, onPropertyChange)
326
329
  }}
327
330
  />
331
+
332
+ <UI.Switch
333
+ wrapperClass="bg-blue"
334
+ label={{ name: $t('constructor.props.bitmode') }}
335
+ value={component.properties.bitMode}
336
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
337
+ onChange={(value) => {
338
+ updateProperty('bitMode', value, component, onPropertyChange)
339
+ currentValueType = $optionsStore.SELECT_VALUE_TYPE_OPTIONS[1] as ValueTypeOption
340
+ const options = [...(component.properties?.options || [])]
341
+ const newType = $optionsStore.SELECT_VALUE_TYPE_OPTIONS[1].value
342
+ options.forEach((option) => {
343
+ if (newType === 'number') option.value = option.value !== undefined ? Number(option.value) : 0
344
+ else option.value = option.value !== undefined ? String(option.value) : ''
345
+ })
346
+ updateProperty('options', options, component, onPropertyChange)
347
+ if (value) generateBitOptions(component.properties.range.start, component.properties.range.end)
348
+ }}
349
+ />
350
+ {#if component.properties.bitMode}
351
+ <UI.Slider
352
+ label={{ name: $t('constructor.props.range') }}
353
+ type="range"
354
+ number={{ minNum: 0, maxNum: 31, step: 1 }}
355
+ value={[component.properties.range.start, component.properties.range.end]}
356
+ onUpdate={(value) => {
357
+ if (Array.isArray(value)) {
358
+ if (value[1] - value[0] > 6) value = [value[0], value[0] + 6]
359
+ updateProperty('range.start', value[0] as number, component, onPropertyChange)
360
+ updateProperty('range.end', value[1] as number, component, onPropertyChange)
361
+ generateBitOptions(component.properties.range.start, component.properties.range.end)
362
+ }
363
+ }}
364
+ />
365
+ {/if}
328
366
  </div>
329
367
  </div>
330
368
 
@@ -366,6 +404,7 @@
366
404
  label={{ name: $t('constructor.props.optionvalue') }}
367
405
  wrapperClass="!w-3/10"
368
406
  value={option.value}
407
+ readonly={component.properties.bitMode}
369
408
  type={currentValueType.value}
370
409
  onUpdate={(value) => {
371
410
  const options = [...(component.properties?.options || [])]
@@ -1,9 +1,14 @@
1
- import { type UIComponent, type ISelectProps } from '../types';
1
+ import { type UIComponent, type ISelectProps, type IUIComponentHandler } from '../types';
2
2
  type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISelectProps>;
5
5
  };
6
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
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 SelectProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -105,7 +105,7 @@
105
105
  onmousedown={() => (activeRound = 'ceil')}
106
106
  {disabled}
107
107
  class={twMerge(
108
- `slider-bg basis-[calc(${(centerNum / number.maxNum) * 100}%+2rem+5px)] h-8 w-full appearance-none overflow-hidden
108
+ `basis-[calc(${(centerNum / number.maxNum) * 100}%+2rem+5px)] h-8 w-full appearance-none overflow-hidden
109
109
  accent-(--back-color)
110
110
  [&::-webkit-slider-runnable-track]:rounded-l-full
111
111
  [&::-webkit-slider-runnable-track]:bg-(--gray-color)
@@ -196,7 +196,7 @@
196
196
  bind:value={singleValue}
197
197
  oninput={() => onUpdate(singleValue)}
198
198
  class={twMerge(
199
- ` h-8 w-full appearance-none overflow-hidden rounded-full accent-(--back-color)
199
+ `h-8 w-full appearance-none overflow-hidden rounded-full accent-(--back-color)
200
200
  [&::-webkit-slider-runnable-track]:rounded-full
201
201
  [&::-webkit-slider-runnable-track]:bg-(--gray-color)
202
202
  [&::-webkit-slider-thumb]:relative
@@ -225,6 +225,7 @@
225
225
  `[&::-moz-range-thumb]:shadow-[calc(100rem*-1-0.5rem)_0_0_100rem]
226
226
  [&::-webkit-slider-thumb]:shadow-[calc(100rem*-1-0.5rem)_0_0_100rem]`,
227
227
  )}
228
+ style="color: var(--bg-color);"
228
229
  />
229
230
  </div>
230
231
  {/if}
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext } from 'svelte'
3
3
  import { t } from '../locales/i18n'
4
- import { type UIComponent, type ISliderProps, updateProperty } from '../types'
4
+ import { type UIComponent, type ISliderProps, updateProperty, type IUIComponentHandler } from '../types'
5
5
  import * as UI from '..'
6
6
  import { optionsStore } from '../options'
7
7
  import { twMerge } from 'tailwind-merge'
@@ -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, access?: string) => void
15
+ onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
 
@@ -41,17 +41,18 @@
41
41
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
42
42
  onUpdate={(value) => {
43
43
  updateProperty('id', value.value as string, component, onPropertyChange)
44
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
45
- onPropertyChange(null, value.name?.split('—')[1].trim(), null)
44
+ onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
46
45
  }}
47
46
  />
48
47
  <UI.Select
49
48
  label={{ name: $t('constructor.props.action') }}
50
49
  type="buttons"
51
- value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument)}
50
+ value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.eventHandler.Argument)}
52
51
  options={$optionsStore.SHORT_ARGUMENT_OPTION}
53
52
  onUpdate={(option) => {
54
53
  updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
54
+
55
+ onPropertyChange({ eventHandler: { Argument: option.value as string } })
55
56
  }}
56
57
  />
57
58
  <UI.Select
@@ -59,7 +60,7 @@
59
60
  type="buttons"
60
61
  options={$optionsStore.ACCESS_OPTION}
61
62
  value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
62
- onUpdate={(option) => onPropertyChange(null, null, option.value)}
63
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
63
64
  />
64
65
  </div>
65
66
  <div class="flex w-1/3 flex-col px-2">
@@ -157,7 +158,7 @@
157
158
  type="buttons"
158
159
  options={$optionsStore.ACCESS_OPTION}
159
160
  value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
160
- onUpdate={(option) => onPropertyChange(null, null, option.value)}
161
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
161
162
  />
162
163
  <UI.Input
163
164
  label={{ name: $t('constructor.props.label') }}
@@ -1,9 +1,14 @@
1
- import { type UIComponent, type ISliderProps } from '../types';
1
+ import { type UIComponent, type ISliderProps, type IUIComponentHandler } from '../types';
2
2
  type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISliderProps>;
5
5
  };
6
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
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 SliderProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -60,7 +60,7 @@
60
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
- {#if option.name}
63
+ {#if option.name && bitMode}
64
64
  <span>{option.name}</span>
65
65
  {/if}
66
66
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext } from 'svelte'
3
3
  import { t } from '../locales/i18n'
4
- import { type UIComponent, type ISwitchProps, updateProperty, type ISelectOption } from '../types'
4
+ import { type UIComponent, type ISwitchProps, updateProperty, type ISelectOption, type IUIComponentHandler } from '../types'
5
5
  import * as UI from '..'
6
6
  import { optionsStore } from '../options'
7
7
  import { twMerge } from 'tailwind-merge'
@@ -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, access?: string) => void
17
+ onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
18
18
  forConstructor?: boolean
19
19
  }>()
20
20
  const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
@@ -37,17 +37,16 @@
37
37
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
38
38
  onUpdate={(value) => {
39
39
  updateProperty('id', value.value as string, component, onPropertyChange)
40
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
41
- onPropertyChange(null, value.name?.split('—')[1].trim(), null)
40
+ onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
42
41
  }}
43
42
  />
44
43
  <UI.Select
45
44
  label={{ name: $t('constructor.props.action') }}
46
45
  type="buttons"
47
- value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument)}
46
+ value={$optionsStore.SHORT_ARGUMENT_OPTION.find((h) => h.value === component.eventHandler.Argument)}
48
47
  options={$optionsStore.SHORT_ARGUMENT_OPTION}
49
48
  onUpdate={(option) => {
50
- updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
49
+ onPropertyChange({ eventHandler: { Argument: option.value as string } })
51
50
  }}
52
51
  />
53
52
  <UI.Select
@@ -55,7 +54,7 @@
55
54
  type="buttons"
56
55
  options={$optionsStore.ACCESS_OPTION}
57
56
  value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
58
- onUpdate={(option) => onPropertyChange(null, null, option.value)}
57
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
59
58
  />
60
59
  </div>
61
60
 
@@ -230,28 +229,29 @@
230
229
  type="buttons"
231
230
  options={$optionsStore.ACCESS_OPTION}
232
231
  value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
233
- onUpdate={(option) => onPropertyChange(null, null, option.value)}
232
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
234
233
  />
235
234
  <UI.Input
236
235
  label={{ name: $t('constructor.props.wrapperclass') }}
237
236
  value={component.properties.wrapperClass}
238
237
  onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
239
238
  />
240
- <UI.Select
241
- wrapperClass=" h-14"
242
- label={{ name: $t('constructor.props.colors') }}
243
- type="buttons"
244
- options={$optionsStore.COLOR_OPTIONS.filter((option) => option.value !== 'bg-max' && option.value !== 'bg-gray')}
245
- value={component.properties.options[0].class.split(' ').find((cls: string) => cls.startsWith('bg-'))}
246
- onUpdate={(option) => {
247
- updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)
248
- const options = [...(component.properties?.options || [])]
249
- options.forEach((o) => {
250
- o['class'] = option.value
251
- })
252
- updateProperty('options', options, component, onPropertyChange)
253
- }}
254
- />
239
+ {#if !component.properties.bitMode}
240
+ <UI.Select
241
+ wrapperClass="!h-14"
242
+ label={{ name: $t('constructor.props.colors') }}
243
+ type="buttons"
244
+ options={$optionsStore.COLOR_OPTIONS.filter((option) => option.value !== 'bg-max' && option.value !== 'bg-gray')}
245
+ value={$optionsStore.COLOR_OPTIONS.find((c) =>
246
+ (c.value as string).includes(component.properties.options[0].class.split(' ').find((cls: string) => cls.startsWith('bg-'))),
247
+ )}
248
+ onUpdate={(option) => {
249
+ const options = [...(component.properties?.options || [])]
250
+ options[0]['class'] = option.value
251
+ updateProperty('options', options, component, onPropertyChange)
252
+ }}
253
+ />
254
+ {/if}
255
255
  </div>
256
256
  <div class="flex w-1/3 flex-col px-2">
257
257
  <UI.Input
@@ -259,19 +259,22 @@
259
259
  value={component.properties.label.name}
260
260
  onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
261
261
  />
262
- <UI.Input
263
- label={{ name: $t('constructor.props.caption.left') }}
264
- value={component.properties.label.captionLeft}
265
- onUpdate={(value) => updateProperty('label.captionLeft', value as string, component, onPropertyChange)}
266
- />
267
- <UI.Input
268
- label={{ name: $t('constructor.props.caption.right') }}
269
- value={component.properties.label.captionRight}
270
- onUpdate={(value) => updateProperty('label.captionRight', value as string, component, onPropertyChange)}
271
- />
262
+ {#if !component.properties.bitMode}
263
+ <UI.Input
264
+ label={{ name: $t('constructor.props.caption.left') }}
265
+ value={component.properties.label.captionLeft}
266
+ onUpdate={(value) => updateProperty('label.captionLeft', value as string, component, onPropertyChange)}
267
+ />
268
+ <UI.Input
269
+ label={{ name: $t('constructor.props.caption.right') }}
270
+ value={component.properties.label.captionRight}
271
+ onUpdate={(value) => updateProperty('label.captionRight', value as string, component, onPropertyChange)}
272
+ />
273
+ {/if}
272
274
  <UI.Select
273
275
  wrapperClass="!h-14"
274
276
  label={{ name: $t('constructor.props.type') }}
277
+ disabled={component.properties.bitMode}
275
278
  type="buttons"
276
279
  options={$optionsStore.SWITCH_OPTIONS}
277
280
  value={$optionsStore.SWITCH_OPTIONS.find((option) => option.value == component.properties.type)}
@@ -291,13 +294,19 @@
291
294
  number={{ minNum: 0, maxNum: component.properties.bitMode ? Math.pow(2, 32) : 1, step: 1 }}
292
295
  onUpdate={(value) => updateProperty('value', value as number, component, onPropertyChange)}
293
296
  />
294
- <UI.Switch
295
- wrapperClass="bg-blue"
296
- label={{ name: $t('constructor.props.disabled') }}
297
- value={component.properties.disabled}
298
- options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
299
- onChange={(value) => updateProperty('disabled', value, component, onPropertyChange)}
300
- />
297
+ {#if !component.properties.bitMode}
298
+ <UI.Switch
299
+ wrapperClass="bg-blue"
300
+ label={{ name: $t('constructor.props.disabled') }}
301
+ value={component.properties.options[0].disabled}
302
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
303
+ onChange={(value) => {
304
+ const options = [...(component.properties?.options || [])]
305
+ options[0]['disabled'] = value
306
+ updateProperty('options', options, component, onPropertyChange)
307
+ }}
308
+ />
309
+ {/if}
301
310
  <UI.Switch
302
311
  wrapperClass="bg-blue"
303
312
  label={{ name: $t('constructor.props.bitmode') }}
@@ -1,9 +1,14 @@
1
- import { type UIComponent, type ISwitchProps } from '../types';
1
+ import { type UIComponent, type ISwitchProps, type IUIComponentHandler } from '../types';
2
2
  type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISwitchProps>;
5
5
  };
6
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
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 SwitchProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -2,7 +2,7 @@
2
2
  <script lang="ts">
3
3
  import { get } from 'svelte/store'
4
4
  import type { ITableHeader, ITableProps } from '../types'
5
- import { fly } from 'svelte/transition'
5
+ import { fade, fly } from 'svelte/transition'
6
6
  import { twMerge } from 'tailwind-merge'
7
7
  import { onMount } from 'svelte'
8
8
 
@@ -284,7 +284,12 @@
284
284
  >
285
285
  <div class=" size-5 text-sm [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full">
286
286
  {#if copiedCell.y === index && copiedCell.x === column.key}
287
- <div class="rounded-md bg-(--green-color) shadow-lg">✓</div>
287
+ <div
288
+ class="absolute top-1/2 right-3.5 -translate-y-1/2 transform rounded-md bg-(--green-color) px-1.5 py-1 shadow-lg"
289
+ transition:fade={{ duration: 200 }}
290
+ >
291
+
292
+ </div>
288
293
  {:else}
289
294
  <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
290
295
  <g fill="none" stroke="currentColor" stroke-width="1.5">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext } from 'svelte'
3
3
  import { t } from '../locales/i18n'
4
- import { type UIComponent, type ITableProps, type ITableHeader, updateProperty } from '../types'
4
+ import { type UIComponent, type ITableProps, type ITableHeader, updateProperty, type IUIComponentHandler } from '../types'
5
5
  import * as UI from '..'
6
6
  import ButtonDelete from '../libIcons/ButtonDelete.svelte'
7
7
  import ButtonAdd from '../libIcons/ButtonAdd.svelte'
@@ -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, access?: string) => void
20
+ onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
21
21
  forConstructor?: boolean
22
22
  }>()
23
23
 
@@ -57,11 +57,14 @@
57
57
  }
58
58
 
59
59
  const updateButtonProperty = (columnIndex: number, buttonIndex: number, field: string, value: any) => {
60
- const headers = [...component.properties.header]
61
- const buttons = [...headers[columnIndex].buttons]
62
- buttons[buttonIndex] = { ...buttons[buttonIndex], [field]: value }
63
- headers[columnIndex].buttons = buttons
64
- updateProperty('header', headers, component, onPropertyChange)
60
+ if (field === 'eventHandler') {
61
+ } else {
62
+ const headers = [...component.properties.header]
63
+ const buttons = [...headers[columnIndex].buttons]
64
+ buttons[buttonIndex] = { ...buttons[buttonIndex], [field]: value }
65
+ headers[columnIndex].buttons = buttons
66
+ updateProperty('header', headers, component, onPropertyChange)
67
+ }
65
68
  }
66
69
 
67
70
  const removeButtonFromColumn = (columnIndex: number, buttonIndex: number) => {
@@ -82,8 +85,7 @@
82
85
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
83
86
  onUpdate={(value) => {
84
87
  updateProperty('id', value.value as string, component, onPropertyChange)
85
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
86
- onPropertyChange(null, value.name?.split('—')[1].trim(), null)
88
+ onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
87
89
  }}
88
90
  />
89
91
  <UI.Select
@@ -91,7 +93,7 @@
91
93
  type="buttons"
92
94
  options={$optionsStore.ACCESS_OPTION}
93
95
  value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
94
- onUpdate={(option) => onPropertyChange(null, null, option.value)}
96
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
95
97
  />
96
98
  </div>
97
99
  <div class="flex w-1/3 flex-col px-2">
@@ -144,6 +146,9 @@
144
146
  }
145
147
  const headers = [...(component.properties.header || []), newColumn]
146
148
  updateProperty('header', headers, component, onPropertyChange)
149
+ headers.forEach((h) => {
150
+ updateTableHeader(headers.indexOf(h), 'width', `${(100 / headers.length).toFixed(2)}%`)
151
+ })
147
152
  updateTableBody()
148
153
  }}
149
154
  />
@@ -219,6 +224,9 @@
219
224
  const headers = [...(component.properties.header || [])]
220
225
  headers.splice(columnIndex, 1)
221
226
  updateProperty('header', headers, component, onPropertyChange)
227
+ headers.forEach((h) => {
228
+ updateTableHeader(headers.indexOf(h), 'width', `${(100 / headers.length).toFixed(2)}%`)
229
+ })
222
230
  }}
223
231
  />
224
232
  </div>
@@ -266,7 +274,13 @@
266
274
  updateButtonProperty(columnIndex, buttonIndex, 'eventHandler', handler)
267
275
  }}
268
276
  />
269
- <UI.Button wrapperClass="w-8" content={{ icon: ButtonDelete }} onClick={() => removeButtonFromColumn(columnIndex, buttonIndex)} />
277
+ <UI.Button
278
+ wrapperClass="w-8"
279
+ content={{ icon: ButtonDelete }}
280
+ onClick={() => {
281
+ removeButtonFromColumn(columnIndex, buttonIndex)
282
+ }}
283
+ />
270
284
  </div>
271
285
  {/each}
272
286
  </div>
@@ -309,7 +323,7 @@
309
323
  type="buttons"
310
324
  options={$optionsStore.ACCESS_OPTION}
311
325
  value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
312
- onUpdate={(option) => onPropertyChange(null, null, option.value)}
326
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
313
327
  />
314
328
  <UI.Input
315
329
  label={{ name: $t('constructor.props.label') }}
@@ -357,6 +371,9 @@
357
371
  }
358
372
  const headers = [...(component.properties.header || []), newColumn]
359
373
  updateProperty('header', headers, component, onPropertyChange)
374
+ headers.forEach((h) => {
375
+ updateTableHeader(headers.indexOf(h), 'width', `${(100 / headers.length).toFixed(2)}%`)
376
+ })
360
377
  updateTableBody()
361
378
  }}
362
379
  />
@@ -432,6 +449,9 @@
432
449
  const headers = [...(component.properties.header || [])]
433
450
  headers.splice(columnIndex, 1)
434
451
  updateProperty('header', headers, component, onPropertyChange)
452
+ headers.forEach((h) => {
453
+ updateTableHeader(headers.indexOf(h), 'width', `${(100 / headers.length).toFixed(2)}%`)
454
+ })
435
455
  }}
436
456
  />
437
457
  </div>
@@ -1,9 +1,14 @@
1
- import { type UIComponent, type ITableProps } from '../types';
1
+ import { type UIComponent, type ITableProps, type IUIComponentHandler } from '../types';
2
2
  type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITableProps<object>>;
5
5
  };
6
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
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 TableProps: import("svelte").Component<$$ComponentProps, {}, "">;