fix: expose members as protected for extension compat. till v1

This commit is contained in:
Thijs Louisse 2021-04-13 16:38:33 +02:00
parent 956d077d83
commit f0527583d6
9 changed files with 40 additions and 17 deletions

View file

@ -0,0 +1,11 @@
---
'@lion/button': patch
'@lion/calendar': patch
'@lion/input-date': patch
'@lion/input-datepicker': patch
'@lion/input': patch
'@lion/select-rich': patch
'@lion/select': patch
---
fix: expose members as protected for extension compat. till v1

View file

@ -240,8 +240,10 @@ export class LionButton extends DisabledWithTabIndexMixin(SlotMixin(LitElement))
* of the form, and firing click on this button. This will fire the form submit * of the form, and firing click on this button. This will fire the form submit
* without side effects caused by the click bubbling back up to lion-button. * without side effects caused by the click bubbling back up to lion-button.
* @param {Event} ev * @param {Event} ev
* @private * @protected
* @returns {Promise<void>}
*/ */
// TODO: rename to _clickDelegationHandler in v1
async __clickDelegationHandler(ev) { async __clickDelegationHandler(ev) {
// Wait for updateComplete if form is not yet available // Wait for updateComplete if form is not yet available
if (!this._form) { if (!this._form) {

View file

@ -466,8 +466,9 @@ export class LionCalendar extends LocalizeMixin(LitElement) {
* @param {string} type * @param {string} type
* @param {string} previousMonth * @param {string} previousMonth
* @param {number} previousYear * @param {number} previousYear
* @private * @protected
*/ */
// TODO: rename to _previousButtonTemplate in v1. Also see: https://github.com/ing-bank/lion/discussions/591
__renderPreviousButton(type, previousMonth, previousYear) { __renderPreviousButton(type, previousMonth, previousYear) {
const { disabled, month } = this.__getPreviousDisabled(type, previousMonth, previousYear); const { disabled, month } = this.__getPreviousDisabled(type, previousMonth, previousYear);
const previousButtonTitle = this.__getNavigationLabel('previous', type, month, previousYear); const previousButtonTitle = this.__getNavigationLabel('previous', type, month, previousYear);
@ -496,8 +497,9 @@ export class LionCalendar extends LocalizeMixin(LitElement) {
* @param {string} type * @param {string} type
* @param {string} nextMonth * @param {string} nextMonth
* @param {number} nextYear * @param {number} nextYear
* @private * @protected
*/ */
// TODO: rename to _nextButtonTemplate in v1. Also see: https://github.com/ing-bank/lion/discussions/591
__renderNextButton(type, nextMonth, nextYear) { __renderNextButton(type, nextMonth, nextYear) {
const { disabled, month } = this.__getNextDisabled(type, nextMonth, nextYear); const { disabled, month } = this.__getNextDisabled(type, nextMonth, nextYear);
const nextButtonTitle = this.__getNavigationLabel('next', type, month, nextYear); const nextButtonTitle = this.__getNavigationLabel('next', type, month, nextYear);

View file

@ -219,12 +219,12 @@ const FormatMixinImplementation = superclass =>
/** @type {?} */ /** @type {?} */
this.modelValue = this.deserializer(this.serializedValue); this.modelValue = this.deserializer(this.serializedValue);
} else if (source === 'formatted') { } else if (source === 'formatted') {
this.modelValue = this.__callParser(); this.modelValue = this._callParser();
} }
} }
if (source !== 'formatted') { if (source !== 'formatted') {
/** @type {string} */ /** @type {string} */
this.formattedValue = this.__callFormatter(); this.formattedValue = this._callFormatter();
} }
if (source !== 'serialized') { if (source !== 'serialized') {
/** @type {string} */ /** @type {string} */
@ -239,7 +239,7 @@ const FormatMixinImplementation = superclass =>
* @return {?} * @return {?}
* @private * @private
*/ */
__callParser(value = this.formattedValue) { _callParser(value = this.formattedValue) {
// A) check if we need to parse at all // A) check if we need to parse at all
// A.1) The end user had no intention to parse // A.1) The end user had no intention to parse
@ -277,7 +277,7 @@ const FormatMixinImplementation = superclass =>
* @returns {string|undefined} * @returns {string|undefined}
* @private * @private
*/ */
__callFormatter() { _callFormatter() {
// - Why check for this.hasError? // - Why check for this.hasError?
// We only want to format values that are considered valid. For best UX, // We only want to format values that are considered valid. For best UX,
// we only 'reward' valid inputs. // we only 'reward' valid inputs.
@ -350,7 +350,7 @@ const FormatMixinImplementation = superclass =>
if (!this.__isHandlingComposition) { if (!this.__isHandlingComposition) {
this.value = this.preprocessor(this.value); this.value = this.preprocessor(this.value);
} }
this.modelValue = this.__callParser(this.value); this.modelValue = this._callParser(this.value);
} }
/** /**

View file

@ -27,10 +27,10 @@ export declare class FormatHost {
protected _reflectBackOn(): boolean; protected _reflectBackOn(): boolean;
protected _proxyInputEvent(): void; protected _proxyInputEvent(): void;
protected _onUserInputChanged(): void; protected _onUserInputChanged(): void;
protected _callParser(value: string | undefined): object;
protected _callFormatter(): string;
private __preventRecursiveTrigger: boolean; private __preventRecursiveTrigger: boolean;
private __callParser(value: string | undefined): object;
private __callFormatter(): string;
} }
export declare function FormatImplementation<T extends Constructor<LitElement>>( export declare function FormatImplementation<T extends Constructor<LitElement>>(

View file

@ -10,8 +10,6 @@ import { parseAmount } from './parsers.js';
* *
* @customElement lion-input-amount * @customElement lion-input-amount
*/ */
// TODO: make __callParser protected => _callParser
// @ts-ignore [allow-private]: __callParser
export class LionInputAmount extends LocalizeMixin(LionInput) { export class LionInputAmount extends LocalizeMixin(LionInput) {
/** @type {any} */ /** @type {any} */
static get properties() { static get properties() {
@ -104,15 +102,15 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
/** /**
* @override of FormatMixin * @override of FormatMixin
* @private * @protected
*/ */
__callParser(value = this.formattedValue) { _callParser(value = this.formattedValue) {
// TODO: (@daKmor) input and change events both trigger parsing therefore we need to handle the second parse // TODO: (@daKmor) input and change events both trigger parsing therefore we need to handle the second parse
this.__parserCallcountSincePaste += 1; this.__parserCallcountSincePaste += 1;
this.__isPasting = this.__parserCallcountSincePaste === 2; this.__isPasting = this.__parserCallcountSincePaste === 2;
this.formatOptions.mode = this.__isPasting === true ? 'pasted' : 'auto'; this.formatOptions.mode = this.__isPasting === true ? 'pasted' : 'auto';
// @ts-ignore [allow-private] // @ts-ignore [allow-protected]
return super.__callParser(value); return super._callParser(value);
} }
/** /**

View file

@ -157,10 +157,17 @@ export class LionInputDatepicker extends ScopedElementsMixin(
]; ];
} }
/**
* @protected
*/
get _invokerNode() { get _invokerNode() {
return /** @type {HTMLElement} */ (this.querySelector(`#${this.__invokerId}`)); return /** @type {HTMLElement} */ (this.querySelector(`#${this.__invokerId}`));
} }
/**
* @type {LionCalendar}
* @protected
*/
get _calendarNode() { get _calendarNode() {
return /** @type {LionCalendar} */ (this._overlayCtrl.contentNode.querySelector( return /** @type {LionCalendar} */ (this._overlayCtrl.contentNode.querySelector(
'[slot="content"]', '[slot="content"]',

View file

@ -44,6 +44,7 @@ export class DatepickerInputObject {
*/ */
get invokerEl() { get invokerEl() {
// @ts-ignore [allow-protected] in test
return this.el._invokerNode; return this.el._invokerNode;
} }
@ -63,6 +64,7 @@ export class DatepickerInputObject {
} }
get calendarEl() { get calendarEl() {
// @ts-ignore [allow-protected] in test
return /** @type {import('@lion/calendar').LionCalendar} */ (this.el && this.el._calendarNode); return /** @type {import('@lion/calendar').LionCalendar} */ (this.el && this.el._calendarNode);
} }

View file

@ -462,8 +462,9 @@ export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(L
/** /**
* @param {KeyboardEvent} ev * @param {KeyboardEvent} ev
* @private * @protected
*/ */
// TODO: rename to _onKeyUp in v1
__onKeyUp(ev) { __onKeyUp(ev) {
if (this.disabled) { if (this.disabled) {
return; return;