vis-data 7.1.9 → 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 +25 -91
- package/dist/esm.js.map +1 -1
- package/dist/umd.js +25 -91
- 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 +12 -8
- package/peer/esm/vis-data.js +25 -91
- package/peer/esm/vis-data.js.map +1 -1
- package/peer/esm/vis-data.min.js +2 -2
- package/peer/esm/vis-data.min.js.map +1 -1
- package/peer/umd/vis-data.js +25 -91
- package/peer/umd/vis-data.js.map +1 -1
- package/peer/umd/vis-data.min.js +2 -2
- package/peer/umd/vis-data.min.js.map +1 -1
- package/standalone/esm/vis-data.js +25 -91
- package/standalone/esm/vis-data.js.map +1 -1
- package/standalone/esm/vis-data.min.js +2 -2
- package/standalone/esm/vis-data.min.js.map +1 -1
- package/standalone/umd/vis-data.js +25 -91
- package/standalone/umd/vis-data.js.map +1 -1
- package/standalone/umd/vis-data.min.js +2 -2
- 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.
|
|
@@ -10503,7 +10490,6 @@
|
|
|
10503
10490
|
|
|
10504
10491
|
/**
|
|
10505
10492
|
* Determine whether a value can be used as an id.
|
|
10506
|
-
*
|
|
10507
10493
|
* @param value - Input value of unknown type.
|
|
10508
10494
|
* @returns True if the value is valid id, false otherwise.
|
|
10509
10495
|
*/
|
|
@@ -10513,13 +10499,11 @@
|
|
|
10513
10499
|
|
|
10514
10500
|
/**
|
|
10515
10501
|
* A queue.
|
|
10516
|
-
*
|
|
10517
10502
|
* @typeParam T - The type of method names to be replaced by queued versions.
|
|
10518
10503
|
*/
|
|
10519
10504
|
var Queue = /*#__PURE__*/function () {
|
|
10520
10505
|
/**
|
|
10521
10506
|
* Construct a new Queue.
|
|
10522
|
-
*
|
|
10523
10507
|
* @param options - Queue configuration.
|
|
10524
10508
|
*/
|
|
10525
10509
|
function Queue(options) {
|
|
@@ -10536,7 +10520,6 @@
|
|
|
10536
10520
|
}
|
|
10537
10521
|
/**
|
|
10538
10522
|
* Update the configuration of the queue.
|
|
10539
|
-
*
|
|
10540
10523
|
* @param options - Queue configuration.
|
|
10541
10524
|
*/
|
|
10542
10525
|
_createClass(Queue, [{
|
|
@@ -10553,7 +10536,6 @@
|
|
|
10553
10536
|
/**
|
|
10554
10537
|
* Extend an object with queuing functionality.
|
|
10555
10538
|
* The object will be extended with a function flush, and the methods provided in options.replace will be replaced with queued ones.
|
|
10556
|
-
*
|
|
10557
10539
|
* @param object - The object to be extended.
|
|
10558
10540
|
* @param options - Additional options.
|
|
10559
10541
|
* @returns The created queue.
|
|
@@ -10584,7 +10566,6 @@
|
|
|
10584
10566
|
}
|
|
10585
10567
|
/**
|
|
10586
10568
|
* Replace a method on an object with a queued version.
|
|
10587
|
-
*
|
|
10588
10569
|
* @param object - Object having the method.
|
|
10589
10570
|
* @param method - The method name.
|
|
10590
10571
|
*/
|
|
@@ -10611,7 +10592,6 @@
|
|
|
10611
10592
|
}
|
|
10612
10593
|
/**
|
|
10613
10594
|
* Queue a call.
|
|
10614
|
-
*
|
|
10615
10595
|
* @param entry - The function or entry to be queued.
|
|
10616
10596
|
*/
|
|
10617
10597
|
}, {
|
|
@@ -10697,7 +10677,6 @@
|
|
|
10697
10677
|
|
|
10698
10678
|
/**
|
|
10699
10679
|
* {@link DataSet} code that can be reused in {@link DataView} or other similar implementations of {@link DataInterface}.
|
|
10700
|
-
*
|
|
10701
10680
|
* @typeParam Item - Item type that may or may not have an id.
|
|
10702
10681
|
* @typeParam IdProp - Name of the property that contains the id.
|
|
10703
10682
|
*/
|
|
@@ -10724,7 +10703,6 @@
|
|
|
10724
10703
|
value:
|
|
10725
10704
|
/**
|
|
10726
10705
|
* Trigger an event
|
|
10727
|
-
*
|
|
10728
10706
|
* @param event - Event name.
|
|
10729
10707
|
* @param payload - Event payload.
|
|
10730
10708
|
* @param senderId - Id of the sender.
|
|
@@ -10740,7 +10718,6 @@
|
|
|
10740
10718
|
}
|
|
10741
10719
|
/**
|
|
10742
10720
|
* Subscribe to an event, add an event listener.
|
|
10743
|
-
*
|
|
10744
10721
|
* @remarks Non-function callbacks are ignored.
|
|
10745
10722
|
* @param event - Event name.
|
|
10746
10723
|
* @param callback - Callback method.
|
|
@@ -10755,7 +10732,6 @@
|
|
|
10755
10732
|
}
|
|
10756
10733
|
/**
|
|
10757
10734
|
* Unsubscribe from an event, remove an event listener.
|
|
10758
|
-
*
|
|
10759
10735
|
* @remarks If the same callback was subscribed more than once **all** occurences will be removed.
|
|
10760
10736
|
* @param event - Event name.
|
|
10761
10737
|
* @param callback - Callback method.
|
|
@@ -10822,7 +10798,6 @@
|
|
|
10822
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; }
|
|
10823
10799
|
/**
|
|
10824
10800
|
* Data stream
|
|
10825
|
-
*
|
|
10826
10801
|
* @remarks
|
|
10827
10802
|
* {@link DataStream} offers an always up to date stream of items from a {@link DataSet} or {@link DataView}.
|
|
10828
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.
|
|
@@ -10832,7 +10807,6 @@
|
|
|
10832
10807
|
var DataStream = /*#__PURE__*/function (_Symbol$iterator$1) {
|
|
10833
10808
|
/**
|
|
10834
10809
|
* Create a new data stream.
|
|
10835
|
-
*
|
|
10836
10810
|
* @param pairs - The id, item pairs.
|
|
10837
10811
|
*/
|
|
10838
10812
|
function DataStream(pairs) {
|
|
@@ -11013,7 +10987,6 @@
|
|
|
11013
10987
|
})
|
|
11014
10988
|
/**
|
|
11015
10989
|
* Return an array containing all the ids in this stream.
|
|
11016
|
-
*
|
|
11017
10990
|
* @remarks
|
|
11018
10991
|
* The array may contain duplicities.
|
|
11019
10992
|
* @returns The array with all ids from this stream.
|
|
@@ -11028,7 +11001,6 @@
|
|
|
11028
11001
|
}
|
|
11029
11002
|
/**
|
|
11030
11003
|
* Return an array containing all the items in this stream.
|
|
11031
|
-
*
|
|
11032
11004
|
* @remarks
|
|
11033
11005
|
* The array may contain duplicities.
|
|
11034
11006
|
* @returns The array with all items from this stream.
|
|
@@ -11043,7 +11015,6 @@
|
|
|
11043
11015
|
}
|
|
11044
11016
|
/**
|
|
11045
11017
|
* Return an array containing all the entries in this stream.
|
|
11046
|
-
*
|
|
11047
11018
|
* @remarks
|
|
11048
11019
|
* The array may contain duplicities.
|
|
11049
11020
|
* @returns The array with all entries from this stream.
|
|
@@ -11055,7 +11026,6 @@
|
|
|
11055
11026
|
}
|
|
11056
11027
|
/**
|
|
11057
11028
|
* Return an object map containing all the items in this stream accessible by ids.
|
|
11058
|
-
*
|
|
11059
11029
|
* @remarks
|
|
11060
11030
|
* In case of duplicate ids (coerced to string so `7 == '7'`) the last encoutered appears in the returned object.
|
|
11061
11031
|
* @returns The object map of all id → item pairs from this stream.
|
|
@@ -11082,7 +11052,6 @@
|
|
|
11082
11052
|
}
|
|
11083
11053
|
/**
|
|
11084
11054
|
* Return a map containing all the items in this stream accessible by ids.
|
|
11085
|
-
*
|
|
11086
11055
|
* @returns The map of all id → item pairs from this stream.
|
|
11087
11056
|
*/
|
|
11088
11057
|
}, {
|
|
@@ -11092,7 +11061,6 @@
|
|
|
11092
11061
|
}
|
|
11093
11062
|
/**
|
|
11094
11063
|
* Return a set containing all the (unique) ids in this stream.
|
|
11095
|
-
*
|
|
11096
11064
|
* @returns The set of all ids from this stream.
|
|
11097
11065
|
*/
|
|
11098
11066
|
}, {
|
|
@@ -11102,7 +11070,6 @@
|
|
|
11102
11070
|
}
|
|
11103
11071
|
/**
|
|
11104
11072
|
* Return a set containing all the (unique) items in this stream.
|
|
11105
|
-
*
|
|
11106
11073
|
* @returns The set of all items from this stream.
|
|
11107
11074
|
*/
|
|
11108
11075
|
}, {
|
|
@@ -11112,7 +11079,6 @@
|
|
|
11112
11079
|
}
|
|
11113
11080
|
/**
|
|
11114
11081
|
* Cache the items from this stream.
|
|
11115
|
-
*
|
|
11116
11082
|
* @remarks
|
|
11117
11083
|
* This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
|
|
11118
11084
|
* It can also be used to optimize performance as {@link DataStream} would otherwise reevaluate everything upon each iteration.
|
|
@@ -11139,7 +11105,6 @@
|
|
|
11139
11105
|
}
|
|
11140
11106
|
/**
|
|
11141
11107
|
* Get the distinct values of given property.
|
|
11142
|
-
*
|
|
11143
11108
|
* @param callback - The function that picks and possibly converts the property.
|
|
11144
11109
|
* @typeParam T - The type of the distinct value.
|
|
11145
11110
|
* @returns A set of all distinct properties.
|
|
@@ -11166,7 +11131,6 @@
|
|
|
11166
11131
|
}
|
|
11167
11132
|
/**
|
|
11168
11133
|
* Filter the items of the stream.
|
|
11169
|
-
*
|
|
11170
11134
|
* @param callback - The function that decides whether an item will be included.
|
|
11171
11135
|
* @returns A new data stream with the filtered items.
|
|
11172
11136
|
*/
|
|
@@ -11221,7 +11185,6 @@
|
|
|
11221
11185
|
}
|
|
11222
11186
|
/**
|
|
11223
11187
|
* Execute a callback for each item of the stream.
|
|
11224
|
-
*
|
|
11225
11188
|
* @param callback - The function that will be invoked for each item.
|
|
11226
11189
|
*/
|
|
11227
11190
|
}, {
|
|
@@ -11244,7 +11207,6 @@
|
|
|
11244
11207
|
}
|
|
11245
11208
|
/**
|
|
11246
11209
|
* Map the items into a different type.
|
|
11247
|
-
*
|
|
11248
11210
|
* @param callback - The function that does the conversion.
|
|
11249
11211
|
* @typeParam Mapped - The type of the item after mapping.
|
|
11250
11212
|
* @returns A new data stream with the mapped items.
|
|
@@ -11296,7 +11258,6 @@
|
|
|
11296
11258
|
}
|
|
11297
11259
|
/**
|
|
11298
11260
|
* Get the item with the maximum value of given property.
|
|
11299
|
-
*
|
|
11300
11261
|
* @param callback - The function that picks and possibly converts the property.
|
|
11301
11262
|
* @returns The item with the maximum if found otherwise null.
|
|
11302
11263
|
*/
|
|
@@ -11324,7 +11285,6 @@
|
|
|
11324
11285
|
}
|
|
11325
11286
|
/**
|
|
11326
11287
|
* Get the item with the minimum value of given property.
|
|
11327
|
-
*
|
|
11328
11288
|
* @param callback - The function that picks and possibly converts the property.
|
|
11329
11289
|
* @returns The item with the minimum if found otherwise null.
|
|
11330
11290
|
*/
|
|
@@ -11352,7 +11312,6 @@
|
|
|
11352
11312
|
}
|
|
11353
11313
|
/**
|
|
11354
11314
|
* Reduce the items into a single value.
|
|
11355
|
-
*
|
|
11356
11315
|
* @param callback - The function that does the reduction.
|
|
11357
11316
|
* @param accumulator - The initial value of the accumulator.
|
|
11358
11317
|
* @typeParam T - The type of the accumulated value.
|
|
@@ -11379,7 +11338,6 @@
|
|
|
11379
11338
|
}
|
|
11380
11339
|
/**
|
|
11381
11340
|
* Sort the items.
|
|
11382
|
-
*
|
|
11383
11341
|
* @param callback - Item comparator.
|
|
11384
11342
|
* @returns A new stream with sorted items.
|
|
11385
11343
|
*/
|
|
@@ -11415,7 +11373,6 @@
|
|
|
11415
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; } }
|
|
11416
11374
|
/**
|
|
11417
11375
|
* Add an id to given item if it doesn't have one already.
|
|
11418
|
-
*
|
|
11419
11376
|
* @remarks
|
|
11420
11377
|
* The item will be modified.
|
|
11421
11378
|
* @param item - The item that will have an id after a call to this function.
|
|
@@ -11453,15 +11410,15 @@
|
|
|
11453
11410
|
* // add items
|
|
11454
11411
|
* // note that the data items can contain different properties and data formats
|
|
11455
11412
|
* data.add([
|
|
11456
|
-
*
|
|
11457
|
-
*
|
|
11458
|
-
*
|
|
11459
|
-
*
|
|
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'}
|
|
11460
11417
|
* ]);
|
|
11461
11418
|
*
|
|
11462
11419
|
* // subscribe to any change in the DataSet
|
|
11463
11420
|
* data.on('*', function (event, properties, senderId) {
|
|
11464
|
-
*
|
|
11421
|
+
* console.log('event', event, properties);
|
|
11465
11422
|
* });
|
|
11466
11423
|
*
|
|
11467
11424
|
* // update an existing item
|
|
@@ -11480,13 +11437,12 @@
|
|
|
11480
11437
|
*
|
|
11481
11438
|
* // retrieve a filtered subset of the data
|
|
11482
11439
|
* var items = data.get({
|
|
11483
|
-
*
|
|
11484
|
-
*
|
|
11485
|
-
*
|
|
11440
|
+
* filter: function (item) {
|
|
11441
|
+
* return item.group == 1;
|
|
11442
|
+
* }
|
|
11486
11443
|
* });
|
|
11487
11444
|
* console.log('filtered items', items);
|
|
11488
11445
|
* ```
|
|
11489
|
-
*
|
|
11490
11446
|
* @typeParam Item - Item type that may or may not have an id.
|
|
11491
11447
|
* @typeParam IdProp - Name of the property that contains the id.
|
|
11492
11448
|
*/
|
|
@@ -11495,7 +11451,6 @@
|
|
|
11495
11451
|
var _super = _createSuper$1(DataSet);
|
|
11496
11452
|
/**
|
|
11497
11453
|
* Construct a new DataSet.
|
|
11498
|
-
*
|
|
11499
11454
|
* @param data - Initial data or options.
|
|
11500
11455
|
* @param options - Options (type error if data is also options).
|
|
11501
11456
|
*/
|
|
@@ -11522,7 +11477,6 @@
|
|
|
11522
11477
|
}
|
|
11523
11478
|
/**
|
|
11524
11479
|
* Set new options.
|
|
11525
|
-
*
|
|
11526
11480
|
* @param options - The new options.
|
|
11527
11481
|
*/
|
|
11528
11482
|
_createClass(DataSet, [{
|
|
@@ -11571,14 +11525,13 @@
|
|
|
11571
11525
|
*
|
|
11572
11526
|
* // add items
|
|
11573
11527
|
* const ids = data.add([
|
|
11574
|
-
*
|
|
11575
|
-
*
|
|
11576
|
-
*
|
|
11528
|
+
* { id: 1, text: 'item 1' },
|
|
11529
|
+
* { id: 2, text: 'item 2' },
|
|
11530
|
+
* { text: 'item without an id' }
|
|
11577
11531
|
* ])
|
|
11578
11532
|
*
|
|
11579
11533
|
* console.log(ids) // [1, 2, '<UUIDv4>']
|
|
11580
11534
|
* ```
|
|
11581
|
-
*
|
|
11582
11535
|
* @param data - Items to be added (ids will be generated if missing).
|
|
11583
11536
|
* @param senderId - Sender id.
|
|
11584
11537
|
* @returns addedIds - Array with the ids (generated if not present) of the added items.
|
|
@@ -11620,7 +11573,6 @@
|
|
|
11620
11573
|
}
|
|
11621
11574
|
/**
|
|
11622
11575
|
* Update existing items. When an item does not exist, it will be created.
|
|
11623
|
-
*
|
|
11624
11576
|
* @remarks
|
|
11625
11577
|
* The provided properties will be merged in the existing item. When an item does not exist, it will be created.
|
|
11626
11578
|
*
|
|
@@ -11716,7 +11668,6 @@
|
|
|
11716
11668
|
}
|
|
11717
11669
|
/**
|
|
11718
11670
|
* Update existing items. When an item does not exist, an error will be thrown.
|
|
11719
|
-
*
|
|
11720
11671
|
* @remarks
|
|
11721
11672
|
* The provided properties will be deeply merged into the existing item.
|
|
11722
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.
|
|
@@ -12023,7 +11974,6 @@
|
|
|
12023
11974
|
}
|
|
12024
11975
|
/**
|
|
12025
11976
|
* Filter the fields of an item.
|
|
12026
|
-
*
|
|
12027
11977
|
* @param item - The item whose fields should be filtered.
|
|
12028
11978
|
* @param fields - The names of the fields that will be kept.
|
|
12029
11979
|
* @typeParam K - Field name type.
|
|
@@ -12048,7 +11998,6 @@
|
|
|
12048
11998
|
}
|
|
12049
11999
|
/**
|
|
12050
12000
|
* Sort the provided array with items.
|
|
12051
|
-
*
|
|
12052
12001
|
* @param items - Items to be sorted in place.
|
|
12053
12002
|
* @param order - A field name or custom sort function.
|
|
12054
12003
|
* @typeParam T - The type of the items in the items array.
|
|
@@ -12085,9 +12034,9 @@
|
|
|
12085
12034
|
* ```javascript
|
|
12086
12035
|
* // create a DataSet
|
|
12087
12036
|
* const data = new vis.DataSet([
|
|
12088
|
-
*
|
|
12089
|
-
*
|
|
12090
|
-
*
|
|
12037
|
+
* { id: 1, text: 'item 1' },
|
|
12038
|
+
* { id: 2, text: 'item 2' },
|
|
12039
|
+
* { id: 3, text: 'item 3' }
|
|
12091
12040
|
* ])
|
|
12092
12041
|
*
|
|
12093
12042
|
* // remove items
|
|
@@ -12095,7 +12044,6 @@
|
|
|
12095
12044
|
*
|
|
12096
12045
|
* console.log(ids) // [2, 3]
|
|
12097
12046
|
* ```
|
|
12098
|
-
*
|
|
12099
12047
|
* @param id - One or more items or ids of items to be removed.
|
|
12100
12048
|
* @param senderId - Sender id.
|
|
12101
12049
|
* @returns The ids of the removed items.
|
|
@@ -12127,7 +12075,6 @@
|
|
|
12127
12075
|
}
|
|
12128
12076
|
/**
|
|
12129
12077
|
* Remove an item by its id or reference.
|
|
12130
|
-
*
|
|
12131
12078
|
* @param id - Id of an item or the item itself.
|
|
12132
12079
|
* @returns The removed item if removed, null otherwise.
|
|
12133
12080
|
*/
|
|
@@ -12156,7 +12103,6 @@
|
|
|
12156
12103
|
* Clear the entire data set.
|
|
12157
12104
|
*
|
|
12158
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.
|
|
12159
|
-
*
|
|
12160
12106
|
* @param senderId - Sender id.
|
|
12161
12107
|
* @returns removedIds - The ids of all removed items.
|
|
12162
12108
|
*/
|
|
@@ -12179,7 +12125,6 @@
|
|
|
12179
12125
|
}
|
|
12180
12126
|
/**
|
|
12181
12127
|
* Find the item with maximum value of a specified field.
|
|
12182
|
-
*
|
|
12183
12128
|
* @param field - Name of the property that should be searched for max value.
|
|
12184
12129
|
* @returns Item containing max value, or null if no items.
|
|
12185
12130
|
*/
|
|
@@ -12209,7 +12154,6 @@
|
|
|
12209
12154
|
}
|
|
12210
12155
|
/**
|
|
12211
12156
|
* Find the item with minimum value of a specified field.
|
|
12212
|
-
*
|
|
12213
12157
|
* @param field - Name of the property that should be searched for min value.
|
|
12214
12158
|
* @returns Item containing min value, or null if no items.
|
|
12215
12159
|
*/
|
|
@@ -12239,7 +12183,6 @@
|
|
|
12239
12183
|
}
|
|
12240
12184
|
/**
|
|
12241
12185
|
* Find all distinct values of a specified field
|
|
12242
|
-
*
|
|
12243
12186
|
* @param prop - The property name whose distinct values should be returned.
|
|
12244
12187
|
* @returns Unordered array containing all distinct values. Items without specified property are ignored.
|
|
12245
12188
|
*/
|
|
@@ -12270,7 +12213,6 @@
|
|
|
12270
12213
|
}
|
|
12271
12214
|
/**
|
|
12272
12215
|
* Add a single item. Will fail when an item with the same id already exists.
|
|
12273
|
-
*
|
|
12274
12216
|
* @param item - A new item to be added.
|
|
12275
12217
|
* @returns Added item's id. An id is generated when it is not present in the item.
|
|
12276
12218
|
*/
|
|
@@ -12291,7 +12233,6 @@
|
|
|
12291
12233
|
/**
|
|
12292
12234
|
* Update a single item: merge with existing item.
|
|
12293
12235
|
* Will fail when the item has no id, or when there does not exist an item with the same id.
|
|
12294
|
-
*
|
|
12295
12236
|
* @param update - The new item
|
|
12296
12237
|
* @returns The id of the updated item.
|
|
12297
12238
|
*/
|
|
@@ -12387,25 +12328,25 @@
|
|
|
12387
12328
|
* // create a DataSet
|
|
12388
12329
|
* var data = new vis.DataSet();
|
|
12389
12330
|
* data.add([
|
|
12390
|
-
*
|
|
12391
|
-
*
|
|
12392
|
-
*
|
|
12393
|
-
*
|
|
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'}
|
|
12394
12335
|
* ]);
|
|
12395
12336
|
*
|
|
12396
12337
|
* // create a DataView
|
|
12397
12338
|
* // the view will only contain items having a property group with value 1,
|
|
12398
12339
|
* // and will only output fields id, text, and date.
|
|
12399
12340
|
* var view = new vis.DataView(data, {
|
|
12400
|
-
*
|
|
12401
|
-
*
|
|
12402
|
-
*
|
|
12403
|
-
*
|
|
12341
|
+
* filter: function (item) {
|
|
12342
|
+
* return (item.group == 1);
|
|
12343
|
+
* },
|
|
12344
|
+
* fields: ['id', 'text', 'date']
|
|
12404
12345
|
* });
|
|
12405
12346
|
*
|
|
12406
12347
|
* // subscribe to any change in the DataView
|
|
12407
12348
|
* view.on('*', function (event, properties, senderId) {
|
|
12408
|
-
*
|
|
12349
|
+
* console.log('event', event, properties);
|
|
12409
12350
|
* });
|
|
12410
12351
|
*
|
|
12411
12352
|
* // update an item in the data set
|
|
@@ -12418,7 +12359,6 @@
|
|
|
12418
12359
|
* // get all items in the view
|
|
12419
12360
|
* var items = view.get();
|
|
12420
12361
|
* ```
|
|
12421
|
-
*
|
|
12422
12362
|
* @typeParam Item - Item type that may or may not have an id.
|
|
12423
12363
|
* @typeParam IdProp - Name of the property that contains the id.
|
|
12424
12364
|
*/
|
|
@@ -12429,7 +12369,6 @@
|
|
|
12429
12369
|
|
|
12430
12370
|
/**
|
|
12431
12371
|
* Create a DataView.
|
|
12432
|
-
*
|
|
12433
12372
|
* @param data - The instance containing data (directly or indirectly).
|
|
12434
12373
|
* @param options - Options to configure this data view.
|
|
12435
12374
|
*/
|
|
@@ -12451,7 +12390,6 @@
|
|
|
12451
12390
|
// and trigger changes accordingly
|
|
12452
12391
|
/**
|
|
12453
12392
|
* Set a data source for the view.
|
|
12454
|
-
*
|
|
12455
12393
|
* @param data - The instance containing data (directly or indirectly).
|
|
12456
12394
|
* @remarks
|
|
12457
12395
|
* Note that when the data view is bound to a data set it won't be garbage
|
|
@@ -12691,7 +12629,6 @@
|
|
|
12691
12629
|
}
|
|
12692
12630
|
/**
|
|
12693
12631
|
* Render the instance unusable prior to garbage collection.
|
|
12694
|
-
*
|
|
12695
12632
|
* @remarks
|
|
12696
12633
|
* The intention of this method is to help discover scenarios where the data
|
|
12697
12634
|
* view is being used when the programmer thinks it has been garbage collected
|
|
@@ -12729,7 +12666,6 @@
|
|
|
12729
12666
|
}
|
|
12730
12667
|
/**
|
|
12731
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.
|
|
12732
|
-
*
|
|
12733
12669
|
* @param event - The name of the event.
|
|
12734
12670
|
* @param params - Parameters of the event.
|
|
12735
12671
|
* @param senderId - Id supplied by the sender.
|
|
@@ -12821,7 +12757,6 @@
|
|
|
12821
12757
|
|
|
12822
12758
|
/**
|
|
12823
12759
|
* Check that given value is compatible with Vis Data Set interface.
|
|
12824
|
-
*
|
|
12825
12760
|
* @param idProp - The expected property to contain item id.
|
|
12826
12761
|
* @param v - The value to be tested.
|
|
12827
12762
|
* @returns True if all expected values and methods match, false otherwise.
|
|
@@ -12832,7 +12767,6 @@
|
|
|
12832
12767
|
|
|
12833
12768
|
/**
|
|
12834
12769
|
* Check that given value is compatible with Vis Data View interface.
|
|
12835
|
-
*
|
|
12836
12770
|
* @param idProp - The expected property to contain item id.
|
|
12837
12771
|
* @param v - The value to be tested.
|
|
12838
12772
|
* @returns True if all expected values and methods match, false otherwise.
|