x4js 2.0.23 → 2.0.24
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.js +2 -2
- package/lib/esm/x4.mjs +2 -2
- package/package.json +1 -1
- package/src/components/input/input.ts +21 -2
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
17
|
import { EventCallback } from '../../core/core_events';
|
|
18
|
-
import { Component, ComponentEvent, ComponentProps, EvChange, EvFocus } from '../../core/component';
|
|
18
|
+
import { Component, ComponentEvent, componentFromDOM, ComponentProps, EvChange, EvFocus } from '../../core/component';
|
|
19
19
|
import { class_ns, formatIntlDate, IComponentInterface, IFormElement, isString } from '../../core/core_tools';
|
|
20
20
|
|
|
21
21
|
import "./input.module.scss"
|
|
@@ -407,10 +407,16 @@ export class Input extends Component<InputProps,InputEvents> {
|
|
|
407
407
|
if( this.props.type=='checkbox' ) {
|
|
408
408
|
return this.getCheck( );
|
|
409
409
|
}
|
|
410
|
+
else if( this.props.type=='radio' ) {
|
|
411
|
+
const owner = getRadioOwner( this.dom );
|
|
412
|
+
const checked = owner.querySelector( `input[name="${this.props.name}"]:checked` )
|
|
413
|
+
return checked ? (checked as HTMLInputElement).value : undefined;
|
|
414
|
+
}
|
|
415
|
+
|
|
410
416
|
return this.getValue();
|
|
411
417
|
},
|
|
412
418
|
setRawValue: ( v: any ) => {
|
|
413
|
-
if( this.props.type=='checkbox' ) {
|
|
419
|
+
if( this.props.type=='checkbox' || this.props.type=='radio' ) {
|
|
414
420
|
this.setCheck( !!v );
|
|
415
421
|
}
|
|
416
422
|
else {
|
|
@@ -429,6 +435,19 @@ export class Input extends Component<InputProps,InputEvents> {
|
|
|
429
435
|
}
|
|
430
436
|
|
|
431
437
|
|
|
438
|
+
function getRadioOwner( el: Element ) {
|
|
439
|
+
|
|
440
|
+
while( el!=document.body ) {
|
|
441
|
+
const comp = componentFromDOM(el);
|
|
442
|
+
const ifx = comp.queryInterface( "tab-handler");
|
|
443
|
+
if( ifx ) {
|
|
444
|
+
return el;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
el = el.parentElement;
|
|
448
|
+
}
|
|
432
449
|
|
|
450
|
+
return document;
|
|
451
|
+
}
|
|
433
452
|
|
|
434
453
|
|