From c67805e4fec910ab451bfb8fb2accb270dd2c0ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20Maanp=C3=A4=C3=A4?= Date: Fri, 29 May 2020 11:01:50 +0300 Subject: [PATCH] Mark private and protected explicitly --- src/vaadin-time-picker.html | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/vaadin-time-picker.html b/src/vaadin-time-picker.html index 34be234..600101a 100644 --- a/src/vaadin-time-picker.html +++ b/src/vaadin-time-picker.html @@ -299,6 +299,7 @@ */ autoOpenDisabled: Boolean, + /** @private */ __dropdownItems: { type: Array }, @@ -383,6 +384,7 @@ ]; } + /** @protected */ ready() { super.ready(); @@ -407,11 +409,13 @@ }); } + /** @private */ __validDayDivisor(step) { // valid if undefined, or exact divides a day, or has millisecond resolution return !step || 24 * 3600 % step === 0 || (step < 1 && step % 1 * 1000 % 1 === 0); } + /** @private */ __onKeyDown(e) { if (this.readonly || this.disabled || this.__dropdownItems.length) { @@ -427,7 +431,7 @@ } } - + /** @private */ __onArrowPressWithStep(step) { const objWithStep = this.__addStep(this.__getMsec(this.__memoValue), step, true); this.__memoValue = objWithStep; @@ -435,12 +439,14 @@ this.__dispatchChange(); } + /** @private */ __dispatchChange() { this.dispatchEvent(new CustomEvent('change', {bubbles: true})); } /** * Returning milliseconds from Object in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }` + * @private */ __getMsec(obj) { let result = (obj && obj.hours || 0) * 60 * 60 * 1000; @@ -453,6 +459,7 @@ /** * Returning seconds from Object in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }` + * @private */ __getSec(obj) { let result = (obj && obj.hours || 0) * 60 * 60; @@ -467,6 +474,7 @@ * Returning Object in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }` * from the result of adding step value in milliseconds to the milliseconds amount. * With `precision` parameter rounding the value to the closest step valid interval. + * @private */ __addStep(msec, step, precision) { // If the time is `00:00` and step changes value downwards, it should be considered as `24:00` @@ -494,6 +502,7 @@ return {hours: (hh < 24) ? hh : 0, minutes: mm, seconds: ss, milliseconds: msec}; } + /** @private */ __updateDropdownItems(i8n, min, max, step) { const minTimeObj = this.__validateTime(this.__parseISO(min)); const minSec = this.__getSec(minTimeObj); @@ -516,6 +525,7 @@ } } + /** @private */ __generateDropdownList(minSec, maxSec, step) { if (step < 15 * 60 || !this.__validDayDivisor(step)) { return []; @@ -537,6 +547,7 @@ return generatedList; } + /** @private */ __adjustValue(minSec, maxSec, minTimeObj, maxTimeObj) { // Do not change the value if it is empty if (!this.__memoValue) { @@ -552,6 +563,7 @@ } } + /** @private */ __valueChanged(value, oldValue) { const parsedObj = this.__memoValue = this.__parseISO(value); const newValue = this.__formatISO(parsedObj) || ''; @@ -565,6 +577,7 @@ } } + /** @private */ __onInputChange(e) { const parsedObj = this.i18n.parseTime(this.__dropdownElement.value); const newValue = this.i18n.formatTime(parsedObj) || ''; @@ -580,16 +593,19 @@ } } + /** @private */ __updateValue(obj) { const timeString = this.__formatISO(this.__validateTime(obj)) || ''; this.value = timeString; } + /** @private */ __updateInputValue(obj) { const timeString = this.i18n.formatTime(this.__validateTime(obj)) || ''; this.__dropdownElement.value = timeString; } + /** @private */ __validateTime(timeObject) { if (timeObject) { timeObject.hours = parseInt(timeObject.hours); @@ -600,6 +616,7 @@ return timeObject; } + /** @private */ get __stepSegment() { if (this.step % 3600 === 0) { // Accept hours @@ -616,11 +633,13 @@ } } + /** @private */ __formatISO(time) { // The default i18n formatter implementation is ISO 8601 compliant return TimePickerElement.properties.i18n.value().formatTime(time); } + /** @private */ __parseISO(text) { // The default i18n parser implementation is ISO 8601 compliant return TimePickerElement.properties.i18n.value().parseTime(text); @@ -631,10 +650,12 @@ return this.shadowRoot.querySelector('vaadin-time-picker-text-field'); } + /** @private */ get __inputElement() { return this.__memoInput || (this.__memoInput = this._getInputElement()); } + /** @private */ get __dropdownElement() { return this.__memoDropdown || (this.__memoDropdown = this.shadowRoot.querySelector('vaadin-combo-box-light'));