@cas-smartdesign/combo-box 7.4.0 → 7.4.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/combo-box.mjs
CHANGED
|
@@ -258,7 +258,15 @@ const l = (o = class extends _ {
|
|
|
258
258
|
{
|
|
259
259
|
name: "offset",
|
|
260
260
|
options: {
|
|
261
|
-
offset: ({ placement: e }) =>
|
|
261
|
+
offset: ({ placement: e }) => {
|
|
262
|
+
var i;
|
|
263
|
+
return e.indexOf("top") > -1 ? [0, -parseInt(getComputedStyle(t).paddingTop, 10)] : e.indexOf("bottom") > -1 ? [
|
|
264
|
+
0,
|
|
265
|
+
-parseInt(getComputedStyle(t).paddingBottom, 10) - (((i = this.shadowRoot.querySelector(
|
|
266
|
+
".validation-message-wrapper"
|
|
267
|
+
)) == null ? void 0 : i.offsetHeight) ?? 0)
|
|
268
|
+
] : [0, 0];
|
|
269
|
+
}
|
|
262
270
|
}
|
|
263
271
|
},
|
|
264
272
|
{
|
package/dist/combo-box.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.mjs","sources":["../toggle.svg?raw","../clear.svg?raw","../combo-box.ts"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"toggle-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M13 4v2l-5 5-5-5v-2l5 5z\\\"/>\\r\\n</svg>\\r\\n\"","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"clear-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M12.96 4.46l-1.42-1.42-3.54 3.55-3.54-3.55-1.42 1.42 3.55 3.54-3.55 3.54 1.42 1.42 3.54-3.55 3.54 3.55 1.42-1.42-3.55-3.54 3.55-3.54z\\\"/>\\r\\n</svg>\\r\\n\"","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { unsafeCSS, PropertyValues, css, TemplateResult, html } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { createPopper, Instance as Popper } from \"@popperjs/core\";\nimport SDInput, { CustomEventMap as InputCustomEventMap } from \"@cas-smartdesign/lit-input\";\nimport VirtualList, { SelectionType, ItemGenerator, ListDataProvider } from \"@cas-smartdesign/virtual-list\";\nimport { ItemData, generator } from \"@cas-smartdesign/list-item\";\n\nconst TAG_NAME = \"sd-combo-box\";\n\nfunction debounce<T>(func: (...args: T[]) => unknown, delay: number): typeof func {\n let timeout: number;\n return function (...args: T[]) {\n if (timeout != null) {\n clearTimeout(timeout);\n }\n timeout = window.setTimeout(() => func(...args), delay);\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [TAG_NAME]: ComboBox;\n }\n}\n\nimport style from \"./style.scss?inline\";\nimport toggleSvg from \"./toggle.svg?raw\";\nimport clearSvg from \"./clear.svg?raw\";\nimport ImageTools from \"@cas-smartdesign/image-tools\";\n\nexport type ComboBoxValue = {\n index: number;\n item: ItemData | any;\n};\nexport type InMemoryFilter = (filterText: string, item: any) => boolean;\nexport type DataResponse = {\n items: any[];\n finalSizeIsKnown: boolean;\n};\n\nlet idCounter = 0;\n\nexport interface ISelectionEvent {\n selection: ComboBoxValue | string;\n isCustomValue: boolean;\n}\nexport interface IFilterChangeEvent {\n value: string;\n}\n\nexport interface CustomEventMap extends InputCustomEventMap {\n \"selection-change\": CustomEvent<ISelectionEvent>;\n \"filter-change\": CustomEvent<IFilterChangeEvent>;\n}\n\nexport default interface ComboBox {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport default class ComboBox extends SDInput {\n public static readonly ID: string = TAG_NAME;\n public static ensureDefined = (): void => {\n VirtualList.ensureDefined();\n if (!customElements.get(ComboBox.ID)) {\n customElements.define(ComboBox.ID, ComboBox);\n }\n };\n static formAssociated = true;\n\n private static readonly DATA_REQUEST_CANCELLED: string = \"cancel_data_request\";\n\n @property({ type: Boolean, reflect: true })\n public opened = false;\n @property({ type: Number, attribute: \"item-height\" })\n public itemHeight = 50;\n @property({ type: Boolean, attribute: \"allow-custom-value\", reflect: true })\n public allowCustomValue: boolean;\n @property({ type: Boolean, attribute: \"trigger-only\", reflect: true })\n public triggerOnly: boolean;\n @property({ type: Boolean, attribute: \"null-setting-disallowed\", reflect: true })\n public nullSettingDisallowed: boolean;\n @property({ type: Boolean, attribute: \"show-icon\", reflect: true })\n public showIcon: boolean;\n @property({ type: String, attribute: \"display-value-path\", noAccessor: true })\n public displayValuePath = \"caption\";\n @property({ type: String, attribute: \"filter-property\", noAccessor: true })\n public filterProperty: string;\n @property({ type: String, attribute: true, reflect: true })\n public id: string = ComboBox.ID + \"_\" + idCounter++;\n\n public inMemoryFilter: InMemoryFilter = (filterText, item) => {\n if (!filterText) {\n return true;\n }\n const lowerCaseFilter = filterText.toLowerCase();\n if (typeof item.caption == \"string\" && item.caption.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n if (typeof item.description == \"string\" && item.description.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n return false;\n };\n\n public filterText: string;\n public minimumOverlayWidth = 250;\n\n private _comboBoxValue: ComboBoxValue | string;\n private _clearButton: SVGElement;\n private _toggleButton: SVGElement;\n private _popper: Popper;\n private _list: VirtualList;\n private _dataProvider: ListDataProvider;\n private _itemGenerator: ItemGenerator = generator;\n private _itemCache: any[] = [];\n private _declarativeItems: HTMLElement[];\n private _onDataRequest: (filterText: string, page: number) => Promise<DataResponse>;\n private _pendingDataRequest: { cancel: (reason?: any) => void };\n private _openedByFilterTextChange: boolean;\n private _lastRequestedPage: number;\n private _lastRequestedFilterText: string;\n private _icon: HTMLElement;\n\n constructor() {\n super();\n this._dataProvider = new ListDataProvider();\n this._dataProvider.finalSizeIsKnown = true;\n }\n\n public get clearFilterOnLazyLoadedSelection(): boolean {\n return this.triggerOnly;\n }\n\n /**\n * @deprecated The method should not be used.\n * Use {@link ComboBox#triggerOnly} instead.\n * @param {boolean} value\n */\n public set clearFilterOnLazyLoadedSelection(value: boolean) {\n console.warn(\n \"Using clearFilterOnLazyLoadedSelection setting on a combo-box is deprecated. Use triggerOnly instead.\",\n );\n this.triggerOnly = value;\n }\n\n public get itemGenerator(): ItemGenerator {\n return this._itemGenerator;\n }\n\n public set itemGenerator(value: ItemGenerator) {\n this._itemGenerator = value;\n if (this._list) {\n this._list.itemGenerator = this._itemGenerator;\n }\n }\n\n public get items(): any[] {\n return this._itemCache;\n }\n\n public set items(items: any[]) {\n this._itemCache = items;\n if (this.isLazyLoadConfigured) {\n this._dataProvider.items = items;\n this._lastRequestedPage = null;\n }\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n this.filterItemsInMemory();\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n public get finalSizeIsKnown(): boolean {\n return this._dataProvider.finalSizeIsKnown;\n }\n\n public set finalSizeIsKnown(value: boolean) {\n this._dataProvider.finalSizeIsKnown = value;\n }\n\n public configureLazyLoad(onDataRequest: (filterText: string, page: number) => Promise<DataResponse>): void {\n if (!onDataRequest) {\n throw new Error(\"It is not possible to configure lazy load without a given onDataRequest calback.\");\n }\n this._dataProvider.finalSizeIsKnown = false;\n this._onDataRequest = onDataRequest;\n this._dataProvider.onDataRequest = (page: number) => {\n this.requestData(page, false);\n };\n }\n\n public get comboBoxValue(): ComboBoxValue | string {\n return this._comboBoxValue;\n }\n\n public set comboBoxValue(value: ComboBoxValue | string) {\n this._comboBoxValue = value;\n this.updateInputValue(null);\n this.updateHasValue();\n }\n\n public get selectedIndex(): number {\n if (this.isCustomValue(this.comboBoxValue) || !this.comboBoxValue) {\n return -1;\n }\n return this.comboBoxValue.index;\n }\n\n public get displayValue(): string {\n return this.value;\n }\n\n public open(): void {\n this.opened = true;\n }\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n\n public render(): TemplateResult {\n return html`\n ${super.render()}\n <slot @slotchange=${this.onDefaultSlotChange} id=\"default-slot\"></slot>\n `;\n }\n\n public attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue !== newValue) {\n switch (name) {\n case \"opened\": {\n this.handleOpenedStateChange();\n break;\n }\n case \"item-height\": {\n if (this._list) {\n this._list.itemHeight = this.itemHeight;\n }\n break;\n }\n case \"id\": {\n this.updateListId();\n break;\n }\n }\n }\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n window.requestAnimationFrame(() => {\n this.initClearButtton();\n this.initToggleButtton();\n this.updateHasValue();\n\n this.addEventListener(\"click\", () => {\n if (!this.disabled) {\n this.opened = !this.opened;\n }\n });\n this.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n if (!this.disabled) {\n this.handleKeyDown(event);\n }\n });\n });\n this.inputElement.setAttribute(\"role\", \"combobox\");\n this.inputElement.setAttribute(\"aria-autocomplete\", \"list\");\n }\n\n private updateComboBoxValueFromValue() {\n if (this.value) {\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value,\n );\n if (selectedIndex > -1) {\n this._comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else if (this.allowCustomValue) {\n this._comboBoxValue = this.value;\n } else {\n this._comboBoxValue = null;\n }\n this.updateHasValue();\n this.updateIconFromCurrentValue();\n }\n }\n\n public updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has(\"showIcon\")) {\n if (this.showIcon) {\n if (this._icon == null) {\n this.initIconWrapper();\n }\n } else if (this._icon != null) {\n this._icon.remove();\n this._icon = null;\n }\n }\n if (changedProperties.has(\"currentText\")) {\n this.updateHasValue();\n }\n if (changedProperties.has(\"triggerOnly\") && this._list) {\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n }\n }\n\n private initIconWrapper() {\n this._icon = document.createElement(\"div\");\n this._icon.className = \"icon-wrapper\";\n this._icon.role = \"img\";\n const iconEl = document.createElement(\"div\");\n iconEl.style.backgroundRepeat = \"no-repeat\";\n iconEl.style.backgroundPosition = \"center\";\n iconEl.style.backgroundSize = \"cover\";\n iconEl.style.height = \"24px\";\n iconEl.style.width = \"24px\";\n this._icon.appendChild(iconEl);\n this._icon.slot = \"prefix\";\n this.appendChild(this._icon);\n this.updateIconFromCurrentValue();\n }\n\n private updateIconFromCurrentValue() {\n if (this.isCustomValue(this.comboBoxValue)) {\n this.updateIcon(null);\n } else {\n this.updateIcon(this.comboBoxValue?.item);\n }\n }\n\n private updateIcon(item) {\n if (this._icon) {\n if (item && (item.icon || item.iconPlaceholder)) {\n const selectedItem = item as {\n iconBackgroundColor?: string;\n attributes?: Record<string, string>;\n };\n if (selectedItem.attributes == null) {\n this._icon.title = \"\";\n this._icon.ariaLabel = \"\";\n } else {\n this._icon.title = selectedItem.attributes[\"icon-attr-title\"] ?? \"\";\n this._icon.ariaLabel = selectedItem.attributes[\"icon-attr-aria-label\"] ?? \"\";\n }\n this._icon.style.backgroundColor = selectedItem.iconBackgroundColor;\n this._icon.style.display = \"\";\n ImageTools.showImage(this._icon.querySelector(\"div\"), item.icon, item.iconPlaceholder);\n } else if (this._icon) {\n this._icon.style.display = \"none\";\n }\n }\n }\n\n private updateHasValue() {\n if (this.currentText || (this.comboBoxValue != null && this.comboBoxValue != \"\")) {\n this.setAttribute(\"has-value\", \"\");\n if (this._clearButton) {\n this._clearButton.style.display = \"\";\n }\n } else {\n this.removeAttribute(\"has-value\");\n }\n }\n\n protected shouldFloat() {\n return super.shouldFloat() || (this.comboBoxValue != null && this.comboBoxValue != \"\");\n }\n\n private initClearButtton(): void {\n const clearButtonTemplate = document.createElement(\"template\");\n clearButtonTemplate.innerHTML = clearSvg;\n this._clearButton = clearButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._clearButton);\n\n this._clearButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n this.clearValue();\n });\n }\n\n private initToggleButtton(): void {\n const toggleButtonTemplate = document.createElement(\"template\");\n toggleButtonTemplate.innerHTML = toggleSvg;\n this._toggleButton = toggleButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._toggleButton);\n\n this._toggleButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = !this.opened;\n this.select();\n });\n }\n\n private debouncedFilterItemsInMemory = debounce(this.filterItemsInMemory.bind(this), 200);\n private filterItemsInMemory(): void {\n if (this.isLazyLoadConfigured) {\n return;\n }\n let filteredInMemory = false;\n if (this.filterText) {\n if (this.filterProperty) {\n this._dataProvider.items = this._itemCache.filter((item) => {\n return item[this.filterProperty] && String(item[this.filterProperty]).indexOf(this.filterText) > -1;\n });\n filteredInMemory = true;\n } else if (this.inMemoryFilter) {\n this._dataProvider.items = this._itemCache.filter((item) => this.inMemoryFilter(this.filterText, item));\n filteredInMemory = true;\n }\n }\n if (!filteredInMemory) {\n this._dataProvider.items = this._itemCache;\n if (this._list) {\n this.updateFocusAndSelectedIndexFromValue();\n }\n } else if (this._list) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n let index = this._dataProvider.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this._dataProvider.items.findIndex((item: any) => item.id == selectedId);\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = null;\n }\n }\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n private ensureListAndPopperInitialized(): void {\n if (!this._list) {\n this._list = document.createElement(VirtualList.ID) as VirtualList;\n this.updateListId();\n this._list.classList.add(\"combo-box-dropdown\");\n this._list.itemHeight = this.itemHeight;\n this._list.itemGenerator = this.itemGenerator;\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n this._list.setAttribute(\"focus-target\", \"\");\n Object.assign(this._list.style, {\n zIndex: \"21000\",\n boxShadow: `rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,\n rgba(0, 0, 0, 0.12) 0px 1px 5px 0px,\n rgba(0, 0, 0, 0.2) 0px 3px 1px -2px`,\n background: \"white\",\n overflowY: \"auto\",\n });\n this._list.addEventListener(\"selection\", this.handleSelection);\n this._dataProvider.connectList(this._list);\n }\n if (!this._popper) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const comboBox = this;\n this._popper = createPopper(this, this._list, {\n placement: \"bottom-start\",\n modifiers: [\n {\n name: \"computeStyles\",\n options: {\n gpuAcceleration: true,\n },\n },\n {\n name: \"hide\",\n enabled: false,\n },\n {\n name: \"closeIfReferenceHidden\",\n enabled: true,\n phase: \"afterWrite\",\n fn({ state }) {\n const comboBox = state.elements.reference as ComboBox;\n comboBox.closeIfNotVisible();\n },\n },\n {\n name: \"offset\",\n options: {\n offset: ({ placement }) => {\n if (placement.indexOf(\"top\") > -1) {\n return [0, -parseInt(getComputedStyle(comboBox).paddingTop, 10)];\n }\n if (placement.indexOf(\"bottom\") > -1) {\n return [0, -parseInt(getComputedStyle(comboBox).paddingBottom, 10)];\n }\n return [0, 0];\n },\n },\n },\n {\n name: \"adjustWidthIfNeeded\",\n enabled: true,\n phase: \"read\",\n fn({ state }) {\n const list = state.elements.popper as VirtualList;\n list.increaseWidthOnNextRenderIfNeeded();\n },\n },\n ],\n });\n }\n }\n\n private closeIfNotVisible(): void {\n const elementFromPoint = this.elementFromMiddleOfComboBox();\n // elementFromPoint might be the list itself in Safari, thus it needs to be checked as well (Fixes: 244485)\n if (\n !this.contains(elementFromPoint) &&\n !this.shadowRoot.contains(elementFromPoint) &&\n elementFromPoint !== this._list\n ) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n }\n\n private elementFromMiddleOfComboBox(): Element {\n const rect = this.getBoundingClientRect();\n return document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);\n }\n\n private handleSelection = (event: CustomEvent) => {\n const selectedItem = this._dataProvider.items[event.detail.index];\n if (!event.detail.selected) {\n // null selection is not allowed via clicking inside the dropdown\n this._list.selectedIndices = [event.detail.index];\n }\n this.comboBoxValue = { index: this._itemCache.indexOf(selectedItem), item: selectedItem };\n this.dispatchSelectionChangeEvent();\n this.opened = false;\n };\n\n private async handleOpenedStateChange(): Promise<void> {\n this.inputElement.setAttribute(\"aria-expanded\", String(this.opened));\n if (this.opened) {\n if (!this.disabled) {\n this.ensureListAndPopperInitialized();\n\n const filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n if (this.isLazyLoadConfigured && (this.items.length == 0 || filterChanged)) {\n this.requestData(0, filterChanged);\n }\n\n this.updateDropdownSizes();\n this.ownerDocument.body.appendChild(this._list);\n this.updateFocusAndSelectedIndexFromValue();\n\n window.requestAnimationFrame(() => {\n if (this._popper) {\n this._popper.update();\n }\n });\n\n window.addEventListener(\"pointerdown\", this.handleWindowPointerDown);\n\n if (!this.allowCustomValue && !this._openedByFilterTextChange) {\n this.select();\n }\n }\n this._openedByFilterTextChange = false;\n } else {\n await this._list.updateComplete;\n if (this._popper) {\n await this._popper.update;\n }\n this.ownerDocument.body.removeChild(this._list);\n window.removeEventListener(\"pointerdown\", this.handleWindowPointerDown);\n this.updateValueOnClose();\n this.clearFilter();\n this.setSelectionRange(0, 0);\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n }\n\n private updateValueOnClose(): void {\n const oldValue = this.comboBoxValue ?? \"\";\n if (this.nullSettingDisallowed && !this.value && this.comboBoxValue) {\n this.restorePreviousSelection();\n } else if (this.value !== (this.convertToDisplayValue(null) ?? \"\")) {\n // value change only if needed\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n disabled?: boolean;\n };\n if (focusedItem && (focusedItem[this.displayValuePath] ?? \"\") === this.value) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n // 1. select focused item if the input's value is the same\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n } else if (this.allowCustomValue || !this.value) {\n // 2. set as a custom or empty value\n this.comboBoxValue = this.value;\n } else {\n // 3. try to search for an identical item\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value && !item.disabled,\n );\n if (selectedIndex > -1) {\n this.comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else {\n this.restorePreviousSelection(); // Fixes C1XRTYID\n }\n }\n } else {\n // Allow selecting another item with same caption but different id\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n id?: string;\n disabled?: boolean;\n };\n if (focusedItem && focusedItem.id != null) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n if (\n !this.comboBoxValue ||\n this.isCustomValue(this.comboBoxValue) ||\n this.comboBoxValue.item.id != focusedItem.id\n ) {\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n }\n }\n }\n if (oldValue !== (this.comboBoxValue ?? \"\")) {\n this.dispatchSelectionChangeEvent();\n }\n this.updateIcon(this.isCustomValue(this.comboBoxValue) ? null : this.comboBoxValue?.item);\n }\n\n private restorePreviousSelection() {\n this.updateInputValue(null);\n }\n\n private updateFocusAndSelectedIndexFromValue(): void {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue) && !this._openedByFilterTextChange) {\n let index = this.comboBoxValue.index;\n if (index == -1 || this.isLazyLoadConfigured) {\n index = this.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = -1;\n this._list.selectedIndices = [];\n }\n this.updateActiveDescendant();\n }\n\n private handleWindowPointerDown = (event: PointerEvent) => {\n const contains = event.target instanceof Node && this.contains(event.target);\n if (!contains && this.opened && event.composedPath().indexOf(this._list) === -1) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Down\":\n case \"ArrowDown\": {\n event.preventDefault();\n this.navigateInList(+1);\n break;\n }\n case \"Up\":\n case \"ArrowUp\": {\n event.preventDefault();\n this.navigateInList(-1);\n break;\n }\n case \"Enter\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n }\n break;\n }\n case \"Escape\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n if (\n this._list.selectedIndices.indexOf(this._list.focusIndex) > -1 &&\n this._dataProvider.items.length > this._list.focusIndex\n ) {\n this.opened = false;\n } else {\n this.clearFilter();\n this.updateInputValue(null);\n this.updateFocusAndSelectedIndexFromValue();\n if (!this._list.selectedIndices.includes(this._list.focusIndex)) {\n this._list.selectedIndices.push(this._list.focusIndex);\n }\n }\n }\n break;\n }\n case \"Tab\": {\n if (this.opened) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n break;\n }\n }\n };\n\n private navigateInList(offset: number): void {\n if (!this.opened) {\n this.opened = true;\n } else {\n if (this._list.focusIndex == null) {\n if (offset > 0) {\n this._list.focusIndex = 0;\n } else {\n this._list.focusIndex = Math.max(0, this._dataProvider.items.length - 1);\n }\n } else {\n this._list.focusIndex = Math.max(\n 0,\n Math.min(this._dataProvider.items.length - 1, this._list.focusIndex + offset),\n );\n }\n this.updateInputValue(this._dataProvider.items[this._list.focusIndex] as ItemData | any);\n this.updateActiveDescendant();\n if (!this.allowCustomValue) {\n this.select();\n }\n }\n }\n\n private updateActiveDescendant() {\n const focusedListItem = this._list && this._list.getListItem(this._list.focusIndex);\n if (focusedListItem) {\n this.inputElement.setAttribute(\"aria-activedescendant\", focusedListItem.id);\n } else {\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n }\n }\n\n private updateInputValue(item: ItemData): void {\n this.updateComplete.then(() => {\n this.value = this.convertToDisplayValue(item);\n if (item) {\n this.updateIcon(item);\n } else {\n this.updateIconFromCurrentValue();\n }\n });\n }\n\n private convertToDisplayValue(item: ItemData): string {\n if (item) {\n return item[this.displayValuePath];\n } else if (this.comboBoxValue) {\n if (this.isCustomValue(this.comboBoxValue)) {\n return this.comboBoxValue;\n } else {\n return this.comboBoxValue.item[this.displayValuePath];\n }\n } else {\n return null;\n }\n }\n\n protected fireValueChange(immediate?: boolean): void {\n if (immediate) {\n if (this.filterText !== this.value) {\n const effectiveFilterChange = (this.filterText ?? \"\") !== this.value;\n this.filterText = this.value;\n this.updateIcon(null);\n if (!this.opened) {\n this._openedByFilterTextChange = true;\n this.opened = true;\n }\n if (effectiveFilterChange) {\n this.dispatchFilterChangeEvent();\n this.debouncedFilterItemsInMemory();\n }\n }\n }\n // consume both change events triggered from input, combo box provides a different API for that\n }\n\n private clearValue(): void {\n if (!this.nullSettingDisallowed) {\n this.value = null;\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n if (this._list) {\n this._list.selectedIndices = [];\n }\n this.clearFilter();\n if (this.comboBoxValue) {\n this.comboBoxValue = null;\n this.dispatchSelectionChangeEvent();\n }\n this.requestUpdate();\n }\n }\n\n private clearFilter(): void {\n if (this.filterText != null) {\n this.filterText = undefined;\n this.filterItemsInMemory();\n this.dispatchFilterChangeEvent();\n this.updateIconFromCurrentValue();\n }\n }\n\n private updateDropdownSizes(): void {\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight;\n const overlayMaxHeight = (viewportHeight - this.offsetHeight) * 0.5;\n Object.assign(this._list.style, {\n maxHeight: `${overlayMaxHeight}px`,\n minWidth: `${Math.max(this.offsetWidth, this.minimumOverlayWidth)}px`,\n maxWidth: `max(50vw, ${this.offsetWidth}px)`,\n });\n }\n\n private updateListId() {\n if (this.inputElement && this._list) {\n this._list.id = this.id + \"_list\";\n this.inputElement.setAttribute(\"aria-controls\", this._list.id);\n }\n }\n\n private isCustomValue(value: ComboBoxValue | string): value is string {\n return typeof value === \"string\";\n }\n\n private dispatchSelectionChangeEvent(): void {\n this.updateComplete\n .then(() => {\n this.dispatchEvent(\n new CustomEvent<ISelectionEvent>(\"selection-change\", {\n detail: {\n selection: this.comboBoxValue,\n isCustomValue: this.isCustomValue(this.comboBoxValue),\n },\n }),\n );\n if (this.triggerOnly) {\n this.comboBoxValue = null;\n } else {\n const comboBoxValue = this.comboBoxValue;\n if (this.isCustomValue(comboBoxValue)) {\n this.setFormValue(comboBoxValue);\n } else {\n this.setFormValue(comboBoxValue?.item?.caption);\n }\n }\n })\n .catch((e) => {\n console.error(\"Could not dispatch selection change event due to:\", e);\n });\n }\n\n private dispatchFilterChangeEvent(): void {\n this.dispatchEvent(\n new CustomEvent<IFilterChangeEvent>(\"filter-change\", {\n detail: { value: this.filterText },\n composed: true,\n }),\n );\n this.debouncedRequestData(0);\n }\n\n private get isLazyLoadConfigured(): boolean {\n return !!this._onDataRequest;\n }\n\n /**\n * Used only when lazy loading is configured.\n */\n private debouncedRequestData = debounce(this.requestData.bind(this), 250);\n private requestData(page: number, filterChanged?: boolean) {\n if (filterChanged == null) {\n filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n }\n if (this.isLazyLoadConfigured) {\n if (!this.opened) {\n if (filterChanged) {\n this._dataProvider.items = [];\n this._itemCache = [];\n }\n return;\n }\n if (this._lastRequestedPage == page && !filterChanged) {\n return;\n }\n if (this._pendingDataRequest) {\n this._pendingDataRequest.cancel(ComboBox.DATA_REQUEST_CANCELLED);\n }\n const cancellationPromise = new Promise<DataResponse>((_resolve, reject) => {\n this._pendingDataRequest = { cancel: reject };\n });\n this._lastRequestedPage = page;\n this._lastRequestedFilterText = this.filterText;\n this.setAttribute(\"loading\", \"\");\n Promise.race([cancellationPromise, this._onDataRequest(this._lastRequestedFilterText, page)])\n .then((dataResponse) => {\n if (this.filterText == this._lastRequestedFilterText && this._lastRequestedPage == page) {\n this._dataProvider.finalSizeIsKnown = dataResponse.finalSizeIsKnown;\n if (filterChanged) {\n this._dataProvider.items = dataResponse.items;\n this._itemCache = dataResponse.items;\n } else {\n this._dataProvider.addItems(dataResponse.items);\n this._itemCache = this._dataProvider.items;\n }\n if (this._list) {\n this._list.itemCount = this._dataProvider.items.length;\n }\n if (this._popper && this.opened) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n const selectedItem = this.comboBoxValue.item;\n if (\n this._list.selectedIndices.length == 0 ||\n this.items[this._list.selectedIndices[0]] != selectedItem\n ) {\n let index = this.items.indexOf(selectedItem);\n if (index == -1) {\n const selectedId = selectedItem.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n this.comboBoxValue.index = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n }\n }\n this.updateDropdownSizes();\n this._popper.update();\n }\n }\n this._pendingDataRequest = null;\n this.removeAttribute(\"loading\");\n })\n .catch((e) => {\n if (e !== ComboBox.DATA_REQUEST_CANCELLED) {\n console.error(\n `Data could not be loaded for filter \"${this._lastRequestedFilterText}\" and page number \"${page}\" due to the following error:\\n${e}`,\n );\n this._dataProvider.finalSizeIsKnown = true;\n\n if (this.items.length == 0) {\n this.opened = false;\n } else if (this._list) {\n this._list.itemCount = this.items.length;\n }\n this.removeAttribute(\"loading\");\n }\n this._pendingDataRequest = null;\n });\n }\n }\n\n private get defaultSlot(): HTMLSlotElement {\n return this.shadowRoot.querySelector(\"#default-slot\");\n }\n\n private onDefaultSlotChange(): void {\n this._declarativeItems = this.defaultSlot.assignedElements() as HTMLElement[];\n if (this._declarativeItems.length > 0) {\n this.finalSizeIsKnown = true;\n this.itemGenerator = (_data, index) => {\n return this._declarativeItems[index].cloneNode(true) as HTMLElement;\n };\n this.items = this._declarativeItems.map((item) => {\n const data = {\n caption: item.getAttribute(\"caption\"),\n description: item.getAttribute(\"description\"),\n };\n if (\"caption\" != this.displayValuePath && \"description\" != this.displayValuePath) {\n data[this.displayValuePath] =\n item[this.displayValuePath] || item.getAttribute(this.displayValuePath);\n }\n return data;\n });\n }\n }\n}\n\nComboBox.ensureDefined();\n"],"names":["toggleSvg","clearSvg","TAG_NAME","debounce","func","delay","timeout","args","idCounter","_ComboBox","_a","SDInput","filterText","item","lowerCaseFilter","generator","event","selectedItem","ListDataProvider","value","items","onDataRequest","page","css","unsafeCSS","style","html","name","oldValue","newValue","changedProperties","selectedIndex","SelectionType","iconEl","ImageTools","clearButtonTemplate","toggleButtonTemplate","filteredInMemory","index","selectedId","VirtualList","comboBox","createPopper","state","placement","elementFromPoint","rect","filterChanged","focusedItem","offset","focusedListItem","immediate","effectiveFilterChange","overlayMaxHeight","comboBoxValue","e","cancellationPromise","_resolve","reject","dataResponse","_data","data","__decorateClass","property","ComboBox"],"mappings":";;;;;;;ukKAAeA,IAAA;AAAA;AAAA;AAAA,GCAAC,IAAA;AAAA;AAAA;AAAA;;;;;;ACQf,MAAMC,IAAW;AAEjB,SAASC,EAAYC,GAAiCC,GAA4B;AAC1E,MAAAC;AACJ,SAAO,YAAaC,GAAW;AAC3B,IAAID,KAAW,QACX,aAA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M,QAAQ,WAAW,sBAAsB,YAAY,IAAM;AAAA,GAxB5DtD,EAyBV,WAAA,oBAAA,CAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,mBAAmB,YAAY,IAAM;AAAA,GA1BzDtD,EA2BV,WAAA,kBAAA,CAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,IAAM,SAAS,IAAM;AAAA,GA5BzCtD,EA6BV,WAAA,MAAA,CAAA;AA7BX,IAAqBuD,IAArBvD;AA48BAuD,EAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"combo-box.mjs","sources":["../toggle.svg?raw","../clear.svg?raw","../combo-box.ts"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"toggle-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M13 4v2l-5 5-5-5v-2l5 5z\\\"/>\\r\\n</svg>\\r\\n\"","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"clear-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M12.96 4.46l-1.42-1.42-3.54 3.55-3.54-3.55-1.42 1.42 3.55 3.54-3.55 3.54 1.42 1.42 3.54-3.55 3.54 3.55 1.42-1.42-3.55-3.54 3.55-3.54z\\\"/>\\r\\n</svg>\\r\\n\"","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { unsafeCSS, PropertyValues, css, TemplateResult, html } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { createPopper, Instance as Popper } from \"@popperjs/core\";\nimport SDInput, { CustomEventMap as InputCustomEventMap } from \"@cas-smartdesign/lit-input\";\nimport VirtualList, { SelectionType, ItemGenerator, ListDataProvider } from \"@cas-smartdesign/virtual-list\";\nimport { ItemData, generator } from \"@cas-smartdesign/list-item\";\n\nconst TAG_NAME = \"sd-combo-box\";\n\nfunction debounce<T>(func: (...args: T[]) => unknown, delay: number): typeof func {\n let timeout: number;\n return function (...args: T[]) {\n if (timeout != null) {\n clearTimeout(timeout);\n }\n timeout = window.setTimeout(() => func(...args), delay);\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [TAG_NAME]: ComboBox;\n }\n}\n\nimport style from \"./style.scss?inline\";\nimport toggleSvg from \"./toggle.svg?raw\";\nimport clearSvg from \"./clear.svg?raw\";\nimport ImageTools from \"@cas-smartdesign/image-tools\";\n\nexport type ComboBoxValue = {\n index: number;\n item: ItemData | any;\n};\nexport type InMemoryFilter = (filterText: string, item: any) => boolean;\nexport type DataResponse = {\n items: any[];\n finalSizeIsKnown: boolean;\n};\n\nlet idCounter = 0;\n\nexport interface ISelectionEvent {\n selection: ComboBoxValue | string;\n isCustomValue: boolean;\n}\nexport interface IFilterChangeEvent {\n value: string;\n}\n\nexport interface CustomEventMap extends InputCustomEventMap {\n \"selection-change\": CustomEvent<ISelectionEvent>;\n \"filter-change\": CustomEvent<IFilterChangeEvent>;\n}\n\nexport default interface ComboBox {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport default class ComboBox extends SDInput {\n public static readonly ID: string = TAG_NAME;\n public static ensureDefined = (): void => {\n VirtualList.ensureDefined();\n if (!customElements.get(ComboBox.ID)) {\n customElements.define(ComboBox.ID, ComboBox);\n }\n };\n static formAssociated = true;\n\n private static readonly DATA_REQUEST_CANCELLED: string = \"cancel_data_request\";\n\n @property({ type: Boolean, reflect: true })\n public opened = false;\n @property({ type: Number, attribute: \"item-height\" })\n public itemHeight = 50;\n @property({ type: Boolean, attribute: \"allow-custom-value\", reflect: true })\n public allowCustomValue: boolean;\n @property({ type: Boolean, attribute: \"trigger-only\", reflect: true })\n public triggerOnly: boolean;\n @property({ type: Boolean, attribute: \"null-setting-disallowed\", reflect: true })\n public nullSettingDisallowed: boolean;\n @property({ type: Boolean, attribute: \"show-icon\", reflect: true })\n public showIcon: boolean;\n @property({ type: String, attribute: \"display-value-path\", noAccessor: true })\n public displayValuePath = \"caption\";\n @property({ type: String, attribute: \"filter-property\", noAccessor: true })\n public filterProperty: string;\n @property({ type: String, attribute: true, reflect: true })\n public id: string = ComboBox.ID + \"_\" + idCounter++;\n\n public inMemoryFilter: InMemoryFilter = (filterText, item) => {\n if (!filterText) {\n return true;\n }\n const lowerCaseFilter = filterText.toLowerCase();\n if (typeof item.caption == \"string\" && item.caption.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n if (typeof item.description == \"string\" && item.description.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n return false;\n };\n\n public filterText: string;\n public minimumOverlayWidth = 250;\n\n private _comboBoxValue: ComboBoxValue | string;\n private _clearButton: SVGElement;\n private _toggleButton: SVGElement;\n private _popper: Popper;\n private _list: VirtualList;\n private _dataProvider: ListDataProvider;\n private _itemGenerator: ItemGenerator = generator;\n private _itemCache: any[] = [];\n private _declarativeItems: HTMLElement[];\n private _onDataRequest: (filterText: string, page: number) => Promise<DataResponse>;\n private _pendingDataRequest: { cancel: (reason?: any) => void };\n private _openedByFilterTextChange: boolean;\n private _lastRequestedPage: number;\n private _lastRequestedFilterText: string;\n private _icon: HTMLElement;\n\n constructor() {\n super();\n this._dataProvider = new ListDataProvider();\n this._dataProvider.finalSizeIsKnown = true;\n }\n\n public get clearFilterOnLazyLoadedSelection(): boolean {\n return this.triggerOnly;\n }\n\n /**\n * @deprecated The method should not be used.\n * Use {@link ComboBox#triggerOnly} instead.\n * @param {boolean} value\n */\n public set clearFilterOnLazyLoadedSelection(value: boolean) {\n console.warn(\n \"Using clearFilterOnLazyLoadedSelection setting on a combo-box is deprecated. Use triggerOnly instead.\",\n );\n this.triggerOnly = value;\n }\n\n public get itemGenerator(): ItemGenerator {\n return this._itemGenerator;\n }\n\n public set itemGenerator(value: ItemGenerator) {\n this._itemGenerator = value;\n if (this._list) {\n this._list.itemGenerator = this._itemGenerator;\n }\n }\n\n public get items(): any[] {\n return this._itemCache;\n }\n\n public set items(items: any[]) {\n this._itemCache = items;\n if (this.isLazyLoadConfigured) {\n this._dataProvider.items = items;\n this._lastRequestedPage = null;\n }\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n this.filterItemsInMemory();\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n public get finalSizeIsKnown(): boolean {\n return this._dataProvider.finalSizeIsKnown;\n }\n\n public set finalSizeIsKnown(value: boolean) {\n this._dataProvider.finalSizeIsKnown = value;\n }\n\n public configureLazyLoad(onDataRequest: (filterText: string, page: number) => Promise<DataResponse>): void {\n if (!onDataRequest) {\n throw new Error(\"It is not possible to configure lazy load without a given onDataRequest calback.\");\n }\n this._dataProvider.finalSizeIsKnown = false;\n this._onDataRequest = onDataRequest;\n this._dataProvider.onDataRequest = (page: number) => {\n this.requestData(page, false);\n };\n }\n\n public get comboBoxValue(): ComboBoxValue | string {\n return this._comboBoxValue;\n }\n\n public set comboBoxValue(value: ComboBoxValue | string) {\n this._comboBoxValue = value;\n this.updateInputValue(null);\n this.updateHasValue();\n }\n\n public get selectedIndex(): number {\n if (this.isCustomValue(this.comboBoxValue) || !this.comboBoxValue) {\n return -1;\n }\n return this.comboBoxValue.index;\n }\n\n public get displayValue(): string {\n return this.value;\n }\n\n public open(): void {\n this.opened = true;\n }\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n\n public render(): TemplateResult {\n return html`\n ${super.render()}\n <slot @slotchange=${this.onDefaultSlotChange} id=\"default-slot\"></slot>\n `;\n }\n\n public attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue !== newValue) {\n switch (name) {\n case \"opened\": {\n this.handleOpenedStateChange();\n break;\n }\n case \"item-height\": {\n if (this._list) {\n this._list.itemHeight = this.itemHeight;\n }\n break;\n }\n case \"id\": {\n this.updateListId();\n break;\n }\n }\n }\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n window.requestAnimationFrame(() => {\n this.initClearButtton();\n this.initToggleButtton();\n this.updateHasValue();\n\n this.addEventListener(\"click\", () => {\n if (!this.disabled) {\n this.opened = !this.opened;\n }\n });\n this.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n if (!this.disabled) {\n this.handleKeyDown(event);\n }\n });\n });\n this.inputElement.setAttribute(\"role\", \"combobox\");\n this.inputElement.setAttribute(\"aria-autocomplete\", \"list\");\n }\n\n private updateComboBoxValueFromValue() {\n if (this.value) {\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value,\n );\n if (selectedIndex > -1) {\n this._comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else if (this.allowCustomValue) {\n this._comboBoxValue = this.value;\n } else {\n this._comboBoxValue = null;\n }\n this.updateHasValue();\n this.updateIconFromCurrentValue();\n }\n }\n\n public updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has(\"showIcon\")) {\n if (this.showIcon) {\n if (this._icon == null) {\n this.initIconWrapper();\n }\n } else if (this._icon != null) {\n this._icon.remove();\n this._icon = null;\n }\n }\n if (changedProperties.has(\"currentText\")) {\n this.updateHasValue();\n }\n if (changedProperties.has(\"triggerOnly\") && this._list) {\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n }\n }\n\n private initIconWrapper() {\n this._icon = document.createElement(\"div\");\n this._icon.className = \"icon-wrapper\";\n this._icon.role = \"img\";\n const iconEl = document.createElement(\"div\");\n iconEl.style.backgroundRepeat = \"no-repeat\";\n iconEl.style.backgroundPosition = \"center\";\n iconEl.style.backgroundSize = \"cover\";\n iconEl.style.height = \"24px\";\n iconEl.style.width = \"24px\";\n this._icon.appendChild(iconEl);\n this._icon.slot = \"prefix\";\n this.appendChild(this._icon);\n this.updateIconFromCurrentValue();\n }\n\n private updateIconFromCurrentValue() {\n if (this.isCustomValue(this.comboBoxValue)) {\n this.updateIcon(null);\n } else {\n this.updateIcon(this.comboBoxValue?.item);\n }\n }\n\n private updateIcon(item) {\n if (this._icon) {\n if (item && (item.icon || item.iconPlaceholder)) {\n const selectedItem = item as {\n iconBackgroundColor?: string;\n attributes?: Record<string, string>;\n };\n if (selectedItem.attributes == null) {\n this._icon.title = \"\";\n this._icon.ariaLabel = \"\";\n } else {\n this._icon.title = selectedItem.attributes[\"icon-attr-title\"] ?? \"\";\n this._icon.ariaLabel = selectedItem.attributes[\"icon-attr-aria-label\"] ?? \"\";\n }\n this._icon.style.backgroundColor = selectedItem.iconBackgroundColor;\n this._icon.style.display = \"\";\n ImageTools.showImage(this._icon.querySelector(\"div\"), item.icon, item.iconPlaceholder);\n } else if (this._icon) {\n this._icon.style.display = \"none\";\n }\n }\n }\n\n private updateHasValue() {\n if (this.currentText || (this.comboBoxValue != null && this.comboBoxValue != \"\")) {\n this.setAttribute(\"has-value\", \"\");\n if (this._clearButton) {\n this._clearButton.style.display = \"\";\n }\n } else {\n this.removeAttribute(\"has-value\");\n }\n }\n\n protected shouldFloat() {\n return super.shouldFloat() || (this.comboBoxValue != null && this.comboBoxValue != \"\");\n }\n\n private initClearButtton(): void {\n const clearButtonTemplate = document.createElement(\"template\");\n clearButtonTemplate.innerHTML = clearSvg;\n this._clearButton = clearButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._clearButton);\n\n this._clearButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n this.clearValue();\n });\n }\n\n private initToggleButtton(): void {\n const toggleButtonTemplate = document.createElement(\"template\");\n toggleButtonTemplate.innerHTML = toggleSvg;\n this._toggleButton = toggleButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._toggleButton);\n\n this._toggleButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = !this.opened;\n this.select();\n });\n }\n\n private debouncedFilterItemsInMemory = debounce(this.filterItemsInMemory.bind(this), 200);\n private filterItemsInMemory(): void {\n if (this.isLazyLoadConfigured) {\n return;\n }\n let filteredInMemory = false;\n if (this.filterText) {\n if (this.filterProperty) {\n this._dataProvider.items = this._itemCache.filter((item) => {\n return item[this.filterProperty] && String(item[this.filterProperty]).indexOf(this.filterText) > -1;\n });\n filteredInMemory = true;\n } else if (this.inMemoryFilter) {\n this._dataProvider.items = this._itemCache.filter((item) => this.inMemoryFilter(this.filterText, item));\n filteredInMemory = true;\n }\n }\n if (!filteredInMemory) {\n this._dataProvider.items = this._itemCache;\n if (this._list) {\n this.updateFocusAndSelectedIndexFromValue();\n }\n } else if (this._list) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n let index = this._dataProvider.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this._dataProvider.items.findIndex((item: any) => item.id == selectedId);\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = null;\n }\n }\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n private ensureListAndPopperInitialized(): void {\n if (!this._list) {\n this._list = document.createElement(VirtualList.ID) as VirtualList;\n this.updateListId();\n this._list.classList.add(\"combo-box-dropdown\");\n this._list.itemHeight = this.itemHeight;\n this._list.itemGenerator = this.itemGenerator;\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n this._list.setAttribute(\"focus-target\", \"\");\n Object.assign(this._list.style, {\n zIndex: \"21000\",\n boxShadow: `rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,\n rgba(0, 0, 0, 0.12) 0px 1px 5px 0px,\n rgba(0, 0, 0, 0.2) 0px 3px 1px -2px`,\n background: \"white\",\n overflowY: \"auto\",\n });\n this._list.addEventListener(\"selection\", this.handleSelection);\n this._dataProvider.connectList(this._list);\n }\n if (!this._popper) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const comboBox = this;\n this._popper = createPopper(this, this._list, {\n placement: \"bottom-start\",\n modifiers: [\n {\n name: \"computeStyles\",\n options: {\n gpuAcceleration: true,\n },\n },\n {\n name: \"hide\",\n enabled: false,\n },\n {\n name: \"closeIfReferenceHidden\",\n enabled: true,\n phase: \"afterWrite\",\n fn({ state }) {\n const comboBox = state.elements.reference as ComboBox;\n comboBox.closeIfNotVisible();\n },\n },\n {\n name: \"offset\",\n options: {\n offset: ({ placement }) => {\n if (placement.indexOf(\"top\") > -1) {\n return [0, -parseInt(getComputedStyle(comboBox).paddingTop, 10)];\n }\n if (placement.indexOf(\"bottom\") > -1) {\n return [\n 0,\n -parseInt(getComputedStyle(comboBox).paddingBottom, 10) -\n ((\n this.shadowRoot.querySelector(\n \".validation-message-wrapper\",\n ) as HTMLElement\n )?.offsetHeight ?? 0),\n ];\n }\n return [0, 0];\n },\n },\n },\n {\n name: \"adjustWidthIfNeeded\",\n enabled: true,\n phase: \"read\",\n fn({ state }) {\n const list = state.elements.popper as VirtualList;\n list.increaseWidthOnNextRenderIfNeeded();\n },\n },\n ],\n });\n }\n }\n\n private closeIfNotVisible(): void {\n const elementFromPoint = this.elementFromMiddleOfComboBox();\n // elementFromPoint might be the list itself in Safari, thus it needs to be checked as well (Fixes: 244485)\n if (\n !this.contains(elementFromPoint) &&\n !this.shadowRoot.contains(elementFromPoint) &&\n elementFromPoint !== this._list\n ) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n }\n\n private elementFromMiddleOfComboBox(): Element {\n const rect = this.getBoundingClientRect();\n return document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);\n }\n\n private handleSelection = (event: CustomEvent) => {\n const selectedItem = this._dataProvider.items[event.detail.index];\n if (!event.detail.selected) {\n // null selection is not allowed via clicking inside the dropdown\n this._list.selectedIndices = [event.detail.index];\n }\n this.comboBoxValue = { index: this._itemCache.indexOf(selectedItem), item: selectedItem };\n this.dispatchSelectionChangeEvent();\n this.opened = false;\n };\n\n private async handleOpenedStateChange(): Promise<void> {\n this.inputElement.setAttribute(\"aria-expanded\", String(this.opened));\n if (this.opened) {\n if (!this.disabled) {\n this.ensureListAndPopperInitialized();\n\n const filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n if (this.isLazyLoadConfigured && (this.items.length == 0 || filterChanged)) {\n this.requestData(0, filterChanged);\n }\n\n this.updateDropdownSizes();\n this.ownerDocument.body.appendChild(this._list);\n this.updateFocusAndSelectedIndexFromValue();\n\n window.requestAnimationFrame(() => {\n if (this._popper) {\n this._popper.update();\n }\n });\n\n window.addEventListener(\"pointerdown\", this.handleWindowPointerDown);\n\n if (!this.allowCustomValue && !this._openedByFilterTextChange) {\n this.select();\n }\n }\n this._openedByFilterTextChange = false;\n } else {\n await this._list.updateComplete;\n if (this._popper) {\n await this._popper.update;\n }\n this.ownerDocument.body.removeChild(this._list);\n window.removeEventListener(\"pointerdown\", this.handleWindowPointerDown);\n this.updateValueOnClose();\n this.clearFilter();\n this.setSelectionRange(0, 0);\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n }\n\n private updateValueOnClose(): void {\n const oldValue = this.comboBoxValue ?? \"\";\n if (this.nullSettingDisallowed && !this.value && this.comboBoxValue) {\n this.restorePreviousSelection();\n } else if (this.value !== (this.convertToDisplayValue(null) ?? \"\")) {\n // value change only if needed\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n disabled?: boolean;\n };\n if (focusedItem && (focusedItem[this.displayValuePath] ?? \"\") === this.value) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n // 1. select focused item if the input's value is the same\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n } else if (this.allowCustomValue || !this.value) {\n // 2. set as a custom or empty value\n this.comboBoxValue = this.value;\n } else {\n // 3. try to search for an identical item\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value && !item.disabled,\n );\n if (selectedIndex > -1) {\n this.comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else {\n this.restorePreviousSelection(); // Fixes C1XRTYID\n }\n }\n } else {\n // Allow selecting another item with same caption but different id\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n id?: string;\n disabled?: boolean;\n };\n if (focusedItem && focusedItem.id != null) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n if (\n !this.comboBoxValue ||\n this.isCustomValue(this.comboBoxValue) ||\n this.comboBoxValue.item.id != focusedItem.id\n ) {\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n }\n }\n }\n if (oldValue !== (this.comboBoxValue ?? \"\")) {\n this.dispatchSelectionChangeEvent();\n }\n this.updateIcon(this.isCustomValue(this.comboBoxValue) ? null : this.comboBoxValue?.item);\n }\n\n private restorePreviousSelection() {\n this.updateInputValue(null);\n }\n\n private updateFocusAndSelectedIndexFromValue(): void {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue) && !this._openedByFilterTextChange) {\n let index = this.comboBoxValue.index;\n if (index == -1 || this.isLazyLoadConfigured) {\n index = this.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = -1;\n this._list.selectedIndices = [];\n }\n this.updateActiveDescendant();\n }\n\n private handleWindowPointerDown = (event: PointerEvent) => {\n const contains = event.target instanceof Node && this.contains(event.target);\n if (!contains && this.opened && event.composedPath().indexOf(this._list) === -1) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Down\":\n case \"ArrowDown\": {\n event.preventDefault();\n this.navigateInList(+1);\n break;\n }\n case \"Up\":\n case \"ArrowUp\": {\n event.preventDefault();\n this.navigateInList(-1);\n break;\n }\n case \"Enter\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n }\n break;\n }\n case \"Escape\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n if (\n this._list.selectedIndices.indexOf(this._list.focusIndex) > -1 &&\n this._dataProvider.items.length > this._list.focusIndex\n ) {\n this.opened = false;\n } else {\n this.clearFilter();\n this.updateInputValue(null);\n this.updateFocusAndSelectedIndexFromValue();\n if (!this._list.selectedIndices.includes(this._list.focusIndex)) {\n this._list.selectedIndices.push(this._list.focusIndex);\n }\n }\n }\n break;\n }\n case \"Tab\": {\n if (this.opened) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n break;\n }\n }\n };\n\n private navigateInList(offset: number): void {\n if (!this.opened) {\n this.opened = true;\n } else {\n if (this._list.focusIndex == null) {\n if (offset > 0) {\n this._list.focusIndex = 0;\n } else {\n this._list.focusIndex = Math.max(0, this._dataProvider.items.length - 1);\n }\n } else {\n this._list.focusIndex = Math.max(\n 0,\n Math.min(this._dataProvider.items.length - 1, this._list.focusIndex + offset),\n );\n }\n this.updateInputValue(this._dataProvider.items[this._list.focusIndex] as ItemData | any);\n this.updateActiveDescendant();\n if (!this.allowCustomValue) {\n this.select();\n }\n }\n }\n\n private updateActiveDescendant() {\n const focusedListItem = this._list && this._list.getListItem(this._list.focusIndex);\n if (focusedListItem) {\n this.inputElement.setAttribute(\"aria-activedescendant\", focusedListItem.id);\n } else {\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n }\n }\n\n private updateInputValue(item: ItemData): void {\n this.updateComplete.then(() => {\n this.value = this.convertToDisplayValue(item);\n if (item) {\n this.updateIcon(item);\n } else {\n this.updateIconFromCurrentValue();\n }\n });\n }\n\n private convertToDisplayValue(item: ItemData): string {\n if (item) {\n return item[this.displayValuePath];\n } else if (this.comboBoxValue) {\n if (this.isCustomValue(this.comboBoxValue)) {\n return this.comboBoxValue;\n } else {\n return this.comboBoxValue.item[this.displayValuePath];\n }\n } else {\n return null;\n }\n }\n\n protected fireValueChange(immediate?: boolean): void {\n if (immediate) {\n if (this.filterText !== this.value) {\n const effectiveFilterChange = (this.filterText ?? \"\") !== this.value;\n this.filterText = this.value;\n this.updateIcon(null);\n if (!this.opened) {\n this._openedByFilterTextChange = true;\n this.opened = true;\n }\n if (effectiveFilterChange) {\n this.dispatchFilterChangeEvent();\n this.debouncedFilterItemsInMemory();\n }\n }\n }\n // consume both change events triggered from input, combo box provides a different API for that\n }\n\n private clearValue(): void {\n if (!this.nullSettingDisallowed) {\n this.value = null;\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n if (this._list) {\n this._list.selectedIndices = [];\n }\n this.clearFilter();\n if (this.comboBoxValue) {\n this.comboBoxValue = null;\n this.dispatchSelectionChangeEvent();\n }\n this.requestUpdate();\n }\n }\n\n private clearFilter(): void {\n if (this.filterText != null) {\n this.filterText = undefined;\n this.filterItemsInMemory();\n this.dispatchFilterChangeEvent();\n this.updateIconFromCurrentValue();\n }\n }\n\n private updateDropdownSizes(): void {\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight;\n const overlayMaxHeight = (viewportHeight - this.offsetHeight) * 0.5;\n Object.assign(this._list.style, {\n maxHeight: `${overlayMaxHeight}px`,\n minWidth: `${Math.max(this.offsetWidth, this.minimumOverlayWidth)}px`,\n maxWidth: `max(50vw, ${this.offsetWidth}px)`,\n });\n }\n\n private updateListId() {\n if (this.inputElement && this._list) {\n this._list.id = this.id + \"_list\";\n this.inputElement.setAttribute(\"aria-controls\", this._list.id);\n }\n }\n\n private isCustomValue(value: ComboBoxValue | string): value is string {\n return typeof value === \"string\";\n }\n\n private dispatchSelectionChangeEvent(): void {\n this.updateComplete\n .then(() => {\n this.dispatchEvent(\n new CustomEvent<ISelectionEvent>(\"selection-change\", {\n detail: {\n selection: this.comboBoxValue,\n isCustomValue: this.isCustomValue(this.comboBoxValue),\n },\n }),\n );\n if (this.triggerOnly) {\n this.comboBoxValue = null;\n } else {\n const comboBoxValue = this.comboBoxValue;\n if (this.isCustomValue(comboBoxValue)) {\n this.setFormValue(comboBoxValue);\n } else {\n this.setFormValue(comboBoxValue?.item?.caption);\n }\n }\n })\n .catch((e) => {\n console.error(\"Could not dispatch selection change event due to:\", e);\n });\n }\n\n private dispatchFilterChangeEvent(): void {\n this.dispatchEvent(\n new CustomEvent<IFilterChangeEvent>(\"filter-change\", {\n detail: { value: this.filterText },\n composed: true,\n }),\n );\n this.debouncedRequestData(0);\n }\n\n private get isLazyLoadConfigured(): boolean {\n return !!this._onDataRequest;\n }\n\n /**\n * Used only when lazy loading is configured.\n */\n private debouncedRequestData = debounce(this.requestData.bind(this), 250);\n private requestData(page: number, filterChanged?: boolean) {\n if (filterChanged == null) {\n filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n }\n if (this.isLazyLoadConfigured) {\n if (!this.opened) {\n if (filterChanged) {\n this._dataProvider.items = [];\n this._itemCache = [];\n }\n return;\n }\n if (this._lastRequestedPage == page && !filterChanged) {\n return;\n }\n if (this._pendingDataRequest) {\n this._pendingDataRequest.cancel(ComboBox.DATA_REQUEST_CANCELLED);\n }\n const cancellationPromise = new Promise<DataResponse>((_resolve, reject) => {\n this._pendingDataRequest = { cancel: reject };\n });\n this._lastRequestedPage = page;\n this._lastRequestedFilterText = this.filterText;\n this.setAttribute(\"loading\", \"\");\n Promise.race([cancellationPromise, this._onDataRequest(this._lastRequestedFilterText, page)])\n .then((dataResponse) => {\n if (this.filterText == this._lastRequestedFilterText && this._lastRequestedPage == page) {\n this._dataProvider.finalSizeIsKnown = dataResponse.finalSizeIsKnown;\n if (filterChanged) {\n this._dataProvider.items = dataResponse.items;\n this._itemCache = dataResponse.items;\n } else {\n this._dataProvider.addItems(dataResponse.items);\n this._itemCache = this._dataProvider.items;\n }\n if (this._list) {\n this._list.itemCount = this._dataProvider.items.length;\n }\n if (this._popper && this.opened) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n const selectedItem = this.comboBoxValue.item;\n if (\n this._list.selectedIndices.length == 0 ||\n this.items[this._list.selectedIndices[0]] != selectedItem\n ) {\n let index = this.items.indexOf(selectedItem);\n if (index == -1) {\n const selectedId = selectedItem.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n this.comboBoxValue.index = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n }\n }\n this.updateDropdownSizes();\n this._popper.update();\n }\n }\n this._pendingDataRequest = null;\n this.removeAttribute(\"loading\");\n })\n .catch((e) => {\n if (e !== ComboBox.DATA_REQUEST_CANCELLED) {\n console.error(\n `Data could not be loaded for filter \"${this._lastRequestedFilterText}\" and page number \"${page}\" due to the following error:\\n${e}`,\n );\n this._dataProvider.finalSizeIsKnown = true;\n\n if (this.items.length == 0) {\n this.opened = false;\n } else if (this._list) {\n this._list.itemCount = this.items.length;\n }\n this.removeAttribute(\"loading\");\n }\n this._pendingDataRequest = null;\n });\n }\n }\n\n private get defaultSlot(): HTMLSlotElement {\n return this.shadowRoot.querySelector(\"#default-slot\");\n }\n\n private onDefaultSlotChange(): void {\n this._declarativeItems = this.defaultSlot.assignedElements() as HTMLElement[];\n if (this._declarativeItems.length > 0) {\n this.finalSizeIsKnown = true;\n this.itemGenerator = (_data, index) => {\n return this._declarativeItems[index].cloneNode(true) as HTMLElement;\n };\n this.items = this._declarativeItems.map((item) => {\n const data = {\n caption: item.getAttribute(\"caption\"),\n description: item.getAttribute(\"description\"),\n };\n if (\"caption\" != this.displayValuePath && \"description\" != this.displayValuePath) {\n data[this.displayValuePath] =\n item[this.displayValuePath] || item.getAttribute(this.displayValuePath);\n }\n return data;\n });\n }\n }\n}\n\nComboBox.ensureDefined();\n"],"names":["toggleSvg","clearSvg","TAG_NAME","debounce","func","delay","timeout","args","idCounter","_ComboBox","_a","SDInput","filterText","item","lowerCaseFilter","generator","event","selectedItem","ListDataProvider","value","items","onDataRequest","page","css","unsafeCSS","style","html","name","oldValue","newValue","changedProperties","selectedIndex","SelectionType","iconEl","ImageTools","clearButtonTemplate","toggleButtonTemplate","filteredInMemory","index","selectedId","VirtualList","comboBox","createPopper","state","placement","elementFromPoint","rect","filterChanged","focusedItem","offset","focusedListItem","immediate","effectiveFilterChange","overlayMaxHeight","comboBoxValue","e","cancellationPromise","_resolve","reject","dataResponse","_data","data","__decorateClass","property","ComboBox"],"mappings":";;;;;;;ukKAAeA,IAAA;AAAA;AAAA;AAAA,GCAAC,IAAA;AAAA;AAAA;AAAA;;;;;;ACQf,MAAMC,IAAW;AAEjB,SAASC,EAAYC,GAAiCC,GAA4B;AAC1E,MAAAC;AACJ,SAAO,YAAaC,GAAW;AAC3B,IAAID,KAAW,QACX,aAAaA,CAAO,GAExBA,IAAU,OAAO,WAAW,MAAMF,EAAK,GAAGG,CAAI,GAAGF,CAAK;AAAA,EAAA;AAE9D;AAuBA,IAAIG,IAAY;;AAuChB,MAAqBC,KAArBC,IAAA,cAAsCC,EAAQ;AAAA,EAgE1C,cAAc;AACJ,aApDV,KAAO,SAAS,IAEhB,KAAO,aAAa,IAU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A,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,mBAAmB,YAAY,IAAM;AAAA,GA1BzDtD,EA2BV,WAAA,kBAAA,CAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,IAAM,SAAS,IAAM;AAAA,GA5BzCtD,EA6BV,WAAA,MAAA,CAAA;AA7BX,IAAqBuD,IAArBvD;AAo9BAuD,EAAS,cAAc;"}
|
package/dist/docs/doc.mjs
CHANGED
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
--sd-input-validation-message-minheight: 20px;
|
|
30
30
|
box-sizing: border-box;
|
|
31
31
|
}
|
|
32
|
+
sd-combo-box.legacy-validation-layout {
|
|
33
|
+
--sd-input-validation-message-minheight: unset;
|
|
34
|
+
padding-bottom: 16px;
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
.grid-example-container {
|
|
34
38
|
display: grid;
|
|
@@ -1362,6 +1366,10 @@ duplicateExample.comboBoxValue = { index: 88, item: itemsWithDuplicate[88] };
|
|
|
1362
1366
|
allow-custom-value></sd-combo-box>
|
|
1363
1367
|
<sd-combo-box null-setting-disallowed label="Null setting not allowed and mandatory"></sd-combo-box>
|
|
1364
1368
|
<sd-combo-box long-validation-message label="Long validation message"></sd-combo-box>
|
|
1369
|
+
<sd-combo-box
|
|
1370
|
+
class="legacy-validation-layout"
|
|
1371
|
+
long-validation-message
|
|
1372
|
+
label="Long validation message with single line layout"></sd-combo-box>
|
|
1365
1373
|
</div>
|
|
1366
1374
|
`,$r=`<h3 id="validation-examples">Validation examples</h3>
|
|
1367
1375
|
`,Or=`import "@cas-smartdesign/combo-box";
|
|
@@ -1529,7 +1537,7 @@ function updateMandatory(combobox: ComboBox) {
|
|
|
1529
1537
|
<slot @slotchange=${this.onDefaultSlotChange} id="default-slot"></slot>
|
|
1530
1538
|
`}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),t!==i)switch(e){case"opened":{this.handleOpenedStateChange();break}case"item-height":{this._list&&(this._list.itemHeight=this.itemHeight);break}case"id":{this.updateListId();break}}}firstUpdated(e){super.firstUpdated(e),this.value&&!this.comboBoxValue&&this.updateComboBoxValueFromValue(),window.requestAnimationFrame(()=>{this.initClearButtton(),this.initToggleButtton(),this.updateHasValue(),this.addEventListener("click",()=>{this.disabled||(this.opened=!this.opened)}),this.addEventListener("keydown",t=>{this.disabled||this.handleKeyDown(t)})}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-autocomplete","list")}updateComboBoxValueFromValue(){if(this.value){const e=this._itemCache.findIndex(t=>(t[this.displayValuePath]??"")===this.value);e>-1?this._comboBoxValue={index:e,item:this._itemCache[e]}:this.allowCustomValue?this._comboBoxValue=this.value:this._comboBoxValue=null,this.updateHasValue(),this.updateIconFromCurrentValue()}}updated(e){super.updated(e),e.has("showIcon")&&(this.showIcon?this._icon==null&&this.initIconWrapper():this._icon!=null&&(this._icon.remove(),this._icon=null)),e.has("currentText")&&this.updateHasValue(),e.has("triggerOnly")&&this._list&&(this._list.selectionType=this.triggerOnly?xt.TriggerOnly:xt.Single)}initIconWrapper(){this._icon=document.createElement("div"),this._icon.className="icon-wrapper",this._icon.role="img";const e=document.createElement("div");e.style.backgroundRepeat="no-repeat",e.style.backgroundPosition="center",e.style.backgroundSize="cover",e.style.height="24px",e.style.width="24px",this._icon.appendChild(e),this._icon.slot="prefix",this.appendChild(this._icon),this.updateIconFromCurrentValue()}updateIconFromCurrentValue(){var e;this.isCustomValue(this.comboBoxValue)?this.updateIcon(null):this.updateIcon((e=this.comboBoxValue)==null?void 0:e.item)}updateIcon(e){if(this._icon)if(e&&(e.icon||e.iconPlaceholder)){const t=e;t.attributes==null?(this._icon.title="",this._icon.ariaLabel=""):(this._icon.title=t.attributes["icon-attr-title"]??"",this._icon.ariaLabel=t.attributes["icon-attr-aria-label"]??""),this._icon.style.backgroundColor=t.iconBackgroundColor,this._icon.style.display="",Ga.showImage(this._icon.querySelector("div"),e.icon,e.iconPlaceholder)}else this._icon&&(this._icon.style.display="none")}updateHasValue(){this.currentText||this.comboBoxValue!=null&&this.comboBoxValue!=""?(this.setAttribute("has-value",""),this._clearButton&&(this._clearButton.style.display="")):this.removeAttribute("has-value")}shouldFloat(){return super.shouldFloat()||this.comboBoxValue!=null&&this.comboBoxValue!=""}initClearButtton(){const e=document.createElement("template");e.innerHTML=kl,this._clearButton=e.content.firstChild,this.appendChild(this._clearButton),this._clearButton.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.opened=!1,this.clearValue()})}initToggleButtton(){const e=document.createElement("template");e.innerHTML=Al,this._toggleButton=e.content.firstChild,this.appendChild(this._toggleButton),this._toggleButton.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.opened=!this.opened,this.select()})}filterItemsInMemory(){if(this.isLazyLoadConfigured)return;let e=!1;if(this.filterText&&(this.filterProperty?(this._dataProvider.items=this._itemCache.filter(t=>t[this.filterProperty]&&String(t[this.filterProperty]).indexOf(this.filterText)>-1),e=!0):this.inMemoryFilter&&(this._dataProvider.items=this._itemCache.filter(t=>this.inMemoryFilter(this.filterText,t)),e=!0)),!e)this._dataProvider.items=this._itemCache,this._list&&this.updateFocusAndSelectedIndexFromValue();else if(this._list)if(this.comboBoxValue&&!this.isCustomValue(this.comboBoxValue)){let t=this._dataProvider.items.indexOf(this.comboBoxValue.item);if(t==-1){const i=this.comboBoxValue.item.id;i!=null&&(t=this._dataProvider.items.findIndex(a=>a.id==i))}this._list.focusIndex=t,this._list.selectedIndices=t==-1?[]:[t]}else this._list.focusIndex=null;this.opened&&this._popper&&this._popper.update()}ensureListAndPopperInitialized(){if(this._list||(this._list=document.createElement(Ji.ID),this.updateListId(),this._list.classList.add("combo-box-dropdown"),this._list.itemHeight=this.itemHeight,this._list.itemGenerator=this.itemGenerator,this._list.selectionType=this.triggerOnly?xt.TriggerOnly:xt.Single,this._list.setAttribute("focus-target",""),Object.assign(this._list.style,{zIndex:"21000",boxShadow:`rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,
|
|
1531
1539
|
rgba(0, 0, 0, 0.12) 0px 1px 5px 0px,
|
|
1532
|
-
rgba(0, 0, 0, 0.2) 0px 3px 1px -2px`,background:"white",overflowY:"auto"}),this._list.addEventListener("selection",this.handleSelection),this._dataProvider.connectList(this._list)),!this._popper){const e=this;this._popper=el(this,this._list,{placement:"bottom-start",modifiers:[{name:"computeStyles",options:{gpuAcceleration:!0}},{name:"hide",enabled:!1},{name:"closeIfReferenceHidden",enabled:!0,phase:"afterWrite",fn({state:t}){t.elements.reference.closeIfNotVisible()}},{name:"offset",options:{offset:({placement:t})=>t.indexOf("top")>-1?[0,-parseInt(getComputedStyle(e).paddingTop,10)]:t.indexOf("bottom")>-1?[0,-parseInt(getComputedStyle(e).paddingBottom,10)]:[0,0]}},{name:"adjustWidthIfNeeded",enabled:!0,phase:"read",fn({state:t}){t.elements.popper.increaseWidthOnNextRenderIfNeeded()}}]})}}closeIfNotVisible(){const e=this.elementFromMiddleOfComboBox();!this.contains(e)&&!this.shadowRoot.contains(e)&&e!==this._list&&(this.triggerOnly&&(this.value=null),this.opened=!1)}elementFromMiddleOfComboBox(){const e=this.getBoundingClientRect();return document.elementFromPoint(e.left+e.width/2,e.top+e.height/2)}async handleOpenedStateChange(){if(this.inputElement.setAttribute("aria-expanded",String(this.opened)),this.opened){if(!this.disabled){this.ensureListAndPopperInitialized();const e=(this.filterText??"")!==(this._lastRequestedFilterText??"");this.isLazyLoadConfigured&&(this.items.length==0||e)&&this.requestData(0,e),this.updateDropdownSizes(),this.ownerDocument.body.appendChild(this._list),this.updateFocusAndSelectedIndexFromValue(),window.requestAnimationFrame(()=>{this._popper&&this._popper.update()}),window.addEventListener("pointerdown",this.handleWindowPointerDown),!this.allowCustomValue&&!this._openedByFilterTextChange&&this.select()}this._openedByFilterTextChange=!1}else await this._list.updateComplete,this._popper&&await this._popper.update,this.ownerDocument.body.removeChild(this._list),window.removeEventListener("pointerdown",this.handleWindowPointerDown),this.updateValueOnClose(),this.clearFilter(),this.setSelectionRange(0,0),this.inputElement.removeAttribute("aria-activedescendant"),this._popper&&(this._popper.destroy(),this._popper=null)}updateValueOnClose(){var t;const e=this.comboBoxValue??"";if(this.nullSettingDisallowed&&!this.value&&this.comboBoxValue)this.restorePreviousSelection();else if(this.value!==(this.convertToDisplayValue(null)??"")){const i=this._dataProvider.items[this._list.focusIndex];if(i&&(i[this.displayValuePath]??"")===this.value){if(i.disabled){this.restorePreviousSelection();return}this.comboBoxValue={index:this._itemCache.indexOf(i),item:i}}else if(this.allowCustomValue||!this.value)this.comboBoxValue=this.value;else{const a=this._itemCache.findIndex(r=>(r[this.displayValuePath]??"")===this.value&&!r.disabled);a>-1?this.comboBoxValue={index:a,item:this._itemCache[a]}:this.restorePreviousSelection()}}else{const i=this._dataProvider.items[this._list.focusIndex];if(i&&i.id!=null){if(i.disabled){this.restorePreviousSelection();return}(!this.comboBoxValue||this.isCustomValue(this.comboBoxValue)||this.comboBoxValue.item.id!=i.id)&&(this.comboBoxValue={index:this._itemCache.indexOf(i),item:i})}}e!==(this.comboBoxValue??"")&&this.dispatchSelectionChangeEvent(),this.updateIcon(this.isCustomValue(this.comboBoxValue)?null:(t=this.comboBoxValue)==null?void 0:t.item)}restorePreviousSelection(){this.updateInputValue(null)}updateFocusAndSelectedIndexFromValue(){if(this.comboBoxValue&&!this.isCustomValue(this.comboBoxValue)&&!this._openedByFilterTextChange){let e=this.comboBoxValue.index;if((e==-1||this.isLazyLoadConfigured)&&(e=this.items.indexOf(this.comboBoxValue.item),e==-1)){const t=this.comboBoxValue.item.id;t!=null&&(e=this.items.findIndex(i=>i.id==t))}this._list.focusIndex=e,this._list.selectedIndices=e==-1?[]:[e]}else this._list.focusIndex=-1,this._list.selectedIndices=[];this.updateActiveDescendant()}navigateInList(e){this.opened?(this._list.focusIndex==null?e>0?this._list.focusIndex=0:this._list.focusIndex=Math.max(0,this._dataProvider.items.length-1):this._list.focusIndex=Math.max(0,Math.min(this._dataProvider.items.length-1,this._list.focusIndex+e)),this.updateInputValue(this._dataProvider.items[this._list.focusIndex]),this.updateActiveDescendant(),this.allowCustomValue||this.select()):this.opened=!0}updateActiveDescendant(){const e=this._list&&this._list.getListItem(this._list.focusIndex);e?this.inputElement.setAttribute("aria-activedescendant",e.id):this.inputElement.removeAttribute("aria-activedescendant")}updateInputValue(e){this.updateComplete.then(()=>{this.value=this.convertToDisplayValue(e),e?this.updateIcon(e):this.updateIconFromCurrentValue()})}convertToDisplayValue(e){return e?e[this.displayValuePath]:this.comboBoxValue?this.isCustomValue(this.comboBoxValue)?this.comboBoxValue:this.comboBoxValue.item[this.displayValuePath]:null}fireValueChange(e){if(e&&this.filterText!==this.value){const t=(this.filterText??"")!==this.value;this.filterText=this.value,this.updateIcon(null),this.opened||(this._openedByFilterTextChange=!0,this.opened=!0),t&&(this.dispatchFilterChangeEvent(),this.debouncedFilterItemsInMemory())}}clearValue(){this.nullSettingDisallowed||(this.value=null,this.inputElement.removeAttribute("aria-activedescendant"),this._list&&(this._list.selectedIndices=[]),this.clearFilter(),this.comboBoxValue&&(this.comboBoxValue=null,this.dispatchSelectionChangeEvent()),this.requestUpdate())}clearFilter(){this.filterText!=null&&(this.filterText=void 0,this.filterItemsInMemory(),this.dispatchFilterChangeEvent(),this.updateIconFromCurrentValue())}updateDropdownSizes(){const t=((window.innerHeight||document.documentElement.clientHeight)-this.offsetHeight)*.5;Object.assign(this._list.style,{maxHeight:`${t}px`,minWidth:`${Math.max(this.offsetWidth,this.minimumOverlayWidth)}px`,maxWidth:`max(50vw, ${this.offsetWidth}px)`})}updateListId(){this.inputElement&&this._list&&(this._list.id=this.id+"_list",this.inputElement.setAttribute("aria-controls",this._list.id))}isCustomValue(e){return typeof e=="string"}dispatchSelectionChangeEvent(){this.updateComplete.then(()=>{var e;if(this.dispatchEvent(new CustomEvent("selection-change",{detail:{selection:this.comboBoxValue,isCustomValue:this.isCustomValue(this.comboBoxValue)}})),this.triggerOnly)this.comboBoxValue=null;else{const t=this.comboBoxValue;this.isCustomValue(t)?this.setFormValue(t):this.setFormValue((e=t==null?void 0:t.item)==null?void 0:e.caption)}}).catch(e=>{console.error("Could not dispatch selection change event due to:",e)})}dispatchFilterChangeEvent(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{value:this.filterText},composed:!0})),this.debouncedRequestData(0)}get isLazyLoadConfigured(){return!!this._onDataRequest}requestData(e,t){if(t==null&&(t=(this.filterText??"")!==(this._lastRequestedFilterText??"")),this.isLazyLoadConfigured){if(!this.opened){t&&(this._dataProvider.items=[],this._itemCache=[]);return}if(this._lastRequestedPage==e&&!t)return;this._pendingDataRequest&&this._pendingDataRequest.cancel(ae.DATA_REQUEST_CANCELLED);const i=new Promise((a,r)=>{this._pendingDataRequest={cancel:r}});this._lastRequestedPage=e,this._lastRequestedFilterText=this.filterText,this.setAttribute("loading",""),Promise.race([i,this._onDataRequest(this._lastRequestedFilterText,e)]).then(a=>{if(this.filterText==this._lastRequestedFilterText&&this._lastRequestedPage==e&&(this._dataProvider.finalSizeIsKnown=a.finalSizeIsKnown,t?(this._dataProvider.items=a.items,this._itemCache=a.items):(this._dataProvider.addItems(a.items),this._itemCache=this._dataProvider.items),this._list&&(this._list.itemCount=this._dataProvider.items.length),this._popper&&this.opened)){if(this.comboBoxValue&&!this.isCustomValue(this.comboBoxValue)){const r=this.comboBoxValue.item;if(this._list.selectedIndices.length==0||this.items[this._list.selectedIndices[0]]!=r){let n=this.items.indexOf(r);if(n==-1){const o=r.id;o!=null&&(n=this.items.findIndex(l=>l.id==o))}this.comboBoxValue.index=n,this._list.selectedIndices=n==-1?[]:[n]}}this.updateDropdownSizes(),this._popper.update()}this._pendingDataRequest=null,this.removeAttribute("loading")}).catch(a=>{a!==ae.DATA_REQUEST_CANCELLED&&(console.error(`Data could not be loaded for filter "${this._lastRequestedFilterText}" and page number "${e}" due to the following error:
|
|
1540
|
+
rgba(0, 0, 0, 0.2) 0px 3px 1px -2px`,background:"white",overflowY:"auto"}),this._list.addEventListener("selection",this.handleSelection),this._dataProvider.connectList(this._list)),!this._popper){const e=this;this._popper=el(this,this._list,{placement:"bottom-start",modifiers:[{name:"computeStyles",options:{gpuAcceleration:!0}},{name:"hide",enabled:!1},{name:"closeIfReferenceHidden",enabled:!0,phase:"afterWrite",fn({state:t}){t.elements.reference.closeIfNotVisible()}},{name:"offset",options:{offset:({placement:t})=>{var i;return t.indexOf("top")>-1?[0,-parseInt(getComputedStyle(e).paddingTop,10)]:t.indexOf("bottom")>-1?[0,-parseInt(getComputedStyle(e).paddingBottom,10)-(((i=this.shadowRoot.querySelector(".validation-message-wrapper"))==null?void 0:i.offsetHeight)??0)]:[0,0]}}},{name:"adjustWidthIfNeeded",enabled:!0,phase:"read",fn({state:t}){t.elements.popper.increaseWidthOnNextRenderIfNeeded()}}]})}}closeIfNotVisible(){const e=this.elementFromMiddleOfComboBox();!this.contains(e)&&!this.shadowRoot.contains(e)&&e!==this._list&&(this.triggerOnly&&(this.value=null),this.opened=!1)}elementFromMiddleOfComboBox(){const e=this.getBoundingClientRect();return document.elementFromPoint(e.left+e.width/2,e.top+e.height/2)}async handleOpenedStateChange(){if(this.inputElement.setAttribute("aria-expanded",String(this.opened)),this.opened){if(!this.disabled){this.ensureListAndPopperInitialized();const e=(this.filterText??"")!==(this._lastRequestedFilterText??"");this.isLazyLoadConfigured&&(this.items.length==0||e)&&this.requestData(0,e),this.updateDropdownSizes(),this.ownerDocument.body.appendChild(this._list),this.updateFocusAndSelectedIndexFromValue(),window.requestAnimationFrame(()=>{this._popper&&this._popper.update()}),window.addEventListener("pointerdown",this.handleWindowPointerDown),!this.allowCustomValue&&!this._openedByFilterTextChange&&this.select()}this._openedByFilterTextChange=!1}else await this._list.updateComplete,this._popper&&await this._popper.update,this.ownerDocument.body.removeChild(this._list),window.removeEventListener("pointerdown",this.handleWindowPointerDown),this.updateValueOnClose(),this.clearFilter(),this.setSelectionRange(0,0),this.inputElement.removeAttribute("aria-activedescendant"),this._popper&&(this._popper.destroy(),this._popper=null)}updateValueOnClose(){var t;const e=this.comboBoxValue??"";if(this.nullSettingDisallowed&&!this.value&&this.comboBoxValue)this.restorePreviousSelection();else if(this.value!==(this.convertToDisplayValue(null)??"")){const i=this._dataProvider.items[this._list.focusIndex];if(i&&(i[this.displayValuePath]??"")===this.value){if(i.disabled){this.restorePreviousSelection();return}this.comboBoxValue={index:this._itemCache.indexOf(i),item:i}}else if(this.allowCustomValue||!this.value)this.comboBoxValue=this.value;else{const a=this._itemCache.findIndex(r=>(r[this.displayValuePath]??"")===this.value&&!r.disabled);a>-1?this.comboBoxValue={index:a,item:this._itemCache[a]}:this.restorePreviousSelection()}}else{const i=this._dataProvider.items[this._list.focusIndex];if(i&&i.id!=null){if(i.disabled){this.restorePreviousSelection();return}(!this.comboBoxValue||this.isCustomValue(this.comboBoxValue)||this.comboBoxValue.item.id!=i.id)&&(this.comboBoxValue={index:this._itemCache.indexOf(i),item:i})}}e!==(this.comboBoxValue??"")&&this.dispatchSelectionChangeEvent(),this.updateIcon(this.isCustomValue(this.comboBoxValue)?null:(t=this.comboBoxValue)==null?void 0:t.item)}restorePreviousSelection(){this.updateInputValue(null)}updateFocusAndSelectedIndexFromValue(){if(this.comboBoxValue&&!this.isCustomValue(this.comboBoxValue)&&!this._openedByFilterTextChange){let e=this.comboBoxValue.index;if((e==-1||this.isLazyLoadConfigured)&&(e=this.items.indexOf(this.comboBoxValue.item),e==-1)){const t=this.comboBoxValue.item.id;t!=null&&(e=this.items.findIndex(i=>i.id==t))}this._list.focusIndex=e,this._list.selectedIndices=e==-1?[]:[e]}else this._list.focusIndex=-1,this._list.selectedIndices=[];this.updateActiveDescendant()}navigateInList(e){this.opened?(this._list.focusIndex==null?e>0?this._list.focusIndex=0:this._list.focusIndex=Math.max(0,this._dataProvider.items.length-1):this._list.focusIndex=Math.max(0,Math.min(this._dataProvider.items.length-1,this._list.focusIndex+e)),this.updateInputValue(this._dataProvider.items[this._list.focusIndex]),this.updateActiveDescendant(),this.allowCustomValue||this.select()):this.opened=!0}updateActiveDescendant(){const e=this._list&&this._list.getListItem(this._list.focusIndex);e?this.inputElement.setAttribute("aria-activedescendant",e.id):this.inputElement.removeAttribute("aria-activedescendant")}updateInputValue(e){this.updateComplete.then(()=>{this.value=this.convertToDisplayValue(e),e?this.updateIcon(e):this.updateIconFromCurrentValue()})}convertToDisplayValue(e){return e?e[this.displayValuePath]:this.comboBoxValue?this.isCustomValue(this.comboBoxValue)?this.comboBoxValue:this.comboBoxValue.item[this.displayValuePath]:null}fireValueChange(e){if(e&&this.filterText!==this.value){const t=(this.filterText??"")!==this.value;this.filterText=this.value,this.updateIcon(null),this.opened||(this._openedByFilterTextChange=!0,this.opened=!0),t&&(this.dispatchFilterChangeEvent(),this.debouncedFilterItemsInMemory())}}clearValue(){this.nullSettingDisallowed||(this.value=null,this.inputElement.removeAttribute("aria-activedescendant"),this._list&&(this._list.selectedIndices=[]),this.clearFilter(),this.comboBoxValue&&(this.comboBoxValue=null,this.dispatchSelectionChangeEvent()),this.requestUpdate())}clearFilter(){this.filterText!=null&&(this.filterText=void 0,this.filterItemsInMemory(),this.dispatchFilterChangeEvent(),this.updateIconFromCurrentValue())}updateDropdownSizes(){const t=((window.innerHeight||document.documentElement.clientHeight)-this.offsetHeight)*.5;Object.assign(this._list.style,{maxHeight:`${t}px`,minWidth:`${Math.max(this.offsetWidth,this.minimumOverlayWidth)}px`,maxWidth:`max(50vw, ${this.offsetWidth}px)`})}updateListId(){this.inputElement&&this._list&&(this._list.id=this.id+"_list",this.inputElement.setAttribute("aria-controls",this._list.id))}isCustomValue(e){return typeof e=="string"}dispatchSelectionChangeEvent(){this.updateComplete.then(()=>{var e;if(this.dispatchEvent(new CustomEvent("selection-change",{detail:{selection:this.comboBoxValue,isCustomValue:this.isCustomValue(this.comboBoxValue)}})),this.triggerOnly)this.comboBoxValue=null;else{const t=this.comboBoxValue;this.isCustomValue(t)?this.setFormValue(t):this.setFormValue((e=t==null?void 0:t.item)==null?void 0:e.caption)}}).catch(e=>{console.error("Could not dispatch selection change event due to:",e)})}dispatchFilterChangeEvent(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{value:this.filterText},composed:!0})),this.debouncedRequestData(0)}get isLazyLoadConfigured(){return!!this._onDataRequest}requestData(e,t){if(t==null&&(t=(this.filterText??"")!==(this._lastRequestedFilterText??"")),this.isLazyLoadConfigured){if(!this.opened){t&&(this._dataProvider.items=[],this._itemCache=[]);return}if(this._lastRequestedPage==e&&!t)return;this._pendingDataRequest&&this._pendingDataRequest.cancel(ae.DATA_REQUEST_CANCELLED);const i=new Promise((a,r)=>{this._pendingDataRequest={cancel:r}});this._lastRequestedPage=e,this._lastRequestedFilterText=this.filterText,this.setAttribute("loading",""),Promise.race([i,this._onDataRequest(this._lastRequestedFilterText,e)]).then(a=>{if(this.filterText==this._lastRequestedFilterText&&this._lastRequestedPage==e&&(this._dataProvider.finalSizeIsKnown=a.finalSizeIsKnown,t?(this._dataProvider.items=a.items,this._itemCache=a.items):(this._dataProvider.addItems(a.items),this._itemCache=this._dataProvider.items),this._list&&(this._list.itemCount=this._dataProvider.items.length),this._popper&&this.opened)){if(this.comboBoxValue&&!this.isCustomValue(this.comboBoxValue)){const r=this.comboBoxValue.item;if(this._list.selectedIndices.length==0||this.items[this._list.selectedIndices[0]]!=r){let n=this.items.indexOf(r);if(n==-1){const o=r.id;o!=null&&(n=this.items.findIndex(l=>l.id==o))}this.comboBoxValue.index=n,this._list.selectedIndices=n==-1?[]:[n]}}this.updateDropdownSizes(),this._popper.update()}this._pendingDataRequest=null,this.removeAttribute("loading")}).catch(a=>{a!==ae.DATA_REQUEST_CANCELLED&&(console.error(`Data could not be loaded for filter "${this._lastRequestedFilterText}" and page number "${e}" due to the following error:
|
|
1533
1541
|
${a}`),this._dataProvider.finalSizeIsKnown=!0,this.items.length==0?this.opened=!1:this._list&&(this._list.itemCount=this.items.length),this.removeAttribute("loading")),this._pendingDataRequest=null})}}get defaultSlot(){return this.shadowRoot.querySelector("#default-slot")}onDefaultSlotChange(){this._declarativeItems=this.defaultSlot.assignedElements(),this._declarativeItems.length>0&&(this.finalSizeIsKnown=!0,this.itemGenerator=(e,t)=>this._declarativeItems[t].cloneNode(!0),this.items=this._declarativeItems.map(e=>{const t={caption:e.getAttribute("caption"),description:e.getAttribute("description")};return this.displayValuePath!="caption"&&this.displayValuePath!="description"&&(t[this.displayValuePath]=e[this.displayValuePath]||e.getAttribute(this.displayValuePath)),t}))}},ae.ID=Ml,ae.ensureDefined=()=>{Ji.ensureDefined(),customElements.get(ae.ID)||customElements.define(ae.ID,ae)},ae.formAssociated=!0,ae.DATA_REQUEST_CANCELLED="cancel_data_request",ae);Oe([v({type:Boolean,reflect:!0})],Se.prototype,"opened",2);Oe([v({type:Number,attribute:"item-height"})],Se.prototype,"itemHeight",2);Oe([v({type:Boolean,attribute:"allow-custom-value",reflect:!0})],Se.prototype,"allowCustomValue",2);Oe([v({type:Boolean,attribute:"trigger-only",reflect:!0})],Se.prototype,"triggerOnly",2);Oe([v({type:Boolean,attribute:"null-setting-disallowed",reflect:!0})],Se.prototype,"nullSettingDisallowed",2);Oe([v({type:Boolean,attribute:"show-icon",reflect:!0})],Se.prototype,"showIcon",2);Oe([v({type:String,attribute:"display-value-path",noAccessor:!0})],Se.prototype,"displayValuePath",2);Oe([v({type:String,attribute:"filter-property",noAccessor:!0})],Se.prototype,"filterProperty",2);Oe([v({type:String,attribute:!0,reflect:!0})],Se.prototype,"id",2);let Rl=Se;Rl.ensureDefined();function Ka(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Ll(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(i){var a=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:function(){return s[i]}})}),t}var xs={exports:{}},j=String,qa=function(){return{isColorSupported:!1,reset:j,bold:j,dim:j,italic:j,underline:j,inverse:j,hidden:j,strikethrough:j,black:j,red:j,green:j,yellow:j,blue:j,magenta:j,cyan:j,white:j,gray:j,bgBlack:j,bgRed:j,bgGreen:j,bgYellow:j,bgBlue:j,bgMagenta:j,bgCyan:j,bgWhite:j}};xs.exports=qa();xs.exports.createColors=qa;var Pl=xs.exports;const Dl={},Bl=Object.freeze(Object.defineProperty({__proto__:null,default:Dl},Symbol.toStringTag,{value:"Module"})),Ne=Ll(Bl);let na=Pl,ra=Ne,Zi=class Ja extends Error{constructor(e,t,i,a,r,n){super(e),this.name="CssSyntaxError",this.reason=e,r&&(this.file=r),a&&(this.source=a),n&&(this.plugin=n),typeof t<"u"&&typeof i<"u"&&(typeof t=="number"?(this.line=t,this.column=i):(this.line=t.line,this.column=t.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Ja)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=na.isColorSupported),ra&&e&&(t=ra(t));let i=t.split(/\r?\n/),a=Math.max(this.line-3,0),r=Math.min(this.line+2,i.length),n=String(r).length,o,l;if(e){let{bold:c,gray:m,red:u}=na.createColors(!0);o=h=>c(u(h)),l=h=>m(h)}else o=l=c=>c;return i.slice(a,r).map((c,m)=>{let u=a+1+m,h=" "+(" "+u).slice(-n)+" | ";if(u===this.line){let g=l(h.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return o(">")+l(h)+c+`
|
|
1534
1542
|
`+g+o("^")}return" "+l(h)+c}).join(`
|
|
1535
1543
|
`)}toString(){let e=this.showSourceCode();return e&&(e=`
|
package/dist/docs/index.html
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
margin: 0 auto !important;
|
|
14
14
|
padding-bottom: 45px;
|
|
15
15
|
}
|
|
16
|
+
/* Give space for the popover also below the last example */
|
|
17
|
+
.example-container:last-child {
|
|
18
|
+
margin-bottom: 100px;
|
|
19
|
+
}
|
|
16
20
|
</style>
|
|
17
21
|
<script type="module" crossorigin src="./doc.mjs"></script>
|
|
18
22
|
<link rel="stylesheet" crossorigin href="./doc.css">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cas-smartdesign/combo-box",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "A combo-box element with the look and feel of the SmartDesign inputs & list item layouts",
|
|
5
5
|
"main": "dist/combo-box-with-externals.js",
|
|
6
6
|
"module": "dist/combo-box.mjs",
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@popperjs/core": "^2.11.8",
|
|
11
11
|
"lit": "^2.8.0",
|
|
12
|
-
"@cas-smartdesign/image-tools": "^3.0.2",
|
|
13
12
|
"@cas-smartdesign/lit-input": "^7.3.0",
|
|
14
|
-
"@cas-smartdesign/
|
|
15
|
-
"@cas-smartdesign/list-item": "^7.2.4"
|
|
13
|
+
"@cas-smartdesign/image-tools": "^3.0.2",
|
|
14
|
+
"@cas-smartdesign/list-item": "^7.2.4",
|
|
15
|
+
"@cas-smartdesign/virtual-list": "^6.2.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@cas-smartdesign/element-preview": "^0.2.2",
|
|
19
|
-
"@cas-smartdesign/
|
|
20
|
-
"@cas-smartdesign/
|
|
19
|
+
"@cas-smartdesign/field-validation-message": "^5.0.2",
|
|
20
|
+
"@cas-smartdesign/license-generator": "^1.6.3"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|