@rettangoli/ui 0.1.31 → 1.0.0-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.
- package/README.md +20 -85
- package/dist/rettangoli-iife-layout.min.js +113 -173
- package/dist/rettangoli-iife-ui.min.js +123 -183
- package/package.json +5 -4
- package/src/common/dimensions.js +72 -0
- package/src/common/link.js +111 -0
- package/src/common/responsive.js +8 -0
- package/src/common.js +43 -8
- package/src/components/accordionItem/accordionItem.handlers.js +1 -1
- package/src/components/accordionItem/accordionItem.schema.yaml +14 -0
- package/src/components/accordionItem/accordionItem.store.js +8 -8
- package/src/components/accordionItem/accordionItem.view.yaml +5 -35
- package/src/components/breadcrumb/breadcrumb.handlers.js +24 -3
- package/src/components/breadcrumb/breadcrumb.schema.yaml +51 -0
- package/src/components/breadcrumb/breadcrumb.store.js +66 -10
- package/src/components/breadcrumb/breadcrumb.view.yaml +18 -58
- package/src/components/dropdownMenu/dropdownMenu.handlers.js +17 -3
- package/src/components/dropdownMenu/dropdownMenu.schema.yaml +64 -0
- package/src/components/dropdownMenu/dropdownMenu.store.js +48 -6
- package/src/components/dropdownMenu/dropdownMenu.view.yaml +24 -46
- package/src/components/form/form.handlers.js +25 -108
- package/src/components/form/form.schema.yaml +283 -0
- package/src/components/form/form.store.js +19 -14
- package/src/components/form/form.view.yaml +28 -319
- package/src/components/globalUi/globalUi.handlers.js +2 -2
- package/src/components/globalUi/globalUi.schema.yaml +8 -0
- package/src/components/globalUi/globalUi.store.js +8 -8
- package/src/components/globalUi/globalUi.view.yaml +9 -46
- package/src/components/navbar/navbar.handlers.js +1 -1
- package/src/components/navbar/navbar.schema.yaml +25 -0
- package/src/components/navbar/navbar.store.js +28 -14
- package/src/components/navbar/navbar.view.yaml +21 -65
- package/src/components/pageOutline/pageOutline.handlers.js +17 -11
- package/src/components/pageOutline/pageOutline.schema.yaml +16 -0
- package/src/components/pageOutline/pageOutline.store.js +6 -7
- package/src/components/pageOutline/pageOutline.view.yaml +1 -29
- package/src/components/popoverInput/popoverInput.handlers.js +31 -31
- package/src/components/popoverInput/popoverInput.schema.yaml +18 -0
- package/src/components/popoverInput/popoverInput.store.js +9 -9
- package/src/components/popoverInput/popoverInput.view.yaml +5 -22
- package/src/components/select/select.handlers.js +31 -35
- package/src/components/select/select.schema.yaml +36 -0
- package/src/components/select/select.store.js +34 -35
- package/src/components/select/select.view.yaml +13 -56
- package/src/components/sidebar/sidebar.handlers.js +5 -5
- package/src/components/sidebar/sidebar.schema.yaml +57 -0
- package/src/components/sidebar/sidebar.store.js +45 -23
- package/src/components/sidebar/sidebar.view.yaml +79 -174
- package/src/components/sliderInput/sliderInput.handlers.js +28 -8
- package/src/components/sliderInput/sliderInput.schema.yaml +27 -0
- package/src/components/sliderInput/sliderInput.store.js +9 -9
- package/src/components/sliderInput/sliderInput.view.yaml +8 -33
- package/src/components/table/table.handlers.js +3 -3
- package/src/components/table/table.schema.yaml +27 -0
- package/src/components/table/table.store.js +8 -8
- package/src/components/table/table.view.yaml +16 -62
- package/src/components/tabs/tabs.schema.yaml +26 -0
- package/src/components/tabs/tabs.store.js +12 -9
- package/src/components/tabs/tabs.view.yaml +4 -60
- package/src/components/tooltip/tooltip.schema.yaml +18 -0
- package/src/components/tooltip/tooltip.store.js +7 -7
- package/src/components/tooltip/tooltip.view.yaml +4 -22
- package/src/components/waveform/waveform.handlers.js +6 -6
- package/src/components/waveform/waveform.schema.yaml +25 -0
- package/src/components/waveform/waveform.store.js +6 -6
- package/src/components/waveform/waveform.view.yaml +6 -34
- package/src/deps/createGlobalUI.js +2 -2
- package/src/primitives/button.js +200 -114
- package/src/primitives/colorPicker.js +56 -50
- package/src/primitives/dialog.js +2 -1
- package/src/primitives/image.js +73 -103
- package/src/primitives/input-number.js +139 -93
- package/src/primitives/input.js +87 -64
- package/src/primitives/popover.js +36 -28
- package/src/primitives/slider.js +6 -4
- package/src/primitives/svg.js +9 -10
- package/src/primitives/text.js +26 -47
- package/src/primitives/textarea.js +25 -9
- package/src/primitives/view.js +49 -90
- package/src/setup.js +1 -7
- package/src/styles/buttonMarginStyles.js +1 -13
- package/src/styles/cursorStyles.js +1 -5
- package/src/styles/flexDirectionStyles.js +4 -4
- package/src/styles/marginStylesForTarget.js +13 -0
- package/src/styles/textColorStyles.js +14 -6
- package/src/styles/textStyles.js +4 -4
- package/src/styles/viewStyles.js +6 -6
- package/src/styles/viewStylesForTarget.js +58 -0
- package/src/styles/flexChildStyles.js +0 -43
|
@@ -1,74 +1,30 @@
|
|
|
1
|
-
elementName: rtgl-navbar
|
|
2
|
-
|
|
3
|
-
viewDataSchema:
|
|
4
|
-
type: object
|
|
5
|
-
properties:
|
|
6
|
-
containerAttrString:
|
|
7
|
-
type: string
|
|
8
|
-
start:
|
|
9
|
-
type: object
|
|
10
|
-
properties:
|
|
11
|
-
label:
|
|
12
|
-
type: string
|
|
13
|
-
href:
|
|
14
|
-
type: string
|
|
15
|
-
image:
|
|
16
|
-
type: object
|
|
17
|
-
properties:
|
|
18
|
-
src:
|
|
19
|
-
type: string
|
|
20
|
-
hasImage:
|
|
21
|
-
type: boolean
|
|
22
|
-
hasHref:
|
|
23
|
-
type: boolean
|
|
24
|
-
|
|
25
|
-
propsSchema:
|
|
26
|
-
type: object
|
|
27
|
-
properties:
|
|
28
|
-
start:
|
|
29
|
-
type: object
|
|
30
|
-
properties:
|
|
31
|
-
label:
|
|
32
|
-
type: string
|
|
33
|
-
href:
|
|
34
|
-
type: string
|
|
35
|
-
image:
|
|
36
|
-
type: object
|
|
37
|
-
properties:
|
|
38
|
-
src:
|
|
39
|
-
type: string
|
|
40
|
-
|
|
41
1
|
refs:
|
|
42
2
|
start:
|
|
43
3
|
eventListeners:
|
|
44
4
|
click:
|
|
45
5
|
handler: handleClickStart
|
|
46
|
-
|
|
47
|
-
events:
|
|
48
|
-
clickStart:
|
|
49
|
-
type: object
|
|
50
|
-
properties:
|
|
51
|
-
path:
|
|
52
|
-
type: string
|
|
53
|
-
|
|
54
6
|
anchors:
|
|
55
|
-
-
|
|
56
|
-
- rtgl-text s=lg: "${start.label}"
|
|
7
|
+
- - rtgl-text s=lg: ${start.label}
|
|
57
8
|
- $if start.image && start.image.src:
|
|
58
|
-
- rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}:
|
|
59
|
-
|
|
9
|
+
- rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}: null
|
|
60
10
|
template:
|
|
61
11
|
- rtgl-view bgc=bg d=h h=48 av=c w=f ${containerAttrString}:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
12
|
+
- $if start.href:
|
|
13
|
+
- a href=${start.href}:
|
|
14
|
+
- rtgl-view d=h av=c g=md:
|
|
15
|
+
- - rtgl-text s=lg: ${start.label}
|
|
16
|
+
- $if start.image && start.image.src:
|
|
17
|
+
- rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}: null
|
|
18
|
+
$elif start.path:
|
|
19
|
+
- rtgl-view#start d=h av=c g=md cur=pointer:
|
|
20
|
+
- - rtgl-text s=lg: ${start.label}
|
|
21
|
+
- $if start.image && start.image.src:
|
|
22
|
+
- rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}: null
|
|
23
|
+
$else:
|
|
24
|
+
- rtgl-view d=h av=c g=md:
|
|
25
|
+
- - rtgl-text s=lg: ${start.label}
|
|
26
|
+
- $if start.image && start.image.src:
|
|
27
|
+
- rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}: null
|
|
28
|
+
- rtgl-view w=1fg: null
|
|
29
|
+
- rtgl-view d=h av=c g=lg:
|
|
30
|
+
- slot name=right: null
|
|
@@ -38,7 +38,7 @@ const updateToLatestCurrentId = (headingElements, offsetTop, deps) => {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (currentHeadingId && currentHeadingId !== store.selectCurrentId()) {
|
|
41
|
-
store.setCurrentId(currentHeadingId);
|
|
41
|
+
store.setCurrentId({ id: currentHeadingId });
|
|
42
42
|
render();
|
|
43
43
|
}
|
|
44
44
|
};
|
|
@@ -71,7 +71,7 @@ const startListening = (contentContainer, scrollContainer, offsetTop, deps) => {
|
|
|
71
71
|
};
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
store.setItems(items);
|
|
74
|
+
store.setItems({ items });
|
|
75
75
|
updateToLatestCurrentId(headingElements, offsetTop, deps);
|
|
76
76
|
render();
|
|
77
77
|
|
|
@@ -88,22 +88,28 @@ const startListening = (contentContainer, scrollContainer, offsetTop, deps) => {
|
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
export const handleBeforeMount = (deps) => {
|
|
91
|
-
const {
|
|
91
|
+
const { props } = deps;
|
|
92
|
+
let stopListening = () => {};
|
|
93
|
+
|
|
92
94
|
requestAnimationFrame(() => {
|
|
93
|
-
const targetElement = document.getElementById(
|
|
95
|
+
const targetElement = document.getElementById(props.targetId);
|
|
96
|
+
if (!targetElement) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
94
99
|
|
|
95
100
|
// Get scroll container - default to window for page scroll if not specified
|
|
96
101
|
let scrollContainer = window;
|
|
97
|
-
if (
|
|
98
|
-
scrollContainer = document.getElementById(
|
|
102
|
+
if (props.scrollContainerId) {
|
|
103
|
+
scrollContainer = document.getElementById(props.scrollContainerId) || window;
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
// Get offset top - default to 100px if not specified
|
|
102
|
-
const offsetTop = parseInt(
|
|
107
|
+
const offsetTop = parseInt(props.offsetTop || '100', 10);
|
|
103
108
|
|
|
104
|
-
|
|
105
|
-
return () => {
|
|
106
|
-
stopListening();
|
|
107
|
-
}
|
|
109
|
+
stopListening = startListening(targetElement, scrollContainer, offsetTop, deps);
|
|
108
110
|
})
|
|
111
|
+
|
|
112
|
+
return () => {
|
|
113
|
+
stopListening();
|
|
114
|
+
};
|
|
109
115
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
componentName: rtgl-page-outline
|
|
2
|
+
propsSchema:
|
|
3
|
+
type: object
|
|
4
|
+
properties:
|
|
5
|
+
targetId:
|
|
6
|
+
type: string
|
|
7
|
+
scrollContainerId:
|
|
8
|
+
type: string
|
|
9
|
+
offsetTop:
|
|
10
|
+
type: string
|
|
11
|
+
events:
|
|
12
|
+
onItemClick:
|
|
13
|
+
type: object
|
|
14
|
+
methods:
|
|
15
|
+
type: object
|
|
16
|
+
properties: {}
|
|
@@ -69,17 +69,16 @@ export const selectCurrentId = ({ state }) => {
|
|
|
69
69
|
return state.currentId;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export const setItems = (state,
|
|
73
|
-
state.items = items;
|
|
72
|
+
export const setItems = ({ state }, payload = {}) => {
|
|
73
|
+
state.items = Array.isArray(payload.items) ? payload.items : [];
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export const setCurrentId = (state,
|
|
77
|
-
state.currentId = id;
|
|
76
|
+
export const setCurrentId = ({ state }, payload = {}) => {
|
|
77
|
+
state.currentId = payload.id;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export const setContentContainer = (state,
|
|
81
|
-
state.contentContainer = container;
|
|
80
|
+
export const setContentContainer = ({ state }, payload = {}) => {
|
|
81
|
+
state.contentContainer = payload.container;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
|
|
@@ -1,36 +1,8 @@
|
|
|
1
|
-
elementName: rtgl-page-outline
|
|
2
|
-
|
|
3
|
-
viewDataSchema:
|
|
4
|
-
type: object
|
|
5
|
-
properties:
|
|
6
|
-
items:
|
|
7
|
-
type: array
|
|
8
|
-
items:
|
|
9
|
-
type: object
|
|
10
|
-
properties:
|
|
11
|
-
slug:
|
|
12
|
-
type: string
|
|
13
|
-
title:
|
|
14
|
-
type: string
|
|
15
|
-
selectedSlug:
|
|
16
|
-
type: string
|
|
17
|
-
nullable: true
|
|
18
|
-
|
|
19
|
-
propsSchema:
|
|
20
|
-
type: object
|
|
21
|
-
properties: {}
|
|
22
|
-
|
|
23
1
|
refs: {}
|
|
24
|
-
|
|
25
|
-
events:
|
|
26
|
-
onItemClick:
|
|
27
|
-
type: object
|
|
28
|
-
|
|
29
2
|
template:
|
|
30
3
|
- rtgl-view h=f w=272 pr=md:
|
|
31
4
|
- rtgl-view w=f mt=xl:
|
|
32
5
|
- $for item, i in items:
|
|
33
6
|
- rtgl-view d=h bwl=xs bc="${item.bc}" pv=sm av=c href=${item.href} pl=md:
|
|
34
|
-
- rtgl-view w=${item.ml}:
|
|
7
|
+
- rtgl-view w=${item.ml}: null
|
|
35
8
|
- rtgl-text s=sm c=${item.c} h-c=fg: ${item.title}
|
|
36
|
-
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
export const handleBeforeMount = (deps) => {
|
|
2
|
-
const { store,
|
|
2
|
+
const { store, props } = deps;
|
|
3
3
|
|
|
4
|
-
if (
|
|
5
|
-
store.setValue(
|
|
4
|
+
if (props.value !== undefined) {
|
|
5
|
+
store.setValue({ value: props.value || '' });
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export const handleOnUpdate = (deps, payload) => {
|
|
10
|
-
const {
|
|
10
|
+
const { oldProps, newProps } = payload;
|
|
11
11
|
const { store, render } = deps;
|
|
12
12
|
|
|
13
|
-
if (
|
|
14
|
-
const value =
|
|
15
|
-
store.setValue(value);
|
|
13
|
+
if (oldProps?.value !== newProps?.value) {
|
|
14
|
+
const value = newProps?.value ?? '';
|
|
15
|
+
store.setValue({ value });
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
render();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const handleTextClick = (deps, payload) => {
|
|
22
|
-
const { store, render,
|
|
22
|
+
const { store, render, refs, props } = deps;
|
|
23
23
|
const event = payload._event;
|
|
24
24
|
|
|
25
25
|
const value = store.selectValue();
|
|
26
|
-
store.setTempValue(value)
|
|
26
|
+
store.setTempValue({ value })
|
|
27
27
|
|
|
28
28
|
store.openPopover({
|
|
29
29
|
position: {
|
|
@@ -32,20 +32,20 @@ export const handleTextClick = (deps, payload) => {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
const { input } =
|
|
36
|
-
input.
|
|
35
|
+
const { input } = refs;
|
|
36
|
+
input.value = value;
|
|
37
37
|
render();
|
|
38
38
|
|
|
39
|
-
if (
|
|
39
|
+
if (props.autoFocus) {
|
|
40
40
|
setTimeout(() => {
|
|
41
|
-
input.
|
|
41
|
+
input.focus();
|
|
42
42
|
}, 50)
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export const handlePopoverClose = (deps, payload) => {
|
|
47
47
|
const { store, render } = deps;
|
|
48
|
-
store.closePopover();
|
|
48
|
+
store.closePopover({});
|
|
49
49
|
render();
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -54,50 +54,50 @@ export const handleInputChange = (deps, payload) => {
|
|
|
54
54
|
const event = payload._event;
|
|
55
55
|
const value = event.detail.value;
|
|
56
56
|
|
|
57
|
-
store.setTempValue(value);
|
|
57
|
+
store.setTempValue({ value });
|
|
58
58
|
|
|
59
|
-
dispatchEvent(new CustomEvent('
|
|
59
|
+
dispatchEvent(new CustomEvent('value-input', {
|
|
60
60
|
detail: { value },
|
|
61
|
-
bubbles: true
|
|
61
|
+
bubbles: true,
|
|
62
62
|
}));
|
|
63
63
|
|
|
64
64
|
render();
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export const handleSubmitClick = (deps) => {
|
|
68
|
-
const { store, render, dispatchEvent,
|
|
69
|
-
const { input } =
|
|
70
|
-
const value = input.
|
|
68
|
+
const { store, render, dispatchEvent, refs } = deps;
|
|
69
|
+
const { input } = refs
|
|
70
|
+
const value = input.value;
|
|
71
71
|
|
|
72
|
-
store.setValue(value)
|
|
73
|
-
store.closePopover();
|
|
72
|
+
store.setValue({ value });
|
|
73
|
+
store.closePopover({});
|
|
74
74
|
|
|
75
|
-
dispatchEvent(new CustomEvent('
|
|
75
|
+
dispatchEvent(new CustomEvent('value-change', {
|
|
76
76
|
detail: { value },
|
|
77
|
-
bubbles: true
|
|
77
|
+
bubbles: true,
|
|
78
78
|
}));
|
|
79
79
|
|
|
80
80
|
render();
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export const handleInputKeydown = (deps, payload) => {
|
|
84
|
-
const { store, render, dispatchEvent,
|
|
84
|
+
const { store, render, dispatchEvent, refs } = deps;
|
|
85
85
|
const event = payload._event;
|
|
86
86
|
|
|
87
87
|
if (event.key === 'Enter') {
|
|
88
|
-
const { input } =
|
|
89
|
-
const value = input.
|
|
88
|
+
const { input } = refs
|
|
89
|
+
const value = input.value;
|
|
90
90
|
|
|
91
|
-
store.closePopover();
|
|
91
|
+
store.closePopover({});
|
|
92
92
|
// Dispatch custom event
|
|
93
|
-
dispatchEvent(new CustomEvent('
|
|
93
|
+
dispatchEvent(new CustomEvent('value-change', {
|
|
94
94
|
detail: { value },
|
|
95
|
-
bubbles: true
|
|
95
|
+
bubbles: true,
|
|
96
96
|
}));
|
|
97
97
|
|
|
98
98
|
render();
|
|
99
99
|
} else if (event.key === 'Escape') {
|
|
100
|
-
store.closePopover();
|
|
100
|
+
store.closePopover({});
|
|
101
101
|
render();
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
componentName: rtgl-popover-input
|
|
2
|
+
propsSchema:
|
|
3
|
+
type: object
|
|
4
|
+
properties:
|
|
5
|
+
value:
|
|
6
|
+
type: string
|
|
7
|
+
placeholder:
|
|
8
|
+
type: string
|
|
9
|
+
label:
|
|
10
|
+
type: string
|
|
11
|
+
autoFocus:
|
|
12
|
+
type: boolean
|
|
13
|
+
events:
|
|
14
|
+
value-input: {}
|
|
15
|
+
value-change: {}
|
|
16
|
+
methods:
|
|
17
|
+
type: object
|
|
18
|
+
properties: {}
|
|
@@ -8,7 +8,7 @@ export const createInitialState = () => Object.freeze({
|
|
|
8
8
|
tempValue: '',
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
export const selectViewData = ({
|
|
11
|
+
export const selectViewData = ({ props, state }) => {
|
|
12
12
|
const value = state.value || '-';
|
|
13
13
|
|
|
14
14
|
return {
|
|
@@ -16,29 +16,29 @@ export const selectViewData = ({ attrs, state }) => {
|
|
|
16
16
|
position: state.position,
|
|
17
17
|
value: value,
|
|
18
18
|
tempValue: state.tempValue,
|
|
19
|
-
placeholder:
|
|
20
|
-
label:
|
|
19
|
+
placeholder: props.placeholder ?? '',
|
|
20
|
+
label: props.label,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export const setTempValue = (state,
|
|
25
|
-
state.tempValue = value;
|
|
24
|
+
export const setTempValue = ({ state }, payload = {}) => {
|
|
25
|
+
state.tempValue = payload.value;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export const openPopover = (state, payload) => {
|
|
28
|
+
export const openPopover = ({ state }, payload = {}) => {
|
|
29
29
|
const { position } = payload;
|
|
30
30
|
state.position = position;
|
|
31
31
|
state.isOpen = true;
|
|
32
32
|
state.hasUnsavedChanges = false;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export const closePopover = (state) => {
|
|
35
|
+
export const closePopover = ({ state }) => {
|
|
36
36
|
state.isOpen = false;
|
|
37
37
|
state.tempValue = '';
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export const setValue = (state,
|
|
41
|
-
state.value = value;
|
|
40
|
+
export const setValue = ({ state }, payload = {}) => {
|
|
41
|
+
state.value = payload.value;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export const selectValue = ({ state }) => {
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
elementName: rtgl-popover-input
|
|
2
|
-
|
|
3
|
-
viewDataSchema:
|
|
4
|
-
type: object
|
|
5
|
-
|
|
6
|
-
attrsSchema:
|
|
7
|
-
type: object
|
|
8
|
-
properties:
|
|
9
|
-
value:
|
|
10
|
-
type: string
|
|
11
|
-
placeholder:
|
|
12
|
-
type: string
|
|
13
|
-
|
|
14
1
|
refs:
|
|
15
|
-
|
|
2
|
+
textDisplay:
|
|
16
3
|
eventListeners:
|
|
17
4
|
click:
|
|
18
5
|
handler: handleTextClick
|
|
@@ -22,7 +9,7 @@ refs:
|
|
|
22
9
|
handler: handlePopoverClose
|
|
23
10
|
input:
|
|
24
11
|
eventListeners:
|
|
25
|
-
input
|
|
12
|
+
value-input:
|
|
26
13
|
handler: handleInputChange
|
|
27
14
|
keydown:
|
|
28
15
|
handler: handleInputKeydown
|
|
@@ -30,16 +17,12 @@ refs:
|
|
|
30
17
|
eventListeners:
|
|
31
18
|
click:
|
|
32
19
|
handler: handleSubmitClick
|
|
33
|
-
|
|
34
|
-
events:
|
|
35
|
-
input-change: {}
|
|
36
|
-
|
|
37
20
|
template:
|
|
38
|
-
- rtgl-view#
|
|
21
|
+
- rtgl-view#textDisplay w=f cur=pointer:
|
|
39
22
|
- rtgl-text: ${value}
|
|
40
23
|
- rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y}:
|
|
41
|
-
- rtgl-view g=md w=240 slot=content bgc=
|
|
24
|
+
- rtgl-view g=md w=240 slot=content bgc=bg br=md:
|
|
42
25
|
- rtgl-text: ${label}
|
|
43
|
-
- rtgl-input#input w=f placeholder=${placeholder}:
|
|
26
|
+
- rtgl-input#input w=f placeholder=${placeholder}: null
|
|
44
27
|
- rtgl-view w=f ah=e:
|
|
45
28
|
- rtgl-button#submit: Submit
|
|
@@ -15,13 +15,13 @@ export const handleBeforeMount = (deps) => {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const handleOnUpdate = (deps, payload) => {
|
|
18
|
-
const {
|
|
18
|
+
const { oldProps, newProps } = payload;
|
|
19
19
|
const { store, render } = deps;
|
|
20
20
|
|
|
21
21
|
// Check if key changed
|
|
22
|
-
if (
|
|
22
|
+
if (oldProps?.key !== newProps?.key && newProps?.key) {
|
|
23
23
|
// Clear current state using store action
|
|
24
|
-
store.resetSelection();
|
|
24
|
+
store.resetSelection({});
|
|
25
25
|
|
|
26
26
|
// Re-apply the prop value if available
|
|
27
27
|
const selectedValue = newProps?.selectedValue;
|
|
@@ -43,11 +43,11 @@ export const handleOnUpdate = (deps, payload) => {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export const handleButtonClick = (deps, payload) => {
|
|
46
|
-
const { store, render,
|
|
46
|
+
const { store, render, refs, props } = deps;
|
|
47
47
|
const event = payload._event;
|
|
48
48
|
event.stopPropagation();
|
|
49
49
|
|
|
50
|
-
const button =
|
|
50
|
+
const button = refs.selectButton;
|
|
51
51
|
|
|
52
52
|
// Get first child's bounding rectangle (since button has display: contents)
|
|
53
53
|
const firstChild = button.firstElementChild;
|
|
@@ -74,7 +74,7 @@ export const handleButtonClick = (deps, payload) => {
|
|
|
74
74
|
|
|
75
75
|
export const handleClickOptionsPopoverOverlay = (deps) => {
|
|
76
76
|
const { store, render } = deps;
|
|
77
|
-
store.closeOptionsPopover();
|
|
77
|
+
store.closeOptionsPopover({});
|
|
78
78
|
render();
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -82,7 +82,8 @@ export const handleOptionClick = (deps, payload) => {
|
|
|
82
82
|
const { render, dispatchEvent, props, store } = deps;
|
|
83
83
|
const event = payload._event;
|
|
84
84
|
event.stopPropagation();
|
|
85
|
-
const id = event.currentTarget.id.
|
|
85
|
+
const id = event.currentTarget.id.slice('option'.length);
|
|
86
|
+
const index = Number(id);
|
|
86
87
|
|
|
87
88
|
const option = props.options[id];
|
|
88
89
|
|
|
@@ -94,15 +95,13 @@ export const handleOptionClick = (deps, payload) => {
|
|
|
94
95
|
props.onChange(option.value);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
dispatchEvent(new CustomEvent('select-change', {
|
|
105
|
-
detail: { selectedValue: option.value },
|
|
98
|
+
dispatchEvent(new CustomEvent('value-change', {
|
|
99
|
+
detail: {
|
|
100
|
+
value: option.value,
|
|
101
|
+
label: option.label,
|
|
102
|
+
index,
|
|
103
|
+
item: option,
|
|
104
|
+
},
|
|
106
105
|
bubbles: true
|
|
107
106
|
}));
|
|
108
107
|
|
|
@@ -112,14 +111,14 @@ export const handleOptionClick = (deps, payload) => {
|
|
|
112
111
|
export const handleOptionMouseEnter = (deps, payload) => {
|
|
113
112
|
const { store, render } = deps;
|
|
114
113
|
const event = payload._event;
|
|
115
|
-
const id = parseInt(event.currentTarget.id.
|
|
116
|
-
store.setHoveredOption(id);
|
|
114
|
+
const id = parseInt(event.currentTarget.id.slice('option'.length), 10);
|
|
115
|
+
store.setHoveredOption({ optionId: id });
|
|
117
116
|
render();
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
export const handleOptionMouseLeave = (deps, payload) => {
|
|
121
120
|
const { store, render } = deps;
|
|
122
|
-
store.clearHoveredOption();
|
|
121
|
+
store.clearHoveredOption({});
|
|
123
122
|
render();
|
|
124
123
|
}
|
|
125
124
|
|
|
@@ -130,22 +129,20 @@ export const handleClearClick = (deps, payload) => {
|
|
|
130
129
|
event.stopPropagation();
|
|
131
130
|
|
|
132
131
|
// Clear the internal state
|
|
133
|
-
store.clearSelectedValue();
|
|
132
|
+
store.clearSelectedValue({});
|
|
134
133
|
|
|
135
134
|
// Call onChange if provided
|
|
136
135
|
if (props.onChange && typeof props.onChange === 'function') {
|
|
137
136
|
props.onChange(undefined);
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
dispatchEvent(new CustomEvent('select-change', {
|
|
148
|
-
detail: { selectedValue: undefined },
|
|
139
|
+
dispatchEvent(new CustomEvent('value-change', {
|
|
140
|
+
detail: {
|
|
141
|
+
value: undefined,
|
|
142
|
+
label: undefined,
|
|
143
|
+
index: null,
|
|
144
|
+
item: undefined,
|
|
145
|
+
},
|
|
149
146
|
bubbles: true
|
|
150
147
|
}));
|
|
151
148
|
|
|
@@ -157,11 +154,10 @@ export const handleAddOptionClick = (deps, payload) => {
|
|
|
157
154
|
const { _event: event } = payload;
|
|
158
155
|
event.stopPropagation();
|
|
159
156
|
// Close the popover
|
|
160
|
-
store.closeOptionsPopover();
|
|
157
|
+
store.closeOptionsPopover({});
|
|
161
158
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
bubbles: true
|
|
159
|
+
dispatchEvent(new CustomEvent('add-option-click', {
|
|
160
|
+
bubbles: true,
|
|
165
161
|
}));
|
|
166
162
|
|
|
167
163
|
render();
|
|
@@ -169,12 +165,12 @@ export const handleAddOptionClick = (deps, payload) => {
|
|
|
169
165
|
|
|
170
166
|
export const handleAddOptionMouseEnter = (deps, payload) => {
|
|
171
167
|
const { store, render } = deps;
|
|
172
|
-
store.setHoveredAddOption(true);
|
|
168
|
+
store.setHoveredAddOption({ isHovered: true });
|
|
173
169
|
render();
|
|
174
170
|
}
|
|
175
171
|
|
|
176
172
|
export const handleAddOptionMouseLeave = (deps, payload) => {
|
|
177
173
|
const { store, render } = deps;
|
|
178
|
-
store.setHoveredAddOption(false);
|
|
174
|
+
store.setHoveredAddOption({ isHovered: false });
|
|
179
175
|
render();
|
|
180
176
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
componentName: rtgl-select
|
|
2
|
+
propsSchema:
|
|
3
|
+
type: object
|
|
4
|
+
properties:
|
|
5
|
+
placeholder:
|
|
6
|
+
type: string
|
|
7
|
+
options:
|
|
8
|
+
type: array
|
|
9
|
+
items:
|
|
10
|
+
type: object
|
|
11
|
+
properties:
|
|
12
|
+
label:
|
|
13
|
+
type: string
|
|
14
|
+
value:
|
|
15
|
+
type: any
|
|
16
|
+
testId:
|
|
17
|
+
type: string
|
|
18
|
+
selectedValue:
|
|
19
|
+
type: any
|
|
20
|
+
onChange:
|
|
21
|
+
type: function
|
|
22
|
+
noClear:
|
|
23
|
+
type: boolean
|
|
24
|
+
addOption:
|
|
25
|
+
type: object
|
|
26
|
+
properties:
|
|
27
|
+
label:
|
|
28
|
+
type: string
|
|
29
|
+
w:
|
|
30
|
+
type: string
|
|
31
|
+
events:
|
|
32
|
+
value-change: {}
|
|
33
|
+
add-option-click: {}
|
|
34
|
+
methods:
|
|
35
|
+
type: object
|
|
36
|
+
properties: {}
|