x4js 2.0.11 → 2.0.13
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 +15 -15
- package/lib/README.txt +15 -15
- package/lib/cjs/x4.css +1 -1
- package/lib/cjs/x4.js +1 -1
- package/lib/esm/x4.css +1 -1
- package/lib/esm/x4.mjs +1 -1
- package/lib/src/components/base.scss +25 -26
- package/lib/src/components/boxes/boxes.module.scss +37 -37
- package/lib/src/components/boxes/boxes.ts +129 -125
- package/lib/src/components/breadcrumb/breadcrumb.scss +28 -0
- package/lib/src/components/breadcrumb/breadcrumb.ts +84 -0
- package/lib/src/components/breadcrumb/chevron-right.svg +1 -0
- package/lib/src/components/btngroup/btngroup.module.scss +28 -28
- package/lib/src/components/btngroup/btngroup.ts +119 -101
- package/lib/src/components/button/button.module.scss +154 -153
- package/lib/src/components/button/button.ts +117 -117
- package/lib/src/components/calendar/calendar.module.scss +162 -162
- package/lib/src/components/calendar/calendar.ts +326 -325
- package/lib/src/components/checkbox/check.svg +3 -3
- package/lib/src/components/checkbox/checkbox.module.scss +141 -141
- package/lib/src/components/checkbox/checkbox.ts +125 -124
- package/lib/src/components/colorinput/colorinput.module.scss +64 -64
- package/lib/src/components/colorinput/colorinput.ts +90 -87
- package/lib/src/components/colorpicker/colorpicker.module.scss +132 -132
- package/lib/src/components/colorpicker/colorpicker.ts +481 -476
- package/lib/src/components/combobox/combobox.module.scss +123 -120
- package/lib/src/components/combobox/combobox.ts +192 -190
- package/lib/src/components/combobox/updown.svg +3 -3
- package/lib/src/components/components.ts +34 -0
- package/lib/src/components/dialog/dialog.module.scss +71 -71
- package/lib/src/components/dialog/dialog.ts +94 -92
- package/lib/src/components/form/form.module.scss +34 -34
- package/lib/src/components/form/form.ts +41 -36
- package/lib/src/components/grid/datastore.ts +1298 -0
- package/lib/src/components/grid/gridview.ts +1108 -0
- package/lib/src/components/grid/memdb.ts +325 -0
- package/lib/src/components/header/header.module.scss +39 -39
- package/lib/src/components/header/header.ts +129 -123
- package/lib/src/components/icon/icon.module.scss +29 -29
- package/lib/src/components/icon/icon.ts +136 -134
- package/lib/src/components/image/image.module.scss +20 -20
- package/lib/src/components/image/image.ts +68 -66
- package/lib/src/components/input/input.module.scss +69 -69
- package/lib/src/components/input/input.ts +275 -274
- package/lib/src/components/label/label.module.scss +58 -52
- package/lib/src/components/label/label.ts +64 -55
- package/lib/src/components/link/link.ts +78 -0
- package/lib/src/components/listbox/listbox.module.scss +103 -103
- package/lib/src/components/listbox/listbox.ts +431 -427
- package/lib/src/components/menu/menu.module.scss +107 -107
- package/lib/src/components/menu/menu.ts +171 -168
- package/lib/src/components/messages/messages.module.scss +48 -47
- package/lib/src/components/messages/messages.ts +68 -63
- package/lib/src/components/normalize.scss +386 -386
- package/lib/src/components/notification/notification.module.scss +81 -81
- package/lib/src/components/notification/notification.ts +109 -108
- package/lib/src/components/panel/panel.module.scss +47 -47
- package/lib/src/components/panel/panel.ts +57 -56
- package/lib/src/components/popup/popup.module.scss +43 -43
- package/lib/src/components/popup/popup.ts +396 -395
- package/lib/src/components/progress/progress.module.scss +56 -56
- package/lib/src/components/progress/progress.ts +43 -42
- package/lib/src/components/rating/rating.module.scss +22 -22
- package/lib/src/components/rating/rating.ts +131 -125
- package/lib/src/components/shared.scss +90 -76
- package/lib/src/components/sizers/sizer.module.scss +89 -89
- package/lib/src/components/sizers/sizer.ts +123 -119
- package/lib/src/components/slider/slider.module.scss +70 -70
- package/lib/src/components/slider/slider.ts +147 -142
- package/lib/src/components/switch/switch.module.scss +126 -126
- package/lib/src/components/switch/switch.ts +61 -55
- package/lib/src/components/tabs/tabs.module.scss +46 -46
- package/lib/src/components/tabs/tabs.ts +168 -157
- package/lib/src/components/textarea/textarea.module.scss +59 -59
- package/lib/src/components/textarea/textarea.ts +60 -54
- package/lib/src/components/textedit/textedit.module.scss +113 -113
- package/lib/src/components/textedit/textedit.ts +83 -82
- package/lib/src/components/themes.scss +81 -77
- package/lib/src/components/tooltips/tooltips.scss +50 -50
- package/lib/src/components/tooltips/tooltips.ts +103 -102
- package/lib/src/components/treeview/treeview.module.scss +115 -115
- package/lib/src/components/treeview/treeview.ts +410 -403
- package/lib/src/components/viewport/viewport.module.scss +24 -24
- package/lib/src/components/viewport/viewport.ts +41 -38
- package/lib/src/core/component.ts +1002 -979
- package/lib/src/core/core_application.ts +44 -0
- package/lib/src/core/core_colors.ts +249 -249
- package/lib/src/core/core_dom.ts +471 -471
- package/lib/src/core/core_dragdrop.ts +200 -200
- package/lib/src/core/core_element.ts +97 -97
- package/lib/src/core/core_events.ts +149 -149
- package/lib/src/core/core_i18n.ts +377 -377
- package/lib/src/core/core_router.ts +221 -221
- package/lib/src/core/core_styles.ts +214 -214
- package/lib/src/core/core_svg.ts +550 -550
- package/lib/src/core/core_tools.ts +688 -673
- package/lib/src/demo/assets/radio.svg +3 -3
- package/lib/src/demo/index.html +11 -11
- package/lib/src/demo/main.scss +21 -21
- package/lib/src/demo/main.tsx +323 -323
- package/lib/src/types/scss.d.ts +4 -4
- package/lib/src/types/x4react.d.ts +8 -8
- package/lib/src/x4.scss +18 -18
- package/lib/src/x4.ts +31 -60
- package/lib/styles/x4.css +1 -1
- package/lib/types/x4js.d.ts +100 -49
- package/package.json +2 -3
- package/src/x4.ts +31 -60
- package/lib/output.d.ts +0 -1472
|
@@ -1,121 +1,124 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|
|
|
7
|
-
*
|
|
8
|
-
* @file combobox.module.scss
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
*
|
|
11
|
-
* @copyright (c) 2024 R-libre ingenierie
|
|
12
|
-
*
|
|
13
|
-
* Use of this source code is governed by an MIT-style license
|
|
14
|
-
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
|
-
**/
|
|
16
|
-
|
|
17
|
-
@use "../shared.scss";
|
|
18
|
-
|
|
19
|
-
:root {
|
|
20
|
-
--dropdown-border: var( --border-hover );
|
|
21
|
-
--dropdown-background: var( --background-primary );
|
|
22
|
-
|
|
23
|
-
--combobox-border: var( --border );
|
|
24
|
-
--combobox-border-focus: var( --border-focus );
|
|
25
|
-
|
|
26
|
-
--combobox-btn-background: inherit;
|
|
27
|
-
--combobox-btn-color: var( --text-secondary );
|
|
28
|
-
--combobox-btn-color-hover: var( --text-primary );
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.x4dropdown {
|
|
32
|
-
@extend .shadow-xl;
|
|
33
|
-
@extend .hbox;
|
|
34
|
-
|
|
35
|
-
max-height: 250px;
|
|
36
|
-
position: absolute;
|
|
37
|
-
background-color: var( --dropdown-background );
|
|
38
|
-
border: 1px solid var( --dropdown-border );
|
|
39
|
-
|
|
40
|
-
.x4listbox {
|
|
41
|
-
@extend .flex;
|
|
42
|
-
|
|
43
|
-
border: none;
|
|
44
|
-
margin: 0;
|
|
45
|
-
width: 100%;
|
|
46
|
-
height: 200px;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.x4combobox {
|
|
51
|
-
@extend .hbox;
|
|
52
|
-
margin: 5px;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
&> .x4label {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file combobox.module.scss
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* @copyright (c) 2024 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Use of this source code is governed by an MIT-style license
|
|
14
|
+
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
|
+
**/
|
|
16
|
+
|
|
17
|
+
@use "../shared.scss";
|
|
18
|
+
|
|
19
|
+
:root {
|
|
20
|
+
--dropdown-border: var( --border-hover );
|
|
21
|
+
--dropdown-background: var( --background-primary );
|
|
22
|
+
|
|
23
|
+
--combobox-border: var( --border );
|
|
24
|
+
--combobox-border-focus: var( --border-focus );
|
|
25
|
+
|
|
26
|
+
--combobox-btn-background: inherit;
|
|
27
|
+
--combobox-btn-color: var( --text-secondary );
|
|
28
|
+
--combobox-btn-color-hover: var( --text-primary );
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.x4dropdown {
|
|
32
|
+
@extend .shadow-xl;
|
|
33
|
+
@extend .hbox;
|
|
34
|
+
|
|
35
|
+
max-height: 250px;
|
|
36
|
+
position: absolute;
|
|
37
|
+
background-color: var( --dropdown-background );
|
|
38
|
+
border: 1px solid var( --dropdown-border );
|
|
39
|
+
|
|
40
|
+
.x4listbox {
|
|
41
|
+
@extend .flex;
|
|
42
|
+
|
|
43
|
+
border: none;
|
|
44
|
+
margin: 0;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 200px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.x4combobox {
|
|
51
|
+
@extend .hbox;
|
|
52
|
+
margin: 5px;
|
|
53
|
+
|
|
54
|
+
//&> #label {
|
|
55
|
+
// padding: 0 6px;
|
|
56
|
+
// border-bottom: 1px solid transparent;
|
|
57
|
+
|
|
58
|
+
&> .x4label {
|
|
59
|
+
padding: 0 6px;
|
|
60
|
+
border-bottom: 1px solid transparent;
|
|
61
|
+
|
|
62
|
+
height: 100%;
|
|
63
|
+
padding: 0;
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
gap: 0;
|
|
66
|
+
|
|
67
|
+
#text::not(.empty)::after {
|
|
68
|
+
content: ":"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//}
|
|
72
|
+
|
|
73
|
+
&>#edit {
|
|
74
|
+
@extend .flex;
|
|
75
|
+
border-bottom: 1px solid var( --combobox-border );
|
|
76
|
+
|
|
77
|
+
.x4input {
|
|
78
|
+
@extend .flex;
|
|
79
|
+
|
|
80
|
+
&[readonly] {
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.x4button {
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0;
|
|
88
|
+
outline: none;
|
|
89
|
+
background-color: var( --combobox-btn-background );
|
|
90
|
+
color: var( --combobox-btn-color );
|
|
91
|
+
|
|
92
|
+
#icon {
|
|
93
|
+
color: var( --combobox-btn-color );
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:hover, &:hover #icon {
|
|
97
|
+
color: var( --combobox-btn-color-hover );
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&:focus {
|
|
101
|
+
//background-color: var( --color-30 );
|
|
102
|
+
//color: var( --color-10 );
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&[disabled] {
|
|
108
|
+
&, * {
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
#label .x4label {
|
|
113
|
+
color: var( --disabled-color-dark );
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&[required] {
|
|
119
|
+
.x4label::before {
|
|
120
|
+
content: "*";
|
|
121
|
+
color: var( --color-90 )
|
|
122
|
+
}
|
|
123
|
+
}
|
|
121
124
|
}
|
|
@@ -1,190 +1,192 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|
|
|
7
|
-
*
|
|
8
|
-
* @file combobox.ts
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
*
|
|
11
|
-
* @copyright (c) 2024 R-libre ingenierie
|
|
12
|
-
*
|
|
13
|
-
* Use of this source code is governed by an MIT-style license
|
|
14
|
-
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
|
-
**/
|
|
16
|
-
|
|
17
|
-
import { Component, ComponentEvent, ComponentProps, EvChange, EvSelectionChange, makeUniqueComponentId } from '../../core/component';
|
|
18
|
-
import { Listbox, ListboxID, ListItem, kbNav } from '../listbox/listbox';
|
|
19
|
-
import { Popup, PopupEvents, PopupProps } from '../popup/popup.js';
|
|
20
|
-
import { Label } from '../label/label';
|
|
21
|
-
import { Input } from '../input/input';
|
|
22
|
-
import { Button } from '../button/button';
|
|
23
|
-
import { HBox } from '../boxes/boxes';
|
|
24
|
-
|
|
25
|
-
import "./combobox.module.scss";
|
|
26
|
-
import icon from "./updown.svg";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
ev.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
private
|
|
84
|
-
private
|
|
85
|
-
private
|
|
86
|
-
private
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this._dropdown
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.
|
|
115
|
-
|
|
116
|
-
this.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
this.
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file combobox.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* @copyright (c) 2024 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Use of this source code is governed by an MIT-style license
|
|
14
|
+
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
|
+
**/
|
|
16
|
+
|
|
17
|
+
import { Component, ComponentEvent, ComponentProps, EvChange, EvSelectionChange, makeUniqueComponentId } from '../../core/component';
|
|
18
|
+
import { Listbox, ListboxID, ListItem, kbNav } from '../listbox/listbox';
|
|
19
|
+
import { Popup, PopupEvents, PopupProps } from '../popup/popup.js';
|
|
20
|
+
import { Label } from '../label/label';
|
|
21
|
+
import { Input } from '../input/input';
|
|
22
|
+
import { Button } from '../button/button';
|
|
23
|
+
import { HBox } from '../boxes/boxes';
|
|
24
|
+
|
|
25
|
+
import "./combobox.module.scss";
|
|
26
|
+
import icon from "./updown.svg";
|
|
27
|
+
import { class_ns } from '@core/core_tools.js';
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
interface DropdownEvents extends PopupEvents {
|
|
32
|
+
selectionChange: EvSelectionChange;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
interface DropdownProps extends Omit<PopupProps,"content"> {
|
|
37
|
+
items: ListItem[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@class_ns( "x4" )
|
|
41
|
+
class Dropdown extends Popup<DropdownProps,DropdownEvents> {
|
|
42
|
+
|
|
43
|
+
private _list: Listbox;
|
|
44
|
+
|
|
45
|
+
constructor( props: DropdownProps, content?: ListItem[] ) {
|
|
46
|
+
super( props );
|
|
47
|
+
|
|
48
|
+
this._list = new Listbox( { items: props.items } );
|
|
49
|
+
this.setContent( this._list );
|
|
50
|
+
|
|
51
|
+
this.addDOMEvent( "mousedown", ( ev: Event ) => {
|
|
52
|
+
console.log( "trap" );
|
|
53
|
+
ev.stopImmediatePropagation( );
|
|
54
|
+
ev.stopPropagation( );
|
|
55
|
+
ev.preventDefault( );
|
|
56
|
+
}, true );
|
|
57
|
+
|
|
58
|
+
this._list.on( "selectionChange", ( ev ) => {
|
|
59
|
+
this.fire( "selectionChange", ev );
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getList( ) {
|
|
64
|
+
return this._list;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
interface ComboboxProps extends Omit<ComponentProps,"content"> {
|
|
74
|
+
label?: string;
|
|
75
|
+
labelWidth?: number | string;
|
|
76
|
+
readonly?: boolean;
|
|
77
|
+
items: ListItem[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@class_ns( "x4" )
|
|
81
|
+
export class Combobox extends Component<ComboboxProps> {
|
|
82
|
+
|
|
83
|
+
private _dropdown: Dropdown;
|
|
84
|
+
private _label: Label;
|
|
85
|
+
private _input: Input;
|
|
86
|
+
private _button: Button;
|
|
87
|
+
private _prevent_close = false;
|
|
88
|
+
private _edit: HBox;
|
|
89
|
+
|
|
90
|
+
constructor( props: ComboboxProps ) {
|
|
91
|
+
super( props );
|
|
92
|
+
|
|
93
|
+
const id = makeUniqueComponentId( );
|
|
94
|
+
|
|
95
|
+
this.setContent( [
|
|
96
|
+
new HBox( { id: "label", content: new Label( { tag: "label", text: props.label, labelFor: id, width: props.labelWidth } ) } ),
|
|
97
|
+
this._edit = new HBox( { id: "edit", content: [
|
|
98
|
+
this._input = new Input( { type: "text", value: "", readonly: props.readonly }),
|
|
99
|
+
this._button = new Button( { icon: icon } )
|
|
100
|
+
]} ),
|
|
101
|
+
])
|
|
102
|
+
|
|
103
|
+
this._dropdown = new Dropdown( { items: props.items } );
|
|
104
|
+
|
|
105
|
+
this._dropdown.on( "selectionChange", ( ev ) => {
|
|
106
|
+
const sel = ev.selection as ListItem;
|
|
107
|
+
this._input.setValue( sel ? sel.text : "" );
|
|
108
|
+
|
|
109
|
+
if( !this._prevent_close ) {
|
|
110
|
+
this._dropdown.show( false );
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
this._button.addDOMEvent( "click", ( ) => this._on_click( ) );
|
|
115
|
+
this._input.addDOMEvent( "input", ( ) => this._on_input( ) );
|
|
116
|
+
this._input.addDOMEvent( "keydown", ( ev ) => this._on_key( ev ) );
|
|
117
|
+
|
|
118
|
+
this.setDOMEvents( {
|
|
119
|
+
focusout: ( ) => this._on_focusout( ),
|
|
120
|
+
click: ( ) => this._on_click( ),
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private _on_key( ev: KeyboardEvent ) {
|
|
125
|
+
switch( ev.key ) {
|
|
126
|
+
case "Enter":
|
|
127
|
+
case "Escape": {
|
|
128
|
+
this._dropdown.show( false );
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
case "ArrowUp":
|
|
133
|
+
this._prevent_close = true;
|
|
134
|
+
if( !this._dropdown.isOpen( ) ) {
|
|
135
|
+
this.showDropDown( );
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this._dropdown.getList().navigate( kbNav.prev );
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this._prevent_close = false;
|
|
142
|
+
break;
|
|
143
|
+
|
|
144
|
+
case "ArrowDown":
|
|
145
|
+
this._prevent_close = true;
|
|
146
|
+
if( !this._dropdown.isOpen( ) ) {
|
|
147
|
+
this.showDropDown( );
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this._dropdown.getList().navigate( kbNav.next );
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
this._prevent_close = false;
|
|
154
|
+
break;
|
|
155
|
+
|
|
156
|
+
default: {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
ev.preventDefault( );
|
|
162
|
+
ev.stopPropagation( );
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private _on_input( ) {
|
|
166
|
+
if( !this._dropdown.isOpen( ) ) {
|
|
167
|
+
this.showDropDown( );
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
this._dropdown.getList().filter( this._input.getValue( ) );
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private _on_focusout( ) {
|
|
174
|
+
this._dropdown.show( false );
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private _on_click( ) {
|
|
178
|
+
this.showDropDown( );
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
showDropDown( ) {
|
|
182
|
+
if( this.isDisabled() ) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const rc = this._edit.getBoundingRect( );
|
|
187
|
+
this._dropdown.setStyleValue( "width", rc.width+"px" );
|
|
188
|
+
this._dropdown.displayNear( rc, "top left", "bottom left", {x:0,y:6} );
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">
|
|
3
|
-
</path>
|
|
1
|
+
<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">
|
|
3
|
+
</path>
|
|
4
4
|
</svg>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export * from "./boxes/boxes"
|
|
2
|
+
export * from "./breadcrumb/breadcrumb"
|
|
3
|
+
export * from "./btngroup/btngroup"
|
|
4
|
+
export * from "./button/button"
|
|
5
|
+
export * from "./calendar/calendar"
|
|
6
|
+
export * from "./checkbox/checkbox"
|
|
7
|
+
export * from "./colorinput/colorinput"
|
|
8
|
+
export * from "./colorpicker/colorpicker"
|
|
9
|
+
export * from "./combobox/combobox"
|
|
10
|
+
export * from "./dialog/dialog"
|
|
11
|
+
export * from "./form/form"
|
|
12
|
+
export * from "./header/header"
|
|
13
|
+
export * from "./icon/icon"
|
|
14
|
+
export * from "./image/image"
|
|
15
|
+
export * from "./input/input"
|
|
16
|
+
export * from "./label/label"
|
|
17
|
+
export * from "./link/link"
|
|
18
|
+
export * from "./listbox/listbox"
|
|
19
|
+
export * from "./menu/menu"
|
|
20
|
+
export * from "./messages/messages"
|
|
21
|
+
export * from "./notification/notification"
|
|
22
|
+
export * from "./panel/panel"
|
|
23
|
+
export * from "./popup/popup"
|
|
24
|
+
export * from "./progress/progress"
|
|
25
|
+
export * from "./rating/rating"
|
|
26
|
+
export * from "./sizers/sizer"
|
|
27
|
+
export * from "./slider/slider"
|
|
28
|
+
export * from "./switch/switch"
|
|
29
|
+
export * from "./tabs/tabs"
|
|
30
|
+
export * from "./textarea/textarea"
|
|
31
|
+
export * from "./textedit/textedit"
|
|
32
|
+
export * from "./tooltips/tooltips"
|
|
33
|
+
export * from "./treeview/treeview"
|
|
34
|
+
export * from "./viewport/viewport"
|