x4js 2.2.52 → 2.2.53
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/package.json +1 -1
- package/src/components/base.scss +4 -0
- package/src/components/combobox/combobox.module.scss +30 -26
- package/src/components/combobox/combobox.ts +12 -5
- package/src/components/dialog/dialog.module.scss +1 -0
- package/src/components/input/input.module.scss +4 -1
- package/src/components/listbox/listbox.ts +7 -7
- package/src/components/textedit/textedit.module.scss +2 -2
- package/src/core/component.ts +5 -0
package/package.json
CHANGED
package/src/components/base.scss
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
--combobox-btn-color-hover: var( --text-primary );
|
|
29
29
|
|
|
30
30
|
--combo-tree-indent: 1em;
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
|
|
33
33
|
.x4dropdownlist {
|
|
34
34
|
@extend %shadow-xl;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
max-height: 250px;
|
|
38
38
|
max-width: 50vw;
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
position: absolute;
|
|
41
41
|
background-color: var( --dropdown-background );
|
|
42
42
|
border: 1px solid var( --dropdown-border );
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
.x4item {
|
|
53
53
|
white-space: nowrap;
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
&.level-1 { padding-left: calc(var(--combo-tree-indent) * 1 ); }
|
|
56
56
|
&.level-2 { padding-left: calc(var(--combo-tree-indent) * 2 ); }
|
|
57
57
|
&.level-3 { padding-left: calc(var(--combo-tree-indent) * 3 ); }
|
|
@@ -60,47 +60,48 @@
|
|
|
60
60
|
&.level-6 { padding-left: calc(var(--combo-tree-indent) * 6 ); }
|
|
61
61
|
&.level-7 { padding-left: calc(var(--combo-tree-indent) * 7 ); }
|
|
62
62
|
&.level-8 { padding-left: calc(var(--combo-tree-indent) * 8 ); }
|
|
63
|
+
}
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
}
|
|
66
|
+
|
|
67
67
|
.x4combobox {
|
|
68
68
|
@extend %hbox;
|
|
69
69
|
margin: 5px;
|
|
70
70
|
gap: 6px;
|
|
71
71
|
|
|
72
72
|
&> #label {
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
&> .x4label {
|
|
75
75
|
padding: 0 6px 0 0;
|
|
76
76
|
border-bottom: 1px solid transparent;
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
height: 100%;
|
|
79
79
|
font-weight: 500;
|
|
80
80
|
gap: 0px;
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
#text:not(.empty) {
|
|
83
83
|
&::after {
|
|
84
84
|
content: ":"
|
|
85
|
-
|
|
85
|
+
}
|
|
86
|
+
}
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
|
-
}
|
|
89
89
|
|
|
90
90
|
&>#edit {
|
|
91
91
|
@extend %flex;
|
|
92
92
|
border-bottom: 1px solid var( --combobox-border );
|
|
93
|
+
|
|
93
94
|
&:focus-within {
|
|
94
95
|
border-bottom-color: var( --combobox-border-focus );
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
+
|
|
97
98
|
.x4input {
|
|
98
99
|
@extend %flex;
|
|
99
|
-
|
|
100
|
-
&[readonly] {
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
}
|
|
103
|
-
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
// &[readonly] {
|
|
102
|
+
// cursor: pointer;
|
|
103
|
+
// }
|
|
104
|
+
}
|
|
104
105
|
|
|
105
106
|
.x4button {
|
|
106
107
|
margin: 0;
|
|
@@ -111,36 +112,39 @@
|
|
|
111
112
|
|
|
112
113
|
#icon {
|
|
113
114
|
color: var( --combobox-btn-color );
|
|
114
|
-
|
|
115
|
+
}
|
|
115
116
|
|
|
116
117
|
&:hover, &:hover #icon {
|
|
117
118
|
color: var( --combobox-btn-color-hover );
|
|
118
|
-
|
|
119
|
+
}
|
|
119
120
|
|
|
120
121
|
//&:focus {
|
|
121
122
|
//background-color: var( --color-30 );
|
|
122
123
|
//color: var( --color-10 );
|
|
123
124
|
//}
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&[disabled],
|
|
129
|
+
&.readonly {
|
|
130
|
+
--label-color: var( --disabled-color-dark );
|
|
131
|
+
--input-color: var( --disabled-color-dark );
|
|
126
132
|
|
|
127
|
-
&[disabled] {
|
|
128
133
|
&, * {
|
|
129
134
|
cursor: not-allowed;
|
|
130
|
-
|
|
135
|
+
}
|
|
131
136
|
|
|
132
137
|
#label .x4label {
|
|
133
|
-
color: var( --disabled-color-dark );
|
|
134
138
|
pointer-events: none;
|
|
135
|
-
}
|
|
136
139
|
}
|
|
137
|
-
|
|
140
|
+
}
|
|
141
|
+
|
|
138
142
|
&[required] {
|
|
139
143
|
& > #label > .x4label::before {
|
|
140
144
|
content: "*";
|
|
141
145
|
font-weight: bold;
|
|
142
146
|
color: var( --textedit-required );
|
|
143
147
|
margin-right: 2px;
|
|
144
|
-
}
|
|
145
148
|
}
|
|
149
|
+
}
|
|
146
150
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
17
|
import { Component, ComponentEvents, ComponentProps, EvClick, EvSelectionChange, makeUniqueComponentId } from '../../core/component';
|
|
18
|
-
import { class_ns, IComponentInterface, IFormElement, kbNav
|
|
18
|
+
import { class_ns, IComponentInterface, IFormElement, kbNav } from '../../core/core_tools';
|
|
19
19
|
import { EventCallback } from '../../core/core_events';
|
|
20
20
|
|
|
21
21
|
import { Listbox, ListboxID, ListItem } from '../listbox/listbox';
|
|
@@ -46,7 +46,7 @@ export class DropdownList extends Popup<DropdownProps,DropdownEvents> {
|
|
|
46
46
|
|
|
47
47
|
private _list: Listbox;
|
|
48
48
|
|
|
49
|
-
constructor( props: DropdownProps
|
|
49
|
+
constructor( props: DropdownProps ) {
|
|
50
50
|
super( props );
|
|
51
51
|
|
|
52
52
|
this._list = new Listbox( { items: props.items } );
|
|
@@ -147,7 +147,7 @@ export class Combobox extends Component<ComboboxProps,ComboboxEvents> {
|
|
|
147
147
|
list.select( sel, false );
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
this._input.setValue(
|
|
150
|
+
this._input.setValue( itm.text as string );
|
|
151
151
|
|
|
152
152
|
if( !this._prevent_close ) {
|
|
153
153
|
this._popup.show( false );
|
|
@@ -248,7 +248,9 @@ export class Combobox extends Component<ComboboxProps,ComboboxEvents> {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
setItems( items: ListItem[] ) {
|
|
251
|
-
this._getList(
|
|
251
|
+
const list = this._getList( );
|
|
252
|
+
list.setItems( items );
|
|
253
|
+
this.setValue( "" );
|
|
252
254
|
}
|
|
253
255
|
|
|
254
256
|
getValue( ) {
|
|
@@ -260,7 +262,12 @@ export class Combobox extends Component<ComboboxProps,ComboboxEvents> {
|
|
|
260
262
|
}
|
|
261
263
|
|
|
262
264
|
selectItem( index: ListboxID ) {
|
|
263
|
-
this._getList( )
|
|
265
|
+
const list = this._getList( );
|
|
266
|
+
list.select( index );
|
|
267
|
+
const el = list.getItem( index );
|
|
268
|
+
if( el ) {
|
|
269
|
+
this.setValue( el.text as string );
|
|
270
|
+
}
|
|
264
271
|
}
|
|
265
272
|
|
|
266
273
|
getSelection( ) {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
--input-placeholder: var( --disabled-background );
|
|
24
24
|
--input-error: var( --alert-background );
|
|
25
25
|
|
|
26
|
+
--input-color-disabled: var( --disabled-color-dark );
|
|
26
27
|
--input-checkbox-color: var( --accent-background );
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -68,8 +69,10 @@ input.x4input {
|
|
|
68
69
|
font-weight: bold;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
&:disabled
|
|
72
|
+
&:disabled,
|
|
73
|
+
&[disabled] {
|
|
72
74
|
background-color: transparent;
|
|
75
|
+
color: var( --input-color-disabled );
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
&:invalid {
|
|
@@ -94,16 +94,11 @@ export interface ListboxProps extends Omit<ComponentProps,'content'> {
|
|
|
94
94
|
@class_ns( "x4" )
|
|
95
95
|
export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
//private _selection: ListboxID;
|
|
99
|
-
//private _selitem: Component;
|
|
100
|
-
|
|
97
|
+
private _view: Viewport;
|
|
101
98
|
private _lastsel: ListboxID;
|
|
102
|
-
|
|
103
99
|
private _multisel: Set<ListboxID>;
|
|
104
100
|
private _items: ListItem[];
|
|
105
|
-
|
|
106
|
-
preventFocus = false;
|
|
101
|
+
//<?? preventFocus = false;
|
|
107
102
|
|
|
108
103
|
constructor( props: ListboxProps ) {
|
|
109
104
|
super( { ...props } );
|
|
@@ -629,6 +624,11 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
|
629
624
|
return Array.from( this._multisel );
|
|
630
625
|
}
|
|
631
626
|
|
|
627
|
+
getFirstSel( ) : ListItem {
|
|
628
|
+
const [first] = this.getSelection( );
|
|
629
|
+
return first ? this.getItem( first ) : null;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
632
|
ensureSelectionVisible( ) {
|
|
633
633
|
const sels = Array.from( this._multisel.values() );
|
|
634
634
|
if( sels.length) {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
--textedit-btn-color: var( --text-secondary );
|
|
26
26
|
--textedit-btn-color-hover: var( --text-primary );
|
|
27
27
|
|
|
28
|
-
--textedit-color-disabled: var( --disabled-
|
|
28
|
+
--textedit-color-disabled: var( --disabled-color-dark );
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.x4textedit {
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
#label > .x4label #text,
|
|
106
|
-
#label > .x4label::before,
|
|
107
106
|
#label::after {
|
|
107
|
+
--label-color: var( --textedit-color-disabled );
|
|
108
108
|
color: var( --textedit-color-disabled );
|
|
109
109
|
}
|
|
110
110
|
|
package/src/core/component.ts
CHANGED
|
@@ -109,6 +109,7 @@ export interface ComponentProps {
|
|
|
109
109
|
hidden?: boolean,
|
|
110
110
|
/** Enables flex layout (boolean) or sets flex-grow (number). */
|
|
111
111
|
flex?: boolean | number;
|
|
112
|
+
stretch?: boolean;
|
|
112
113
|
/** Tooltip text. */
|
|
113
114
|
tooltip?: string;
|
|
114
115
|
/** Existing DOM element to wrap. */
|
|
@@ -202,6 +203,10 @@ export class Component<P extends ComponentProps = ComponentProps, E extends Comp
|
|
|
202
203
|
});
|
|
203
204
|
}
|
|
204
205
|
}
|
|
206
|
+
|
|
207
|
+
if( props.stretch ) {
|
|
208
|
+
this.addClass( "x4stretch" );
|
|
209
|
+
}
|
|
205
210
|
|
|
206
211
|
if( props.id!==undefined ) {
|
|
207
212
|
this.setAttribute( "id", props.id );
|