@cscfi/csc-ui 2.2.9 → 2.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/c-autocomplete_34.cjs.entry.js +20 -9
- package/dist/cjs/c-autocomplete_34.cjs.entry.js.map +1 -1
- package/dist/collection/components/c-select/c-select.js +20 -9
- package/dist/collection/components/c-select/c-select.js.map +1 -1
- package/dist/components/c-select.js +20 -9
- package/dist/components/c-select.js.map +1 -1
- package/dist/csc-ui/csc-ui.esm.js +1 -1
- package/dist/csc-ui/{p-bb0494ca.entry.js → p-ff9cb75f.entry.js} +2 -2
- package/dist/csc-ui/{p-bb0494ca.entry.js.map → p-ff9cb75f.entry.js.map} +1 -1
- package/dist/esm/c-autocomplete_34.entry.js +20 -9
- package/dist/esm/c-autocomplete_34.entry.js.map +1 -1
- package/package.json +1 -1
|
@@ -1781,9 +1781,10 @@ const CSelect = class {
|
|
|
1781
1781
|
this._lastKeyPressTime = null;
|
|
1782
1782
|
this._searchString = '';
|
|
1783
1783
|
this._toggleDropdown = (event) => {
|
|
1784
|
+
var _a;
|
|
1784
1785
|
event.stopPropagation();
|
|
1785
1786
|
if (this.dropdownVisible) {
|
|
1786
|
-
this._dropdownElement.close();
|
|
1787
|
+
(_a = this._dropdownElement) === null || _a === void 0 ? void 0 : _a.close();
|
|
1787
1788
|
return;
|
|
1788
1789
|
}
|
|
1789
1790
|
this._dropdownElement.open();
|
|
@@ -1891,6 +1892,7 @@ const CSelect = class {
|
|
|
1891
1892
|
this._dropdownElement.updateList();
|
|
1892
1893
|
}
|
|
1893
1894
|
handleKeyDown(event) {
|
|
1895
|
+
var _a, _b, _c;
|
|
1894
1896
|
const alphanumeric = /^[0-9a-zA-Z ]+$/;
|
|
1895
1897
|
if (this.disabled)
|
|
1896
1898
|
return;
|
|
@@ -1913,12 +1915,12 @@ const CSelect = class {
|
|
|
1913
1915
|
}
|
|
1914
1916
|
if (event.key === 'Escape') {
|
|
1915
1917
|
this._preventDialogOpen = true;
|
|
1916
|
-
this._dropdownElement.close();
|
|
1918
|
+
(_a = this._dropdownElement) === null || _a === void 0 ? void 0 : _a.close();
|
|
1917
1919
|
this._inputElement.focus();
|
|
1918
1920
|
return;
|
|
1919
1921
|
}
|
|
1920
1922
|
if (event.key === 'Tab') {
|
|
1921
|
-
this._dropdownElement.close();
|
|
1923
|
+
(_b = this._dropdownElement) === null || _b === void 0 ? void 0 : _b.close();
|
|
1922
1924
|
}
|
|
1923
1925
|
if (event.key === 'ArrowDown') {
|
|
1924
1926
|
event.preventDefault();
|
|
@@ -1936,7 +1938,7 @@ const CSelect = class {
|
|
|
1936
1938
|
if (event.key === 'ArrowUp') {
|
|
1937
1939
|
event.preventDefault();
|
|
1938
1940
|
if (this.currentIndex === 0) {
|
|
1939
|
-
this._dropdownElement.close();
|
|
1941
|
+
(_c = this._dropdownElement) === null || _c === void 0 ? void 0 : _c.close();
|
|
1940
1942
|
this._inputElement.focus();
|
|
1941
1943
|
}
|
|
1942
1944
|
if (!this.dropdownVisible) {
|
|
@@ -1976,19 +1978,28 @@ const CSelect = class {
|
|
|
1976
1978
|
this._selectOption(this.returnObject ? v : { name: v, value: v });
|
|
1977
1979
|
}
|
|
1978
1980
|
onSelectOption(event) {
|
|
1981
|
+
var _a, _b;
|
|
1982
|
+
if (this.returnObject &&
|
|
1983
|
+
this.value.value === event.detail.value) {
|
|
1984
|
+
(_a = this._dropdownElement) === null || _a === void 0 ? void 0 : _a.close();
|
|
1985
|
+
}
|
|
1986
|
+
if (!this.returnObject && this.value === event.detail.value) {
|
|
1987
|
+
(_b = this._dropdownElement) === null || _b === void 0 ? void 0 : _b.close();
|
|
1988
|
+
}
|
|
1979
1989
|
this._setValue(event.detail);
|
|
1980
1990
|
}
|
|
1981
1991
|
_selectOption({ value, name }) {
|
|
1982
|
-
|
|
1992
|
+
var _a, _b, _c;
|
|
1993
|
+
(_a = this._dropdownElement) === null || _a === void 0 ? void 0 : _a.close();
|
|
1983
1994
|
const selection = this._setCurrentIndex({ name, value });
|
|
1984
1995
|
if (this.optionElementsExist && this.optionAsSelection && selection) {
|
|
1985
1996
|
const clone = selection.cloneNode(true);
|
|
1986
1997
|
this._selectionElement.classList.add('c-input-menu__selection--show');
|
|
1987
1998
|
this._selectionElement.replaceChildren(clone);
|
|
1988
1999
|
}
|
|
1989
|
-
this._dropdownElement.updateList();
|
|
2000
|
+
(_b = this._dropdownElement) === null || _b === void 0 ? void 0 : _b.updateList();
|
|
1990
2001
|
this._preventDialogOpen = true;
|
|
1991
|
-
this._inputElement.focus();
|
|
2002
|
+
(_c = this._inputElement) === null || _c === void 0 ? void 0 : _c.focus();
|
|
1992
2003
|
}
|
|
1993
2004
|
_setValue({ value, name }) {
|
|
1994
2005
|
this.value = this.returnObject ? { name, value } : value;
|
|
@@ -2074,12 +2085,12 @@ const CSelect = class {
|
|
|
2074
2085
|
}
|
|
2075
2086
|
render() {
|
|
2076
2087
|
const itemType = this.optionElementsExist ? 'option' : 'item';
|
|
2077
|
-
return (h(Host, { key: '
|
|
2088
|
+
return (h(Host, { key: 'fa4bbed472aaf7e75cb358d4896158b9bb967bcb' }, h("c-dropdown", { key: '53db3600ce7c2697d6424a13af97fcbcce43a505', ref: (el) => (this._dropdownElement = el), id: `${this._id}-dropdown`, index: this.currentIndex, "items-per-page": this.itemsPerPage, "dropdown-item-type": itemType, items: this._items, parent: this.el, type: "select" }, h("c-input", { key: '24fb3f6cc64ae04176810315a8a3e764da57eb4a', slot: "default", ref: (el) => (this._cInputElement = el), active: this.dropdownVisible, disabled: this.disabled, "hide-details": this.hideDetails, hint: this.hint, id: this.hostId, "input-id": this._inputId, label: this.label, name: this.name, placeholder: this.placeholder, required: this.required, shadow: this.shadow, valid: this.valid, validate: this.validate, "validate-on-blur": this.validateOnBlur, validation: this.validation, value: this.value, variant: "select", onClick: () => !this.disabled && this._dropdownElement.open() }, h("slot", { key: 'd7151d813bad283c2142ea92da1f91106f364e71', name: "pre", slot: "pre" }), h("div", { key: '98dee6be1850998f1f20004bc5db47115ac06d2d', class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading &&
|
|
2078
2089
|
this.value &&
|
|
2079
2090
|
this.clearable &&
|
|
2080
2091
|
this._renderReset(), !this.loading &&
|
|
2081
2092
|
(!this.value || !this.clearable) &&
|
|
2082
|
-
this._renderChevron(), h("slot", { key: '
|
|
2093
|
+
this._renderChevron(), h("slot", { key: '4ec879c39c676e011f223dba96bc50d145fbf0b6', onSlotchange: () => this._onSlotChange() })), h("slot", { key: '8508f178964fe4637eca12303c25f5cbcfcce4be', name: "post", slot: "post" })))));
|
|
2083
2094
|
}
|
|
2084
2095
|
static get formAssociated() { return true; }
|
|
2085
2096
|
get el() { return getElement(this); }
|