@prof-dev/improved-select
Advanced tools
Comparing version 1.1.11 to 1.1.12
@@ -41,2 +41,3 @@ import { EventEmitter } from "@prof-dev/event-emitter"; | ||
private initChangeStateBehavior; | ||
private updateDefaultSelection; | ||
private initToggleBehavior; | ||
@@ -43,0 +44,0 @@ private initCloseBehavior; |
@@ -222,7 +222,7 @@ "use strict"; | ||
ImprovedSelect.prototype.initChangeStateBehavior = function () { | ||
var e_2, _a, e_3, _b; | ||
var e_2, _a; | ||
if (this.select) { | ||
try { | ||
for (var _c = __values(Array.from(this.select.selectedOptions)), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
var option = _d.value; | ||
for (var _b = __values(Array.from(this.select.selectedOptions)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var option = _c.value; | ||
this.initialSelection.push(option.index); | ||
@@ -234,9 +234,15 @@ } | ||
try { | ||
if (_d && !_d.done && (_a = _c.return)) _a.call(_c); | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
this.updateDefaultSelection(); | ||
} | ||
}; | ||
ImprovedSelect.prototype.updateDefaultSelection = function () { | ||
var e_3, _a; | ||
if (this.select) { | ||
try { | ||
for (var _e = __values(Array.from(this.select.options)), _f = _e.next(); !_f.done; _f = _e.next()) { | ||
var option = _f.value; | ||
for (var _b = __values(Array.from(this.select.options)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var option = _c.value; | ||
if (option.hasAttribute("data-select-default")) { | ||
@@ -250,3 +256,3 @@ this.defaultSelection.push(option.index); | ||
try { | ||
if (_f && !_f.done && (_b = _e.return)) _b.call(_e); | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
@@ -393,5 +399,9 @@ finally { if (e_3) throw e_3.error; } | ||
ImprovedSelect.prototype.updateOptions = function () { | ||
var _a; | ||
this.linkedOptions = Array.from(this.element.querySelectorAll("[data-select-option]")); | ||
this.initLinkedOptions(); | ||
this.updateSelectedValues(); | ||
this.updateDefaultSelection(); | ||
(_a = this.select) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new Event("change", { | ||
bubbles: true, | ||
})); | ||
}; | ||
@@ -398,0 +408,0 @@ ImprovedSelect.prototype.info = function () { |
{ | ||
"name": "@prof-dev/improved-select", | ||
"version": "1.1.11", | ||
"version": "1.1.12", | ||
"description": "Helper for live clicks events management", | ||
@@ -5,0 +5,0 @@ "main": "lib/ImprovedSelect.js", |
@@ -111,2 +111,8 @@ import { EventEmitter } from "@prof-dev/event-emitter"; | ||
this.updateDefaultSelection(); | ||
} | ||
} | ||
private updateDefaultSelection() { | ||
if (this.select) { | ||
for (const option of Array.from(this.select.options)) { | ||
@@ -330,3 +336,9 @@ if (option.hasAttribute("data-select-default")) { | ||
this.updateSelectedValues(); | ||
this.updateDefaultSelection(); | ||
this.select?.dispatchEvent( | ||
new Event("change", { | ||
bubbles: true, | ||
}), | ||
); | ||
} | ||
@@ -333,0 +345,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90444
1604