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
@@ -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;
@@ -405,28 +413,18 @@
405
413
  }
406
414
 
407
415
  /**
408
- * [[DataSet]] code that can be reused in [[DataView]] or other similar implementations of [[DataInterface]].
416
+ * {@link DataSet} code that can be reused in {@link DataView} or other similar implementations of {@link DataInterface}.
409
417
  *
410
418
  * @typeParam Item - Item type that may or may not have an id.
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,18 +463,27 @@
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
  /**
471
477
  * Data stream
472
478
  *
473
479
  * @remarks
474
- * [[DataStream]] offers an always up to date stream of items from a [[DataSet]] or [[DataView]].
475
- * 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.
476
- * Multiple invocations of for example [[toItemArray]] may yield different results (if the data source like for example [[DataSet]] gets modified).
480
+ * {@link DataStream} offers an always up to date stream of items from a {@link DataSet} or {@link DataView}.
481
+ * 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.
482
+ * Multiple invocations of for example {@link toItemArray} may yield different results (if the data source like for example {@link DataSet} gets modified).
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
  *
@@ -590,7 +597,7 @@
590
597
  *
591
598
  * @remarks
592
599
  * This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
593
- * It can also be used to optimize performance as [[DataStream]] would otherwise reevaluate everything upon each iteration.
600
+ * It can also be used to optimize performance as {@link DataStream} would otherwise reevaluate everything upon each iteration.
594
601
  *
595
602
  * ## Example
596
603
  * ```javascript
@@ -605,7 +612,7 @@
605
612
  * ds.clear()
606
613
  * chachedStream // Still has all the items.
607
614
  * ```
608
- * @returns A new [[DataStream]] with cached items (detached from the original [[DataSet]]).
615
+ * @returns A new {@link DataStream} with cached items (detached from the original {@link DataSet}).
609
616
  */
610
617
  cache() {
611
618
  return new DataStream([...this._pairs]);
@@ -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);
@@ -1441,7 +1455,7 @@
1441
1455
  /**
1442
1456
  * Clear the entire data set.
1443
1457
  *
1444
- * 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.
1458
+ * 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.
1445
1459
  *
1446
1460
  * @param senderId - Sender id.
1447
1461
  * @returns removedIds - The ids of all removed items.
@@ -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
  /**
@@ -2040,7 +2057,5 @@
2040
2057
  exports.isDataSetLike = isDataSetLike;
2041
2058
  exports.isDataViewLike = isDataViewLike;
2042
2059
 
2043
- Object.defineProperty(exports, '__esModule', { value: true });
2044
-
2045
2060
  }));
2046
2061
  //# sourceMappingURL=vis-data.js.map