mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* base-64 typings
* formatting and indenting
* feat: add typings for watchpack
* fix: improve missing typings
* Port from https://github.com/agileek/typings-vis/blob/master/vs.d.ts
* Fix travis build failures
* Port PR https://github.com/agileek/typings-vis/pull/12
* Fix travis build failures
* added tsconfig and tslint
* removed patch number
* added tests
* made it export like base64-js
* removed old code
* formatted code
* fix: add files field in tsconfig.json for expected publishment
* fix: improve most missing typings
* feat: upgrade to v3.0.0
* feat: upgrade to tapbale v0.2.5
* Types 2.0 (#13261)
* updating typing of the latest 7.0 react-autosuggest
* updating typing of react-autosuggest 7.0
* update typings for react-autosuggest 7.0
* Remove '+' from header versions, so they can be parsed (#13239)
* Updated masonry-layout to fix linting errors (#13272)
* Updated masonry-layout to fix linting errors
* Fixed the tests I could fix.
* Removed patch version
* Add redux-persist and basic transformers (#13389)
* Add definitions for redux-persist
* Add missin generic types
* Add definitions for filter transformer
* Add definitions for encrypt transformer
* Fix header
* Add definitions for compress transformer
* Delete unnecessary linter configs
* Change way of importing, fix tests
* fix: angulartics type definition for ES6 import
* fix: lint error
* fix scalar type config (#13398)
The `GraphQLScalarTypeConfig` interface had incorrect types. Correct types may be seen here: 379a308439/src/type/definition.js (L348-L350)
* [interact.js] Update module names (#13316)
Update CommonJS module name as it was changed in version 1.2.7.
AMD module name is also different from both new and old CommonJS module names, so a separate declaration was created for that as well.
* Add definitions for redux-recycle (#13424)
* Add definitions for redux-recycle
* Fix linter errors
* [jest] add type definition for toHaveBeenLastCalledWith (#13038)
* remove ajv because the package bundles its own types (#13028)
* Updated type definitions to yfiles for HTML 2.0. (#13332)
* Updated type definitions to yFiles for HTML 2.0.
* Updated type definitions to yfiles for HTML 2.0.
* Added contact in yfiles .d.ts header.
* Add redux-batched-actions typings. (#13054)
* Add types for mailgen (#13080)
* Typings for cordova-sqlite-storage (#13081)
* Add flatpickr definitions (#13083)
* Add pouch-redux-middleware typing (#13071)
* Add pouch-redux-middleware typing
* Fix <> in comment
* Add declaration for crc (#13068)
* Updated jquery.dataTables for 1.10.9 (#13099)
Release Notes: https://cdn.datatables.net/1.10.9/
* Moved legacy browser settings to its own data type.
* Added 'aIds' property on legacy settings object for mapping row ids to data indexes.
* Added 'rowIdFn' function to legacy settings object to get a row's id from the row's data.
* chore(lint): change vis typing to external module (#13399)
* Fix cordova-sqlite-storage lint
* Lint `vis`: Remove "I" prefix for namespaces
* Change cordova-sqlite-storage back. Linter was wrong.
195 lines
4.5 KiB
TypeScript
195 lines
4.5 KiB
TypeScript
// Test DataSet constructor
|
|
new vis.DataSet();
|
|
new vis.DataSet({});
|
|
new vis.DataSet([]);
|
|
new vis.DataSet([], {});
|
|
|
|
// Test Network constructor
|
|
new vis.Network(new HTMLDivElement(), { nodes: new vis.DataSet(), edges: new vis.DataSet() }, {});
|
|
|
|
//
|
|
// Test code sample from http://visjs.org/docs/data/dataset.html#Example
|
|
//
|
|
|
|
interface TestData {
|
|
id: number;
|
|
text?: string;
|
|
date?: any;
|
|
group?: number;
|
|
balance?: number;
|
|
first?: boolean;
|
|
}
|
|
|
|
// create a DataSet
|
|
var options = {};
|
|
var data = new vis.DataSet<TestData>(options);
|
|
|
|
// add items
|
|
// note that the data items can contain different properties and data formats
|
|
data.add([
|
|
{ id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true },
|
|
{ id: 2, text: 'item 2', date: '2013-06-23', group: 2 },
|
|
{ id: 3, text: 'item 3', date: '2013-06-25', group: 2 },
|
|
{ id: 4, text: 'item 4' }
|
|
]);
|
|
|
|
// subscribe to any change in the DataSet
|
|
data.on('*', function (event, properties, senderId) {
|
|
console.log('event', event, properties);
|
|
});
|
|
|
|
// update an existing item
|
|
data.update({ id: 2, group: 1 });
|
|
|
|
// remove an item
|
|
data.remove(4);
|
|
|
|
// get all ids
|
|
var ids = data.getIds();
|
|
console.log('ids', ids);
|
|
|
|
// get a specific item
|
|
var item1 = data.get(1);
|
|
console.log('item1', item1);
|
|
|
|
// retrieve a filtered subset of the data
|
|
var items = data.get({
|
|
filter: function (item) {
|
|
return item.group == 1;
|
|
}
|
|
});
|
|
console.log('filtered items', items);
|
|
|
|
// retrieve formatted items
|
|
var items = data.get({
|
|
fields: ['id', 'date'],
|
|
type: {
|
|
date: 'ISODate'
|
|
}
|
|
});
|
|
console.log('formatted items', items);
|
|
|
|
//
|
|
// Test code sample from http://visjs.org/docs/data/dataset.html#Subscriptions
|
|
//
|
|
|
|
// create a DataSet
|
|
var data = new vis.DataSet<TestData>();
|
|
|
|
// subscribe to any change in the DataSet
|
|
data.on('*', function (event, properties, senderId) {
|
|
console.log('event:', event, 'properties:', properties, 'senderId:', senderId);
|
|
});
|
|
|
|
// add an item
|
|
data.add({ id: 1, text: 'item 1' }); // triggers an 'add' event
|
|
data.update({ id: 1, text: 'item 1 (updated)' }); // triggers an 'update' event
|
|
data.remove(1); // triggers an 'remove' event
|
|
|
|
//
|
|
// Test code sample from http://visjs.org/docs/data/dataset.html#Data_Manipulation
|
|
//
|
|
|
|
// create a DataSet
|
|
var data = new vis.DataSet<TestData>();
|
|
|
|
// add items
|
|
data.add([
|
|
{ id: 1, text: 'item 1' },
|
|
{ id: 2, text: 'item 2' },
|
|
{ id: 3, text: 'item 3' }
|
|
]);
|
|
|
|
// update an item
|
|
data.update({ id: 2, text: 'item 2 (updated)' });
|
|
|
|
// remove an item
|
|
data.remove(3);
|
|
|
|
//
|
|
// Test code sample from http://visjs.org/docs/data/dataset.html#Data_Selection
|
|
//
|
|
|
|
// create a DataSet
|
|
var data = new vis.DataSet<TestData>();
|
|
data.add([
|
|
{ id: 1, text: 'item 1', date: '2013-06-20', group: 1, first: true },
|
|
{ id: 2, text: 'item 2', date: '2013-06-23', group: 2 },
|
|
{ id: 3, text: 'item 3', date: '2013-06-25', group: 2 },
|
|
{ id: 4, text: 'item 4' }
|
|
]);
|
|
|
|
// retrieve formatted items
|
|
var items = data.get({
|
|
fields: ['id', 'date', 'group'], // output the specified fields only
|
|
type: {
|
|
date: 'Date', // convert the date fields to Date objects
|
|
group: 'String' // convert the group fields to Strings
|
|
}
|
|
});
|
|
|
|
var dataset = new vis.DataSet<TestData>();
|
|
|
|
// retrieve all items having a property group with value 2
|
|
var group2 = dataset.get({
|
|
filter: function (item) {
|
|
return (item.group == 2);
|
|
}
|
|
});
|
|
|
|
// retrieve all items having a property balance with a value above zero
|
|
var positiveBalance = dataset.get({
|
|
filter: function (item) {
|
|
return (item.balance > 0);
|
|
}
|
|
});
|
|
|
|
//
|
|
// Test code sample from Getting Started http://visjs.org/docs/network/
|
|
//
|
|
|
|
// create an array with nodes
|
|
var nodes = new vis.DataSet([
|
|
{ id: 1, label: 'Node 1' },
|
|
{ id: 2, label: 'Node 2' },
|
|
{ id: 3, label: 'Node 3' },
|
|
{ id: 4, label: 'Node 4' },
|
|
{ id: 5, label: 'Node 5' }
|
|
]);
|
|
|
|
// create an array with edges
|
|
var edges = new vis.DataSet([
|
|
{ from: 1, to: 3 },
|
|
{ from: 1, to: 2 },
|
|
{ from: 2, to: 4 },
|
|
{ from: 2, to: 5 }
|
|
]);
|
|
|
|
// create a network
|
|
var container = <HTMLElement>document.getElementById('mynetwork');
|
|
|
|
// provide the data in the vis format
|
|
var data2 = {
|
|
nodes: nodes,
|
|
edges: edges
|
|
};
|
|
var options = {};
|
|
|
|
// initialize your network!
|
|
var network = new vis.Network(container, data2, options);
|
|
|
|
//
|
|
// Test code sample from http://visjs.org/docs/network/configure.html#
|
|
//
|
|
|
|
// these are all options in full.
|
|
var options2 = {
|
|
configure: {
|
|
enabled: true,
|
|
filter: 'nodes,edges',
|
|
container: container,
|
|
showButton: true
|
|
}
|
|
}
|
|
|
|
network.setOptions(options2); |