x4js 2.0.23 → 2.0.25
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 +25 -1
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,12 +407,23 @@ 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
419
|
if( this.props.type=='checkbox' ) {
|
|
414
420
|
this.setCheck( !!v );
|
|
415
421
|
}
|
|
422
|
+
else if( this.props.type=='radio' ) {
|
|
423
|
+
if( this.props.value==v ) {
|
|
424
|
+
this.setCheck( true ) ;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
416
427
|
else {
|
|
417
428
|
this.setValue(v);
|
|
418
429
|
}
|
|
@@ -429,6 +440,19 @@ export class Input extends Component<InputProps,InputEvents> {
|
|
|
429
440
|
}
|
|
430
441
|
|
|
431
442
|
|
|
443
|
+
function getRadioOwner( el: Element ) {
|
|
444
|
+
|
|
445
|
+
while( el!=document.body ) {
|
|
446
|
+
const comp = componentFromDOM(el);
|
|
447
|
+
const ifx = comp.queryInterface( "tab-handler");
|
|
448
|
+
if( ifx ) {
|
|
449
|
+
return el;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
el = el.parentElement;
|
|
453
|
+
}
|
|
432
454
|
|
|
455
|
+
return document;
|
|
456
|
+
}
|
|
433
457
|
|
|
434
458
|
|