@prof-dev/improved-select
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -42,3 +42,3 @@ import { EventEmitter } from "@prof-dev/event-emitter"; | ||
updateDisabledOptions(): void; | ||
reset(): void; | ||
reset: () => void; | ||
clear(): void; | ||
@@ -45,0 +45,0 @@ static create(element: HTMLElement): ImprovedSelect; |
@@ -65,2 +65,28 @@ "use strict"; | ||
_this.isHtmlValue = false; | ||
_this.reset = function () { | ||
var e_1, _a; | ||
if (_this.select) { | ||
Array.from(_this.select.options).forEach(function (option) { | ||
option.selected = false; | ||
}); | ||
try { | ||
for (var _b = __values(_this.initialSelection), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var index = _c.value; | ||
if (_this.select.options[index] !== undefined) { | ||
_this.select.options[index].selected = true; | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
_this.select.dispatchEvent(new Event("change", { | ||
bubbles: true, | ||
})); | ||
} | ||
}; | ||
_this.isActive = _this.element.classList.contains("is-active"); | ||
@@ -88,3 +114,3 @@ _this.isHtmlValue = _this.element.hasAttribute("data-select-html-value"); | ||
ImprovedSelect.prototype.initChangeStateBehavior = function () { | ||
var e_1, _a, e_2, _b; | ||
var e_2, _a, e_3, _b; | ||
if (this.select) { | ||
@@ -97,3 +123,3 @@ try { | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
@@ -103,3 +129,3 @@ try { | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
@@ -114,3 +140,3 @@ try { | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
@@ -120,3 +146,3 @@ try { | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
@@ -314,28 +340,2 @@ if (this.defaultSelection.length === 0 && | ||
}; | ||
ImprovedSelect.prototype.reset = function () { | ||
var e_3, _a; | ||
if (this.select) { | ||
Array.from(this.select.options).forEach(function (option) { | ||
option.selected = false; | ||
}); | ||
try { | ||
for (var _b = __values(this.initialSelection), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var index = _c.value; | ||
if (this.select.options[index] !== undefined) { | ||
this.select.options[index].selected = true; | ||
} | ||
} | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
this.select.dispatchEvent(new Event("change", { | ||
bubbles: true, | ||
})); | ||
} | ||
}; | ||
ImprovedSelect.prototype.clear = function () { | ||
@@ -342,0 +342,0 @@ if (this.select) { |
{ | ||
"name": "@prof-dev/improved-select", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Helper for live clicks events management", | ||
@@ -5,0 +5,0 @@ "main": "lib/ImprovedSelect.js", |
@@ -325,3 +325,3 @@ import { EventEmitter } from "@prof-dev/event-emitter"; | ||
reset() { | ||
reset = () => { | ||
if (this.select) { | ||
@@ -344,3 +344,3 @@ Array.from(this.select.options).forEach((option) => { | ||
} | ||
} | ||
}; | ||
@@ -347,0 +347,0 @@ clear() { |
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
76614