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

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

The newest version!
{"version":3,"file":"DateRangePicker.js","sourceRoot":"","sources":["../src/DateRangePicker.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,OAAO,YAAY,MAAM,4DAA4D,CAAC;AACtF,OAAO,YAAY,MAAM,4DAA4D,CAAC;AACtF,OAAO,oBAAoB,MAAM,oEAAoE,CAAC;AACtG,OAAO,EACN,qBAAqB,EACrB,uCAAuC,GACvC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,uBAAuB,MAAM,sDAAsD,CAAC;AAE3F,SAAS;AACT,OAAO,kBAAkB,MAAM,2CAA2C,CAAC;AAC3E,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,mBAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAQvD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAOH,IAAM,eAAe,uBAArB,MAAM,eAAgB,SAAQ,UAAU;IAmBvC,IAAI,kBAAkB;QACrB,MAAM,MAAM,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE7E,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE;YAC/B,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;YAEhC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACvC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IA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e,CAqUpB;AAED,eAAe,CAAC,MAAM,EAAE,CAAC;AAEzB,eAAe,eAAe,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport { renderFinished } from \"@ui5/webcomponents-base/dist/Render.js\";\nimport type { IFormInputElement } from \"@ui5/webcomponents-base/dist/features/InputElementsFormSupport.js\";\nimport CalendarDate from \"@ui5/webcomponents-localization/dist/dates/CalendarDate.js\";\nimport modifyDateBy from \"@ui5/webcomponents-localization/dist/dates/modifyDateBy.js\";\nimport getTodayUTCTimestamp from \"@ui5/webcomponents-localization/dist/dates/getTodayUTCTimestamp.js\";\nimport {\n\tDATERANGE_DESCRIPTION,\n\tDATERANGEPICKER_POPOVER_ACCESSIBLE_NAME,\n} from \"./generated/i18n/i18n-defaults.js\";\nimport DateRangePickerTemplate from \"./generated/templates/DateRangePickerTemplate.lit.js\";\n\n// Styles\nimport DateRangePickerCss from \"./generated/themes/DateRangePicker.css.js\";\nimport DatePicker from \"./DatePicker.js\";\nimport CalendarPickersMode from \"./types/CalendarPickersMode.js\";\nimport CalendarDateRange from \"./CalendarDateRange.js\";\n\nimport type {\n\tDatePickerChangeEventDetail as DateRangePickerChangeEventDetail,\n\tDatePickerInputEventDetail as DateRangePickerInputEventDetail,\n} from \"./DatePicker.js\";\nimport type { CalendarSelectionChangeEventDetail } from \"./Calendar.js\";\n\nconst DEFAULT_DELIMITER = \"-\";\n\n/**\n * @class\n *\n * ### Overview\n * The DateRangePicker enables the users to enter a localized date range using touch, mouse, keyboard input, or by selecting a date range in the calendar.\n *\n * ### Usage\n * The user can enter a date by:\n * Using the calendar that opens in a popup or typing it in directly in the input field (not available for mobile devices).\n * For the `ui5-daterange-picker`\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/DateRangePicker.js\";`\n *\n * ### Keyboard Handling\n * The `ui5-daterange-picker` provides advanced keyboard handling.\n *\n * When the `ui5-daterange-picker` input field is focused the user can\n * increment or decrement respectively the range start or end date, depending on where the cursor is.\n * The following shortcuts are available:\n *\n * - [Page Down] - Decrements the corresponding day of the month by one\n * - [Shift] + [Page Down] - Decrements the corresponding month by one\n * - [Shift] + [Ctrl] + [Page Down] - Decrements the corresponding year by one\n * - [Page Up] - Increments the corresponding day of the month by one\n * - [Shift] + [Page Up] - Increments the corresponding month by one\n * - [Shift] + [Ctrl] + [Page Up] - Increments the corresponding year by one\n * @constructor\n * @extends DatePicker\n * @since 1.0.0-rc.8\n * @public\n */\n@customElement({\n\ttag: \"ui5-daterange-picker\",\n\tstyles: [DatePicker.styles, DateRangePickerCss],\n\ttemplate: DateRangePickerTemplate,\n\tdependencies: [...DatePicker.dependencies, CalendarDateRange],\n})\nclass DateRangePicker extends DatePicker implements IFormInputElement {\n\t /**\n\t * Determines the symbol which separates the dates.\n\t * If not supplied, the default time interval delimiter for the current locale will be used.\n\t * @default \"-\"\n\t * @public\n\t */\n\t@property()\n\tdelimiter = \"-\";\n\n\t /**\n\t * The first date in the range during selection (this is a temporary value, not the first date in the value range)\n\t * @private\n\t */\n\t@property()\n\t_tempValue?: string;\n\n\tprivate _prevDelimiter: string | null;\n\n\tget formFormattedValue() {\n\t\tconst values = this._splitValueByDelimiter(this.value || \"\").filter(Boolean);\n\n\t\tif (values.length && this.name) {\n\t\t\tconst formData = new FormData();\n\n\t\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\t\tformData.append(this.name, values[i]);\n\t\t\t}\n\n\t\t\treturn formData;\n\t\t}\n\n\t\treturn this.value;\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._prevDelimiter = null;\n\t}\n\n\t/**\n\t * **Note:** The getter method is inherited and not supported. If called it will return an empty value.\n\t * @public\n\t * @default null\n\t */\n\tget dateValue(): Date | null {\n\t\treturn null;\n\t}\n\n\t/**\n\t * **Note:** The getter method is inherited and not supported. If called it will return an empty value.\n\t * @public\n\t * @default null\n\t */\n\tget dateValueUTC(): Date | null {\n\t\treturn null;\n\t}\n\n\tget _startDateTimestamp() {\n\t\treturn this._extractFirstTimestamp(this.value);\n\t}\n\n\tget _endDateTimestamp() {\n\t\treturn this._extractLastTimestamp(this.value);\n\t}\n\n\tget _tempTimestamp() {\n\t\treturn this._tempValue && (this.getFormat().parse(this._tempValue, true) as Date).getTime() / 1000;\n\t}\n\n\t/**\n\t * Required by DatePicker.js\n\t * @override\n\t */\n\tget _calendarSelectionMode() {\n\t\treturn \"Range\";\n\t}\n\n\t/**\n\t * Required by DatePicker.js - set the calendar focus on the first selected date (or today if not set)\n\t * @override\n\t */\n\tget _calendarTimestamp() {\n\t\treturn this._tempTimestamp || this._startDateTimestamp || getTodayUTCTimestamp(this._primaryCalendarType);\n\t}\n\n\t/**\n\t * Required by DatePicker.js\n\t * @override\n\t */\n\tget _calendarSelectedDates() {\n\t\tif (this._tempValue) {\n\t\t\treturn [this._tempValue];\n\t\t}\n\t\tif (this.value && this._checkValueValidity(this.value)) {\n\t\t\treturn this._splitValueByDelimiter(this.value);\n\t\t}\n\t\treturn [];\n\t}\n\n\t/**\n\t * Returns the start date of the currently selected range as JavaScript Date instance.\n\t * @public\n\t * @default null\n\t */\n\tget startDateValue(): Date | null {\n\t\treturn CalendarDate.fromTimestamp(this._startDateTimestamp! * 1000).toLocalJSDate();\n\t}\n\n\t/**\n\t * Returns the end date of the currently selected range as JavaScript Date instance.\n\t * @public\n\t * @default null\n\t */\n\tget endDateValue(): Date | null {\n\t\treturn CalendarDate.fromTimestamp(this._endDateTimestamp! * 1000).toLocalJSDate();\n\t}\n\n\tget startValue(): string {\n\t\treturn this._calendarSelectedDates[0] || \"\";\n\t}\n\n\tget endValue(): string {\n\t\treturn this._calendarSelectedDates[1] || \"\";\n\t}\n\n\t/**\n\t * @override\n\t */\n\tget _placeholder() {\n\t\treturn this.placeholder !== undefined ? this.placeholder : `${this._displayFormat} ${this._effectiveDelimiter} ${this._displayFormat}`;\n\t}\n\n\t/**\n\t * @override\n\t */\n\tget dateAriaDescription() {\n\t\treturn DateRangePicker.i18nBundle.getText(DATERANGE_DESCRIPTION);\n\t}\n\n\t/**\n\t * @override\n\t */\n\tget pickerAccessibleName() {\n\t\treturn DateRangePicker.i18nBundle.getText(DATERANGEPICKER_POPOVER_ACCESSIBLE_NAME);\n\t}\n\n\t/**\n\t * @override\n\t */\n\tasync _onInputSubmit() {\n\t\tconst input = this._getInput();\n\t\tconst caretPos = input.getCaretPosition();\n\t\tawait renderFinished();\n\t\tinput.setCaretPosition(caretPos); // Return the caret on the previous position after rendering\n\t}\n\n\t/**\n\t * @override\n\t */\n\t onResponsivePopoverAfterClose() {\n\t\tthis._tempValue = \"\"; // reset _tempValue on popover close\n\t\tsuper.onResponsivePopoverAfterClose();\n\t}\n\n\t/**\n\t * @override\n\t */\n\tisValid(value: string): boolean {\n\t\tconst parts = this._splitValueByDelimiter(value);\n\t\treturn parts.length <= 2 && parts.every(dateString => super.isValid(dateString)); // must be at most 2 dates and each must be valid\n\t}\n\n\t/**\n\t * @override\n\t */\n\tisInValidRange(value: string): boolean {\n\t\treturn this._splitValueByDelimiter(value).every(dateString => super.isInValidRange(dateString));\n\t}\n\n\t/**\n\t * Extract both dates as timestamps, flip if necessary, and build (which will use the desired format so we enforce the format too)\n\t * @override\n\t */\n\tnormalizeValue(value: string) {\n\t\tconst firstDateTimestamp = this._extractFirstTimestamp(value);\n\t\tconst lastDateTimestamp = this._extractLastTimestamp(value);\n\t\tif (firstDateTimestamp && lastDateTimestamp && firstDateTimestamp > lastDateTimestamp) { // if both are timestamps (not undefined), flip if necessary\n\t\t\treturn this._buildValue(lastDateTimestamp, firstDateTimestamp);\n\t\t}\n\t\treturn this._buildValue(firstDateTimestamp, lastDateTimestamp);\n\t}\n\n\t/**\n\t * @override\n\t */\n\tonSelectedDatesChange(event: CustomEvent) {\n\t\tevent.preventDefault(); // never let the calendar update its own dates, the parent component controls them\n\t\tconst values = event.detail.selectedValues;\n\n\t\tif (values.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (values.length === 1) { // Do nothing until the user selects 2 dates, we don't change any state at all for one date\n\t\t\tthis._tempValue = values[0];\n\t\t\treturn;\n\t\t}\n\t\tconst newValue = this._buildValue(event.detail.selectedDates[0], event.detail.selectedDates[1]); // the value will be normalized so we don't need to order them here\n\t\tthis._updateValueAndFireEvents(newValue, true, [\"change\", \"value-changed\"]);\n\t\tthis._togglePicker();\n\t}\n\n\t/**\n\t * @override\n\t */\n\tasync _modifyDateValue(amount: number, unit: string, preserveDate?: boolean) {\n\t\tif (!this._endDateTimestamp) { // If empty or only one date -> treat as datepicker entirely\n\t\t\treturn super._modifyDateValue(amount, unit, preserveDate);\n\t\t}\n\n\t\tconst input = this._getInput();\n\t\tlet caretPos: number = input.getCaretPosition()!; // caret position is always number for input of type text;\n\t\tlet newValue: string;\n\n\t\tif (caretPos <= this.value.indexOf(this._effectiveDelimiter)) { // The user is focusing the first date -> change it and keep the second date\n\t\t\tconst startDateModified = modifyDateBy(CalendarDate.fromTimestamp(this._startDateTimestamp! * 1000), amount, unit, preserveDate, this._minDate, this._maxDate);\n\t\t\tconst newStartDateTimestamp = startDateModified.valueOf() / 1000;\n\t\t\tif (newStartDateTimestamp > this._endDateTimestamp) { // dates flipped -> move the caret to the same position but on the last date\n\t\t\t\tcaretPos += Math.ceil(this.value.length / 2);\n\t\t\t}\n\t\t\tnewValue = this._buildValue(newStartDateTimestamp, this._endDateTimestamp); // the value will be normalized so we don't try to order them here\n\t\t} else {\n\t\t\tconst endDateModified = modifyDateBy(CalendarDate.fromTimestamp(this._endDateTimestamp * 1000), amount, unit, preserveDate, this._minDate, this._maxDate);\n\t\t\tconst newEndDateTimestamp = endDateModified.valueOf() / 1000;\n\t\t\tnewValue = this._buildValue(this._startDateTimestamp, newEndDateTimestamp); // the value will be normalized so we don't try to order them here\n\t\t\tif (newEndDateTimestamp < this._startDateTimestamp!) { // dates flipped -> move the caret to the same position but on the first date\n\t\t\t\tcaretPos -= Math.ceil(this.value.length / 2);\n\t\t\t}\n\t\t}\n\t\tthis._updateValueAndFireEvents(newValue, true, [\"change\", \"value-changed\"]);\n\n\t\tawait renderFinished();\n\t\tinput.setCaretPosition(caretPos); // Return the caret to the previous (or the adjusted, if dates flipped) position after rendering\n\t}\n\n\tget _effectiveDelimiter(): string {\n\t\treturn this.delimiter || DEFAULT_DELIMITER;\n\t}\n\n\t_splitValueByDelimiter(value: string) {\n\t\tconst valuesArray: Array = [];\n\t\tconst partsArray = value.split(this._prevDelimiter || this._effectiveDelimiter);\n\n\t\t// if format successfully parse the value, the value contains only single date\n\t\tif (this.getFormat().parse(value)) {\n\t\t\tvaluesArray[0] = partsArray.join(this._effectiveDelimiter);\n\t\t\tvaluesArray[1] = \"\";\n\t\t} else {\n\t\t\tvaluesArray[0] = partsArray.slice(0, partsArray.length / 2).join(this._effectiveDelimiter);\n\t\t\tvaluesArray[1] = partsArray.slice(partsArray.length / 2).join(this._effectiveDelimiter);\n\t\t}\n\n\t\treturn valuesArray;\n\t}\n\n\t/**\n\t * Returns a UTC timestamp, representing the first date in the value string or undefined if the value is empty\n\t * @private\n\t */\n\t_extractFirstTimestamp(value: string) {\n\t\tif (!value || !this._checkValueValidity(value)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst dateStrings = this._splitValueByDelimiter(value); // at least one item guaranteed due to the checks above (non-empty and valid)\n\n\t\tconst parsedDate = this.getFormat().parse(dateStrings[0], true) as Date;\n\t\treturn parsedDate.getTime() / 1000;\n\t}\n\n\t/**\n\t * Returns a UTC timestamp, representing the last date in the value string or undefined if the value is empty or there is just one date\n\t * @private\n\t */\n\t_extractLastTimestamp(value: string) {\n\t\tif (!value || !this._checkValueValidity(value)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst dateStrings = this._splitValueByDelimiter(value);\n\t\tif (dateStrings[1]) {\n\t\t\tconst parsedDate = this.getFormat().parse(dateStrings[1], true) as Date;\n\t\t\treturn parsedDate.getTime() / 1000;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Builds a string value out of two UTC timestamps - this method is the counterpart to _extractFirstTimestamp/_extractLastTimestamp\n\t * @private\n\t */\n\t_buildValue(firstDateTimestamp: number | undefined, lastDateTimestamp: number | undefined) {\n\t\tthis._prevDelimiter = this._effectiveDelimiter;\n\t\tif (firstDateTimestamp) {\n\t\t\tconst firstDateString = this._getStringFromTimestamp(firstDateTimestamp * 1000);\n\n\t\t\tif (!lastDateTimestamp) {\n\t\t\t\treturn firstDateString;\n\t\t\t}\n\n\t\t\tconst lastDateString = this._getStringFromTimestamp(lastDateTimestamp * 1000);\n\t\t\treturn `${firstDateString} ${this._effectiveDelimiter} ${lastDateString}`;\n\t\t}\n\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * @override\n\t */\n\tget _calendarPickersMode() {\n\t\treturn CalendarPickersMode.DAY_MONTH_YEAR;\n\t}\n}\n\nDateRangePicker.define();\n\nexport default DateRangePicker;\nexport type {\n\tDateRangePickerChangeEventDetail,\n\tDateRangePickerInputEventDetail,\n};\n"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy