vis-data 7.1.3 → 7.1.4

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.
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * Manage unstructured data using DataSet. Add, update, and remove data, and listen for changes in the data.
6
6
  *
7
- * @version 7.1.3
8
- * @date 2022-03-02T13:02:54.265Z
7
+ * @version 7.1.4
8
+ * @date 2022-03-15T15:23:59.245Z
9
9
  *
10
10
  * @copyright (c) 2011-2017 Almende B.V, http://almende.com
11
11
  * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
@@ -74,6 +74,17 @@
74
74
  * @typeParam TP - Target item type's id property name.
75
75
  */
76
76
  class SimpleDataPipe {
77
+ _source;
78
+ _transformers;
79
+ _target;
80
+ /**
81
+ * Bound listeners for use with `DataInterface['on' | 'off']`.
82
+ */
83
+ _listeners = {
84
+ add: this._add.bind(this),
85
+ remove: this._remove.bind(this),
86
+ update: this._update.bind(this),
87
+ };
77
88
  /**
78
89
  * Create a new data pipe.
79
90
  *
@@ -86,14 +97,6 @@
86
97
  this._source = _source;
87
98
  this._transformers = _transformers;
88
99
  this._target = _target;
89
- /**
90
- * Bound listeners for use with `DataInterface['on' | 'off']`.
91
- */
92
- this._listeners = {
93
- add: this._add.bind(this),
94
- remove: this._remove.bind(this),
95
- update: this._update.bind(this),
96
- };
97
100
  }
98
101
  /** @inheritDoc */
99
102
  all() {
@@ -170,6 +173,12 @@
170
173
  * @typeParam TP - Target item type's id property name.
171
174
  */
172
175
  class DataPipeUnderConstruction {
176
+ _source;
177
+ /**
178
+ * Array transformers used to transform items within the pipe. This is typed
179
+ * as any for the sake of simplicity.
180
+ */
181
+ _transformers = [];
173
182
  /**
174
183
  * Create a new data pipe factory. This is an internal constructor that
175
184
  * should never be called from outside of this file.
@@ -178,11 +187,6 @@
178
187
  */
179
188
  constructor(_source) {
180
189
  this._source = _source;
181
- /**
182
- * Array transformers used to transform items within the pipe. This is typed
183
- * as any for the sake of simplicity.
184
- */
185
- this._transformers = [];
186
190
  }
187
191
  /**
188
192
  * Filter the items.
@@ -249,15 +253,19 @@
249
253
  * @typeParam T - The type of method names to be replaced by queued versions.
250
254
  */
251
255
  class Queue {
256
+ /** Delay in milliseconds. If defined the queue will be periodically flushed. */
257
+ delay;
258
+ /** Maximum number of entries in the queue before it will be flushed. */
259
+ max;
260
+ _queue = [];
261
+ _timeout = null;
262
+ _extended = null;
252
263
  /**
253
264
  * Construct a new Queue.
254
265
  *
255
266
  * @param options - Queue configuration.
256
267
  */
257
268
  constructor(options) {
258
- this._queue = [];
259
- this._timeout = null;
260
- this._extended = null;
261
269
  // options
262
270
  this.delay = null;
263
271
  this.max = Infinity;
@@ -411,22 +419,12 @@
411
419
  * @typeParam IdProp - Name of the property that contains the id.
412
420
  */
413
421
  class DataSetPart {
414
- constructor() {
415
- this._subscribers = {
416
- "*": [],
417
- add: [],
418
- remove: [],
419
- update: [],
420
- };
421
- /**
422
- * @deprecated Use on instead (PS: DataView.subscribe === DataView.on).
423
- */
424
- this.subscribe = DataSetPart.prototype.on;
425
- /**
426
- * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off).
427
- */
428
- this.unsubscribe = DataSetPart.prototype.off;
429
- }
422
+ _subscribers = {
423
+ "*": [],
424
+ add: [],
425
+ remove: [],
426
+ update: [],
427
+ };
430
428
  /**
431
429
  * Trigger an event
432
430
  *
@@ -465,6 +463,14 @@
465
463
  off(event, callback) {
466
464
  this._subscribers[event] = this._subscribers[event].filter((subscriber) => subscriber !== callback);
467
465
  }
466
+ /**
467
+ * @deprecated Use on instead (PS: DataView.subscribe === DataView.on).
468
+ */
469
+ subscribe = DataSetPart.prototype.on;
470
+ /**
471
+ * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off).
472
+ */
473
+ unsubscribe = DataSetPart.prototype.off;
468
474
  }
469
475
 
470
476
  /**
@@ -477,6 +483,7 @@
477
483
  * @typeParam Item - The item type this stream is going to work with.
478
484
  */
479
485
  class DataStream {
486
+ _pairs;
480
487
  /**
481
488
  * Create a new data stream.
482
489
  *
@@ -823,6 +830,18 @@
823
830
  * @typeParam IdProp - Name of the property that contains the id.
824
831
  */
825
832
  class DataSet extends DataSetPart {
833
+ /** Flush all queued calls. */
834
+ flush;
835
+ /** @inheritDoc */
836
+ length;
837
+ /** @inheritDoc */
838
+ get idProp() {
839
+ return this._idProp;
840
+ }
841
+ _options;
842
+ _data;
843
+ _idProp;
844
+ _queue = null;
826
845
  /**
827
846
  * Construct a new DataSet.
828
847
  *
@@ -831,7 +850,6 @@
831
850
  */
832
851
  constructor(data, options) {
833
852
  super();
834
- this._queue = null;
835
853
  // correctly read optional arguments
836
854
  if (data && !Array.isArray(data)) {
837
855
  options = data;
@@ -847,10 +865,6 @@
847
865
  }
848
866
  this.setOptions(options);
849
867
  }
850
- /** @inheritDoc */
851
- get idProp() {
852
- return this._idProp;
853
- }
854
868
  /**
855
869
  * Set new options.
856
870
  *
@@ -1068,7 +1082,7 @@
1068
1082
  }
1069
1083
  return { oldData, update };
1070
1084
  })
1071
- .map(({ oldData, update }) => {
1085
+ .map(({ oldData, update, }) => {
1072
1086
  const id = oldData[this._idProp];
1073
1087
  const updatedData = esnext.pureDeepObjectAssign(oldData, update);
1074
1088
  this._data.set(id, updatedData);
@@ -1633,6 +1647,16 @@
1633
1647
  * @typeParam IdProp - Name of the property that contains the id.
1634
1648
  */
1635
1649
  class DataView extends DataSetPart {
1650
+ /** @inheritDoc */
1651
+ length = 0;
1652
+ /** @inheritDoc */
1653
+ get idProp() {
1654
+ return this.getDataSet().idProp;
1655
+ }
1656
+ _listener;
1657
+ _data; // constructor → setData
1658
+ _ids = new Set(); // ids of the items currently in memory (just contains a boolean true)
1659
+ _options;
1636
1660
  /**
1637
1661
  * Create a DataView.
1638
1662
  *
@@ -1641,17 +1665,10 @@
1641
1665
  */
1642
1666
  constructor(data, options) {
1643
1667
  super();
1644
- /** @inheritDoc */
1645
- this.length = 0;
1646
- this._ids = new Set(); // ids of the items currently in memory (just contains a boolean true)
1647
1668
  this._options = options || {};
1648
1669
  this._listener = this._onEvent.bind(this);
1649
1670
  this.setData(data);
1650
1671
  }
1651
- /** @inheritDoc */
1652
- get idProp() {
1653
- return this.getDataSet().idProp;
1654
- }
1655
1672
  // TODO: implement a function .config() to dynamically update things like configured filter
1656
1673
  // and trigger changes accordingly
1657
1674
  /**