@prof-dev/improved-select
Advanced tools
Comparing version 1.1.15 to 1.1.16
@@ -62,2 +62,3 @@ import { EventEmitter } from "@prof-dev/event-emitter"; | ||
updateDisabledOptions(): void; | ||
private onFormReset; | ||
reset: () => void; | ||
@@ -64,0 +65,0 @@ clear(): void; |
@@ -169,2 +169,12 @@ "use strict"; | ||
}); }; | ||
_this.onFormReset = function () { | ||
if (_this.select) { | ||
Array.from(_this.select.options).forEach(function (option) { | ||
option.selected = option.hasAttribute("selected"); | ||
}); | ||
_this.select.dispatchEvent(new Event("change", { | ||
bubbles: true, | ||
})); | ||
} | ||
}; | ||
_this.reset = function () { | ||
@@ -330,3 +340,3 @@ var e_1, _a; | ||
if (this.form !== null) { | ||
this.form.addEventListener("reset", this.reset); | ||
this.form.addEventListener("reset", this.onFormReset); | ||
} | ||
@@ -333,0 +343,0 @@ }; |
{ | ||
"name": "@prof-dev/improved-select", | ||
"version": "1.1.15", | ||
"version": "1.1.16", | ||
"description": "Helper for live clicks events management", | ||
@@ -5,0 +5,0 @@ "main": "lib/ImprovedSelect.js", |
@@ -227,3 +227,3 @@ import { EventEmitter } from "@prof-dev/event-emitter"; | ||
if (this.form !== null) { | ||
this.form.addEventListener("reset", this.reset); | ||
this.form.addEventListener("reset", this.onFormReset); | ||
} | ||
@@ -433,2 +433,16 @@ } | ||
private onFormReset = () => { | ||
if (this.select) { | ||
Array.from(this.select.options).forEach((option) => { | ||
option.selected = option.hasAttribute("selected"); | ||
}); | ||
this.select.dispatchEvent( | ||
new Event("change", { | ||
bubbles: true, | ||
}), | ||
); | ||
} | ||
}; | ||
public reset = () => { | ||
@@ -435,0 +449,0 @@ if (this.select) { |
Sorry, the diff of this file is not supported yet
92751
1648