chore: unify the naming of changedProperties param (#620)
This commit is contained in:
parent
67a42c032e
commit
ad1e828d51
15 changed files with 73 additions and 67 deletions
|
|
@ -217,8 +217,8 @@ export class LionCalendar extends LocalizeMixin(LitElement) {
|
|||
this.__addEventForKeyboardNavigation();
|
||||
}
|
||||
|
||||
updated(changed) {
|
||||
if (changed.has('__focusedDate') && this.__focusedDate) {
|
||||
updated(changedProperties) {
|
||||
if (changedProperties.has('__focusedDate') && this.__focusedDate) {
|
||||
this.focusCentralDate();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,18 +62,18 @@ export const ChoiceInputMixin = superclass =>
|
|||
}
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
if (c.has('checked')) {
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
if (changedProperties.has('checked')) {
|
||||
// Here we set the initial value for our [slot=input] content,
|
||||
// which has been set by our SlotMixin
|
||||
this.__syncCheckedToInputElement();
|
||||
}
|
||||
}
|
||||
|
||||
updated(c) {
|
||||
super.updated(c);
|
||||
if (c.has('modelValue')) {
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
if (changedProperties.has('modelValue')) {
|
||||
this.__syncCheckedToInputElement();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,10 +102,10 @@ export const FormControlMixin = dedupeMixin(
|
|||
};
|
||||
}
|
||||
|
||||
updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
|
||||
if (changedProps.has('_ariaLabelledNodes')) {
|
||||
if (changedProperties.has('_ariaLabelledNodes')) {
|
||||
this.__reflectAriaAttr(
|
||||
'aria-labelledby',
|
||||
this._ariaLabelledNodes,
|
||||
|
|
@ -113,7 +113,7 @@ export const FormControlMixin = dedupeMixin(
|
|||
);
|
||||
}
|
||||
|
||||
if (changedProps.has('_ariaDescribedNodes')) {
|
||||
if (changedProperties.has('_ariaDescribedNodes')) {
|
||||
this.__reflectAriaAttr(
|
||||
'aria-describedby',
|
||||
this._ariaDescribedNodes,
|
||||
|
|
@ -121,11 +121,11 @@ export const FormControlMixin = dedupeMixin(
|
|||
);
|
||||
}
|
||||
|
||||
if (changedProps.has('label')) {
|
||||
if (changedProperties.has('label')) {
|
||||
this._onLabelChanged({ label: this.label });
|
||||
}
|
||||
|
||||
if (changedProps.has('helpText')) {
|
||||
if (changedProperties.has('helpText')) {
|
||||
this._onHelpTextChanged({ helpText: this.helpText });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ export class LionField extends FormControlMixin(
|
|||
this.submitted = false;
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
this._initialModelValue = this.modelValue;
|
||||
}
|
||||
|
||||
|
|
@ -118,19 +118,19 @@ export class LionField extends FormControlMixin(
|
|||
this._inputNode.removeEventListener('change', this._onChange);
|
||||
}
|
||||
|
||||
updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
|
||||
if (changedProps.has('disabled')) {
|
||||
if (changedProperties.has('disabled')) {
|
||||
this._inputNode.disabled = this.disabled;
|
||||
this.validate();
|
||||
}
|
||||
|
||||
if (changedProps.has('name')) {
|
||||
if (changedProperties.has('name')) {
|
||||
this._inputNode.name = this.name;
|
||||
}
|
||||
|
||||
if (changedProps.has('autocomplete')) {
|
||||
if (changedProperties.has('autocomplete')) {
|
||||
this._inputNode.autocomplete = this.autocomplete;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,10 +145,10 @@ export const FormGroupMixin = dedupeMixin(
|
|||
});
|
||||
}
|
||||
|
||||
updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
|
||||
if (changedProps.has('disabled')) {
|
||||
if (changedProperties.has('disabled')) {
|
||||
if (this.disabled) {
|
||||
this.__requestChildrenToBeDisabled();
|
||||
} else {
|
||||
|
|
@ -156,7 +156,7 @@ export const FormGroupMixin = dedupeMixin(
|
|||
}
|
||||
}
|
||||
|
||||
if (changedProps.has('focused')) {
|
||||
if (changedProperties.has('focused')) {
|
||||
if (this.focused === true) {
|
||||
this.__setupOutsideClickHandling();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ export class HelperOutput extends LitElement {
|
|||
];
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
if (!this.field) {
|
||||
// Fuzzy logic, but... practical
|
||||
const prev = this.previousElementSibling;
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
|
|||
}
|
||||
}
|
||||
|
||||
updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
if (changedProps.has('currency')) {
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
if (changedProperties.has('currency')) {
|
||||
this._onCurrencyChanged({ currency: this.currency });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ export class LionInputDate extends LocalizeMixin(LionInput) {
|
|||
this.defaultValidators.push(new IsDate());
|
||||
}
|
||||
|
||||
updated(c) {
|
||||
super.updated(c);
|
||||
if (c.has('locale')) {
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
if (changedProperties.has('locale')) {
|
||||
this._calculateValues();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,22 +178,22 @@ export class LionInputDatepicker extends OverlayMixin(LionInputDate) {
|
|||
}
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
this.__toggleInvokerDisabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @param {Map} c - changed properties
|
||||
* @param {Map} changedProperties - changed properties
|
||||
*/
|
||||
updated(c) {
|
||||
super.updated(c);
|
||||
if (c.has('validators')) {
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
if (changedProperties.has('validators')) {
|
||||
const validators = [...(this.validators || [])];
|
||||
this.__syncDisabledDates(validators);
|
||||
}
|
||||
if (c.has('label')) {
|
||||
if (changedProperties.has('label')) {
|
||||
this.calendarHeading = this.calendarHeading || this.label;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,17 +60,17 @@ export class LionInput extends LionField {
|
|||
}
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
this.__delegateReadOnly();
|
||||
}
|
||||
|
||||
updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
if (changedProps.has('type')) {
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
if (changedProperties.has('type')) {
|
||||
this._inputNode.type = this.type;
|
||||
}
|
||||
if (changedProps.has('placeholder')) {
|
||||
if (changedProperties.has('placeholder')) {
|
||||
this._inputNode.placeholder = this.placeholder;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,8 +200,8 @@ export class LionSelectRich extends ChoiceGroupMixin(
|
|||
this.__teardownListboxNode();
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
this.__setupOverlay();
|
||||
this.__setupInvokerNode();
|
||||
this.__setupListboxNode();
|
||||
|
|
@ -245,10 +245,10 @@ export class LionSelectRich extends ChoiceGroupMixin(
|
|||
`;
|
||||
}
|
||||
|
||||
updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
|
||||
if (changedProps.has('disabled')) {
|
||||
if (changedProperties.has('disabled')) {
|
||||
if (this.disabled) {
|
||||
this._invokerNode.makeRequestToBeDisabled();
|
||||
this.__requestOptionsToBeDisabled();
|
||||
|
|
@ -259,21 +259,21 @@ export class LionSelectRich extends ChoiceGroupMixin(
|
|||
}
|
||||
|
||||
if (this._inputNode && this._invokerNode) {
|
||||
if (changedProps.has('_ariaLabelledNodes')) {
|
||||
if (changedProperties.has('_ariaLabelledNodes')) {
|
||||
this._invokerNode.setAttribute(
|
||||
'aria-labelledby',
|
||||
`${this._inputNode.getAttribute('aria-labelledby')} ${this._invokerNode.id}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (changedProps.has('_ariaDescribedNodes')) {
|
||||
if (changedProperties.has('_ariaDescribedNodes')) {
|
||||
this._invokerNode.setAttribute(
|
||||
'aria-describedby',
|
||||
this._inputNode.getAttribute('aria-describedby'),
|
||||
);
|
||||
}
|
||||
|
||||
if (changedProps.has('showsFeedbackFor')) {
|
||||
if (changedProperties.has('showsFeedbackFor')) {
|
||||
// The ValidateMixin sets aria-invalid on the inputNode, but in this component we also need it on the invoker
|
||||
this._invokerNode.setAttribute('aria-invalid', this._hasFeedbackVisibleFor('error'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,13 @@ export class LionSteps extends LitElement {
|
|||
};
|
||||
}
|
||||
|
||||
updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
if (changedProps.has('current')) {
|
||||
this._onCurrentChanged({ current: this.current }, { current: changedProps.get('current') });
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
if (changedProperties.has('current')) {
|
||||
this._onCurrentChanged(
|
||||
{ current: this.current },
|
||||
{ current: changedProperties.get('current') },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,8 +188,8 @@ export const ValidateMixin = dedupeMixin(
|
|||
await import('../lion-validation-feedback.js');
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
this.__validateInitialized = true;
|
||||
this.validate();
|
||||
this._loadFeedbackComponent();
|
||||
|
|
@ -591,10 +591,13 @@ export const ValidateMixin = dedupeMixin(
|
|||
);
|
||||
}
|
||||
|
||||
updated(c) {
|
||||
super.updated(c);
|
||||
updated(changedProperties) {
|
||||
super.updated(changedProperties);
|
||||
|
||||
if (c.has('shouldShowFeedbackFor') || c.has('hasFeedbackFor')) {
|
||||
if (
|
||||
changedProperties.has('shouldShowFeedbackFor') ||
|
||||
changedProperties.has('hasFeedbackFor')
|
||||
) {
|
||||
this.showsFeedbackFor = this.constructor.validationTypes
|
||||
.map(type => (this._hasFeedbackVisibleFor(type) ? type : undefined))
|
||||
.filter(_ => !!_);
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ export const SyncUpdatableMixin = dedupeMixin(
|
|||
this.__SyncUpdatableNamespace = {};
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
this.__SyncUpdatableNamespace.connected = true;
|
||||
this.__syncUpdatableInitialize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ describe('SyncUpdatableMixin', () => {
|
|||
this.propB = 'init-b';
|
||||
}
|
||||
|
||||
firstUpdated(c) {
|
||||
super.firstUpdated(c);
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties);
|
||||
hasCalledFirstUpdated = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue