fix(ui): type requestUpdate
This commit is contained in:
parent
aee0621c54
commit
dec62b3b0d
16 changed files with 104 additions and 71 deletions
|
|
@ -317,11 +317,17 @@ export class LionCalendar extends LocalizeMixin(LitElement) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {?} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
|
||||
if (name === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
const map = {
|
||||
disableDates: () => this.__disableDatesChanged(),
|
||||
|
|
|
|||
|
|
@ -378,11 +378,13 @@ export class LionCombobox extends OverlayMixin(LionListbox) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {'disabled'|'modelValue'|'readOnly'|'focused'} name
|
||||
* @param {unknown} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (name === 'disabled' || name === 'readOnly') {
|
||||
this.__setComboboxDisabledAndReadOnly();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,11 +58,13 @@ const DisabledMixinImplementation = superclass =>
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {PropertyKey} name
|
||||
* @param {?} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (name === 'disabled') {
|
||||
if (this.__isUserSettingDisabled) {
|
||||
this.__restoreDisabledTo = this.disabled;
|
||||
|
|
|
|||
|
|
@ -60,11 +60,13 @@ const DisabledWithTabIndexMixinImplementation = superclass =>
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {PropertyKey} name
|
||||
* @param {?} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
|
||||
if (name === 'disabled') {
|
||||
if (this.disabled) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export declare class SlotHost {
|
|||
* };
|
||||
* }
|
||||
*/
|
||||
export declare function SlotMixinImplementation<T extends Constructor<LitElement>>(
|
||||
declare function SlotMixinImplementation<T extends Constructor<LitElement>>(
|
||||
superclass: T,
|
||||
): T &
|
||||
Constructor<SlotHost> &
|
||||
|
|
|
|||
|
|
@ -70,19 +70,21 @@ const FormatMixinImplementation = superclass =>
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {any} oldVal
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldVal) {
|
||||
super.requestUpdate(name, oldVal);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
|
||||
if (name === 'modelValue' && this.modelValue !== oldVal) {
|
||||
this._onModelValueChanged({ modelValue: this.modelValue }, { modelValue: oldVal });
|
||||
if (name === 'modelValue' && this.modelValue !== oldValue) {
|
||||
this._onModelValueChanged({ modelValue: this.modelValue }, { modelValue: oldValue });
|
||||
}
|
||||
if (name === 'serializedValue' && this.serializedValue !== oldVal) {
|
||||
if (name === 'serializedValue' && this.serializedValue !== oldValue) {
|
||||
this._calculateValues({ source: 'serialized' });
|
||||
}
|
||||
if (name === 'formattedValue' && this.formattedValue !== oldVal) {
|
||||
if (name === 'formattedValue' && this.formattedValue !== oldValue) {
|
||||
this._calculateValues({ source: 'formatted' });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,12 +33,14 @@ const InteractionStateMixinImplementation = superclass =>
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {PropertyKey} name
|
||||
* @param {*} oldVal
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldVal) {
|
||||
super.requestUpdate(name, oldVal);
|
||||
if (name === 'touched' && this.touched !== oldVal) {
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (name === 'touched' && this.touched !== oldValue) {
|
||||
this._onTouchedChanged();
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +50,7 @@ const InteractionStateMixinImplementation = superclass =>
|
|||
this.filled = !this._isEmpty();
|
||||
}
|
||||
|
||||
if (name === 'dirty' && this.dirty !== oldVal) {
|
||||
if (name === 'dirty' && this.dirty !== oldValue) {
|
||||
this._onDirtyChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,11 +52,13 @@ const ChoiceInputMixinImplementation = superclass =>
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {any} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
|
||||
if (name === 'modelValue') {
|
||||
if (this.modelValue.checked !== this.checked) {
|
||||
|
|
|
|||
|
|
@ -93,11 +93,16 @@ const SyncUpdatableMixinImplementation = superclass =>
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {*} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (name === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.__SyncUpdatableNamespace = this.__SyncUpdatableNamespace || {};
|
||||
const ns = this.__SyncUpdatableNamespace;
|
||||
|
|
|
|||
|
|
@ -147,11 +147,13 @@ describe('SyncUpdatableMixin', () => {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {*} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (name === 'prop') {
|
||||
propChangedCount += 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,11 +211,13 @@ export class LionInputDatepicker extends ScopedElementsMixin(
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {PropertyKey} name
|
||||
* @param {?} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
|
||||
if (name === 'disabled' || name === 'readOnly') {
|
||||
this.__toggleInvokerDisabled();
|
||||
|
|
|
|||
|
|
@ -64,11 +64,13 @@ export class LionInput extends NativeTextFieldMixin(LionField) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {PropertyKey} [name]
|
||||
* @param {?} [oldValue]
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (name === 'readOnly') {
|
||||
this.__delegateReadOnly();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,11 +78,13 @@ export class LionOption extends DisabledMixin(
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {unknown} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
|
||||
if (name === 'active' && this.active !== oldValue) {
|
||||
this.dispatchEvent(new Event('active-changed', { bubbles: true }));
|
||||
|
|
|
|||
|
|
@ -58,12 +58,13 @@ export const OverlayMixinImplementation = superclass =>
|
|||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @param {string} name
|
||||
* @param {any} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (name === 'opened' && this.opened !== oldValue) {
|
||||
this.dispatchEvent(new Event('opened-changed'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,11 +156,13 @@ export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(L
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {unknown} oldValue
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (name === 'interactionMode') {
|
||||
if (this.interactionMode === 'auto') {
|
||||
this.interactionMode = detectInteractionMode();
|
||||
|
|
|
|||
|
|
@ -151,14 +151,13 @@ export class LionSwitchButton extends DisabledWithTabIndexMixin(LitElement) {
|
|||
}
|
||||
|
||||
/**
|
||||
* We synchronously update aria-checked to support voice over on safari.
|
||||
*
|
||||
* @param {PropertyKey} name
|
||||
* @param {?} oldValue
|
||||
* @override
|
||||
* @param {string} [name]
|
||||
* @param {unknown} [oldValue]
|
||||
* @param {import('lit').PropertyDeclaration} [options]
|
||||
* @returns {void}
|
||||
*/
|
||||
requestUpdate(name, oldValue) {
|
||||
super.requestUpdate(name, oldValue);
|
||||
requestUpdate(name, oldValue, options) {
|
||||
super.requestUpdate(name, oldValue, options);
|
||||
if (this.isConnected && name === 'checked' && this.checked !== oldValue && !this.disabled) {
|
||||
this.__checkedStateChange();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue