@rettangoli/ui 0.1.30 → 0.1.32-rc1

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 (89) hide show
  1. package/README.md +20 -85
  2. package/dist/rettangoli-iife-layout.min.js +113 -173
  3. package/dist/rettangoli-iife-ui.min.js +123 -183
  4. package/package.json +5 -4
  5. package/src/common/dimensions.js +72 -0
  6. package/src/common/link.js +111 -0
  7. package/src/common/responsive.js +8 -0
  8. package/src/common.js +43 -8
  9. package/src/components/accordionItem/accordionItem.handlers.js +1 -1
  10. package/src/components/accordionItem/accordionItem.schema.yaml +14 -0
  11. package/src/components/accordionItem/accordionItem.store.js +8 -8
  12. package/src/components/accordionItem/accordionItem.view.yaml +9 -38
  13. package/src/components/breadcrumb/breadcrumb.handlers.js +24 -3
  14. package/src/components/breadcrumb/breadcrumb.schema.yaml +51 -0
  15. package/src/components/breadcrumb/breadcrumb.store.js +66 -10
  16. package/src/components/breadcrumb/breadcrumb.view.yaml +18 -58
  17. package/src/components/dropdownMenu/dropdownMenu.handlers.js +17 -3
  18. package/src/components/dropdownMenu/dropdownMenu.schema.yaml +64 -0
  19. package/src/components/dropdownMenu/dropdownMenu.store.js +48 -6
  20. package/src/components/dropdownMenu/dropdownMenu.view.yaml +24 -46
  21. package/src/components/form/form.handlers.js +25 -108
  22. package/src/components/form/form.schema.yaml +283 -0
  23. package/src/components/form/form.store.js +19 -14
  24. package/src/components/form/form.view.yaml +28 -319
  25. package/src/components/globalUi/globalUi.handlers.js +2 -2
  26. package/src/components/globalUi/globalUi.schema.yaml +8 -0
  27. package/src/components/globalUi/globalUi.store.js +8 -8
  28. package/src/components/globalUi/globalUi.view.yaml +9 -46
  29. package/src/components/navbar/navbar.handlers.js +1 -1
  30. package/src/components/navbar/navbar.schema.yaml +25 -0
  31. package/src/components/navbar/navbar.store.js +28 -14
  32. package/src/components/navbar/navbar.view.yaml +21 -65
  33. package/src/components/pageOutline/pageOutline.handlers.js +17 -11
  34. package/src/components/pageOutline/pageOutline.schema.yaml +16 -0
  35. package/src/components/pageOutline/pageOutline.store.js +6 -7
  36. package/src/components/pageOutline/pageOutline.view.yaml +1 -29
  37. package/src/components/popoverInput/popoverInput.handlers.js +31 -31
  38. package/src/components/popoverInput/popoverInput.schema.yaml +18 -0
  39. package/src/components/popoverInput/popoverInput.store.js +9 -9
  40. package/src/components/popoverInput/popoverInput.view.yaml +5 -22
  41. package/src/components/select/select.handlers.js +31 -35
  42. package/src/components/select/select.schema.yaml +36 -0
  43. package/src/components/select/select.store.js +34 -35
  44. package/src/components/select/select.view.yaml +13 -56
  45. package/src/components/sidebar/sidebar.handlers.js +5 -5
  46. package/src/components/sidebar/sidebar.schema.yaml +57 -0
  47. package/src/components/sidebar/sidebar.store.js +45 -23
  48. package/src/components/sidebar/sidebar.view.yaml +79 -174
  49. package/src/components/sliderInput/sliderInput.handlers.js +28 -8
  50. package/src/components/sliderInput/sliderInput.schema.yaml +27 -0
  51. package/src/components/sliderInput/sliderInput.store.js +9 -9
  52. package/src/components/sliderInput/sliderInput.view.yaml +8 -33
  53. package/src/components/table/table.handlers.js +3 -3
  54. package/src/components/table/table.schema.yaml +27 -0
  55. package/src/components/table/table.store.js +8 -8
  56. package/src/components/table/table.view.yaml +16 -62
  57. package/src/components/tabs/tabs.schema.yaml +26 -0
  58. package/src/components/tabs/tabs.store.js +12 -9
  59. package/src/components/tabs/tabs.view.yaml +4 -60
  60. package/src/components/tooltip/tooltip.schema.yaml +18 -0
  61. package/src/components/tooltip/tooltip.store.js +7 -7
  62. package/src/components/tooltip/tooltip.view.yaml +4 -22
  63. package/src/components/waveform/waveform.handlers.js +6 -6
  64. package/src/components/waveform/waveform.schema.yaml +25 -0
  65. package/src/components/waveform/waveform.store.js +6 -6
  66. package/src/components/waveform/waveform.view.yaml +6 -34
  67. package/src/deps/createGlobalUI.js +2 -2
  68. package/src/primitives/button.js +200 -114
  69. package/src/primitives/colorPicker.js +56 -50
  70. package/src/primitives/dialog.js +2 -1
  71. package/src/primitives/image.js +73 -103
  72. package/src/primitives/input-number.js +139 -93
  73. package/src/primitives/input.js +87 -64
  74. package/src/primitives/popover.js +36 -28
  75. package/src/primitives/slider.js +6 -4
  76. package/src/primitives/svg.js +9 -10
  77. package/src/primitives/text.js +26 -47
  78. package/src/primitives/textarea.js +25 -9
  79. package/src/primitives/view.js +49 -90
  80. package/src/setup.js +1 -7
  81. package/src/styles/buttonMarginStyles.js +1 -13
  82. package/src/styles/cursorStyles.js +1 -5
  83. package/src/styles/flexDirectionStyles.js +4 -4
  84. package/src/styles/marginStylesForTarget.js +13 -0
  85. package/src/styles/textColorStyles.js +14 -6
  86. package/src/styles/textStyles.js +4 -4
  87. package/src/styles/viewStyles.js +6 -6
  88. package/src/styles/viewStylesForTarget.js +58 -0
  89. package/src/styles/flexChildStyles.js +0 -43
@@ -1,64 +1,24 @@
1
- elementName: rtgl-breadcrumb
2
-
3
- viewDataSchema:
4
- type: object
5
- properties:
6
- containerAttrString:
7
- type: string
8
- items:
9
- type: array
10
- items:
11
- type: object
12
- properties:
13
- label:
14
- type: string
15
- id:
16
- type: string
17
- separator:
18
- type: string
19
-
20
- propsSchema:
21
- type: object
22
- properties:
23
- items:
24
- type: array
25
- items:
26
- type: object
27
- properties:
28
- label:
29
- type: string
30
- id:
31
- type: string
32
- separator:
33
- type: string
34
- default: "breadcrumb-arrow"
35
-
36
1
  refs:
37
- item-*:
2
+ item*:
38
3
  eventListeners:
39
4
  click:
40
5
  handler: handleClickItem
41
- events:
42
- item-click:
43
- type: object
44
- properties:
45
- item:
46
- type: object
47
- properties:
48
- label:
49
- type: string
50
- id:
51
- type: string
52
- index:
53
- type: number
54
-
6
+ styles:
7
+ a:
8
+ text-decoration: none
9
+ color: inherit
55
10
  template:
56
11
  - rtgl-view d=h av=c g=md p=sm ${containerAttrString}:
57
- - $for item in items:
58
- - $if item.isSeparator:
59
- - rtgl-svg wh=16 svg=${separator} c=mu-fg:
60
- $elif item.id:
61
- - rtgl-view#item-${item.id} data-id=${item.id} cur=p:
62
- - rtgl-text s=sm c=mu-fg: "${item.label}"
63
- $else:
64
- - rtgl-text s=sm c=mu-fg: "${item.label}"
12
+ - $for item, i in items:
13
+ - $if item.isSeparator:
14
+ - rtgl-svg wh=16 svg=${sep} c=mu-fg: null
15
+ $elif item.isEllipsis:
16
+ - rtgl-text s=sm c=mu-fg: ${item.label}
17
+ $elif item.isInteractive && item.href:
18
+ - a#item${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index}:
19
+ - rtgl-text s=sm c=${item.c}: ${item.label}
20
+ $elif item.isInteractive:
21
+ - rtgl-view#item${i} data-index=${item.index} cur=pointer:
22
+ - rtgl-text s=sm c=${item.c}: ${item.label}
23
+ $else:
24
+ - rtgl-text s=sm c=${item.c}: ${item.label}
@@ -7,13 +7,27 @@ export const handleClosePopover = (deps, payload) => {
7
7
  export const handleClickMenuItem = (deps, payload) => {
8
8
  const { dispatchEvent, props } = deps;
9
9
  const event = payload._event;
10
- const index = parseInt(event.currentTarget.id.replace('option-', ''));
10
+ const index = Number(event.currentTarget.dataset.index ?? event.currentTarget.id.slice('option'.length));
11
11
  const item = props.items[index];
12
+ const itemType = item?.type || 'item';
12
13
 
13
- dispatchEvent(new CustomEvent('click-item', {
14
+ if (!item || itemType !== 'item' || item.disabled) {
15
+ event.preventDefault();
16
+ return;
17
+ }
18
+
19
+ if (!item.href) {
20
+ event.preventDefault();
21
+ }
22
+
23
+ dispatchEvent(new CustomEvent('item-click', {
14
24
  detail: {
15
25
  index,
16
- item
26
+ item,
27
+ id: item.id,
28
+ path: item.path,
29
+ href: item.href,
30
+ trigger: event.type,
17
31
  }
18
32
  }));
19
33
  }
@@ -0,0 +1,64 @@
1
+ componentName: rtgl-dropdown-menu
2
+ propsSchema:
3
+ type: object
4
+ properties:
5
+ items:
6
+ type: array
7
+ items:
8
+ type: object
9
+ properties:
10
+ label:
11
+ type: string
12
+ type:
13
+ type: string
14
+ enum:
15
+ - label
16
+ - item
17
+ - separator
18
+ id:
19
+ type: string
20
+ path:
21
+ type: string
22
+ href:
23
+ type: string
24
+ disabled:
25
+ type: boolean
26
+ newTab:
27
+ type: boolean
28
+ rel:
29
+ type: string
30
+ testId:
31
+ type: string
32
+ open:
33
+ type: string
34
+ x:
35
+ type: string
36
+ 'y':
37
+ type: string
38
+ place:
39
+ type: string
40
+ w:
41
+ type: string
42
+ h:
43
+ type: string
44
+ events:
45
+ close:
46
+ type: object
47
+ item-click:
48
+ type: object
49
+ properties:
50
+ index:
51
+ type: number
52
+ item:
53
+ type: object
54
+ id:
55
+ type: string
56
+ path:
57
+ type: string
58
+ href:
59
+ type: string
60
+ trigger:
61
+ type: string
62
+ methods:
63
+ type: object
64
+ properties: {}
@@ -2,12 +2,54 @@
2
2
  export const createInitialState = () => Object.freeze({
3
3
  });
4
4
 
5
- export const selectViewData = ({ props, attrs }) => {
5
+ const escapeAttrValue = (value) => `${value}`.replace(/"/g, '"');
6
+
7
+ const normalizeItems = (items) => {
8
+ return items.map((item, index) => {
9
+ const type = item.type || 'item';
10
+ const isSeparator = type === 'separator';
11
+ const isLabel = type === 'label';
12
+ const isItem = type === 'item';
13
+ const isDisabled = !!item.disabled;
14
+ const isInteractive = isItem && !isDisabled;
15
+ const c = isDisabled ? 'mu-fg' : 'fg';
16
+ const bgc = isDisabled ? 'mu' : 'mu';
17
+ const hoverBgc = isDisabled ? '' : 'ac';
18
+ const hasHref = typeof item.href === 'string' && item.href.length > 0;
19
+ const relValue = item.rel || (item.newTab ? 'noopener noreferrer' : '');
20
+ const linkExtraAttrs = [
21
+ item.newTab ? 'target="_blank"' : '',
22
+ relValue ? `rel="${escapeAttrValue(relValue)}"` : '',
23
+ ].filter(Boolean).join(' ');
24
+
25
+ return {
26
+ ...item,
27
+ index,
28
+ type,
29
+ isSeparator,
30
+ isLabel,
31
+ isItem,
32
+ isDisabled,
33
+ isInteractive,
34
+ hasHref,
35
+ linkExtraAttrs,
36
+ c,
37
+ bgc,
38
+ hoverBgc,
39
+ };
40
+ });
41
+ };
42
+
43
+ export const selectViewData = ({ props }) => {
44
+ const items = Array.isArray(props.items) ? props.items : [];
45
+
6
46
  return {
7
- items: props.items || [],
8
- open: !!attrs.open,
9
- x: attrs.x,
10
- y: attrs.y,
11
- placement: attrs.placement
47
+ items: normalizeItems(items),
48
+ open: !!props.open,
49
+ x: props.x || 0,
50
+ y: props.y || 0,
51
+ w: props.w || '300',
52
+ h: props.h || '300',
53
+ place: props.place || 'bs',
12
54
  };
13
55
  }
@@ -1,58 +1,36 @@
1
- elementName: rtgl-dropdown-menu
2
-
3
- viewDataSchema:
4
- type: object
5
-
6
- propsSchema:
7
- type: object
8
- properties:
9
- items:
10
- type: array
11
- items:
12
- type: object
13
- properties:
14
- label:
15
- type: string
16
- type:
17
- type: string
18
- enum:
19
- - label
20
- - item
21
- - separator
22
- testId:
23
- type: string
24
-
25
- attrsSchema:
26
- type: object
27
- properties:
28
- open:
29
- type: string
30
- x:
31
- type: string
32
- y:
33
- type: string
34
- placement:
35
- type: string
36
-
37
1
  refs:
38
2
  popover:
39
3
  eventListeners:
40
4
  close:
41
5
  handler: handleClosePopover
42
- option-*:
6
+ option*:
43
7
  eventListeners:
44
8
  click:
45
9
  handler: handleClickMenuItem
46
-
10
+ styles:
11
+ a:
12
+ text-decoration: none
13
+ color: inherit
47
14
  template:
48
- - rtgl-popover#popover ?open=${open} x=${x} y=${y} placement=${placement}:
49
- - rtgl-view wh=300 sv g=xs slot=content bgc=background br=md:
15
+ - rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place}:
16
+ - rtgl-view w=${w} h=${h} sv g=xs slot=content bgc=bg br=md:
50
17
  - $for item, i in items:
51
- - $if item.type == 'label':
18
+ - $if item.isLabel:
52
19
  - rtgl-view w=f ph=lg pv=md:
53
20
  - rtgl-text s=sm c=mu-fg: ${item.label}
54
- $elif item.type == 'item':
55
- - rtgl-view#option-${i} w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu data-testid=${item.testId}:
56
- - rtgl-text: ${item.label}
57
- $elif item.type == 'separator':
58
- - rtgl-view w=f h=1 ph=lg mv=md bgc=bo:
21
+ $elif item.isItem && item.isDisabled:
22
+ - rtgl-view w=f ph=lg pv=md br=md bgc=${item.bgc}:
23
+ - rtgl-text c=${item.c}: ${item.label}
24
+ $elif item.isItem && item.hasHref && item.linkExtraAttrs:
25
+ - a#option${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index} data-testid=${item.testId}:
26
+ - rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}:
27
+ - rtgl-text c=${item.c}: ${item.label}
28
+ $elif item.isItem && item.hasHref:
29
+ - a#option${i} href=${item.href} data-index=${item.index} data-testid=${item.testId}:
30
+ - rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}:
31
+ - rtgl-text c=${item.c}: ${item.label}
32
+ $elif item.isItem:
33
+ - rtgl-view#option${i} w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc} data-index=${item.index} data-testid=${item.testId}:
34
+ - rtgl-text c=${item.c}: ${item.label}
35
+ $elif item.isSeparator:
36
+ - rtgl-view w=f h=1 ph=lg mv=md bgc=bo: null
@@ -1,13 +1,13 @@
1
1
  const updateAttributes = ({ form, defaultValues = {}, refs }) => {
2
2
  const { fields = [] } = form;
3
- fields.forEach((field) => {
4
- const ref = refs[`field-${field.name}`]?.elm;
3
+ fields.forEach((field, index) => {
4
+ const ref = refs[`field${index}`];
5
5
 
6
6
  if (!ref) {
7
7
  return;
8
8
  }
9
9
 
10
- if (['input-textarea', 'inputText', 'input-text', 'input-number', 'colorPicker', 'slider', 'slider-input', 'popover-input'].includes(field.inputType)) {
10
+ if (['input-textarea', 'input-text', 'input-number', 'color-picker', 'slider', 'slider-input', 'popover-input'].includes(field.inputType)) {
11
11
  const defaultValue = defaultValues[field.name];
12
12
  if (defaultValue === undefined || defaultValue === null) {
13
13
  ref.removeAttribute('value')
@@ -15,7 +15,7 @@ const updateAttributes = ({ form, defaultValues = {}, refs }) => {
15
15
  ref.setAttribute('value', defaultValue)
16
16
  }
17
17
  }
18
- if (['inputText', 'input-text', 'input-textarea'].includes(field.inputType) && field.placeholder) {
18
+ if (['input-text', 'input-textarea'].includes(field.inputType) && field.placeholder) {
19
19
  const currentPlaceholder = ref.getAttribute('placeholder')
20
20
  if (currentPlaceholder !== field.placeholder) {
21
21
  if (field.placeholder === undefined || field.placeholder === null) {
@@ -31,16 +31,12 @@ const updateAttributes = ({ form, defaultValues = {}, refs }) => {
31
31
  const autoFocusFirstInput = (refs) => {
32
32
  // Find first focusable field
33
33
  for (const fieldKey in refs) {
34
- if (fieldKey.startsWith('field-')) {
34
+ if (fieldKey.startsWith('field')) {
35
35
  const fieldRef = refs[fieldKey];
36
- if (fieldRef && fieldRef.elm) {
37
- const element = fieldRef.elm;
38
-
39
- if (element.focus) {
40
- // Currently only available for input-text and input-textarea
41
- element.focus();
42
- return;
43
- }
36
+ if (fieldRef && fieldRef.focus) {
37
+ // Currently only available for input-text and input-textarea
38
+ fieldRef.focus();
39
+ return;
44
40
  }
45
41
  }
46
42
  }
@@ -49,18 +45,17 @@ const autoFocusFirstInput = (refs) => {
49
45
 
50
46
  export const handleBeforeMount = (deps) => {
51
47
  const { store, props } = deps;
52
- store.setFormValues(props.defaultValues);
48
+ store.setFormValues({ formValues: props.defaultValues });
53
49
  };
54
50
 
55
51
  export const handleAfterMount = (deps) => {
56
- const { props, getRefIds, render, attrs } = deps;
52
+ const { props, refs, render } = deps;
57
53
  const { form = {}, defaultValues } = props;
58
- const refs = getRefIds();
59
54
  updateAttributes({ form, defaultValues, refs });
60
55
  render();
61
56
 
62
57
  // Auto-focus first input field if autofocus attribute is set
63
- if (attrs?.autofocus) {
58
+ if (props?.autofocus) {
64
59
  setTimeout(() => {
65
60
  autoFocusFirstInput(refs);
66
61
  }, 50);
@@ -68,13 +63,12 @@ export const handleAfterMount = (deps) => {
68
63
  };
69
64
 
70
65
  export const handleOnUpdate = (deps, payload) => {
71
- const { oldAttrs, newAttrs, newProps } = payload;
72
- const { store, render, getRefIds } = deps;
66
+ const { oldProps, newProps } = payload;
67
+ const { store, render, refs } = deps;
73
68
  const { form = {}, defaultValues } = newProps;
74
- if (oldAttrs?.key !== newAttrs?.key) {
75
- const refs = getRefIds();
69
+ if (oldProps?.key !== newProps?.key) {
76
70
  updateAttributes({ form, defaultValues, refs });
77
- store.setFormValues(defaultValues);
71
+ store.setFormValues({ formValues: defaultValues });
78
72
  render();
79
73
  return;
80
74
  }
@@ -96,7 +90,7 @@ const dispatchFormChange = (name, fieldValue, formValues, dispatchEvent) => {
96
90
  export const handleActionClick = (deps, payload) => {
97
91
  const { store, dispatchEvent } = deps;
98
92
  const event = payload._event;
99
- const id = event.currentTarget.id.replace("action-", "");
93
+ const id = event.currentTarget.dataset.actionId || event.currentTarget.id.slice("action".length);
100
94
  dispatchEvent(
101
95
  new CustomEvent("action-click", {
102
96
  detail: {
@@ -108,15 +102,14 @@ export const handleActionClick = (deps, payload) => {
108
102
  };
109
103
 
110
104
  export const handleInputChange = (deps, payload) => {
111
- const { store, dispatchEvent, props } = deps;
105
+ const { store, dispatchEvent } = deps;
112
106
  const event = payload._event;
113
- let name = event.currentTarget.id.replace("field-", "");
114
- if (name && event.detail.value !== undefined) {
107
+ let name = event.currentTarget.dataset.fieldName || event.currentTarget.id.slice("field".length);
108
+ if (name && event.detail && Object.prototype.hasOwnProperty.call(event.detail, "value")) {
115
109
  const value = event.detail.value
116
110
  store.setFormFieldValue({
117
111
  name: name,
118
112
  value,
119
- props,
120
113
  });
121
114
  dispatchFormChange(
122
115
  name,
@@ -127,82 +120,6 @@ export const handleInputChange = (deps, payload) => {
127
120
  }
128
121
  };
129
122
 
130
- export const handleSelectChange = (deps, payload) => {
131
- const { store, dispatchEvent, render, props } = deps;
132
- const event = payload._event;
133
- const name = event.currentTarget.id.replace("field-", "");
134
- if (name) {
135
- store.setFormFieldValue({
136
- name: name,
137
- value: event.detail.selectedValue,
138
- props,
139
- });
140
- dispatchFormChange(
141
- name,
142
- event.detail.selectedValue,
143
- store.selectFormValues(),
144
- dispatchEvent,
145
- );
146
- render();
147
- }
148
- };
149
-
150
- export const handleColorPickerChange = (deps, payload) => {
151
- const { store, dispatchEvent, props } = deps;
152
- const event = payload._event;
153
- const name = event.currentTarget.id.replace("field-", "");
154
- if (name && event.detail.value !== undefined) {
155
- store.setFormFieldValue({
156
- name: name,
157
- value: event.detail.value,
158
- props,
159
- });
160
- dispatchFormChange(
161
- name,
162
- event.detail.value,
163
- store.selectFormValues(),
164
- dispatchEvent,
165
- );
166
- }
167
- };
168
-
169
- export const handleSliderChange = (deps, payload) => {
170
- const { store, dispatchEvent, props } = deps;
171
- const event = payload._event;
172
- const name = event.currentTarget.id.replace("field-", "");
173
- if (name && event.detail.value !== undefined) {
174
- store.setFormFieldValue({
175
- name: name,
176
- value: event.detail.value,
177
- props,
178
- });
179
- dispatchFormChange(
180
- name,
181
- event.detail.value,
182
- store.selectFormValues(),
183
- dispatchEvent,
184
- );
185
- }
186
- };
187
-
188
- export const handleSliderInputChange = (deps, payload) => {
189
- const { store, dispatchEvent, props } = deps;
190
- const event = payload._event;
191
- const name = event.currentTarget.id.replace("field-", "");
192
- if (name && event.detail.value !== undefined) {
193
- store.setFormFieldValue({
194
- name: name,
195
- value: event.detail.value,
196
- props,
197
- });
198
- dispatchFormChange(
199
- name,
200
- event.detail.value,
201
- store.selectFormValues(),
202
- dispatchEvent,
203
- );
204
- }
205
- };
206
123
 
207
124
  export const handleImageClick = (deps, payload) => {
208
125
  const event = payload._event;
@@ -210,7 +127,7 @@ export const handleImageClick = (deps, payload) => {
210
127
  event.preventDefault();
211
128
  }
212
129
  const { dispatchEvent } = deps;
213
- const name = event.currentTarget.id.replace("image-", "");
130
+ const name = event.currentTarget.dataset.fieldName || event.currentTarget.id.slice("image".length);
214
131
  dispatchEvent(
215
132
  new CustomEvent("extra-event", {
216
133
  detail: {
@@ -229,7 +146,7 @@ export const handleWaveformClick = (deps, payload) => {
229
146
  event.preventDefault();
230
147
  }
231
148
  const { dispatchEvent } = deps;
232
- const name = event.currentTarget.id.replace("waveform-", "");
149
+ const name = event.currentTarget.dataset.fieldName || event.currentTarget.id.slice("waveform".length);
233
150
  dispatchEvent(
234
151
  new CustomEvent("extra-event", {
235
152
  detail: {
@@ -245,7 +162,7 @@ export const handleWaveformClick = (deps, payload) => {
245
162
  export const handleSelectAddOption = (deps, payload) => {
246
163
  const { store, dispatchEvent } = deps;
247
164
  const event = payload._event;
248
- const name = event.currentTarget.id.replace("field-", "");
165
+ const name = event.currentTarget.dataset.fieldName || event.currentTarget.id.slice("field".length);
249
166
  dispatchEvent(
250
167
  new CustomEvent("action-click", {
251
168
  detail: {
@@ -260,7 +177,7 @@ export const handleSelectAddOption = (deps, payload) => {
260
177
  export const handleTooltipMouseEnter = (deps, payload) => {
261
178
  const { store, render, props } = deps;
262
179
  const event = payload._event;
263
- const fieldName = event.currentTarget.id.replace('tooltip-icon-', '');
180
+ const fieldName = event.currentTarget.dataset.fieldName || event.currentTarget.id.slice('tooltipIcon'.length);
264
181
 
265
182
  // Find the field with matching name to get tooltip content
266
183
  const form = props.form;
@@ -279,7 +196,7 @@ export const handleTooltipMouseEnter = (deps, payload) => {
279
196
 
280
197
  export const handleTooltipMouseLeave = (deps) => {
281
198
  const { store, render } = deps;
282
- store.hideTooltip();
199
+ store.hideTooltip({});
283
200
  render();
284
201
  };
285
202