@cscfi/csc-ui 1.2.2 → 1.2.3
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_16.cjs.entry.js +6 -8
- package/dist/cjs/c-autocomplete_16.cjs.entry.js.map +1 -1
- package/dist/cjs/csc-ui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/c-autocomplete/c-autocomplete.js +6 -13
- package/dist/collection/components/c-autocomplete/c-autocomplete.js.map +1 -1
- package/dist/collection/components/c-dropdown/c-dropdown.js +0 -1
- package/dist/collection/components/c-dropdown/c-dropdown.js.map +1 -1
- package/dist/components/c-autocomplete.js +7 -8
- package/dist/components/c-autocomplete.js.map +1 -1
- package/dist/components/c-dropdown2.js +0 -1
- package/dist/components/c-dropdown2.js.map +1 -1
- package/dist/csc-ui/csc-ui.esm.js +1 -1
- package/dist/csc-ui/csc-ui.esm.js.map +1 -1
- package/dist/csc-ui/p-6062aaff.entry.js +2 -0
- package/dist/csc-ui/p-6062aaff.entry.js.map +1 -0
- package/dist/esm/c-autocomplete_16.entry.js +6 -8
- package/dist/esm/c-autocomplete_16.entry.js.map +1 -1
- package/dist/esm/csc-ui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/c-autocomplete/c-autocomplete.d.ts +1 -1
- package/package.json +1 -1
- package/dist/csc-ui/p-ee753bac.entry.js +0 -2
- package/dist/csc-ui/p-ee753bac.entry.js.map +0 -1
|
@@ -30,8 +30,7 @@ const CAutocomplete = class {
|
|
|
30
30
|
? { name: selection.name, value: selection.value }
|
|
31
31
|
: selection.value;
|
|
32
32
|
this.changeValue.emit(this.value);
|
|
33
|
-
this.
|
|
34
|
-
this.changeQuery.emit(selection.value);
|
|
33
|
+
this.changeQuery.emit(this.query);
|
|
35
34
|
this.internals.setFormValue(selection.value.toString());
|
|
36
35
|
}
|
|
37
36
|
if (this.optionElements.length && !this.optionElementsExist) {
|
|
@@ -114,7 +113,7 @@ const CAutocomplete = class {
|
|
|
114
113
|
this.changeQuery.emit('');
|
|
115
114
|
this._dropdownElement.updateList();
|
|
116
115
|
}
|
|
117
|
-
|
|
116
|
+
_handleKeyDown(event) {
|
|
118
117
|
const alphanumeric = /^[0-9a-zA-Z ]+$/;
|
|
119
118
|
if (event.key.match(alphanumeric) && event.key.length === 1) {
|
|
120
119
|
if (!this.dropdownVisible) {
|
|
@@ -211,9 +210,9 @@ const CAutocomplete = class {
|
|
|
211
210
|
handleQueryChange() {
|
|
212
211
|
this._updateStatusText();
|
|
213
212
|
}
|
|
214
|
-
_updateInput(
|
|
213
|
+
_updateInput() {
|
|
215
214
|
this._dropdownElement.open();
|
|
216
|
-
this.query =
|
|
215
|
+
this.query = this._inputElement.value;
|
|
217
216
|
this.changeQuery.emit(this.query);
|
|
218
217
|
this._dropdownElement.updateList();
|
|
219
218
|
}
|
|
@@ -232,7 +231,7 @@ const CAutocomplete = class {
|
|
|
232
231
|
}
|
|
233
232
|
_renderInputElement() {
|
|
234
233
|
var _a;
|
|
235
|
-
return (index.h("div", { class: "c-input-menu__input" }, index.h("input", { type: "text", ref: (el) => (this._inputElement = el), "aria-expanded": this.dropdownVisible.toString(), "aria-owns": this._inputId + '-items', "aria-autocomplete": "list", autocomplete: "off", class: "c-input__input", role: "combobox", value: this.query, name: (_a = this.name) !== null && _a !== void 0 ? _a : null, onInput: (
|
|
234
|
+
return (index.h("div", { class: "c-input-menu__input" }, index.h("input", { type: "text", ref: (el) => (this._inputElement = el), "aria-expanded": this.dropdownVisible.toString(), "aria-owns": this._inputId + '-items', "aria-autocomplete": "list", autocomplete: "off", class: "c-input__input", role: "combobox", value: this.query, name: (_a = this.name) !== null && _a !== void 0 ? _a : null, onInput: () => this._updateInput(), onFocus: () => this._onInputFocus() })));
|
|
236
235
|
}
|
|
237
236
|
componentWillLoad() {
|
|
238
237
|
CAutocomplete._uniqueId += 1;
|
|
@@ -266,7 +265,7 @@ const CAutocomplete = class {
|
|
|
266
265
|
}
|
|
267
266
|
render() {
|
|
268
267
|
const itemType = this.optionElementsExist ? 'option' : 'item';
|
|
269
|
-
return (index.h(index.Host, null, index.h("c-dropdown", { ref: (el) => (this._dropdownElement = el), id: `${this._id}-dropdown`, index: this.currentIndex, "items-per-page": this.itemsPerPage, "item-type": itemType, items: this._items, parent: this.el, type: "autocomplete" }, index.h("c-input", { 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.query, variant: "select" }, index.h("slot", { name: "pre", slot: "pre" }), index.h("div", { class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading && this.value && this._renderReset(), !this.loading && !this.value && this._renderChevron(), index.h("slot", { onSlotchange: () => this._handleSlotChange() })), index.h("slot", { name: "post", slot: "post" })))));
|
|
268
|
+
return (index.h(index.Host, null, index.h("c-dropdown", { ref: (el) => (this._dropdownElement = el), id: `${this._id}-dropdown`, index: this.currentIndex, "items-per-page": this.itemsPerPage, "item-type": itemType, items: this._items, parent: this.el, type: "autocomplete", onKeyDown: (event) => this._handleKeyDown(event) }, index.h("c-input", { 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.query, variant: "select" }, index.h("slot", { name: "pre", slot: "pre" }), index.h("div", { class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading && this.value && this._renderReset(), !this.loading && !this.value && this._renderChevron(), index.h("slot", { onSlotchange: () => this._handleSlotChange() })), index.h("slot", { name: "post", slot: "post" })))));
|
|
270
269
|
}
|
|
271
270
|
static get formAssociated() { return true; }
|
|
272
271
|
get el() { return index.getElement(this); }
|
|
@@ -695,7 +694,6 @@ const CDropdown = class {
|
|
|
695
694
|
inputSlot = 'input-bottom';
|
|
696
695
|
this._dialog.style.top = 'auto';
|
|
697
696
|
this._dialog.style.bottom = `${innerHeight - inputSize.top - 44}px`;
|
|
698
|
-
this._inputElement.scrollIntoView();
|
|
699
697
|
}
|
|
700
698
|
}
|
|
701
699
|
this._dummyElement.style.width = `${this._getParentPosition().width}px`;
|