All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.TimeSelectionInputs.js.map Maven / Gradle / Ivy

The newest version!
{"version":3,"file":"TimeSelectionInputs.js","sourceRoot":"","sources":["../src/TimeSelectionInputs.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAE3E,OAAO,qEAAqE,CAAC,CAAC,gCAAgC;AAC9G,OAAO,EACN,OAAO,EACP,QAAQ,GACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EACN,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,GAC/B,MAAM,mCAAmC,CAAC;AAE3C,WAAW;AACX,OAAO,2BAA2B,MAAM,0DAA0D,CAAC;AAEnG,SAAS;AACT,OAAO,sBAAsB,MAAM,+CAA+C,CAAC;AAEnF;;;;;;;;;;;;;;;;GAgBG;AAYH,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,mBAAmB;IAArD;;QAEC,iBAAY,GAAG,CAAC,CAAC,CAAC;IAsRnB,CAAC;IAjRA,IAAI,eAAe;QAClB,OAAO,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,iBAAiB;QACpB,OAAO,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,iBAAiB;QACpB,OAAO,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,WAAW;QACd,OAAO,SAAS,CA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,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAE7D,IAAI,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE;YACtD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;YACtC,IAAI,CAAC,iBAAiB,GAAG,WAAW,CAAC;YACrC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC;SACnC;IACF,CAAC;CACD,CAAA;AAtRA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDACT;AAGlB;IADC,QAAQ,EAAE;8DACgB;AALtB,mBAAmB;IAXxB,aAAa,CAAC;QACd,GAAG,EAAE,2BAA2B;QAChC,MAAM,EAAE,sBAAsB;QAC9B,QAAQ,EAAE,2BAA2B;QACrC,YAAY,EAAE;YACb,KAAK;YACL,eAAe;YACf,mBAAmB;SACnB;KACD,CAAC;GAEI,mBAAmB,CAwRxB;AAED,mBAAmB,CAAC,MAAM,EAAE,CAAC;AAE7B,eAAe,mBAAmB,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\n\nimport \"@ui5/webcomponents-localization/dist/features/calendar/Gregorian.js\"; // default calendar for bundling\nimport {\n\tisEnter,\n\tisNumber,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport TimePickerInternals from \"./TimePickerInternals.js\";\nimport Input from \"./Input.js\";\nimport SegmentedButton from \"./SegmentedButton.js\";\nimport SegmentedButtonItem from \"./SegmentedButtonItem.js\";\n\nimport InputType from \"./types/InputType.js\";\n\nimport {\n\tTIMEPICKER_INPUTS_ENTER_HOURS,\n\tTIMEPICKER_INPUTS_ENTER_MINUTES,\n\tTIMEPICKER_INPUTS_ENTER_SECONDS,\n} from \"./generated/i18n/i18n-defaults.js\";\n\n// Template\nimport TimeSelectionInputsTemplate from \"./generated/templates/TimeSelectionInputsTemplate.lit.js\";\n\n// Styles\nimport TimeSelectionInputsCss from \"./generated/themes/TimeSelectionInputs.css.js\";\n\n/**\n * @class\n *\n * ### Overview\n *\n * `ui5-time-selection-inputs` displays a popover with `ui5-input` components of type=\"number\" and an\n * optional a AM/PM `ui5-segmented-button` according to the display format given to the `ui5-time-picker`.\n * Using of numeric input components enables display of mobile devices' native numeric keyboard, which speeds up entering of the time.\n * The popup appears only on mobile devices when there is a tap on the `ui5-time-picker` input.\n *\n * This component should not be used separately.\n * @constructor\n * @extends TimePickerInternals\n * @abstract\n * @since 1.18.0\n * @private\n */\n@customElement({\n\ttag: \"ui5-time-selection-inputs\",\n\tstyles: TimeSelectionInputsCss,\n\ttemplate: TimeSelectionInputsTemplate,\n\tdependencies: [\n\t\tInput,\n\t\tSegmentedButton,\n\t\tSegmentedButtonItem,\n\t],\n})\n\nclass TimeSelectionInputs extends TimePickerInternals {\n\t@property({ type: Number })\n\t_editedInput = -1;\n\n\t@property()\n\t_editedInputValue?: string;\n\n\tget enterHoursLabel() {\n\t\treturn TimePickerInternals.i18nBundle.getText(TIMEPICKER_INPUTS_ENTER_HOURS);\n\t}\n\n\tget enterMinutesLabel() {\n\t\treturn TimePickerInternals.i18nBundle.getText(TIMEPICKER_INPUTS_ENTER_MINUTES);\n\t}\n\n\tget enterSecondsLabel() {\n\t\treturn TimePickerInternals.i18nBundle.getText(TIMEPICKER_INPUTS_ENTER_SECONDS);\n\t}\n\n\tget _numberType() {\n\t\treturn InputType.Number;\n\t}\n\n\tget _isHoursInput() {\n\t\tconst key = this._componentKey(\"hours\");\n\t\treturn this._componentMap[key] === this._activeIndex;\n\t}\n\n\tget _is24HoursFormat() {\n\t\treturn this.formatPattern?.includes(\"HH\") || this.formatPattern?.includes(\"H\");\n\t}\n\n\tonBeforeRendering() {\n\t\tthis._createComponents();\n\t}\n\n\t_addNumericAttributes() {\n\t\tthis._entities.forEach((item, index) => {\n\t\t\tconst input = this._inputComponent(index);\n\t\t\tif (input) {\n\t\t\t\tconst innerInput = this._innerInput(input)!;\n\t\t\t\tinnerInput.setAttribute(\"autocomplete\", \"off\");\n\t\t\t\tinnerInput.setAttribute(\"pattern\", \"[0-9]*\");\n\t\t\t\tinnerInput.setAttribute(\"inputmode\", \"numeric\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Returns Input component by index or name.\n\t * @param indexOrName the index or name of the component\n\t * @returns component (if exists) or undefined\n\t */\n\t_inputComponent(indexOrName: number | string): Input | undefined | null {\n\t\tconst index = typeof indexOrName === \"string\" ? this._indexFromName(indexOrName) : indexOrName;\n\t\tconst entity = this._entities[index].entity;\n\t\treturn entity ? this.shadowRoot?.querySelector(`#${this._id}_input_${entity}`) : undefined;\n\t}\n\n\t/**\n\t * Returns the inner input element DOM reference.\n\t * @param input the Input component\n\t * @returns inner input element\n\t */\n\t_innerInput(input: Input): HTMLInputElement | null {\n\t\treturn input && input.getInputDOMRefSync();\n\t}\n\n\t/**\n\t * Creates clock and button components according to the display format pattern.\n\t */\n\t_createComponents() {\n\t\tlet value;\n\n\t\tthis._entities = [];\n\t\tthis._periods = [];\n\t\tthis._componentMap = {\n\t\t\thours: -1,\n\t\t\tminutes: -1,\n\t\t\tseconds: -1,\n\t\t};\n\t\tif (this._hasHoursComponent) {\n\t\t\t// add Hours input\n\t\t\tthis._componentMap.hours = this._entities.length;\n\t\t\tvalue = parseInt(this._hours);\n\t\t\tthis._entities.push({\n\t\t\t\t\"entity\": \"hours\",\n\t\t\t\t\"label\": this.enterHoursLabel,\n\t\t\t\t\"value\": value,\n\t\t\t\t\"stringValue\": this._editedInput === this._entities.length ? this._editedInputValue : this._formatNumberToString(value, this._zeroPaddedHours),\n\t\t\t\t\"hasSeparator\": this._entities.length > 0,\n\t\t\t\t\"prependZero\": this._zeroPaddedHours,\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"min\": this._hoursConfiguration.minHour,\n\t\t\t\t\t\"max\": this._hoursConfiguration.maxHour,\n\t\t\t\t\t\"step\": 1,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tif (this._hasMinutesComponent) {\n\t\t\t// add Minutes clock\n\t\t\tthis._componentMap.minutes = this._entities.length;\n\t\t\tvalue = parseInt(this._minutes);\n\t\t\tthis._entities.push({\n\t\t\t\t\"entity\": \"minutes\",\n\t\t\t\t\"label\": this.enterMinutesLabel,\n\t\t\t\t\"value\": value,\n\t\t\t\t\"stringValue\": this._editedInput === this._entities.length ? this._editedInputValue : this._formatNumberToString(value, true),\n\t\t\t\t\"hasSeparator\": this._entities.length > 0,\n\t\t\t\t\"prependZero\": true,\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"min\": 0,\n\t\t\t\t\t\"max\": 59,\n\t\t\t\t\t\"step\": 1,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tif (this._hasSecondsComponent) {\n\t\t\t// add Seconds clock\n\t\t\tthis._componentMap.seconds = this._entities.length;\n\t\t\tvalue = parseInt(this._seconds);\n\t\t\tthis._entities.push({\n\t\t\t\t\"entity\": \"seconds\",\n\t\t\t\t\"label\": this.enterSecondsLabel,\n\t\t\t\t\"value\": value,\n\t\t\t\t\"stringValue\": this._editedInput === this._entities.length ? this._editedInputValue : this._formatNumberToString(value, true),\n\t\t\t\t\"hasSeparator\": this._entities.length > 0,\n\t\t\t\t\"prependZero\": true,\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"min\": 0,\n\t\t\t\t\t\"max\": 59,\n\t\t\t\t\t\"step\": 1,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tthis._createPeriodComponent();\n\t}\n\n\t/**\n\t * Switches to the specific input.\n\t * @param index the index (in _entities array) of the input\n\t * @private\n\t */\n\t_switchInput(index: number) {\n\t\tif (index >= this._entities.length) {\n\t\t\tindex = 0;\n\t\t}\n\t\tthis._inputComponent(index)!.focus();\n\t}\n\n\t/**\n\t * Switches to the next input that can de focused.\n\t * @param wrapAround whether to start with first clock after reaching the last one, or not\n\t * @private\n\t */\n\t_switchNextInput(wrapAround = false) {\n\t\tlet activeInput = this._activeIndex;\n\t\tconst startActiveInput = activeInput;\n\n\t\tif (!this._entities.length) {\n\t\t\treturn;\n\t\t}\n\t\tdo {\n\t\t\tactiveInput++;\n\t\t\tif (activeInput >= this._entities.length) {\n\t\t\t\tactiveInput = wrapAround ? 0 : this._entities.length - 1;\n\t\t\t}\n\t\t// false-positive finding of no-unmodified-loop-condition rule\n\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t} while (this._inputComponent(activeInput)!.disabled && activeInput !== startActiveInput && (wrapAround || activeInput < this._entities.length));\n\t\tif (activeInput !== startActiveInput && !this._inputComponent(activeInput)!.disabled) {\n\t\t\tthis._switchInput(activeInput);\n\t\t}\n\t}\n\n\t/**\n\t * Return a value as string, formatted and prepended with zero if necessary.\n\t * @param num A number to format\n\t * @param prependZero Whether to prepend with zero or not\n\t * @returns Formatted value\n\t * @private\n\t */\n\t_formatNumberToString(num: number, prependZero: boolean): string {\n\t\treturn num < 10 && prependZero ? `0${num}` : num.toString();\n\t}\n\n\t_onkeydown(evt: KeyboardEvent) {\n\t\tif (this._activeIndex === -1) {\n\t\t\treturn;\n\t\t}\n\t\tif (isEnter(evt)) {\n\t\t\t// Accept the time and close the popover\n\t\t\tthis.fireEvent(\"close-inputs\");\n\t\t} else if (isNumber(evt) && this._entities[this._activeIndex]) {\n\t\t\tconst char = evt.key;\n\t\t\tconst buffer = this._keyboardBuffer + char;\n\t\t\tconst bufferValue = parseInt(buffer);\n\n\t\t\tevt.preventDefault();\n\t\t\tthis._resetCooldown(true);\n\t\t\tif (bufferValue > this._entities[this._activeIndex].attributes!.max) {\n\t\t\t\t// value accumulated in the buffer (old entry + new entry) is greater than the input maximum value,\n\t\t\t\t// so assign old entry to the current inut and then switch to the next input, and add new entry as an old value\n\t\t\t\tthis._inputChange(parseInt(this._keyboardBuffer));\n\t\t\t\tthis._switchNextInput();\n\t\t\t\tthis._keyboardBuffer = char;\n\t\t\t\tthis._inputChange(parseInt(char));\n\t\t\t\tthis._resetCooldown(true);\n\t\t\t} else {\n\t\t\t\t// value is less than clock's max value, so add new entry to the buffer\n\t\t\t\tthis._keyboardBuffer = buffer;\n\t\t\t\tthis._inputChange(parseInt(this._keyboardBuffer));\n\t\t\t\tif (this._keyboardBuffer.length === 2 || parseInt(`${this._keyboardBuffer}0`) > this._entities[this._activeIndex].attributes!.max) {\n\t\t\t\t\t// if buffer length is 2, or buffer value + one more (any) number is greater than clock's max value\n\t\t\t\t\t// there is no place for more entry - just set buffer as a value, and switch to the next clock\n\t\t\t\t\tthis._resetCooldown(this._keyboardBuffer.length !== 2);\n\t\t\t\t\tthis._keyboardBuffer = \"\";\n\t\t\t\t\tthis._switchNextInput();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Input 'change' event handler.\n\t * @param value new value to set on active input\n\t */\n\t_inputChange(value: number) {\n\t\tconst stringValue = this._formatNumberToString(value, this._entities[this._activeIndex].prependZero);\n\n\t\tif (this._activeIndex === -1) {\n\t\t\treturn;\n\t\t}\n\t\tvalue = parseInt(stringValue);\n\t\tthis._entities[this._activeIndex].value = value;\n\t\tthis._inputComponent(this._activeIndex)!.value = this._formatNumberToString(value, this._entities[this._activeIndex].prependZero);\n\t\tswitch (this._activeIndex) {\n\t\tcase this._componentMap.hours:\n\t\t\tthis._hoursChange(value);\n\t\t\tbreak;\n\t\tcase this._componentMap.minutes:\n\t\t\tthis._minutesChange(value);\n\t\t\tbreak;\n\t\tcase this._componentMap.seconds:\n\t\t\tthis._secondsChange(value);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t_onfocusin(e: FocusEvent) {\n\t\tconst input = e.target as Input;\n\t\tconst innerInput = this._innerInput(input);\n\n\t\tthis._editedInput = -1;\n\t\tinnerInput!.select();\n\t\tthis._activeIndex = this._getIndexFromId(input.id);\n\t}\n\n\t_onfocusout() {\n\t\tlet value = this._inputComponent(this._activeIndex)!.value === \"\" ? 0 : this._entities[this._activeIndex].value;\n\n\t\tthis._editedInput = -1;\n\t\tif (this._isHoursInput && !this._is24HoursFormat && value === 0) {\n\t\t\tvalue = 12;\n\t\t}\n\t\tthis._inputChange(value);\n\t\tthis._activeIndex = -1;\n\t}\n\n\t_oninput() {\n\t\tconst stringValue = this._inputComponent(this._activeIndex)!.value;\n\t\tconst value = stringValue === \"\" ? 0 : parseInt(stringValue);\n\n\t\tif (value !== this._entities[this._activeIndex].value) {\n\t\t\tthis._editedInput = this._activeIndex;\n\t\t\tthis._editedInputValue = stringValue;\n\t\t\tthis._inputChange(value);\n\t\t\tthis._keyboardBuffer = stringValue;\n\t\t}\n\t}\n}\n\nTimeSelectionInputs.define();\n\nexport default TimeSelectionInputs;\n"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy