@danielgindi/selectbox 2.0.65 → 2.0.66
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 +130 -103
- package/dist/lib.cjs.js +193 -89
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +193 -89
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +193 -89
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/dist/types/DropList.d.ts +13 -1
- package/dist/types/DropList.d.ts.map +1 -1
- package/dist/types/SelectBox.d.ts +7 -1
- package/dist/types/SelectBox.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +35 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +11 -11
- package/vue/DropList.vue +19 -5
- package/vue/SelectBox.vue +19 -5
- package/vue/component-types.d.ts +4 -0
package/dist/lib.es6.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 2.0.
|
|
2
|
+
* @danielgindi/selectbox 2.0.66
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
import { closestUntil, createElement, next, prev, setElementAttrs } from "@danielgindi/dom-utils/lib/Dom";
|
|
@@ -96,6 +96,7 @@ var DefaultOptions = {
|
|
|
96
96
|
labelProp: "label",
|
|
97
97
|
valueProp: "value",
|
|
98
98
|
on: null,
|
|
99
|
+
zIndex: null,
|
|
99
100
|
isHeaderVisible: false,
|
|
100
101
|
isFooterVisible: false,
|
|
101
102
|
searchable: false,
|
|
@@ -140,6 +141,9 @@ var DropList = class DropList {
|
|
|
140
141
|
unrenderNoResultsItem: o.unrenderNoResultsItem,
|
|
141
142
|
on: o.on || null,
|
|
142
143
|
positionOptionsProvider: o.positionOptionsProvider ?? null,
|
|
144
|
+
zIndex: o.zIndex ?? null,
|
|
145
|
+
appliedZIndex: null,
|
|
146
|
+
ownerSelectBox: null,
|
|
143
147
|
onError: o.onError,
|
|
144
148
|
searchable: o.searchable,
|
|
145
149
|
searchPlaceholder: o.searchPlaceholder,
|
|
@@ -240,12 +244,13 @@ var DropList = class DropList {
|
|
|
240
244
|
itemEl.className = `${p.baseClassName}__item`;
|
|
241
245
|
const classList = itemEl.classList;
|
|
242
246
|
if (item) {
|
|
243
|
-
if (p.multi)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
if (p.multi) {
|
|
248
|
+
if (item._nocheck) classList.add(`${p.baseClassName}__item_multi_nocheck`);
|
|
249
|
+
else {
|
|
250
|
+
classList.add(`${p.baseClassName}__item_multi`);
|
|
251
|
+
if (item._checked) classList.add(`${p.baseClassName}__item_checked`);
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
249
254
|
classList.add(`${p.baseClassName}__item_single`);
|
|
250
255
|
if (p.singleSelectedValue !== void 0 && item.value === p.singleSelectedValue) {
|
|
251
256
|
classList.add(`${p.baseClassName}__item_selected`);
|
|
@@ -710,6 +715,70 @@ var DropList = class DropList {
|
|
|
710
715
|
return this._p.positionOptionsProvider;
|
|
711
716
|
}
|
|
712
717
|
/**
|
|
718
|
+
* Sets the z-index: a fixed value, a resolver function, or `null` to use the CSS z-index.
|
|
719
|
+
* Applied immediately if the DropList is visible.
|
|
720
|
+
*/
|
|
721
|
+
setZIndex(zIndex) {
|
|
722
|
+
const p = this._p;
|
|
723
|
+
zIndex = zIndex ?? null;
|
|
724
|
+
if (p.zIndex === zIndex) return this;
|
|
725
|
+
p.zIndex = zIndex;
|
|
726
|
+
this.updateZIndex();
|
|
727
|
+
return this;
|
|
728
|
+
}
|
|
729
|
+
getZIndex() {
|
|
730
|
+
return this._p.zIndex;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Re-resolves the z-index (re-invoking a resolver function) and applies it.
|
|
734
|
+
* The z-index is resolved automatically on `show()`, so call this only when the stacking
|
|
735
|
+
* order around the owner changes while the DropList is open. Does nothing while hidden.
|
|
736
|
+
*/
|
|
737
|
+
updateZIndex() {
|
|
738
|
+
const p = this._p;
|
|
739
|
+
if (!this.isVisible()) return this;
|
|
740
|
+
this._applyZIndex(p.positionOptionsProvider?.() ?? p.lastPositionOptions ?? null);
|
|
741
|
+
return this;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Marks this DropList as owned by a SelectBox, for `DropListZIndexContext`.
|
|
745
|
+
* @internal
|
|
746
|
+
*/
|
|
747
|
+
_setOwnerSelectBox(selectBox) {
|
|
748
|
+
this._p.ownerSelectBox = selectBox;
|
|
749
|
+
}
|
|
750
|
+
/** @internal */
|
|
751
|
+
_resolveZIndex(positionOptions) {
|
|
752
|
+
const p = this._p;
|
|
753
|
+
const option = p.zIndex;
|
|
754
|
+
let zIndex;
|
|
755
|
+
if (typeof option === "function") {
|
|
756
|
+
const context = {
|
|
757
|
+
dropList: this,
|
|
758
|
+
owner: p.ownerSelectBox?.el ?? positionOptions?.target ?? null,
|
|
759
|
+
selectBox: p.ownerSelectBox,
|
|
760
|
+
positionOptions
|
|
761
|
+
};
|
|
762
|
+
try {
|
|
763
|
+
zIndex = option(context);
|
|
764
|
+
} catch (err) {
|
|
765
|
+
reportError(p.onError, err, { source: "zIndex" });
|
|
766
|
+
zIndex = null;
|
|
767
|
+
}
|
|
768
|
+
} else zIndex = option;
|
|
769
|
+
if (zIndex == null || zIndex === "") return null;
|
|
770
|
+
return String(zIndex);
|
|
771
|
+
}
|
|
772
|
+
/** @internal */
|
|
773
|
+
_applyZIndex(positionOptions) {
|
|
774
|
+
const p = this._p;
|
|
775
|
+
const zIndex = this._resolveZIndex(positionOptions);
|
|
776
|
+
if (zIndex !== null) p.el.style.zIndex = zIndex;
|
|
777
|
+
else if (p.appliedZIndex !== null) p.el.style.zIndex = "";
|
|
778
|
+
p.appliedZIndex = zIndex;
|
|
779
|
+
p.currentSubDropList?.droplist?.updateZIndex();
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
713
782
|
* Sets a handler to intercept internal errors/warnings (e.g. from a throwing `renderItem`/`unrenderItem`)
|
|
714
783
|
* instead of the default `console.error`/`console.warn`.
|
|
715
784
|
*/
|
|
@@ -778,13 +847,15 @@ var DropList = class DropList {
|
|
|
778
847
|
return our;
|
|
779
848
|
});
|
|
780
849
|
}
|
|
781
|
-
if (!Array.isArray(filteredItems))
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
850
|
+
if (!Array.isArray(filteredItems)) {
|
|
851
|
+
if (term) {
|
|
852
|
+
const matcher = new RegExp(escapeRegex(term), "i");
|
|
853
|
+
filteredItems = p.items.filter((x) => {
|
|
854
|
+
if (!filterGroups && x._group) return true;
|
|
855
|
+
return matcher.test(x.label);
|
|
856
|
+
});
|
|
857
|
+
} else filteredItems = null;
|
|
858
|
+
}
|
|
788
859
|
p.filteredItems = filteredItems;
|
|
789
860
|
if (filteredItems && filterEmptyGroups) {
|
|
790
861
|
let lastGroup = -1;
|
|
@@ -995,8 +1066,10 @@ var DropList = class DropList {
|
|
|
995
1066
|
};
|
|
996
1067
|
viewCss.left += anchor.left - position.left;
|
|
997
1068
|
if (positionOptions.offset) {
|
|
998
|
-
if (positionOptions.offset.y)
|
|
999
|
-
|
|
1069
|
+
if (positionOptions.offset.y) {
|
|
1070
|
+
if (invertYPos) viewCss.top -= positionOptions.offset.y;
|
|
1071
|
+
else viewCss.top += positionOptions.offset.y;
|
|
1072
|
+
}
|
|
1000
1073
|
if (positionOptions.offset.x) {
|
|
1001
1074
|
let rtl = elComputedStyle.direction === "rtl";
|
|
1002
1075
|
viewCss.left += rtl ? -positionOptions.offset.x : positionOptions.offset.x;
|
|
@@ -1126,6 +1199,7 @@ var DropList = class DropList {
|
|
|
1126
1199
|
p.lastPositionOptions = null;
|
|
1127
1200
|
if (positionOptions === void 0) positionOptions = p.positionOptionsProvider?.() ?? p.lastPositionOptions;
|
|
1128
1201
|
else p.lastPositionOptions = positionOptions;
|
|
1202
|
+
this._applyZIndex(positionOptions ?? null);
|
|
1129
1203
|
if (positionOptions) {
|
|
1130
1204
|
const elComputedStyle = getComputedStyle(el);
|
|
1131
1205
|
const originalMaxHeight = el.style.maxHeight;
|
|
@@ -1327,7 +1401,8 @@ var DropList = class DropList {
|
|
|
1327
1401
|
valueProp: p.valueProp,
|
|
1328
1402
|
renderItem: p.renderItem,
|
|
1329
1403
|
unrenderItem: p.unrenderItem,
|
|
1330
|
-
positionOptionsProvider: () => p.currentSubDropList.showOptions
|
|
1404
|
+
positionOptionsProvider: () => p.currentSubDropList.showOptions,
|
|
1405
|
+
zIndex: () => this._p?.appliedZIndex ?? null
|
|
1331
1406
|
});
|
|
1332
1407
|
let onBlur = (event) => {
|
|
1333
1408
|
if (this[DestroyedSymbol$1]) return;
|
|
@@ -2150,14 +2225,18 @@ var DropList = class DropList {
|
|
|
2150
2225
|
_updateWidth(positionOptions) {
|
|
2151
2226
|
const p = this._p, el = p.el;
|
|
2152
2227
|
let targetWidth = 0;
|
|
2153
|
-
if (positionOptions)
|
|
2154
|
-
|
|
2155
|
-
|
|
2228
|
+
if (positionOptions) {
|
|
2229
|
+
if (typeof positionOptions.updateWidth === "number") targetWidth = positionOptions.updateWidth;
|
|
2230
|
+
else if (positionOptions.targetWidth != null) targetWidth = positionOptions.targetWidth;
|
|
2231
|
+
else targetWidth = getElementWidth(positionOptions.target, true, true);
|
|
2232
|
+
}
|
|
2156
2233
|
let autoWidth = 0;
|
|
2157
|
-
if (!p.useExactTargetWidth || !targetWidth)
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2234
|
+
if (!p.useExactTargetWidth || !targetWidth) {
|
|
2235
|
+
if (p.estimateWidth || p.virtualListHelper.isVirtual()) autoWidth = p.lastMeasureItemWidth;
|
|
2236
|
+
else {
|
|
2237
|
+
el.style.width = "";
|
|
2238
|
+
autoWidth = getElementWidth(el, true, true);
|
|
2239
|
+
}
|
|
2161
2240
|
}
|
|
2162
2241
|
let newOuterWidth = Math.max(autoWidth, targetWidth);
|
|
2163
2242
|
setElementWidth(el, newOuterWidth, true, true);
|
|
@@ -2786,6 +2865,22 @@ var SelectBox = class {
|
|
|
2786
2865
|
this._setupDropdownMenu();
|
|
2787
2866
|
return this;
|
|
2788
2867
|
}
|
|
2868
|
+
/**
|
|
2869
|
+
* Sets `listOptions.zIndex` without recreating the DropList.
|
|
2870
|
+
* `undefined` falls back to `DropListDefaultOptions.zIndex`.
|
|
2871
|
+
*/
|
|
2872
|
+
setListZIndex(zIndex) {
|
|
2873
|
+
const p = this._p;
|
|
2874
|
+
p.listOptions = {
|
|
2875
|
+
...p.listOptions,
|
|
2876
|
+
zIndex
|
|
2877
|
+
};
|
|
2878
|
+
p.dropList?.setZIndex(zIndex === void 0 ? DefaultOptions.zIndex : zIndex);
|
|
2879
|
+
return this;
|
|
2880
|
+
}
|
|
2881
|
+
getListZIndex() {
|
|
2882
|
+
return this._p.listOptions?.zIndex;
|
|
2883
|
+
}
|
|
2789
2884
|
setRenderSingleItem(render, unrender) {
|
|
2790
2885
|
const p = this._p;
|
|
2791
2886
|
p.renderSingleItem = render;
|
|
@@ -3206,23 +3301,27 @@ var SelectBox = class {
|
|
|
3206
3301
|
this._registerDropdownEvents();
|
|
3207
3302
|
}
|
|
3208
3303
|
}
|
|
3209
|
-
if (p.hasOpenIndicator !== !!p.openIndicator)
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3304
|
+
if (p.hasOpenIndicator !== !!p.openIndicator) {
|
|
3305
|
+
if (p.hasOpenIndicator) {
|
|
3306
|
+
p.openIndicator = createElement("span", { class: `${p.baseClassName}__open_indicator` });
|
|
3307
|
+
p.el.appendChild(p.openIndicator);
|
|
3308
|
+
p.el.classList.add(`${p.baseClassName}__has_open_indicator`);
|
|
3309
|
+
} else {
|
|
3310
|
+
remove(p.openIndicator);
|
|
3311
|
+
delete p.openIndicator;
|
|
3312
|
+
p.el.classList.remove(`${p.baseClassName}__has_open_indicator`);
|
|
3313
|
+
}
|
|
3217
3314
|
}
|
|
3218
|
-
if (p.isLoadingMode !== !!p.spinner)
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3315
|
+
if (p.isLoadingMode !== !!p.spinner) {
|
|
3316
|
+
if (p.isLoadingMode) {
|
|
3317
|
+
p.spinner = createElement("span", { class: `${p.baseClassName}__spinner` });
|
|
3318
|
+
p.el.appendChild(p.spinner);
|
|
3319
|
+
p.el.classList.add(`${p.baseClassName}__has_spinner`);
|
|
3320
|
+
} else {
|
|
3321
|
+
remove(p.spinner);
|
|
3322
|
+
delete p.spinner;
|
|
3323
|
+
p.el.classList.remove(`${p.baseClassName}__has_spinner`);
|
|
3324
|
+
}
|
|
3226
3325
|
}
|
|
3227
3326
|
}
|
|
3228
3327
|
/**
|
|
@@ -3349,21 +3448,22 @@ var SelectBox = class {
|
|
|
3349
3448
|
p.selectionChanged = true;
|
|
3350
3449
|
p.resortBySelectionNeeded = true;
|
|
3351
3450
|
const hasGroupSync = !!event.isCheckingGroup;
|
|
3352
|
-
if (p.showSelection)
|
|
3353
|
-
if (
|
|
3354
|
-
|
|
3355
|
-
if (
|
|
3451
|
+
if (p.showSelection) {
|
|
3452
|
+
if (checked) {
|
|
3453
|
+
if (dropList.itemCount() === 1 && p.clearInputWhen.includes("multi_select_single")) this._setInputText("");
|
|
3454
|
+
if (p.sortSelectedItems) {
|
|
3455
|
+
if (!hasGroupSync) this._scheduleSync("full");
|
|
3456
|
+
} else {
|
|
3457
|
+
if (p.maxMultiItems != null && (p.treatGroupSelectionAsItems ? p.selectedItems : p.selectedItems.filter((x) => !x._group)).length > p.maxMultiItems) this._scheduleSync("addOrUpdateMultiItemRestElement");
|
|
3458
|
+
else this._scheduleSync("addMultiItemElement", item);
|
|
3459
|
+
if (!hasGroupSync) this._scheduleSync("render_base");
|
|
3460
|
+
}
|
|
3356
3461
|
} else {
|
|
3357
|
-
if (p.maxMultiItems != null && (p.treatGroupSelectionAsItems ? p.selectedItems : p.selectedItems.filter((x) => !x._group)).length
|
|
3358
|
-
else this._scheduleSync("
|
|
3462
|
+
if (p.maxMultiItems != null && (p.treatGroupSelectionAsItems ? p.selectedItems : p.selectedItems.filter((x) => !x._group)).length === p.maxMultiItems) this._scheduleSync("removeMultiItemRestElement");
|
|
3463
|
+
else this._scheduleSync("removeMultiItemElement", item);
|
|
3359
3464
|
if (!hasGroupSync) this._scheduleSync("render_base");
|
|
3360
3465
|
}
|
|
3361
|
-
} else
|
|
3362
|
-
if (p.maxMultiItems != null && (p.treatGroupSelectionAsItems ? p.selectedItems : p.selectedItems.filter((x) => !x._group)).length === p.maxMultiItems) this._scheduleSync("removeMultiItemRestElement");
|
|
3363
|
-
else this._scheduleSync("removeMultiItemElement", item);
|
|
3364
|
-
if (!hasGroupSync) this._scheduleSync("render_base");
|
|
3365
|
-
}
|
|
3366
|
-
else if (p.multi) this._scheduleSync("syncPlaceholder");
|
|
3466
|
+
} else if (p.multi) this._scheduleSync("syncPlaceholder");
|
|
3367
3467
|
this._trigger(checked ? "addsel" : "removesel", {
|
|
3368
3468
|
value,
|
|
3369
3469
|
item,
|
|
@@ -3409,6 +3509,7 @@ var SelectBox = class {
|
|
|
3409
3509
|
}
|
|
3410
3510
|
}
|
|
3411
3511
|
});
|
|
3512
|
+
dropList._setOwnerSelectBox(this);
|
|
3412
3513
|
p.sink.add(dropList.el, "mousedown", preventDropListMouseDownBlur);
|
|
3413
3514
|
this._registerDropdownEvents();
|
|
3414
3515
|
}
|
|
@@ -3782,9 +3883,10 @@ var SelectBox = class {
|
|
|
3782
3883
|
_syncPlaceholder() {
|
|
3783
3884
|
const p = this._p, multiItemLabelProp = p.multiItemLabelProp;
|
|
3784
3885
|
let placeholder = "";
|
|
3785
|
-
if (p.multi && !p.showSelection)
|
|
3786
|
-
|
|
3787
|
-
|
|
3886
|
+
if (p.multi && !p.showSelection) {
|
|
3887
|
+
if (typeof p.multiPlaceholderFormatter === "function") placeholder = p.multiPlaceholderFormatter(p.selectedItems);
|
|
3888
|
+
else placeholder = p.selectedItems.length === 0 ? p.placeholder || "" : defaultMultiPlaceholderFormatter(p.selectedItems, p.labelProp);
|
|
3889
|
+
} else if (p.selectedItems.length === 0 || !p.showSelection || p.selectedItems.every((x) => x[multiItemLabelProp] === false)) placeholder = p.placeholder == null ? "" : p.placeholder + "";
|
|
3788
3890
|
p.input.setAttribute("placeholder", placeholder);
|
|
3789
3891
|
if (p.showPlaceholderInTooltip) p.input.setAttribute("title", placeholder);
|
|
3790
3892
|
else p.input.removeAttribute("title");
|
|
@@ -3908,46 +4010,48 @@ var SelectBox = class {
|
|
|
3908
4010
|
else if (kEvent.key === VALUE_BACK_SPACE) nextFocus = prev(itemEl, `.${p.baseClassName}__item,.${p.baseClassName}__search_wrapper`);
|
|
3909
4011
|
} else if (/click|mouse|touch/.test(originatingEvent.type)) nextFocus = next(itemEl, `.${p.baseClassName}__item,.${p.baseClassName}__search_wrapper`);
|
|
3910
4012
|
const item = itemEl[ItemSymbol], value = item[p.valueProp];
|
|
3911
|
-
if (item !== void 0)
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
4013
|
+
if (item !== void 0) {
|
|
4014
|
+
if (value === RestMultiItemsSymbol) {
|
|
4015
|
+
let items = (p.treatGroupSelectionAsItems ? p.selectedItems : p.selectedItems.filter((x) => !x._group)).slice(p.maxMultiItems);
|
|
4016
|
+
let itemsToRemove = [];
|
|
4017
|
+
for (let item of items) {
|
|
4018
|
+
let removeselEvt = {
|
|
4019
|
+
value: item[p.valueProp],
|
|
4020
|
+
item,
|
|
4021
|
+
cancel: false
|
|
4022
|
+
};
|
|
4023
|
+
this._trigger("removesel:before", removeselEvt);
|
|
4024
|
+
if (!removeselEvt.cancel) itemsToRemove.push(item);
|
|
4025
|
+
}
|
|
4026
|
+
if (itemsToRemove.length > 0) {
|
|
4027
|
+
this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);
|
|
4028
|
+
for (let item of itemsToRemove) {
|
|
4029
|
+
let idx = p.selectedItems.indexOf(item);
|
|
4030
|
+
if (idx === -1) idx = p.selectedValues.indexOf(item[p.valueProp]);
|
|
4031
|
+
if (idx !== -1) {
|
|
4032
|
+
p.selectedItems.splice(idx, 1);
|
|
4033
|
+
p.selectedValues.splice(idx, 1);
|
|
4034
|
+
p.selectionChanged = true;
|
|
4035
|
+
p.resortBySelectionNeeded = true;
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
}
|
|
4039
|
+
if (items.length > itemsToRemove.length) this._addMultiItemRestElement();
|
|
4040
|
+
if (itemsToRemove.length > 0) this._scheduleSync("render_list");
|
|
4041
|
+
} else {
|
|
3915
4042
|
let removeselEvt = {
|
|
3916
|
-
value
|
|
4043
|
+
value,
|
|
3917
4044
|
item,
|
|
3918
4045
|
cancel: false
|
|
3919
4046
|
};
|
|
3920
4047
|
this._trigger("removesel:before", removeselEvt);
|
|
3921
|
-
if (
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
if (idx === -1) idx = p.selectedValues.indexOf(item[p.valueProp]);
|
|
3928
|
-
if (idx !== -1) {
|
|
3929
|
-
p.selectedItems.splice(idx, 1);
|
|
3930
|
-
p.selectedValues.splice(idx, 1);
|
|
3931
|
-
p.selectionChanged = true;
|
|
3932
|
-
p.resortBySelectionNeeded = true;
|
|
3933
|
-
}
|
|
3934
|
-
}
|
|
4048
|
+
if (removeselEvt.cancel) return this;
|
|
4049
|
+
this._removeMultiItem(item);
|
|
4050
|
+
this._trigger("removesel", {
|
|
4051
|
+
value,
|
|
4052
|
+
item
|
|
4053
|
+
});
|
|
3935
4054
|
}
|
|
3936
|
-
if (items.length > itemsToRemove.length) this._addMultiItemRestElement();
|
|
3937
|
-
if (itemsToRemove.length > 0) this._scheduleSync("render_list");
|
|
3938
|
-
} else {
|
|
3939
|
-
let removeselEvt = {
|
|
3940
|
-
value,
|
|
3941
|
-
item,
|
|
3942
|
-
cancel: false
|
|
3943
|
-
};
|
|
3944
|
-
this._trigger("removesel:before", removeselEvt);
|
|
3945
|
-
if (removeselEvt.cancel) return this;
|
|
3946
|
-
this._removeMultiItem(item);
|
|
3947
|
-
this._trigger("removesel", {
|
|
3948
|
-
value,
|
|
3949
|
-
item
|
|
3950
|
-
});
|
|
3951
4055
|
}
|
|
3952
4056
|
if (!nextFocus) nextFocus = p.el.querySelector(`.${p.baseClassName}__item, .${p.baseClassName}__search_field`);
|
|
3953
4057
|
if (hasClass(nextFocus, `${p.baseClassName}__search_wrapper`)) nextFocus = nextFocus.querySelector("input");
|