adt-js-components 1.6.4 → 1.6.5
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/package.json +1 -1
- package/src/Select2/index.js +9 -4
package/package.json
CHANGED
package/src/Select2/index.js
CHANGED
|
@@ -4,7 +4,8 @@ import 'select2-bootstrap-5-theme/dist/select2-bootstrap-5-theme.css'
|
|
|
4
4
|
import 'select2/dist/js/i18n/cs'
|
|
5
5
|
|
|
6
6
|
function run(options) {
|
|
7
|
-
const
|
|
7
|
+
const noSelect2Class = '.select-default';
|
|
8
|
+
const selector = options.selector || 'select:not(' + noSelect2Class + ')';
|
|
8
9
|
|
|
9
10
|
function applyEventHandlers(el) {
|
|
10
11
|
$(el)
|
|
@@ -19,12 +20,14 @@ function run(options) {
|
|
|
19
20
|
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
|
|
20
21
|
$(mutation.addedNodes).each(function() {
|
|
21
22
|
if (this.nodeType === Node.ELEMENT_NODE) {
|
|
22
|
-
if (this.matches(selector)) {
|
|
23
|
+
if (this.matches(selector) && !this.closest(noSelect2Class)) {
|
|
23
24
|
applyEventHandlers(this);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
this.querySelectorAll(selector).forEach(function(innerNode) {
|
|
27
|
-
|
|
28
|
+
if (!innerNode.closest(noSelect2Class)) {
|
|
29
|
+
applyEventHandlers(innerNode);
|
|
30
|
+
}
|
|
28
31
|
});
|
|
29
32
|
}
|
|
30
33
|
});
|
|
@@ -35,7 +38,9 @@ function run(options) {
|
|
|
35
38
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
36
39
|
|
|
37
40
|
document.querySelectorAll(selector).forEach(function(innerNode) {
|
|
38
|
-
|
|
41
|
+
if (!innerNode.closest(noSelect2Class)) {
|
|
42
|
+
applyEventHandlers(innerNode);
|
|
43
|
+
}
|
|
39
44
|
});
|
|
40
45
|
}
|
|
41
46
|
|