vis-data 7.1.3 → 7.1.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.
Files changed (38) hide show
  1. package/declarations/data-interface.d.ts +13 -13
  2. package/declarations/data-interface.d.ts.map +1 -1
  3. package/declarations/data-pipe.d.ts.map +1 -1
  4. package/declarations/data-set-part.d.ts +3 -3
  5. package/declarations/data-set-part.d.ts.map +1 -1
  6. package/declarations/data-set.d.ts +2 -2
  7. package/declarations/data-set.d.ts.map +1 -1
  8. package/declarations/data-stream.d.ts +5 -5
  9. package/declarations/data-view.d.ts.map +1 -1
  10. package/dist/esm.js +9149 -7875
  11. package/dist/esm.js.map +1 -1
  12. package/dist/umd.js +9155 -7881
  13. package/dist/umd.js.map +1 -1
  14. package/esnext/esm/vis-data.js +71 -54
  15. package/esnext/esm/vis-data.js.map +1 -1
  16. package/esnext/esm/vis-data.min.js +3 -3
  17. package/esnext/esm/vis-data.min.js.map +1 -1
  18. package/esnext/umd/vis-data.js +71 -56
  19. package/esnext/umd/vis-data.js.map +1 -1
  20. package/esnext/umd/vis-data.min.js +3 -3
  21. package/esnext/umd/vis-data.min.js.map +1 -1
  22. package/package.json +49 -91
  23. package/peer/esm/vis-data.js +6890 -5160
  24. package/peer/esm/vis-data.js.map +1 -1
  25. package/peer/esm/vis-data.min.js +4 -4
  26. package/peer/esm/vis-data.min.js.map +1 -1
  27. package/peer/umd/vis-data.js +6888 -5160
  28. package/peer/umd/vis-data.js.map +1 -1
  29. package/peer/umd/vis-data.min.js +4 -4
  30. package/peer/umd/vis-data.min.js.map +1 -1
  31. package/standalone/esm/vis-data.js +6890 -5160
  32. package/standalone/esm/vis-data.js.map +1 -1
  33. package/standalone/esm/vis-data.min.js +4 -4
  34. package/standalone/esm/vis-data.min.js.map +1 -1
  35. package/standalone/umd/vis-data.js +6888 -5160
  36. package/standalone/umd/vis-data.js.map +1 -1
  37. package/standalone/umd/vis-data.min.js +4 -4
  38. package/standalone/umd/vis-data.min.js.map +1 -1
@@ -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.5
8
+ * @date 2023-03-21T20:54:51.525Z
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
@@ -73,6 +73,17 @@ function createNewDataPipeFrom(from) {
73
73
  * @typeParam TP - Target item type's id property name.
74
74
  */
75
75
  class SimpleDataPipe {
76
+ _source;
77
+ _transformers;
78
+ _target;
79
+ /**
80
+ * Bound listeners for use with `DataInterface['on' | 'off']`.
81
+ */
82
+ _listeners = {
83
+ add: this._add.bind(this),
84
+ remove: this._remove.bind(this),
85
+ update: this._update.bind(this),
86
+ };
76
87
  /**
77
88
  * Create a new data pipe.
78
89
  *
@@ -85,14 +96,6 @@ class SimpleDataPipe {
85
96
  this._source = _source;
86
97
  this._transformers = _transformers;
87
98
  this._target = _target;
88
- /**
89
- * Bound listeners for use with `DataInterface['on' | 'off']`.
90
- */
91
- this._listeners = {
92
- add: this._add.bind(this),
93
- remove: this._remove.bind(this),
94
- update: this._update.bind(this),
95
- };
96
99
  }
97
100
  /** @inheritDoc */
98
101
  all() {
@@ -169,6 +172,12 @@ class SimpleDataPipe {
169
172
  * @typeParam TP - Target item type's id property name.
170
173
  */
171
174
  class DataPipeUnderConstruction {
175
+ _source;
176
+ /**
177
+ * Array transformers used to transform items within the pipe. This is typed
178
+ * as any for the sake of simplicity.
179
+ */
180
+ _transformers = [];
172
181
  /**
173
182
  * Create a new data pipe factory. This is an internal constructor that
174
183
  * should never be called from outside of this file.
@@ -177,11 +186,6 @@ class DataPipeUnderConstruction {
177
186
  */
178
187
  constructor(_source) {
179
188
  this._source = _source;
180
- /**
181
- * Array transformers used to transform items within the pipe. This is typed
182
- * as any for the sake of simplicity.
183
- */
184
- this._transformers = [];
185
189
  }
186
190
  /**
187
191
  * Filter the items.
@@ -248,15 +252,19 @@ function isId(value) {
248
252
  * @typeParam T - The type of method names to be replaced by queued versions.
249
253
  */
250
254
  class Queue {
255
+ /** Delay in milliseconds. If defined the queue will be periodically flushed. */
256
+ delay;
257
+ /** Maximum number of entries in the queue before it will be flushed. */
258
+ max;
259
+ _queue = [];
260
+ _timeout = null;
261
+ _extended = null;
251
262
  /**
252
263
  * Construct a new Queue.
253
264
  *
254
265
  * @param options - Queue configuration.
255
266
  */
256
267
  constructor(options) {
257
- this._queue = [];
258
- this._timeout = null;
259
- this._extended = null;
260
268
  // options
261
269
  this.delay = null;
262
270
  this.max = Infinity;
@@ -404,28 +412,18 @@ class Queue {
404
412
  }
405
413
 
406
414
  /**
407
- * [[DataSet]] code that can be reused in [[DataView]] or other similar implementations of [[DataInterface]].
415
+ * {@link DataSet} code that can be reused in {@link DataView} or other similar implementations of {@link DataInterface}.
408
416
  *
409
417
  * @typeParam Item - Item type that may or may not have an id.
410
418
  * @typeParam IdProp - Name of the property that contains the id.
411
419
  */
412
420
  class DataSetPart {
413
- constructor() {
414
- this._subscribers = {
415
- "*": [],
416
- add: [],
417
- remove: [],
418
- update: [],
419
- };
420
- /**
421
- * @deprecated Use on instead (PS: DataView.subscribe === DataView.on).
422
- */
423
- this.subscribe = DataSetPart.prototype.on;
424
- /**
425
- * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off).
426
- */
427
- this.unsubscribe = DataSetPart.prototype.off;
428
- }
421
+ _subscribers = {
422
+ "*": [],
423
+ add: [],
424
+ remove: [],
425
+ update: [],
426
+ };
429
427
  /**
430
428
  * Trigger an event
431
429
  *
@@ -464,18 +462,27 @@ class DataSetPart {
464
462
  off(event, callback) {
465
463
  this._subscribers[event] = this._subscribers[event].filter((subscriber) => subscriber !== callback);
466
464
  }
465
+ /**
466
+ * @deprecated Use on instead (PS: DataView.subscribe === DataView.on).
467
+ */
468
+ subscribe = DataSetPart.prototype.on;
469
+ /**
470
+ * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off).
471
+ */
472
+ unsubscribe = DataSetPart.prototype.off;
467
473
  }
468
474
 
469
475
  /**
470
476
  * Data stream
471
477
  *
472
478
  * @remarks
473
- * [[DataStream]] offers an always up to date stream of items from a [[DataSet]] or [[DataView]].
474
- * That means that the stream is evaluated at the time of iteration, conversion to another data type or when [[cache]] is called, not when the [[DataStream]] was created.
475
- * Multiple invocations of for example [[toItemArray]] may yield different results (if the data source like for example [[DataSet]] gets modified).
479
+ * {@link DataStream} offers an always up to date stream of items from a {@link DataSet} or {@link DataView}.
480
+ * That means that the stream is evaluated at the time of iteration, conversion to another data type or when {@link cache} is called, not when the {@link DataStream} was created.
481
+ * Multiple invocations of for example {@link toItemArray} may yield different results (if the data source like for example {@link DataSet} gets modified).
476
482
  * @typeParam Item - The item type this stream is going to work with.
477
483
  */
478
484
  class DataStream {
485
+ _pairs;
479
486
  /**
480
487
  * Create a new data stream.
481
488
  *
@@ -589,7 +596,7 @@ class DataStream {
589
596
  *
590
597
  * @remarks
591
598
  * This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
592
- * It can also be used to optimize performance as [[DataStream]] would otherwise reevaluate everything upon each iteration.
599
+ * It can also be used to optimize performance as {@link DataStream} would otherwise reevaluate everything upon each iteration.
593
600
  *
594
601
  * ## Example
595
602
  * ```javascript
@@ -604,7 +611,7 @@ class DataStream {
604
611
  * ds.clear()
605
612
  * chachedStream // Still has all the items.
606
613
  * ```
607
- * @returns A new [[DataStream]] with cached items (detached from the original [[DataSet]]).
614
+ * @returns A new {@link DataStream} with cached items (detached from the original {@link DataSet}).
608
615
  */
609
616
  cache() {
610
617
  return new DataStream([...this._pairs]);
@@ -822,6 +829,18 @@ function ensureFullItem(item, idProp) {
822
829
  * @typeParam IdProp - Name of the property that contains the id.
823
830
  */
824
831
  class DataSet extends DataSetPart {
832
+ /** Flush all queued calls. */
833
+ flush;
834
+ /** @inheritDoc */
835
+ length;
836
+ /** @inheritDoc */
837
+ get idProp() {
838
+ return this._idProp;
839
+ }
840
+ _options;
841
+ _data;
842
+ _idProp;
843
+ _queue = null;
825
844
  /**
826
845
  * Construct a new DataSet.
827
846
  *
@@ -830,7 +849,6 @@ class DataSet extends DataSetPart {
830
849
  */
831
850
  constructor(data, options) {
832
851
  super();
833
- this._queue = null;
834
852
  // correctly read optional arguments
835
853
  if (data && !Array.isArray(data)) {
836
854
  options = data;
@@ -846,10 +864,6 @@ class DataSet extends DataSetPart {
846
864
  }
847
865
  this.setOptions(options);
848
866
  }
849
- /** @inheritDoc */
850
- get idProp() {
851
- return this._idProp;
852
- }
853
867
  /**
854
868
  * Set new options.
855
869
  *
@@ -1067,7 +1081,7 @@ class DataSet extends DataSetPart {
1067
1081
  }
1068
1082
  return { oldData, update };
1069
1083
  })
1070
- .map(({ oldData, update }) => {
1084
+ .map(({ oldData, update, }) => {
1071
1085
  const id = oldData[this._idProp];
1072
1086
  const updatedData = pureDeepObjectAssign(oldData, update);
1073
1087
  this._data.set(id, updatedData);
@@ -1440,7 +1454,7 @@ class DataSet extends DataSetPart {
1440
1454
  /**
1441
1455
  * Clear the entire data set.
1442
1456
  *
1443
- * After the items are removed, the [[DataSet]] will trigger an event `remove` for all removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
1457
+ * After the items are removed, the {@link DataSet} will trigger an event `remove` for all removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
1444
1458
  *
1445
1459
  * @param senderId - Sender id.
1446
1460
  * @returns removedIds - The ids of all removed items.
@@ -1632,6 +1646,16 @@ class DataSet extends DataSetPart {
1632
1646
  * @typeParam IdProp - Name of the property that contains the id.
1633
1647
  */
1634
1648
  class DataView extends DataSetPart {
1649
+ /** @inheritDoc */
1650
+ length = 0;
1651
+ /** @inheritDoc */
1652
+ get idProp() {
1653
+ return this.getDataSet().idProp;
1654
+ }
1655
+ _listener;
1656
+ _data; // constructor → setData
1657
+ _ids = new Set(); // ids of the items currently in memory (just contains a boolean true)
1658
+ _options;
1635
1659
  /**
1636
1660
  * Create a DataView.
1637
1661
  *
@@ -1640,17 +1664,10 @@ class DataView extends DataSetPart {
1640
1664
  */
1641
1665
  constructor(data, options) {
1642
1666
  super();
1643
- /** @inheritDoc */
1644
- this.length = 0;
1645
- this._ids = new Set(); // ids of the items currently in memory (just contains a boolean true)
1646
1667
  this._options = options || {};
1647
1668
  this._listener = this._onEvent.bind(this);
1648
1669
  this.setData(data);
1649
1670
  }
1650
- /** @inheritDoc */
1651
- get idProp() {
1652
- return this.getDataSet().idProp;
1653
- }
1654
1671
  // TODO: implement a function .config() to dynamically update things like configured filter
1655
1672
  // and trigger changes accordingly
1656
1673
  /**