@symfony/ux-autocomplete 2.34.0 → 2.35.0
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/controller.d.ts +2 -0
- package/dist/controller.js +12 -1
- package/package.json +1 -1
package/dist/controller.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ declare class export_default extends Controller {
|
|
|
19
19
|
minCharacters: NumberConstructor;
|
|
20
20
|
tomSelectOptions: ObjectConstructor;
|
|
21
21
|
preload: StringConstructor;
|
|
22
|
+
resetOnFocus: BooleanConstructor;
|
|
22
23
|
};
|
|
23
24
|
readonly urlValue: string;
|
|
24
25
|
readonly optionsAsHtmlValue: boolean;
|
|
@@ -31,6 +32,7 @@ declare class export_default extends Controller {
|
|
|
31
32
|
readonly tomSelectOptionsValue: object;
|
|
32
33
|
readonly hasPreloadValue: boolean;
|
|
33
34
|
readonly preloadValue: string;
|
|
35
|
+
readonly resetOnFocusValue: boolean;
|
|
34
36
|
tomSelect: TomSelect | undefined;
|
|
35
37
|
private mutationObserver;
|
|
36
38
|
private isObserving;
|
package/dist/controller.js
CHANGED
|
@@ -290,6 +290,16 @@ function _createAutocompleteWithRemoteData(autocompleteEndpointUrl, minCharacter
|
|
|
290
290
|
return `<div class="create">${this.createOptionTextValue.replace("%placeholder%", `<strong>${escapeData(data.input)}</strong>`)}</div>`;
|
|
291
291
|
}
|
|
292
292
|
},
|
|
293
|
+
onFocus: () => {
|
|
294
|
+
if (this.resetOnFocusValue && this.tomSelect) {
|
|
295
|
+
if (this.tomSelect.control_input.value.trim() === "") {
|
|
296
|
+
this.tomSelect.clearOptions();
|
|
297
|
+
this.tomSelect.loadedSearches = {};
|
|
298
|
+
if (typeof this.tomSelect["clearPagination"] === "function") this.tomSelect["clearPagination"]();
|
|
299
|
+
this.tomSelect.load("");
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
},
|
|
293
303
|
preload: this.preload
|
|
294
304
|
});
|
|
295
305
|
return _assertClassBrand(_Class_brand, this, _createTomSelect).call(this, config);
|
|
@@ -333,6 +343,7 @@ _Class.values = {
|
|
|
333
343
|
createOptionText: String,
|
|
334
344
|
minCharacters: Number,
|
|
335
345
|
tomSelectOptions: Object,
|
|
336
|
-
preload: String
|
|
346
|
+
preload: String,
|
|
347
|
+
resetOnFocus: Boolean
|
|
337
348
|
};
|
|
338
349
|
export { _Class as default };
|