slim-select 4.4.0 → 4.5.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/README.md +1 -1
- package/dist/mutations.d.ts +2 -0
- package/dist/react/index.js +14 -7
- package/dist/react/index.umd.js +1 -1
- package/dist/render.d.ts +7 -0
- package/dist/select.d.ts +1 -0
- package/dist/slimselect.cjs.js +1 -1
- package/dist/slimselect.cjs.js.map +1 -1
- package/dist/slimselect.es.js +14 -7
- package/dist/slimselect.es.js.map +1 -1
- package/dist/slimselect.iife.js +1 -1
- package/dist/slimselect.iife.js.map +1 -1
- package/dist/slimselect.js +1 -1
- package/dist/slimselect.js.map +1 -1
- package/dist/vue/index.js +14 -7
- package/dist/vue/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/slimselect.es.js
CHANGED
|
@@ -717,6 +717,9 @@ var O = class {
|
|
|
717
717
|
if (this.main.main.className = "", this.main.main.removeAttribute("style"), this.content.main.className = "", this.content.main.removeAttribute("style"), this.addClasses(this.main.main, this.classes.main), this.addClasses(this.content.main, this.classes.content), this.settings.style !== "" && (this.main.main.style.cssText = this.settings.style, this.content.main.style.cssText = this.settings.style), this.settings.class.length) for (let e of this.settings.class) e.trim() !== "" && (this.main.main.classList.add(e.trim()), this.content.main.classList.add(e.trim()));
|
|
718
718
|
(this.settings.contentPosition === "relative" || this.settings.contentPosition === "fixed") && this.content.main.classList.add("ss-" + this.settings.contentPosition);
|
|
719
719
|
}
|
|
720
|
+
updateTitle(e) {
|
|
721
|
+
e ? this.main.main.setAttribute("title", e) : this.main.main.removeAttribute("title");
|
|
722
|
+
}
|
|
720
723
|
updateAriaAttributes() {
|
|
721
724
|
let e = this.content.list.id;
|
|
722
725
|
this.main.main.role = "combobox", this.main.main.setAttribute("aria-haspopup", "listbox"), this.main.main.setAttribute("aria-controls", e), this.main.main.setAttribute("aria-expanded", "false"), this.content.list.setAttribute("role", "listbox"), this.content.list.setAttribute("aria-label", this.settings.ariaLabel + " listbox"), this.settings.isMultiple && this.content.list.setAttribute("aria-multiselectable", "true"), this.content.search.input.setAttribute("aria-controls", e);
|
|
@@ -1497,12 +1500,13 @@ var O = class {
|
|
|
1497
1500
|
function P(e, t) {
|
|
1498
1501
|
let n = {
|
|
1499
1502
|
classChanged: !1,
|
|
1503
|
+
titleChanged: !1,
|
|
1500
1504
|
disabledChanged: !1,
|
|
1501
1505
|
optgroupOptionChanged: !1,
|
|
1502
1506
|
selectionChanged: !1
|
|
1503
1507
|
};
|
|
1504
1508
|
for (let r of e) {
|
|
1505
|
-
if (r.target === t && (r.attributeName === "disabled" && (n.disabledChanged = !0), r.attributeName === "class" && (n.classChanged = !0), r.type === "childList")) {
|
|
1509
|
+
if (r.target === t && (r.attributeName === "disabled" && (n.disabledChanged = !0), r.attributeName === "class" && (n.classChanged = !0), r.attributeName === "title" && (n.titleChanged = !0), r.type === "childList")) {
|
|
1506
1510
|
for (let e of Array.from(r.addedNodes)) if (e.nodeName === "OPTION" && e.value === t.value) {
|
|
1507
1511
|
n.selectionChanged = !0;
|
|
1508
1512
|
break;
|
|
@@ -1519,6 +1523,7 @@ var F = class {
|
|
|
1519
1523
|
select;
|
|
1520
1524
|
onValueChange;
|
|
1521
1525
|
onClassChange;
|
|
1526
|
+
onTitleChange;
|
|
1522
1527
|
onDisabledChange;
|
|
1523
1528
|
onOptionsChange;
|
|
1524
1529
|
onLabelClick;
|
|
@@ -1577,19 +1582,19 @@ var F = class {
|
|
|
1577
1582
|
}
|
|
1578
1583
|
observeCall(e) {
|
|
1579
1584
|
if (!this.listen) return;
|
|
1580
|
-
let { classChanged: t,
|
|
1581
|
-
if (t && this.onClassChange && this.onClassChange(this.select.className.split(" ")), n && this.onDisabledChange && (this.changeListen(!1), this.onDisabledChange(this.select.disabled), this.changeListen(!0)),
|
|
1585
|
+
let { classChanged: t, titleChanged: n, disabledChanged: r, optgroupOptionChanged: i, selectionChanged: a } = P(e, this.select), o = a;
|
|
1586
|
+
if (t && this.onClassChange && this.onClassChange(this.select.className.split(" ")), n && this.onTitleChange && this.onTitleChange(this.select.getAttribute("title") || ""), r && this.onDisabledChange && (this.changeListen(!1), this.onDisabledChange(this.select.disabled), this.changeListen(!0)), i && this.clearLeftoverHiddenDisplay(e), i && this.onOptionsChange) {
|
|
1582
1587
|
if (this.isUpdating) {
|
|
1583
1588
|
if (this.select.options.length > 0) {
|
|
1584
1589
|
let e = this.getData();
|
|
1585
1590
|
e.length > 0 && (this.pendingOptionsChange = e);
|
|
1586
1591
|
}
|
|
1587
|
-
|
|
1592
|
+
o && this.select.dispatchEvent(new Event("change"));
|
|
1588
1593
|
return;
|
|
1589
1594
|
}
|
|
1590
|
-
this.changeListen(!1), this.onOptionsChange(this.getData()), this.changeListen(!0),
|
|
1595
|
+
this.changeListen(!1), this.onOptionsChange(this.getData()), this.changeListen(!0), o = !1;
|
|
1591
1596
|
}
|
|
1592
|
-
|
|
1597
|
+
o && this.select.dispatchEvent(new Event("change"));
|
|
1593
1598
|
}
|
|
1594
1599
|
getData() {
|
|
1595
1600
|
let e = [], t = this.select.childNodes;
|
|
@@ -1929,6 +1934,8 @@ var R = class {
|
|
|
1929
1934
|
for (let e in t.events) t.events.hasOwnProperty(e) && (n.indexOf(e) === -1 ? this.events[e] = t.events[e] : this.events[e] = _(t.events[e], 100));
|
|
1930
1935
|
this.settings.disabled = t.settings?.disabled ? t.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new F(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onClassChange = (e) => {
|
|
1931
1936
|
this.settings.class = e, this.render.updateClassStyles();
|
|
1937
|
+
}, this.select.onTitleChange = (e) => {
|
|
1938
|
+
this.render.updateTitle(e);
|
|
1932
1939
|
}, this.select.onDisabledChange = (e) => {
|
|
1933
1940
|
e ? this.disable() : this.enable();
|
|
1934
1941
|
}, this.select.onLabelClick = () => {
|
|
@@ -2016,7 +2023,7 @@ var R = class {
|
|
|
2016
2023
|
let e = Array.from(this.selectEl.labels).map((e, t) => (e.id ||= `${this.settings.id}-label-${t}`, e.id));
|
|
2017
2024
|
this.render.main.main.removeAttribute("aria-label"), this.render.main.main.setAttribute("aria-labelledby", e.join(" "));
|
|
2018
2025
|
}
|
|
2019
|
-
this.selectEl.parentNode && this.selectEl.parentNode.insertBefore(this.render.main.main, this.selectEl.nextSibling), this.globalEvents.attach({ listenScroll: this.settings.openPosition === "auto" }), this.settings.disabled && this.disable(), this.settings.alwaysOpen && this.open(), this.select.setupLabelHandlers(), this.selectEl.slim = this;
|
|
2026
|
+
this.render.updateTitle(this.selectEl.getAttribute("title")), this.selectEl.parentNode && this.selectEl.parentNode.insertBefore(this.render.main.main, this.selectEl.nextSibling), this.globalEvents.attach({ listenScroll: this.settings.openPosition === "auto" }), this.settings.disabled && this.disable(), this.settings.alwaysOpen && this.open(), this.select.setupLabelHandlers(), this.selectEl.slim = this;
|
|
2020
2027
|
}
|
|
2021
2028
|
enable() {
|
|
2022
2029
|
this.settings.disabled = !1, this.select.enable(), this.render.enable();
|