dragselect 2.5.3 → 2.5.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/CHANGELOG.md +9 -0
- package/README.md +25 -17
- package/dist/DragSelect.d.ts +2 -2
- package/dist/DragSelect.es6m.js +27 -19
- package/dist/DragSelect.js +27 -19
- package/dist/ds.es6m.min.js +1 -1
- package/dist/ds.min.js +1 -1
- package/dist/modules/Interaction.d.ts +1 -1
- package/package.json +4 -6
- package/rollup.config.js +19 -5
- package/src/DragSelect.js +44 -10
- package/src/methods/createSelectorElement.js +2 -2
- package/src/modules/Area.js +3 -2
- package/src/modules/Interaction.js +8 -5
- package/src/modules/Selector.js +2 -0
- package/jsdoc.json +0 -18
- package/todos.md +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# 2.5.5
|
|
2
|
+
|
|
3
|
+
- Fix bug where setting a new area via `.setSettings({ area: '...' })` would not remove the old event listeners. Which causes the mobile touch scroll from being blocked when switching between the Document to an areas.
|
|
4
|
+
|
|
5
|
+
# 2.5.4
|
|
6
|
+
|
|
7
|
+
- Fix a bug where `setSettings` would not work with `customStyles`.
|
|
8
|
+
- Beautify the default selector using rgb(0,175,255) as base blue color
|
|
9
|
+
|
|
1
10
|
# 2.5.3
|
|
2
11
|
|
|
3
12
|
- Fix a bug where `setSettings` would not work with dropZones.
|
package/README.md
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<p align="center" style="text-align: center" >
|
|
2
|
+
<a href="https://DragSelect.com/">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://dragselect.com/media/dragselect-logo.png">
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://dragselect.com/media/dragselect-logo-alt.png">
|
|
6
|
+
<img alt="The DragSelect logo: a selection symbol, a hand, a drop symbol and a mouse within a selection square." width="300" src="https://dragselect.com/media/dragselect-logo.png">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
<p align="center" style="text-align: center">
|
|
11
|
+
<a href="https://dragselect.com/">Project-Page</a> |
|
|
12
|
+
<a href="https://dragselect.com/docs/intro">Documentation</a> |
|
|
13
|
+
<a href="https://github.com/ThibaultJanBeyer/DragSelect/">Github</a> |
|
|
14
|
+
<a href="https://www.npmjs.com/package/dragselect">NPM</a> |
|
|
15
|
+
</p>
|
|
16
|
+
<p align="center" style="text-align: center; margin-bottom: 50px;">
|
|
17
|
+
<a href="https://github.com/ThibaultJanBeyer/DragSelect/actions"><img alt="Build Status" src="https://github.com/ThibaultJanBeyer/DragSelect/actions/workflows/github-actions-build.yml/badge.svg"></a>
|
|
18
|
+
<a href="https://dragselect.com/v2/ds.min.js"><img alt="gzip size" src="https://img.badgesize.io/https://dragselect.com/v2/ds.min.js?compression=gzip"></a>
|
|
19
|
+
<a href="https://www.npmjs.com/package/dragselect"><img alt="npm downloads count" src="https://img.shields.io/npm/dt/dragselect.svg"></a>
|
|
20
|
+
<a href="https://github.com/ThibaultJanBeyer/DragSelect/blob/master/package.json"><img alt="No Dependency" src="https://img.shields.io/badge/dependencies-none-informational"></a>
|
|
21
|
+
<a href="https://github.com/ThibaultJanBeyer/DragSelect/blob/master/CONTRIBUTING.md"><img alt="Contributors Welcome" src="https://img.shields.io/badge/contributors-welcome-blueviolet"></a>
|
|
22
|
+
<a href="https://github.com/sponsors/ThibaultJanBeyer"><img alt="Sponsors Welcome" src="https://img.shields.io/badge/sponsors-welcome-blueviolet"></a>
|
|
23
|
+
</p>
|
|
13
24
|
|
|
14
25
|
# DragSelect 
|
|
15
26
|
easily add a selection algorithm to your application/website.
|
|
@@ -88,12 +99,9 @@ If you're too poor or broke you can still support us with your time instead by [
|
|
|
88
99
|
|
|
89
100
|
## Thanks to:
|
|
90
101
|
|
|
91
|
-
|
|
|
102
|
+
| <a href="https://www.browserstack.com/"><img src="https://dragselect.com/media/browserstack.jpg" alt="Browserstack" width="150px"></a> | [You?](https://github.com/sponsors/ThibaultJanBeyer) |
|
|
92
103
|
|--- |--- |
|
|
93
|
-
|[BrowserStack](https://www.browserstack.com/) is a
|
|
94
|
-
| Via BTC: | [1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC](https://www.blockchain.com/btc/address/1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC) (direct) |
|
|
95
|
-
| Via GitHub: | [GitHub Sponsors](https://github.com/sponsors/ThibaultJanBeyer) (monthly & one-time) |
|
|
96
|
-
| Other: | [get in touch](mailto:thibault.beyer@gmail.com) |
|
|
104
|
+
|[BrowserStack](https://www.browserstack.com/) is a service for cross-browser testing. They support this open source projects by providing us with a [free account](https://www.browserstack.com/open-source)! | Thank and support us by making a [Direct Donation to DragSelect](https://www.blockchain.com/btc/address/1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC) (via Bitcoin: `1LdweSpjgSeJC8XxX3swrohBMBLUzg6cmC`). Or sponsor via [GitHub Sponsors](https://github.com/sponsors/ThibaultJanBeyer) or [Get in touch](mailto:thibault.beyer@gmail.com).
|
|
97
105
|
|
|
98
106
|
All donations are distributed with all project contributors proportionally to their involvement. We are grateful for any amount:
|
|
99
107
|
We have more than , imagine how much we'd have if everyone would have had donated only 1$ 🤩 (unfortunately this did not happen)
|
package/dist/DragSelect.d.ts
CHANGED
|
@@ -85,10 +85,10 @@ declare class DragSelect {
|
|
|
85
85
|
* Multiple elements can be given at once.
|
|
86
86
|
* @param {DSInputElements} elements one or multiple elements
|
|
87
87
|
* @param {boolean} [triggerCallback] - if callback should be called
|
|
88
|
-
* @param {boolean} [
|
|
88
|
+
* @param {boolean} [removeFromSelectables] - if element should not be added/removed to the list of selectable elements accordingly
|
|
89
89
|
* @return {DSElements} all selected elements
|
|
90
90
|
*/
|
|
91
|
-
toggleSelection(elements: DSInputElements, triggerCallback?: boolean,
|
|
91
|
+
toggleSelection(elements: DSInputElements, triggerCallback?: boolean, removeFromSelectables?: boolean): DSElements;
|
|
92
92
|
/**
|
|
93
93
|
* Sets the current selected elements and optionally run the callback
|
|
94
94
|
* By default, adds new elements also to the list of selectables
|
package/dist/DragSelect.es6m.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/***
|
|
2
2
|
|
|
3
|
-
~~~ Version 2.5.
|
|
3
|
+
~~~ Version 2.5.4 ~~~
|
|
4
4
|
|
|
5
5
|
******************************************
|
|
6
6
|
|
|
@@ -580,8 +580,8 @@ var createSelectorElement = (function (customStyles) {
|
|
|
580
580
|
var selector = document.createElement('div');
|
|
581
581
|
selector.style.position = 'absolute';
|
|
582
582
|
if (!customStyles) {
|
|
583
|
-
selector.style.background = 'rgba(0,
|
|
584
|
-
selector.style.border = '1px solid rgba(0,
|
|
583
|
+
selector.style.background = 'rgba(0, 175, 255, 0.2)';
|
|
584
|
+
selector.style.border = '1px solid rgba(0, 175, 255, 0.8)';
|
|
585
585
|
selector.style.display = 'none';
|
|
586
586
|
selector.style.pointerEvents = 'none'; // fix for issue #8 (ie11+)
|
|
587
587
|
}
|
|
@@ -1488,6 +1488,7 @@ var Area = /*#__PURE__*/function () {
|
|
|
1488
1488
|
_defineProperty(this, "_computedBorder", void 0);
|
|
1489
1489
|
_defineProperty(this, "_rect", void 0);
|
|
1490
1490
|
_defineProperty(this, "setArea", function (area) {
|
|
1491
|
+
_this.reset();
|
|
1491
1492
|
_this._node = area;
|
|
1492
1493
|
handleElementPositionAttribute({
|
|
1493
1494
|
computedStyle: _this.computedStyle,
|
|
@@ -1542,7 +1543,7 @@ var Area = /*#__PURE__*/function () {
|
|
|
1542
1543
|
// @ts-ignore: @todo: update to typescript
|
|
1543
1544
|
this.DS.PubSub.subscribe('Settings:updated:area', function (_ref2) {
|
|
1544
1545
|
var settings = _ref2.settings;
|
|
1545
|
-
|
|
1546
|
+
_this.setArea(settings.area);
|
|
1546
1547
|
});
|
|
1547
1548
|
this.DS.PubSub.subscribe('Interaction:init', this.start);
|
|
1548
1549
|
this.DS.PubSub.subscribe('Interaction:end', this.reset);
|
|
@@ -2228,22 +2229,23 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
2228
2229
|
_this.reset(); // simulate mouse-up (that does not exist on keyboard)
|
|
2229
2230
|
});
|
|
2230
2231
|
_defineProperty(this, "stop", function () {
|
|
2232
|
+
var area = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.DS.Area.HTMLNode;
|
|
2231
2233
|
_this.isInteracting = false;
|
|
2232
2234
|
_this.isDragging = false;
|
|
2233
2235
|
|
|
2234
2236
|
// @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
|
|
2235
2237
|
if (_this.Settings.usePointerEvents) {
|
|
2236
|
-
|
|
2238
|
+
area.removeEventListener('pointerdown', _this.start, {
|
|
2237
2239
|
// @ts-ignore
|
|
2238
2240
|
passive: false
|
|
2239
2241
|
});
|
|
2240
2242
|
document.removeEventListener('pointerup', _this.reset);
|
|
2241
2243
|
document.removeEventListener('pointercancel', _this.reset);
|
|
2242
2244
|
} else {
|
|
2243
|
-
|
|
2245
|
+
area.removeEventListener('mousedown', _this.start);
|
|
2244
2246
|
document.removeEventListener('mouseup', _this.reset);
|
|
2245
2247
|
}
|
|
2246
|
-
|
|
2248
|
+
area.removeEventListener('touchstart', _this.start, {
|
|
2247
2249
|
// @ts-ignore
|
|
2248
2250
|
passive: false
|
|
2249
2251
|
});
|
|
@@ -2278,20 +2280,24 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
2278
2280
|
this.DS = DS;
|
|
2279
2281
|
this.Settings = DS.stores.SettingsStore.s;
|
|
2280
2282
|
// @ts-ignore: @todo: update to typescript
|
|
2281
|
-
this.DS.subscribe('Settings:updated:area',
|
|
2283
|
+
this.DS.subscribe('Settings:updated:area', function (_ref4) {
|
|
2284
|
+
var settings = _ref4.settings;
|
|
2285
|
+
_this.stop(settings['area:pre']);
|
|
2286
|
+
_this.init();
|
|
2287
|
+
});
|
|
2282
2288
|
this.DS.subscribe('PointerStore:updated', this.update);
|
|
2283
2289
|
this.DS.subscribe('Selectable:click', this.onClick);
|
|
2284
|
-
this.DS.subscribe('Selectable:pointer', function (
|
|
2285
|
-
var event =
|
|
2290
|
+
this.DS.subscribe('Selectable:pointer', function (_ref5) {
|
|
2291
|
+
var event = _ref5.event;
|
|
2286
2292
|
return _this.start(event);
|
|
2287
2293
|
});
|
|
2288
|
-
this.DS.subscribe('Interaction:start:pre', function (
|
|
2289
|
-
var event =
|
|
2294
|
+
this.DS.subscribe('Interaction:start:pre', function (_ref6) {
|
|
2295
|
+
var event = _ref6.event;
|
|
2290
2296
|
return _this._start(event);
|
|
2291
2297
|
});
|
|
2292
2298
|
this.DS.subscribe('Interaction:init:pre', this._init);
|
|
2293
|
-
this.DS.subscribe('Interaction:end:pre', function (
|
|
2294
|
-
var event =
|
|
2299
|
+
this.DS.subscribe('Interaction:end:pre', function (_ref7) {
|
|
2300
|
+
var event = _ref7.event;
|
|
2295
2301
|
return _this._reset(event);
|
|
2296
2302
|
});
|
|
2297
2303
|
this.DS.subscribe('Area:scroll', this.update);
|
|
@@ -2758,6 +2764,8 @@ var Selector = /*#__PURE__*/function () {
|
|
|
2758
2764
|
});
|
|
2759
2765
|
// @ts-ignore: @todo: update to typescript
|
|
2760
2766
|
this.DS.subscribe('Settings:updated:selector', this.attachSelector);
|
|
2767
|
+
// @ts-ignore: @todo: update to typescript
|
|
2768
|
+
this.DS.subscribe('Settings:updated:customStyles', this.attachSelector);
|
|
2761
2769
|
this.attachSelector();
|
|
2762
2770
|
this.DS.subscribe('Interaction:start', this.start);
|
|
2763
2771
|
this.DS.subscribe('Interaction:update', this.update);
|
|
@@ -3379,7 +3387,7 @@ function SettingsStore(_ref) {
|
|
|
3379
3387
|
/** @param {{settings: Settings, init?: boolean}} props */;
|
|
3380
3388
|
|
|
3381
3389
|
// Setup
|
|
3382
|
-
|
|
3390
|
+
/// ///////////////////////////////////////////////////////////////////////////////////
|
|
3383
3391
|
var DragSelect = /*#__PURE__*/function () {
|
|
3384
3392
|
/**
|
|
3385
3393
|
* used to skip all current Selection and dragNdrop functionality
|
|
@@ -3510,7 +3518,7 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3510
3518
|
}
|
|
3511
3519
|
|
|
3512
3520
|
// Useful methods for the user
|
|
3513
|
-
|
|
3521
|
+
/// ///////////////////////////////////////////////////////////////////////////////////
|
|
3514
3522
|
/**
|
|
3515
3523
|
* Initializes the functionality. Automatically triggered when created.
|
|
3516
3524
|
* Also, reset the functionality after a teardown
|
|
@@ -3594,7 +3602,7 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3594
3602
|
* Multiple elements can be given at once.
|
|
3595
3603
|
* @param {DSInputElements} elements one or multiple elements
|
|
3596
3604
|
* @param {boolean} [triggerCallback] - if callback should be called
|
|
3597
|
-
* @param {boolean} [
|
|
3605
|
+
* @param {boolean} [removeFromSelectables] - if element should not be added/removed to the list of selectable elements accordingly
|
|
3598
3606
|
* @return {DSElements} all selected elements
|
|
3599
3607
|
*/
|
|
3600
3608
|
}, {
|
|
@@ -3602,9 +3610,9 @@ var DragSelect = /*#__PURE__*/function () {
|
|
|
3602
3610
|
value: function toggleSelection(elements) {
|
|
3603
3611
|
var _this2 = this;
|
|
3604
3612
|
var triggerCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3605
|
-
var
|
|
3613
|
+
var removeFromSelectables = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3606
3614
|
toArray(elements).forEach(function (el) {
|
|
3607
|
-
return _this2.SelectedSet.has(el) ? _this2.removeSelection(elements, triggerCallback,
|
|
3615
|
+
return _this2.SelectedSet.has(el) ? _this2.removeSelection(elements, triggerCallback, removeFromSelectables) : _this2.addSelection(elements, triggerCallback, removeFromSelectables);
|
|
3608
3616
|
});
|
|
3609
3617
|
if (triggerCallback) this.PubSub.publish('callback', {
|
|
3610
3618
|
items: this.getSelection()
|
package/dist/DragSelect.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/***
|
|
2
2
|
|
|
3
|
-
~~~ Version 2.5.
|
|
3
|
+
~~~ Version 2.5.4 ~~~
|
|
4
4
|
|
|
5
5
|
******************************************
|
|
6
6
|
|
|
@@ -586,8 +586,8 @@
|
|
|
586
586
|
var selector = document.createElement('div');
|
|
587
587
|
selector.style.position = 'absolute';
|
|
588
588
|
if (!customStyles) {
|
|
589
|
-
selector.style.background = 'rgba(0,
|
|
590
|
-
selector.style.border = '1px solid rgba(0,
|
|
589
|
+
selector.style.background = 'rgba(0, 175, 255, 0.2)';
|
|
590
|
+
selector.style.border = '1px solid rgba(0, 175, 255, 0.8)';
|
|
591
591
|
selector.style.display = 'none';
|
|
592
592
|
selector.style.pointerEvents = 'none'; // fix for issue #8 (ie11+)
|
|
593
593
|
}
|
|
@@ -1494,6 +1494,7 @@
|
|
|
1494
1494
|
_defineProperty(this, "_computedBorder", void 0);
|
|
1495
1495
|
_defineProperty(this, "_rect", void 0);
|
|
1496
1496
|
_defineProperty(this, "setArea", function (area) {
|
|
1497
|
+
_this.reset();
|
|
1497
1498
|
_this._node = area;
|
|
1498
1499
|
handleElementPositionAttribute({
|
|
1499
1500
|
computedStyle: _this.computedStyle,
|
|
@@ -1548,7 +1549,7 @@
|
|
|
1548
1549
|
// @ts-ignore: @todo: update to typescript
|
|
1549
1550
|
this.DS.PubSub.subscribe('Settings:updated:area', function (_ref2) {
|
|
1550
1551
|
var settings = _ref2.settings;
|
|
1551
|
-
|
|
1552
|
+
_this.setArea(settings.area);
|
|
1552
1553
|
});
|
|
1553
1554
|
this.DS.PubSub.subscribe('Interaction:init', this.start);
|
|
1554
1555
|
this.DS.PubSub.subscribe('Interaction:end', this.reset);
|
|
@@ -2234,22 +2235,23 @@
|
|
|
2234
2235
|
_this.reset(); // simulate mouse-up (that does not exist on keyboard)
|
|
2235
2236
|
});
|
|
2236
2237
|
_defineProperty(this, "stop", function () {
|
|
2238
|
+
var area = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.DS.Area.HTMLNode;
|
|
2237
2239
|
_this.isInteracting = false;
|
|
2238
2240
|
_this.isDragging = false;
|
|
2239
2241
|
|
|
2240
2242
|
// @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
|
|
2241
2243
|
if (_this.Settings.usePointerEvents) {
|
|
2242
|
-
|
|
2244
|
+
area.removeEventListener('pointerdown', _this.start, {
|
|
2243
2245
|
// @ts-ignore
|
|
2244
2246
|
passive: false
|
|
2245
2247
|
});
|
|
2246
2248
|
document.removeEventListener('pointerup', _this.reset);
|
|
2247
2249
|
document.removeEventListener('pointercancel', _this.reset);
|
|
2248
2250
|
} else {
|
|
2249
|
-
|
|
2251
|
+
area.removeEventListener('mousedown', _this.start);
|
|
2250
2252
|
document.removeEventListener('mouseup', _this.reset);
|
|
2251
2253
|
}
|
|
2252
|
-
|
|
2254
|
+
area.removeEventListener('touchstart', _this.start, {
|
|
2253
2255
|
// @ts-ignore
|
|
2254
2256
|
passive: false
|
|
2255
2257
|
});
|
|
@@ -2284,20 +2286,24 @@
|
|
|
2284
2286
|
this.DS = DS;
|
|
2285
2287
|
this.Settings = DS.stores.SettingsStore.s;
|
|
2286
2288
|
// @ts-ignore: @todo: update to typescript
|
|
2287
|
-
this.DS.subscribe('Settings:updated:area',
|
|
2289
|
+
this.DS.subscribe('Settings:updated:area', function (_ref4) {
|
|
2290
|
+
var settings = _ref4.settings;
|
|
2291
|
+
_this.stop(settings['area:pre']);
|
|
2292
|
+
_this.init();
|
|
2293
|
+
});
|
|
2288
2294
|
this.DS.subscribe('PointerStore:updated', this.update);
|
|
2289
2295
|
this.DS.subscribe('Selectable:click', this.onClick);
|
|
2290
|
-
this.DS.subscribe('Selectable:pointer', function (
|
|
2291
|
-
var event =
|
|
2296
|
+
this.DS.subscribe('Selectable:pointer', function (_ref5) {
|
|
2297
|
+
var event = _ref5.event;
|
|
2292
2298
|
return _this.start(event);
|
|
2293
2299
|
});
|
|
2294
|
-
this.DS.subscribe('Interaction:start:pre', function (
|
|
2295
|
-
var event =
|
|
2300
|
+
this.DS.subscribe('Interaction:start:pre', function (_ref6) {
|
|
2301
|
+
var event = _ref6.event;
|
|
2296
2302
|
return _this._start(event);
|
|
2297
2303
|
});
|
|
2298
2304
|
this.DS.subscribe('Interaction:init:pre', this._init);
|
|
2299
|
-
this.DS.subscribe('Interaction:end:pre', function (
|
|
2300
|
-
var event =
|
|
2305
|
+
this.DS.subscribe('Interaction:end:pre', function (_ref7) {
|
|
2306
|
+
var event = _ref7.event;
|
|
2301
2307
|
return _this._reset(event);
|
|
2302
2308
|
});
|
|
2303
2309
|
this.DS.subscribe('Area:scroll', this.update);
|
|
@@ -2764,6 +2770,8 @@
|
|
|
2764
2770
|
});
|
|
2765
2771
|
// @ts-ignore: @todo: update to typescript
|
|
2766
2772
|
this.DS.subscribe('Settings:updated:selector', this.attachSelector);
|
|
2773
|
+
// @ts-ignore: @todo: update to typescript
|
|
2774
|
+
this.DS.subscribe('Settings:updated:customStyles', this.attachSelector);
|
|
2767
2775
|
this.attachSelector();
|
|
2768
2776
|
this.DS.subscribe('Interaction:start', this.start);
|
|
2769
2777
|
this.DS.subscribe('Interaction:update', this.update);
|
|
@@ -3385,7 +3393,7 @@
|
|
|
3385
3393
|
/** @param {{settings: Settings, init?: boolean}} props */;
|
|
3386
3394
|
|
|
3387
3395
|
// Setup
|
|
3388
|
-
|
|
3396
|
+
/// ///////////////////////////////////////////////////////////////////////////////////
|
|
3389
3397
|
var DragSelect = /*#__PURE__*/function () {
|
|
3390
3398
|
/**
|
|
3391
3399
|
* used to skip all current Selection and dragNdrop functionality
|
|
@@ -3516,7 +3524,7 @@
|
|
|
3516
3524
|
}
|
|
3517
3525
|
|
|
3518
3526
|
// Useful methods for the user
|
|
3519
|
-
|
|
3527
|
+
/// ///////////////////////////////////////////////////////////////////////////////////
|
|
3520
3528
|
/**
|
|
3521
3529
|
* Initializes the functionality. Automatically triggered when created.
|
|
3522
3530
|
* Also, reset the functionality after a teardown
|
|
@@ -3600,7 +3608,7 @@
|
|
|
3600
3608
|
* Multiple elements can be given at once.
|
|
3601
3609
|
* @param {DSInputElements} elements one or multiple elements
|
|
3602
3610
|
* @param {boolean} [triggerCallback] - if callback should be called
|
|
3603
|
-
* @param {boolean} [
|
|
3611
|
+
* @param {boolean} [removeFromSelectables] - if element should not be added/removed to the list of selectable elements accordingly
|
|
3604
3612
|
* @return {DSElements} all selected elements
|
|
3605
3613
|
*/
|
|
3606
3614
|
}, {
|
|
@@ -3608,9 +3616,9 @@
|
|
|
3608
3616
|
value: function toggleSelection(elements) {
|
|
3609
3617
|
var _this2 = this;
|
|
3610
3618
|
var triggerCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3611
|
-
var
|
|
3619
|
+
var removeFromSelectables = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3612
3620
|
toArray(elements).forEach(function (el) {
|
|
3613
|
-
return _this2.SelectedSet.has(el) ? _this2.removeSelection(elements, triggerCallback,
|
|
3621
|
+
return _this2.SelectedSet.has(el) ? _this2.removeSelection(elements, triggerCallback, removeFromSelectables) : _this2.addSelection(elements, triggerCallback, removeFromSelectables);
|
|
3614
3622
|
});
|
|
3615
3623
|
if (triggerCallback) this.PubSub.publish('callback', {
|
|
3616
3624
|
items: this.getSelection()
|