mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-13 21:17:55 +08:00
fix(checkbox, toggle, radio-group): add initial value
This commit is contained in:
@@ -174,6 +174,7 @@ export class Checkbox implements ComponentInterface {
|
|||||||
* a higher priority.
|
* a higher priority.
|
||||||
*/
|
*/
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
|
console.log('updating hint text id');
|
||||||
this.hintTextID = this.getHintTextID();
|
this.hintTextID = this.getHintTextID();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -193,6 +194,8 @@ export class Checkbox implements ComponentInterface {
|
|||||||
this.inheritedAttributes = {
|
this.inheritedAttributes = {
|
||||||
...inheritAriaAttributes(this.el),
|
...inheritAriaAttributes(this.el),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.hintTextID = this.getHintTextID();
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
|
|
||||||
const isInvalid = checkbox.classList.contains('ion-invalid');
|
const isInvalid = checkbox.classList.contains('ion-invalid');
|
||||||
if (isInvalid) {
|
if (isInvalid) {
|
||||||
console.log('Field marked invalid:', checkbox.label, checkbox.errorText);
|
console.log('Field marked invalid:', checkbox.innerText, checkbox.errorText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { ComponentInterface, EventEmitter } from '@stencil/core';
|
import type { ComponentInterface, EventEmitter } from '@stencil/core';
|
||||||
import { Build, Component, Element, Event, Host, Listen, Method, Prop, State, Watch, h } from '@stencil/core';
|
import { Build, Component, Element, Event, Host, Listen, Method, Prop, State, Watch, h } from '@stencil/core';
|
||||||
import { checkInvalidState } from '@utils/forms';
|
import { checkInvalidState } from '@utils/forms';
|
||||||
import { renderHiddenInput } from '@utils/helpers';
|
import { inheritAriaAttributes, renderHiddenInput } from '@utils/helpers';
|
||||||
|
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
|
|
||||||
@@ -171,6 +171,10 @@ export class RadioGroup implements ComponentInterface {
|
|||||||
this.isInvalid = checkInvalidState(this.el);
|
this.isInvalid = checkInvalidState(this.el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillLoad() {
|
||||||
|
this.hintTextID = this.getHintTextID();
|
||||||
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
// Clean up validation observer to prevent memory leaks.
|
// Clean up validation observer to prevent memory leaks.
|
||||||
if (this.validationObserver) {
|
if (this.validationObserver) {
|
||||||
|
|||||||
@@ -157,7 +157,7 @@
|
|||||||
|
|
||||||
const isInvalid = radioGroup.classList.contains('ion-invalid');
|
const isInvalid = radioGroup.classList.contains('ion-invalid');
|
||||||
if (isInvalid) {
|
if (isInvalid) {
|
||||||
console.log('Field marked invalid:', radioGroup.label, radioGroup.errorText);
|
console.log('Field marked invalid:', radioGroup.id, radioGroup.errorText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
|
|
||||||
const isInvalid = toggle.classList.contains('ion-invalid');
|
const isInvalid = toggle.classList.contains('ion-invalid');
|
||||||
if (isInvalid) {
|
if (isInvalid) {
|
||||||
console.log('Field marked invalid:', toggle.label, toggle.errorText);
|
console.log('Field marked invalid:', toggle.innerText, toggle.errorText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -269,6 +269,8 @@ export class Toggle implements ComponentInterface {
|
|||||||
this.inheritedAttributes = {
|
this.inheritedAttributes = {
|
||||||
...inheritAriaAttributes(this.el),
|
...inheritAriaAttributes(this.el),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.hintTextID = this.getHintTextID();
|
||||||
}
|
}
|
||||||
|
|
||||||
private onStart() {
|
private onStart() {
|
||||||
|
|||||||
Reference in New Issue
Block a user