x4js 2.0.20 → 2.0.22
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/lib/cjs/x4.css +1 -1
- package/lib/cjs/x4.js +2 -2
- package/lib/esm/x4.css +1 -1
- package/lib/esm/x4.mjs +2 -2
- package/lib/styles/x4.css +1 -1
- package/lib/types/x4js.d.ts +93 -77
- package/package.json +1 -1
- package/src/components/boxes/boxes.ts +33 -1
- package/src/components/canvas/canvas.ts +9 -3
- package/src/components/combobox/combobox.module.scss +13 -0
- package/src/components/combobox/combobox.ts +7 -0
- package/src/components/form/form.ts +4 -4
- package/src/components/gridview/gridview.ts +12 -9
- package/src/components/header/header.module.scss +2 -1
- package/src/components/header/header.ts +17 -5
- package/src/components/icon/icon.module.scss +1 -0
- package/src/components/label/label.module.scss +6 -1
- package/src/components/listbox/listbox.module.scss +35 -31
- package/src/components/listbox/listbox.ts +50 -12
- package/src/components/messages/messages.ts +14 -0
- package/src/components/notification/notification.ts +1 -1
- package/src/components/popup/popup.ts +13 -2
- package/src/components/propgrid/propgrid.ts +4 -2
- package/src/components/sizers/sizer.ts +4 -4
- package/src/components/tabs/tabs.module.scss +2 -2
- package/src/components/tabs/tabs.ts +28 -4
- package/src/components/textedit/textedit.ts +1 -1
- package/src/components/treeview/treeview.module.scss +9 -1
- package/src/components/treeview/treeview.ts +52 -13
- package/src/core/component.ts +46 -9
- package/src/core/core_data.ts +8 -8
- package/src/core/core_state.ts +1 -1
- package/src/core/core_tools.ts +2 -0
- package/lib/src/components/base.scss +0 -25
- package/lib/src/components/boxes/boxes.module.scss +0 -54
- package/lib/src/components/boxes/boxes.ts +0 -370
- package/lib/src/components/breadcrumb/breadcrumb.scss +0 -56
- package/lib/src/components/breadcrumb/breadcrumb.ts +0 -93
- package/lib/src/components/breadcrumb/chevron-right.svg +0 -1
- package/lib/src/components/btngroup/btngroup.module.scss +0 -41
- package/lib/src/components/btngroup/btngroup.ts +0 -153
- package/lib/src/components/button/button.module.scss +0 -173
- package/lib/src/components/button/button.ts +0 -185
- package/lib/src/components/calendar/calendar-check-sharp-light.svg +0 -1
- package/lib/src/components/calendar/calendar.module.scss +0 -163
- package/lib/src/components/calendar/calendar.ts +0 -327
- package/lib/src/components/calendar/chevron-left-sharp-light.svg +0 -1
- package/lib/src/components/calendar/chevron-right-sharp-light.svg +0 -1
- package/lib/src/components/canvas/canvas.module.scss +0 -25
- package/lib/src/components/canvas/canvas.ts +0 -189
- package/lib/src/components/canvas/canvas_ex.ts +0 -276
- package/lib/src/components/checkbox/check.svg +0 -4
- package/lib/src/components/checkbox/checkbox.module.scss +0 -142
- package/lib/src/components/checkbox/checkbox.ts +0 -140
- package/lib/src/components/colorinput/colorinput.module.scss +0 -65
- package/lib/src/components/colorinput/colorinput.ts +0 -91
- package/lib/src/components/colorinput/crosshairs-simple-sharp-light.svg +0 -1
- package/lib/src/components/colorpicker/colorpicker.module.scss +0 -133
- package/lib/src/components/colorpicker/colorpicker.ts +0 -482
- package/lib/src/components/combobox/combobox.module.scss +0 -133
- package/lib/src/components/combobox/combobox.ts +0 -275
- package/lib/src/components/combobox/updown.svg +0 -4
- package/lib/src/components/components.ts +0 -42
- package/lib/src/components/dialog/dialog.module.scss +0 -104
- package/lib/src/components/dialog/dialog.ts +0 -229
- package/lib/src/components/dialog/xmark-sharp-light.svg +0 -1
- package/lib/src/components/filedrop/cloud-arrow-up.svg +0 -1
- package/lib/src/components/filedrop/filedrop.module.scss +0 -70
- package/lib/src/components/filedrop/filedrop.ts +0 -131
- package/lib/src/components/form/form.module.scss +0 -38
- package/lib/src/components/form/form.ts +0 -172
- package/lib/src/components/gridview/arrow-down-light.svg +0 -1
- package/lib/src/components/gridview/arrow-up-light.svg +0 -1
- package/lib/src/components/gridview/gridview.module.scss +0 -324
- package/lib/src/components/gridview/gridview.ts +0 -1175
- package/lib/src/components/header/header.module.scss +0 -40
- package/lib/src/components/header/header.ts +0 -130
- package/lib/src/components/icon/icon.module.scss +0 -31
- package/lib/src/components/icon/icon.ts +0 -137
- package/lib/src/components/image/image.module.scss +0 -28
- package/lib/src/components/image/image.ts +0 -168
- package/lib/src/components/input/input.module.scss +0 -74
- package/lib/src/components/input/input.ts +0 -422
- package/lib/src/components/keyboard/arrow-up.svg +0 -1
- package/lib/src/components/keyboard/delete-left.svg +0 -1
- package/lib/src/components/keyboard/eye-slash.svg +0 -1
- package/lib/src/components/keyboard/keyboard.module.scss +0 -134
- package/lib/src/components/keyboard/keyboard.ts +0 -526
- package/lib/src/components/label/label.module.scss +0 -76
- package/lib/src/components/label/label.ts +0 -97
- package/lib/src/components/link/link.ts +0 -81
- package/lib/src/components/listbox/listbox.module.scss +0 -161
- package/lib/src/components/listbox/listbox.ts +0 -539
- package/lib/src/components/menu/caret-right-solid.svg +0 -1
- package/lib/src/components/menu/menu.module.scss +0 -117
- package/lib/src/components/menu/menu.ts +0 -174
- package/lib/src/components/messages/circle-exclamation.svg +0 -1
- package/lib/src/components/messages/messages.module.scss +0 -92
- package/lib/src/components/messages/messages.ts +0 -215
- package/lib/src/components/messages/pen-field.svg +0 -1
- package/lib/src/components/normalize.scss +0 -391
- package/lib/src/components/notification/circle-check-solid.svg +0 -1
- package/lib/src/components/notification/circle-exclamation-solid.svg +0 -1
- package/lib/src/components/notification/circle-notch-light.svg +0 -1
- package/lib/src/components/notification/notification.module.scss +0 -84
- package/lib/src/components/notification/notification.ts +0 -107
- package/lib/src/components/notification/xmark-sharp-light.svg +0 -1
- package/lib/src/components/panel/panel.module.scss +0 -60
- package/lib/src/components/panel/panel.ts +0 -58
- package/lib/src/components/popup/popup.module.scss +0 -51
- package/lib/src/components/popup/popup.ts +0 -442
- package/lib/src/components/progress/progress.module.scss +0 -57
- package/lib/src/components/progress/progress.ts +0 -44
- package/lib/src/components/propgrid/folder-closed.svg +0 -1
- package/lib/src/components/propgrid/folder-open.svg +0 -1
- package/lib/src/components/propgrid/progrid.module.scss +0 -112
- package/lib/src/components/propgrid/propgrid.ts +0 -288
- package/lib/src/components/propgrid/updown.svg +0 -4
- package/lib/src/components/radio/radio.module.scss +0 -147
- package/lib/src/components/radio/radio.svg +0 -4
- package/lib/src/components/radio/radio.ts +0 -142
- package/lib/src/components/rating/rating.module.scss +0 -23
- package/lib/src/components/rating/rating.ts +0 -131
- package/lib/src/components/rating/star-sharp-light.svg +0 -1
- package/lib/src/components/rating/star-sharp-solid.svg +0 -1
- package/lib/src/components/select/select.module.scss +0 -9
- package/lib/src/components/select/select.ts +0 -134
- package/lib/src/components/shared.scss +0 -137
- package/lib/src/components/sizers/sizer.module.scss +0 -90
- package/lib/src/components/sizers/sizer.ts +0 -132
- package/lib/src/components/slider/slider.module.scss +0 -118
- package/lib/src/components/slider/slider.ts +0 -198
- package/lib/src/components/switch/switch.module.scss +0 -127
- package/lib/src/components/switch/switch.ts +0 -62
- package/lib/src/components/tabs/tabs.module.scss +0 -45
- package/lib/src/components/tabs/tabs.ts +0 -205
- package/lib/src/components/textarea/textarea.module.scss +0 -63
- package/lib/src/components/textarea/textarea.ts +0 -125
- package/lib/src/components/textedit/textedit.module.scss +0 -116
- package/lib/src/components/textedit/textedit.ts +0 -115
- package/lib/src/components/themes.scss +0 -88
- package/lib/src/components/tickline/tickline.module.scss +0 -26
- package/lib/src/components/tickline/tickline.ts +0 -82
- package/lib/src/components/tooltips/circle-info-sharp-light.svg +0 -1
- package/lib/src/components/tooltips/comments-question.svg +0 -1
- package/lib/src/components/tooltips/tooltips.scss +0 -72
- package/lib/src/components/tooltips/tooltips.ts +0 -109
- package/lib/src/components/treeview/chevron-down-light.svg +0 -1
- package/lib/src/components/treeview/treeview.module.scss +0 -185
- package/lib/src/components/treeview/treeview.ts +0 -445
- package/lib/src/components/viewport/viewport.module.scss +0 -32
- package/lib/src/components/viewport/viewport.ts +0 -41
- package/lib/src/core/component.ts +0 -1066
- package/lib/src/core/core_application.ts +0 -265
- package/lib/src/core/core_colors.ts +0 -250
- package/lib/src/core/core_data.ts +0 -1310
- package/lib/src/core/core_dom.ts +0 -471
- package/lib/src/core/core_dragdrop.ts +0 -201
- package/lib/src/core/core_element.ts +0 -115
- package/lib/src/core/core_events.ts +0 -177
- package/lib/src/core/core_i18n.ts +0 -393
- package/lib/src/core/core_react.ts +0 -79
- package/lib/src/core/core_router.ts +0 -237
- package/lib/src/core/core_state.ts +0 -62
- package/lib/src/core/core_styles.ts +0 -214
- package/lib/src/core/core_svg.ts +0 -712
- package/lib/src/core/core_tools.ts +0 -906
- package/lib/src/types/scss.d.ts +0 -4
- package/lib/src/types/svg.d.ts +0 -1
- package/lib/src/types/x4react.d.ts +0 -9
- package/lib/src/x4.scss +0 -19
- package/lib/src/x4.ts +0 -35
- package/lib/src/x4tsx.d.ts +0 -25
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|
|
|
7
|
-
*
|
|
8
|
-
* @file input.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 { EventCallback } from '../../core/core_events';
|
|
18
|
-
import { Component, ComponentEvent, ComponentProps, EvChange, EvFocus } from '../../core/component';
|
|
19
|
-
import { class_ns, formatIntlDate, IComponentInterface, IFormElement, isString } from '../../core/core_tools';
|
|
20
|
-
|
|
21
|
-
import "./input.module.scss"
|
|
22
|
-
|
|
23
|
-
export interface BaseProps extends ComponentProps {
|
|
24
|
-
name?: string;
|
|
25
|
-
autofocus?: boolean;
|
|
26
|
-
required?: boolean;
|
|
27
|
-
readonly?: boolean;
|
|
28
|
-
placeholder?: string;
|
|
29
|
-
|
|
30
|
-
focus?: EventCallback<EvFocus>;
|
|
31
|
-
change?: EventCallback<EvChange>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface CheckboxProps extends BaseProps {
|
|
35
|
-
type: "checkbox";
|
|
36
|
-
value?: boolean | number | string;
|
|
37
|
-
checked?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface RadioProps extends BaseProps {
|
|
41
|
-
type: "radio";
|
|
42
|
-
value?: boolean | number | string;
|
|
43
|
-
checked?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface RangeProps extends BaseProps {
|
|
47
|
-
type: "range";
|
|
48
|
-
value?: number;
|
|
49
|
-
min: number;
|
|
50
|
-
max: number;
|
|
51
|
-
step?: number;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface FileProps extends BaseProps {
|
|
55
|
-
type: "file";
|
|
56
|
-
accept: string | string[];
|
|
57
|
-
value?: never;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export interface DateProps extends BaseProps {
|
|
62
|
-
type: "date";
|
|
63
|
-
value?: Date | string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface TimeProps extends BaseProps {
|
|
67
|
-
type: "time";
|
|
68
|
-
readonly?: boolean;
|
|
69
|
-
required?: boolean;
|
|
70
|
-
value?: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface NumberProps extends BaseProps {
|
|
74
|
-
type: "number";
|
|
75
|
-
readonly?: boolean;
|
|
76
|
-
required?: boolean;
|
|
77
|
-
value?: number | string;
|
|
78
|
-
min?: number;
|
|
79
|
-
max?: number;
|
|
80
|
-
step?: number;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface TextInputProps extends BaseProps {
|
|
84
|
-
type?: "text" | "email" | "password";
|
|
85
|
-
readonly?: boolean;
|
|
86
|
-
required?: boolean;
|
|
87
|
-
pattern?: string;
|
|
88
|
-
value?: string | number;
|
|
89
|
-
spellcheck?: boolean;
|
|
90
|
-
minlength?: number;
|
|
91
|
-
maxlength?: number;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
export type InputProps = TextInputProps | CheckboxProps | RadioProps | RangeProps | DateProps | NumberProps | FileProps | TimeProps;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
interface InputEvents extends ComponentEvent {
|
|
99
|
-
focus: EvFocus;
|
|
100
|
-
change: EvChange;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
@class_ns( "x4" )
|
|
109
|
-
export class Input extends Component<InputProps,InputEvents> {
|
|
110
|
-
constructor( props: InputProps ) {
|
|
111
|
-
super( { tag: "input", ...props } );
|
|
112
|
-
|
|
113
|
-
this.mapPropEvents( props, "focus", "change" );
|
|
114
|
-
|
|
115
|
-
this.setAttribute( "type", props.type ?? "text" );
|
|
116
|
-
this.setAttribute( "name", props.name );
|
|
117
|
-
|
|
118
|
-
if( props.autofocus===true ) {
|
|
119
|
-
this.setAttribute( "autofocus", true );
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
switch( props.type ) {
|
|
123
|
-
case "checkbox":
|
|
124
|
-
case "radio": {
|
|
125
|
-
const ck = this.dom as HTMLInputElement;
|
|
126
|
-
ck.checked = props.checked;
|
|
127
|
-
ck.value = props.value === undefined ? "" : props.value+"";
|
|
128
|
-
//this.setAttribute( "checked", props.checked );
|
|
129
|
-
//this.setAttribute( "value", props.value );
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
case "range": {
|
|
134
|
-
this.setAttribute( "min", props.min );
|
|
135
|
-
this.setAttribute( "max", props.max );
|
|
136
|
-
this.setAttribute( "step", props.step );
|
|
137
|
-
this.setAttribute( "value", props.value );
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
case "number": {
|
|
142
|
-
const p = this.props as NumberProps;
|
|
143
|
-
|
|
144
|
-
this.setAttribute( "required", p.required );
|
|
145
|
-
this.setAttribute( "readonly", p.readonly );
|
|
146
|
-
this.setAttribute( "min", p.min );
|
|
147
|
-
this.setAttribute( "max", p.max );
|
|
148
|
-
this.setAttribute( "step", p.step );
|
|
149
|
-
//this.setAttribute( "value", p.value+'' );
|
|
150
|
-
this.setNumValue( isString(p.value) ? parseFloat(p.value) : p.value, -2 );
|
|
151
|
-
|
|
152
|
-
this.addDOMEvent( "wheel", ( e: WheelEvent ) => {
|
|
153
|
-
if( this.hasFocus() ) { // only if has focus
|
|
154
|
-
e.preventDefault( );
|
|
155
|
-
let v = this.getNumValue();
|
|
156
|
-
const delta = e.deltaY < 0 ? 1 : -1;
|
|
157
|
-
v += (p.step ? p.step : 1) * delta;
|
|
158
|
-
this.setNumValue( v, -2 );
|
|
159
|
-
|
|
160
|
-
this.dom.dispatchEvent(new Event('input'));
|
|
161
|
-
}
|
|
162
|
-
}, );
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
case "date": {
|
|
167
|
-
this.setAttribute( "required", props.required );
|
|
168
|
-
|
|
169
|
-
let v = props.value;
|
|
170
|
-
if( v instanceof Date ) {
|
|
171
|
-
this.setAttribute( "value", formatIntlDate( v, "Y-M-D" ) );
|
|
172
|
-
}
|
|
173
|
-
else if( props.value!==null && props.value!==undefined ) {
|
|
174
|
-
this.setAttribute( "value", v );
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
case "file": {
|
|
181
|
-
let v: string;
|
|
182
|
-
if( Array.isArray(props.accept) ) {
|
|
183
|
-
v = props.accept.join("," );
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
v = props.accept;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
this.setAttribute( "accept", v );
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
case "time": {
|
|
194
|
-
this.setAttribute( "required", props.required );
|
|
195
|
-
if( props.value!==null && props.value!==undefined ) {
|
|
196
|
-
this.setAttribute( "value", props.value );
|
|
197
|
-
}
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
default: {
|
|
202
|
-
this.setAttribute( "required", props.required );
|
|
203
|
-
this.setAttribute( "readonly", props.readonly );
|
|
204
|
-
|
|
205
|
-
if( props.value!==null && props.value!==undefined ) {
|
|
206
|
-
this.setAttribute( "value", props.value );
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if( props.pattern!==null && props.pattern!==undefined ) {
|
|
210
|
-
this.setAttribute( "pattern", props.pattern );
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if( props.placeholder!==null && props.placeholder!==undefined ) {
|
|
214
|
-
this.setAttribute( "placeholder", props.placeholder );
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if( props.spellcheck===false ) {
|
|
218
|
-
this.setAttribute( "spellcheck", false );
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if( props.minlength!==undefined ) {
|
|
222
|
-
this.setAttribute( "minlength", props.minlength );
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if( props.maxlength!==undefined ) {
|
|
226
|
-
this.setAttribute( "maxlength", props.maxlength );
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
this.addDOMEvent( "blur", ( e ) => { this.on_focus(e,true);} );
|
|
234
|
-
this.addDOMEvent( "focus", ( e ) => { this.on_focus(e,false);} );
|
|
235
|
-
this.addDOMEvent( "input", ( e ) => { this.on_change(e as InputEvent); });
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
*
|
|
240
|
-
*/
|
|
241
|
-
|
|
242
|
-
private on_focus( ev: FocusEvent, focus_out: boolean ) {
|
|
243
|
-
const event: EvFocus = { focus_out }
|
|
244
|
-
this.fire( "focus", event );
|
|
245
|
-
|
|
246
|
-
if( event.defaultPrevented ) {
|
|
247
|
-
ev.preventDefault( );
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
*
|
|
253
|
-
*/
|
|
254
|
-
|
|
255
|
-
private on_change( ev: InputEvent ) {
|
|
256
|
-
|
|
257
|
-
const event: EvChange = { value: this.getValue() };
|
|
258
|
-
this.fire( "change", event );
|
|
259
|
-
|
|
260
|
-
if( event.defaultPrevented ) {
|
|
261
|
-
ev.preventDefault( );
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* @returns
|
|
267
|
-
*/
|
|
268
|
-
|
|
269
|
-
public getValue( ) {
|
|
270
|
-
return (this.dom as HTMLInputElement).value;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
*
|
|
275
|
-
* @param value
|
|
276
|
-
*/
|
|
277
|
-
|
|
278
|
-
public setValue( value: string ) {
|
|
279
|
-
(this.dom as HTMLInputElement).value = value+"";
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
*
|
|
284
|
-
* @returns
|
|
285
|
-
*/
|
|
286
|
-
|
|
287
|
-
public getNumValue( defNan?: number ) {
|
|
288
|
-
const v = parseFloat( this.getValue() );
|
|
289
|
-
if( isNaN(v) && defNan!==undefined ) {
|
|
290
|
-
return defNan;
|
|
291
|
-
}
|
|
292
|
-
return v;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
*
|
|
297
|
-
* @param value
|
|
298
|
-
* @param ndec number of decimals or -1 for auto, -2 as prop.step
|
|
299
|
-
*
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
|
-
public setNumValue( value: number, ndec = -1 ) {
|
|
303
|
-
|
|
304
|
-
if( ndec==-2 && this.props.type=='number' ) {
|
|
305
|
-
const p = this.props as NumberProps;
|
|
306
|
-
|
|
307
|
-
if( p.step<1 ) {
|
|
308
|
-
let ndec = -Math.floor(Math.log10(p.step ?? 1) );
|
|
309
|
-
return this.setValue( value.toFixed(ndec) );
|
|
310
|
-
}
|
|
311
|
-
else if( p.step>1 ) {
|
|
312
|
-
return this.setValue( value.toFixed() );
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
else if( ndec>=0 ) {
|
|
316
|
-
return this.setValue( value.toFixed(ndec) );
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
this.setValue( value+"" );
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* @return the checked value
|
|
324
|
-
*/
|
|
325
|
-
|
|
326
|
-
public getCheck() {
|
|
327
|
-
const d = this.dom as HTMLInputElement;
|
|
328
|
-
return d.checked;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* change the checked value
|
|
333
|
-
* @param {boolean} ck new checked value
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
public setCheck(ck: boolean) {
|
|
337
|
-
const d = this.dom as HTMLInputElement;
|
|
338
|
-
d.checked = ck;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
*
|
|
343
|
-
*/
|
|
344
|
-
|
|
345
|
-
public setReadOnly( ro: boolean ) {
|
|
346
|
-
const d = this.dom as HTMLInputElement;
|
|
347
|
-
d.readOnly = ro;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* select all the text
|
|
352
|
-
*/
|
|
353
|
-
|
|
354
|
-
public selectAll( ) {
|
|
355
|
-
const d = this.dom as HTMLInputElement;
|
|
356
|
-
d.select();
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* select a part of the text
|
|
361
|
-
* @param start
|
|
362
|
-
* @param length
|
|
363
|
-
*/
|
|
364
|
-
|
|
365
|
-
public select( start: number, length: number = 9999 ) : void {
|
|
366
|
-
const d = this.dom as HTMLInputElement;
|
|
367
|
-
d.setSelectionRange( start, start+length );
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* get the selection as { start, length }
|
|
372
|
-
*/
|
|
373
|
-
|
|
374
|
-
public getSelection( ) {
|
|
375
|
-
const d = this.dom as HTMLInputElement;
|
|
376
|
-
|
|
377
|
-
return {
|
|
378
|
-
start: d.selectionStart,
|
|
379
|
-
length: d.selectionEnd - d.selectionStart,
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
*
|
|
385
|
-
*/
|
|
386
|
-
|
|
387
|
-
public isValid( ) {
|
|
388
|
-
|
|
389
|
-
if( (this.props as any).required ) {
|
|
390
|
-
const v = this.getValue( );
|
|
391
|
-
if( v==="" ) {
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
return true;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
*
|
|
401
|
-
*/
|
|
402
|
-
|
|
403
|
-
override queryInterface<T extends IComponentInterface>( name: string ): T {
|
|
404
|
-
if( name=="form-element" ) {
|
|
405
|
-
const i: IFormElement = {
|
|
406
|
-
getRawValue: ( ): any => { return this.getValue(); },
|
|
407
|
-
setRawValue: ( v: any ) => { this.setValue(v); },
|
|
408
|
-
isValid: ( ) => { return this.isValid(); }
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
//@ts-ignore
|
|
412
|
-
return i as T;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
return super.queryInterface( name );
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2 160 448c0 17.7 14.3 32 32 32s32-14.3 32-32l0-306.7L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M576 128c0-35.3-28.7-64-64-64L205.3 64c-17 0-33.3 6.7-45.3 18.7L9.4 233.4c-6 6-9.4 14.1-9.4 22.6s3.4 16.6 9.4 22.6L160 429.3c12 12 28.3 18.7 45.3 18.7L512 448c35.3 0 64-28.7 64-64l0-256zM271 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zm151 118.3C226 97.7 269.5 80 320 80c65.2 0 118.8 29.6 159.9 67.7C518.4 183.5 545 226 558.6 256c-12.6 28-36.6 66.8-70.9 100.9l-53.8-42.2c9.1-17.6 14.2-37.5 14.2-58.7c0-70.7-57.3-128-128-128c-32.2 0-61.7 11.9-84.2 31.5l-46.1-36.1zM394.9 284.2l-81.5-63.9c4.2-8.5 6.6-18.2 6.6-28.3c0-5.5-.7-10.9-2-16c.7 0 1.3 0 2 0c44.2 0 80 35.8 80 80c0 9.9-1.8 19.4-5.1 28.2zm9.4 130.3C378.8 425.4 350.7 432 320 432c-65.2 0-118.8-29.6-159.9-67.7C121.6 328.5 95 286 81.4 256c8.3-18.4 21.5-41.5 39.4-64.8L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5l-41.9-33zM192 256c0 70.7 57.3 128 128 128c13.3 0 26.1-2 38.2-5.8L302 334c-23.5-5.4-43.1-21.2-53.7-42.3l-56.1-44.2c-.2 2.8-.3 5.6-.3 8.5z"/></svg>
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|.2
|
|
7
|
-
*
|
|
8
|
-
* @file keyboard.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
|
-
:root {
|
|
18
|
-
--keyboard-key-background: #33302d;
|
|
19
|
-
--keyboard-hilite-color: #5ba921;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.x4keyboard {
|
|
23
|
-
z-index: 2000;
|
|
24
|
-
position: absolute !important;
|
|
25
|
-
width: 100vw;
|
|
26
|
-
height: 14rem;
|
|
27
|
-
bottom: 0;
|
|
28
|
-
|
|
29
|
-
background-color: rgba(0,0,0,0.9);
|
|
30
|
-
|
|
31
|
-
box-sizing: border-box;
|
|
32
|
-
padding: 4px;
|
|
33
|
-
|
|
34
|
-
#kb {
|
|
35
|
-
width: 100vw;
|
|
36
|
-
max-width: 800px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.line {
|
|
40
|
-
flex-grow: 10;
|
|
41
|
-
position: relative;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.mi {
|
|
45
|
-
font-family: 'Material Icons';
|
|
46
|
-
font-size: 22px;
|
|
47
|
-
text-align: center;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.tch {
|
|
51
|
-
cursor: pointer;
|
|
52
|
-
|
|
53
|
-
flex-grow: 10;
|
|
54
|
-
flex-basis: 44px;
|
|
55
|
-
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
|
|
59
|
-
div {
|
|
60
|
-
width: 100%;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
color: white;
|
|
64
|
-
text-align: center;
|
|
65
|
-
|
|
66
|
-
background-color: var( --keyboard-key-background);
|
|
67
|
-
border: 1px solid var( --keyboard-key-background);
|
|
68
|
-
|
|
69
|
-
border-radius: 4px;
|
|
70
|
-
margin: 2px 4px;
|
|
71
|
-
box-sizing: border-box;
|
|
72
|
-
|
|
73
|
-
&:hover {
|
|
74
|
-
border: 1px solid var( --keyboard-hilite-color);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
&:active {
|
|
78
|
-
background-color: var( --keyboard-hilite-color);
|
|
79
|
-
color: var( --keyboard-key-background);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.cplace {
|
|
85
|
-
visibility: hidden;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.kbicon {
|
|
89
|
-
div {
|
|
90
|
-
width: 0;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.cret {
|
|
95
|
-
color: var( --keyboard-hilite-color);
|
|
96
|
-
font-weight: bold;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.cdel,
|
|
100
|
-
.cshift,
|
|
101
|
-
.chide {
|
|
102
|
-
.x4icon {
|
|
103
|
-
margin: auto;
|
|
104
|
-
color: var( --keyboard-hilite-color);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// color: rgba(255,255,255,0.3);
|
|
109
|
-
|
|
110
|
-
.lower,
|
|
111
|
-
.upper {
|
|
112
|
-
|
|
113
|
-
.cspace {
|
|
114
|
-
flex-basis: 689px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.cret {
|
|
118
|
-
flex-basis: 84px;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.cshift {
|
|
122
|
-
flex-basis: 60px;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.chide {
|
|
126
|
-
flex-basis: 88px;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.cnum {
|
|
130
|
-
flex-basis: 88px;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|