@nova-design-system/nova-webcomponents 3.9.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/native.cjs.js +1 -1
- package/dist/cjs/nv-calendar.cjs.entry.js +9 -3
- package/dist/cjs/nv-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddate.cjs.entry.js +62 -94
- package/dist/cjs/nv-fielddate.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddaterange.cjs.entry.js +52 -33
- package/dist/cjs/nv-fielddaterange.cjs.entry.js.map +1 -1
- package/dist/collection/components/nv-calendar/nv-calendar.js +9 -3
- package/dist/collection/components/nv-calendar/nv-calendar.js.map +1 -1
- package/dist/collection/components/nv-fielddate/nv-fielddate.js +63 -94
- package/dist/collection/components/nv-fielddate/nv-fielddate.js.map +1 -1
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js +52 -33
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js.map +1 -1
- package/dist/components/nv-calendar.js +1 -1
- package/dist/components/nv-fielddate.js +66 -98
- package/dist/components/nv-fielddate.js.map +1 -1
- package/dist/components/nv-fielddaterange.js +54 -35
- package/dist/components/nv-fielddaterange.js.map +1 -1
- package/dist/components/{p-d32b75ac.js → p-82e5674c.js} +10 -4
- package/dist/components/p-82e5674c.js.map +1 -0
- package/dist/components/{p-91a558eb.js → p-f1df2634.js} +2 -2
- package/dist/components/{p-91a558eb.js.map → p-f1df2634.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/native.js +1 -1
- package/dist/esm/nv-calendar.entry.js +9 -3
- package/dist/esm/nv-calendar.entry.js.map +1 -1
- package/dist/esm/nv-fielddate.entry.js +62 -94
- package/dist/esm/nv-fielddate.entry.js.map +1 -1
- package/dist/esm/nv-fielddaterange.entry.js +52 -33
- package/dist/esm/nv-fielddaterange.entry.js.map +1 -1
- package/dist/native/native.esm.js +1 -1
- package/dist/native/native.esm.js.map +1 -1
- package/dist/native/{p-dc34da69.entry.js → p-4a533dd8.entry.js} +2 -2
- package/dist/native/p-4a533dd8.entry.js.map +1 -0
- package/dist/native/{p-f687e05c.entry.js → p-55cd3d62.entry.js} +2 -2
- package/dist/native/p-55cd3d62.entry.js.map +1 -0
- package/dist/native/{p-516da423.entry.js → p-9ea3d30d.entry.js} +2 -2
- package/dist/native/p-9ea3d30d.entry.js.map +1 -0
- package/dist/types/components/nv-fielddate/nv-fielddate.d.ts +4 -19
- package/dist/types/components/nv-fielddaterange/nv-fielddaterange.d.ts +1 -0
- package/hydrate/index.js +123 -131
- package/hydrate/index.mjs +123 -131
- package/package.json +1 -1
- package/dist/components/p-d32b75ac.js.map +0 -1
- package/dist/native/p-516da423.entry.js.map +0 -1
- package/dist/native/p-dc34da69.entry.js.map +0 -1
- package/dist/native/p-f687e05c.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nv-fielddaterange.js","sourceRoot":"","sources":["../../../src/components/nv-fielddaterange/nv-fielddaterange.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,IAAI,EACJ,KAAK,EACL,OAAO,EACP,KAAK,EAEL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAiBpC;;;;;;;;GAQG;AAMH,MAAM,OAAO,gBAAgB;IAL7B;QASU,cAAS,GAAW,MAAM,EAAE,CAAC;QAGrC,8EAA8E;QAC9E,oBAAoB;QAEpB;;;WAGG;QAEM,iBAAY,GAAW,MAAM,EAAE,CAAC;QAEzC;;;WAGG;QAEM,eAAU,GAAW,MAAM,EAAE,CAAC;QAsCvC;;WAEG;QAEM,aAAQ,GAAY,KAAK,CAAC;QA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,mBAAmB,IAChD,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CACrD,YAAM,IAAI,EAAC,mBAAmB,GAAQ,CACvC,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,gBAAgB,CACtB,CACG,CACP;YAED,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import {\n Component,\n h,\n Prop,\n State,\n Element,\n Event,\n EventEmitter,\n Listen,\n Host,\n Watch,\n Method,\n} from '@stencil/core';\nimport Inputmask from 'inputmask';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * Extends HTMLInputElement to include the inputmask property.\n */\ninterface HTMLInputElementWithInputmask extends HTMLInputElement {\n /**\n * The inputmask instance that provides masking functionality.\n */\n inputmask?: {\n /**\n * Removes the inputmask instance.\n */\n remove: () => void;\n };\n}\n\n/**\n * @slot default - Child content of the component.\n * @slot leading-input - Content to be placed before the input text, within the input container.\n * @slot before-input - Content to be placed before the input text, outside the input container.\n * @slot after-input - Content to be placed after the input text, outside the input container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fielddaterange',\n styleUrl: 'styles/nv-fielddaterange.scss',\n shadow: false,\n})\nexport class NvFielddaterange {\n @Element() el!: HTMLNvFielddaterangeElement;\n private popoverElement!: HTMLNvPopoverElement;\n private calendarElement!: HTMLNvCalendarElement;\n private popoverId: string = uuidv4();\n private contentRef?: HTMLDivElement;\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the start input element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated.\n */\n @Prop({ reflect: true })\n readonly startInputId: string = uuidv4();\n\n /**\n * Sets the ID for the end input element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated.\n */\n @Prop({ reflect: true })\n readonly endInputId: string = uuidv4();\n\n /**\n * Text displayed as label. A slot label can override this prop.\n */\n @Prop({ reflect: true })\n readonly label: string;\n\n /**\n * Description displayed below the input. A slot description can override this prop.\n */\n @Prop({ reflect: true })\n readonly description: string;\n\n /**\n * Placeholder for the start input field.\n */\n @Prop({ reflect: true })\n readonly startPlaceholder: string;\n\n /**\n * Placeholder for the end input field.\n */\n @Prop({ reflect: true })\n readonly endPlaceholder: string;\n\n /**\n * Name attribute for the start input.\n */\n @Prop({ reflect: true })\n readonly startName: string;\n\n /**\n * Name attribute for the end input.\n */\n @Prop({ reflect: true })\n readonly endName: string;\n\n /**\n * Disables both input fields.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Sets both input fields as read-only.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks both input fields as required.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Indicates an error state.\n */\n @Prop({ reflect: true })\n readonly error: boolean = false;\n\n /**\n * Error description. A slot error-description can override this prop.\n */\n @Prop({ reflect: true })\n readonly errorDescription?: string;\n\n /**\n * Indicates a success state.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * Autofocus the start input when the component is mounted.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n /**\n * The initial value of the date range (in string format).\n */\n // eslint-disable-next-line @stencil-community/strict-mutable\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * The current value of the start date in string format.\n */\n @State()\n startValue: string = '';\n\n /**\n * The current value of the end date in string format.\n */\n @State()\n endValue: string = '';\n\n /**\n * Controls the opening of the popover.\n */\n @State()\n open: boolean = false;\n\n /**\n * First day of the week 0 = Sunday, 1 = Monday, etc.\n * @default 1\n */\n @Prop({ reflect: true })\n readonly firstDayOfWeek: number = 1;\n\n /**\n * Number of calendars to display\n * @default 2\n */\n @Prop({ reflect: true })\n readonly numberOfCalendars: number = 2;\n\n /**\n * Minimum date for selection ISO string format, ex: 2025-01-01\n */\n @Prop({ reflect: true })\n readonly min?: string = '';\n\n /**\n * Maximum date for selection ISO string format, ex: 2025-12-31\n */\n @Prop({ reflect: true })\n readonly max?: string = '';\n\n /** Locale for date formatting\n * @default 'en-BE'\n */\n @Prop({ reflect: true })\n readonly locale: string = 'en-BE';\n\n /** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.\n * @default 'YYYY-MM-DD'\n */\n @Prop({ reflect: true })\n readonly dateFormat: string = 'YYYY-MM-DD';\n\n /**\n * Footer placement\n * @default 'bottom'\n */\n @Prop({ reflect: true })\n readonly shortcutsPlacement: 'bottom' | 'left' | 'right' = 'bottom';\n\n /**\n * Show action buttons\n * @default false\n */\n @Prop({ reflect: true })\n readonly showActions: boolean = false;\n\n /**\n * Custom actions to display in the footer\n */\n @Prop({ reflect: true })\n readonly shortcuts: HTMLNvCalendarElement['shortcuts'];\n\n /**\n * Show week numbers\n */\n @Prop({ reflect: true })\n readonly showWeekNumbers: boolean;\n\n /**\n * Disabled dates ISO string array\n */\n @Prop({ reflect: true })\n readonly disabledDates: Array<string>;\n\n /**\n * Allows the field to stretch and fill the entire width of its container.\n */\n @Prop({ reflect: true })\n readonly fluid: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Parses the unified value prop and synchronizes with internal state\n * @param {string} value - Value to parse\n */\n private parseUnifiedValue = (value: string): void => {\n if (!value) {\n // Reset all selections\n this.startValue = '';\n this.endValue = '';\n return;\n }\n\n const values = value\n .split(',')\n .map(v => v.trim())\n .filter(Boolean);\n\n if (values.length >= 2) {\n this.startValue = values[0];\n this.endValue = values[1];\n } else {\n // Handle malformed value gracefully\n console.warn(`Invalid date range format: ${value}`);\n this.startValue = '';\n this.endValue = '';\n }\n };\n\n /**\n * Converts the nv-calendar date format to the format expected by Inputmask.\n * @param {string} format - The date format to convert\n * @returns {string} The converted format for Inputmask\n */\n private convertToInputmaskFormat(format: string): string {\n // If the format is not specified, use the default format YYYY-MM-DD\n if (!format) {\n return 'dd/mm/yyyy';\n }\n\n const formatMap = {\n 'YYYY-MM-DD': 'yyyy-mm-dd',\n 'DD/MM/YYYY': 'dd/mm/yyyy',\n 'MM/DD/YYYY': 'mm/dd/yyyy',\n 'DD.MM.YYYY': 'dd.mm.yyyy',\n 'YYYYMMDD': 'yyyymmdd',\n };\n\n return formatMap[format] || 'dd/mm/yyyy';\n }\n\n /**\n * Closes the popover when a click is detected outside the component.\n * @param {MouseEvent} event - The mouse event\n */\n private handleClickOutside = (event: MouseEvent) => {\n if (this.open && this.el && !this.el.contains(event.target as Node)) {\n this.open = false;\n }\n };\n\n /**\n * Handles the input event on the start input element.\n * @param {Event} event - The input event\n */\n private handleStartInput = (event: Event) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n return;\n }\n const input = event.target as HTMLInputElement;\n this.startValue = input.value;\n\n // Update unified value prop\n this.value = `${input.value},${this.endValue}`;\n this.valueChanged.emit(this.value);\n\n // Legacy support (deprecated)\n this.dateRangeChange.emit({ start: input.value, end: this.endValue });\n\n // Temporarily enable navigation for keyboard input\n if (this.calendarElement) {\n this.calendarElement.removeAttribute('data-prevent-navigation');\n this.updateCalendarValue();\n // Restore navigation prevention after update\n setTimeout(() => {\n if (this.calendarElement) {\n this.calendarElement.setAttribute('data-prevent-navigation', 'true');\n }\n }, 100);\n }\n };\n\n /**\n * Handles the input event on the end input element.\n * @param {Event} event - The input event\n */\n private handleEndInput = (event: Event) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n return;\n }\n const input = event.target as HTMLInputElement;\n this.endValue = input.value;\n\n // Update unified value prop\n this.value = `${this.startValue},${input.value}`;\n this.valueChanged.emit(this.value);\n\n // Legacy support (deprecated)\n this.dateRangeChange.emit({ start: this.startValue, end: input.value });\n\n // Temporarily enable navigation for keyboard input\n if (this.calendarElement) {\n this.calendarElement.removeAttribute('data-prevent-navigation');\n this.updateCalendarValue();\n // Restore navigation prevention after update\n setTimeout(() => {\n if (this.calendarElement) {\n this.calendarElement.setAttribute('data-prevent-navigation', 'true');\n }\n }, 100);\n }\n };\n\n /**\n * Update the calendar's rangeValue property without forcing month change\n */\n private updateCalendarValue() {\n if (this.calendarElement && this.startValue && this.endValue) {\n // Store the current calendar state\n }\n }\n\n /**\n * Handles focus events on the input elements.\n * @param {FocusEvent} event - The focus event\n */\n private handleFocus = (event: FocusEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n (event.target as HTMLElement).blur();\n return;\n }\n\n // Enable navigation on focus\n if (this.calendarElement) {\n this.calendarElement.removeAttribute('data-prevent-navigation');\n }\n\n this.open = true;\n\n // Restore navigation prevention after opening\n setTimeout(() => {\n if (this.calendarElement) {\n this.calendarElement.setAttribute('data-prevent-navigation', 'true');\n }\n }, 300);\n };\n\n /**\n * Toggles the opening/closing of the popover.\n */\n private toggleCalendar = () => {\n if (this.readonly || this.disabled) {\n return;\n }\n this.open = !this.open;\n };\n\n /**\n * Clears the current selection and resets the date range field to its initial state.\n * This method can be called programmatically to reset the field.\n */\n @Method()\n async clear(): Promise<void> {\n // Reset internal state\n this.startValue = '';\n this.endValue = '';\n this.value = '';\n\n // Reset both input elements\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n input.value = '';\n // Remove input mask if exists\n if ((input as HTMLInputElementWithInputmask).inputmask) {\n (input as HTMLInputElementWithInputmask).inputmask.remove();\n }\n });\n\n // Emit events to notify about the change\n this.valueChanged.emit('');\n this.dateRangeChange.emit({ start: '', end: '' });\n\n // Close the popover if open\n this.open = false;\n\n // Clear the calendar if it exists\n if (this.calendarElement) {\n this.calendarElement.clear();\n }\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n connectedCallback() {\n document.addEventListener('click', this.handleClickOutside);\n }\n\n componentWillLoad() {\n if (this.value) {\n // Use the unified parsing method\n this.parseUnifiedValue(this.value);\n }\n }\n\n componentDidLoad() {\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n const inputMask = new Inputmask({\n alias: 'datetime',\n inputFormat: this.convertToInputmaskFormat(this.dateFormat),\n placeholder: this.convertToInputmaskFormat(this.dateFormat),\n clearIncomplete: false,\n showMaskOnHover: false,\n showMaskOnFocus: false,\n clearMaskOnLostFocus: false,\n insertMode: true,\n rightAlign: false,\n oncomplete: function (e) {\n const input = e.target as HTMLInputElement;\n const event = new CustomEvent('input', { bubbles: true });\n input.dispatchEvent(event);\n },\n });\n inputMask.mask(input);\n\n // Set the value after applying the mask\n if (input.name === this.startName && this.startValue) {\n requestAnimationFrame(() => {\n input.value = this.startValue;\n const event = new CustomEvent('input', { bubbles: true });\n input.dispatchEvent(event);\n });\n } else if (input.name === this.endName && this.endValue) {\n requestAnimationFrame(() => {\n input.value = this.endValue;\n const event = new CustomEvent('input', { bubbles: true });\n input.dispatchEvent(event);\n });\n }\n });\n }\n\n componentDidRender() {\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n const value =\n input.name === this.startName\n ? this.startValue\n : this.endName\n ? this.endValue\n : '';\n if (value) {\n // Make sure the value is defined both as a property and attribute\n requestAnimationFrame(() => {\n input.value = value;\n input.setAttribute('value', value);\n });\n }\n });\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this.handleClickOutside);\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the date range changes.\n */\n @Event()\n dateRangeChange: EventEmitter<\n HTMLNvCalendarElementEventMap['rangeDateChange']\n >;\n\n /**\n * Emitted when the unified value changes\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Handles the range date selection event from nv-calendar.\n * @param {CustomEvent<DateRange>} event - The custom event\n */\n @Listen('rangeDateChange')\n handleRangeDateChange(\n event: CustomEvent<HTMLNvCalendarElementEventMap['rangeDateChange']>,\n ) {\n const { start, end } = event.detail || {};\n\n // Check that both dates are defined\n if (start && end) {\n this.startValue = start;\n this.endValue = end;\n\n // Update unified value prop (like nv-calendar)\n this.value = `${start},${end}`;\n this.valueChanged.emit(this.value);\n\n // Legacy support (deprecated)\n this.dateRangeChange.emit({\n start: this.startValue,\n end: this.endValue,\n });\n\n if (!this.showActions) {\n this.open = false;\n }\n }\n }\n\n /**\n * Handles the unified value change event from nv-calendar\n * @param {CustomEvent<string>} event - The custom event\n */\n @Listen('valueChanged')\n handleCalendarValueChanged(event: CustomEvent<string>) {\n const newValue = event.detail || '';\n\n if (newValue !== this.value) {\n this.value = newValue;\n this.valueChanged.emit(newValue);\n\n // Parse and update internal state\n this.parseUnifiedValue(newValue);\n\n // Legacy support - emit dateRangeChange\n this.dateRangeChange.emit({\n start: this.startValue,\n end: this.endValue,\n });\n }\n }\n\n @Listen('closePopover')\n handleClosePopover() {\n this.open = false;\n }\n\n @Listen('applyDateRange')\n handleApplyDateRange() {\n this.open = false;\n }\n\n /**\n * Handles the reset event from the calendar's cancel button\n * @param {CustomEvent} event - The event emitted by the calendar\n */\n @Listen('singleDateChange')\n @Listen('rangeDateChange')\n handleDateReset(event: CustomEvent) {\n const isResetSingle =\n event.type === 'singleDateChange' && event.detail === '';\n const isResetRange =\n event.type === 'rangeDateChange' &&\n event.detail &&\n event.detail.start === '' &&\n event.detail.end === '';\n\n if (isResetSingle || isResetRange) {\n this.startValue = '';\n this.endValue = '';\n\n // Update unified value prop\n this.value = '';\n this.valueChanged.emit('');\n\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n input.value = '';\n });\n\n // Legacy support (deprecated)\n this.dateRangeChange.emit({ start: '', end: '' });\n }\n }\n\n /**\n * Handles keyboard events.\n * @param {KeyboardEvent} event - The keyboard event\n */\n @Listen('keydown', { passive: false })\n handleKeyDown(event: KeyboardEvent) {\n if (!this.open) {\n if (event.key === 'ArrowDown') {\n this.open = true;\n event.preventDefault();\n return;\n }\n return;\n }\n\n if (!this.popoverElement) {\n console.warn('nv-fielddaterange -> Popover element is not defined');\n return;\n }\n }\n\n @Watch('value')\n handleValueChange(newValue: string) {\n // Use the unified parsing method instead of JSON.parse\n this.parseUnifiedValue(newValue);\n }\n\n @Watch('open')\n onOpenChanged(newValue: boolean) {\n if (this.contentRef) {\n if (newValue) {\n this.contentRef.style.transition = 'none';\n this.contentRef.style.maxHeight = '0px';\n void this.contentRef.offsetHeight;\n requestAnimationFrame(() => {\n this.contentRef.style.transition =\n 'max-height 0.18s cubic-bezier(0.4,0,0.2,1)';\n this.contentRef.style.maxHeight = this.contentRef.scrollHeight + 'px';\n });\n } else {\n this.contentRef.style.transition = 'none';\n this.contentRef.style.maxHeight = this.contentRef.scrollHeight + 'px';\n void this.contentRef.offsetHeight;\n requestAnimationFrame(() => {\n this.contentRef.style.transition =\n 'max-height 0.18s cubic-bezier(0.4,0,0.2,1)';\n this.contentRef.style.maxHeight = '0px';\n });\n }\n }\n }\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region RENDER\n\n render() {\n return (\n <Host>\n {((this.label && this.label.length > 0) ||\n this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.startInputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <nv-popover\n ref={el => (this.popoverElement = el as HTMLNvPopoverElement)}\n id={this.popoverId}\n triggerMode=\"controlled\"\n placement=\"bottom-start\"\n open={this.open}\n >\n <div slot=\"trigger\" class=\"input-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div class=\"input-container\">\n <slot name=\"leading-input\"></slot>\n\n <div class=\"range-inputs\">\n <input\n id={this.startInputId}\n type=\"text\"\n placeholder={this.startPlaceholder}\n name={this.startName}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n autofocus={this.autofocus}\n value={this.startValue}\n onInput={this.handleStartInput}\n onFocus={this.handleFocus}\n data-scope=\"date-range\"\n />\n\n <div class=\"range-separator\"></div>\n\n <input\n id={this.endInputId}\n type=\"text\"\n placeholder={this.endPlaceholder}\n name={this.endName}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n value={this.endValue}\n onInput={this.handleEndInput}\n onFocus={this.handleFocus}\n data-scope=\"date-range\"\n />\n </div>\n\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n <nv-iconbutton\n class=\"toggle-calendar-icon\"\n name=\"calendar\"\n size=\"md\"\n emphasis=\"lower\"\n aria-label={this.open ? 'Hide calendar' : 'Show calendar'}\n aria-pressed={this.open.toString()}\n onClick={this.toggleCalendar}\n tabIndex={this.disabled ? -1 : 0}\n />\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n <div slot=\"content\">\n <nv-calendar\n ref={el => (this.calendarElement = el as HTMLNvCalendarElement)}\n dateFormat={this.dateFormat}\n value={this.value}\n firstDayOfWeek={this.firstDayOfWeek}\n numberOfCalendars={this.numberOfCalendars}\n min={this.min}\n max={this.max}\n locale={this.locale}\n shortcutsPlacement={this.shortcutsPlacement}\n showActions={this.showActions}\n shortcuts={this.shortcuts}\n showWeekNumbers={this.showWeekNumbers}\n disabledDates={this.disabledDates}\n selectionType=\"range\"\n data-prevent-navigation=\"true\"\n ></nv-calendar>\n </div>\n </nv-popover>\n\n {((this.description && this.description.length > 0) ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\">\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div hidden={!this.error} class=\"error-description\">\n {this.el.querySelector('[slot=\"error-description\"]') ? (\n <slot name=\"error-description\"></slot>\n ) : (\n this.errorDescription\n )}\n </div>\n )}\n\n <slot></slot>\n </Host>\n );\n }\n //#endregion RENDER\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nv-fielddaterange.js","sourceRoot":"","sources":["../../../src/components/nv-fielddaterange/nv-fielddaterange.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,IAAI,EACJ,KAAK,EACL,OAAO,EACP,KAAK,EAEL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAiBpC;;;;;;;;GAQG;AAMH,MAAM,OAAO,gBAAgB;IAL7B;QASU,cAAS,GAAW,MAAM,EAAE,CAAC;QAGrC,8EAA8E;Q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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import {\n Component,\n h,\n Prop,\n State,\n Element,\n Event,\n EventEmitter,\n Listen,\n Host,\n Watch,\n Method,\n} from '@stencil/core';\nimport Inputmask from 'inputmask';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * Extends HTMLInputElement to include the inputmask property.\n */\ninterface HTMLInputElementWithInputmask extends HTMLInputElement {\n /**\n * The inputmask instance that provides masking functionality.\n */\n inputmask?: {\n /**\n * Removes the inputmask instance.\n */\n remove: () => void;\n };\n}\n\n/**\n * @slot default - Child content of the component.\n * @slot leading-input - Content to be placed before the input text, within the input container.\n * @slot before-input - Content to be placed before the input text, outside the input container.\n * @slot after-input - Content to be placed after the input text, outside the input container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fielddaterange',\n styleUrl: 'styles/nv-fielddaterange.scss',\n shadow: false,\n})\nexport class NvFielddaterange {\n @Element() el!: HTMLNvFielddaterangeElement;\n private popoverElement!: HTMLNvPopoverElement;\n private calendarElement!: HTMLNvCalendarElement;\n private popoverId: string = uuidv4();\n private contentRef?: HTMLDivElement;\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the start input element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated.\n */\n @Prop({ reflect: true })\n readonly startInputId: string = uuidv4();\n\n /**\n * Sets the ID for the end input element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated.\n */\n @Prop({ reflect: true })\n readonly endInputId: string = uuidv4();\n\n /**\n * Text displayed as label. A slot label can override this prop.\n */\n @Prop({ reflect: true })\n readonly label: string;\n\n /**\n * Description displayed below the input. A slot description can override this prop.\n */\n @Prop({ reflect: true })\n readonly description: string;\n\n /**\n * Placeholder for the start input field.\n */\n @Prop({ reflect: true })\n readonly startPlaceholder: string;\n\n /**\n * Placeholder for the end input field.\n */\n @Prop({ reflect: true })\n readonly endPlaceholder: string;\n\n /**\n * Name attribute for the start input.\n */\n @Prop({ reflect: true })\n readonly startName: string;\n\n /**\n * Name attribute for the end input.\n */\n @Prop({ reflect: true })\n readonly endName: string;\n\n /**\n * Disables both input fields.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Sets both input fields as read-only.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks both input fields as required.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Indicates an error state.\n */\n @Prop({ reflect: true })\n readonly error: boolean = false;\n\n /**\n * Error description. A slot error-description can override this prop.\n */\n @Prop({ reflect: true })\n readonly errorDescription?: string;\n\n /**\n * Indicates a success state.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * Autofocus the start input when the component is mounted.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n /**\n * The initial value of the date range (in string format).\n */\n // eslint-disable-next-line @stencil-community/strict-mutable\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * The current value of the start date in string format.\n */\n @State()\n startValue: string = '';\n\n /**\n * The current value of the end date in string format.\n */\n @State()\n endValue: string = '';\n\n /**\n * Controls the opening of the popover.\n */\n @State()\n open: boolean = false;\n\n /**\n * First day of the week 0 = Sunday, 1 = Monday, etc.\n * @default 1\n */\n @Prop({ reflect: true })\n readonly firstDayOfWeek: number = 1;\n\n /**\n * Number of calendars to display\n * @default 2\n */\n @Prop({ reflect: true })\n readonly numberOfCalendars: number = 2;\n\n /**\n * Minimum date for selection ISO string format, ex: 2025-01-01\n */\n @Prop({ reflect: true })\n readonly min?: string = '';\n\n /**\n * Maximum date for selection ISO string format, ex: 2025-12-31\n */\n @Prop({ reflect: true })\n readonly max?: string = '';\n\n /** Locale for date formatting\n * @default 'en-BE'\n */\n @Prop({ reflect: true })\n readonly locale: string = 'en-BE';\n\n /** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.\n * @default 'YYYY-MM-DD'\n */\n @Prop({ reflect: true })\n readonly dateFormat: string = 'YYYY-MM-DD';\n\n /**\n * Footer placement\n * @default 'bottom'\n */\n @Prop({ reflect: true })\n readonly shortcutsPlacement: 'bottom' | 'left' | 'right' = 'bottom';\n\n /**\n * Show action buttons\n * @default false\n */\n @Prop({ reflect: true })\n readonly showActions: boolean = false;\n\n /**\n * Custom actions to display in the footer\n */\n @Prop({ reflect: true })\n readonly shortcuts: HTMLNvCalendarElement['shortcuts'];\n\n /**\n * Show week numbers\n */\n @Prop({ reflect: true })\n readonly showWeekNumbers: boolean;\n\n /**\n * Disabled dates ISO string array\n */\n @Prop({ reflect: true })\n readonly disabledDates: Array<string>;\n\n /**\n * Allows the field to stretch and fill the entire width of its container.\n */\n @Prop({ reflect: true })\n readonly fluid: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Parses the unified value prop and synchronizes with internal state\n * @param {string} value - Value to parse\n */\n private parseUnifiedValue = (value: string): void => {\n if (!value) {\n // Reset all selections\n this.startValue = '';\n this.endValue = '';\n return;\n }\n\n const values = value\n .split(',')\n .map(v => v.trim())\n .filter(Boolean);\n\n if (values.length >= 2) {\n this.startValue = values[0];\n this.endValue = values[1];\n }\n };\n\n /**\n * Converts the nv-calendar date format to the format expected by Inputmask.\n * @param {string} format - The date format to convert\n * @returns {string} The converted format for Inputmask\n */\n private convertToInputmaskFormat(format: string): string {\n // If the format is not specified, use the default format YYYY-MM-DD\n if (!format) {\n return 'dd/mm/yyyy';\n }\n\n const formatMap = {\n 'YYYY-MM-DD': 'yyyy-mm-dd',\n 'DD/MM/YYYY': 'dd/mm/yyyy',\n 'MM/DD/YYYY': 'mm/dd/yyyy',\n 'DD.MM.YYYY': 'dd.mm.yyyy',\n 'YYYYMMDD': 'yyyymmdd',\n };\n\n return formatMap[format] || 'dd/mm/yyyy';\n }\n\n /**\n * Closes the popover when a click is detected outside the component.\n * @param {MouseEvent} event - The mouse event\n */\n private handleClickOutside = (event: MouseEvent) => {\n if (this.open && this.el && !this.el.contains(event.target as Node)) {\n this.open = false;\n }\n };\n\n /**\n * Handles the input event on the start input element.\n * @param {Event} event - The input event\n */\n private handleStartInput = (event: Event) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n return;\n }\n const input = event.target as HTMLInputElement;\n this.startValue = input.value;\n\n // Update unified value prop\n this.value = `${input.value},${this.endValue}`;\n\n // Temporarily enable navigation for keyboard input\n if (this.calendarElement) {\n this.calendarElement.removeAttribute('data-prevent-navigation');\n this.updateCalendarValue();\n // Restore navigation prevention after update\n setTimeout(() => {\n if (this.calendarElement) {\n this.calendarElement.setAttribute('data-prevent-navigation', 'true');\n }\n }, 100);\n }\n };\n\n /**\n * Handles the input event on the end input element.\n * @param {Event} event - The input event\n */\n private handleEndInput = (event: Event) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n return;\n }\n const input = event.target as HTMLInputElement;\n this.endValue = input.value;\n\n // Update unified value prop\n this.value = `${this.startValue},${input.value}`;\n\n // Temporarily enable navigation for keyboard input\n if (this.calendarElement) {\n this.calendarElement.removeAttribute('data-prevent-navigation');\n this.updateCalendarValue();\n // Restore navigation prevention after update\n setTimeout(() => {\n if (this.calendarElement) {\n this.calendarElement.setAttribute('data-prevent-navigation', 'true');\n }\n }, 100);\n }\n };\n\n /**\n * Update the calendar's rangeValue property without forcing month change\n */\n private updateCalendarValue() {\n if (this.calendarElement && this.startValue && this.endValue) {\n // Store the current calendar state\n }\n }\n\n /**\n * Handles focus events on the input elements.\n * @param {FocusEvent} event - The focus event\n */\n private handleFocus = (event: FocusEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n (event.target as HTMLElement).blur();\n return;\n }\n\n // Enable navigation on focus\n if (this.calendarElement) {\n this.calendarElement.removeAttribute('data-prevent-navigation');\n }\n\n this.open = true;\n\n // Restore navigation prevention after opening\n setTimeout(() => {\n if (this.calendarElement) {\n this.calendarElement.setAttribute('data-prevent-navigation', 'true');\n }\n }, 300);\n };\n\n /**\n * Toggles the opening/closing of the popover.\n */\n private toggleCalendar = () => {\n if (this.readonly || this.disabled) {\n return;\n }\n this.open = !this.open;\n };\n\n /**\n * Clears the current selection and resets the date range field to its initial state.\n * This method can be called programmatically to reset the field.\n */\n @Method()\n async clear(): Promise<void> {\n // Reset internal state\n this.startValue = '';\n this.endValue = '';\n this.value = '';\n\n // Reset both input elements\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n input.value = '';\n // Remove input mask if exists\n if ((input as HTMLInputElementWithInputmask).inputmask) {\n (input as HTMLInputElementWithInputmask).inputmask.remove();\n }\n });\n\n // Emit events to notify about the change\n this.valueChanged.emit('');\n this.dateRangeChange.emit({ start: '', end: '' });\n\n // Close the popover if open\n this.open = false;\n\n // Clear the calendar if it exists\n if (this.calendarElement) {\n this.calendarElement.clear();\n }\n }\n\n private updateMask() {\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n (input as HTMLInputElementWithInputmask).inputmask?.remove?.();\n\n const inputMask = new Inputmask({\n alias: 'datetime',\n inputFormat: this.convertToInputmaskFormat(this.dateFormat),\n placeholder: this.convertToInputmaskFormat(this.dateFormat),\n clearIncomplete: false,\n showMaskOnHover: false,\n showMaskOnFocus: true,\n clearMaskOnLostFocus: !this.open,\n postValidation: true,\n oncleared: (e: CustomEvent) => {\n const input = e.target as HTMLInputElement;\n if (input.id === this.startInputId) {\n this.startValue = '';\n }\n if (input.id === this.endInputId) {\n this.endValue = '';\n }\n },\n oncomplete: () => {\n if (/[a-zA-Z]/g.test(this.value)) return;\n const values = this.value\n .split(',')\n .map(v => v.trim())\n .filter(Boolean);\n if (values.length < 2) return;\n\n // If valid emit change event\n this.valueChanged.emit(this.value);\n\n // Legacy support (deprecated)\n this.dateRangeChange.emit({\n start: this.startValue,\n end: input.value,\n });\n },\n });\n inputMask.mask(input);\n });\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n connectedCallback() {\n document.addEventListener('click', this.handleClickOutside);\n }\n\n componentWillLoad() {\n if (this.value) {\n // Use the unified parsing method\n this.parseUnifiedValue(this.value);\n }\n }\n\n componentDidLoad() {\n this.updateMask();\n\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n // Set the value after applying the mask\n if (input.name === this.startName && this.startValue) {\n requestAnimationFrame(() => {\n input.value = this.startValue;\n const event = new CustomEvent('input', { bubbles: true });\n input.dispatchEvent(event);\n });\n } else if (input.name === this.endName && this.endValue) {\n requestAnimationFrame(() => {\n input.value = this.endValue;\n const event = new CustomEvent('input', { bubbles: true });\n input.dispatchEvent(event);\n });\n }\n });\n }\n\n componentDidRender() {\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n const value =\n input.name === this.startName\n ? this.startValue\n : this.endName\n ? this.endValue\n : '';\n if (value) {\n // Make sure the value is defined both as a property and attribute\n requestAnimationFrame(() => {\n input.value = value;\n input.setAttribute('value', value);\n });\n }\n });\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this.handleClickOutside);\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the date range changes.\n */\n @Event()\n dateRangeChange: EventEmitter<\n HTMLNvCalendarElementEventMap['rangeDateChange']\n >;\n\n /**\n * Emitted when the unified value changes\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Handles the range date selection event from nv-calendar.\n * @param {CustomEvent<DateRange>} event - The custom event\n */\n @Listen('rangeDateChange')\n handleRangeDateChange(\n event: CustomEvent<HTMLNvCalendarElementEventMap['rangeDateChange']>,\n ) {\n const { start, end } = event.detail || {};\n\n // Check that both dates are defined\n if (start && end) {\n this.startValue = start;\n this.endValue = end;\n\n // Update unified value prop (like nv-calendar)\n this.value = `${start},${end}`;\n this.valueChanged.emit(this.value);\n\n // Legacy support (deprecated)\n this.dateRangeChange.emit({\n start: this.startValue,\n end: this.endValue,\n });\n\n if (!this.showActions) {\n this.open = false;\n }\n }\n }\n\n /**\n * Handles the unified value change event from nv-calendar\n * @param {CustomEvent<string>} event - The custom event\n */\n @Listen('valueChanged')\n handleCalendarValueChanged(event: CustomEvent<string>) {\n const newValue = event.detail || '';\n\n if (newValue !== this.value) {\n this.value = newValue;\n this.valueChanged.emit(newValue);\n\n // Parse and update internal state\n this.parseUnifiedValue(newValue);\n\n // Legacy support - emit dateRangeChange\n this.dateRangeChange.emit({\n start: this.startValue,\n end: this.endValue,\n });\n }\n }\n\n @Listen('closePopover')\n handleClosePopover() {\n this.open = false;\n }\n\n @Listen('applyDateRange')\n handleApplyDateRange() {\n this.open = false;\n }\n\n /**\n * Handles the reset event from the calendar's cancel button\n * @param {CustomEvent} event - The event emitted by the calendar\n */\n @Listen('singleDateChange')\n @Listen('rangeDateChange')\n handleDateReset(event: CustomEvent) {\n const isResetSingle =\n event.type === 'singleDateChange' && event.detail === '';\n const isResetRange =\n event.type === 'rangeDateChange' &&\n event.detail &&\n event.detail.start === '' &&\n event.detail.end === '';\n\n if (isResetSingle || isResetRange) {\n this.startValue = '';\n this.endValue = '';\n\n // Update unified value prop\n this.value = '';\n this.valueChanged.emit('');\n\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n input.value = '';\n });\n\n // Legacy support (deprecated)\n this.dateRangeChange.emit({ start: '', end: '' });\n }\n }\n\n /**\n * Handles keyboard events.\n * @param {KeyboardEvent} event - The keyboard event\n */\n @Listen('keydown', { passive: false })\n handleKeyDown(event: KeyboardEvent) {\n if (!this.open) {\n if (event.key === 'ArrowDown') {\n this.open = true;\n event.preventDefault();\n return;\n }\n return;\n }\n\n if (!this.popoverElement) {\n console.warn('nv-fielddaterange -> Popover element is not defined');\n return;\n }\n }\n\n @Watch('value')\n handleValueChange(newValue: string) {\n // Use the unified parsing method instead of JSON.parse\n this.parseUnifiedValue(newValue);\n }\n\n @Watch('open')\n onOpenChanged(newValue: boolean) {\n this.updateMask();\n if (this.contentRef) {\n if (newValue) {\n this.contentRef.style.transition = 'none';\n this.contentRef.style.maxHeight = '0px';\n void this.contentRef.offsetHeight;\n requestAnimationFrame(() => {\n this.contentRef.style.transition =\n 'max-height 0.18s cubic-bezier(0.4,0,0.2,1)';\n this.contentRef.style.maxHeight = this.contentRef.scrollHeight + 'px';\n });\n } else {\n this.contentRef.style.transition = 'none';\n this.contentRef.style.maxHeight = this.contentRef.scrollHeight + 'px';\n void this.contentRef.offsetHeight;\n requestAnimationFrame(() => {\n this.contentRef.style.transition =\n 'max-height 0.18s cubic-bezier(0.4,0,0.2,1)';\n this.contentRef.style.maxHeight = '0px';\n });\n }\n }\n }\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region RENDER\n\n render() {\n return (\n <Host>\n {((this.label && this.label.length > 0) ||\n this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.startInputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <nv-popover\n ref={el => (this.popoverElement = el as HTMLNvPopoverElement)}\n id={this.popoverId}\n triggerMode=\"controlled\"\n placement=\"bottom-start\"\n open={this.open}\n >\n <div slot=\"trigger\" class=\"input-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div class=\"input-container\">\n <slot name=\"leading-input\"></slot>\n\n <div class=\"range-inputs\">\n <input\n id={this.startInputId}\n type=\"text\"\n placeholder={\n this.startPlaceholder ||\n this.convertToInputmaskFormat(this.dateFormat)\n }\n name={this.startName}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n autofocus={this.autofocus}\n value={this.startValue}\n onInput={this.handleStartInput}\n onFocus={this.handleFocus}\n data-scope=\"date-range\"\n />\n\n <div class=\"range-separator\"></div>\n\n <input\n id={this.endInputId}\n type=\"text\"\n placeholder={\n this.endPlaceholder ||\n this.convertToInputmaskFormat(this.dateFormat)\n }\n name={this.endName}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n value={this.endValue}\n onInput={this.handleEndInput}\n onFocus={this.handleFocus}\n data-scope=\"date-range\"\n />\n </div>\n\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n <nv-iconbutton\n class=\"toggle-calendar-icon\"\n name=\"calendar\"\n size=\"md\"\n emphasis=\"lower\"\n aria-label={this.open ? 'Hide calendar' : 'Show calendar'}\n aria-pressed={this.open.toString()}\n onClick={this.toggleCalendar}\n tabIndex={this.disabled ? -1 : 0}\n />\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n <div slot=\"content\">\n <nv-calendar\n ref={el => (this.calendarElement = el as HTMLNvCalendarElement)}\n dateFormat={this.dateFormat}\n value={this.value}\n firstDayOfWeek={this.firstDayOfWeek}\n numberOfCalendars={this.numberOfCalendars}\n min={this.min}\n max={this.max}\n locale={this.locale}\n shortcutsPlacement={this.shortcutsPlacement}\n showActions={this.showActions}\n shortcuts={this.shortcuts}\n showWeekNumbers={this.showWeekNumbers}\n disabledDates={this.disabledDates}\n selectionType=\"range\"\n data-prevent-navigation=\"true\"\n ></nv-calendar>\n </div>\n </nv-popover>\n\n {((this.description && this.description.length > 0) ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\">\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div hidden={!this.error} class=\"error-description\">\n {this.el.querySelector('[slot=\"error-description\"]') ? (\n <slot name=\"error-description\"></slot>\n ) : (\n this.errorDescription\n )}\n </div>\n )}\n\n <slot></slot>\n </Host>\n );\n }\n //#endregion RENDER\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-aff3ed68.js';
|
|
2
|
-
import { I as Inputmask } from './p-
|
|
3
|
-
import { d as defineCustomElement$6 } from './p-
|
|
2
|
+
import { I as Inputmask } from './p-f1df2634.js';
|
|
3
|
+
import { d as defineCustomElement$6 } from './p-82e5674c.js';
|
|
4
4
|
import { d as defineCustomElement$5 } from './p-6460318d.js';
|
|
5
5
|
import { d as defineCustomElement$4 } from './p-025b8a78.js';
|
|
6
6
|
import { d as defineCustomElement$3 } from './p-dfd2d4f0.js';
|
|
@@ -51,8 +51,6 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
51
51
|
* The initial value of the input (date in string format).
|
|
52
52
|
* @bind value
|
|
53
53
|
*/
|
|
54
|
-
// eslint-disable-next-line @stencil-community/own-props-must-be-private
|
|
55
|
-
// eslint-disable-next-line @stencil-community/strict-mutable
|
|
56
54
|
this.value = '';
|
|
57
55
|
/**
|
|
58
56
|
* The current value of the input date in string format.
|
|
@@ -124,18 +122,10 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
124
122
|
return;
|
|
125
123
|
}
|
|
126
124
|
this.inputElement.focus();
|
|
127
|
-
// Select the first characters based on the date format
|
|
128
|
-
const format = this.dateFormat;
|
|
129
|
-
if (format.startsWith('DD') || format.startsWith('MM')) {
|
|
130
|
-
this.inputElement.setSelectionRange(0, 2);
|
|
131
|
-
}
|
|
132
|
-
else if (format.startsWith('YYYY')) {
|
|
133
|
-
this.inputElement.setSelectionRange(0, 4);
|
|
134
|
-
}
|
|
135
125
|
};
|
|
136
126
|
/**
|
|
137
127
|
* Handles the input event on the input element.
|
|
138
|
-
* Updates the singleValue and emits the valueChanged event.
|
|
128
|
+
* Updates the singleValue and emits the valueChanged event if empty.
|
|
139
129
|
* @param {Event} event - The input event.
|
|
140
130
|
*/
|
|
141
131
|
this.handleInput = (event) => {
|
|
@@ -144,74 +134,10 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
144
134
|
return;
|
|
145
135
|
}
|
|
146
136
|
const input = event.target;
|
|
147
|
-
const previousValue = this.value;
|
|
148
137
|
this.singleValue = input.value;
|
|
149
138
|
this.value = input.value;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.valueChanged.emit(input.value);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Initializes the input mask.
|
|
157
|
-
*/
|
|
158
|
-
this.initializeInputMask = () => {
|
|
159
|
-
this.currentPlaceholder = '';
|
|
160
|
-
if (this.inputElement.inputmask) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const inputMask = new Inputmask({
|
|
164
|
-
alias: 'datetime',
|
|
165
|
-
inputFormat: this.convertToInputmaskFormat(this.dateFormat),
|
|
166
|
-
placeholder: ' ',
|
|
167
|
-
prefillYear: false,
|
|
168
|
-
clearIncomplete: false,
|
|
169
|
-
showMaskOnHover: false,
|
|
170
|
-
showMaskOnFocus: false,
|
|
171
|
-
clearMaskOnLostFocus: false,
|
|
172
|
-
insertMode: true,
|
|
173
|
-
rightAlign: false,
|
|
174
|
-
oncomplete: function (e) {
|
|
175
|
-
const input = e.target;
|
|
176
|
-
const event = new CustomEvent('input', { bubbles: true });
|
|
177
|
-
input.dispatchEvent(event);
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
inputMask.mask(this.inputElement);
|
|
181
|
-
// Set the value after applying the mask
|
|
182
|
-
if (this.inputElement.name === this.name && this.singleValue) {
|
|
183
|
-
requestAnimationFrame(() => {
|
|
184
|
-
this.inputElement.value = this.singleValue;
|
|
185
|
-
const event = new CustomEvent('input', { bubbles: true });
|
|
186
|
-
this.inputElement.dispatchEvent(event);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Handles keydown events on the input before the mask is initialized.
|
|
192
|
-
* Initializes the mask on the first number input.
|
|
193
|
-
* @param {KeyboardEvent} event - The keyboard event.
|
|
194
|
-
*/
|
|
195
|
-
this.handleKeydownBeforeMask = (event) => {
|
|
196
|
-
const allowedKeys = [
|
|
197
|
-
'Backspace',
|
|
198
|
-
'Delete',
|
|
199
|
-
'Tab',
|
|
200
|
-
'ArrowLeft',
|
|
201
|
-
'ArrowRight',
|
|
202
|
-
'ArrowUp',
|
|
203
|
-
'ArrowDown',
|
|
204
|
-
'Home',
|
|
205
|
-
'End',
|
|
206
|
-
];
|
|
207
|
-
if (/\d/.test(event.key)) {
|
|
208
|
-
this.initializeInputMask();
|
|
209
|
-
this.inputElement.removeEventListener('keydown', this.handleKeydownBeforeMask);
|
|
210
|
-
}
|
|
211
|
-
else if (!allowedKeys.includes(event.key) &&
|
|
212
|
-
!event.metaKey &&
|
|
213
|
-
!event.ctrlKey) {
|
|
214
|
-
event.preventDefault();
|
|
139
|
+
if (this.value === '') {
|
|
140
|
+
this.valueChanged.emit('');
|
|
215
141
|
}
|
|
216
142
|
};
|
|
217
143
|
/**
|
|
@@ -224,17 +150,8 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
224
150
|
event.target.blur();
|
|
225
151
|
return;
|
|
226
152
|
}
|
|
227
|
-
if (!this.inputElement.inputmask) {
|
|
228
|
-
this.inputElement.addEventListener('keydown', this.handleKeydownBeforeMask);
|
|
229
|
-
}
|
|
230
153
|
this.open = true;
|
|
231
154
|
};
|
|
232
|
-
/**
|
|
233
|
-
* Handles blur events on the input element.
|
|
234
|
-
*/
|
|
235
|
-
this.handleBlur = () => {
|
|
236
|
-
this.inputElement.removeEventListener('keydown', this.handleKeydownBeforeMask);
|
|
237
|
-
};
|
|
238
155
|
/**
|
|
239
156
|
* Prevents the valueChanged event from the calendar from propagating up.
|
|
240
157
|
* @param {CustomEvent} event - The valueChanged event from nv-calendar.
|
|
@@ -309,6 +226,27 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
309
226
|
// Close the popover if open
|
|
310
227
|
this.open = false;
|
|
311
228
|
}
|
|
229
|
+
updateMask() {
|
|
230
|
+
var _a, _b;
|
|
231
|
+
if (!this.inputElement)
|
|
232
|
+
return;
|
|
233
|
+
(_b = (_a = this.inputElement.inputmask) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
234
|
+
const inputMask = new Inputmask({
|
|
235
|
+
alias: 'datetime',
|
|
236
|
+
inputFormat: this.convertToInputmaskFormat(this.dateFormat),
|
|
237
|
+
placeholder: this.convertToInputmaskFormat(this.dateFormat),
|
|
238
|
+
clearIncomplete: false,
|
|
239
|
+
showMaskOnHover: false,
|
|
240
|
+
showMaskOnFocus: true,
|
|
241
|
+
clearMaskOnLostFocus: !this.open,
|
|
242
|
+
postValidation: true,
|
|
243
|
+
oncomplete: (e) => {
|
|
244
|
+
var _a;
|
|
245
|
+
this.valueChanged.emit((_a = e.target) === null || _a === void 0 ? void 0 : _a.value);
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
inputMask.mask(this.inputElement);
|
|
249
|
+
}
|
|
312
250
|
//#endregion METHODS
|
|
313
251
|
/****************************************************************************/
|
|
314
252
|
//#region LIFECYCLE
|
|
@@ -319,10 +257,26 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
319
257
|
if (this.value) {
|
|
320
258
|
this.singleValue = this.value;
|
|
321
259
|
}
|
|
322
|
-
this.currentPlaceholder = this.placeholder || this.dateFormat;
|
|
323
260
|
}
|
|
324
261
|
componentDidLoad() {
|
|
325
|
-
|
|
262
|
+
this.updateMask();
|
|
263
|
+
// Set the initial value after applying the mask
|
|
264
|
+
if (this.inputElement.name === this.name && this.singleValue) {
|
|
265
|
+
requestAnimationFrame(() => {
|
|
266
|
+
this.inputElement.value = this.singleValue;
|
|
267
|
+
const event = new CustomEvent('input', { bubbles: true });
|
|
268
|
+
this.inputElement.dispatchEvent(event);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
componentDidRender() {
|
|
273
|
+
// Only set value on initial render when there's no existing value in the input
|
|
274
|
+
if (this.singleValue && this.inputElement && !this.inputElement.value) {
|
|
275
|
+
requestAnimationFrame(() => {
|
|
276
|
+
this.inputElement.value = this.singleValue;
|
|
277
|
+
this.inputElement.setAttribute('value', this.singleValue);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
326
280
|
}
|
|
327
281
|
disconnectedCallback() {
|
|
328
282
|
document.removeEventListener('click', this.handleClickOutside);
|
|
@@ -341,6 +295,10 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
341
295
|
const previousValue = this.value;
|
|
342
296
|
this.singleValue = value;
|
|
343
297
|
this.value = value;
|
|
298
|
+
// Set the input value directly when calendar is used
|
|
299
|
+
if (this.inputElement) {
|
|
300
|
+
this.inputElement.value = value;
|
|
301
|
+
}
|
|
344
302
|
// Only emit valueChanged if the value actually changed
|
|
345
303
|
if (previousValue !== value) {
|
|
346
304
|
this.valueChanged.emit(value);
|
|
@@ -369,21 +327,31 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
369
327
|
}
|
|
370
328
|
handleValueChange(newValue) {
|
|
371
329
|
this.singleValue = newValue;
|
|
330
|
+
// Only set input value if it's different from current input value
|
|
331
|
+
// This prevents interfering with user typing
|
|
332
|
+
if (this.inputElement && this.inputElement.value !== newValue) {
|
|
333
|
+
this.inputElement.value = newValue;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
handleOpenChange() {
|
|
337
|
+
this.updateMask();
|
|
372
338
|
}
|
|
373
339
|
//#endregion EVENTS
|
|
374
340
|
/****************************************************************************/
|
|
375
341
|
//#region RENDER
|
|
376
342
|
render() {
|
|
377
|
-
return (h(Host, { key: '
|
|
378
|
-
this.el.querySelector('[slot="label"]')) && (h("label", { key: '
|
|
343
|
+
return (h(Host, { key: 'e72afd15f69aa6267cc9444e63fae12e4cfcf05b' }, ((this.label && this.label.length > 0) ||
|
|
344
|
+
this.el.querySelector('[slot="label"]')) && (h("label", { key: 'bc13c15f74ac4dbe4b326fe479dcd9a6fb20cf40', htmlFor: this.inputId }, h("slot", { key: '30ae9788e7768adc9da95e0b89a3f6f7027e625f', name: "label" }, this.label))), h("nv-popover", { key: 'e043d7b021d1d7ee206d231a1cfc7b4541091ae5', ref: this.setPopoverRef, id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { key: '75682a712a8276bc24b285a48ef2312aae9f5097', slot: "trigger", class: "input-wrapper" }, h("slot", { key: '17593b316a870a5edbbc50eb4bb9441759309612', name: "before-input" }), h("div", { key: '0eb576fbe4a800ed7e1583810986e5f7f07e175a', class: "input-container", onClick: this.handleInputContainerClick }, h("slot", { key: 'c058ea07757486cf69621deba85ebbec3b075779', name: "leading-input" }), h("input", { key: '4c31a633358ff96f774a7862507c4c40301062cb', id: this.inputId, ref: this.setInputRef, placeholder: this.placeholder ||
|
|
345
|
+
this.convertToInputmaskFormat(this.dateFormat), name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, onInput: this.handleInput, onFocus: this.handleFocus, "data-scope": "date" }), this.error && (h("nv-icon", { key: '036392f177a0c10f609e7b555c3e7f256cd63962', name: "alert-circle", class: "validation", size: "md" })), this.success && (h("nv-icon", { key: '5a74ecdd55177d8cda55e8afdb05978e23450346', name: "circle-check", class: "validation", size: "md" })), h("nv-iconbutton", { key: 'e07f8b69d1810430cffff071d39ca7c72a15ccaf', class: "toggle-calendar-icon", name: "calendar" //{this.open ? 'chevron-top' : 'chevron-down'}
|
|
379
346
|
,
|
|
380
|
-
size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', "aria-pressed": this.open.toString(), onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), h("slot", { key: '
|
|
381
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
382
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '
|
|
347
|
+
size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', "aria-pressed": this.open.toString(), onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), h("slot", { key: 'a84e382a534735adb22741df1751d9c70c050b69', name: "after-input" })), h("div", { key: '29a3ca7ed69a772497590595fc82a78fddf0c32a', slot: "content" }, h("nv-calendar", { key: '6797dab38dba23f7396aadcbf5281aefdabd891f', dateFormat: this.dateFormat, singleValue: this.singleValue, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, onValueChanged: this.handleCalendarValueChanged }))), ((this.description && this.description.length > 0) ||
|
|
348
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '1799cd4dc4f6ca4b520277c080574af089816a9b', class: "description" }, h("slot", { key: 'eb2d9ac73687786e589f5a90791763f4465d1d20', name: "description" }, this.description))), (this.errorDescription ||
|
|
349
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '7c25fc8369b6bc948d7b233eb5b58451b02cbc62', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (h("slot", { name: "error-description" })) : (this.errorDescription))), h("slot", { key: '1499ea51b0e2d283037bf71aae6da242839c0e49' })));
|
|
383
350
|
}
|
|
384
351
|
get el() { return this; }
|
|
385
352
|
static get watchers() { return {
|
|
386
|
-
"value": ["handleValueChange"]
|
|
353
|
+
"value": ["handleValueChange"],
|
|
354
|
+
"open": ["handleOpenChange"]
|
|
387
355
|
}; }
|
|
388
356
|
static get style() { return NvFielddateStyle0; }
|
|
389
357
|
}, [4, "nv-fielddate", {
|
|
@@ -413,11 +381,11 @@ const NvFielddate$1 = /*@__PURE__*/ proxyCustomElement(class NvFielddate extends
|
|
|
413
381
|
"disabledDates": [16],
|
|
414
382
|
"fluid": [516],
|
|
415
383
|
"singleValue": [32],
|
|
416
|
-
"currentPlaceholder": [32],
|
|
417
384
|
"open": [32],
|
|
418
385
|
"clear": [64]
|
|
419
386
|
}, [[0, "singleDateChange", "handleSingleDateChange"], [0, "closePopover", "handleClosePopover"], [0, "keydown", "handleKeyDown"]], {
|
|
420
|
-
"value": ["handleValueChange"]
|
|
387
|
+
"value": ["handleValueChange"],
|
|
388
|
+
"open": ["handleOpenChange"]
|
|
421
389
|
}]);
|
|
422
390
|
function defineCustomElement$1() {
|
|
423
391
|
if (typeof customElements === "undefined") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nv-fielddate.js","mappings":";;;;;;;;;AAAA,MAAM,cAAc,GAAG,4mPAA4mP,CAAC;AACpoP,0BAAe,cAAc;;MC8ChBA,aAAW;IALxB;;;;QAUU,cAAS,GAAWC,EAAM,EAAE,CAAC;;;;;;;QAU5B,YAAO,GAAWA,EAAM,EAAE,CAAC;;;;QA8B3B,aAAQ,GAAY,KAAK,CAAC;;;;QAM1B,aAAQ,GAAY,KAA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ate","uuidv4"],"sources":["src/components/nv-fielddate/styles/nv-fielddate.scss?tag=nv-fielddate","src/components/nv-fielddate/nv-fielddate.tsx"],"sourcesContent":["@import '../../../styles/form-field';\n\nnv-fielddate {\n @include form-field-variables();\n @include form-field-root();\n\n &[fluid]:not([fluid=\"false\"]) {\n @include form-field-fluid();\n }\n\n &[readonly]:not([readonly='false']) {\n @include form-field-readonly-variables();\n }\n\n &[error]:not([error='false']) {\n @include form-field-error-variables();\n }\n\n &[success]:not([success='false']) {\n @include form-field-success-variables();\n }\n\n &[required]:not([required='false']) label {\n @include form-field-label-required();\n }\n\n label {\n @include form-field-label();\n }\n\n nv-popover {\n width: 100%;\n display: block;\n\n [data-scope='popover'] {\n padding: 0;\n background-color: var(--components-list-dropdown-background);\n border: 1px solid var(--components-list-dropdown-border);\n width: auto;\n }\n\n [slot='content'] {\n display: block;\n width: 100%;\n }\n .datepicker-container {\n border: none\n }\n }\n\n .input-wrapper {\n @include form-field-input-wrapper();\n display: flex;\n align-items: center;\n gap: 8px;\n\n .input-container {\n @include form-field-input-container();\n\n input {\n @include form-field-input();\n font-feature-settings: 'tnum';\n font-family: \"TTNorms Pro Mono\", monospace;\n }\n\n > nv-iconbutton {\n @include form-field-action();\n }\n\n nv-icon.validation {\n @include form-field-icon();\n }\n }\n }\n\n .description {\n @include form-field-description();\n }\n\n .error-description {\n @include form-field-error-description();\n }\n}\n","import {\n Component,\n h,\n Prop,\n State,\n Element,\n Event,\n EventEmitter,\n Listen,\n Host,\n Watch,\n Method,\n} from '@stencil/core';\nimport Inputmask from 'inputmask';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * Extends HTMLInputElement to include the inputmask property.\n */\ninterface HTMLInputElementWithInputmask extends HTMLInputElement {\n /**\n * The inputmask instance that provides masking functionality.\n */\n inputmask?: {\n /**\n * Removes the inputmask instance.\n */\n remove: () => void;\n };\n}\n\n/**\n * A field date component that combines an input with a calendar popover.\n *\n * @slot default - Child content of the component.\n * @slot leading-input - Content to be placed before the input text, within the input container.\n * @slot before-input - Content to be placed before the input text, outside the input container.\n * @slot after-input - Content to be placed after the input text, outside the input container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fielddate',\n styleUrl: 'styles/nv-fielddate.scss',\n shadow: false,\n})\nexport class NvFielddate {\n @Element() el: HTMLNvFielddateElement;\n private inputElement!: HTMLInputElement;\n\n private popoverElement!: HTMLNvPopoverElement;\n private popoverId: string = uuidv4();\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the input element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated.\n */\n @Prop({ reflect: true })\n readonly inputId: string = uuidv4();\n\n /**\n * Text displayed as label. A slot label can override this prop.\n */\n @Prop({ reflect: true })\n readonly label: string;\n\n /**\n * Description displayed below the input. A slot description can override this prop.\n */\n @Prop({ reflect: true })\n readonly description: string;\n\n /**\n * Placeholder for the input field.\n */\n @Prop({ reflect: true })\n readonly placeholder: string;\n\n /**\n * Name attribute for the input.\n */\n @Prop({ reflect: true })\n readonly name: string;\n\n /**\n * Disables the input field.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Sets the input field as read-only.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks the input field as required.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Indicates an error state.\n */\n @Prop({ reflect: true })\n readonly error: boolean = false;\n\n /**\n * Error description. A slot error-description can override this prop.\n */\n @Prop({ reflect: true })\n readonly errorDescription?: string;\n\n /**\n * Indicates a success state.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * Autofocus the input when the component is mounted.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n /**\n * The initial value of the input (date in string format).\n * @bind value\n */\n // eslint-disable-next-line @stencil-community/own-props-must-be-private\n // eslint-disable-next-line @stencil-community/strict-mutable\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * The current value of the input date in string format.\n */\n @State()\n singleValue: string = '';\n\n /**\n * The placeholder to display in the input.\n */\n @State()\n currentPlaceholder: string;\n\n /**\n * Controls the opening of the popover.\n */\n @State()\n open: boolean = false;\n\n /**\n * First day of the week 0 = Sunday, 1 = Monday, etc.\n * @default 1\n */\n @Prop({ reflect: true })\n readonly firstDayOfWeek: number = 1;\n\n /**\n * Number of calendars to display\n * @default 1\n */\n @Prop({ reflect: true })\n readonly numberOfCalendars: number = 1;\n\n /**\n * Minimum date for selection ISO string format, ex: 2025-01-01\n */\n @Prop({ reflect: true })\n readonly min?: string = '';\n\n /**\n * Maximum date for selection ISO string format, ex: 2025-12-31\n */\n @Prop({ reflect: true })\n readonly max?: string = '';\n\n /** Locale for date formatting\n * @default 'en-BE'\n */\n @Prop({ reflect: true })\n readonly locale: string = 'en-BE';\n\n /** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.\n * @default 'YYYY-MM-DD'\n * @note If the date format is in UTC mode, the date will be displayed in UTC time.\n * @note If the date format is not in UTC mode, the date will be displayed in the local time.\n */\n @Prop({ reflect: true })\n readonly dateFormat: string = 'YYYY-MM-DD';\n\n /**\n * Footer placement\n * @default 'bottom'\n */\n @Prop({ reflect: true })\n readonly shortcutsPlacement: 'bottom' | 'left' | 'right' = 'bottom';\n\n /**\n * Show action buttons\n * @default false\n */\n @Prop({ reflect: true })\n readonly showActions: boolean = false;\n\n /**\n * Custom actions to display in the footer\n */\n @Prop({ reflect: true })\n readonly shortcuts: HTMLNvCalendarElement['shortcuts'];\n\n /**\n * Show week numbers\n * @default true\n */\n @Prop({ reflect: true })\n readonly showWeekNumbers: boolean;\n\n /**\n * Disabled dates ISO string array\n */\n @Prop({ reflect: true })\n readonly disabledDates: Array<string>;\n\n /**\n * Allows the field to stretch and fill the entire width of its container.\n */\n @Prop({ reflect: true })\n readonly fluid: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Converts the nv-calendar date format to the format expected by Inputmask.\n * @param {string} format - The date format.\n * @returns {string} Format adapted for Inputmask.\n */\n private convertToInputmaskFormat(format: string): string {\n // If the format is not specified, use the default format\n if (!format) {\n return 'dd/mm/yyyy';\n }\n\n const formatMap = {\n 'DD/MM/YYYY': 'dd/mm/yyyy',\n 'MM/DD/YYYY': 'mm/dd/yyyy',\n 'YYYY-MM-DD': 'yyyy-mm-dd',\n 'DD.MM.YYYY': 'dd.mm.yyyy',\n 'YYYYMMDD': 'yyyymmdd',\n };\n\n return formatMap[format] || 'dd/mm/yyyy';\n }\n\n /**\n * Closes the popover when a click is detected outside the component.\n * @param {MouseEvent} event - The click event.\n */\n private handleClickOutside = (event: MouseEvent) => {\n if (this.open && this.el && !this.el.contains(event.target as Node)) {\n this.open = false;\n }\n };\n\n /**\n * Focuses the input when the input container is clicked.\n * @param {MouseEvent} event - The click event.\n */\n private handleInputContainerClick = (event: MouseEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.inputElement.focus();\n // Select the first characters based on the date format\n const format = this.dateFormat;\n if (format.startsWith('DD') || format.startsWith('MM')) {\n this.inputElement.setSelectionRange(0, 2);\n } else if (format.startsWith('YYYY')) {\n this.inputElement.setSelectionRange(0, 4);\n }\n };\n\n /**\n * Handles the input event on the input element.\n * Updates the singleValue and emits the valueChanged event.\n * @param {Event} event - The input event.\n */\n private handleInput = (event: Event) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n return;\n }\n const input = event.target as HTMLInputElement;\n const previousValue = this.value;\n this.singleValue = input.value;\n this.value = input.value;\n // Only emit valueChanged if the value actually changed\n if (previousValue !== input.value) {\n this.valueChanged.emit(input.value);\n }\n };\n\n /**\n * Initializes the input mask.\n */\n private initializeInputMask = () => {\n this.currentPlaceholder = '';\n\n if ((this.inputElement as HTMLInputElementWithInputmask).inputmask) {\n return;\n }\n\n const inputMask = new Inputmask({\n alias: 'datetime',\n inputFormat: this.convertToInputmaskFormat(this.dateFormat),\n placeholder: ' ',\n prefillYear: false,\n clearIncomplete: false,\n showMaskOnHover: false,\n showMaskOnFocus: false,\n clearMaskOnLostFocus: false,\n insertMode: true,\n rightAlign: false,\n oncomplete: function (e) {\n const input = e.target as HTMLInputElement;\n const event = new CustomEvent('input', { bubbles: true });\n input.dispatchEvent(event);\n },\n });\n inputMask.mask(this.inputElement);\n\n // Set the value after applying the mask\n if (this.inputElement.name === this.name && this.singleValue) {\n requestAnimationFrame(() => {\n this.inputElement.value = this.singleValue;\n const event = new CustomEvent('input', { bubbles: true });\n this.inputElement.dispatchEvent(event);\n });\n }\n };\n\n /**\n * Handles keydown events on the input before the mask is initialized.\n * Initializes the mask on the first number input.\n * @param {KeyboardEvent} event - The keyboard event.\n */\n private handleKeydownBeforeMask = (event: KeyboardEvent) => {\n const allowedKeys = [\n 'Backspace',\n 'Delete',\n 'Tab',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n ];\n\n if (/\\d/.test(event.key)) {\n this.initializeInputMask();\n this.inputElement.removeEventListener(\n 'keydown',\n this.handleKeydownBeforeMask,\n );\n } else if (\n !allowedKeys.includes(event.key) &&\n !event.metaKey &&\n !event.ctrlKey\n ) {\n event.preventDefault();\n }\n };\n\n /**\n * Handles focus events on the input element.\n * @param {FocusEvent} event - The focus event.\n */\n private handleFocus = (event: FocusEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n (event.target as HTMLElement).blur();\n return;\n }\n\n if (!(this.inputElement as HTMLInputElementWithInputmask).inputmask) {\n this.inputElement.addEventListener(\n 'keydown',\n this.handleKeydownBeforeMask,\n );\n }\n\n this.open = true;\n };\n\n /**\n * Handles blur events on the input element.\n */\n private handleBlur = () => {\n this.inputElement.removeEventListener(\n 'keydown',\n this.handleKeydownBeforeMask,\n );\n };\n\n /**\n * Prevents the valueChanged event from the calendar from propagating up.\n * @param {CustomEvent} event - The valueChanged event from nv-calendar.\n */\n private handleCalendarValueChanged = (event: CustomEvent) => {\n event.stopPropagation();\n };\n\n /**\n * Sets the reference to the popover element.\n * @param {HTMLNvPopoverElement} el - The popover element.\n */\n private setPopoverRef = (el: HTMLNvPopoverElement) => {\n this.popoverElement = el;\n };\n\n /**\n * Sets the reference to the input element.\n * @param {HTMLInputElement} el - The input element.\n */\n private setInputRef = (el: HTMLInputElement) => {\n this.inputElement = el;\n };\n\n /**\n * Toggles the opening/closing of the popover.\n */\n private toggleCalendar = () => {\n if (this.readonly || this.disabled) {\n return;\n }\n this.open = !this.open;\n };\n\n /**\n * Clears the current selection and resets the field to its initial state.\n * This method can be called programmatically to reset the field.\n */\n @Method()\n async clear(): Promise<void> {\n // Reset internal state\n this.singleValue = '';\n this.value = '';\n\n // Reset the input element value\n if (this.inputElement) {\n this.inputElement.value = '';\n // Remove the input mask and reinitialize if needed\n if ((this.inputElement as HTMLInputElementWithInputmask).inputmask) {\n (this.inputElement as HTMLInputElementWithInputmask).inputmask.remove();\n }\n }\n\n // Emit events to notify about the change\n this.valueChanged.emit('');\n\n // Close the popover if open\n this.open = false;\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n connectedCallback() {\n document.addEventListener('click', this.handleClickOutside);\n }\n\n componentWillLoad() {\n if (this.value) {\n this.singleValue = this.value;\n }\n this.currentPlaceholder = this.placeholder || this.dateFormat;\n }\n\n componentDidLoad() {\n // Inputmask is now initialized on the first keypress\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this.handleClickOutside);\n if (\n this.inputElement &&\n (this.inputElement as HTMLInputElementWithInputmask).inputmask\n ) {\n (this.inputElement as HTMLInputElementWithInputmask).inputmask.remove();\n }\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the value changes (unified value binding).\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Handles the single date selection event from nv-calendar.\n * Updates the input value and closes the popover.\n * @param {CustomEvent} event - The event from nv-calendar.\n */\n @Listen('singleDateChange')\n handleSingleDateChange(event: CustomEvent) {\n const value: string = event.detail;\n const previousValue = this.value;\n this.singleValue = value;\n this.value = value;\n // Only emit valueChanged if the value actually changed\n if (previousValue !== value) {\n this.valueChanged.emit(value);\n }\n if (!this.showActions) {\n this.open = false;\n }\n }\n\n @Listen('closePopover')\n handleClosePopover() {\n this.open = false;\n }\n\n @Listen('keydown', { passive: false })\n handleKeyDown(event: KeyboardEvent) {\n if (!this.open) {\n if (event.key === 'ArrowDown') {\n this.open = true;\n\n event.preventDefault();\n return;\n }\n return;\n }\n\n // Verify if the popover element is defined\n if (!this.popoverElement) {\n console.warn('nv-fielddate -> Popover element is not defined');\n return;\n }\n }\n\n @Watch('value')\n handleValueChange(newValue: string) {\n this.singleValue = newValue;\n }\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region RENDER\n render() {\n return (\n <Host>\n {((this.label && this.label.length > 0) ||\n this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.inputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <nv-popover\n ref={this.setPopoverRef}\n id={this.popoverId}\n triggerMode=\"controlled\"\n placement=\"bottom-start\"\n open={this.open}\n >\n <div slot=\"trigger\" class=\"input-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div\n class=\"input-container\"\n onClick={this.handleInputContainerClick}\n >\n <slot name=\"leading-input\"></slot>\n\n <input\n id={this.inputId}\n ref={this.setInputRef}\n placeholder={this.currentPlaceholder}\n name={this.name}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n autofocus={this.autofocus}\n value={this.singleValue}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n data-scope=\"date\"\n />\n\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n <nv-iconbutton\n class=\"toggle-calendar-icon\"\n name=\"calendar\" //{this.open ? 'chevron-top' : 'chevron-down'}\n size=\"md\"\n emphasis=\"lower\"\n aria-label={this.open ? 'Hide calendar' : 'Show calendar'}\n aria-pressed={this.open.toString()}\n onClick={this.toggleCalendar}\n tabIndex={this.disabled ? -1 : 0}\n />\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n <div slot=\"content\">\n <nv-calendar\n dateFormat={this.dateFormat}\n singleValue={this.singleValue}\n firstDayOfWeek={this.firstDayOfWeek}\n numberOfCalendars={this.numberOfCalendars}\n min={this.min}\n max={this.max}\n locale={this.locale}\n shortcutsPlacement={this.shortcutsPlacement}\n showActions={this.showActions}\n shortcuts={this.shortcuts}\n showWeekNumbers={this.showWeekNumbers}\n disabledDates={this.disabledDates}\n onValueChanged={this.handleCalendarValueChanged}\n ></nv-calendar>\n </div>\n </nv-popover>\n\n {((this.description && this.description.length > 0) ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\">\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div hidden={!this.error} class=\"error-description\">\n {this.el.querySelector('[slot=\"error-description\"]') ? (\n <slot name=\"error-description\"></slot>\n ) : (\n this.errorDescription\n )}\n </div>\n )}\n\n <slot></slot>\n </Host>\n );\n }\n //#endregion RENDER\n}\n"],"version":3}
|
|
1
|
+
{"file":"nv-fielddate.js","mappings":";;;;;;;;;AAAA,MAAM,cAAc,GAAG,4mPAA4mP,CAAC;AACpoP,0BAAe,cAAc;;MC8ChBA,aAAW;IALxB;;;;QAUU,cAAS,GAAWC,EAAM,EAAE,CAAC;;;;;;;QAU5B,YAAO,GAAWA,EAAM,EAAE,CAAC;;;;QA8B3B,aAAQ,GAAY,KAAK,CAAC;;;;QAM1B,aAAQ,G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AgB;YACrB,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,4BAA4B,CAAC,MACnD,4DAAK,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAC,mBAAmB,IAChD,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,4BAA4B,CAAC,IAClD,YAAM,IAAI,EAAC,mBAAmB,GAAQ,KAEtC,IAAI,CAAC,gBAAgB,CACtB,CACG,CACP,EAED,8DAAa,CACR,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["NvFielddate","uuidv4"],"sources":["src/components/nv-fielddate/styles/nv-fielddate.scss?tag=nv-fielddate","src/components/nv-fielddate/nv-fielddate.tsx"],"sourcesContent":["@import '../../../styles/form-field';\n\nnv-fielddate {\n @include form-field-variables();\n @include form-field-root();\n\n &[fluid]:not([fluid=\"false\"]) {\n @include form-field-fluid();\n }\n\n &[readonly]:not([readonly='false']) {\n @include form-field-readonly-variables();\n }\n\n &[error]:not([error='false']) {\n @include form-field-error-variables();\n }\n\n &[success]:not([success='false']) {\n @include form-field-success-variables();\n }\n\n &[required]:not([required='false']) label {\n @include form-field-label-required();\n }\n\n label {\n @include form-field-label();\n }\n\n nv-popover {\n width: 100%;\n display: block;\n\n [data-scope='popover'] {\n padding: 0;\n background-color: var(--components-list-dropdown-background);\n border: 1px solid var(--components-list-dropdown-border);\n width: auto;\n }\n\n [slot='content'] {\n display: block;\n width: 100%;\n }\n .datepicker-container {\n border: none\n }\n }\n\n .input-wrapper {\n @include form-field-input-wrapper();\n display: flex;\n align-items: center;\n gap: 8px;\n\n .input-container {\n @include form-field-input-container();\n\n input {\n @include form-field-input();\n font-feature-settings: 'tnum';\n font-family: \"TTNorms Pro Mono\", monospace;\n }\n\n > nv-iconbutton {\n @include form-field-action();\n }\n\n nv-icon.validation {\n @include form-field-icon();\n }\n }\n }\n\n .description {\n @include form-field-description();\n }\n\n .error-description {\n @include form-field-error-description();\n }\n}\n","import {\n Component,\n h,\n Prop,\n State,\n Element,\n Event,\n EventEmitter,\n Listen,\n Host,\n Watch,\n Method,\n} from '@stencil/core';\nimport Inputmask from 'inputmask';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * Extends HTMLInputElement to include the inputmask property.\n */\ninterface HTMLInputElementWithInputmask extends HTMLInputElement {\n /**\n * The inputmask instance that provides masking functionality.\n */\n inputmask?: {\n /**\n * Removes the inputmask instance.\n */\n remove?: () => void;\n };\n}\n\n/**\n * A field date component that combines an input with a calendar popover.\n *\n * @slot default - Child content of the component.\n * @slot leading-input - Content to be placed before the input text, within the input container.\n * @slot before-input - Content to be placed before the input text, outside the input container.\n * @slot after-input - Content to be placed after the input text, outside the input container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fielddate',\n styleUrl: 'styles/nv-fielddate.scss',\n shadow: false,\n})\nexport class NvFielddate {\n @Element() el: HTMLNvFielddateElement;\n private inputElement!: HTMLInputElement;\n\n private popoverElement!: HTMLNvPopoverElement;\n private popoverId: string = uuidv4();\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the input element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated.\n */\n @Prop({ reflect: true })\n readonly inputId: string = uuidv4();\n\n /**\n * Text displayed as label. A slot label can override this prop.\n */\n @Prop({ reflect: true })\n readonly label: string;\n\n /**\n * Description displayed below the input. A slot description can override this prop.\n */\n @Prop({ reflect: true })\n readonly description: string;\n\n /**\n * Placeholder for the input field.\n */\n @Prop({ reflect: true })\n readonly placeholder: string;\n\n /**\n * Name attribute for the input.\n */\n @Prop({ reflect: true })\n readonly name: string;\n\n /**\n * Disables the input field.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Sets the input field as read-only.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks the input field as required.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Indicates an error state.\n */\n @Prop({ reflect: true })\n readonly error: boolean = false;\n\n /**\n * Error description. A slot error-description can override this prop.\n */\n @Prop({ reflect: true })\n readonly errorDescription?: string;\n\n /**\n * Indicates a success state.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * Autofocus the input when the component is mounted.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n /**\n * The initial value of the input (date in string format).\n * @bind value\n */\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * The current value of the input date in string format.\n */\n @State()\n singleValue: string = '';\n\n /**\n * Controls the opening of the popover.\n */\n @State()\n open: boolean = false;\n\n /**\n * First day of the week 0 = Sunday, 1 = Monday, etc.\n * @default 1\n */\n @Prop({ reflect: true })\n readonly firstDayOfWeek: number = 1;\n\n /**\n * Number of calendars to display\n * @default 1\n */\n @Prop({ reflect: true })\n readonly numberOfCalendars: number = 1;\n\n /**\n * Minimum date for selection ISO string format, ex: 2025-01-01\n */\n @Prop({ reflect: true })\n readonly min?: string = '';\n\n /**\n * Maximum date for selection ISO string format, ex: 2025-12-31\n */\n @Prop({ reflect: true })\n readonly max?: string = '';\n\n /** Locale for date formatting\n * @default 'en-BE'\n */\n @Prop({ reflect: true })\n readonly locale: string = 'en-BE';\n\n /** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.\n * @default 'YYYY-MM-DD'\n * @note If the date format is in UTC mode, the date will be displayed in UTC time.\n * @note If the date format is not in UTC mode, the date will be displayed in the local time.\n */\n @Prop({ reflect: true })\n readonly dateFormat: string = 'YYYY-MM-DD';\n\n /**\n * Footer placement\n * @default 'bottom'\n */\n @Prop({ reflect: true })\n readonly shortcutsPlacement: 'bottom' | 'left' | 'right' = 'bottom';\n\n /**\n * Show action buttons\n * @default false\n */\n @Prop({ reflect: true })\n readonly showActions: boolean = false;\n\n /**\n * Custom actions to display in the footer\n */\n @Prop({ reflect: true })\n readonly shortcuts: HTMLNvCalendarElement['shortcuts'];\n\n /**\n * Show week numbers\n * @default true\n */\n @Prop({ reflect: true })\n readonly showWeekNumbers: boolean;\n\n /**\n * Disabled dates ISO string array\n */\n @Prop({ reflect: true })\n readonly disabledDates: Array<string>;\n\n /**\n * Allows the field to stretch and fill the entire width of its container.\n */\n @Prop({ reflect: true })\n readonly fluid: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Converts the nv-calendar date format to the format expected by Inputmask.\n * @param {string} format - The date format.\n * @returns {string} Format adapted for Inputmask.\n */\n private convertToInputmaskFormat(format: string): string {\n // If the format is not specified, use the default format\n if (!format) {\n return 'dd/mm/yyyy';\n }\n\n const formatMap = {\n 'DD/MM/YYYY': 'dd/mm/yyyy',\n 'MM/DD/YYYY': 'mm/dd/yyyy',\n 'YYYY-MM-DD': 'yyyy-mm-dd',\n 'DD.MM.YYYY': 'dd.mm.yyyy',\n 'YYYYMMDD': 'yyyymmdd',\n };\n\n return formatMap[format] || 'dd/mm/yyyy';\n }\n\n /**\n * Closes the popover when a click is detected outside the component.\n * @param {MouseEvent} event - The click event.\n */\n private handleClickOutside = (event: MouseEvent) => {\n if (this.open && this.el && !this.el.contains(event.target as Node)) {\n this.open = false;\n }\n };\n\n /**\n * Focuses the input when the input container is clicked.\n * @param {MouseEvent} event - The click event.\n */\n private handleInputContainerClick = (event: MouseEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.inputElement.focus();\n };\n\n /**\n * Handles the input event on the input element.\n * Updates the singleValue and emits the valueChanged event if empty.\n * @param {Event} event - The input event.\n */\n private handleInput = (event: Event) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n return;\n }\n const input = event.target as HTMLInputElement;\n this.singleValue = input.value;\n this.value = input.value;\n\n if (this.value === '') {\n this.valueChanged.emit('');\n }\n };\n\n /**\n * Handles focus events on the input element.\n * @param {FocusEvent} event - The focus event.\n */\n private handleFocus = (event: FocusEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n (event.target as HTMLElement).blur();\n return;\n }\n\n this.open = true;\n };\n\n /**\n * Prevents the valueChanged event from the calendar from propagating up.\n * @param {CustomEvent} event - The valueChanged event from nv-calendar.\n */\n private handleCalendarValueChanged = (event: CustomEvent) => {\n event.stopPropagation();\n };\n\n /**\n * Sets the reference to the popover element.\n * @param {HTMLNvPopoverElement} el - The popover element.\n */\n private setPopoverRef = (el: HTMLNvPopoverElement) => {\n this.popoverElement = el;\n };\n\n /**\n * Sets the reference to the input element.\n * @param {HTMLInputElement} el - The input element.\n */\n private setInputRef = (el: HTMLInputElement) => {\n this.inputElement = el;\n };\n\n /**\n * Toggles the opening/closing of the popover.\n */\n private toggleCalendar = () => {\n if (this.readonly || this.disabled) {\n return;\n }\n this.open = !this.open;\n };\n\n /**\n * Clears the current selection and resets the field to its initial state.\n * This method can be called programmatically to reset the field.\n */\n @Method()\n async clear(): Promise<void> {\n // Reset internal state\n this.singleValue = '';\n this.value = '';\n\n // Reset the input element value\n if (this.inputElement) {\n this.inputElement.value = '';\n // Remove the input mask and reinitialize if needed\n if ((this.inputElement as HTMLInputElementWithInputmask).inputmask) {\n (this.inputElement as HTMLInputElementWithInputmask).inputmask.remove();\n }\n }\n\n // Emit events to notify about the change\n this.valueChanged.emit('');\n\n // Close the popover if open\n this.open = false;\n }\n\n private updateMask() {\n if (!this.inputElement) return;\n (this.inputElement as HTMLInputElementWithInputmask).inputmask?.remove?.();\n\n const inputMask = new Inputmask({\n alias: 'datetime',\n inputFormat: this.convertToInputmaskFormat(this.dateFormat),\n placeholder: this.convertToInputmaskFormat(this.dateFormat),\n clearIncomplete: false,\n showMaskOnHover: false,\n showMaskOnFocus: true,\n clearMaskOnLostFocus: !this.open,\n postValidation: true,\n oncomplete: (e: CustomEvent) => {\n this.valueChanged.emit((e.target as HTMLInputElement)?.value);\n },\n });\n inputMask.mask(this.inputElement);\n }\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n connectedCallback() {\n document.addEventListener('click', this.handleClickOutside);\n }\n\n componentWillLoad() {\n if (this.value) {\n this.singleValue = this.value;\n }\n }\n\n componentDidLoad() {\n this.updateMask();\n\n // Set the initial value after applying the mask\n if (this.inputElement.name === this.name && this.singleValue) {\n requestAnimationFrame(() => {\n this.inputElement.value = this.singleValue;\n const event = new CustomEvent('input', { bubbles: true });\n this.inputElement.dispatchEvent(event);\n });\n }\n }\n\n componentDidRender() {\n // Only set value on initial render when there's no existing value in the input\n if (this.singleValue && this.inputElement && !this.inputElement.value) {\n requestAnimationFrame(() => {\n this.inputElement.value = this.singleValue;\n this.inputElement.setAttribute('value', this.singleValue);\n });\n }\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this.handleClickOutside);\n if (\n this.inputElement &&\n (this.inputElement as HTMLInputElementWithInputmask).inputmask\n ) {\n (this.inputElement as HTMLInputElementWithInputmask).inputmask.remove();\n }\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the value changes (unified value binding).\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Handles the single date selection event from nv-calendar.\n * Updates the input value and closes the popover.\n * @param {CustomEvent} event - The event from nv-calendar.\n */\n @Listen('singleDateChange')\n handleSingleDateChange(event: CustomEvent) {\n const value: string = event.detail;\n const previousValue = this.value;\n this.singleValue = value;\n this.value = value;\n\n // Set the input value directly when calendar is used\n if (this.inputElement) {\n this.inputElement.value = value;\n }\n\n // Only emit valueChanged if the value actually changed\n if (previousValue !== value) {\n this.valueChanged.emit(value);\n }\n if (!this.showActions) {\n this.open = false;\n }\n }\n\n @Listen('closePopover')\n handleClosePopover() {\n this.open = false;\n }\n\n @Listen('keydown', { passive: false })\n handleKeyDown(event: KeyboardEvent) {\n if (!this.open) {\n if (event.key === 'ArrowDown') {\n this.open = true;\n\n event.preventDefault();\n return;\n }\n return;\n }\n\n // Verify if the popover element is defined\n if (!this.popoverElement) {\n console.warn('nv-fielddate -> Popover element is not defined');\n return;\n }\n }\n\n @Watch('value')\n handleValueChange(newValue: string) {\n this.singleValue = newValue;\n // Only set input value if it's different from current input value\n // This prevents interfering with user typing\n if (this.inputElement && this.inputElement.value !== newValue) {\n this.inputElement.value = newValue;\n }\n }\n\n @Watch('open')\n handleOpenChange() {\n this.updateMask();\n }\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region RENDER\n render() {\n return (\n <Host>\n {((this.label && this.label.length > 0) ||\n this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.inputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <nv-popover\n ref={this.setPopoverRef}\n id={this.popoverId}\n triggerMode=\"controlled\"\n placement=\"bottom-start\"\n open={this.open}\n >\n <div slot=\"trigger\" class=\"input-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div\n class=\"input-container\"\n onClick={this.handleInputContainerClick}\n >\n <slot name=\"leading-input\"></slot>\n\n <input\n id={this.inputId}\n ref={this.setInputRef}\n placeholder={\n this.placeholder ||\n this.convertToInputmaskFormat(this.dateFormat)\n }\n name={this.name}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n autofocus={this.autofocus}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n data-scope=\"date\"\n />\n\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n <nv-iconbutton\n class=\"toggle-calendar-icon\"\n name=\"calendar\" //{this.open ? 'chevron-top' : 'chevron-down'}\n size=\"md\"\n emphasis=\"lower\"\n aria-label={this.open ? 'Hide calendar' : 'Show calendar'}\n aria-pressed={this.open.toString()}\n onClick={this.toggleCalendar}\n tabIndex={this.disabled ? -1 : 0}\n />\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n <div slot=\"content\">\n <nv-calendar\n dateFormat={this.dateFormat}\n singleValue={this.singleValue}\n firstDayOfWeek={this.firstDayOfWeek}\n numberOfCalendars={this.numberOfCalendars}\n min={this.min}\n max={this.max}\n locale={this.locale}\n shortcutsPlacement={this.shortcutsPlacement}\n showActions={this.showActions}\n shortcuts={this.shortcuts}\n showWeekNumbers={this.showWeekNumbers}\n disabledDates={this.disabledDates}\n onValueChanged={this.handleCalendarValueChanged}\n ></nv-calendar>\n </div>\n </nv-popover>\n\n {((this.description && this.description.length > 0) ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\">\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div hidden={!this.error} class=\"error-description\">\n {this.el.querySelector('[slot=\"error-description\"]') ? (\n <slot name=\"error-description\"></slot>\n ) : (\n this.errorDescription\n )}\n </div>\n )}\n\n <slot></slot>\n </Host>\n );\n }\n //#endregion RENDER\n}\n"],"version":3}
|