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.
- package/declarations/data-pipe.d.ts.map +1 -1
- package/declarations/data-set-part.d.ts.map +1 -1
- package/declarations/data-set.d.ts.map +1 -1
- package/declarations/data-view.d.ts.map +1 -1
- package/dist/esm.js +1706 -1172
- package/dist/esm.js.map +1 -1
- package/dist/umd.js +1706 -1172
- package/dist/umd.js.map +1 -1
- package/esnext/esm/vis-data.js +64 -47
- package/esnext/esm/vis-data.js.map +1 -1
- package/esnext/esm/vis-data.min.js +3 -3
- package/esnext/esm/vis-data.min.js.map +1 -1
- package/esnext/umd/vis-data.js +64 -47
- package/esnext/umd/vis-data.js.map +1 -1
- package/esnext/umd/vis-data.min.js +3 -3
- package/esnext/umd/vis-data.min.js.map +1 -1
- package/package.json +15 -60
- package/peer/esm/vis-data.js +1703 -1168
- package/peer/esm/vis-data.js.map +1 -1
- package/peer/esm/vis-data.min.js +4 -4
- package/peer/esm/vis-data.min.js.map +1 -1
- package/peer/umd/vis-data.js +1703 -1168
- package/peer/umd/vis-data.js.map +1 -1
- package/peer/umd/vis-data.min.js +4 -4
- package/peer/umd/vis-data.min.js.map +1 -1
- package/standalone/esm/vis-data.js +1703 -1168
- package/standalone/esm/vis-data.js.map +1 -1
- package/standalone/esm/vis-data.min.js +4 -4
- package/standalone/esm/vis-data.min.js.map +1 -1
- package/standalone/umd/vis-data.js +1703 -1168
- package/standalone/umd/vis-data.js.map +1 -1
- package/standalone/umd/vis-data.min.js +4 -4
- package/standalone/umd/vis-data.min.js.map +1 -1
package/esnext/esm/vis-data.js
CHANGED
|
@@ -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.
|
|
8
|
-
* @date 2022-03-
|
|
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
|
|
@@ -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;
|
|
@@ -410,22 +418,12 @@ class Queue {
|
|
|
410
418
|
* @typeParam IdProp - Name of the property that contains the id.
|
|
411
419
|
*/
|
|
412
420
|
class DataSetPart {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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,6 +462,14 @@ 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
|
/**
|
|
@@ -476,6 +482,7 @@ class DataSetPart {
|
|
|
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
|
*
|
|
@@ -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);
|
|
@@ -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
|
/**
|