vis-data 7.1.8 → 7.1.10
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-interface.d.ts +0 -46
- package/declarations/data-interface.d.ts.map +1 -1
- package/declarations/data-pipe.d.ts +0 -8
- package/declarations/data-pipe.d.ts.map +1 -1
- package/declarations/data-set-check.d.ts +0 -1
- package/declarations/data-set-check.d.ts.map +1 -1
- package/declarations/data-set-part.d.ts +0 -1
- package/declarations/data-set-part.d.ts.map +1 -1
- package/declarations/data-set.d.ts +14 -28
- package/declarations/data-set.d.ts.map +1 -1
- package/declarations/data-stream.d.ts +0 -18
- package/declarations/data-stream.d.ts.map +1 -1
- package/declarations/data-view-check.d.ts +0 -1
- package/declarations/data-view-check.d.ts.map +1 -1
- package/declarations/data-view.d.ts +9 -15
- package/declarations/data-view.d.ts.map +1 -1
- package/declarations/queue.d.ts +0 -7
- package/declarations/queue.d.ts.map +1 -1
- package/dist/esm.js +133 -266
- package/dist/esm.js.map +1 -1
- package/dist/umd.js +133 -266
- package/dist/umd.js.map +1 -1
- package/esnext/esm/vis-data.js +25 -91
- package/esnext/esm/vis-data.js.map +1 -1
- package/esnext/esm/vis-data.min.js +2 -2
- package/esnext/esm/vis-data.min.js.map +1 -1
- package/esnext/umd/vis-data.js +25 -91
- package/esnext/umd/vis-data.js.map +1 -1
- package/esnext/umd/vis-data.min.js +2 -2
- package/esnext/umd/vis-data.min.js.map +1 -1
- package/package.json +19 -14
- package/peer/esm/vis-data.js +131 -264
- 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 +131 -264
- 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 +131 -264
- 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 +131 -264
- 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
|
@@ -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
|
|
7
|
+
* @version 7.1.10
|
|
8
|
+
* @date 2025-07-06T08:42:20.006Z
|
|
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
|
|
@@ -3179,7 +3179,6 @@
|
|
|
3179
3179
|
|
|
3180
3180
|
/**
|
|
3181
3181
|
* Create new data pipe.
|
|
3182
|
-
*
|
|
3183
3182
|
* @param from - The source data set or data view.
|
|
3184
3183
|
* @remarks
|
|
3185
3184
|
* Example usage:
|
|
@@ -3215,7 +3214,6 @@
|
|
|
3215
3214
|
/**
|
|
3216
3215
|
* Internal implementation of the pipe. This should be accessible only through
|
|
3217
3216
|
* `createNewDataPipeFrom` from the outside.
|
|
3218
|
-
*
|
|
3219
3217
|
* @typeParam SI - Source item type.
|
|
3220
3218
|
* @typeParam SP - Source item type's id property name.
|
|
3221
3219
|
* @typeParam TI - Target item type.
|
|
@@ -3224,7 +3222,6 @@
|
|
|
3224
3222
|
var SimpleDataPipe = /*#__PURE__*/function () {
|
|
3225
3223
|
/**
|
|
3226
3224
|
* Create a new data pipe.
|
|
3227
|
-
*
|
|
3228
3225
|
* @param _source - The data set or data view that will be observed.
|
|
3229
3226
|
* @param _transformers - An array of transforming functions to be used to
|
|
3230
3227
|
* filter or transform the items in the pipe.
|
|
@@ -3272,7 +3269,6 @@
|
|
|
3272
3269
|
}
|
|
3273
3270
|
/**
|
|
3274
3271
|
* Apply the transformers to the items.
|
|
3275
|
-
*
|
|
3276
3272
|
* @param items - The items to be transformed.
|
|
3277
3273
|
* @returns The transformed items.
|
|
3278
3274
|
*/
|
|
@@ -3286,7 +3282,6 @@
|
|
|
3286
3282
|
}
|
|
3287
3283
|
/**
|
|
3288
3284
|
* Handle an add event.
|
|
3289
|
-
*
|
|
3290
3285
|
* @param _name - Ignored.
|
|
3291
3286
|
* @param payload - The payload containing the ids of the added items.
|
|
3292
3287
|
*/
|
|
@@ -3300,7 +3295,6 @@
|
|
|
3300
3295
|
}
|
|
3301
3296
|
/**
|
|
3302
3297
|
* Handle an update event.
|
|
3303
|
-
*
|
|
3304
3298
|
* @param _name - Ignored.
|
|
3305
3299
|
* @param payload - The payload containing the ids of the updated items.
|
|
3306
3300
|
*/
|
|
@@ -3314,7 +3308,6 @@
|
|
|
3314
3308
|
}
|
|
3315
3309
|
/**
|
|
3316
3310
|
* Handle a remove event.
|
|
3317
|
-
*
|
|
3318
3311
|
* @param _name - Ignored.
|
|
3319
3312
|
* @param payload - The payload containing the data of the removed items.
|
|
3320
3313
|
*/
|
|
@@ -3332,7 +3325,6 @@
|
|
|
3332
3325
|
/**
|
|
3333
3326
|
* Internal implementation of the pipe factory. This should be accessible
|
|
3334
3327
|
* only through `createNewDataPipeFrom` from the outside.
|
|
3335
|
-
*
|
|
3336
3328
|
* @typeParam TI - Target item type.
|
|
3337
3329
|
* @typeParam TP - Target item type's id property name.
|
|
3338
3330
|
*/
|
|
@@ -3340,7 +3332,6 @@
|
|
|
3340
3332
|
/**
|
|
3341
3333
|
* Create a new data pipe factory. This is an internal constructor that
|
|
3342
3334
|
* should never be called from outside of this file.
|
|
3343
|
-
*
|
|
3344
3335
|
* @param _source - The source data set or data view for this pipe.
|
|
3345
3336
|
*/
|
|
3346
3337
|
function DataPipeUnderConstruction(_source) {
|
|
@@ -3354,7 +3345,6 @@
|
|
|
3354
3345
|
}
|
|
3355
3346
|
/**
|
|
3356
3347
|
* Filter the items.
|
|
3357
|
-
*
|
|
3358
3348
|
* @param callback - A filtering function that returns true if given item
|
|
3359
3349
|
* should be piped and false if not.
|
|
3360
3350
|
* @returns This factory for further configuration.
|
|
@@ -3369,7 +3359,6 @@
|
|
|
3369
3359
|
}
|
|
3370
3360
|
/**
|
|
3371
3361
|
* Map each source item to a new type.
|
|
3372
|
-
*
|
|
3373
3362
|
* @param callback - A mapping function that takes a source item and returns
|
|
3374
3363
|
* corresponding mapped item.
|
|
3375
3364
|
* @typeParam TI - Target item type.
|
|
@@ -3386,7 +3375,6 @@
|
|
|
3386
3375
|
}
|
|
3387
3376
|
/**
|
|
3388
3377
|
* Map each source item to zero or more items of a new type.
|
|
3389
|
-
*
|
|
3390
3378
|
* @param callback - A mapping function that takes a source item and returns
|
|
3391
3379
|
* an array of corresponding mapped items.
|
|
3392
3380
|
* @typeParam TI - Target item type.
|
|
@@ -3403,7 +3391,6 @@
|
|
|
3403
3391
|
}
|
|
3404
3392
|
/**
|
|
3405
3393
|
* Connect this pipe to given data set.
|
|
3406
|
-
*
|
|
3407
3394
|
* @param target - The data set that will receive the items from this pipe.
|
|
3408
3395
|
* @returns The pipe connected between given data sets and performing
|
|
3409
3396
|
* configured transformation on the processed items.
|
|
@@ -4435,179 +4422,112 @@
|
|
|
4435
4422
|
var componentEmitter = {exports: {}};
|
|
4436
4423
|
|
|
4437
4424
|
(function (module) {
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
}
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
function
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
}
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
Emitter.prototype.
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
if (cb === fn || cb.fn === fn) {
|
|
4545
|
-
callbacks.splice(i, 1);
|
|
4546
|
-
break;
|
|
4547
|
-
}
|
|
4548
|
-
}
|
|
4549
|
-
|
|
4550
|
-
// Remove event specific arrays for event types that no
|
|
4551
|
-
// one is subscribed for to avoid memory leak.
|
|
4552
|
-
if (callbacks.length === 0) {
|
|
4553
|
-
delete this._callbacks['$' + event];
|
|
4554
|
-
}
|
|
4555
|
-
|
|
4556
|
-
return this;
|
|
4557
|
-
};
|
|
4558
|
-
|
|
4559
|
-
/**
|
|
4560
|
-
* Emit `event` with the given args.
|
|
4561
|
-
*
|
|
4562
|
-
* @param {String} event
|
|
4563
|
-
* @param {Mixed} ...
|
|
4564
|
-
* @return {Emitter}
|
|
4565
|
-
*/
|
|
4566
|
-
|
|
4567
|
-
Emitter.prototype.emit = function(event){
|
|
4568
|
-
this._callbacks = this._callbacks || {};
|
|
4569
|
-
|
|
4570
|
-
var args = new Array(arguments.length - 1)
|
|
4571
|
-
, callbacks = this._callbacks['$' + event];
|
|
4572
|
-
|
|
4573
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
4574
|
-
args[i - 1] = arguments[i];
|
|
4575
|
-
}
|
|
4576
|
-
|
|
4577
|
-
if (callbacks) {
|
|
4578
|
-
callbacks = callbacks.slice(0);
|
|
4579
|
-
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
|
4580
|
-
callbacks[i].apply(this, args);
|
|
4581
|
-
}
|
|
4582
|
-
}
|
|
4583
|
-
|
|
4584
|
-
return this;
|
|
4585
|
-
};
|
|
4586
|
-
|
|
4587
|
-
/**
|
|
4588
|
-
* Return array of callbacks for `event`.
|
|
4589
|
-
*
|
|
4590
|
-
* @param {String} event
|
|
4591
|
-
* @return {Array}
|
|
4592
|
-
* @api public
|
|
4593
|
-
*/
|
|
4594
|
-
|
|
4595
|
-
Emitter.prototype.listeners = function(event){
|
|
4596
|
-
this._callbacks = this._callbacks || {};
|
|
4597
|
-
return this._callbacks['$' + event] || [];
|
|
4598
|
-
};
|
|
4599
|
-
|
|
4600
|
-
/**
|
|
4601
|
-
* Check if this emitter has `event` handlers.
|
|
4602
|
-
*
|
|
4603
|
-
* @param {String} event
|
|
4604
|
-
* @return {Boolean}
|
|
4605
|
-
* @api public
|
|
4606
|
-
*/
|
|
4607
|
-
|
|
4608
|
-
Emitter.prototype.hasListeners = function(event){
|
|
4609
|
-
return !! this.listeners(event).length;
|
|
4610
|
-
};
|
|
4425
|
+
function Emitter(object) {
|
|
4426
|
+
if (object) {
|
|
4427
|
+
return mixin(object);
|
|
4428
|
+
}
|
|
4429
|
+
|
|
4430
|
+
this._callbacks = new Map();
|
|
4431
|
+
}
|
|
4432
|
+
|
|
4433
|
+
function mixin(object) {
|
|
4434
|
+
Object.assign(object, Emitter.prototype);
|
|
4435
|
+
object._callbacks = new Map();
|
|
4436
|
+
return object;
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
Emitter.prototype.on = function (event, listener) {
|
|
4440
|
+
const callbacks = this._callbacks.get(event) ?? [];
|
|
4441
|
+
callbacks.push(listener);
|
|
4442
|
+
this._callbacks.set(event, callbacks);
|
|
4443
|
+
return this;
|
|
4444
|
+
};
|
|
4445
|
+
|
|
4446
|
+
Emitter.prototype.once = function (event, listener) {
|
|
4447
|
+
const on = (...arguments_) => {
|
|
4448
|
+
this.off(event, on);
|
|
4449
|
+
listener.apply(this, arguments_);
|
|
4450
|
+
};
|
|
4451
|
+
|
|
4452
|
+
on.fn = listener;
|
|
4453
|
+
this.on(event, on);
|
|
4454
|
+
return this;
|
|
4455
|
+
};
|
|
4456
|
+
|
|
4457
|
+
Emitter.prototype.off = function (event, listener) {
|
|
4458
|
+
if (event === undefined && listener === undefined) {
|
|
4459
|
+
this._callbacks.clear();
|
|
4460
|
+
return this;
|
|
4461
|
+
}
|
|
4462
|
+
|
|
4463
|
+
if (listener === undefined) {
|
|
4464
|
+
this._callbacks.delete(event);
|
|
4465
|
+
return this;
|
|
4466
|
+
}
|
|
4467
|
+
|
|
4468
|
+
const callbacks = this._callbacks.get(event);
|
|
4469
|
+
if (callbacks) {
|
|
4470
|
+
for (const [index, callback] of callbacks.entries()) {
|
|
4471
|
+
if (callback === listener || callback.fn === listener) {
|
|
4472
|
+
callbacks.splice(index, 1);
|
|
4473
|
+
break;
|
|
4474
|
+
}
|
|
4475
|
+
}
|
|
4476
|
+
|
|
4477
|
+
if (callbacks.length === 0) {
|
|
4478
|
+
this._callbacks.delete(event);
|
|
4479
|
+
} else {
|
|
4480
|
+
this._callbacks.set(event, callbacks);
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4483
|
+
|
|
4484
|
+
return this;
|
|
4485
|
+
};
|
|
4486
|
+
|
|
4487
|
+
Emitter.prototype.emit = function (event, ...arguments_) {
|
|
4488
|
+
const callbacks = this._callbacks.get(event);
|
|
4489
|
+
if (callbacks) {
|
|
4490
|
+
// Create a copy of the callbacks array to avoid issues if it's modified during iteration
|
|
4491
|
+
const callbacksCopy = [...callbacks];
|
|
4492
|
+
|
|
4493
|
+
for (const callback of callbacksCopy) {
|
|
4494
|
+
callback.apply(this, arguments_);
|
|
4495
|
+
}
|
|
4496
|
+
}
|
|
4497
|
+
|
|
4498
|
+
return this;
|
|
4499
|
+
};
|
|
4500
|
+
|
|
4501
|
+
Emitter.prototype.listeners = function (event) {
|
|
4502
|
+
return this._callbacks.get(event) ?? [];
|
|
4503
|
+
};
|
|
4504
|
+
|
|
4505
|
+
Emitter.prototype.listenerCount = function (event) {
|
|
4506
|
+
if (event) {
|
|
4507
|
+
return this.listeners(event).length;
|
|
4508
|
+
}
|
|
4509
|
+
|
|
4510
|
+
let totalCount = 0;
|
|
4511
|
+
for (const callbacks of this._callbacks.values()) {
|
|
4512
|
+
totalCount += callbacks.length;
|
|
4513
|
+
}
|
|
4514
|
+
|
|
4515
|
+
return totalCount;
|
|
4516
|
+
};
|
|
4517
|
+
|
|
4518
|
+
Emitter.prototype.hasListeners = function (event) {
|
|
4519
|
+
return this.listenerCount(event) > 0;
|
|
4520
|
+
};
|
|
4521
|
+
|
|
4522
|
+
// Aliases
|
|
4523
|
+
Emitter.prototype.addEventListener = Emitter.prototype.on;
|
|
4524
|
+
Emitter.prototype.removeListener = Emitter.prototype.off;
|
|
4525
|
+
Emitter.prototype.removeEventListener = Emitter.prototype.off;
|
|
4526
|
+
Emitter.prototype.removeAllListeners = Emitter.prototype.off;
|
|
4527
|
+
|
|
4528
|
+
{
|
|
4529
|
+
module.exports = Emitter;
|
|
4530
|
+
}
|
|
4611
4531
|
} (componentEmitter));
|
|
4612
4532
|
|
|
4613
4533
|
var componentEmitterExports = componentEmitter.exports;
|
|
@@ -10570,7 +10490,6 @@
|
|
|
10570
10490
|
|
|
10571
10491
|
/**
|
|
10572
10492
|
* Determine whether a value can be used as an id.
|
|
10573
|
-
*
|
|
10574
10493
|
* @param value - Input value of unknown type.
|
|
10575
10494
|
* @returns True if the value is valid id, false otherwise.
|
|
10576
10495
|
*/
|
|
@@ -10580,13 +10499,11 @@
|
|
|
10580
10499
|
|
|
10581
10500
|
/**
|
|
10582
10501
|
* A queue.
|
|
10583
|
-
*
|
|
10584
10502
|
* @typeParam T - The type of method names to be replaced by queued versions.
|
|
10585
10503
|
*/
|
|
10586
10504
|
var Queue = /*#__PURE__*/function () {
|
|
10587
10505
|
/**
|
|
10588
10506
|
* Construct a new Queue.
|
|
10589
|
-
*
|
|
10590
10507
|
* @param options - Queue configuration.
|
|
10591
10508
|
*/
|
|
10592
10509
|
function Queue(options) {
|
|
@@ -10603,7 +10520,6 @@
|
|
|
10603
10520
|
}
|
|
10604
10521
|
/**
|
|
10605
10522
|
* Update the configuration of the queue.
|
|
10606
|
-
*
|
|
10607
10523
|
* @param options - Queue configuration.
|
|
10608
10524
|
*/
|
|
10609
10525
|
_createClass(Queue, [{
|
|
@@ -10620,7 +10536,6 @@
|
|
|
10620
10536
|
/**
|
|
10621
10537
|
* Extend an object with queuing functionality.
|
|
10622
10538
|
* The object will be extended with a function flush, and the methods provided in options.replace will be replaced with queued ones.
|
|
10623
|
-
*
|
|
10624
10539
|
* @param object - The object to be extended.
|
|
10625
10540
|
* @param options - Additional options.
|
|
10626
10541
|
* @returns The created queue.
|
|
@@ -10651,7 +10566,6 @@
|
|
|
10651
10566
|
}
|
|
10652
10567
|
/**
|
|
10653
10568
|
* Replace a method on an object with a queued version.
|
|
10654
|
-
*
|
|
10655
10569
|
* @param object - Object having the method.
|
|
10656
10570
|
* @param method - The method name.
|
|
10657
10571
|
*/
|
|
@@ -10678,7 +10592,6 @@
|
|
|
10678
10592
|
}
|
|
10679
10593
|
/**
|
|
10680
10594
|
* Queue a call.
|
|
10681
|
-
*
|
|
10682
10595
|
* @param entry - The function or entry to be queued.
|
|
10683
10596
|
*/
|
|
10684
10597
|
}, {
|
|
@@ -10764,7 +10677,6 @@
|
|
|
10764
10677
|
|
|
10765
10678
|
/**
|
|
10766
10679
|
* {@link DataSet} code that can be reused in {@link DataView} or other similar implementations of {@link DataInterface}.
|
|
10767
|
-
*
|
|
10768
10680
|
* @typeParam Item - Item type that may or may not have an id.
|
|
10769
10681
|
* @typeParam IdProp - Name of the property that contains the id.
|
|
10770
10682
|
*/
|
|
@@ -10791,7 +10703,6 @@
|
|
|
10791
10703
|
value:
|
|
10792
10704
|
/**
|
|
10793
10705
|
* Trigger an event
|
|
10794
|
-
*
|
|
10795
10706
|
* @param event - Event name.
|
|
10796
10707
|
* @param payload - Event payload.
|
|
10797
10708
|
* @param senderId - Id of the sender.
|
|
@@ -10807,7 +10718,6 @@
|
|
|
10807
10718
|
}
|
|
10808
10719
|
/**
|
|
10809
10720
|
* Subscribe to an event, add an event listener.
|
|
10810
|
-
*
|
|
10811
10721
|
* @remarks Non-function callbacks are ignored.
|
|
10812
10722
|
* @param event - Event name.
|
|
10813
10723
|
* @param callback - Callback method.
|
|
@@ -10822,7 +10732,6 @@
|
|
|
10822
10732
|
}
|
|
10823
10733
|
/**
|
|
10824
10734
|
* Unsubscribe from an event, remove an event listener.
|
|
10825
|
-
*
|
|
10826
10735
|
* @remarks If the same callback was subscribed more than once **all** occurences will be removed.
|
|
10827
10736
|
* @param event - Event name.
|
|
10828
10737
|
* @param callback - Callback method.
|
|
@@ -10889,7 +10798,6 @@
|
|
|
10889
10798
|
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10890
10799
|
/**
|
|
10891
10800
|
* Data stream
|
|
10892
|
-
*
|
|
10893
10801
|
* @remarks
|
|
10894
10802
|
* {@link DataStream} offers an always up to date stream of items from a {@link DataSet} or {@link DataView}.
|
|
10895
10803
|
* 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.
|
|
@@ -10899,7 +10807,6 @@
|
|
|
10899
10807
|
var DataStream = /*#__PURE__*/function (_Symbol$iterator$1) {
|
|
10900
10808
|
/**
|
|
10901
10809
|
* Create a new data stream.
|
|
10902
|
-
*
|
|
10903
10810
|
* @param pairs - The id, item pairs.
|
|
10904
10811
|
*/
|
|
10905
10812
|
function DataStream(pairs) {
|
|
@@ -11080,7 +10987,6 @@
|
|
|
11080
10987
|
})
|
|
11081
10988
|
/**
|
|
11082
10989
|
* Return an array containing all the ids in this stream.
|
|
11083
|
-
*
|
|
11084
10990
|
* @remarks
|
|
11085
10991
|
* The array may contain duplicities.
|
|
11086
10992
|
* @returns The array with all ids from this stream.
|
|
@@ -11095,7 +11001,6 @@
|
|
|
11095
11001
|
}
|
|
11096
11002
|
/**
|
|
11097
11003
|
* Return an array containing all the items in this stream.
|
|
11098
|
-
*
|
|
11099
11004
|
* @remarks
|
|
11100
11005
|
* The array may contain duplicities.
|
|
11101
11006
|
* @returns The array with all items from this stream.
|
|
@@ -11110,7 +11015,6 @@
|
|
|
11110
11015
|
}
|
|
11111
11016
|
/**
|
|
11112
11017
|
* Return an array containing all the entries in this stream.
|
|
11113
|
-
*
|
|
11114
11018
|
* @remarks
|
|
11115
11019
|
* The array may contain duplicities.
|
|
11116
11020
|
* @returns The array with all entries from this stream.
|
|
@@ -11122,7 +11026,6 @@
|
|
|
11122
11026
|
}
|
|
11123
11027
|
/**
|
|
11124
11028
|
* Return an object map containing all the items in this stream accessible by ids.
|
|
11125
|
-
*
|
|
11126
11029
|
* @remarks
|
|
11127
11030
|
* In case of duplicate ids (coerced to string so `7 == '7'`) the last encoutered appears in the returned object.
|
|
11128
11031
|
* @returns The object map of all id → item pairs from this stream.
|
|
@@ -11149,7 +11052,6 @@
|
|
|
11149
11052
|
}
|
|
11150
11053
|
/**
|
|
11151
11054
|
* Return a map containing all the items in this stream accessible by ids.
|
|
11152
|
-
*
|
|
11153
11055
|
* @returns The map of all id → item pairs from this stream.
|
|
11154
11056
|
*/
|
|
11155
11057
|
}, {
|
|
@@ -11159,7 +11061,6 @@
|
|
|
11159
11061
|
}
|
|
11160
11062
|
/**
|
|
11161
11063
|
* Return a set containing all the (unique) ids in this stream.
|
|
11162
|
-
*
|
|
11163
11064
|
* @returns The set of all ids from this stream.
|
|
11164
11065
|
*/
|
|
11165
11066
|
}, {
|
|
@@ -11169,7 +11070,6 @@
|
|
|
11169
11070
|
}
|
|
11170
11071
|
/**
|
|
11171
11072
|
* Return a set containing all the (unique) items in this stream.
|
|
11172
|
-
*
|
|
11173
11073
|
* @returns The set of all items from this stream.
|
|
11174
11074
|
*/
|
|
11175
11075
|
}, {
|
|
@@ -11179,7 +11079,6 @@
|
|
|
11179
11079
|
}
|
|
11180
11080
|
/**
|
|
11181
11081
|
* Cache the items from this stream.
|
|
11182
|
-
*
|
|
11183
11082
|
* @remarks
|
|
11184
11083
|
* This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
|
|
11185
11084
|
* It can also be used to optimize performance as {@link DataStream} would otherwise reevaluate everything upon each iteration.
|
|
@@ -11206,7 +11105,6 @@
|
|
|
11206
11105
|
}
|
|
11207
11106
|
/**
|
|
11208
11107
|
* Get the distinct values of given property.
|
|
11209
|
-
*
|
|
11210
11108
|
* @param callback - The function that picks and possibly converts the property.
|
|
11211
11109
|
* @typeParam T - The type of the distinct value.
|
|
11212
11110
|
* @returns A set of all distinct properties.
|
|
@@ -11233,7 +11131,6 @@
|
|
|
11233
11131
|
}
|
|
11234
11132
|
/**
|
|
11235
11133
|
* Filter the items of the stream.
|
|
11236
|
-
*
|
|
11237
11134
|
* @param callback - The function that decides whether an item will be included.
|
|
11238
11135
|
* @returns A new data stream with the filtered items.
|
|
11239
11136
|
*/
|
|
@@ -11288,7 +11185,6 @@
|
|
|
11288
11185
|
}
|
|
11289
11186
|
/**
|
|
11290
11187
|
* Execute a callback for each item of the stream.
|
|
11291
|
-
*
|
|
11292
11188
|
* @param callback - The function that will be invoked for each item.
|
|
11293
11189
|
*/
|
|
11294
11190
|
}, {
|
|
@@ -11311,7 +11207,6 @@
|
|
|
11311
11207
|
}
|
|
11312
11208
|
/**
|
|
11313
11209
|
* Map the items into a different type.
|
|
11314
|
-
*
|
|
11315
11210
|
* @param callback - The function that does the conversion.
|
|
11316
11211
|
* @typeParam Mapped - The type of the item after mapping.
|
|
11317
11212
|
* @returns A new data stream with the mapped items.
|
|
@@ -11363,7 +11258,6 @@
|
|
|
11363
11258
|
}
|
|
11364
11259
|
/**
|
|
11365
11260
|
* Get the item with the maximum value of given property.
|
|
11366
|
-
*
|
|
11367
11261
|
* @param callback - The function that picks and possibly converts the property.
|
|
11368
11262
|
* @returns The item with the maximum if found otherwise null.
|
|
11369
11263
|
*/
|
|
@@ -11391,7 +11285,6 @@
|
|
|
11391
11285
|
}
|
|
11392
11286
|
/**
|
|
11393
11287
|
* Get the item with the minimum value of given property.
|
|
11394
|
-
*
|
|
11395
11288
|
* @param callback - The function that picks and possibly converts the property.
|
|
11396
11289
|
* @returns The item with the minimum if found otherwise null.
|
|
11397
11290
|
*/
|
|
@@ -11419,7 +11312,6 @@
|
|
|
11419
11312
|
}
|
|
11420
11313
|
/**
|
|
11421
11314
|
* Reduce the items into a single value.
|
|
11422
|
-
*
|
|
11423
11315
|
* @param callback - The function that does the reduction.
|
|
11424
11316
|
* @param accumulator - The initial value of the accumulator.
|
|
11425
11317
|
* @typeParam T - The type of the accumulated value.
|
|
@@ -11446,7 +11338,6 @@
|
|
|
11446
11338
|
}
|
|
11447
11339
|
/**
|
|
11448
11340
|
* Sort the items.
|
|
11449
|
-
*
|
|
11450
11341
|
* @param callback - Item comparator.
|
|
11451
11342
|
* @returns A new stream with sorted items.
|
|
11452
11343
|
*/
|
|
@@ -11482,7 +11373,6 @@
|
|
|
11482
11373
|
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11483
11374
|
/**
|
|
11484
11375
|
* Add an id to given item if it doesn't have one already.
|
|
11485
|
-
*
|
|
11486
11376
|
* @remarks
|
|
11487
11377
|
* The item will be modified.
|
|
11488
11378
|
* @param item - The item that will have an id after a call to this function.
|
|
@@ -11520,15 +11410,15 @@
|
|
|
11520
11410
|
* // add items
|
|
11521
11411
|
* // note that the data items can contain different properties and data formats
|
|
11522
11412
|
* data.add([
|
|
11523
|
-
*
|
|
11524
|
-
*
|
|
11525
|
-
*
|
|
11526
|
-
*
|
|
11413
|
+
* {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
|
|
11414
|
+
* {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
|
|
11415
|
+
* {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
|
|
11416
|
+
* {id: 4, text: 'item 4'}
|
|
11527
11417
|
* ]);
|
|
11528
11418
|
*
|
|
11529
11419
|
* // subscribe to any change in the DataSet
|
|
11530
11420
|
* data.on('*', function (event, properties, senderId) {
|
|
11531
|
-
*
|
|
11421
|
+
* console.log('event', event, properties);
|
|
11532
11422
|
* });
|
|
11533
11423
|
*
|
|
11534
11424
|
* // update an existing item
|
|
@@ -11547,13 +11437,12 @@
|
|
|
11547
11437
|
*
|
|
11548
11438
|
* // retrieve a filtered subset of the data
|
|
11549
11439
|
* var items = data.get({
|
|
11550
|
-
*
|
|
11551
|
-
*
|
|
11552
|
-
*
|
|
11440
|
+
* filter: function (item) {
|
|
11441
|
+
* return item.group == 1;
|
|
11442
|
+
* }
|
|
11553
11443
|
* });
|
|
11554
11444
|
* console.log('filtered items', items);
|
|
11555
11445
|
* ```
|
|
11556
|
-
*
|
|
11557
11446
|
* @typeParam Item - Item type that may or may not have an id.
|
|
11558
11447
|
* @typeParam IdProp - Name of the property that contains the id.
|
|
11559
11448
|
*/
|
|
@@ -11562,7 +11451,6 @@
|
|
|
11562
11451
|
var _super = _createSuper$1(DataSet);
|
|
11563
11452
|
/**
|
|
11564
11453
|
* Construct a new DataSet.
|
|
11565
|
-
*
|
|
11566
11454
|
* @param data - Initial data or options.
|
|
11567
11455
|
* @param options - Options (type error if data is also options).
|
|
11568
11456
|
*/
|
|
@@ -11589,7 +11477,6 @@
|
|
|
11589
11477
|
}
|
|
11590
11478
|
/**
|
|
11591
11479
|
* Set new options.
|
|
11592
|
-
*
|
|
11593
11480
|
* @param options - The new options.
|
|
11594
11481
|
*/
|
|
11595
11482
|
_createClass(DataSet, [{
|
|
@@ -11638,14 +11525,13 @@
|
|
|
11638
11525
|
*
|
|
11639
11526
|
* // add items
|
|
11640
11527
|
* const ids = data.add([
|
|
11641
|
-
*
|
|
11642
|
-
*
|
|
11643
|
-
*
|
|
11528
|
+
* { id: 1, text: 'item 1' },
|
|
11529
|
+
* { id: 2, text: 'item 2' },
|
|
11530
|
+
* { text: 'item without an id' }
|
|
11644
11531
|
* ])
|
|
11645
11532
|
*
|
|
11646
11533
|
* console.log(ids) // [1, 2, '<UUIDv4>']
|
|
11647
11534
|
* ```
|
|
11648
|
-
*
|
|
11649
11535
|
* @param data - Items to be added (ids will be generated if missing).
|
|
11650
11536
|
* @param senderId - Sender id.
|
|
11651
11537
|
* @returns addedIds - Array with the ids (generated if not present) of the added items.
|
|
@@ -11687,7 +11573,6 @@
|
|
|
11687
11573
|
}
|
|
11688
11574
|
/**
|
|
11689
11575
|
* Update existing items. When an item does not exist, it will be created.
|
|
11690
|
-
*
|
|
11691
11576
|
* @remarks
|
|
11692
11577
|
* The provided properties will be merged in the existing item. When an item does not exist, it will be created.
|
|
11693
11578
|
*
|
|
@@ -11783,7 +11668,6 @@
|
|
|
11783
11668
|
}
|
|
11784
11669
|
/**
|
|
11785
11670
|
* Update existing items. When an item does not exist, an error will be thrown.
|
|
11786
|
-
*
|
|
11787
11671
|
* @remarks
|
|
11788
11672
|
* The provided properties will be deeply merged into the existing item.
|
|
11789
11673
|
* When an item does not exist (id not present in the data set or absent), an error will be thrown and nothing will be changed.
|
|
@@ -12090,7 +11974,6 @@
|
|
|
12090
11974
|
}
|
|
12091
11975
|
/**
|
|
12092
11976
|
* Filter the fields of an item.
|
|
12093
|
-
*
|
|
12094
11977
|
* @param item - The item whose fields should be filtered.
|
|
12095
11978
|
* @param fields - The names of the fields that will be kept.
|
|
12096
11979
|
* @typeParam K - Field name type.
|
|
@@ -12115,7 +11998,6 @@
|
|
|
12115
11998
|
}
|
|
12116
11999
|
/**
|
|
12117
12000
|
* Sort the provided array with items.
|
|
12118
|
-
*
|
|
12119
12001
|
* @param items - Items to be sorted in place.
|
|
12120
12002
|
* @param order - A field name or custom sort function.
|
|
12121
12003
|
* @typeParam T - The type of the items in the items array.
|
|
@@ -12152,9 +12034,9 @@
|
|
|
12152
12034
|
* ```javascript
|
|
12153
12035
|
* // create a DataSet
|
|
12154
12036
|
* const data = new vis.DataSet([
|
|
12155
|
-
*
|
|
12156
|
-
*
|
|
12157
|
-
*
|
|
12037
|
+
* { id: 1, text: 'item 1' },
|
|
12038
|
+
* { id: 2, text: 'item 2' },
|
|
12039
|
+
* { id: 3, text: 'item 3' }
|
|
12158
12040
|
* ])
|
|
12159
12041
|
*
|
|
12160
12042
|
* // remove items
|
|
@@ -12162,7 +12044,6 @@
|
|
|
12162
12044
|
*
|
|
12163
12045
|
* console.log(ids) // [2, 3]
|
|
12164
12046
|
* ```
|
|
12165
|
-
*
|
|
12166
12047
|
* @param id - One or more items or ids of items to be removed.
|
|
12167
12048
|
* @param senderId - Sender id.
|
|
12168
12049
|
* @returns The ids of the removed items.
|
|
@@ -12194,7 +12075,6 @@
|
|
|
12194
12075
|
}
|
|
12195
12076
|
/**
|
|
12196
12077
|
* Remove an item by its id or reference.
|
|
12197
|
-
*
|
|
12198
12078
|
* @param id - Id of an item or the item itself.
|
|
12199
12079
|
* @returns The removed item if removed, null otherwise.
|
|
12200
12080
|
*/
|
|
@@ -12223,7 +12103,6 @@
|
|
|
12223
12103
|
* Clear the entire data set.
|
|
12224
12104
|
*
|
|
12225
12105
|
* 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.
|
|
12226
|
-
*
|
|
12227
12106
|
* @param senderId - Sender id.
|
|
12228
12107
|
* @returns removedIds - The ids of all removed items.
|
|
12229
12108
|
*/
|
|
@@ -12246,7 +12125,6 @@
|
|
|
12246
12125
|
}
|
|
12247
12126
|
/**
|
|
12248
12127
|
* Find the item with maximum value of a specified field.
|
|
12249
|
-
*
|
|
12250
12128
|
* @param field - Name of the property that should be searched for max value.
|
|
12251
12129
|
* @returns Item containing max value, or null if no items.
|
|
12252
12130
|
*/
|
|
@@ -12276,7 +12154,6 @@
|
|
|
12276
12154
|
}
|
|
12277
12155
|
/**
|
|
12278
12156
|
* Find the item with minimum value of a specified field.
|
|
12279
|
-
*
|
|
12280
12157
|
* @param field - Name of the property that should be searched for min value.
|
|
12281
12158
|
* @returns Item containing min value, or null if no items.
|
|
12282
12159
|
*/
|
|
@@ -12306,7 +12183,6 @@
|
|
|
12306
12183
|
}
|
|
12307
12184
|
/**
|
|
12308
12185
|
* Find all distinct values of a specified field
|
|
12309
|
-
*
|
|
12310
12186
|
* @param prop - The property name whose distinct values should be returned.
|
|
12311
12187
|
* @returns Unordered array containing all distinct values. Items without specified property are ignored.
|
|
12312
12188
|
*/
|
|
@@ -12337,7 +12213,6 @@
|
|
|
12337
12213
|
}
|
|
12338
12214
|
/**
|
|
12339
12215
|
* Add a single item. Will fail when an item with the same id already exists.
|
|
12340
|
-
*
|
|
12341
12216
|
* @param item - A new item to be added.
|
|
12342
12217
|
* @returns Added item's id. An id is generated when it is not present in the item.
|
|
12343
12218
|
*/
|
|
@@ -12358,7 +12233,6 @@
|
|
|
12358
12233
|
/**
|
|
12359
12234
|
* Update a single item: merge with existing item.
|
|
12360
12235
|
* Will fail when the item has no id, or when there does not exist an item with the same id.
|
|
12361
|
-
*
|
|
12362
12236
|
* @param update - The new item
|
|
12363
12237
|
* @returns The id of the updated item.
|
|
12364
12238
|
*/
|
|
@@ -12454,25 +12328,25 @@
|
|
|
12454
12328
|
* // create a DataSet
|
|
12455
12329
|
* var data = new vis.DataSet();
|
|
12456
12330
|
* data.add([
|
|
12457
|
-
*
|
|
12458
|
-
*
|
|
12459
|
-
*
|
|
12460
|
-
*
|
|
12331
|
+
* {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
|
|
12332
|
+
* {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
|
|
12333
|
+
* {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
|
|
12334
|
+
* {id: 4, text: 'item 4'}
|
|
12461
12335
|
* ]);
|
|
12462
12336
|
*
|
|
12463
12337
|
* // create a DataView
|
|
12464
12338
|
* // the view will only contain items having a property group with value 1,
|
|
12465
12339
|
* // and will only output fields id, text, and date.
|
|
12466
12340
|
* var view = new vis.DataView(data, {
|
|
12467
|
-
*
|
|
12468
|
-
*
|
|
12469
|
-
*
|
|
12470
|
-
*
|
|
12341
|
+
* filter: function (item) {
|
|
12342
|
+
* return (item.group == 1);
|
|
12343
|
+
* },
|
|
12344
|
+
* fields: ['id', 'text', 'date']
|
|
12471
12345
|
* });
|
|
12472
12346
|
*
|
|
12473
12347
|
* // subscribe to any change in the DataView
|
|
12474
12348
|
* view.on('*', function (event, properties, senderId) {
|
|
12475
|
-
*
|
|
12349
|
+
* console.log('event', event, properties);
|
|
12476
12350
|
* });
|
|
12477
12351
|
*
|
|
12478
12352
|
* // update an item in the data set
|
|
@@ -12485,7 +12359,6 @@
|
|
|
12485
12359
|
* // get all items in the view
|
|
12486
12360
|
* var items = view.get();
|
|
12487
12361
|
* ```
|
|
12488
|
-
*
|
|
12489
12362
|
* @typeParam Item - Item type that may or may not have an id.
|
|
12490
12363
|
* @typeParam IdProp - Name of the property that contains the id.
|
|
12491
12364
|
*/
|
|
@@ -12496,7 +12369,6 @@
|
|
|
12496
12369
|
|
|
12497
12370
|
/**
|
|
12498
12371
|
* Create a DataView.
|
|
12499
|
-
*
|
|
12500
12372
|
* @param data - The instance containing data (directly or indirectly).
|
|
12501
12373
|
* @param options - Options to configure this data view.
|
|
12502
12374
|
*/
|
|
@@ -12518,7 +12390,6 @@
|
|
|
12518
12390
|
// and trigger changes accordingly
|
|
12519
12391
|
/**
|
|
12520
12392
|
* Set a data source for the view.
|
|
12521
|
-
*
|
|
12522
12393
|
* @param data - The instance containing data (directly or indirectly).
|
|
12523
12394
|
* @remarks
|
|
12524
12395
|
* Note that when the data view is bound to a data set it won't be garbage
|
|
@@ -12758,7 +12629,6 @@
|
|
|
12758
12629
|
}
|
|
12759
12630
|
/**
|
|
12760
12631
|
* Render the instance unusable prior to garbage collection.
|
|
12761
|
-
*
|
|
12762
12632
|
* @remarks
|
|
12763
12633
|
* The intention of this method is to help discover scenarios where the data
|
|
12764
12634
|
* view is being used when the programmer thinks it has been garbage collected
|
|
@@ -12796,7 +12666,6 @@
|
|
|
12796
12666
|
}
|
|
12797
12667
|
/**
|
|
12798
12668
|
* Event listener. Will propagate all events from the connected data set to the subscribers of the DataView, but will filter the items and only trigger when there are changes in the filtered data set.
|
|
12799
|
-
*
|
|
12800
12669
|
* @param event - The name of the event.
|
|
12801
12670
|
* @param params - Parameters of the event.
|
|
12802
12671
|
* @param senderId - Id supplied by the sender.
|
|
@@ -12888,7 +12757,6 @@
|
|
|
12888
12757
|
|
|
12889
12758
|
/**
|
|
12890
12759
|
* Check that given value is compatible with Vis Data Set interface.
|
|
12891
|
-
*
|
|
12892
12760
|
* @param idProp - The expected property to contain item id.
|
|
12893
12761
|
* @param v - The value to be tested.
|
|
12894
12762
|
* @returns True if all expected values and methods match, false otherwise.
|
|
@@ -12899,7 +12767,6 @@
|
|
|
12899
12767
|
|
|
12900
12768
|
/**
|
|
12901
12769
|
* Check that given value is compatible with Vis Data View interface.
|
|
12902
|
-
*
|
|
12903
12770
|
* @param idProp - The expected property to contain item id.
|
|
12904
12771
|
* @param v - The value to be tested.
|
|
12905
12772
|
* @returns True if all expected values and methods match, false otherwise.
|