From 09a539b8117a25822fc5b1988d59ed4d53da9a4c Mon Sep 17 00:00:00 2001 From: Kiarash Ghiaseddin Date: Fri, 13 Feb 2015 14:25:32 +0100 Subject: [PATCH 01/31] New jquery.dataTables.d.ts for new API 1.10.x # complete file adding new Settings and API for dataTable # all methods and settings for 1.10.5 # basic testing --- jquery.dataTables/jquery.dataTables-tests.ts | 2327 +++++++----------- jquery.dataTables/jquery.dataTables.d.ts | 2061 ++++++++++++---- 2 files changed, 2479 insertions(+), 1909 deletions(-) diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts index d3fe178c3..d94d68864 100755 --- a/jquery.dataTables/jquery.dataTables-tests.ts +++ b/jquery.dataTables/jquery.dataTables-tests.ts @@ -3,1443 +3,890 @@ // http://www.datatables.net/api -// $ - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Highlight every second row - oTable.$('tr:odd').css('backgroundColor', 'blue'); -} ); - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Filter to rows with 'Webkit' in them, add a background colour and then - // remove the filter, thus highlighting the 'Webkit' rows only. - oTable.fnFilter('Webkit'); - oTable.$('tr', {"filter": "applied"}).css('backgroundColor', 'blue'); - oTable.fnFilter(''); -} ); - -// _ - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Get the data from the first row in the table - var data = oTable._('tr:first'); - - // Do something useful with the data - alert( "First cell is: "+data[0] ); -} ); - - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Filter to 'Webkit' and get all data for - oTable.fnFilter('Webkit'); - var data = oTable._('tr', {"filter": "applied"}); - - // Do something with the data - alert( data.length+" rows matched the filter" ); -} ); - -// fnAddData - -var giCount = 2; - -$(document).ready(function() { - $('#example').dataTable(); -} ); - -function fnClickAddRow() { - $('#example').dataTable().fnAddData( [ - giCount+".1", - giCount+".2", - giCount+".3", - giCount+".4" ] - ); - - giCount++; -} - -// fnAdjustColumnSizing - -$(document).ready(function() { - var oTable = $('#example').dataTable( { - "sScrollY": "200px", - "bPaginate": false - } ); - - $(window).bind('resize', function () { - oTable.fnAdjustColumnSizing(); - } ); -} ); - -// fnClearTable - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...) - oTable.fnClearTable(); -} ); - -// fnClose - -$(document).ready(function() { - var oTable; - - // 'open' an information row when a row is clicked on - $('#example tbody tr').click( function () { - if ( oTable.fnIsOpen(this) ) { - oTable.fnClose( this ); - } else { - oTable.fnOpen( this, "Temporary row opened", "info_row" ); - } - } ); - - oTable = $('#example').dataTable(); -} ); - -// fnDeleteRow - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Immediately remove the first row - oTable.fnDeleteRow( 0 ); -} ); - -// fnDestroy - -$(document).ready(function() { - // This example is fairly pointless in reality, but shows how fnDestroy can be used - var oTable = $('#example').dataTable(); - oTable.fnDestroy(); -} ); - -// fnDraw - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Re-draw the table - you wouldn't want to do it here, but it's an example :-) - oTable.fnDraw(); -} ); - -// fnFilter - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Sometime later - filter... - oTable.fnFilter( 'test string' ); -} ); - -// fnGetData - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - oTable.$('tr').click( function () { - var data = oTable.fnGetData( this ); - // ... do something with the array / object of data for the row - } ); -} ); - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - oTable.$('td').click( function () { - var sData = oTable.fnGetData( this ); - alert( 'The cell clicked on had the value of '+sData ); - } ); -} ); - -// fnGetNodes - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Get the nodes from the table - var nNodes = oTable.fnGetNodes( ); -} ); - -// fnGetPosition - -$(document).ready(function() { - $('#example tbody td').click( function () { - // Get the position of the current data from the node - var aPos = oTable.fnGetPosition( this ); - - // Get the data array for this row - var aData = oTable.fnGetData( aPos[0] ); - - // Update the data array and return the value - aData[ aPos[1] ] = 'clicked'; - this.innerHTML = 'clicked'; - } ); - - // Init DataTables - var oTable = $('#example').dataTable(); -} ); - -// fnIsOpen - -$(document).ready(function() { - var oTable; - - // 'open' an information row when a row is clicked on - $('#example tbody tr').click( function () { - if ( oTable.fnIsOpen(this) ) { - oTable.fnClose( this ); - } else { - oTable.fnOpen( this, "Temporary row opened", "info_row" ); - } - } ); - - oTable = $('#example').dataTable(); -} ); - -// fnOpen - -$(document).ready(function() { - var oTable; - - // 'open' an information row when a row is clicked on - $('#example tbody tr').click( function () { - if ( oTable.fnIsOpen(this) ) { - oTable.fnClose( this ); - } else { - oTable.fnOpen( this, "Temporary row opened", "info_row" ); - } - } ); - - oTable = $('#example').dataTable(); -} ); - -// fnPageChange - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - oTable.fnPageChange( 'next' ); -} ); - -// fnSetColumnVis - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Hide the second column after initialisation - oTable.fnSetColumnVis( 1, false ); -} ); - -// fnSettings - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - var oSettings = oTable.fnSettings(); - - // Show an example parameter from the settings - alert("" + oSettings._iDisplayStart); -} ); - -// fnSort - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Sort immediately with columns 0 and 1 - oTable.fnSort( [ [0,'asc'], [1,'asc'] ] ); -} ); - -// fnSortListener - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - - // Sort on column 1, when 'sorter' is clicked on - oTable.fnSortListener( document.getElementById('sorter'), 1 ); -} ); - -// fnUpdate - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell - oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1 ); // Row -} ); - -// fnVersionCheck - -$(document).ready(function() { - var oTable = $('#example').dataTable(); - oTable.fnVersionCheck( '1.9.0'); -} ); - -// http://datatables.net/usage/features - -$(document).ready( function () { - $('#example').dataTable( { - "bAutoWidth": false - } ); -} ); - -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "sAjaxSource": "sources/arrays.txt", - "bDeferRender": true - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bFilter": false - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bInfo": false - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bJQueryUI": true - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bLengthChange": false - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bPaginate": false - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bProcessing": true - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bScrollInfinite": true, - "bScrollCollapse": true, - "sScrollY": "200px" - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bServerSide": true, - "sAjaxSource": "xhr.php" - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bSort": false - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bSortClasses": false - } ); -} ); - -$(document).ready( function () { - $('#example').dataTable( { - "bStateSave": true - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "sScrollX": "100%", - "bScrollCollapse": true - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "sScrollY": "200px", - "bPaginate": false - } ); -} ); - -// http://datatables.net/usage/options - -$(document).ready( function() { - $('#example').dataTable( { - "sScrollY": "200px", - "bPaginate": false - } ); - - // Some time later.... - $('#example').dataTable( { - "bFilter": false, - "bDestroy": true - } ); -} ); - -$(document).ready( function() { - initTable(); - tableActions(); -} ); - -function initTable () -{ - return $('#example').dataTable( { - "sScrollY": "200px", - "bPaginate": false, - "bRetrieve": true - } ); -} - -function tableActions () -{ - var oTable = initTable(); - // perform API operations with oTable -} - -$(document).ready( function() { - $('#example').dataTable( { - "bScrollAutoCss": false, - "sScrollY": "200px" - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "sScrollY": "200", - "bScrollCollapse": true - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bSortCellsTop": true - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "iCookieDuration": 60*60*24 // 1 day - } ); -} ); - -// 57 records available in the table, no filtering applied -$(document).ready( function() { - $('#example').dataTable( { - "bServerSide": true, - "sAjaxSource": "scripts/server_processing.php", - "iDeferLoading": 57 - } ); -} ); - - -// 57 records after filtering, 100 without filtering (an initial filter applied) -$(document).ready( function() { - $('#example').dataTable( { - "bServerSide": true, - "sAjaxSource": "scripts/server_processing.php", - "iDeferLoading": [ 57, 100 ], - "oSearch": { - "sSearch": "my_filter" - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "iDisplayLength": 50 - } ); -} ) - -$(document).ready( function() { - $('#example').dataTable( { - "iDisplayStart": 20 - } ); -} ) - -$(document).ready( function() { - $('#example').dataTable( { - "bScrollInfinite": true, - "bScrollCollapse": true, - "sScrollY": "200px", - "iScrollLoadGap": 50 - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "iTabIndex": 1 - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oSearch": {"sSearch": "Initial search"} - } ); -} ) - -// Get data from { "data": [...] } -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "sAjaxSource": "sources/data.txt", - "sAjaxDataProp": "data" - } ); -} ); - - -// Get data from { "data": { "inner": [...] } } -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "sAjaxSource": "sources/data.txt", - "sAjaxDataProp": "data.inner" - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "sAjaxSource": "http://www.sprymedia.co.uk/dataTables/json.php" - } ); -} ) - -$(document).ready( function() { - $('#example').dataTable( { - "sCookiePrefix": "my_datatable_" - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "sDom": '<"top"i>rt<"bottom"flp><"clear">' - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "sPaginationType": "full_numbers" - } ); -} ) - -$(document).ready( function() { - $('#example').dataTable( { - "sScrollX": "100%", - "sScrollXInner": "110%" - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bServerSide": true, - "sAjaxSource": "scripts/post.php", - "sServerMethod": "POST" - } ); -} ); - -// http://datatables.net/usage/callbacks - -$(document).ready( function () { - $('#example').dataTable( { - "fnCookieCallback": function (sName, oData, sExpires, sPath) { - // Customise oData or sName or whatever else here - return sName + "="+JSON.stringify(oData)+"; expires=" + sExpires +"; path=" + sPath; - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "fnCreatedRow": function( nRow, aData, iDataIndex ) { - // Bold the grade for all 'A' grade browsers - if ( aData[4] == "A" ) - { - $('td:eq(4)', nRow).html( 'A' ); - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "fnDrawCallback": function( oSettings ) { - alert( 'DataTables has redrawn the table' ); - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "fnFooterCallback": function( nFoot, aData, iStart, iEnd, aiDisplay ) { - ( (nFoot.getElementsByTagName('th')[0])).innerHTML = "Starting index is "+iStart; - } - } ); -} ) - -$(document).ready( function() { - $('#example').dataTable( { - "fnFormatNumber": function ( iIn ) { - if ( iIn < 1000 ) { - return iIn.toString(); - } else { - var - s=(iIn+""), - a=s.split(""), out="", - iLen=s.length; - - for ( var i=0 ; i nHead.getElementsByTagName('th')[0]).innerHTML = "Displaying "+(iEnd-iStart)+" records"; - } - } ); -} ) - -$('#example').dataTable( { - "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) { - return iStart +" to "+ iEnd; - } -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "fnInitComplete": function(oSettings, json) { - alert( 'DataTables has finished its initialisation.' ); - } - } ); -} ) - -$(document).ready( function() { - $('#example').dataTable( { - "fnPreDrawCallback": function( oSettings ) { - if ( $('#test').val() == 1 ) { - return false; - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { - // Bold the grade for all 'A' grade browsers - if ( aData[4] == "A" ) - { - $('td:eq(4)', nRow).html( 'A' ); - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bProcessing": true, - "bServerSide": true, - "sAjaxSource": "xhr.php", - "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) { - oSettings.jqXHR = $.ajax( { - "dataType": 'json', - "type": "POST", - "url": sSource, - "data": aoData, - "success": fnCallback - } ); - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bProcessing": true, - "bServerSide": true, - "sAjaxSource": "scripts/server_processing.php", - "fnServerParams": function ( aoData ) { - aoData.push( { "name": "more_data", "value": "my_value" } ); - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bStateSave": true, - "fnStateLoad": function (oSettings) { - var o; - - // Send an Ajax request to the server to get the data. Note that - // this is a synchronous request. - $.ajax( { - "url": "/state_load", - "async": false, - "dataType": "json", - "success": function (json) { - o = json; - } - } ); - - return o; - } - } ); -} ); - -// Remove a saved filter, so filtering is never loaded -$(document).ready( function() { - $('#example').dataTable( { - "bStateSave": true, - "fnStateLoadParams": function (oSettings, oData) { - oData.oSearch.sSearch = ""; - } - } ); -} ); - - -// Disallow state loading by returning false -$(document).ready( function() { - $('#example').dataTable( { - "bStateSave": true, - "fnStateLoadParams": function (oSettings, oData) { - return false; - } - } ); -} ); - -// Show an alert with the filtering value that was saved -$(document).ready( function() { - $('#example').dataTable( { - "bStateSave": true, - "fnStateLoaded": function (oSettings, oData) { - alert( 'Saved filter was: '+oData.oSearch.sSearch ); - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bStateSave": true, - "fnStateSave": function (oSettings, oData) { - // Send an Ajax request to the server with the state object - $.ajax( { - "url": "/state_save", - "data": oData, - "dataType": "json", - "method": "POST", - "success": function () {} - } ); - } - } ); -} ); - -// Remove a saved filter, so filtering is never saved -$(document).ready( function() { - $('#example').dataTable( { - "bStateSave": true, - "fnStateSaveParams": function (oSettings, oData) { - oData.oSearch.sSearch = ""; - } - } ); -} ); - -// http://datatables.net/usage/columns - -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "aDataSort": [ 0, 1 ], "aTargets": [ 0 ] }, - { "aDataSort": [ 1, 0 ], "aTargets": [ 1 ] }, - { "aDataSort": [ 2, 3, 4 ], "aTargets": [ 2 ] } - ] - } ); -} ); - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "aDataSort": [ 0, 1 ] }, - { "aDataSort": [ 1, 0 ] }, - { "aDataSort": [ 2, 3, 4 ] }, - null, - null - ] - } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "asSorting": [ "asc" ], "aTargets": [ 1 ] }, - { "asSorting": [ "desc", "asc", "asc" ], "aTargets": [ 2 ] }, - { "asSorting": [ "desc" ], "aTargets": [ 3 ] } - ] - } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - null, - { "asSorting": [ "asc" ] }, - { "asSorting": [ "desc", "asc", "asc" ] }, - { "asSorting": [ "desc" ] }, - null - ] - } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "bSearchable": false, "aTargets": [ 0 ] } - ] } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "bSearchable": false }, - null, - null, - null, - null - ] } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "bSortable": false, "aTargets": [ 0 ] } - ] } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "bSortable": false }, - null, - null, - null, - null - ] } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "bVisible": false, "aTargets": [ 0 ] } - ] } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "bVisible": false }, - null, - null, - null, - null - ] } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ { - "aTargets": [3], - "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) { - if ( sData == "1.7" ) { - $(nTd).css('color', 'blue') - } - } - } ] - }); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "iDataSort": 1, "aTargets": [ 0 ] } - ] - } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "iDataSort": 1 }, - null, - null, - null, - null - ] - } ); -} ); - -// Read table data from objects -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "sAjaxSource": "sources/deep.txt", - "aoColumns": [ - { "mData": "engine" }, - { "mData": "browser" }, - { "mData": "platform.inner" }, - { "mData": "platform.details.0" }, - { "mData": "platform.details.1" } - ] - } ); -} ); - - -// Using mData as a function to provide different information for -// sorting, filtering and display. In this case, currency (price) -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "aoColumnDefs": [ { - "aTargets": [ 0 ], - "mData": function ( source, type, val ) { - if (type === 'set') { - source.price = val; - // Store the computed dislay and filter values for efficiency - source.price_display = val=="" ? "" : "$"+val; - source.price_filter = val=="" ? "" : "$"+val+" "+val; - return; - } - else if (type === 'display') { - return source.price_display; - } - else if (type === 'filter') { - return source.price_filter; - } - // 'sort', 'type' and undefined all just use the integer - return source.price; - } - } ] - } ); -} ); - -// Create a comma separated list from an array of objects -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "sAjaxSource": "sources/deep.txt", - "aoColumns": [ - { "mData": "engine" }, - { "mData": "browser" }, - { - "mData": "platform", - "mRender": "[, ].name" - } - ] - } ); -} ); - - -// Use as a function to create a link from the data source -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "aoColumnDefs": [ { - "aTargets": [ 0 ], - "mData": "download_link", - "mRender": function ( data, type, full ) { - return 'Download'; - } - } ] - } ); -} ); - -// Make the first column use TH cells -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "aoColumnDefs": [ { - "aTargets": [ 0 ], - "sCellType": "th" - } ] - } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "sClass": "my_class", "aTargets": [ 0 ] } - ] - } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "sClass": "my_class" }, - null, - null, - null, - null - ] - } ); -} ); - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - null, - null, - null, - { - "sContentPadding": "mmm" - } - ] - } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { - "mData": null, - "sDefaultContent": "Edit", - "aTargets": [ -1 ] - } - ] - } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - null, - null, - null, - { - "mData": null, - "sDefaultContent": "Edit" - } - ] - } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "sName": "engine", "aTargets": [ 0 ] }, - { "sName": "browser", "aTargets": [ 1 ] }, - { "sName": "platform", "aTargets": [ 2 ] }, - { "sName": "version", "aTargets": [ 3 ] }, - { "sName": "grade", "aTargets": [ 4 ] } - ] - } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "sName": "engine" }, - { "sName": "browser" }, - { "sName": "platform" }, - { "sName": "version" }, - { "sName": "grade" } - ] - } ); -} ); - -/* - -This test does not compile, because - for some hard to find reason - the compiler is missing the aTargets -property of the second element. - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "sSortDataType": "dom-text", "aTargets": [ 2, 3 ] }, - { "sType": "numeric", "aTargets": [ 3 ] }, - { "sSortDataType": "dom-select", "aTargets": [ 4 ] }, - { "sSortDataType": "dom-checkbox", "aTargets": [ 5 ] } - ] - } ); -} ); - -*/ - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - null, - null, - { "sSortDataType": "dom-text" }, - { "sSortDataType": "dom-text", "sType": "numeric" }, - { "sSortDataType": "dom-select" }, - { "sSortDataType": "dom-checkbox" } - ] - } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "sTitle": "My column title", "aTargets": [ 0 ] } - ] - } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "sTitle": "My column title" }, - null, - null, - null, - null - ] - } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "sType": "html", "aTargets": [ 0 ] } - ] - } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "sType": "html" }, - null, - null, - null, - null - ] - } ); -} ); - -// Using aoColumnDefs -$(document).ready( function() { - $('#example').dataTable( { - "aoColumnDefs": [ - { "sWidth": "20%", "aTargets": [ 0 ] } - ] - } ); -} ); - - -// Using aoColumns -$(document).ready( function() { - $('#example').dataTable( { - "aoColumns": [ - { "sWidth": "20%" }, - null, - null, - null, - null - ] - } ); -} ); - -// http://www.datatables.net/usage/i18n - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "oAria": { - "sSortAscending": " - click/return to sort ascending" - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "oAria": { - "sSortDescending": " - click/return to sort descending" - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "oPaginate": { - "sFirst": "First page" - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "oPaginate": { - "sLast": "Last page" - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "oPaginate": { - "sNext": "Next page" - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "oPaginate": { - "sPrevious": "Previous page" - } - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sEmptyTable": "No data available in table" - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sInfo": "Got a total of _TOTAL_ entries to show (_START_ to _END_)" - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sInfoEmpty": "No entries to show" - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sInfoFiltered": " - filtering from _MAX_ records" - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sInfoPostFix": "All records shown are derived from real information." - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sInfoThousands": "'" - } - } ); -} ); - -// Language change only -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sLengthMenu": "Display _MENU_ records" - } - } ); -} ); - - -// Language and options change -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sLengthMenu": 'Display records' - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sLoadingRecords": "Please wait - loading..." - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sProcessing": "DataTables is currently busy" - } - } ); -} ); - -// Input text box will be appended at the end automatically -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sSearch": "Filter records:" - } - } ); -} ); - - -// Specify where the filter should appear -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sSearch": "Apply filter _INPUT_ to table" - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sUrl": "http://www.sprymedia.co.uk/dataTables/lang.txt" - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "oLanguage": { - "sZeroRecords": "No records to display" - } - } ); -} ); - -// http://www.datatables.net/usage/server-side - -$(document).ready( function () { - $('#example').dataTable( { - "bServerSide": true, - "sAjaxSource": "xhr.php" - } ); -} ); - -// POST data to server -$(document).ready( function() { - $('#example').dataTable( { - "bProcessing": true, - "bServerSide": true, - "sAjaxSource": "xhr.php", - "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) { - oSettings.jqXHR = $.ajax( { - "dataType": 'json', - "type": "POST", - "url": sSource, - "data": aoData, - "success": fnCallback - } ); - } - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "bProcessing": true, - "bServerSide": true, - "sAjaxSource": "scripts/server_processing.php", - "fnServerParams": function ( aoData ) { - aoData.push( { "name": "more_data", "value": "my_value" } ); - } - } ); -} ); - -// Get data from { "data": [...] } -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "sAjaxSource": "sources/data.txt", - "sAjaxDataProp": "data" - } ); -} ); - - -// Get data from { "data": { "inner": [...] } } -$(document).ready( function() { - var oTable = $('#example').dataTable( { - "sAjaxSource": "sources/data.txt", - "sAjaxDataProp": "data.inner" - } ); -} ); - -$(document).ready( function() { - $('#example').dataTable( { - "sAjaxSource": "http://www.sprymedia.co.uk/dataTables/json.php" - } ); -} ) - -$(document).ready( function() { - $('#example').dataTable( { - "bServerSide": true, - "sAjaxSource": "scripts/post.php", - "sServerMethod": "POST" - } ); -} ); +$(document).ready(function () { + //#region "Language" + + var lang: DataTables.LanguageSettings = { + "emptyTable": "No data available in table", + "info": "Showing _START_ to _END_ of _TOTAL_ entries", + "infoEmpty": "Showing 0 to 0 of 0 entries", + "infoFiltered": "(filtered from _MAX_ total entries)", + "infoPostFix": "", + "thousands": ",", + "lengthMenu": "Show _MENU_ entries", + "loadingRecords": "Loading...", + "processing": "Processing...", + "search": "Search:", + "zeroRecords": "No matching records found", + "paginate": { + "first": "First", + "last": "Last", + "next": "Next", + "previous": "Previous" + }, + "aria": { + "sortAscending": ": activate to sort column ascending", + "sortDescending": ": activate to sort column descending" + } + }; + + //#endregion "Language" + + //#region "Column" + + var colCreatedCellFunc: DataTables.IFunctionColumnCreatedCell = function (cell, cellData, rowData, rowIndex, colIndex) { + + } + + var colDataObject: DataTables.IObjectColumnData = { + _: "phone", + filter: "phone_filter", + display: "phone_display", + sort: "asc" + }; + + var colDataFunc: DataTables.IFunctionColumnData = function (row, type, set, meta) { + }; + + var colRenderObject: DataTables.IObjectColumnRender = { + _: "phone", + filter: "phone_filter", + display: "phone_display", + sort: "asc" + }; + + var colRenderFunc: DataTables.IFunctionColumnRender = function (data, type, row, meta) { + + }; + + var col: DataTables.ColumnSettings = + { + cellType: "th", + className: "css", + contentPadding: "mmmm", + createdCell: colCreatedCellFunc, + data: 1, + defaultContent: "edit", + name: "name", + orderable: true, + orderData: 10, + orderDataType: "dom-checkbox", + orderSequence: ['asc', 'desc'], + render: 1, + searchable: true, + title: "title", + visible: true, + width: "200px" + } + col = + { + data: "", + orderData: [10, 11, 20], + render: "", + } + col = + { + data: colDataObject, + render: colRenderObject, + } + col = + { + data: colDataFunc, + render: colRenderFunc, + } + + //#endregion "Column" + + //#region "ColumnDef" + + var colDef: DataTables.ColumnDefsSettings = + { + targets: 1, + cellType: "th", + className: "css", + contentPadding: "mmmm", + createdCell: colCreatedCellFunc, + data: 1, + defaultContent: "edit", + name: "name", + orderable: true, + orderData: 10, + orderDataType: "dom-checkbox", + orderSequence: ['asc', 'desc'], + render: 1, + searchable: true, + title: "title", + visible: true, + width: "200px" + }; + + colDef = + { + targets: "2", + cellType: "th", + }; + + colDef = + { + targets: ["2", 5], + cellType: "th", + }; + + //#endregion "ColumnDef" + + //#region "Callbacks" + + var createRowFunc: DataTables.IFunctionCreateRow = function (row, data, dataIndex) { }; + var drawCallbackFunc: DataTables.IFunctionDrawCallback = function (settings) { }; + var footerCallbackFunc: DataTables.IFunctionFooterCallback = function (tfoot, data, start, end, display) { }; + var formatNumberFunc: DataTables.IFunctionFormatNumber = function (toForm) { }; + var headerCallbackFunc: DataTables.IFunctionHeaderCallback = function (thead, data, start, end, display) { }; + var infoCallbackFunc: DataTables.IFunctionInfoCallback = function (settings, start, end, total, pre) { }; + var initCallbackFunc: DataTables.IFunctionInitComplete = function (settings, json) { }; + var preDrawFunc: DataTables.IFunctionPreDrawCallback = function (settings) { }; + var rowCallbackFunc: DataTables.IFunctionRowCallback = function (row, data) { }; + var stateLoadCallbackFunc: DataTables.IFunctionStateLoadCallback = function (settings) { }; + var stateLoadedCallbackFunc: DataTables.IFunctionStateLoaded = function (settings, data) { }; + var stateSaveCallbackFunc: DataTables.IFunctionStateSaveCallback = function (settings, data) { }; + var stateSaveParamsFunc: DataTables.IFunctionStateSaveParams = function (settings, data) { }; + + //#endregion "Callbacks + + //#region "Ajax" + + var ajaxFunc: DataTables.IFunctionAjax = function (data, callback, settings) { }; + + var ajaxDataFunc: DataTables.IFunctionAjaxData = function (data) { + return data; + }; + + ajaxDataFunc = function (data) { + return ""; + }; + + //#endregion "Ajax" + + //#region "Settings" + + var config: DataTables.Settings = + { + // columns + columns: [ + col, + null, + col, + null, + col, + col + ], + columnDefs: [ + null, + colDef, + colDef, + null, + ], + // Data + ajax: "url", + data: {}, + // Features + autoWidth: true, + deferRender: true, + info: true, + jQueryUI: false, + lengthChange: true, + ordering: true, + paging: true, + scrollX: true, + scrollY: "200px", + searching: true, + serverSide: true, + stateSave: true, + // Options + deferLoading: 10, + destroy: true, + displayStart: 1, + dom: "lrtip", + lengthMenu: [1, 2, 3, 4], + orderCellsTop: true, + orderClasses: true, + order: [[0, 'asc'], [1, 'asc']], + orderFixed: [[0, 'asc'], [1, 'asc']], + orderMulti: true, + pageLength: 10, + pagingType: "simple", + retrieve: true, + renderer: "bootstrap", + scrollCollapse: true, + search: true, + searchCols: [{ "search": "", "smart": true, "regex": false, "caseInsensitive": true }], + searchDelay: 10, + stateDuration: 10, + tabIndex: 10, + }; + + + config = + { + ajax: ajaxFunc, + deferLoading: [10, 100], + lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], + order: [0, 'asc'], + orderFixed: [[0, 'asc'], [1, 'asc']], + renderer: { + header: "bootstrap", + pageButton: "jqueryui" + }, + search: { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, + searchCols: [ + null, + { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, + { "search": "" }, + { "search": "", "smart": true }, + null + ], + }; + + config = + { + ajax: { + data: {}, + dataSrc: "", + }, + }; + + config = + { + ajax: { + data: ajaxDataFunc, + dataSrc: function (data) { }, + }, + }; + + //#endregion "Settings" + + //#region "Init" + + var dt = $('#example').DataTable(); + dt = $('#example1').DataTable(config); + dt = $('#example1').DataTable(config); + dt.$('tr:odd').css('backgroundColor', 'blue'); + + //#endregion "Init" + + //#region "Methods-Ajax" + + var json = dt.ajax.json(); + + var params = dt.ajax.params(); + + var reload = dt.ajax.reload(); + reload = dt.ajax.reload(function () { }); + reload = dt.ajax.reload(function () { }, true); + var test = reload.$(""); + + var url = dt.ajax.url(); + dt.ajax.url("url"); + dt.ajax.url("url").load(); + + //#endregion "Methods-Ajax" + + //#region "Methods-Core" + + var clear = dt.clear(); + clear.$(""); + + var data = dt.data(); + data.$(""); + + var destroy = dt.destroy(); + destroy = dt.destroy(true); + destroy.$(""); + + var draw = dt.draw(); + draw = dt.draw(true); + draw.$(""); + + var off = dt.off("event"); + off = dt.off("event", function () { }); + off.$(""); + + var on = dt.on("event", function () { }); + on.$(""); + + var one = dt.one("event", function () { }); + one.$(""); + + var order_get = dt.order(); + var order_set = dt.order([0, "asc"]); + order_set = dt.order([0, "asc"], [1, "desc"]); // TODO: Fíx that + order_set = dt.order([[0, "asc"], [1, "desc"]]); + + var orderListerner = order_set.order.listener("node", 1, function () { }); + + var page_get = dt.page(); + var page_set = dt.page(1); + page_set = dt.page("next"); + + var page = dt.page.info(); + page = { + "page": 1, + "pages": 6, + "start": 10, + "end": 20, + "length": 10, + "recordsTotal": 57, + "recordsDisplay": 57 + }; + + var page_len_get = dt.page.len(); + var page_len_set = dt.page.len(10); + + var search_get = dt.search(); + var search_set = dt.search("searchStr"); + search_set = dt.search("searchStr", true); + search_set = dt.search("searchStr", true, false); + search_set = dt.search("searchStr", true, false, false); + + var settings = dt.settings(); + + var state = dt.state(); + state = { "time": 1423772610230, "start": 0, "length": 25, "order": [[0, "asc"]], "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, "columns": [{ "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }] }; + state = dt.state.loaded(); + + var state_clear = dt.state.clear(); + state_clear.$(""); + + var state_save = dt.state.save(); + state_save.$(""); + + //#endregion "Methods-Core" + + var modifier: DataTables.IObjectSelectorModifier = { + order: "current", + search: "none", + page: "all", + }; + + //#region "Methods-Cell" + + var cells = dt.cells(); + cells = dt.cells(":contains('Not shipped')"); + cells = dt.cells(function () { }); + cells = dt.cells($("")); + cells = dt.cells({}); + cells = dt.cells(":contains('Not shipped')r", modifier); + cells = dt.cells("row-selector", "cells-selector", modifier); + + var cells_cache = cells.cache("search"); + // Create the select list and search operation + var select = $('') + .appendTo( + dt.column(colIdx).footer() + ) + .on('change', function () { + dt + .column(colIdx) + .search($(this).val()) + .draw(); + }); + + // Get the search data for the first column and add to the select list + dt + .column(colIdx) + .cache('search') + .sort() + .unique() + .each(function (d) { + select.append($('')); + }); + }); + + var columns_data = columns.data(); + //$('#listData').html( + // dt + // .columns(0) + // .data() + // .eq(0) // Reduce the 2D array into a 1D array of data + // .sort() // Sort data alphabetically + // .unique() // Reduce to unique values + // .join('
') + // ); + + //var idx = dt + // .columns('.check') + // .data() + // .eq(0) // Reduce the 2D array into a 1D array of data + // .indexOf('Yes'); + + var columns_dataSrc = columns.dataSrc(); + //alert('Data source: ' + dt.columns([0, 1]).dataSrc().join(' ')); + + var columns_footer = columns.footer(); + var columns_header = columns.header(); + var columns_indexes = columns.indexes(); + columns_indexes = columns.indexes("visibile"); + var columns_nodes = columns.nodes(); + dt + .columns('.ready') + .nodes() + //.flatten() // Reduce to a 1D array + //.to$() // Convert to a jQuery object + //.addClass('highlight'); + + var columns_search_get = columns.search(); + var columns_search_set = columns.search("string"); + columns_search_set = columns.search("string", true); + columns_search_set = columns.search("string", true, false); + columns_search_set = columns.search("string", true, false, true); + + var columns_visible_get = columns.visible(); + var columns_visible_set = columns.visible(false); + columns_visible_set = columns.visible(false, true); + // Hide a column + dt.column(1).visible(false); + dt.columns([0, 1, 2, 3]).visible(false, false); + dt.columns.adjust().draw(false); // adjust column sizing and redraw + + var columns_adjust = dt.columns.adjust(); + + var column = dt.column("selector"); + column = dt.column("selector", modifier); + + dt.column(0).visible(false); + + $('#example tbody').on('click', 'td', function () { + var visIdx = $(this).index(); + var dataIdx = dt.column.index('fromVisible', visIdx); + + alert('Column data index: ' + dataIdx + ', and visible index: ' + visIdx); + }); + + var column_cache = column.cache("order"); + // Create the select list and search operation + var select = $('') + // .appendTo( + // dt.column(colIdx).footer() + // ) + // .on('change', function () { + // dt + // .column(colIdx) + // .search($(this).val()) + // .draw(); + // }); + + // // Get the search data for the first column and add to the select list + // dt + // .column(colIdx) + // .cache('search') + // .sort() + // .unique() + // .each(function (d) { + // select.append($('')); + // }); + //}); + + var column_visible_get = column.visible(); + var column_visible_set = column.visible(false); + column_visible_set = column.visible(false, true); + alert('Column index 0 is ' + + (dt.column(0).visible() === true ? 'visible' : 'not visible') + ); + for (var i = 0; i < 4; i++) { + dt.column(i).visible(false, false); + } + dt.columns.adjust().draw(false); // adjust column sizing and redraw + + //#endregion "Methods-Column" + + //#region "Methods-Row" + + var row_1 = dt.row("selector"); + var row_2 = dt.row("selector").child.hide(); + var row_3 = dt.row("selector").child.isShown(); + var row_4 = dt.row("selector").child.remove(); + var row_5 = dt.row("selector").child.show(); + var row_6 = dt.row("selector").child(); + var row_7 = dt.row("selector").child(false); + var row_8 = dt.row("selector").child(false).hide(); + var row_9 = dt.row("selector").child("data"); + var row_10 = dt.row("selector").child("data").remove(); + var row_11 = dt.row("selector").child("data", "css").show(); + var row_12 = dt.row("selector").child.remove(); + var row_13 = dt.row("selector").child.show(); + var row_14 = dt.row.add({}); + var row_15 = dt.row("selector").invalidate(); + var row_16 = dt.row("selector").invalidate("auto"); + var row_17 = dt.row("selector").data(); + var row_18 = dt.row("selector").data({}); + var row_19 = dt.row("selector").index(); + var row_20 = dt.row("selector").node(); + var row_21 = dt.row("selector").remove(); + + var rows_1 = dt.rows(); + var rows_2 = dt.rows().remove(); + var rows_3 = dt.rows("selector"); + var rows_4 = dt.rows("selector").cache("type"); + var rows_5 = dt.rows("selector").data(); + var rows_6 = dt.rows("selector").data({}); + var rows_7 = dt.rows("selector").indexes(); + var rows_8 = dt.rows("selector").invalidate(); + var rows_9 = dt.rows("selector").invalidate("auto"); + var rows_10 = dt.rows("selector").indexes(); + var rows_11 = dt.rows("selector").remove(); + var rows_12 = dt.rows("selector").nodes(); + var rows_13 = dt.rows.add([{}, {}]); + + var table3 = $('#example').DataTable(); + table3.row.add({ + "name": "Tiger Nixon", + "position": "System Architect", + "salary": "$3,120", + "start_date": "2011/04/25", + "office": "Edinburgh", + "extn": "5421" + }).draw(); + + var table4 = $('#example').DataTable(); + table4.row.add([{ + "name": "Tiger Nixon", + "position": "System Architect", + "salary": "$3,120", + "start_date": "2011/04/25", + "office": "Edinburgh", + "extn": "5421" + }, { + "name": "Garrett Winters", + "position": "Director", + "salary": "$5,300", + "start_date": "2011/07/25", + "office": "Edinburgh", + "extn": "8422" + }]) + .draw(); + + var pupil: any; + var table5 = $('#example').DataTable(); + table5.rows.add([ + pupil, + pupil, + pupil, + ]) + .draw(); + //.nodes() + //.to$() + //.addClass('new'); + + $('#example tbody').on('click', 'td.details-control', function () { + var tr = $(this).parents('tr'); + var row = dt.row(tr); + + if (row.child.isShown()) { + // This row is already open - close it + row.child.hide(); + tr.removeClass('shown'); + } + else { + // Open this row (the format() function would return the data to be shown) + row.child("").show(); + tr.addClass('shown'); + } + }); + + dt.row(':eq(0)').child([ + 'First child row', + 'Second child row', + 'Third child row' + ]) + .show(); + + dt.rows().eq(0).each(function (rowIdx) { + dt + .row(rowIdx) + .child( + $( + '' + + '' + rowIdx + '.1' + + '' + rowIdx + '.2' + + '' + rowIdx + '.3' + + '' + rowIdx + '.4' + + '' + ) + ) + .show(); + }); + + $('#example tbody').on('click', 'td.details-control', function () { + var tr = $(this).parents('tr'); + var row = dt.row(tr); + + if (row.child.isShown()) { + // This row is already open - close it + row.child.hide(); + tr.removeClass('shown'); + } + else { + // Open this row (the format() function would return the data to be shown) + row.child("").show(); + tr.addClass('shown'); + } + }); + + $('#example tbody').on('click', 'td.details-control', function () { + var tr = $(this).parents('tr'); + var row = dt.row(tr); + + if (row.child.isShown()) { + // This row is already open - remove it + row.child.remove(); + tr.removeClass('shown'); + } + else { + // Open this row (the format() function would return the data to be shown) + row.child("").show(); + tr.addClass('shown'); + } + }); + + //#endregion "Methods-Row" + + //#region "Methods-Table" + + var tables = dt.tables(); + tables = dt.tables("selector"); + + var tables_body = tables.body(); + var tables_containers = tables.containers(); + var tables_footer = tables.footer(); + var tables_header = tables.header(); + var tables_nodes = tables.nodes(); + + var table = dt.table("selector"); + + var table_body = table.body(); + var table_container = table.container(); + var table_footer = table.footer(); + var table_header = table.header(); + var table_node = table.node(); + + //#endregion "Methods-Table" + + //#region "Methods-Util" + + //#endregion "Methods-Util" +}); diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index 9884b78e2..23087fbb7 100755 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -1,479 +1,1602 @@ -// Type definitions for JQuery DataTables 1.9.4 +// Type definitions for JQuery DataTables 1.10.5 // Project: http://www.datatables.net -// Definitions by: Armin Sander +// Definitions by: Kiarash Ghiaseddin // Definitions: https://github.com/borisyankov/DefinitelyTyped // missing: // - Static methods that are defined in JQueryStatic.fn are not typed. // - Plugin and extension definitions are not typed. +// - Some return types are not fully wokring -interface JQuery -{ - dataTable(param? :DataTables.Options) : DataTables.DataTable; +interface JQuery { + DataTable(param?: DataTables.Settings): DataTables.DataTable; } -declare module DataTables -{ - export interface DataTable - { - /// Perform a jQuery selector action on the table's TR elements (from the tbody) and return the resulting jQuery object. - $(selector:string, opts?:RowParams): JQuery; - $(selector:Node[], opts?:RowParams): JQuery; - $(selector:JQuery, opts?:RowParams): JQuery; - - /// Almost identical to $ in operation, but in this case returns the data for the matched rows. - _(selector:string, opts?:RowParams): any[]; - _(selector:Node[], opts?:RowParams): any[]; - _(selector:JQuery, opts?:RowParams): any[]; - - /// Add a single new row or multiple rows of data to the table. - fnAddData(data:any, redraw?:boolean) : number[]; - - /// This function will make DataTables recalculate the column sizes. - fnAdjustColumnSizing(redraw? : boolean) : void; - - /// Quickly and simply clear a table - fnClearTable(redraw? : boolean) : void; - - /// The exact opposite of 'opening' a row, this function will close any rows which are currently 'open'. - fnClose(node: Node) : number; - - /// Remove a row for the table - fnDeleteRow(index: number, callback?: () => void, redraw?: boolean) : any[]; - fnDeleteRow(tr: Node, callback?: () => void, redraw?: boolean) : any[]; - - /// Restore the table to it's original state in the DOM by removing all of DataTables enhancements, - /// alterations to the DOM structure of the table and event listeners. - fnDestroy(remove?: boolean) : void; - - /// Redraw the table - fnDraw(complete? : boolean) : void; - - /// Filter the input based on data - fnFilter(input: string, column? : number, regex?: boolean, smart? : boolean, showGlobal?: boolean, caseInsensitive? : boolean) : void; - - /// Get the data for the whole table, an individual row or an individual cell based on the provided parameters. - fnGetData(row?: Node, col? : number) : any; - fnGetData(row?: number, col? : number) : any; - - /// Get an array of the TR nodes that are used in the table's body. - fnGetNodes(row? : number) : any; // Node[] | Node - - /// Get the array indexes of a particular cell from it's DOM element and column index including hidden columns - fnGetPosition(node: Node) : any; // number | number[] - - /// Check to see if a row is 'open' or not. - fnIsOpen(tr: Node) : boolean; - - /// This function will place a new row directly after a row which is currently on display on the page, - /// with the HTML contents that is passed into the function. - fnOpen(node: Node, html: string, clazz: string) : Node; - fnOpen(node: Node, html: Node, clazz: string) : Node; - fnOpen(node: Node, html: JQuery, clazz: string) : Node; - - /// Change the pagination - provides the internal logic for pagination in a simple API function. - fnPageChange(action: string, redraw?: boolean) : void; - fnPageChange(page: number, redraw?: boolean) : void; - - /// Show a particular column - fnSetColumnVis(column: number, show: boolean, redraw?: boolean) : void; - - /// Get the settings for a particular table for external manipulation - fnSettings() : Settings; - - /// Sort the table by a particular column - fnSort(col: number) : void; - fnSort(col: any[][]) : void; - - /// Attach a sort listener to an element for a given column - fnSortListener(node: Node, column: number, callback? : () => void): void; - - /// Update a table cell or row - this method will accept either a single value to update the cell with, - /// an array of values with one element for each column or an object in the same format as the original data source. - fnUpdate(data: any, row: Node, column?:number, redraw?: boolean, action? : boolean) : number; - fnUpdate(data: any, dataIndex: number, column?:number, redraw?: boolean, action? : boolean) : number; - - /// Provide a common method for plug-ins to check the version of DataTables being used, - /// in order to ensure compatibility. - fnVersionCheck(version: string) : boolean; - } - - export interface Static - { - /// Provide a common method for plug-ins to check the version of DataTables being used, - /// in order to ensure compatibility. - fnVersionCheck(version: string) : boolean; - - /// Check if a TABLE node is a DataTable table already or not. - fnIsDataTable(table: Node) : boolean; - - /// Get all DataTable tables that have been initialised. - fnTables(visible? : boolean) : Node[]; - } - - export interface RowParams - { - /// Select TR elements that meet the current filter criterion ("applied") or all TR elements (i.e. no filter). - filter?: string; - - /// Order of the TR elements in the processed array. - /// Can be either 'current', whereby the current sorting of the table is used, or - /// 'original' whereby the original order the data was read into the table is used. - order?: string; - - /// Limit the selection to the currently displayed page - /// ("current") or not ("all"). If 'current' is given, then order is assumed to be - /// 'current' and filter is 'applied', regardless of what they might be given as. - page?: string; - } - - export interface Options - { - aaData?: any[]; - aaSorting?: any[]; - aaSortingFixed?: any[]; - ajax?: any; - aLengthMenu?: any[]; - aoColumns?: ColumnOptions[]; - aoColumnDefs?: ColumnDef[]; - aoSearchCols?: any[]; - asStripClasses?: string[]; - bAutoWidth?: boolean; - bDeferRender?: boolean; - bDestroy?: boolean; - bFilter?: boolean; - bInfo?: boolean; - bJQueryUI?: boolean; - bLengthChange?: boolean; - bPaginate?: boolean; - bProcessing?: boolean; - bRetrieve?: boolean; - bScrollAutoCss?: boolean; - bScrollCollapse?: boolean; - bScrollInfinite?: boolean; - bServerSide?: boolean; - bSort?: boolean; - bSortCellsTop?: boolean; - bSortClasses?: boolean; - bStateSave?: boolean; - fnCookieCallback?: CookieCallback; - fnCreatedRow?: RowCreatedCallback; - fnDrawCallback?: DrawCallback; - fnFooterCallback?: FooterCallback; - fnFormatNumber?: FormatNumber; - fnHeaderCallback?: HeaderCallback; - fnInfoCallback?: InfoCallback; - fnInitComplete?: InitComplete; - fnPreDrawCallback?: PreDrawCallback; - fnRowCallback?: RowCallback; - - fnStateLoadCallback?: StateLoadCallback; - fnStateLoadParams?: StateLoadParams; - fnStateLoaded?: StateLoaded; - fnStateSaveCallback?: StateSaveCallback; - fnStateSaveParams?: StateSaveParams; - iCookieDuration?: number; - iDeferLoading?: any; - iDisplayLength?: number; - iDisplayStart?: number; - iScrollLoadGap?: number; - iTabIndex?: number; - oLanguage?: LanguageOptions; - oSearch?: any; - sAjaxDataProp?: string; - sAjaxSource?: string; - sCookiePrefix?: string; - sDom?: string; - sPaginationType?: string; - sScrollX?: string; - sScrollXInner?: string; - sScrollY?: string; - sServerMethod? : string; - } - - export interface LanguageOptions - { - oAria? : AriaOptions; - oPaginate? : PaginateOptions; - sEmptyTable?: string; - sInfo?: string; - sInfoEmpty?: string; - sInfoFiltered?: string; - sInfoPostFix?: string; - sInfoThousands?: string; - sLengthMenu?: string; - sLoadingRecords?: string; - sProcessing?: string; - sSearch?: string; - sUrl?: string; - sZeroRecords?: string; - } - - export interface AriaOptions - { - sSortAscending?: string; - sSortDescending?: string; - } - - export interface PaginateOptions - { - sFirst?: string; - sLast?: string; - sNext?: string; - sPrevious?: string; - } - - export interface ColumnOptions - { - aDataSort?: number[]; - asSorting?: string[]; - bSearchable? : boolean; - bSortable? : boolean; - bVisible? : boolean; - _bAutoType? : boolean; - fnCreatedCell?: CreatedCell; - iDataSort?: number; - mData?: any; - mRender?: any; - sCellType?: string; - sClass?: string; - sContentPadding?: string; - sDefaultContent?: string; - sName?: string; - sSortDataType?: string; - sSortingClass?: string; - sTitle?: string; - sType?: string; - sWidth?: string; - } - - export interface ColumnDef extends ColumnOptions - { - aTargets: any[]; - } - - export interface Settings - { - oFeatures : Features; - oScroll: ScrollingSettings; - oLanguage : { fnInfoCallback : InfoCallback; }; - oBrowser : { bScrollOversize : boolean; }; - aanFeatures: Node[][]; - aoData: Row[]; - aiDisplay: number[]; - aiDisplayMaster: number[]; - aoColumns: Column[]; - aoHeader: any[]; - aoFooter: any[]; - asDataSearch: string[]; - oPreviousSearch: any; - aoPreSearchCols: any[]; - aaSorting: any[][]; - aaSortingFixed: any[][]; - asStripeClasses: string[]; - asDestroyStripes: string[]; - sDestroyWidth: number; - aoRowCallback: RowCallback[]; - aoHeaderCallback: HeaderCallback[]; - aoFooterCallback: FooterCallback[]; - aoDrawCallback: DrawCallback[]; - aoRowCreatedCallback: RowCreatedCallback[]; - aoPreDrawCallback: PreDrawCallback[]; - aoInitComplete: InitComplete[]; - aoStateSaveParams: StateSaveParams[]; - aoStateLoadParams: StateLoadParams[]; - aoStateLoaded: StateLoaded[]; - sTableId: string; - nTable: Node; - nTHead: Node; - nTFoot: Node; - nTBody: Node; - nTableWrapper: Node; - bDeferLoading: boolean; - bInitialized: boolean; - aoOpenRows: any[]; - sDom: string; - sPaginationType: string; - iCookieDuration: number; - sCookiePrefix: string; - fnCookieCallback: CookieCallback; - aoStateSave: StateSaveCallback[]; - aoStateLoad: StateLoadCallback[]; - oLoadedState: any; - sAjaxSource: string; - sAjaxDataProp: string; - bAjaxDataGet: boolean; - jqXHR: any; - fnServerData: any; - aoServerParams: any[]; - sServerMethod: string; - fnFormatNumber: FormatNumber; - aLengthMenu: any[]; - iDraw: number; - bDrawing: boolean; - iDrawError: number; - _iDisplayLength: number; - _iDisplayStart: number; - _iDisplayEnd: number; - _iRecordsTotal: number; - _iRecordsDisplay: number; - bJUI: boolean; - oClasses: any; - bFiltered: boolean; - bSorted: boolean; - bSortCellsTop: boolean; - oInit: any; - aoDestroyCallback: any[]; - fnRecordsTotal: () => number; - fnRecordsDisplay: () => number; - fnDisplayEnd: () => number; - oInstance : any; - sInstance: string; - iTabIndex: number; - nScrollHead: Node; - nScrollFoot: Node; - } - - export interface Features - { - bAutoWidth: boolean; - bDeferRender: boolean; - bFilter: boolean; - bInfo: boolean; - bLengthChange: boolean; - bPaginate: boolean; - bProcessing: boolean; - bServerSide: boolean; - bSort: boolean; - bSortClasses: boolean; - bStateSave: boolean; - } - - export interface ScrollingSettings - { - bAutoCss : boolean; - bCollapse: boolean; - bInfinite: boolean; - iBarWidth: number; - iLoadGap: number; - sX: string; - sY: string; - } - - export interface Row - { - nTr: Node; - _aData: any; - _aSortData: any[]; - _anHidden: Node[]; - _sRowStripe: string; - } - - export interface Column - { - aDataSort: any; - asSorting: string[]; - bSearchable : boolean; - bSortable : boolean; - bVisible : boolean; - _bAutoType : boolean; - fnCreatedCell: CreatedCell; - fnGetData: (data: any, specific: string) => any; - fnSetData: (data: any, value: any) => void; - mData: any; - mRender: any; - nTh: Node; - nIf: Node; - sClass: string; - sContentPadding: string; - sDefaultContent: string; - sName: string; - sSortDataType: string; - sSortingClass: string; - sSortingClassJUI: string; - sTitle: string; - sType: string; - sWidth: string; - sWidthOrig: string; - } - - export interface CookieCallback - { - (name: string, data: any, expires: string, path: string, cookie: string) : void; - } - - export interface RowCreatedCallback - { - (row: Node, data: any[], dataIndex: number) : void; - } - - export interface DrawCallback - { - (settings: Settings) : void; - } - - export interface FooterCallback - { - (foot: Element, data: any[], start:number, end:number, display: number[]) : void; - } - - export interface FormatNumber - { - (toFormat: number) : string; - } - - export interface HeaderCallback - { - (head: Element, data: any[], start:number, end:number, display: number[]) : void; - } - - export interface InfoCallback - { - (settings: Settings, start: number, end: number, max:number, total: number, pre: string) : string; - } - - export interface InitComplete - { - (settings: Settings, json: any) : void; - } - - export interface PreDrawCallback - { - (settings: Settings) : boolean; - } - - export interface RowCallback - { - (row : Settings, data: any[], displayIndex: number, displayIndexFull: number) : void; - } - - export interface StateLoadCallback - { - (settings: Settings) : any; - } - - export interface StateLoadParams - { - (settings: Settings, data: any) : void; - } - - export interface StateLoaded - { - (settings: Settings, data: any) : void; - } - - export interface StateSaveCallback - { - (settings: any, data:any) : void; - } - - export interface StateSaveParams - { - (settings: any, data:any) : void; - } - - export interface CreatedCell - { - (nTd: Node, cellData: any, rowData: any, row: number, col: number) : void; - } +interface JQueryStatic { + //TODO: Wrong, as jquery.d.ts has no interface for fn + dataTable: DataTables.StaticFunctions; } + +declare module DataTables { + export interface DataTable extends DataTableCore { + /** + * Get the data for the whole table. + */ + data(): DataTable; + + /** + * Order Methods / Object + */ + order: OrderMethods; + + //#region "Cell/Cells" + + /** + * Select the cell found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cell(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellMethods; + + /** + * Select the cell found by a cell selector + * + * @param rowSelector Row selector. + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cell(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellMethods; + + /** + * Select all cells + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cells(modifier?: IObjectSelectorModifier): CellsMethods; + + /** + * Select cells found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cells(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellsMethods; + + /** + * Select cells found by both row and column selectors + * + * @param rowSelector Row selector. + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cells(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellsMethods; + //#endregion "Cell/Cells" + + //#region "Column/Columns" + + /** + * Column Methods / Object + */ + column: ColumnMethodsModel; + + /** + * Columns Methods / Object + */ + columns: ColumnsMethodsModel; + + //#endregion "Column/Columns" + + //#region "Row/Rows" + + /** + * Row Methode / Object + */ + row: RowMethodsModel + + /** + * Rows Methods / Object + */ + rows: RowsMethodsModel + + //#endregion "Row/Rows" + + //#region "Table/Tables" + + /** + * Select a table based on a selector from the API's context + * + * @param tableSelector Table selector. + */ + table(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TableMethods; + + /** + * Select all tables + */ + tables(): TablesMethods; + + /** + * Select tables based on the given selector + * + * @param tableSelector Table selector. + */ + tables(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TablesMethods; + + //#endregion "Table/Tables" + } + + export interface DataTables extends DataTableCore { + [index: number]: DataTable; + } + + interface IObjectSelectorModifier { + /** + * The order modifier provides the ability to control which order the rows are processed in. + * Values: 'current', 'applied', 'index', 'original' + */ + order?: string; + + /** + * The search modifier provides the ability to govern which rows are used by the selector using the search options that are applied to the table. + * Values: 'none', 'applied', 'removed' + */ + search?: string; + + /** + * The page modifier allows you to control if the selector should consider all data in the table, regardless of paging, or if only the rows in the currently disabled page should be used. + * Values: 'all', 'current' + */ + page?: string; + } + + //#region "Namespaces" + + //#region "core-methods" + + interface DataTableCore extends UtilityMethods { + /** + * Get jquery object + */ + $(selector: string | Node | Node[]| JQuery, modifier?: IObjectSelectorModifier): JQuery; + + ///// Almost identical to $ in operation, but in this case returns the data for the matched rows. + //_(selector: string | Node | Node[] | JQuery, modifier?: IObjectSelectorModifier): JQuery; + + /** + * Ajax Methods + */ + ajax: AjaxMethodModel; + + /** + * Clear the table of all data. + */ + clear(): DataTable; + + /** + * Destroy the DataTables in the current context. + * + * @param remove Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false). + */ + destroy(remove?: boolean): DataTable; + + /** + * Destroy the DataTables in the current context. + * + * @param reset Reset (default) or hold the current paging position. A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action. + */ + draw(reset?: boolean): DataTable; + + /** + * Table events removal. + * + * @param event Event name to remove. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + off(event: string, callback?: Function): DataTable; + + /** + * Table events listener. + * + * @param event Event to listen for. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + on(event: string, callback: Function): DataTable; + + /** + * Listen for a table event once and then remove the listener. + * + * @param event Event to listen for. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + one(event: string, callback: Function): DataTable; + + /** + * Page Methods / Object + */ + page: PageMethods; + + /** + * Get current search + */ + search(): string; + + /** + * Search for data in the table. + * + * @param input Search string to apply to the table. + * @param regex Treat as a regular expression (true) or not (default, false). + * @param smart Perform smart search. + * @param caseInsen Do case-insensitive matching (default, true) or not (false). + */ + search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): DataTable; + + /** + * Obtain the table's settings object + */ + settings(): DataTable; + + /** + * Page Methods / Object + */ + state: StateMethods; + } + + //#region "ajax-methods" + + interface AjaxMethods extends DataTable { + /** + * Reload the table data from the Ajax data source. + * + * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. + * @param resetPaging Reset (default action or true) or hold the current paging position (false). + */ + load(callback?: Function, resetPaging?: boolean): DataTable; + } + + interface AjaxMethodModel { + /** + * Get the latest JSON data obtained from the last Ajax request DataTables made + */ + json(): Object; + + /** + * Get the data submitted by DataTables to the server in the last Ajax request + */ + params(): Object; + + /** + * Reload the table data from the Ajax data source. + * + * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. + * @param resetPaging Reset (default action or true) or hold the current paging position (false). + */ + reload(callback?: Function, resetPaging?: boolean): DataTable; + + /** + * Reload the table data from the Ajax data source + */ + url(): string; + + /** + * Reload the table data from the Ajax data source + * + * @param url URL to set to be the Ajax data source for the table. + */ + url(url: string): AjaxMethods; + } + + //#endregion "ajax-methods" + + //#region "order-methods" + + interface OrderMethods { + /** + * Get the ordering applied to the table. + */ + (): (string | number)[][]; + + /** + * Set the ordering applied to the table. + * + * @param order Order Model + */ + (order?: (string | number)[]): DataTable; + (order?: (string | number)[][]): DataTable; + (order: (string | number)[], ...args: any[]): DataTable; + + /** + * Add an ordering listener to an element, for a given column. + * + * @param node Selector + * @param column Column index + * @param callback Callback function + */ + listener(node: string | Node | JQuery, column: number, callback: Function): DataTable; + } + //#endregion "order-methods" + + //#region "page-methods" + + interface PageMethods { + /** + * Get the current page of the table. + */ + (): number; + + /** + * Set the current page of the table. + * + * @param page Index or 'first', 'next', 'previous', 'last' + */ + (page: number | string): DataTable; + + /** + * Get paging information about the table + */ + info(): PageMethodeModelInfoReturn; + + /** + * Get the table's page length. + */ + len(): number; + + /** + * Set the table's page length. + * + * @param length Page length to set. use -1 to show all records. + */ + len(length: number): DataTable; + } + + interface PageMethodeModelInfoReturn { + page: number; + pages: number; + start: number; + end: number; + length: number; + recordsTotal: number; + recordsDisplay: number; + } + + //#endregion "page-methods" + + //#region "state-methods" + + interface StateMethods { + /** + * Get the last saved state of the table + */ + (): StateReturnModel; + + /** + * Clear the saved state of the table. + */ + clear(): DataTable; + + /** + * Get the table state that was loaded during initialisation. + */ + loaded(): StateReturnModel; + + /** + * Trigger a state save. + */ + save(): DataTable; + } + + interface StateReturnModel { + time: number; + start: number; + length: number; + order: (string | number)[][]; + search: SearchSettings; + columns: Array; + } + + //#endregion "state-methods" + + //#endregion "core-methods" + + //#region "util-methods" + + interface UtilityMethods { + /** + * Concatenate two or more API instances together + * + * @param a API instance to concatenate to the initial instance. + * @param b Additional API instance(s) to concatenate to the initial instance. + */ + concat(a: Object, ...b: Object[]): DataTable; + + /** + * Iterate over the contents of the API result set. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters + */ + each(fn: Function): DataTable; + + /** + * Reduce an Api instance to a single context and result set. + * + * @param idx Index to select + */ + eq(idx: number): DataTable; + + /** + * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. + */ + filter(fn: Function): DataTable; + + /** + * Flatten a 2D array structured API instance to a 1D array structure. + */ + flatten(): DataTable; + + /** + * Find the first instance of a value in the API instance's result set. + * + * @param value Value to find in the instance's result set. + */ + indexOf(value: any): number; + + /** + * Join the elements in the result set into a string. + * + * @param separator The string that will be used to separate each element of the result set. + */ + join(separator: string): string; + + /** + * Find the last instance of a value in the API instance's result set. + * + * @param value Value to find in the instance's result set. + */ + lastIndexOf(value: any): number; + + /** + * Number of elements in an API instance's result set. + */ + length: number; + + /** + * Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. + */ + map(fn: Function): DataTable; + + /** + * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements. + * + * @param property Object property name to use from the element in the original result set for the new result set. + */ + pluck(property: number | string): DataTable; + + /** + * Remove the last item from an API instance's result set. + */ + pop(): any; + + /** + * Add one or more items to the end of an API instance's result set. + * + * @param value_1 Item to add to the API instance's result set. + */ + push(value_1: any | any[], ...value_2: any[]): number; + + /** + * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right). + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. + * @param initialValue Value to use as the first argument of the first call to the fn callback. + */ + reduce(fn: Function, initialValue?: any): any; + + /** + * Apply a callback function against and accumulator and each element in the Api's result set (right-to-left). + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. + * @param initialValue Value to use as the first argument of the first call to the fn callback. + */ + reduceRight(fn: Function, initialValue?: any): any; + + /** + * Reverse the result set of the API instance and return the original array. + */ + reverse(): DataTable; + + /** + * Remove the first item from an API instance's result set. + */ + shift(): any; + + /** + * Sort the elements of the API instance's result set. + * + * @param fn This is a standard Javascript sort comparison function. It accepts two parameters. + */ + sort(fn?: Function): DataTable; + + /** + * Modify the contents of an Api instance's result set, adding or removing items from it as required. + * + * @param index Index at which to start modifying the Api instance's result set. + * @param howMany Number of elements to remove from the result set. + * @param value_1 Item to add to the result set at the index specified by the first parameter. + */ + splice(index: number, howMany: number, value_1?: any | any[], ...value_2: any[]): any[]; + + /** + * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. + */ + to$(): JQuery; + + /** + * Create a native Javascript array object from an API instance. + */ + toArray(): any[]; + + /** + * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. + */ + toJQuery(): JQuery; + + /** + * Create a new API instance containing only the unique items from a the elements in an instance's result set. + */ + unique(): DataTable; + + /** + * Add one or more items to the start of an API instance's result set. + * + * @param value_1 Item to add to the API instance's result set. + */ + unshift(value_1: any | any[], ...value_2: any[]): number; + } + + //#endregion "util-methods" + + interface CommonSubMethods { + /** + * Get the DataTables cached data for the selected cell + * + * @param t Specify which cache the data should be read from. Can take one of two values: search or order + */ + cache(t: string): DataTable; + } + + //#region "cell-methods" + + interface CommonCellMethods extends CommonSubMethods { + /** + * Invalidate the data held in DataTables for the selected cells + * + * @param source Data source to read the new data from. + */ + invalidate(source?: string): DataTable; + + /** + * Get data for the selected cell + * + * @param f Data type to get. This can be one of: 'display', 'filter', 'sort', 'type' + */ + render(t: string): any; + } + + interface CellMethods extends DataTableCore, CommonCellMethods { + /** + * Get data for the selected cell + */ + data(): any; + + /** + * Get data for the selected cell + * + * @param data Value to assign to the data for the cell + */ + data(data: any): DataTable; + + /** + * Get index information about the selected cell + */ + index(): CellIndexReturn; + + /** + * Get the DOM element for the selected cell + */ + node(): Node; + } + + interface CellIndexReturn { + row: number; + column: number; + columnVisible: number; + } + + interface CellsMethods extends DataTableCore, CommonCellMethods { + /** + * Get data for the selected cells + */ + data(): DataTable; + + /** + * Get index information about the selected cells + */ + indexes(): DataTable; + + /** + * Get the DOM elements for the selected cells + */ + nodes(): DataTable; + } + //#endregion "cell-methods" + + //#region "column-methods" + + interface CommonColumnMethod extends CommonSubMethods { + /** + * Get the footer th / td cell for the selected column. + */ + footer(): any; + + /** + * Get the header th / td cell for a column. + */ + header(): Node; + + /** + * Order the table, in the direction specified, by the column selected by the column()DT selector. + * + * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending). + */ + order(direction: string): DataTable; + + /** + * Get the visibility of the selected column. + */ + visible(): boolean; + + /** + * Set the visibility of the selected column. + * + * @param show Specify if the column should be visible (true) or not (false). + * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance. + */ + visible(show: boolean, redrawCalculations?: boolean): DataTable; + } + + interface ColumnMethodsModel { + /** + * Select the column found by a column selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (columnSelector: any, modifier?: IObjectSelectorModifier): ColumnMethods; + + /** + * Convert from the input column index type to that required. + * + * @param t The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible' + * @param index The index to be converted + */ + index(t: string, index: number): number; + } + + interface ColumnMethods extends DataTableCore, CommonColumnMethod { + /** + * Get the data for the cells in the selected column. + */ + data(): DataTable[]; + + /** + * Get the data source property for the selected column + */ + dataSrc(): number | string | Function; + + /** + * Get index information about the selected cell + * + * @param t Specify if you want to get the column data index (default) or the visible index (visible). + */ + index(t?: string): DataTable; + + /** + * Obtain the th / td nodes for the selected column + */ + nodes(): DataTable[]; + } + + interface ColumnsMethodsModel { + /** + * Select all columns + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (modifier?: IObjectSelectorModifier): ColumnsMethods; + + /** + * Select columns found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (columnSelector: any, modifier?: IObjectSelectorModifier): ColumnsMethods; + + /** + * Recalculate the column widths for layout. + */ + adjust(): DataTable; + } + + interface ColumnsMethods extends DataTableCore, CommonColumnMethod { + /** + * Obtain the data for the columns from the selector + */ + data(): DataTable[][]; + + /** + * Get the data source property for the selected columns. + */ + dataSrc(): DataTable; + + /** + * Get the column indexes of the selected columns. + * + * @param t Specify if you want to get the column data index (default) or the visible index (visible). + */ + indexes(t?: string): DataTable; + + /** + * Obtain the th / td nodes for the selected columns + */ + nodes(): DataTable[][]; + } + //#endregion "column-methods" + + //#region "row-methods" + + interface CommonRowMethod extends CommonSubMethods { + /** + * Obtain the th / td nodes for the selected column + * + * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom' + */ + invalidate(source?: string): DataTable; + } + + interface RowChildMethodModel { + /** + * Get the child row(s) that have been set for a parent row + */ + (): JQuery; + + /** + * Get the child row(s) that have been set for a parent row + * + * @param showRemove This parameter can be given as true or false + */ + (showRemove: boolean): RowChildMethods; + + /** + * Set the data to show in the child row(s). Note that calling this method will replace any child rows which are already attached to the parent row. + * + * @param data The data to be shown in the child row can be given in multiple different ways. + * @param className Class name that is added to the td cell node(s) of the child row(s). As of 1.10.1 it is also added to the tr row node of the child row(s). + */ + (data: (string | Node | JQuery) | (string | Node | JQuery)[], className?: string): RowChildMethods; + + /** + * Hide the child row(s) of a parent row + */ + hide(): DataTable; + + /** + * Check if the child rows of a parent row are visible + */ + isShown(): DataTable; + + /** + * Remove child row(s) from display and release any allocated memory + */ + remove(): DataTable; + + /** + * Show the child row(s) of a parent row + */ + show(): DataTable; + } + + interface RowChildMethods extends DataTableCore { + /** + * Hide the child row(s) of a parent row + */ + hide(): DataTable; + + /** + * Remove child row(s) from display and release any allocated memory + */ + remove(): DataTable; + + /** + * Make newly defined child rows visible + */ + show(): DataTable; + } + + interface RowMethodsModel { + /** + * Select a row found by a row selector + * + * @param rowSelector Row selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (rowSelector: any, modifier?: IObjectSelectorModifier): RowMethods; + + /** + * Add a new row to the table using the given data + * + * @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table + */ + add(data: any[]| Object): DataTable; + } + + interface RowMethods extends DataTableCore, CommonRowMethod { + /** + * Order Methods / Object + */ + child: RowChildMethodModel; + + /** + * Get the data for the selected row + */ + data(): any[]| Object; + + /** + * Set the data for the selected row + * + * @param d Data to use for the row. + */ + data(d: any[]| Object): DataTable; + + /** + * Get the row index of the row column. + */ + index(): number; + + /** + * Obtain the tr node for the selected row + */ + node(): Node; + + /** + * Delete the selected row from the DataTable. + */ + remove(): Node; + } + + interface RowsMethodsModel { + /** + * Select all rows + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (modifier?: IObjectSelectorModifier): RowsMethods; + + /** + * Select rows found by a row selector + * + * @param cellSelector Row selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (rowSelector: any, modifier?: IObjectSelectorModifier): RowsMethods; + + /** + * Add new rows to the table using the data given + * + * @param data Array of data elements, with each one describing a new row to be added to the table + */ + add(data: any[]): DataTable; + } + + interface RowsMethods extends DataTableCore, CommonRowMethod { + /** + * Get the data for the rows from the selector + */ + data(): DataTable; + + /** + * Set the data for the selected row + * + * @param d Data to use for the row. + */ + data(d: any[]| Object): DataTable; + + /** + * Get the row indexes of the selected rows. + */ + indexes(): DataTable; + + /** + * Obtain the tr nodes for the selected rows + */ + nodes(): DataTable; + + /** + * Delete the selected rows from the DataTable. + */ + remove(): DataTable; + } + //#endregion "row-methods" + + //#region "table-methods" + + interface TableMethods extends DataTableCore { + /** + * Get the tfoot node for the table in the API's context + */ + footer(): Node; + + /** + * Get the thead node for the table in the API's context + */ + header(): Node; + + /** + * Get the tbody node for the table in the API's context + */ + body(): Node; + + /** + * Get the div container node for the table in the API's context + */ + container(): Node; + + /** + * Get the table node for the table in the API's context + */ + node(): Node; + } + + interface TablesMethods extends DataTableCore { + /** + * Get the tfoot nodes for the tables in the API's context + */ + footer(): DataTable; + + /** + * Get the thead nodes for the tables in the API's context + */ + header(): DataTable; + + /** + * Get the tbody nodes for the tables in the API's context + */ + body(): DataTable; + + /** + * Get the div container nodes for the tables in the API's context + */ + containers(): DataTable; + + /** + * Get the table nodes for the tables in the API's context + */ + nodes(): DataTable; + } + //#endregion "table-methods" + + //#endregion "Namespaces" + + //#region "Static-Methods" + + export interface StaticFunctions { + /** + * Check is a table node is a DataTable or not + * + * @param table Selector string for table + */ + isDataTable(table: string): boolean; + + /** + * Get all DataTables on the page + * + * @param visible Get only visible tables + */ + tables(visible?: boolean): DataTables.DataTable[]; + + /** + * Version number compatibility check function + * + * @param version Version string + */ + versionCheck(version: string): boolean; + + /** + * Utils + */ + util: StaticUtilFunctions; + + /** + * Check is a table node is a DataTable or not + * + * @param table Selector string for table + */ + Api(selector: string | Node | Node[]| JQuery): DataTables.DataTable; + } + + export interface StaticUtilFunctions { + /** + * Escape special characters in a regular expression string. Since: 1.10.4 + * + * @param str String to escape + */ + escapeRegex(str: string): string; + + /** + * Throttle the calls to a method to reduce call frequency. Since: 1.10.3 + * + * @param fn Function + * @param period ms + */ + throttle(fn: Function, period?: number): Function; + } + + //#endregion "Static-Methods" + + //#region "Settings" + + export interface Settings { + + //#region "Features" + + /** + * Feature control DataTables' smart column width handling. Since: 1.10 + */ + autoWidth?: boolean; + + /** + * Feature control deferred rendering for additional speed of initialisation. Since: 1.10 + */ + deferRender?: boolean; + + /** + * Feature control table information display field. Since: 1.10 + */ + info?: boolean; + + /** + * Use markup and classes for the table to be themed by jQuery UI ThemeRoller. Since: 1.10 + */ + jQueryUI?: boolean; + + /** + * Feature control the end user's ability to change the paging display length of the table. Since: 1.10 + */ + lengthChange?: boolean; + + /** + * Feature control ordering (sorting) abilities in DataTables. Since: 1.10 + */ + ordering?: boolean; + + /** + * Enable or disable table pagination. Since: 1.10 + */ + paging?: boolean; + + /** + * Feature control the processing indicator. Since: 1.10 + */ + processing?: boolean; + + /** + * Horizontal scrolling. Since: 1.10 + */ + scrollX?: boolean; + + /** + * Vertical scrolling. Since: 1.10 Exp: "200px" + */ + scrollY?: string; + + /** + * Feature control search (filtering) abilities Since: 1.10 + */ + searching?: boolean; + + /** + * Feature control DataTables' server-side processing mode. Since: 1.10 + */ + serverSide?: boolean; + + /** + * State saving - restore table state on page reload. Since: 1.10 + */ + stateSave?: boolean; + + //#endregion "Features" + + //#region "Data" + + /** + * Load data for the table's content from an Ajax source. Since: 1.10 + */ + ajax?: string | AjaxSettings | IFunctionAjax; + + /** + * Data to use as the display data for the table. Since: 1.10 + */ + data?: Object; + + //#endregion "Data" + + //#region "Options" + + /** + * Data to use as the display data for the table. Since: 1.10 + */ + columns?: ColumnSettings[]; + + /** + * Assign a column definition to one or more columns.. Since: 1.10 + */ + columnDefs?: ColumnDefsSettings[]; + + /** + * Delay the loading of server-side data until second draw + */ + deferLoading?: number | number[]; + + /** + * Destroy any existing table matching the selector and replace with the new options. Since: 1.10 + */ + destroy?: boolean; + + /** + * Initial paging start point. Since: 1.10 + */ + displayStart?: number; + + /** + * Define the table control elements to appear on the page and in what order. Since: 1.10 + */ + dom?: string; + + /** + * Change the options in the page length select list. Since: 1.10 + */ + lengthMenu?: (number | string)[]| (number | string)[][]; + + /** + * Control which cell the order event handler will be applied to in a column. Since: 1.10 + */ + orderCellsTop?: boolean; + + /** + * Highlight the columns being ordered in the table's body. Since: 1.10 + */ + orderClasses?: boolean; + + /** + * Initial order (sort) to apply to the table. Since: 1.10 + */ + order?: (string | number)[]| (string | number)[][]; + + /** + * Ordering to always be applied to the table. Since: 1.10 + */ + orderFixed?: (string | number)[]| (string | number)[][]| Object; + + /** + * Multiple column ordering ability control. Since: 1.10 + */ + orderMulti?: boolean; + + /** + * Change the initial page length (number of rows per page). Since: 1.10 + */ + pageLength?: number; + + /** + * Pagination button display options. Basic Types: simple, simple_numbers, full, full_numbers + */ + pagingType?: string; + + /** + * Retrieve an existing DataTables instance. Since: 1.10 + */ + retrieve?: boolean + + /** + * Display component renderer types. Since: 1.10 + */ + renderer?: string | RendererSettings; + + /** + * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10 + */ + scrollCollapse?: boolean; + + /** + * Set an initial filter in DataTables and / or filtering options. Since: 1.10 + */ + search?: SearchSettings; + + /** + * Define an initial search for individual columns. Since: 1.10 + */ + searchCols?: SearchSettings[]; + + /** + * Set a throttle frequency for searching. Since: 1.10 + */ + searchDelay?: number; + + /** + * Saved state validity duration. Since: 1.10 + */ + stateDuration?: number; + + /** + * Set the zebra stripe class names for the rows in the table. Since: 1.10 + */ + stripeClasses?: string[]; + + /** + * Tab index control for keyboard navigation. Since: 1.10 + */ + tabIndex?: number; + + //#endregion "Options" + + //#region "Callbacks" + + /** + * Callback for whenever a TR element is created for the table's body. Since: 1.10 + */ + createdRow?: IFunctionCreateRow; + + /** + * Function that is called every time DataTables performs a draw. Since: 1.10 + */ + drawCallback?: IFunctionDrawCallback; + + /** + * Footer display callback function. Since: 1.10 + */ + footerCallback?: IFunctionFooterCallback; + + /** + * Number formatting callback function. Since: 1.10 + */ + formatNumber?: IFunctionFormatNumber; + + /** + * Header display callback function. Since: 1.10 + */ + headerCallback?: IFunctionHeaderCallback; + + /** + * Table summary information display callback. Since: 1.10 + */ + infoCallback?: IFunctionInfoCallback; + + /** + * Initialisation complete callback. Since: 1.10 + */ + initComplete?: IFunctionInitComplete; + + /** + * Pre-draw callback. Since: 1.10 + */ + preDrawCallback?: IFunctionPreDrawCallback; + + /** + * Row draw callback.. Since: 1.10 + */ + rowCallback?: IFunctionRowCallback; + + /** + * Callback that defines where and how a saved state should be loaded. Since: 1.10 + */ + stateLoadCallback?: IFunctionStateLoadCallback; + + /** + * State loaded callback. Since: 1.10 + */ + stateLoaded?: IFunctionStateLoaded; + + /** + * State loaded - data manipulation callback. Since: 1.10 + */ + stateLoadParams?: IFunctionStateLoadParams; + + /** + * Callback that defines how the table state is stored and where. Since: 1.10 + */ + stateSaveCallback?: IFunctionStateSaveCallback; + + /** + * State save - data manipulation callback. Since: 1.10 + */ + stateSaveParams?: IFunctionStateSaveParams; + + //#endregion "Callbacks" + + //#region "Language" + + language?: LanguageSettings; + + //#endregion "Language" + } + + //#region "ajax-settings" + + interface AjaxSettings extends JQueryAjaxSettings { + /** + * Add or modify data submitted to the server upon an Ajax request. Since: 1.10 + */ + data?: Object | IFunctionAjaxData; + + /** + * Data property or manipulation method for table data. Since: 1.10 + */ + dataSrc?: string | Function; + } + + interface IFunctionAjax { + (data: Object, callback: Function, settings: Settings): void; + } + + interface IFunctionAjaxData { + (data: Object): string | Object; + } + + //#endregion "ajax-settings" + + //#region "colunm-settings" + + export interface ColumnSettings { + /** + * Cell type to be created for a column. th/td Since: 1.10 + */ + cellType?: string; + + /** + * Class to assign to each cell in the column. Since: 1.10 + */ + className?: string; + + /** + * Add padding to the text content used when calculating the optimal with for a table. Since: 1.10 + */ + contentPadding?: string; + + /** + * Cell created callback to allow DOM manipulation. Since: 1.10 + */ + createdCell?: IFunctionColumnCreatedCell; + + /** + * Class to assign to each cell in the column. Since: 1.10 + */ + data?: number | string | IObjectColumnData | IFunctionColumnData; + + /** + * Set default, static, content for a column. Since: 1.10 + */ + defaultContent?: string; + + /** + * Set a descriptive name for a column. Since: 1.10 + */ + name?: string; + + /** + * Enable or disable ordering on this column. Since: 1.10 + */ + orderable?: boolean; + + /** + * Define multiple column ordering as the default order for a column. Since: 1.10 + */ + orderData?: number | number[]; + + /** + * Live DOM sorting type assignment. Since: 1.10 + */ + orderDataType?: string; + + /** + * Order direction application sequence. Since: 1.10 + */ + orderSequence?: string[]; + + /** + * Render (process) the data for use in the table. Since: 1.10 + */ + render?: number | string | IObjectColumnRender | IFunctionColumnRender; + + /** + * Enable or disable filtering on the data in this column. Since: 1.10 + */ + searchable?: boolean; + + /** + * Set the column title. Since: 1.10 + */ + title?: string; + + /** + * Set the column type - used for filtering and sorting string processing. Since: 1.10 + */ + type?: string; + + /** + * Enable or disable the display of this column. Since: 1.10 + */ + visible?: boolean; + + /** + * Column width assignment. Since: 1.10 + */ + width?: string; + } + + interface ColumnDefsSettings extends ColumnSettings { + targets: string | number | (number | string)[] + } + + interface IFunctionColumnCreatedCell { + (cell: Node, cellData: any, rowData: any, row: number, col: number): void; + } + + interface IFunctionColumnData { + (row: any, t: string, s: any, meta: Object): void; + } + + interface IObjectColumnData { + _: string; + filter?: string; + display?: string; + type?: string; + sort?: string; + } + + interface IObjectColumnRender extends IObjectColumnData { + } + + interface IFunctionColumnRender { + (data: Node, t: Node, row: Node, meta: Object): void; + } + + //#endregion "colunm-settings" + + //#region "other-settings" + + export interface RendererSettings { + header?: string; + pageButton?: string; + } + + export interface SearchSettings { + /** + * Control case-sensitive filtering option. Since: 1.10 + */ + caseInsensitive?: boolean; + + /** + * Enable / disable escaping of regular expression characters in the search term. Since: 1.10 + */ + regex?: boolean; + + /** + * Enable / disable DataTables' smart filtering. Since: 1.10 + */ + smart?: boolean; + + /** + * Set an initial filtering condition on the table. Since: 1.10 + */ + search?: string; + } + + //#endregion "other-settings" + + //#region "callback-functions" + + interface IFunctionCreateRow { + (row: Node, data: any[]| Object, dataIndex: number): void; + } + + interface IFunctionDrawCallback { + (settings: Settings): void; + } + + interface IFunctionFooterCallback { + (tfoot: Node, data: any[], start: number, end: number, display: any[]): void; + } + + interface IFunctionFormatNumber { + (formatNumber: number): void; + } + + interface IFunctionHeaderCallback { + (thead: Node, data: any[], start: number, end: number, display: any[]): void; + } + + interface IFunctionInfoCallback { + (settings: Settings, start: number, end: number, mnax: number, total: number, pre: string): void; + } + + interface IFunctionInitComplete { + (settings: Settings, json: Object): void; + } + + interface IFunctionPreDrawCallback { + (settings: Settings): void; + } + + interface IFunctionRowCallback { + (row: Node, data: any[]| Object): void; + } + + interface IFunctionStateLoadCallback { + (settings: Settings): void; + } + + interface IFunctionStateLoaded { + (settings: Settings, data: Object): void; + } + + interface IFunctionStateLoadParams { + (settings: Settings, data: Object): void; + } + + interface IFunctionStateSaveCallback { + (settings: Settings, data: Object): void; + } + + interface IFunctionStateSaveParams { + (settings: Settings, data: Object): void; + } + + //#endregion "callback-functions" + + //#region "language-settings" + + interface LanguageSettings { + emptyTable: string; + info: string; + infoEmpty: string; + infoFiltered: string; + infoPostFix: string; + thousands: string; + lengthMenu: string; + loadingRecords: string; + processing: string; + search: string; + zeroRecords: string; + paginate: LanguagePaginateSettings; + aria: LanguageAriaSettings; + } + + interface LanguagePaginateSettings { + first: string; + last: string; + next: string; + previous: string; + } + + interface LanguageAriaSettings { + sortAscending: string; + sortDescending: string; + } + + //#endregion "language-settings" + + //#endregion "Settings" +} \ No newline at end of file From 845b8e3ccb6969f4b7fc5a82d71d3d7a5620fa84 Mon Sep 17 00:00:00 2001 From: Kiarash Ghiaseddin Date: Wed, 18 Feb 2015 01:53:48 +0100 Subject: [PATCH 02/31] Add (legacy) Settings for internal api use # Add (legacy) Settings for internal api use # Remove I from naming # Update tests --- jquery.dataTables/jquery.dataTables-tests.ts | 127 ++++--- jquery.dataTables/jquery.dataTables.d.ts | 366 +++++++++++++++---- 2 files changed, 356 insertions(+), 137 deletions(-) diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts index d94d68864..256693ab0 100755 --- a/jquery.dataTables/jquery.dataTables-tests.ts +++ b/jquery.dataTables/jquery.dataTables-tests.ts @@ -1,8 +1,3 @@ -/// -/// - -// http://www.datatables.net/api - $(document).ready(function () { //#region "Language" @@ -34,28 +29,28 @@ $(document).ready(function () { //#region "Column" - var colCreatedCellFunc: DataTables.IFunctionColumnCreatedCell = function (cell, cellData, rowData, rowIndex, colIndex) { + var colCreatedCellFunc: DataTables.FunctionColumnCreatedCell = function (cell, cellData, rowData, rowIndex, colIndex) { } - var colDataObject: DataTables.IObjectColumnData = { + var colDataObject: DataTables.ObjectColumnData = { _: "phone", filter: "phone_filter", display: "phone_display", sort: "asc" }; - var colDataFunc: DataTables.IFunctionColumnData = function (row, type, set, meta) { + var colDataFunc: DataTables.FunctionColumnData = function (row, type, set, meta) { }; - var colRenderObject: DataTables.IObjectColumnRender = { + var colRenderObject: DataTables.ObjectColumnRender = { _: "phone", filter: "phone_filter", display: "phone_display", sort: "asc" }; - var colRenderFunc: DataTables.IFunctionColumnRender = function (data, type, row, meta) { + var colRenderFunc: DataTables.FunctionColumnRender = function (data, type, row, meta) { }; @@ -136,27 +131,27 @@ $(document).ready(function () { //#region "Callbacks" - var createRowFunc: DataTables.IFunctionCreateRow = function (row, data, dataIndex) { }; - var drawCallbackFunc: DataTables.IFunctionDrawCallback = function (settings) { }; - var footerCallbackFunc: DataTables.IFunctionFooterCallback = function (tfoot, data, start, end, display) { }; - var formatNumberFunc: DataTables.IFunctionFormatNumber = function (toForm) { }; - var headerCallbackFunc: DataTables.IFunctionHeaderCallback = function (thead, data, start, end, display) { }; - var infoCallbackFunc: DataTables.IFunctionInfoCallback = function (settings, start, end, total, pre) { }; - var initCallbackFunc: DataTables.IFunctionInitComplete = function (settings, json) { }; - var preDrawFunc: DataTables.IFunctionPreDrawCallback = function (settings) { }; - var rowCallbackFunc: DataTables.IFunctionRowCallback = function (row, data) { }; - var stateLoadCallbackFunc: DataTables.IFunctionStateLoadCallback = function (settings) { }; - var stateLoadedCallbackFunc: DataTables.IFunctionStateLoaded = function (settings, data) { }; - var stateSaveCallbackFunc: DataTables.IFunctionStateSaveCallback = function (settings, data) { }; - var stateSaveParamsFunc: DataTables.IFunctionStateSaveParams = function (settings, data) { }; + var createRowFunc: DataTables.FunctionCreateRow = function (row, data, dataIndex) { }; + var drawCallbackFunc: DataTables.FunctionDrawCallback = function (settings) { }; + var footerCallbackFunc: DataTables.FunctionFooterCallback = function (tfoot, data, start, end, display) { }; + var formatNumberFunc: DataTables.FunctionFormatNumber = function (toForm) { }; + var headerCallbackFunc: DataTables.FunctionHeaderCallback = function (thead, data, start, end, display) { }; + var infoCallbackFunc: DataTables.FunctionInfoCallback = function (settings, start, end, total, pre) { }; + var initCallbackFunc: DataTables.FunctionInitComplete = function (settings, json) { }; + var preDrawFunc: DataTables.FunctionPreDrawCallback = function (settings) { }; + var rowCallbackFunc: DataTables.FunctionRowCallback = function (row, data) { }; + var stateLoadCallbackFunc: DataTables.FunctionStateLoadCallback = function (settings) { }; + var stateLoadedCallbackFunc: DataTables.FunctionStateLoaded = function (settings, data) { }; + var stateSaveCallbackFunc: DataTables.FunctionStateSaveCallback = function (settings, data) { }; + var stateSaveParamsFunc: DataTables.FunctionStateSaveParams = function (settings, data) { }; //#endregion "Callbacks //#region "Ajax" - var ajaxFunc: DataTables.IFunctionAjax = function (data, callback, settings) { }; + var ajaxFunc: DataTables.FunctionAjax = function (data, callback, settings) { }; - var ajaxDataFunc: DataTables.IFunctionAjaxData = function (data) { + var ajaxDataFunc: DataTables.FunctionAjaxData = function (data) { return data; }; @@ -361,7 +356,7 @@ $(document).ready(function () { //#endregion "Methods-Core" - var modifier: DataTables.IObjectSelectorModifier = { + var modifier: DataTables.ObjectSelectorModifier = { order: "current", search: "none", page: "all", @@ -534,15 +529,15 @@ $(document).ready(function () { }); var columns_data = columns.data(); - //$('#listData').html( - // dt - // .columns(0) - // .data() - // .eq(0) // Reduce the 2D array into a 1D array of data - // .sort() // Sort data alphabetically - // .unique() // Reduce to unique values - // .join('
') - // ); + $('#listData').html( + dt + .columns(0) + .data() + .eq(0) // Reduce the 2D array into a 1D array of data + .sort() // Sort data alphabetically + .unique() // Reduce to unique values + .join('
') + ); //var idx = dt // .columns('.check') @@ -610,20 +605,20 @@ $(document).ready(function () { dt .column(0) .cache('search') - // .sort() - // .unique() - // .each(function (d) { - // select.append($('')); - //}); + .sort() + .unique() + .each(function (d) { + select.append($('')); + }); var column_data = column.data(); alert('Column 4 sum: ' + dt .column(4) .data() - //.reduce(function (a, b) { - //return a + b; - //}) + .reduce(function (a, b) { + return a + b; + }) ); var column_dataSrc = column.dataSrc(); @@ -633,7 +628,7 @@ $(document).ready(function () { }); var column_footer = column.footer(); - //var column_p = dt.column(0); + var column_p = dt.column(0); //$(column.footer()).html( // column_p // .data() @@ -677,29 +672,29 @@ $(document).ready(function () { .draw(); }); - //dt.columns('.select-filter').eq(0).each(function (colIdx) { - // // Create the select list and search operation - // var select = $('') + .appendTo( + dt.column(colIdx).footer() + ) + .on('change', function () { + dt + .column(colIdx) + .search($(this).val()) + .draw(); + }); - // // Get the search data for the first column and add to the select list - // dt - // .column(colIdx) - // .cache('search') - // .sort() - // .unique() - // .each(function (d) { - // select.append($('')); - // }); - //}); + // Get the search data for the first column and add to the select list + dt + .column(colIdx) + .cache('search') + .sort() + .unique() + .each(function (d) { + select.append($('')); + }); + }); var column_visible_get = column.visible(); var column_visible_set = column.visible(false); diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index 23087fbb7..7c01189f2 100755 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -12,10 +12,10 @@ interface JQuery { DataTable(param?: DataTables.Settings): DataTables.DataTable; } -interface JQueryStatic { - //TODO: Wrong, as jquery.d.ts has no interface for fn - dataTable: DataTables.StaticFunctions; -} +//TODO: Wrong, as jquery.d.ts has no interface for fn +//interface JQueryStatic { +// dataTable: DataTables.StaticFunctions; +//} declare module DataTables { export interface DataTable extends DataTableCore { @@ -37,7 +37,7 @@ declare module DataTables { * @param cellSelector Cell selector. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - cell(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellMethods; + cell(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods; /** * Select the cell found by a cell selector @@ -46,14 +46,14 @@ declare module DataTables { * @param cellSelector Cell selector. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - cell(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellMethods; + cell(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods; /** * Select all cells * * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - cells(modifier?: IObjectSelectorModifier): CellsMethods; + cells(modifier?: ObjectSelectorModifier): CellsMethods; /** * Select cells found by a cell selector @@ -61,7 +61,7 @@ declare module DataTables { * @param cellSelector Cell selector. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - cells(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellsMethods; + cells(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods; /** * Select cells found by both row and column selectors @@ -70,7 +70,7 @@ declare module DataTables { * @param cellSelector Cell selector. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - cells(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: IObjectSelectorModifier): CellsMethods; + cells(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods; //#endregion "Cell/Cells" //#region "Column/Columns" @@ -129,7 +129,7 @@ declare module DataTables { [index: number]: DataTable; } - interface IObjectSelectorModifier { + interface ObjectSelectorModifier { /** * The order modifier provides the ability to control which order the rows are processed in. * Values: 'current', 'applied', 'index', 'original' @@ -157,10 +157,10 @@ declare module DataTables { /** * Get jquery object */ - $(selector: string | Node | Node[]| JQuery, modifier?: IObjectSelectorModifier): JQuery; + $(selector: string | Node | Node[]| JQuery, modifier?: ObjectSelectorModifier): JQuery; ///// Almost identical to $ in operation, but in this case returns the data for the matched rows. - //_(selector: string | Node | Node[] | JQuery, modifier?: IObjectSelectorModifier): JQuery; + //_(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery; /** * Ajax Methods @@ -390,7 +390,12 @@ declare module DataTables { length: number; order: (string | number)[][]; search: SearchSettings; - columns: Array; + columns: StateReturnModelColumns[]; + } + + interface StateReturnModelColumns { + search: SearchSettings; + visible: boolean; } //#endregion "state-methods" @@ -674,7 +679,7 @@ declare module DataTables { * @param cellSelector Cell selector. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - (columnSelector: any, modifier?: IObjectSelectorModifier): ColumnMethods; + (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnMethods; /** * Convert from the input column index type to that required. @@ -689,7 +694,7 @@ declare module DataTables { /** * Get the data for the cells in the selected column. */ - data(): DataTable[]; + data(): DataTable; /** * Get the data source property for the selected column @@ -715,7 +720,7 @@ declare module DataTables { * * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - (modifier?: IObjectSelectorModifier): ColumnsMethods; + (modifier?: ObjectSelectorModifier): ColumnsMethods; /** * Select columns found by a cell selector @@ -723,7 +728,7 @@ declare module DataTables { * @param cellSelector Cell selector. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - (columnSelector: any, modifier?: IObjectSelectorModifier): ColumnsMethods; + (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnsMethods; /** * Recalculate the column widths for layout. @@ -735,7 +740,7 @@ declare module DataTables { /** * Obtain the data for the columns from the selector */ - data(): DataTable[][]; + data(): DataTable; /** * Get the data source property for the selected columns. @@ -833,7 +838,7 @@ declare module DataTables { * @param rowSelector Row selector. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - (rowSelector: any, modifier?: IObjectSelectorModifier): RowMethods; + (rowSelector: any, modifier?: ObjectSelectorModifier): RowMethods; /** * Add a new row to the table using the given data @@ -883,7 +888,7 @@ declare module DataTables { * * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - (modifier?: IObjectSelectorModifier): RowsMethods; + (modifier?: ObjectSelectorModifier): RowsMethods; /** * Select rows found by a row selector @@ -891,7 +896,7 @@ declare module DataTables { * @param cellSelector Row selector. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. */ - (rowSelector: any, modifier?: IObjectSelectorModifier): RowsMethods; + (rowSelector: any, modifier?: ObjectSelectorModifier): RowsMethods; /** * Add new rows to the table using the data given @@ -1124,7 +1129,7 @@ declare module DataTables { /** * Load data for the table's content from an Ajax source. Since: 1.10 */ - ajax?: string | AjaxSettings | IFunctionAjax; + ajax?: string | AjaxSettings | FunctionAjax; /** * Data to use as the display data for the table. Since: 1.10 @@ -1257,72 +1262,72 @@ declare module DataTables { /** * Callback for whenever a TR element is created for the table's body. Since: 1.10 */ - createdRow?: IFunctionCreateRow; + createdRow?: FunctionCreateRow; /** * Function that is called every time DataTables performs a draw. Since: 1.10 */ - drawCallback?: IFunctionDrawCallback; + drawCallback?: FunctionDrawCallback; /** * Footer display callback function. Since: 1.10 */ - footerCallback?: IFunctionFooterCallback; + footerCallback?: FunctionFooterCallback; /** * Number formatting callback function. Since: 1.10 */ - formatNumber?: IFunctionFormatNumber; + formatNumber?: FunctionFormatNumber; /** * Header display callback function. Since: 1.10 */ - headerCallback?: IFunctionHeaderCallback; + headerCallback?: FunctionHeaderCallback; /** * Table summary information display callback. Since: 1.10 */ - infoCallback?: IFunctionInfoCallback; + infoCallback?: FunctionInfoCallback; /** * Initialisation complete callback. Since: 1.10 */ - initComplete?: IFunctionInitComplete; + initComplete?: FunctionInitComplete; /** * Pre-draw callback. Since: 1.10 */ - preDrawCallback?: IFunctionPreDrawCallback; + preDrawCallback?: FunctionPreDrawCallback; /** * Row draw callback.. Since: 1.10 */ - rowCallback?: IFunctionRowCallback; + rowCallback?: FunctionRowCallback; /** * Callback that defines where and how a saved state should be loaded. Since: 1.10 */ - stateLoadCallback?: IFunctionStateLoadCallback; + stateLoadCallback?: FunctionStateLoadCallback; /** * State loaded callback. Since: 1.10 */ - stateLoaded?: IFunctionStateLoaded; + stateLoaded?: FunctionStateLoaded; /** * State loaded - data manipulation callback. Since: 1.10 */ - stateLoadParams?: IFunctionStateLoadParams; + stateLoadParams?: FunctionStateLoadParams; /** * Callback that defines how the table state is stored and where. Since: 1.10 */ - stateSaveCallback?: IFunctionStateSaveCallback; + stateSaveCallback?: FunctionStateSaveCallback; /** * State save - data manipulation callback. Since: 1.10 */ - stateSaveParams?: IFunctionStateSaveParams; + stateSaveParams?: FunctionStateSaveParams; //#endregion "Callbacks" @@ -1335,11 +1340,47 @@ declare module DataTables { //#region "ajax-settings" + export interface AjaxDataRequest { + draw: number; + start: number; + length: number; + data: any; + order: AjaxDataRequestOrder[]; + columns: AjaxDataRequestColumn[]; + search: AjaxDataRequestSearch; + } + + export interface AjaxDataRequestSearch { + value: string; + regex: boolean; + } + + export interface AjaxDataRequestOrder { + column: number; + dir: string; + } + + export interface AjaxDataRequestColumn { + data: string | number; + name: string; + searchable: boolean; + orderable: boolean; + search: AjaxDataRequestSearch; + } + + export interface AjaxData { + draw: number; + recordsTotal: number; + recordsFiltered: number; + data: any; + error?: string; + } + interface AjaxSettings extends JQueryAjaxSettings { /** * Add or modify data submitted to the server upon an Ajax request. Since: 1.10 */ - data?: Object | IFunctionAjaxData; + data?: Object | FunctionAjaxData; /** * Data property or manipulation method for table data. Since: 1.10 @@ -1347,11 +1388,11 @@ declare module DataTables { dataSrc?: string | Function; } - interface IFunctionAjax { - (data: Object, callback: Function, settings: Settings): void; + interface FunctionAjax { + (data: Object, callback: Function, settings: SettingsLegacy): void; } - interface IFunctionAjaxData { + interface FunctionAjaxData { (data: Object): string | Object; } @@ -1378,12 +1419,12 @@ declare module DataTables { /** * Cell created callback to allow DOM manipulation. Since: 1.10 */ - createdCell?: IFunctionColumnCreatedCell; + createdCell?: FunctionColumnCreatedCell; /** * Class to assign to each cell in the column. Since: 1.10 */ - data?: number | string | IObjectColumnData | IFunctionColumnData; + data?: number | string | ObjectColumnData | FunctionColumnData; /** * Set default, static, content for a column. Since: 1.10 @@ -1418,7 +1459,7 @@ declare module DataTables { /** * Render (process) the data for use in the table. Since: 1.10 */ - render?: number | string | IObjectColumnRender | IFunctionColumnRender; + render?: number | string | ObjectColumnRender | FunctionColumnRender; /** * Enable or disable filtering on the data in this column. Since: 1.10 @@ -1450,15 +1491,15 @@ declare module DataTables { targets: string | number | (number | string)[] } - interface IFunctionColumnCreatedCell { + interface FunctionColumnCreatedCell { (cell: Node, cellData: any, rowData: any, row: number, col: number): void; } - interface IFunctionColumnData { + interface FunctionColumnData { (row: any, t: string, s: any, meta: Object): void; } - interface IObjectColumnData { + interface ObjectColumnData { _: string; filter?: string; display?: string; @@ -1466,10 +1507,10 @@ declare module DataTables { sort?: string; } - interface IObjectColumnRender extends IObjectColumnData { + interface ObjectColumnRender extends ObjectColumnData { } - interface IFunctionColumnRender { + interface FunctionColumnRender { (data: Node, t: Node, row: Node, meta: Object): void; } @@ -1508,60 +1549,60 @@ declare module DataTables { //#region "callback-functions" - interface IFunctionCreateRow { + interface FunctionCreateRow { (row: Node, data: any[]| Object, dataIndex: number): void; } - interface IFunctionDrawCallback { - (settings: Settings): void; + interface FunctionDrawCallback { + (settings: SettingsLegacy): void; } - interface IFunctionFooterCallback { + interface FunctionFooterCallback { (tfoot: Node, data: any[], start: number, end: number, display: any[]): void; } - interface IFunctionFormatNumber { + interface FunctionFormatNumber { (formatNumber: number): void; } - interface IFunctionHeaderCallback { + interface FunctionHeaderCallback { (thead: Node, data: any[], start: number, end: number, display: any[]): void; } - interface IFunctionInfoCallback { - (settings: Settings, start: number, end: number, mnax: number, total: number, pre: string): void; + interface FunctionInfoCallback { + (settings: SettingsLegacy, start: number, end: number, mnax: number, total: number, pre: string): void; } - interface IFunctionInitComplete { - (settings: Settings, json: Object): void; + interface FunctionInitComplete { + (settings: SettingsLegacy, json: Object): void; } - interface IFunctionPreDrawCallback { - (settings: Settings): void; + interface FunctionPreDrawCallback { + (settings: SettingsLegacy): void; } - interface IFunctionRowCallback { + interface FunctionRowCallback { (row: Node, data: any[]| Object): void; } - interface IFunctionStateLoadCallback { - (settings: Settings): void; + interface FunctionStateLoadCallback { + (settings: SettingsLegacy): void; } - interface IFunctionStateLoaded { - (settings: Settings, data: Object): void; + interface FunctionStateLoaded { + (settings: SettingsLegacy, data: Object): void; } - interface IFunctionStateLoadParams { - (settings: Settings, data: Object): void; + interface FunctionStateLoadParams { + (settings: SettingsLegacy, data: Object): void; } - interface IFunctionStateSaveCallback { - (settings: Settings, data: Object): void; + interface FunctionStateSaveCallback { + (settings: SettingsLegacy, data: Object): void; } - interface IFunctionStateSaveParams { - (settings: Settings, data: Object): void; + interface FunctionStateSaveParams { + (settings: SettingsLegacy, data: Object): void; } //#endregion "callback-functions" @@ -1599,4 +1640,187 @@ declare module DataTables { //#endregion "language-settings" //#endregion "Settings" + + //#region "SettingsLegacy" + + interface ArrayStringNode { + [index: string]: Node; + } + + export interface SettingsLegacy { + oApi: any; + oFeatures: FeaturesLegacy; + oScroll: ScrollingLegacy; + oLanguage: LanguageLegacy; // | { fnInfoCallback: FunctionInfoCallback; }; + oBrowser: { bScrollOversize: boolean; }; + aanFeatures: ArrayStringNode[][]; + aoData: RowLegacy[]; + aiDisplay: number[]; + //bServerSide: boolean; + aiDisplayMaster: number[]; + aoColumns: ColumnLegacy[]; + aoHeader: any[]; + aoFooter: any[]; + asDataSearch: string[]; + oPreviousSearch: any; + aoPreSearchCols: any[]; + aaSorting: any[][]; + aaSortingFixed: any[][]; + asStripeClasses: string[]; + asDestroyStripes: string[]; + sDestroyWidth: number; + aoRowCallback: FunctionRowCallback[]; + aoHeaderCallback: FunctionHeaderCallback[]; + aoFooterCallback: FunctionFooterCallback[]; + aoDrawCallback: FunctionDrawCallback[]; + aoRowCreatedCallback: FunctionCreateRow[]; + aoPreDrawCallback: FunctionPreDrawCallback[]; + aoInitComplete: FunctionInitComplete[]; + aoStateSaveParams: FunctionStateSaveParams[]; + aoStateLoadParams: FunctionStateLoadParams[]; + aoStateLoaded: FunctionStateLoaded[]; + sTableId: string; + nTable: Node; + nTHead: Node; + nTFoot: Node; + nTBody: Node; + nTableWrapper: Node; + bDeferLoading: boolean; + bInitialized: boolean; + aoOpenRows: any[]; + sDom: string; + sPaginationType: string; + iCookieDuration: number; + sCookiePrefix: string; + fnCookieCallback: CookieCallbackLegacy; + aoStateSave: FunctionStateSaveCallback[]; + aoStateLoad: FunctionStateLoadCallback[]; + oLoadedState: any; + sAjaxSource: string; + sAjaxDataProp: string; + bAjaxDataGet: boolean; + jqXHR: any; + fnServerData: any; + aoServerParams: any[]; + sServerMethod: string; + fnFormatNumber: FunctionFormatNumber; + aLengthMenu: any[]; + iDraw: number; + bDrawing: boolean; + iDrawError: number; + _iDisplayLength: number; + _iDisplayStart: number; + _iDisplayEnd: number; + _iRecordsTotal: number; + _iRecordsDisplay: number; + bJUI: boolean; + oClasses: any; + bFiltered: boolean; + bSorted: boolean; + bSortCellsTop: boolean; + oInit: any; + aoDestroyCallback: any[]; + fnRecordsTotal: () => number; + fnRecordsDisplay: () => number; + fnDisplayEnd: () => number; + oInstance: any; + sInstance: string; + iTabIndex: number; + nScrollHead: Node; + nScrollFoot: Node; + } + + export interface FeaturesLegacy { + bAutoWidth: boolean; + bDeferRender: boolean; + bFilter: boolean; + bInfo: boolean; + bLengthChange: boolean; + bPaginate: boolean; + bProcessing: boolean; + bServerSide: boolean; + bSort: boolean; + bSortClasses: boolean; + bStateSave: boolean; + } + + export interface ScrollingLegacy { + bAutoCss: boolean; + bCollapse: boolean; + bInfinite: boolean; + iBarWidth: number; + iLoadGap: number; + sX: string; + sY: string; + } + + export interface RowLegacy { + nTr: Node; + _aData: any; + _aSortData: any[]; + _anHidden: Node[]; + _sRowStripe: string; + } + + export interface ColumnLegacy { + aDataSort: any; + asSorting: string[]; + bSearchable: boolean; + bSortable: boolean; + bVisible: boolean; + _bAutoType: boolean; + fnCreatedCell: FunctionColumnCreatedCell; + fnGetData: (data: any, specific: string) => any; + fnSetData: (data: any, value: any) => void; + mData: any; + mRender: any; + nTh: Node; + nIf: Node; + sClass: string; + sContentPadding: string; + sDefaultContent: string; + sName: string; + sSortDataType: string; + sSortingClass: string; + sSortingClassJUI: string; + sTitle: string; + sType: string; + sWidth: string; + sWidthOrig: string; + } + + export interface CookieCallbackLegacy { + (name: string, data: any, expires: string, path: string, cookie: string): void; + } + + export interface LanguageLegacy { + oAria?: LanguageAriaLegacy; + oPaginate?: LanguagePaginateLegacy; + sEmptyTable?: string; + sInfo?: string; + sInfoEmpty?: string; + sInfoFiltered?: string; + sInfoPostFix?: string; + sInfoThousands?: string; + sLengthMenu?: string; + sLoadingRecords?: string; + sProcessing?: string; + sSearch?: string; + sUrl?: string; + sZeroRecords?: string; + } + + export interface LanguageAriaLegacy { + sSortAscending?: string; + sSortDescending?: string; + } + + export interface LanguagePaginateLegacy { + sFirst?: string; + sLast?: string; + sNext?: string; + sPrevious?: string; + } + //#endregion "SettingsLegacy" + } \ No newline at end of file From 8fa411866ade00a2649c0c694bc609684dd58ab2 Mon Sep 17 00:00:00 2001 From: Kiarash Ghiaseddin Date: Wed, 18 Feb 2015 12:42:18 +0100 Subject: [PATCH 03/31] Add reference paths --- jquery.dataTables/jquery.dataTables-tests.ts | 3 +++ jquery.dataTables/jquery.dataTables.d.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts index 256693ab0..c90b40d09 100755 --- a/jquery.dataTables/jquery.dataTables-tests.ts +++ b/jquery.dataTables/jquery.dataTables-tests.ts @@ -1,3 +1,6 @@ +/// +/// + $(document).ready(function () { //#region "Language" diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index 7c01189f2..8d94c2e2a 100755 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -8,6 +8,9 @@ // - Plugin and extension definitions are not typed. // - Some return types are not fully wokring + +/// + interface JQuery { DataTable(param?: DataTables.Settings): DataTables.DataTable; } From 9e571910b494d495625abfa9430c93173c592086 Mon Sep 17 00:00:00 2001 From: Kiarash Ghiaseddin Date: Wed, 25 Mar 2015 16:56:15 +0100 Subject: [PATCH 04/31] Add 'old' api Settings, new namespace is SettingsLegacy # Add 'old' api Settings, new namespace is SettingsLegacy # Fix header --- jquery.dataTables/jquery.dataTables.d.ts | 3653 +++++++++++----------- 1 file changed, 1825 insertions(+), 1828 deletions(-) diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index 8d94c2e2a..afeb01f0f 100755 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -1,1829 +1,1826 @@ -// Type definitions for JQuery DataTables 1.10.5 -// Project: http://www.datatables.net -// Definitions by: Kiarash Ghiaseddin -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -// missing: -// - Static methods that are defined in JQueryStatic.fn are not typed. -// - Plugin and extension definitions are not typed. -// - Some return types are not fully wokring - - -/// - -interface JQuery { - DataTable(param?: DataTables.Settings): DataTables.DataTable; -} - -//TODO: Wrong, as jquery.d.ts has no interface for fn -//interface JQueryStatic { -// dataTable: DataTables.StaticFunctions; -//} - -declare module DataTables { - export interface DataTable extends DataTableCore { - /** - * Get the data for the whole table. - */ - data(): DataTable; - - /** - * Order Methods / Object - */ - order: OrderMethods; - - //#region "Cell/Cells" - - /** - * Select the cell found by a cell selector - * - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cell(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods; - - /** - * Select the cell found by a cell selector - * - * @param rowSelector Row selector. - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cell(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods; - - /** - * Select all cells - * - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cells(modifier?: ObjectSelectorModifier): CellsMethods; - - /** - * Select cells found by a cell selector - * - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cells(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods; - - /** - * Select cells found by both row and column selectors - * - * @param rowSelector Row selector. - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cells(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods; - //#endregion "Cell/Cells" - - //#region "Column/Columns" - - /** - * Column Methods / Object - */ - column: ColumnMethodsModel; - - /** - * Columns Methods / Object - */ - columns: ColumnsMethodsModel; - - //#endregion "Column/Columns" - - //#region "Row/Rows" - - /** - * Row Methode / Object - */ - row: RowMethodsModel - - /** - * Rows Methods / Object - */ - rows: RowsMethodsModel - - //#endregion "Row/Rows" - - //#region "Table/Tables" - - /** - * Select a table based on a selector from the API's context - * - * @param tableSelector Table selector. - */ - table(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TableMethods; - - /** - * Select all tables - */ - tables(): TablesMethods; - - /** - * Select tables based on the given selector - * - * @param tableSelector Table selector. - */ - tables(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TablesMethods; - - //#endregion "Table/Tables" - } - - export interface DataTables extends DataTableCore { - [index: number]: DataTable; - } - - interface ObjectSelectorModifier { - /** - * The order modifier provides the ability to control which order the rows are processed in. - * Values: 'current', 'applied', 'index', 'original' - */ - order?: string; - - /** - * The search modifier provides the ability to govern which rows are used by the selector using the search options that are applied to the table. - * Values: 'none', 'applied', 'removed' - */ - search?: string; - - /** - * The page modifier allows you to control if the selector should consider all data in the table, regardless of paging, or if only the rows in the currently disabled page should be used. - * Values: 'all', 'current' - */ - page?: string; - } - - //#region "Namespaces" - - //#region "core-methods" - - interface DataTableCore extends UtilityMethods { - /** - * Get jquery object - */ - $(selector: string | Node | Node[]| JQuery, modifier?: ObjectSelectorModifier): JQuery; - - ///// Almost identical to $ in operation, but in this case returns the data for the matched rows. - //_(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery; - - /** - * Ajax Methods - */ - ajax: AjaxMethodModel; - - /** - * Clear the table of all data. - */ - clear(): DataTable; - - /** - * Destroy the DataTables in the current context. - * - * @param remove Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false). - */ - destroy(remove?: boolean): DataTable; - - /** - * Destroy the DataTables in the current context. - * - * @param reset Reset (default) or hold the current paging position. A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action. - */ - draw(reset?: boolean): DataTable; - - /** - * Table events removal. - * - * @param event Event name to remove. - * @param callback Specific callback function to remove if you want to unbind a single event listener. - */ - off(event: string, callback?: Function): DataTable; - - /** - * Table events listener. - * - * @param event Event to listen for. - * @param callback Specific callback function to remove if you want to unbind a single event listener. - */ - on(event: string, callback: Function): DataTable; - - /** - * Listen for a table event once and then remove the listener. - * - * @param event Event to listen for. - * @param callback Specific callback function to remove if you want to unbind a single event listener. - */ - one(event: string, callback: Function): DataTable; - - /** - * Page Methods / Object - */ - page: PageMethods; - - /** - * Get current search - */ - search(): string; - - /** - * Search for data in the table. - * - * @param input Search string to apply to the table. - * @param regex Treat as a regular expression (true) or not (default, false). - * @param smart Perform smart search. - * @param caseInsen Do case-insensitive matching (default, true) or not (false). - */ - search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): DataTable; - - /** - * Obtain the table's settings object - */ - settings(): DataTable; - - /** - * Page Methods / Object - */ - state: StateMethods; - } - - //#region "ajax-methods" - - interface AjaxMethods extends DataTable { - /** - * Reload the table data from the Ajax data source. - * - * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. - * @param resetPaging Reset (default action or true) or hold the current paging position (false). - */ - load(callback?: Function, resetPaging?: boolean): DataTable; - } - - interface AjaxMethodModel { - /** - * Get the latest JSON data obtained from the last Ajax request DataTables made - */ - json(): Object; - - /** - * Get the data submitted by DataTables to the server in the last Ajax request - */ - params(): Object; - - /** - * Reload the table data from the Ajax data source. - * - * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. - * @param resetPaging Reset (default action or true) or hold the current paging position (false). - */ - reload(callback?: Function, resetPaging?: boolean): DataTable; - - /** - * Reload the table data from the Ajax data source - */ - url(): string; - - /** - * Reload the table data from the Ajax data source - * - * @param url URL to set to be the Ajax data source for the table. - */ - url(url: string): AjaxMethods; - } - - //#endregion "ajax-methods" - - //#region "order-methods" - - interface OrderMethods { - /** - * Get the ordering applied to the table. - */ - (): (string | number)[][]; - - /** - * Set the ordering applied to the table. - * - * @param order Order Model - */ - (order?: (string | number)[]): DataTable; - (order?: (string | number)[][]): DataTable; - (order: (string | number)[], ...args: any[]): DataTable; - - /** - * Add an ordering listener to an element, for a given column. - * - * @param node Selector - * @param column Column index - * @param callback Callback function - */ - listener(node: string | Node | JQuery, column: number, callback: Function): DataTable; - } - //#endregion "order-methods" - - //#region "page-methods" - - interface PageMethods { - /** - * Get the current page of the table. - */ - (): number; - - /** - * Set the current page of the table. - * - * @param page Index or 'first', 'next', 'previous', 'last' - */ - (page: number | string): DataTable; - - /** - * Get paging information about the table - */ - info(): PageMethodeModelInfoReturn; - - /** - * Get the table's page length. - */ - len(): number; - - /** - * Set the table's page length. - * - * @param length Page length to set. use -1 to show all records. - */ - len(length: number): DataTable; - } - - interface PageMethodeModelInfoReturn { - page: number; - pages: number; - start: number; - end: number; - length: number; - recordsTotal: number; - recordsDisplay: number; - } - - //#endregion "page-methods" - - //#region "state-methods" - - interface StateMethods { - /** - * Get the last saved state of the table - */ - (): StateReturnModel; - - /** - * Clear the saved state of the table. - */ - clear(): DataTable; - - /** - * Get the table state that was loaded during initialisation. - */ - loaded(): StateReturnModel; - - /** - * Trigger a state save. - */ - save(): DataTable; - } - - interface StateReturnModel { - time: number; - start: number; - length: number; - order: (string | number)[][]; - search: SearchSettings; - columns: StateReturnModelColumns[]; - } - - interface StateReturnModelColumns { - search: SearchSettings; - visible: boolean; - } - - //#endregion "state-methods" - - //#endregion "core-methods" - - //#region "util-methods" - - interface UtilityMethods { - /** - * Concatenate two or more API instances together - * - * @param a API instance to concatenate to the initial instance. - * @param b Additional API instance(s) to concatenate to the initial instance. - */ - concat(a: Object, ...b: Object[]): DataTable; - - /** - * Iterate over the contents of the API result set. - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters - */ - each(fn: Function): DataTable; - - /** - * Reduce an Api instance to a single context and result set. - * - * @param idx Index to select - */ - eq(idx: number): DataTable; - - /** - * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass. - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. - */ - filter(fn: Function): DataTable; - - /** - * Flatten a 2D array structured API instance to a 1D array structure. - */ - flatten(): DataTable; - - /** - * Find the first instance of a value in the API instance's result set. - * - * @param value Value to find in the instance's result set. - */ - indexOf(value: any): number; - - /** - * Join the elements in the result set into a string. - * - * @param separator The string that will be used to separate each element of the result set. - */ - join(separator: string): string; - - /** - * Find the last instance of a value in the API instance's result set. - * - * @param value Value to find in the instance's result set. - */ - lastIndexOf(value: any): number; - - /** - * Number of elements in an API instance's result set. - */ - length: number; - - /** - * Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback. - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. - */ - map(fn: Function): DataTable; - - /** - * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements. - * - * @param property Object property name to use from the element in the original result set for the new result set. - */ - pluck(property: number | string): DataTable; - - /** - * Remove the last item from an API instance's result set. - */ - pop(): any; - - /** - * Add one or more items to the end of an API instance's result set. - * - * @param value_1 Item to add to the API instance's result set. - */ - push(value_1: any | any[], ...value_2: any[]): number; - - /** - * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right). - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. - * @param initialValue Value to use as the first argument of the first call to the fn callback. - */ - reduce(fn: Function, initialValue?: any): any; - - /** - * Apply a callback function against and accumulator and each element in the Api's result set (right-to-left). - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. - * @param initialValue Value to use as the first argument of the first call to the fn callback. - */ - reduceRight(fn: Function, initialValue?: any): any; - - /** - * Reverse the result set of the API instance and return the original array. - */ - reverse(): DataTable; - - /** - * Remove the first item from an API instance's result set. - */ - shift(): any; - - /** - * Sort the elements of the API instance's result set. - * - * @param fn This is a standard Javascript sort comparison function. It accepts two parameters. - */ - sort(fn?: Function): DataTable; - - /** - * Modify the contents of an Api instance's result set, adding or removing items from it as required. - * - * @param index Index at which to start modifying the Api instance's result set. - * @param howMany Number of elements to remove from the result set. - * @param value_1 Item to add to the result set at the index specified by the first parameter. - */ - splice(index: number, howMany: number, value_1?: any | any[], ...value_2: any[]): any[]; - - /** - * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. - */ - to$(): JQuery; - - /** - * Create a native Javascript array object from an API instance. - */ - toArray(): any[]; - - /** - * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. - */ - toJQuery(): JQuery; - - /** - * Create a new API instance containing only the unique items from a the elements in an instance's result set. - */ - unique(): DataTable; - - /** - * Add one or more items to the start of an API instance's result set. - * - * @param value_1 Item to add to the API instance's result set. - */ - unshift(value_1: any | any[], ...value_2: any[]): number; - } - - //#endregion "util-methods" - - interface CommonSubMethods { - /** - * Get the DataTables cached data for the selected cell - * - * @param t Specify which cache the data should be read from. Can take one of two values: search or order - */ - cache(t: string): DataTable; - } - - //#region "cell-methods" - - interface CommonCellMethods extends CommonSubMethods { - /** - * Invalidate the data held in DataTables for the selected cells - * - * @param source Data source to read the new data from. - */ - invalidate(source?: string): DataTable; - - /** - * Get data for the selected cell - * - * @param f Data type to get. This can be one of: 'display', 'filter', 'sort', 'type' - */ - render(t: string): any; - } - - interface CellMethods extends DataTableCore, CommonCellMethods { - /** - * Get data for the selected cell - */ - data(): any; - - /** - * Get data for the selected cell - * - * @param data Value to assign to the data for the cell - */ - data(data: any): DataTable; - - /** - * Get index information about the selected cell - */ - index(): CellIndexReturn; - - /** - * Get the DOM element for the selected cell - */ - node(): Node; - } - - interface CellIndexReturn { - row: number; - column: number; - columnVisible: number; - } - - interface CellsMethods extends DataTableCore, CommonCellMethods { - /** - * Get data for the selected cells - */ - data(): DataTable; - - /** - * Get index information about the selected cells - */ - indexes(): DataTable; - - /** - * Get the DOM elements for the selected cells - */ - nodes(): DataTable; - } - //#endregion "cell-methods" - - //#region "column-methods" - - interface CommonColumnMethod extends CommonSubMethods { - /** - * Get the footer th / td cell for the selected column. - */ - footer(): any; - - /** - * Get the header th / td cell for a column. - */ - header(): Node; - - /** - * Order the table, in the direction specified, by the column selected by the column()DT selector. - * - * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending). - */ - order(direction: string): DataTable; - - /** - * Get the visibility of the selected column. - */ - visible(): boolean; - - /** - * Set the visibility of the selected column. - * - * @param show Specify if the column should be visible (true) or not (false). - * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance. - */ - visible(show: boolean, redrawCalculations?: boolean): DataTable; - } - - interface ColumnMethodsModel { - /** - * Select the column found by a column selector - * - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnMethods; - - /** - * Convert from the input column index type to that required. - * - * @param t The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible' - * @param index The index to be converted - */ - index(t: string, index: number): number; - } - - interface ColumnMethods extends DataTableCore, CommonColumnMethod { - /** - * Get the data for the cells in the selected column. - */ - data(): DataTable; - - /** - * Get the data source property for the selected column - */ - dataSrc(): number | string | Function; - - /** - * Get index information about the selected cell - * - * @param t Specify if you want to get the column data index (default) or the visible index (visible). - */ - index(t?: string): DataTable; - - /** - * Obtain the th / td nodes for the selected column - */ - nodes(): DataTable[]; - } - - interface ColumnsMethodsModel { - /** - * Select all columns - * - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - (modifier?: ObjectSelectorModifier): ColumnsMethods; - - /** - * Select columns found by a cell selector - * - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnsMethods; - - /** - * Recalculate the column widths for layout. - */ - adjust(): DataTable; - } - - interface ColumnsMethods extends DataTableCore, CommonColumnMethod { - /** - * Obtain the data for the columns from the selector - */ - data(): DataTable; - - /** - * Get the data source property for the selected columns. - */ - dataSrc(): DataTable; - - /** - * Get the column indexes of the selected columns. - * - * @param t Specify if you want to get the column data index (default) or the visible index (visible). - */ - indexes(t?: string): DataTable; - - /** - * Obtain the th / td nodes for the selected columns - */ - nodes(): DataTable[][]; - } - //#endregion "column-methods" - - //#region "row-methods" - - interface CommonRowMethod extends CommonSubMethods { - /** - * Obtain the th / td nodes for the selected column - * - * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom' - */ - invalidate(source?: string): DataTable; - } - - interface RowChildMethodModel { - /** - * Get the child row(s) that have been set for a parent row - */ - (): JQuery; - - /** - * Get the child row(s) that have been set for a parent row - * - * @param showRemove This parameter can be given as true or false - */ - (showRemove: boolean): RowChildMethods; - - /** - * Set the data to show in the child row(s). Note that calling this method will replace any child rows which are already attached to the parent row. - * - * @param data The data to be shown in the child row can be given in multiple different ways. - * @param className Class name that is added to the td cell node(s) of the child row(s). As of 1.10.1 it is also added to the tr row node of the child row(s). - */ - (data: (string | Node | JQuery) | (string | Node | JQuery)[], className?: string): RowChildMethods; - - /** - * Hide the child row(s) of a parent row - */ - hide(): DataTable; - - /** - * Check if the child rows of a parent row are visible - */ - isShown(): DataTable; - - /** - * Remove child row(s) from display and release any allocated memory - */ - remove(): DataTable; - - /** - * Show the child row(s) of a parent row - */ - show(): DataTable; - } - - interface RowChildMethods extends DataTableCore { - /** - * Hide the child row(s) of a parent row - */ - hide(): DataTable; - - /** - * Remove child row(s) from display and release any allocated memory - */ - remove(): DataTable; - - /** - * Make newly defined child rows visible - */ - show(): DataTable; - } - - interface RowMethodsModel { - /** - * Select a row found by a row selector - * - * @param rowSelector Row selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - (rowSelector: any, modifier?: ObjectSelectorModifier): RowMethods; - - /** - * Add a new row to the table using the given data - * - * @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table - */ - add(data: any[]| Object): DataTable; - } - - interface RowMethods extends DataTableCore, CommonRowMethod { - /** - * Order Methods / Object - */ - child: RowChildMethodModel; - - /** - * Get the data for the selected row - */ - data(): any[]| Object; - - /** - * Set the data for the selected row - * - * @param d Data to use for the row. - */ - data(d: any[]| Object): DataTable; - - /** - * Get the row index of the row column. - */ - index(): number; - - /** - * Obtain the tr node for the selected row - */ - node(): Node; - - /** - * Delete the selected row from the DataTable. - */ - remove(): Node; - } - - interface RowsMethodsModel { - /** - * Select all rows - * - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - (modifier?: ObjectSelectorModifier): RowsMethods; - - /** - * Select rows found by a row selector - * - * @param cellSelector Row selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - (rowSelector: any, modifier?: ObjectSelectorModifier): RowsMethods; - - /** - * Add new rows to the table using the data given - * - * @param data Array of data elements, with each one describing a new row to be added to the table - */ - add(data: any[]): DataTable; - } - - interface RowsMethods extends DataTableCore, CommonRowMethod { - /** - * Get the data for the rows from the selector - */ - data(): DataTable; - - /** - * Set the data for the selected row - * - * @param d Data to use for the row. - */ - data(d: any[]| Object): DataTable; - - /** - * Get the row indexes of the selected rows. - */ - indexes(): DataTable; - - /** - * Obtain the tr nodes for the selected rows - */ - nodes(): DataTable; - - /** - * Delete the selected rows from the DataTable. - */ - remove(): DataTable; - } - //#endregion "row-methods" - - //#region "table-methods" - - interface TableMethods extends DataTableCore { - /** - * Get the tfoot node for the table in the API's context - */ - footer(): Node; - - /** - * Get the thead node for the table in the API's context - */ - header(): Node; - - /** - * Get the tbody node for the table in the API's context - */ - body(): Node; - - /** - * Get the div container node for the table in the API's context - */ - container(): Node; - - /** - * Get the table node for the table in the API's context - */ - node(): Node; - } - - interface TablesMethods extends DataTableCore { - /** - * Get the tfoot nodes for the tables in the API's context - */ - footer(): DataTable; - - /** - * Get the thead nodes for the tables in the API's context - */ - header(): DataTable; - - /** - * Get the tbody nodes for the tables in the API's context - */ - body(): DataTable; - - /** - * Get the div container nodes for the tables in the API's context - */ - containers(): DataTable; - - /** - * Get the table nodes for the tables in the API's context - */ - nodes(): DataTable; - } - //#endregion "table-methods" - - //#endregion "Namespaces" - - //#region "Static-Methods" - - export interface StaticFunctions { - /** - * Check is a table node is a DataTable or not - * - * @param table Selector string for table - */ - isDataTable(table: string): boolean; - - /** - * Get all DataTables on the page - * - * @param visible Get only visible tables - */ - tables(visible?: boolean): DataTables.DataTable[]; - - /** - * Version number compatibility check function - * - * @param version Version string - */ - versionCheck(version: string): boolean; - - /** - * Utils - */ - util: StaticUtilFunctions; - - /** - * Check is a table node is a DataTable or not - * - * @param table Selector string for table - */ - Api(selector: string | Node | Node[]| JQuery): DataTables.DataTable; - } - - export interface StaticUtilFunctions { - /** - * Escape special characters in a regular expression string. Since: 1.10.4 - * - * @param str String to escape - */ - escapeRegex(str: string): string; - - /** - * Throttle the calls to a method to reduce call frequency. Since: 1.10.3 - * - * @param fn Function - * @param period ms - */ - throttle(fn: Function, period?: number): Function; - } - - //#endregion "Static-Methods" - - //#region "Settings" - - export interface Settings { - - //#region "Features" - - /** - * Feature control DataTables' smart column width handling. Since: 1.10 - */ - autoWidth?: boolean; - - /** - * Feature control deferred rendering for additional speed of initialisation. Since: 1.10 - */ - deferRender?: boolean; - - /** - * Feature control table information display field. Since: 1.10 - */ - info?: boolean; - - /** - * Use markup and classes for the table to be themed by jQuery UI ThemeRoller. Since: 1.10 - */ - jQueryUI?: boolean; - - /** - * Feature control the end user's ability to change the paging display length of the table. Since: 1.10 - */ - lengthChange?: boolean; - - /** - * Feature control ordering (sorting) abilities in DataTables. Since: 1.10 - */ - ordering?: boolean; - - /** - * Enable or disable table pagination. Since: 1.10 - */ - paging?: boolean; - - /** - * Feature control the processing indicator. Since: 1.10 - */ - processing?: boolean; - - /** - * Horizontal scrolling. Since: 1.10 - */ - scrollX?: boolean; - - /** - * Vertical scrolling. Since: 1.10 Exp: "200px" - */ - scrollY?: string; - - /** - * Feature control search (filtering) abilities Since: 1.10 - */ - searching?: boolean; - - /** - * Feature control DataTables' server-side processing mode. Since: 1.10 - */ - serverSide?: boolean; - - /** - * State saving - restore table state on page reload. Since: 1.10 - */ - stateSave?: boolean; - - //#endregion "Features" - - //#region "Data" - - /** - * Load data for the table's content from an Ajax source. Since: 1.10 - */ - ajax?: string | AjaxSettings | FunctionAjax; - - /** - * Data to use as the display data for the table. Since: 1.10 - */ - data?: Object; - - //#endregion "Data" - - //#region "Options" - - /** - * Data to use as the display data for the table. Since: 1.10 - */ - columns?: ColumnSettings[]; - - /** - * Assign a column definition to one or more columns.. Since: 1.10 - */ - columnDefs?: ColumnDefsSettings[]; - - /** - * Delay the loading of server-side data until second draw - */ - deferLoading?: number | number[]; - - /** - * Destroy any existing table matching the selector and replace with the new options. Since: 1.10 - */ - destroy?: boolean; - - /** - * Initial paging start point. Since: 1.10 - */ - displayStart?: number; - - /** - * Define the table control elements to appear on the page and in what order. Since: 1.10 - */ - dom?: string; - - /** - * Change the options in the page length select list. Since: 1.10 - */ - lengthMenu?: (number | string)[]| (number | string)[][]; - - /** - * Control which cell the order event handler will be applied to in a column. Since: 1.10 - */ - orderCellsTop?: boolean; - - /** - * Highlight the columns being ordered in the table's body. Since: 1.10 - */ - orderClasses?: boolean; - - /** - * Initial order (sort) to apply to the table. Since: 1.10 - */ - order?: (string | number)[]| (string | number)[][]; - - /** - * Ordering to always be applied to the table. Since: 1.10 - */ - orderFixed?: (string | number)[]| (string | number)[][]| Object; - - /** - * Multiple column ordering ability control. Since: 1.10 - */ - orderMulti?: boolean; - - /** - * Change the initial page length (number of rows per page). Since: 1.10 - */ - pageLength?: number; - - /** - * Pagination button display options. Basic Types: simple, simple_numbers, full, full_numbers - */ - pagingType?: string; - - /** - * Retrieve an existing DataTables instance. Since: 1.10 - */ - retrieve?: boolean - - /** - * Display component renderer types. Since: 1.10 - */ - renderer?: string | RendererSettings; - - /** - * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10 - */ - scrollCollapse?: boolean; - - /** - * Set an initial filter in DataTables and / or filtering options. Since: 1.10 - */ - search?: SearchSettings; - - /** - * Define an initial search for individual columns. Since: 1.10 - */ - searchCols?: SearchSettings[]; - - /** - * Set a throttle frequency for searching. Since: 1.10 - */ - searchDelay?: number; - - /** - * Saved state validity duration. Since: 1.10 - */ - stateDuration?: number; - - /** - * Set the zebra stripe class names for the rows in the table. Since: 1.10 - */ - stripeClasses?: string[]; - - /** - * Tab index control for keyboard navigation. Since: 1.10 - */ - tabIndex?: number; - - //#endregion "Options" - - //#region "Callbacks" - - /** - * Callback for whenever a TR element is created for the table's body. Since: 1.10 - */ - createdRow?: FunctionCreateRow; - - /** - * Function that is called every time DataTables performs a draw. Since: 1.10 - */ - drawCallback?: FunctionDrawCallback; - - /** - * Footer display callback function. Since: 1.10 - */ - footerCallback?: FunctionFooterCallback; - - /** - * Number formatting callback function. Since: 1.10 - */ - formatNumber?: FunctionFormatNumber; - - /** - * Header display callback function. Since: 1.10 - */ - headerCallback?: FunctionHeaderCallback; - - /** - * Table summary information display callback. Since: 1.10 - */ - infoCallback?: FunctionInfoCallback; - - /** - * Initialisation complete callback. Since: 1.10 - */ - initComplete?: FunctionInitComplete; - - /** - * Pre-draw callback. Since: 1.10 - */ - preDrawCallback?: FunctionPreDrawCallback; - - /** - * Row draw callback.. Since: 1.10 - */ - rowCallback?: FunctionRowCallback; - - /** - * Callback that defines where and how a saved state should be loaded. Since: 1.10 - */ - stateLoadCallback?: FunctionStateLoadCallback; - - /** - * State loaded callback. Since: 1.10 - */ - stateLoaded?: FunctionStateLoaded; - - /** - * State loaded - data manipulation callback. Since: 1.10 - */ - stateLoadParams?: FunctionStateLoadParams; - - /** - * Callback that defines how the table state is stored and where. Since: 1.10 - */ - stateSaveCallback?: FunctionStateSaveCallback; - - /** - * State save - data manipulation callback. Since: 1.10 - */ - stateSaveParams?: FunctionStateSaveParams; - - //#endregion "Callbacks" - - //#region "Language" - - language?: LanguageSettings; - - //#endregion "Language" - } - - //#region "ajax-settings" - - export interface AjaxDataRequest { - draw: number; - start: number; - length: number; - data: any; - order: AjaxDataRequestOrder[]; - columns: AjaxDataRequestColumn[]; - search: AjaxDataRequestSearch; - } - - export interface AjaxDataRequestSearch { - value: string; - regex: boolean; - } - - export interface AjaxDataRequestOrder { - column: number; - dir: string; - } - - export interface AjaxDataRequestColumn { - data: string | number; - name: string; - searchable: boolean; - orderable: boolean; - search: AjaxDataRequestSearch; - } - - export interface AjaxData { - draw: number; - recordsTotal: number; - recordsFiltered: number; - data: any; - error?: string; - } - - interface AjaxSettings extends JQueryAjaxSettings { - /** - * Add or modify data submitted to the server upon an Ajax request. Since: 1.10 - */ - data?: Object | FunctionAjaxData; - - /** - * Data property or manipulation method for table data. Since: 1.10 - */ - dataSrc?: string | Function; - } - - interface FunctionAjax { - (data: Object, callback: Function, settings: SettingsLegacy): void; - } - - interface FunctionAjaxData { - (data: Object): string | Object; - } - - //#endregion "ajax-settings" - - //#region "colunm-settings" - - export interface ColumnSettings { - /** - * Cell type to be created for a column. th/td Since: 1.10 - */ - cellType?: string; - - /** - * Class to assign to each cell in the column. Since: 1.10 - */ - className?: string; - - /** - * Add padding to the text content used when calculating the optimal with for a table. Since: 1.10 - */ - contentPadding?: string; - - /** - * Cell created callback to allow DOM manipulation. Since: 1.10 - */ - createdCell?: FunctionColumnCreatedCell; - - /** - * Class to assign to each cell in the column. Since: 1.10 - */ - data?: number | string | ObjectColumnData | FunctionColumnData; - - /** - * Set default, static, content for a column. Since: 1.10 - */ - defaultContent?: string; - - /** - * Set a descriptive name for a column. Since: 1.10 - */ - name?: string; - - /** - * Enable or disable ordering on this column. Since: 1.10 - */ - orderable?: boolean; - - /** - * Define multiple column ordering as the default order for a column. Since: 1.10 - */ - orderData?: number | number[]; - - /** - * Live DOM sorting type assignment. Since: 1.10 - */ - orderDataType?: string; - - /** - * Order direction application sequence. Since: 1.10 - */ - orderSequence?: string[]; - - /** - * Render (process) the data for use in the table. Since: 1.10 - */ - render?: number | string | ObjectColumnRender | FunctionColumnRender; - - /** - * Enable or disable filtering on the data in this column. Since: 1.10 - */ - searchable?: boolean; - - /** - * Set the column title. Since: 1.10 - */ - title?: string; - - /** - * Set the column type - used for filtering and sorting string processing. Since: 1.10 - */ - type?: string; - - /** - * Enable or disable the display of this column. Since: 1.10 - */ - visible?: boolean; - - /** - * Column width assignment. Since: 1.10 - */ - width?: string; - } - - interface ColumnDefsSettings extends ColumnSettings { - targets: string | number | (number | string)[] - } - - interface FunctionColumnCreatedCell { - (cell: Node, cellData: any, rowData: any, row: number, col: number): void; - } - - interface FunctionColumnData { - (row: any, t: string, s: any, meta: Object): void; - } - - interface ObjectColumnData { - _: string; - filter?: string; - display?: string; - type?: string; - sort?: string; - } - - interface ObjectColumnRender extends ObjectColumnData { - } - - interface FunctionColumnRender { - (data: Node, t: Node, row: Node, meta: Object): void; - } - - //#endregion "colunm-settings" - - //#region "other-settings" - - export interface RendererSettings { - header?: string; - pageButton?: string; - } - - export interface SearchSettings { - /** - * Control case-sensitive filtering option. Since: 1.10 - */ - caseInsensitive?: boolean; - - /** - * Enable / disable escaping of regular expression characters in the search term. Since: 1.10 - */ - regex?: boolean; - - /** - * Enable / disable DataTables' smart filtering. Since: 1.10 - */ - smart?: boolean; - - /** - * Set an initial filtering condition on the table. Since: 1.10 - */ - search?: string; - } - - //#endregion "other-settings" - - //#region "callback-functions" - - interface FunctionCreateRow { - (row: Node, data: any[]| Object, dataIndex: number): void; - } - - interface FunctionDrawCallback { - (settings: SettingsLegacy): void; - } - - interface FunctionFooterCallback { - (tfoot: Node, data: any[], start: number, end: number, display: any[]): void; - } - - interface FunctionFormatNumber { - (formatNumber: number): void; - } - - interface FunctionHeaderCallback { - (thead: Node, data: any[], start: number, end: number, display: any[]): void; - } - - interface FunctionInfoCallback { - (settings: SettingsLegacy, start: number, end: number, mnax: number, total: number, pre: string): void; - } - - interface FunctionInitComplete { - (settings: SettingsLegacy, json: Object): void; - } - - interface FunctionPreDrawCallback { - (settings: SettingsLegacy): void; - } - - interface FunctionRowCallback { - (row: Node, data: any[]| Object): void; - } - - interface FunctionStateLoadCallback { - (settings: SettingsLegacy): void; - } - - interface FunctionStateLoaded { - (settings: SettingsLegacy, data: Object): void; - } - - interface FunctionStateLoadParams { - (settings: SettingsLegacy, data: Object): void; - } - - interface FunctionStateSaveCallback { - (settings: SettingsLegacy, data: Object): void; - } - - interface FunctionStateSaveParams { - (settings: SettingsLegacy, data: Object): void; - } - - //#endregion "callback-functions" - - //#region "language-settings" - - interface LanguageSettings { - emptyTable: string; - info: string; - infoEmpty: string; - infoFiltered: string; - infoPostFix: string; - thousands: string; - lengthMenu: string; - loadingRecords: string; - processing: string; - search: string; - zeroRecords: string; - paginate: LanguagePaginateSettings; - aria: LanguageAriaSettings; - } - - interface LanguagePaginateSettings { - first: string; - last: string; - next: string; - previous: string; - } - - interface LanguageAriaSettings { - sortAscending: string; - sortDescending: string; - } - - //#endregion "language-settings" - - //#endregion "Settings" - - //#region "SettingsLegacy" - - interface ArrayStringNode { - [index: string]: Node; - } - - export interface SettingsLegacy { - oApi: any; - oFeatures: FeaturesLegacy; - oScroll: ScrollingLegacy; - oLanguage: LanguageLegacy; // | { fnInfoCallback: FunctionInfoCallback; }; - oBrowser: { bScrollOversize: boolean; }; - aanFeatures: ArrayStringNode[][]; - aoData: RowLegacy[]; - aiDisplay: number[]; - //bServerSide: boolean; - aiDisplayMaster: number[]; - aoColumns: ColumnLegacy[]; - aoHeader: any[]; - aoFooter: any[]; - asDataSearch: string[]; - oPreviousSearch: any; - aoPreSearchCols: any[]; - aaSorting: any[][]; - aaSortingFixed: any[][]; - asStripeClasses: string[]; - asDestroyStripes: string[]; - sDestroyWidth: number; - aoRowCallback: FunctionRowCallback[]; - aoHeaderCallback: FunctionHeaderCallback[]; - aoFooterCallback: FunctionFooterCallback[]; - aoDrawCallback: FunctionDrawCallback[]; - aoRowCreatedCallback: FunctionCreateRow[]; - aoPreDrawCallback: FunctionPreDrawCallback[]; - aoInitComplete: FunctionInitComplete[]; - aoStateSaveParams: FunctionStateSaveParams[]; - aoStateLoadParams: FunctionStateLoadParams[]; - aoStateLoaded: FunctionStateLoaded[]; - sTableId: string; - nTable: Node; - nTHead: Node; - nTFoot: Node; - nTBody: Node; - nTableWrapper: Node; - bDeferLoading: boolean; - bInitialized: boolean; - aoOpenRows: any[]; - sDom: string; - sPaginationType: string; - iCookieDuration: number; - sCookiePrefix: string; - fnCookieCallback: CookieCallbackLegacy; - aoStateSave: FunctionStateSaveCallback[]; - aoStateLoad: FunctionStateLoadCallback[]; - oLoadedState: any; - sAjaxSource: string; - sAjaxDataProp: string; - bAjaxDataGet: boolean; - jqXHR: any; - fnServerData: any; - aoServerParams: any[]; - sServerMethod: string; - fnFormatNumber: FunctionFormatNumber; - aLengthMenu: any[]; - iDraw: number; - bDrawing: boolean; - iDrawError: number; - _iDisplayLength: number; - _iDisplayStart: number; - _iDisplayEnd: number; - _iRecordsTotal: number; - _iRecordsDisplay: number; - bJUI: boolean; - oClasses: any; - bFiltered: boolean; - bSorted: boolean; - bSortCellsTop: boolean; - oInit: any; - aoDestroyCallback: any[]; - fnRecordsTotal: () => number; - fnRecordsDisplay: () => number; - fnDisplayEnd: () => number; - oInstance: any; - sInstance: string; - iTabIndex: number; - nScrollHead: Node; - nScrollFoot: Node; - } - - export interface FeaturesLegacy { - bAutoWidth: boolean; - bDeferRender: boolean; - bFilter: boolean; - bInfo: boolean; - bLengthChange: boolean; - bPaginate: boolean; - bProcessing: boolean; - bServerSide: boolean; - bSort: boolean; - bSortClasses: boolean; - bStateSave: boolean; - } - - export interface ScrollingLegacy { - bAutoCss: boolean; - bCollapse: boolean; - bInfinite: boolean; - iBarWidth: number; - iLoadGap: number; - sX: string; - sY: string; - } - - export interface RowLegacy { - nTr: Node; - _aData: any; - _aSortData: any[]; - _anHidden: Node[]; - _sRowStripe: string; - } - - export interface ColumnLegacy { - aDataSort: any; - asSorting: string[]; - bSearchable: boolean; - bSortable: boolean; - bVisible: boolean; - _bAutoType: boolean; - fnCreatedCell: FunctionColumnCreatedCell; - fnGetData: (data: any, specific: string) => any; - fnSetData: (data: any, value: any) => void; - mData: any; - mRender: any; - nTh: Node; - nIf: Node; - sClass: string; - sContentPadding: string; - sDefaultContent: string; - sName: string; - sSortDataType: string; - sSortingClass: string; - sSortingClassJUI: string; - sTitle: string; - sType: string; - sWidth: string; - sWidthOrig: string; - } - - export interface CookieCallbackLegacy { - (name: string, data: any, expires: string, path: string, cookie: string): void; - } - - export interface LanguageLegacy { - oAria?: LanguageAriaLegacy; - oPaginate?: LanguagePaginateLegacy; - sEmptyTable?: string; - sInfo?: string; - sInfoEmpty?: string; - sInfoFiltered?: string; - sInfoPostFix?: string; - sInfoThousands?: string; - sLengthMenu?: string; - sLoadingRecords?: string; - sProcessing?: string; - sSearch?: string; - sUrl?: string; - sZeroRecords?: string; - } - - export interface LanguageAriaLegacy { - sSortAscending?: string; - sSortDescending?: string; - } - - export interface LanguagePaginateLegacy { - sFirst?: string; - sLast?: string; - sNext?: string; - sPrevious?: string; - } - //#endregion "SettingsLegacy" - +// Type definitions for JQuery DataTables 1.10.5 +// Project: http://www.datatables.net +// Definitions by: Kiarash Ghiaseddin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// missing: +// - Static methods that are defined in JQueryStatic.fn are not typed. +// - Plugin and extension definitions are not typed. +// - Some return types are not fully wokring + +interface JQuery { + DataTable(param?: DataTables.Settings): DataTables.DataTable; +} + +//TODO: Wrong, as jquery.d.ts has no interface for fn +//interface JQueryStatic { +// dataTable: DataTables.StaticFunctions; +//} + +declare module DataTables { + export interface DataTable extends DataTableCore { + /** + * Get the data for the whole table. + */ + data(): DataTable; + + /** + * Order Methods / Object + */ + order: OrderMethods; + + //#region "Cell/Cells" + + /** + * Select the cell found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cell(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods; + + /** + * Select the cell found by a cell selector + * + * @param rowSelector Row selector. + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cell(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods; + + /** + * Select all cells + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cells(modifier?: ObjectSelectorModifier): CellsMethods; + + /** + * Select cells found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cells(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods; + + /** + * Select cells found by both row and column selectors + * + * @param rowSelector Row selector. + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + cells(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods; + //#endregion "Cell/Cells" + + //#region "Column/Columns" + + /** + * Column Methods / Object + */ + column: ColumnMethodsModel; + + /** + * Columns Methods / Object + */ + columns: ColumnsMethodsModel; + + //#endregion "Column/Columns" + + //#region "Row/Rows" + + /** + * Row Methode / Object + */ + row: RowMethodsModel + + /** + * Rows Methods / Object + */ + rows: RowsMethodsModel + + //#endregion "Row/Rows" + + //#region "Table/Tables" + + /** + * Select a table based on a selector from the API's context + * + * @param tableSelector Table selector. + */ + table(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TableMethods; + + /** + * Select all tables + */ + tables(): TablesMethods; + + /** + * Select tables based on the given selector + * + * @param tableSelector Table selector. + */ + tables(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TablesMethods; + + //#endregion "Table/Tables" + } + + export interface DataTables extends DataTableCore { + [index: number]: DataTable; + } + + interface ObjectSelectorModifier { + /** + * The order modifier provides the ability to control which order the rows are processed in. + * Values: 'current', 'applied', 'index', 'original' + */ + order?: string; + + /** + * The search modifier provides the ability to govern which rows are used by the selector using the search options that are applied to the table. + * Values: 'none', 'applied', 'removed' + */ + search?: string; + + /** + * The page modifier allows you to control if the selector should consider all data in the table, regardless of paging, or if only the rows in the currently disabled page should be used. + * Values: 'all', 'current' + */ + page?: string; + } + + //#region "Namespaces" + + //#region "core-methods" + + interface DataTableCore extends UtilityMethods { + /** + * Get jquery object + */ + $(selector: string | Node | Node[]| JQuery, modifier?: ObjectSelectorModifier): JQuery; + + ///// Almost identical to $ in operation, but in this case returns the data for the matched rows. + //_(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery; + + /** + * Ajax Methods + */ + ajax: AjaxMethodModel; + + /** + * Clear the table of all data. + */ + clear(): DataTable; + + /** + * Destroy the DataTables in the current context. + * + * @param remove Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false). + */ + destroy(remove?: boolean): DataTable; + + /** + * Destroy the DataTables in the current context. + * + * @param reset Reset (default) or hold the current paging position. A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action. + */ + draw(reset?: boolean): DataTable; + + /** + * Table events removal. + * + * @param event Event name to remove. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + off(event: string, callback?: Function): DataTable; + + /** + * Table events listener. + * + * @param event Event to listen for. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + on(event: string, callback: Function): DataTable; + + /** + * Listen for a table event once and then remove the listener. + * + * @param event Event to listen for. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + one(event: string, callback: Function): DataTable; + + /** + * Page Methods / Object + */ + page: PageMethods; + + /** + * Get current search + */ + search(): string; + + /** + * Search for data in the table. + * + * @param input Search string to apply to the table. + * @param regex Treat as a regular expression (true) or not (default, false). + * @param smart Perform smart search. + * @param caseInsen Do case-insensitive matching (default, true) or not (false). + */ + search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): DataTable; + + /** + * Obtain the table's settings object + */ + settings(): DataTable; + + /** + * Page Methods / Object + */ + state: StateMethods; + } + + //#region "ajax-methods" + + interface AjaxMethods extends DataTable { + /** + * Reload the table data from the Ajax data source. + * + * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. + * @param resetPaging Reset (default action or true) or hold the current paging position (false). + */ + load(callback?: Function, resetPaging?: boolean): DataTable; + } + + interface AjaxMethodModel { + /** + * Get the latest JSON data obtained from the last Ajax request DataTables made + */ + json(): Object; + + /** + * Get the data submitted by DataTables to the server in the last Ajax request + */ + params(): Object; + + /** + * Reload the table data from the Ajax data source. + * + * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. + * @param resetPaging Reset (default action or true) or hold the current paging position (false). + */ + reload(callback?: Function, resetPaging?: boolean): DataTable; + + /** + * Reload the table data from the Ajax data source + */ + url(): string; + + /** + * Reload the table data from the Ajax data source + * + * @param url URL to set to be the Ajax data source for the table. + */ + url(url: string): AjaxMethods; + } + + //#endregion "ajax-methods" + + //#region "order-methods" + + interface OrderMethods { + /** + * Get the ordering applied to the table. + */ + (): (string | number)[][]; + + /** + * Set the ordering applied to the table. + * + * @param order Order Model + */ + (order?: (string | number)[]): DataTable; + (order?: (string | number)[][]): DataTable; + (order: (string | number)[], ...args: any[]): DataTable; + + /** + * Add an ordering listener to an element, for a given column. + * + * @param node Selector + * @param column Column index + * @param callback Callback function + */ + listener(node: string | Node | JQuery, column: number, callback: Function): DataTable; + } + //#endregion "order-methods" + + //#region "page-methods" + + interface PageMethods { + /** + * Get the current page of the table. + */ + (): number; + + /** + * Set the current page of the table. + * + * @param page Index or 'first', 'next', 'previous', 'last' + */ + (page: number | string): DataTable; + + /** + * Get paging information about the table + */ + info(): PageMethodeModelInfoReturn; + + /** + * Get the table's page length. + */ + len(): number; + + /** + * Set the table's page length. + * + * @param length Page length to set. use -1 to show all records. + */ + len(length: number): DataTable; + } + + interface PageMethodeModelInfoReturn { + page: number; + pages: number; + start: number; + end: number; + length: number; + recordsTotal: number; + recordsDisplay: number; + } + + //#endregion "page-methods" + + //#region "state-methods" + + interface StateMethods { + /** + * Get the last saved state of the table + */ + (): StateReturnModel; + + /** + * Clear the saved state of the table. + */ + clear(): DataTable; + + /** + * Get the table state that was loaded during initialisation. + */ + loaded(): StateReturnModel; + + /** + * Trigger a state save. + */ + save(): DataTable; + } + + interface StateReturnModel { + time: number; + start: number; + length: number; + order: (string | number)[][]; + search: SearchSettings; + columns: StateReturnModelColumns[]; + } + + interface StateReturnModelColumns { + search: SearchSettings; + visible: boolean; + } + + //#endregion "state-methods" + + //#endregion "core-methods" + + //#region "util-methods" + + interface UtilityMethods { + /** + * Concatenate two or more API instances together + * + * @param a API instance to concatenate to the initial instance. + * @param b Additional API instance(s) to concatenate to the initial instance. + */ + concat(a: Object, ...b: Object[]): DataTable; + + /** + * Iterate over the contents of the API result set. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters + */ + each(fn: Function): DataTable; + + /** + * Reduce an Api instance to a single context and result set. + * + * @param idx Index to select + */ + eq(idx: number): DataTable; + + /** + * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. + */ + filter(fn: Function): DataTable; + + /** + * Flatten a 2D array structured API instance to a 1D array structure. + */ + flatten(): DataTable; + + /** + * Find the first instance of a value in the API instance's result set. + * + * @param value Value to find in the instance's result set. + */ + indexOf(value: any): number; + + /** + * Join the elements in the result set into a string. + * + * @param separator The string that will be used to separate each element of the result set. + */ + join(separator: string): string; + + /** + * Find the last instance of a value in the API instance's result set. + * + * @param value Value to find in the instance's result set. + */ + lastIndexOf(value: any): number; + + /** + * Number of elements in an API instance's result set. + */ + length: number; + + /** + * Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. + */ + map(fn: Function): DataTable; + + /** + * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements. + * + * @param property Object property name to use from the element in the original result set for the new result set. + */ + pluck(property: number | string): DataTable; + + /** + * Remove the last item from an API instance's result set. + */ + pop(): any; + + /** + * Add one or more items to the end of an API instance's result set. + * + * @param value_1 Item to add to the API instance's result set. + */ + push(value_1: any | any[], ...value_2: any[]): number; + + /** + * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right). + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. + * @param initialValue Value to use as the first argument of the first call to the fn callback. + */ + reduce(fn: Function, initialValue?: any): any; + + /** + * Apply a callback function against and accumulator and each element in the Api's result set (right-to-left). + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. + * @param initialValue Value to use as the first argument of the first call to the fn callback. + */ + reduceRight(fn: Function, initialValue?: any): any; + + /** + * Reverse the result set of the API instance and return the original array. + */ + reverse(): DataTable; + + /** + * Remove the first item from an API instance's result set. + */ + shift(): any; + + /** + * Sort the elements of the API instance's result set. + * + * @param fn This is a standard Javascript sort comparison function. It accepts two parameters. + */ + sort(fn?: Function): DataTable; + + /** + * Modify the contents of an Api instance's result set, adding or removing items from it as required. + * + * @param index Index at which to start modifying the Api instance's result set. + * @param howMany Number of elements to remove from the result set. + * @param value_1 Item to add to the result set at the index specified by the first parameter. + */ + splice(index: number, howMany: number, value_1?: any | any[], ...value_2: any[]): any[]; + + /** + * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. + */ + to$(): JQuery; + + /** + * Create a native Javascript array object from an API instance. + */ + toArray(): any[]; + + /** + * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. + */ + toJQuery(): JQuery; + + /** + * Create a new API instance containing only the unique items from a the elements in an instance's result set. + */ + unique(): DataTable; + + /** + * Add one or more items to the start of an API instance's result set. + * + * @param value_1 Item to add to the API instance's result set. + */ + unshift(value_1: any | any[], ...value_2: any[]): number; + } + + //#endregion "util-methods" + + interface CommonSubMethods { + /** + * Get the DataTables cached data for the selected cell + * + * @param t Specify which cache the data should be read from. Can take one of two values: search or order + */ + cache(t: string): DataTable; + } + + //#region "cell-methods" + + interface CommonCellMethods extends CommonSubMethods { + /** + * Invalidate the data held in DataTables for the selected cells + * + * @param source Data source to read the new data from. + */ + invalidate(source?: string): DataTable; + + /** + * Get data for the selected cell + * + * @param f Data type to get. This can be one of: 'display', 'filter', 'sort', 'type' + */ + render(t: string): any; + } + + interface CellMethods extends DataTableCore, CommonCellMethods { + /** + * Get data for the selected cell + */ + data(): any; + + /** + * Get data for the selected cell + * + * @param data Value to assign to the data for the cell + */ + data(data: any): DataTable; + + /** + * Get index information about the selected cell + */ + index(): CellIndexReturn; + + /** + * Get the DOM element for the selected cell + */ + node(): Node; + } + + interface CellIndexReturn { + row: number; + column: number; + columnVisible: number; + } + + interface CellsMethods extends DataTableCore, CommonCellMethods { + /** + * Get data for the selected cells + */ + data(): DataTable; + + /** + * Get index information about the selected cells + */ + indexes(): DataTable; + + /** + * Get the DOM elements for the selected cells + */ + nodes(): DataTable; + } + //#endregion "cell-methods" + + //#region "column-methods" + + interface CommonColumnMethod extends CommonSubMethods { + /** + * Get the footer th / td cell for the selected column. + */ + footer(): any; + + /** + * Get the header th / td cell for a column. + */ + header(): Node; + + /** + * Order the table, in the direction specified, by the column selected by the column()DT selector. + * + * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending). + */ + order(direction: string): DataTable; + + /** + * Get the visibility of the selected column. + */ + visible(): boolean; + + /** + * Set the visibility of the selected column. + * + * @param show Specify if the column should be visible (true) or not (false). + * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance. + */ + visible(show: boolean, redrawCalculations?: boolean): DataTable; + } + + interface ColumnMethodsModel { + /** + * Select the column found by a column selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnMethods; + + /** + * Convert from the input column index type to that required. + * + * @param t The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible' + * @param index The index to be converted + */ + index(t: string, index: number): number; + } + + interface ColumnMethods extends DataTableCore, CommonColumnMethod { + /** + * Get the data for the cells in the selected column. + */ + data(): DataTable; + + /** + * Get the data source property for the selected column + */ + dataSrc(): number | string | Function; + + /** + * Get index information about the selected cell + * + * @param t Specify if you want to get the column data index (default) or the visible index (visible). + */ + index(t?: string): DataTable; + + /** + * Obtain the th / td nodes for the selected column + */ + nodes(): DataTable[]; + } + + interface ColumnsMethodsModel { + /** + * Select all columns + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (modifier?: ObjectSelectorModifier): ColumnsMethods; + + /** + * Select columns found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnsMethods; + + /** + * Recalculate the column widths for layout. + */ + adjust(): DataTable; + } + + interface ColumnsMethods extends DataTableCore, CommonColumnMethod { + /** + * Obtain the data for the columns from the selector + */ + data(): DataTable; + + /** + * Get the data source property for the selected columns. + */ + dataSrc(): DataTable; + + /** + * Get the column indexes of the selected columns. + * + * @param t Specify if you want to get the column data index (default) or the visible index (visible). + */ + indexes(t?: string): DataTable; + + /** + * Obtain the th / td nodes for the selected columns + */ + nodes(): DataTable[][]; + } + //#endregion "column-methods" + + //#region "row-methods" + + interface CommonRowMethod extends CommonSubMethods { + /** + * Obtain the th / td nodes for the selected column + * + * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom' + */ + invalidate(source?: string): DataTable; + } + + interface RowChildMethodModel { + /** + * Get the child row(s) that have been set for a parent row + */ + (): JQuery; + + /** + * Get the child row(s) that have been set for a parent row + * + * @param showRemove This parameter can be given as true or false + */ + (showRemove: boolean): RowChildMethods; + + /** + * Set the data to show in the child row(s). Note that calling this method will replace any child rows which are already attached to the parent row. + * + * @param data The data to be shown in the child row can be given in multiple different ways. + * @param className Class name that is added to the td cell node(s) of the child row(s). As of 1.10.1 it is also added to the tr row node of the child row(s). + */ + (data: (string | Node | JQuery) | (string | Node | JQuery)[], className?: string): RowChildMethods; + + /** + * Hide the child row(s) of a parent row + */ + hide(): DataTable; + + /** + * Check if the child rows of a parent row are visible + */ + isShown(): DataTable; + + /** + * Remove child row(s) from display and release any allocated memory + */ + remove(): DataTable; + + /** + * Show the child row(s) of a parent row + */ + show(): DataTable; + } + + interface RowChildMethods extends DataTableCore { + /** + * Hide the child row(s) of a parent row + */ + hide(): DataTable; + + /** + * Remove child row(s) from display and release any allocated memory + */ + remove(): DataTable; + + /** + * Make newly defined child rows visible + */ + show(): DataTable; + } + + interface RowMethodsModel { + /** + * Select a row found by a row selector + * + * @param rowSelector Row selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (rowSelector: any, modifier?: ObjectSelectorModifier): RowMethods; + + /** + * Add a new row to the table using the given data + * + * @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table + */ + add(data: any[]| Object): DataTable; + } + + interface RowMethods extends DataTableCore, CommonRowMethod { + /** + * Order Methods / Object + */ + child: RowChildMethodModel; + + /** + * Get the data for the selected row + */ + data(): any[]| Object; + + /** + * Set the data for the selected row + * + * @param d Data to use for the row. + */ + data(d: any[]| Object): DataTable; + + /** + * Get the row index of the row column. + */ + index(): number; + + /** + * Obtain the tr node for the selected row + */ + node(): Node; + + /** + * Delete the selected row from the DataTable. + */ + remove(): Node; + } + + interface RowsMethodsModel { + /** + * Select all rows + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (modifier?: ObjectSelectorModifier): RowsMethods; + + /** + * Select rows found by a row selector + * + * @param cellSelector Row selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ + (rowSelector: any, modifier?: ObjectSelectorModifier): RowsMethods; + + /** + * Add new rows to the table using the data given + * + * @param data Array of data elements, with each one describing a new row to be added to the table + */ + add(data: any[]): DataTable; + } + + interface RowsMethods extends DataTableCore, CommonRowMethod { + /** + * Get the data for the rows from the selector + */ + data(): DataTable; + + /** + * Set the data for the selected row + * + * @param d Data to use for the row. + */ + data(d: any[]| Object): DataTable; + + /** + * Get the row indexes of the selected rows. + */ + indexes(): DataTable; + + /** + * Obtain the tr nodes for the selected rows + */ + nodes(): DataTable; + + /** + * Delete the selected rows from the DataTable. + */ + remove(): DataTable; + } + //#endregion "row-methods" + + //#region "table-methods" + + interface TableMethods extends DataTableCore { + /** + * Get the tfoot node for the table in the API's context + */ + footer(): Node; + + /** + * Get the thead node for the table in the API's context + */ + header(): Node; + + /** + * Get the tbody node for the table in the API's context + */ + body(): Node; + + /** + * Get the div container node for the table in the API's context + */ + container(): Node; + + /** + * Get the table node for the table in the API's context + */ + node(): Node; + } + + interface TablesMethods extends DataTableCore { + /** + * Get the tfoot nodes for the tables in the API's context + */ + footer(): DataTable; + + /** + * Get the thead nodes for the tables in the API's context + */ + header(): DataTable; + + /** + * Get the tbody nodes for the tables in the API's context + */ + body(): DataTable; + + /** + * Get the div container nodes for the tables in the API's context + */ + containers(): DataTable; + + /** + * Get the table nodes for the tables in the API's context + */ + nodes(): DataTable; + } + //#endregion "table-methods" + + //#endregion "Namespaces" + + //#region "Static-Methods" + + export interface StaticFunctions { + /** + * Check is a table node is a DataTable or not + * + * @param table Selector string for table + */ + isDataTable(table: string): boolean; + + /** + * Get all DataTables on the page + * + * @param visible Get only visible tables + */ + tables(visible?: boolean): DataTables.DataTable[]; + + /** + * Version number compatibility check function + * + * @param version Version string + */ + versionCheck(version: string): boolean; + + /** + * Utils + */ + util: StaticUtilFunctions; + + /** + * Check is a table node is a DataTable or not + * + * @param table Selector string for table + */ + Api(selector: string | Node | Node[]| JQuery): DataTables.DataTable; + } + + export interface StaticUtilFunctions { + /** + * Escape special characters in a regular expression string. Since: 1.10.4 + * + * @param str String to escape + */ + escapeRegex(str: string): string; + + /** + * Throttle the calls to a method to reduce call frequency. Since: 1.10.3 + * + * @param fn Function + * @param period ms + */ + throttle(fn: Function, period?: number): Function; + } + + //#endregion "Static-Methods" + + //#region "Settings" + + export interface Settings { + + //#region "Features" + + /** + * Feature control DataTables' smart column width handling. Since: 1.10 + */ + autoWidth?: boolean; + + /** + * Feature control deferred rendering for additional speed of initialisation. Since: 1.10 + */ + deferRender?: boolean; + + /** + * Feature control table information display field. Since: 1.10 + */ + info?: boolean; + + /** + * Use markup and classes for the table to be themed by jQuery UI ThemeRoller. Since: 1.10 + */ + jQueryUI?: boolean; + + /** + * Feature control the end user's ability to change the paging display length of the table. Since: 1.10 + */ + lengthChange?: boolean; + + /** + * Feature control ordering (sorting) abilities in DataTables. Since: 1.10 + */ + ordering?: boolean; + + /** + * Enable or disable table pagination. Since: 1.10 + */ + paging?: boolean; + + /** + * Feature control the processing indicator. Since: 1.10 + */ + processing?: boolean; + + /** + * Horizontal scrolling. Since: 1.10 + */ + scrollX?: boolean; + + /** + * Vertical scrolling. Since: 1.10 Exp: "200px" + */ + scrollY?: string; + + /** + * Feature control search (filtering) abilities Since: 1.10 + */ + searching?: boolean; + + /** + * Feature control DataTables' server-side processing mode. Since: 1.10 + */ + serverSide?: boolean; + + /** + * State saving - restore table state on page reload. Since: 1.10 + */ + stateSave?: boolean; + + //#endregion "Features" + + //#region "Data" + + /** + * Load data for the table's content from an Ajax source. Since: 1.10 + */ + ajax?: string | AjaxSettings | FunctionAjax; + + /** + * Data to use as the display data for the table. Since: 1.10 + */ + data?: Object; + + //#endregion "Data" + + //#region "Options" + + /** + * Data to use as the display data for the table. Since: 1.10 + */ + columns?: ColumnSettings[]; + + /** + * Assign a column definition to one or more columns.. Since: 1.10 + */ + columnDefs?: ColumnDefsSettings[]; + + /** + * Delay the loading of server-side data until second draw + */ + deferLoading?: number | number[]; + + /** + * Destroy any existing table matching the selector and replace with the new options. Since: 1.10 + */ + destroy?: boolean; + + /** + * Initial paging start point. Since: 1.10 + */ + displayStart?: number; + + /** + * Define the table control elements to appear on the page and in what order. Since: 1.10 + */ + dom?: string; + + /** + * Change the options in the page length select list. Since: 1.10 + */ + lengthMenu?: (number | string)[]| (number | string)[][]; + + /** + * Control which cell the order event handler will be applied to in a column. Since: 1.10 + */ + orderCellsTop?: boolean; + + /** + * Highlight the columns being ordered in the table's body. Since: 1.10 + */ + orderClasses?: boolean; + + /** + * Initial order (sort) to apply to the table. Since: 1.10 + */ + order?: (string | number)[]| (string | number)[][]; + + /** + * Ordering to always be applied to the table. Since: 1.10 + */ + orderFixed?: (string | number)[]| (string | number)[][]| Object; + + /** + * Multiple column ordering ability control. Since: 1.10 + */ + orderMulti?: boolean; + + /** + * Change the initial page length (number of rows per page). Since: 1.10 + */ + pageLength?: number; + + /** + * Pagination button display options. Basic Types: simple, simple_numbers, full, full_numbers + */ + pagingType?: string; + + /** + * Retrieve an existing DataTables instance. Since: 1.10 + */ + retrieve?: boolean + + /** + * Display component renderer types. Since: 1.10 + */ + renderer?: string | RendererSettings; + + /** + * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10 + */ + scrollCollapse?: boolean; + + /** + * Set an initial filter in DataTables and / or filtering options. Since: 1.10 + */ + search?: SearchSettings; + + /** + * Define an initial search for individual columns. Since: 1.10 + */ + searchCols?: SearchSettings[]; + + /** + * Set a throttle frequency for searching. Since: 1.10 + */ + searchDelay?: number; + + /** + * Saved state validity duration. Since: 1.10 + */ + stateDuration?: number; + + /** + * Set the zebra stripe class names for the rows in the table. Since: 1.10 + */ + stripeClasses?: string[]; + + /** + * Tab index control for keyboard navigation. Since: 1.10 + */ + tabIndex?: number; + + //#endregion "Options" + + //#region "Callbacks" + + /** + * Callback for whenever a TR element is created for the table's body. Since: 1.10 + */ + createdRow?: FunctionCreateRow; + + /** + * Function that is called every time DataTables performs a draw. Since: 1.10 + */ + drawCallback?: FunctionDrawCallback; + + /** + * Footer display callback function. Since: 1.10 + */ + footerCallback?: FunctionFooterCallback; + + /** + * Number formatting callback function. Since: 1.10 + */ + formatNumber?: FunctionFormatNumber; + + /** + * Header display callback function. Since: 1.10 + */ + headerCallback?: FunctionHeaderCallback; + + /** + * Table summary information display callback. Since: 1.10 + */ + infoCallback?: FunctionInfoCallback; + + /** + * Initialisation complete callback. Since: 1.10 + */ + initComplete?: FunctionInitComplete; + + /** + * Pre-draw callback. Since: 1.10 + */ + preDrawCallback?: FunctionPreDrawCallback; + + /** + * Row draw callback.. Since: 1.10 + */ + rowCallback?: FunctionRowCallback; + + /** + * Callback that defines where and how a saved state should be loaded. Since: 1.10 + */ + stateLoadCallback?: FunctionStateLoadCallback; + + /** + * State loaded callback. Since: 1.10 + */ + stateLoaded?: FunctionStateLoaded; + + /** + * State loaded - data manipulation callback. Since: 1.10 + */ + stateLoadParams?: FunctionStateLoadParams; + + /** + * Callback that defines how the table state is stored and where. Since: 1.10 + */ + stateSaveCallback?: FunctionStateSaveCallback; + + /** + * State save - data manipulation callback. Since: 1.10 + */ + stateSaveParams?: FunctionStateSaveParams; + + //#endregion "Callbacks" + + //#region "Language" + + language?: LanguageSettings; + + //#endregion "Language" + } + + //#region "ajax-settings" + + export interface AjaxDataRequest { + draw: number; + start: number; + length: number; + data: any; + order: AjaxDataRequestOrder[]; + columns: AjaxDataRequestColumn[]; + search: AjaxDataRequestSearch; + } + + export interface AjaxDataRequestSearch { + value: string; + regex: boolean; + } + + export interface AjaxDataRequestOrder { + column: number; + dir: string; + } + + export interface AjaxDataRequestColumn { + data: string | number; + name: string; + searchable: boolean; + orderable: boolean; + search: AjaxDataRequestSearch; + } + + export interface AjaxData { + draw: number; + recordsTotal: number; + recordsFiltered: number; + data: any; + error?: string; + } + + interface AjaxSettings extends JQueryAjaxSettings { + /** + * Add or modify data submitted to the server upon an Ajax request. Since: 1.10 + */ + data?: Object | FunctionAjaxData; + + /** + * Data property or manipulation method for table data. Since: 1.10 + */ + dataSrc?: string | Function; + } + + interface FunctionAjax { + (data: Object, callback: Function, settings: SettingsLegacy): void; + } + + interface FunctionAjaxData { + (data: Object): string | Object; + } + + //#endregion "ajax-settings" + + //#region "colunm-settings" + + export interface ColumnSettings { + /** + * Cell type to be created for a column. th/td Since: 1.10 + */ + cellType?: string; + + /** + * Class to assign to each cell in the column. Since: 1.10 + */ + className?: string; + + /** + * Add padding to the text content used when calculating the optimal with for a table. Since: 1.10 + */ + contentPadding?: string; + + /** + * Cell created callback to allow DOM manipulation. Since: 1.10 + */ + createdCell?: FunctionColumnCreatedCell; + + /** + * Class to assign to each cell in the column. Since: 1.10 + */ + data?: number | string | ObjectColumnData | FunctionColumnData; + + /** + * Set default, static, content for a column. Since: 1.10 + */ + defaultContent?: string; + + /** + * Set a descriptive name for a column. Since: 1.10 + */ + name?: string; + + /** + * Enable or disable ordering on this column. Since: 1.10 + */ + orderable?: boolean; + + /** + * Define multiple column ordering as the default order for a column. Since: 1.10 + */ + orderData?: number | number[]; + + /** + * Live DOM sorting type assignment. Since: 1.10 + */ + orderDataType?: string; + + /** + * Order direction application sequence. Since: 1.10 + */ + orderSequence?: string[]; + + /** + * Render (process) the data for use in the table. Since: 1.10 + */ + render?: number | string | ObjectColumnRender | FunctionColumnRender; + + /** + * Enable or disable filtering on the data in this column. Since: 1.10 + */ + searchable?: boolean; + + /** + * Set the column title. Since: 1.10 + */ + title?: string; + + /** + * Set the column type - used for filtering and sorting string processing. Since: 1.10 + */ + type?: string; + + /** + * Enable or disable the display of this column. Since: 1.10 + */ + visible?: boolean; + + /** + * Column width assignment. Since: 1.10 + */ + width?: string; + } + + interface ColumnDefsSettings extends ColumnSettings { + targets: string | number | (number | string)[] + } + + interface FunctionColumnCreatedCell { + (cell: Node, cellData: any, rowData: any, row: number, col: number): void; + } + + interface FunctionColumnData { + (row: any, t: string, s: any, meta: Object): void; + } + + interface ObjectColumnData { + _: string; + filter?: string; + display?: string; + type?: string; + sort?: string; + } + + interface ObjectColumnRender extends ObjectColumnData { + } + + interface FunctionColumnRender { + (data: Node, t: Node, row: Node, meta: Object): void; + } + + //#endregion "colunm-settings" + + //#region "other-settings" + + export interface RendererSettings { + header?: string; + pageButton?: string; + } + + export interface SearchSettings { + /** + * Control case-sensitive filtering option. Since: 1.10 + */ + caseInsensitive?: boolean; + + /** + * Enable / disable escaping of regular expression characters in the search term. Since: 1.10 + */ + regex?: boolean; + + /** + * Enable / disable DataTables' smart filtering. Since: 1.10 + */ + smart?: boolean; + + /** + * Set an initial filtering condition on the table. Since: 1.10 + */ + search?: string; + } + + //#endregion "other-settings" + + //#region "callback-functions" + + interface FunctionCreateRow { + (row: Node, data: any[]| Object, dataIndex: number): void; + } + + interface FunctionDrawCallback { + (settings: SettingsLegacy): void; + } + + interface FunctionFooterCallback { + (tfoot: Node, data: any[], start: number, end: number, display: any[]): void; + } + + interface FunctionFormatNumber { + (formatNumber: number): void; + } + + interface FunctionHeaderCallback { + (thead: Node, data: any[], start: number, end: number, display: any[]): void; + } + + interface FunctionInfoCallback { + (settings: SettingsLegacy, start: number, end: number, mnax: number, total: number, pre: string): void; + } + + interface FunctionInitComplete { + (settings: SettingsLegacy, json: Object): void; + } + + interface FunctionPreDrawCallback { + (settings: SettingsLegacy): void; + } + + interface FunctionRowCallback { + (row: Node, data: any[]| Object): void; + } + + interface FunctionStateLoadCallback { + (settings: SettingsLegacy): void; + } + + interface FunctionStateLoaded { + (settings: SettingsLegacy, data: Object): void; + } + + interface FunctionStateLoadParams { + (settings: SettingsLegacy, data: Object): void; + } + + interface FunctionStateSaveCallback { + (settings: SettingsLegacy, data: Object): void; + } + + interface FunctionStateSaveParams { + (settings: SettingsLegacy, data: Object): void; + } + + //#endregion "callback-functions" + + //#region "language-settings" + + interface LanguageSettings { + emptyTable: string; + info: string; + infoEmpty: string; + infoFiltered: string; + infoPostFix: string; + thousands: string; + lengthMenu: string; + loadingRecords: string; + processing: string; + search: string; + zeroRecords: string; + paginate: LanguagePaginateSettings; + aria: LanguageAriaSettings; + } + + interface LanguagePaginateSettings { + first: string; + last: string; + next: string; + previous: string; + } + + interface LanguageAriaSettings { + sortAscending: string; + sortDescending: string; + } + + //#endregion "language-settings" + + //#endregion "Settings" + + //#region "SettingsLegacy" + + interface ArrayStringNode { + [index: string]: Node; + } + + export interface SettingsLegacy { + ajax: any; + oApi: any; + oFeatures: FeaturesLegacy; + oScroll: ScrollingLegacy; + oLanguage: LanguageLegacy; // | { fnInfoCallback: FunctionInfoCallback; }; + oBrowser: { bScrollOversize: boolean; }; + aanFeatures: ArrayStringNode[][]; + aoData: RowLegacy[]; + aiDisplay: number[]; + aiDisplayMaster: number[]; + aoColumns: ColumnLegacy[]; + aoHeader: any[]; + aoFooter: any[]; + asDataSearch: string[]; + oPreviousSearch: any; + aoPreSearchCols: any[]; + aaSorting: any[][]; + aaSortingFixed: any[][]; + asStripeClasses: string[]; + asDestroyStripes: string[]; + sDestroyWidth: number; + aoRowCallback: FunctionRowCallback[]; + aoHeaderCallback: FunctionHeaderCallback[]; + aoFooterCallback: FunctionFooterCallback[]; + aoDrawCallback: FunctionDrawCallback[]; + aoRowCreatedCallback: FunctionCreateRow[]; + aoPreDrawCallback: FunctionPreDrawCallback[]; + aoInitComplete: FunctionInitComplete[]; + aoStateSaveParams: FunctionStateSaveParams[]; + aoStateLoadParams: FunctionStateLoadParams[]; + aoStateLoaded: FunctionStateLoaded[]; + sTableId: string; + nTable: Node; + nTHead: Node; + nTFoot: Node; + nTBody: Node; + nTableWrapper: Node; + bDeferLoading: boolean; + bInitialized: boolean; + aoOpenRows: any[]; + sDom: string; + sPaginationType: string; + iCookieDuration: number; + sCookiePrefix: string; + fnCookieCallback: CookieCallbackLegacy; + aoStateSave: FunctionStateSaveCallback[]; + aoStateLoad: FunctionStateLoadCallback[]; + oLoadedState: any; + sAjaxSource: string; + sAjaxDataProp: string; + bAjaxDataGet: boolean; + jqXHR: any; + fnServerData: any; + aoServerParams: any[]; + sServerMethod: string; + fnFormatNumber: FunctionFormatNumber; + aLengthMenu: any[]; + iDraw: number; + bDrawing: boolean; + iDrawError: number; + _iDisplayLength: number; + _iDisplayStart: number; + _iDisplayEnd: number; + _iRecordsTotal: number; + _iRecordsDisplay: number; + bJUI: boolean; + oClasses: any; + bFiltered: boolean; + bSorted: boolean; + bSortCellsTop: boolean; + oInit: any; + aoDestroyCallback: any[]; + fnRecordsTotal: () => number; + fnRecordsDisplay: () => number; + fnDisplayEnd: () => number; + oInstance: any; + sInstance: string; + iTabIndex: number; + nScrollHead: Node; + nScrollFoot: Node; + } + + export interface FeaturesLegacy { + bAutoWidth: boolean; + bDeferRender: boolean; + bFilter: boolean; + bInfo: boolean; + bLengthChange: boolean; + bPaginate: boolean; + bProcessing: boolean; + bServerSide: boolean; + bSort: boolean; + bSortClasses: boolean; + bStateSave: boolean; + } + + export interface ScrollingLegacy { + bAutoCss: boolean; + bCollapse: boolean; + bInfinite: boolean; + iBarWidth: number; + iLoadGap: number; + sX: string; + sY: string; + } + + export interface RowLegacy { + nTr: Node; + _aData: any; + _aSortData: any[]; + _anHidden: Node[]; + _sRowStripe: string; + } + + export interface ColumnLegacy { + aDataSort: any; + asSorting: string[]; + bSearchable: boolean; + bSortable: boolean; + bVisible: boolean; + _bAutoType: boolean; + fnCreatedCell: FunctionColumnCreatedCell; + fnGetData: (data: any, specific: string) => any; + fnSetData: (data: any, value: any) => void; + mData: any; + mRender: any; + nTh: Node; + nIf: Node; + sClass: string; + sContentPadding: string; + sDefaultContent: string; + sName: string; + sSortDataType: string; + sSortingClass: string; + sSortingClassJUI: string; + sTitle: string; + sType: string; + sWidth: string; + sWidthOrig: string; + } + + export interface CookieCallbackLegacy { + (name: string, data: any, expires: string, path: string, cookie: string): void; + } + + export interface LanguageLegacy { + oAria?: LanguageAriaLegacy; + oPaginate?: LanguagePaginateLegacy; + sEmptyTable?: string; + sInfo?: string; + sInfoEmpty?: string; + sInfoFiltered?: string; + sInfoPostFix?: string; + sInfoThousands?: string; + sLengthMenu?: string; + sLoadingRecords?: string; + sProcessing?: string; + sSearch?: string; + sUrl?: string; + sZeroRecords?: string; + } + + export interface LanguageAriaLegacy { + sSortAscending?: string; + sSortDescending?: string; + } + + export interface LanguagePaginateLegacy { + sFirst?: string; + sLast?: string; + sNext?: string; + sPrevious?: string; + } + //#endregion "SettingsLegacy" + } \ No newline at end of file From cc4234e4c707f3aeaca5c2554f5843d3431de628 Mon Sep 17 00:00:00 2001 From: Kiarash Ghiaseddin Date: Wed, 25 Mar 2015 17:57:32 +0100 Subject: [PATCH 05/31] Update header --- jquery.dataTables/jquery.dataTables.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index afeb01f0f..f57690b67 100755 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -1,6 +1,6 @@ -// Type definitions for JQuery DataTables 1.10.5 +// Type definitions for JQuery DataTables 1.10.5 // Project: http://www.datatables.net -// Definitions by: Kiarash Ghiaseddin +// Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander // Definitions: https://github.com/borisyankov/DefinitelyTyped // missing: From dac611a93ddc7bf24f0895d2bc46e25fcaabf521 Mon Sep 17 00:00:00 2001 From: Kiarash Ghiaseddin Date: Wed, 25 Mar 2015 19:31:16 +0100 Subject: [PATCH 06/31] Add missing reference path to jquery.d.td --- jquery.dataTables/jquery.dataTables.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index f57690b67..cbcb1c025 100755 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -8,6 +8,8 @@ // - Plugin and extension definitions are not typed. // - Some return types are not fully wokring +/// + interface JQuery { DataTable(param?: DataTables.Settings): DataTables.DataTable; } From 48de82851fc527418d3aba632e172fa0a889f3cd Mon Sep 17 00:00:00 2001 From: Adam Carr Date: Mon, 30 Mar 2015 16:19:10 -0400 Subject: [PATCH 07/31] Updating hapi.d.ts to support optional parameters when registering a plugin --- hapi/hapi-tests.ts | 6 ++++++ hapi/hapi.d.ts | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts index 058903637..c0f8d9f6e 100644 --- a/hapi/hapi-tests.ts +++ b/hapi/hapi-tests.ts @@ -21,6 +21,12 @@ plugin.register.attributes = { version: "1.0.0" }; +// optional options parameter +server.register({}, function (err) {}); + +// optional options.routes.vhost parameter +server.register({}, { select: 'api', routes: { prefix: '/prefix' } }, function (err) {}); + //server.pack.register(plugin, (err: Object) => { // if (err) { throw err; } //}); diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 61a2ef2d5..be2bf9665 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -2051,11 +2051,13 @@ declare module "hapi" { register(plugins: any|any[], options: { select: string|string[]; routes: { - prefix: string; vhost: string|string[] + prefix: string; vhost?: string|string[] }; } , callback: (err: any) => void):void; + register(plugins: any|any[], callback: (err: any) => void):void; + /**server.render(template, context, [options], callback) Utilizes the server views manager to render a template where: template - the template filename and path, relative to the views manager templates path (path or relativeTo). From 25ab55fa3c9089785ad814dd42a296c92185c553 Mon Sep 17 00:00:00 2001 From: Adam Carr Date: Mon, 30 Mar 2015 18:33:01 -0400 Subject: [PATCH 08/31] making IRouteHandlerConfig parameters optional --- hapi/hapi.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index be2bf9665..77eaf8f08 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -726,7 +726,7 @@ declare module "hapi" { a relative or absolute file path string (relative paths are resolved based on the route files configuration). a function with the signature function(request) which returns the relative or absolute file path. an object with the following options */ - file: string | IRequestHandler |IFileHandlerConfig; + file?: string | IRequestHandler |IFileHandlerConfig; /** directory - generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. @@ -738,7 +738,7 @@ declare module "hapi" { redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension.*/ - directory: { + directory?: { path: string |Array | IRequestHandler | IRequestHandler>; index?: boolean; listing?: boolean; @@ -748,7 +748,7 @@ declare module "hapi" { defaultExtension?: string; }; proxy?: IProxyHandlerConfig; - view: string | { + view?: string | { template: string; context: { payload: any; @@ -757,7 +757,7 @@ declare module "hapi" { pre: any; } }; - config: { + config?: { handler: any; bind: any; app: any; From e3224233793afdbfd918512551a11952a5e7e03e Mon Sep 17 00:00:00 2001 From: Adam Carr Date: Mon, 30 Mar 2015 18:43:43 -0400 Subject: [PATCH 09/31] updating IServerOptions for optional properties --- hapi/hapi.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 77eaf8f08..2cd06cd6e 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -147,11 +147,11 @@ declare module "hapi" { }; /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ - mime: any; + mime?: any; /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ - minimal: boolean; + minimal?: boolean; /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ - plugins: IDictionary; + plugins?: IDictionary; } From 04a29d46fc780188fa5af890c17e87ce5d85ec04 Mon Sep 17 00:00:00 2001 From: Mark Wong Siang Kai Date: Mon, 30 Mar 2015 16:20:23 -0700 Subject: [PATCH 10/31] Added more keyboard events to d3.event -- these events come from https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent but I didn't include all of them --- d3/d3-tests.ts | 16 +++++++++++++++- d3/d3.d.ts | 4 +++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 51c51f608..673375e8f 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -2656,4 +2656,18 @@ function multiTest() { .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis); -} \ No newline at end of file +} + +// Tests miscellaneous keyboard events +function keyboardEventsTest() { + var keyPressed: string; + d3.select("body").on("keydown", () => { + if (d3.event.metaKey) { + keyPressed = "meta"; + } else if (d3.event.ctrlKey) { + keyPressed = "ctrl"; + } else if (d3.event.altKey) { + keyPressed = "alt"; + } + }); +} diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 57e817818..4df7c1aa3 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -57,7 +57,9 @@ declare module D3 { x: number; y: number; keyCode: number; - altKey: any; + altKey?: boolean; + ctrlKey?: boolean; + metaKey?: boolean; type: string; } From 0d0f43a40f0f56682b63f1253d3ca5e9198e840e Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Wed, 1 Apr 2015 18:29:21 +0900 Subject: [PATCH 11/31] Onsen UI type definitions --- onsenui/onsenui.d.ts | 1017 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1017 insertions(+) create mode 100644 onsenui/onsenui.d.ts diff --git a/onsenui/onsenui.d.ts b/onsenui/onsenui.d.ts new file mode 100644 index 000000000..287c8e2f5 --- /dev/null +++ b/onsenui/onsenui.d.ts @@ -0,0 +1,1017 @@ +// Type definitions for Onsen UI +// Project: http://onsen.io +// Definitions by: Fran Dios +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +// Some useful types +interface stringArray { + [index: number]: string; +} + +interface objectArray { + [index: number]: any; +} + + +/** + * @description Should be used as root component of each page. The content inside page component is scrollable + */ +interface PageView { + /** + * @return {Object} Device back button handler + * @description Get the associated back button handler. This method may return null if no handler is assigned + */ + getDeviceBackButtonHandler(): any; +} + +/** + * @description Carousel component + */ +interface CarouselView { + /** + * @description Show next ons-carousel item + */ + next(): void; + /** + * @description Show previous ons-carousel item + */ + prev(): void; + /** + * @description Show first ons-carousel item + */ + first(): void; + /** + * @description Show last ons-carousel item + */ + last(): void; + /** + * @param {Booelan} swipeable If value is true the carousel will be swipeable + * @description Set whether the carousel is swipeable or not + */ + setSwipeable(swipeable: boolean): void; + /** + * @return {Boolean} true if the carousel is swipeable + * @description Returns whether the carousel is swipeable or not + */ + isSwipeable(): boolean; + /** + * @param {Number} index The index that the carousel should be set to + * @description Specify the index of the ons-carousel-item to show + */ + setActiveCarouselItemIndex(index: number): void; + /** + * @return {Number} The current carousel item index + * @description Returns the index of the currently visible ons-carousel-item + */ + getActiveCarouselItemIndex(): number; + /** + * @param {Boolean} enabled If true auto scroll will be enabled + * @description Enable or disable "auto-scroll" attribute + */ + setAutoScrollEnabled(enabled: boolean): void; + /** + * @return {Boolean} true if auto scroll is enabled + * @description Returns whether the "auto-scroll" attribute is set or not + */ + isAutoScrollEnabled(): boolean; + /** + * @param {Number} ratio The desired ratio + * @description Set the auto scroll ratio. Must be a value between 0.0 and 1.0 + */ + setAutoScrollRatio(ratio: number): void; + /** + * @return {Number} The current auto scroll ratio + * @description Returns the current auto scroll ratio + */ + getAutoScrollRatio(): number; + /** + * @param {Boolean} overscrollable If true the carousel will be overscrollable + * @description Set whether the carousel is overscrollable or not + */ + setOverscrollable(overscrollable: boolean): void; + /** + * @return {Boolean} Whether the carousel is overscrollable or not + * @description Returns whether the carousel is overscrollable or not + */ + isOverscrollable(): boolean; + /** + * @description Update the layout of the carousel. Used when adding ons-carousel-items dynamically or to automatically adjust the size + */ + refresh(): void; + /** + * @return {Boolean} Whether the carousel is disabled or not + * @description Returns whether the dialog is disabled or enabled + */ + isDisabled(): boolean; + /** + * @param {Boolean} disabled If true the carousel will be disabled + * @description Disable or enable the dialog + */ + setDisabled(disabled: boolean): void; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +/** + * @description Component that adds "pull-to-refresh" to an element + */ +interface PullHookView { + /** + * @param {Boolean} disabled If true the pull hook will be disabled + * @description Disable or enable the component + */ + setDisabled(disabled: boolean): void; + /** + * @return {Boolean} true if the pull hook is disabled + * @description Returns whether the component is disabled or enabled + */ + isDisabled(): boolean; + /** + * @param {Number} height Desired height + * @description Specify the height + */ + setHeight(height: number): void; + /** + * @param {Number} thresholdHeight Desired threshold height + * @description Specify the threshold height + */ + setThresholdHeight(thresholdHeight: number): void; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +/** + * @description Divides the screen into a left and right section + */ +interface SplitView { + /** + * @param {String} pageUrl Page URL. Can be either an HTML document or an + * @description Show the page specified in pageUrl in the right section + */ + setMainPage(pageUrl: string): void; + /** + * @param {String} pageUrl Page URL. Can be either an HTML document or an + * @description Show the page specified in pageUrl in the left section + */ + setSecondaryPage(pageUrl: string): void; + /** + * @description Trigger an 'update' event and try to determine if the split behaviour should be changed + */ + update(): void; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +interface dialogOptions { + animation?: string; + callback?: any; +} + + +/** + * @modifier android Display an Android style alert dialog + * @description Alert dialog that is displayed on top of the current screen + */ +interface AlertDialogView { + /** + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "fade", "slide" and "none" + * @param {Function} [options.callback] Function to execute after the dialog has been revealed + * @description Show the alert dialog + */ + show(options?: dialogOptions): void; + /** + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "fade", "slide" and "none" + * @param {Function} [options.callback] Function to execute after the dialog has been hidden + * @description Hide the alert dialog + */ + hide(options?: dialogOptions): void; + /** + * @description Returns whether the dialog is visible or not + * @return {Boolean} true if the dialog is currently visible + */ + isShown(): boolean; + /** + * @description Destroy the alert dialog and remove it from the DOM tree + */ + destroy(): void; + /** + * @description Define whether the dialog can be canceled by the user or not + * @param {Boolean} cancelable If true the dialog will be cancelable + */ + setCancelable(cancelable: boolean): void; + /** + * @description Returns whether the dialog is cancelable or not + * @return {Boolean} true if the dialog is cancelable + */ + isCancelable(): boolean; + /** + * @description Disable or enable the alert dialog + * @param {Boolean} disabled If true the dialog will be disabled + */ + setDisabled(disabled: boolean): void; + /** + * @description Returns whether the dialog is disabled or enabled + * @return {Boolean} true if the dialog is disabled + */ + isDisabled(): boolean; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +/** + * @description Dialog that is displayed on top of current screen + */ +interface DialogView { + /** + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide" + * @param {Function} [options.callback] This function is called after the dialog has been revealed + * @description Show the dialog + */ + show(options?: dialogOptions): void; + /** + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide" + * @param {Function} [options.callback] This functions is called after the dialog has been hidden + * @description Hide the dialog + */ + hide(options?: dialogOptions): void; + /** + * @description Returns whether the dialog is visible or not + * @return {Boolean} true if the dialog is visible + */ + isShown(): boolean; + /** + * @description Destroy the dialog and remove it from the DOM tree + */ + destroy(): void; + /** + * @return {Object} Device back button handler + * @description Retrieve the back button handler for overriding the default behavior + */ + getDeviceBackButtonHandler(): any; + /** + * @param {Boolean} cancelable If true the dialog will be cancelable + * @description Define whether the dialog can be canceled by the user or not + */ + setCancelable(cancelable: boolean): void; + /** + * @description Returns whether the dialog is cancelable or not + * @return {Boolean} true if the dialog is cancelable + */ + isCancelable(): boolean; + /** + * @description Disable or enable the dialog + * @param {Boolean} disabled If true the dialog will be disabled + */ + setDisabled(disabled: boolean): void; + /** + * @description Returns whether the dialog is disabled or enabled + * @return {Boolean} true if the dialog is disabled + */ + isDisabled(): boolean; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +/** + * @modifier outline Button with outline and transparent background + * @modifier light Button that doesn't stand out + * @modifier quiet Button with no outline and or background + * @modifier cta Button that really stands out + * @modifier large Large button that covers the width of the screen + * @modifier large--quiet Large quiet button + * @modifier large--cta Large call to action button + * @description Button component. If you want to place a button in a toolbar, use ons-toolbar-button or ons-back-button instead + */ +interface ButtonView { + /** + * @description Show spinner on the button + */ + startSpin(): void; + /** + * @description Remove spinner from button + */ + stopSpin(): void; + /** + * @return {Boolean} true if the button is spinning + * @description Return whether the spinner is visible or not + */ + isSpinning(): boolean; + /** + * @description Set spin animation. Possible values are "slide-left" (default), "slide-right", "slide-up", "slide-down", "expand-left", "expand-right", "expand-up", "expand-down", "zoom-out", "zoom-in" + * @param {String} animation Animation name + */ + setSpinAnimation(animation: string): void; + /** + * @description Disable or enable the button + */ + setDisabled(disabled: boolean): void; + /** + * @return {Boolean} true if the button is disabled + * @description Returns whether the button is disabled or enabled + */ + isDisabled(): boolean; +} + +/** + * @description Switch component + */ +interface SwitchView { + /** + * @return {Boolean} true if the switch is on + * @description Returns true if the switch is ON + */ + isChecked(): boolean; + /** + * @param {Boolean} checked If true the switch will be set to on + * @description Set the value of the switch. isChecked can be either true or false + */ + setChecked(checked: boolean): void; + /** + * @return {HTMLElement} The underlying checkbox element + * @description Get inner input[type=checkbox] element + */ + getCheckboxElement(): HTMLElement; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +/** + * @description + * Modal component that masks current screen + * Underlying components are not subject to any events while the modal component is shown + */ +interface ModalView { + /** + * @description Toggle modal visibility + */ + toggle(): void; + /** + * @description Show modal + */ + show(): void; + /** + * @description Hide modal + */ + hide(): void; + /** + * @return {Object} Device back button handler + * @description Retrieve the back button handler + */ + getDeviceBackButtonHandler(): any; +} + +interface navigatorOptions { + animation?: string; + onTransitionEnd?: any; +} + +/** + * @description A component that provides page stack management and navigation. This component does not have a visible content + */ +interface NavigatorView { + /** + * @param {String} pageUrl Page URL. Can be either a HTML document or a <ons-template> + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none" + * @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended + * @description Pushes the specified pageUrl into the page stack + */ + pushPage(pageUrl: string, options?: navigatorOptions): void; + /** + * @param {Number} index The index where it should be inserted + * @param {String} pageUrl Page URL. Can be either a HTML document or a <ons-template> + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none" + * @description Insert the specified pageUrl into the page stack with specified index + */ + insertPage(index: number, pageUrl: string, options?: navigatorOptions): void; + /** + * @param {Object} [options] Parameter object + * @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended + * @description Pops the current page from the page stack. The previous page will be displayed + */ + popPage(options?: navigatorOptions): void; + /** + * @param {String} pageUrl Page URL. Can be either a HTML document or an <ons-template> + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none" + * @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended + * @description Clears page stack and adds the specified pageUrl to the page stack + */ + resetToPage(pageUrl: string, options?: navigatorOptions): void; + /** + * @return {Object} Current page object + * @description Get current page's navigator item. Use this method to access options passed by pushPage() or resetToPage() method + */ + getCurrentPage(): any; + /** + * @return {List} List of page objects + * @description Retrieve the entire page stack of the navigator + */ + getPages(): objectArray; + /** + * @return {Object} Device back button handler + * @description Retrieve the back button handler for overriding the default behavior + */ + getDeviceBackButtonHandler(): any; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +interface slidingMenuOptions { + closeMenu?: boolean; + callback?: any; +} + +/** + * @description Component for sliding UI where one page is overlayed over another page. The above page can be slided aside to reveal the page behind + */ +interface SlidingMenuView { + /** + * @param {String} pageUrl Page URL. Can be either an HTML document or an <ons-template> + * @param {Object} [options] Parameter object + * @param {Boolean} [options.closeMenu] If true the menu will be closed + * @param {Function} [options.callback] Function that is executed after the page has been set + * @description Show the page specified in pageUrl in the main contents pane + */ + setMainPage(pageUrl: string, options?: slidingMenuOptions): void; + /** + * @param {String} pageUrl Page URL. Can be either an HTML document or an <ons-template> + * @param {Object} [options] Parameter object + * @param {Boolean} [options.closeMenu] If true the menu will be closed after the menu page has been set + * @param {Function} [options.callback] This function will be executed after the menu page has been set + * @description Show the page specified in pageUrl in the side menu pane + */ + setMenuPage(pageUrl: string, options?: slidingMenuOptions): void; + /** + * @param {Object} [options] Parameter object + * @param {Function} [options.callback] This function will be called after the menu has been opened + * @description Slide the above layer to reveal the layer behind + */ + openMenu(options?: slidingMenuOptions): void; + /** + * @param {Object} [options] Parameter object + * @param {Function} [options.callback] This function will be called after the menu has been closed + * @description Slide the above layer to hide the layer behind + */ + closeMenu(options?: slidingMenuOptions): void; + /** + * @param {Object} [options] Parameter object + * @param {Function} [options.callback] This function will be called after the menu has been opened or closed + * @description Slide the above layer to reveal the layer behind if it is currently hidden, otherwise, hide the layer behind + */ + toggleMenu(options?: slidingMenuOptions): void; + /** + * @return {Boolean} true if the menu is currently open + * @description Returns true if the menu page is open, otherwise false + */ + isMenuOpened(): boolean; + /** + * @return {Object} Device back button handler + * @description Retrieve the back-button handler + */ + getDeviceBackButtonHandler(): any; + /** + * @param {Boolean} swipeable If true the menu will be swipeable + * @description Specify if the menu should be swipeable or not + */ + setSwipeable(swipeable: boolean): void; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +interface tabbarOptions { + keepPage?: boolean; +} + +/** + * @description A component to display a tab bar on the bottom of a page. Used with ons-tab to manage pages using tabs + */ +interface TabbarView { + /** + * @param {Number} index Tab index + * @param {Object} [options] Parameter object + * @param {Boolean} [options.keepPage] If true the page will not be changed + * @param {String} [options.animation] Animation name. Available animations are "fade" and "none" + * @return {Boolean} true if the change was successful + * @description Show specified tab page. Animations and other options can be specified by the second parameter + */ + setActiveTab(index: number, options?: tabbarOptions): boolean; + /** + * @return {Number} The index of the currently active tab + * @description Returns tab index on current active tab. If active tab is not found, returns -1 + */ + getActiveTab(): number; + /** + * @param {String} url Page URL. Can be either an HTML document or an <ons-template> + * @description Displays a new page without changing the active index + */ + loadPage(url: string): void; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +interface popoverOptions { + animation?: string; +} + +/** + * @modifier android Display an Android style popover + * @description A component that displays a popover next to an element + */ +interface PopoverView { + /** + * @param {String|Event|HTMLElement} target Target element. Can be either a CSS selector, an event object or a DOM element + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "fade" and "none" + * @description Open the popover and point it at a target. The target can be either an event, a css selector or a DOM element + */ + show(target: any, options?: popoverOptions): void; + /** + * @param {Object} [options] Parameter object + * @param {String} [options.animation] Animation name. Available animations are "fade" and "none" + * @description Close the popover + */ + hide(options?: popoverOptions): void; + /** + * @return {Boolean} true if the popover is visible + * @description Returns whether the popover is visible or not + */ + isShown(): boolean; + /** + * @description Destroy the popover and remove it from the DOM tree + */ + destroy(): void; + /** + * @param {Boolean} cancelable If true the popover will be cancelable + * @description Set whether the popover can be canceled by the user when it is shown + */ + setCancelable(cancelable: boolean): void; + /** + * @return {Boolean} true if the popover is cancelable + * @description Returns whether the popover is cancelable or not + */ + isCancelable(): boolean; + /** + * @param {Boolean} disabled If true the popover will be disabled + * @description Disable or enable the popover + */ + setDisabled(disabled: boolean): void; + /** + * @return {Boolean} true if the popover is disabled + * @description Returns whether the popover is disabled or enabled + */ + isDisabled(): boolean; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +//# Onsen Objects + +/** + * @description A global object that's used in Onsen UI. This object can be reached from the AngularJS scope + */ +interface onsStatic { + /** + * @description Method used to wait for app initialization. The callback will not be executed until Onsen UI has been completely initialized + * @param {Function} callback Function that executes after Onsen UI has been initialized + */ + ready(callback: any): void; + /** + * @description Initialize Onsen UI. Can be used to load Onsen UI without using the ng-app attribute from AngularJS + * @param {String} [moduleName] AngularJS module name + * @param {Array} [dependencies] List of AngularJS module dependencies + * @return {Object} An AngularJS module object + */ + bootstrap(moduleName?: string, dependencies?: objectArray): any; + /** + * @description Enable status bar fill feature on iOS7 and above + */ + enableAutoStatusBarFill(): void; + /** + * @description Disable status bar fill feature on iOS7 and above + */ + disableAutoStatusBarFill(): void; + /** + * @param {String} name Name of component, i.e. 'ons-page' + * @param {Object|jqLite|HTMLElement} [dom] $event, jqLite or HTMLElement object + * @return {Object} Component object. Will return null if no component was found + * @description Find parent component object of dom element + */ + findParentComponentUntil(name: string, dom?: any): any; + /** + * @param {String} selector CSS selector + * @param {HTMLElement} [dom] DOM element to search from + * @return {Object} Component object. Will return null if no component was found + * @description Find component object using CSS selector + */ + findComponent(selector: string, dom?: HTMLElement): any; + /** + * @param {Function} listener Function that executes when device back button is pressed + * @description Set default handler for device back button + */ + setDefaultDeviceBackButtonListener(listener: (eventObject: any) => any): void; + /** + * @description Disable device back button event handler + */ + disableDeviceBackButtonHandler(): void; + /** + * @description Enable device back button event handler + */ + enableDeviceBackButtonHandler(): void; + /** + * @return {Boolean} Will be true if Onsen UI is initialized + * @description Returns true if Onsen UI is initialized + */ + isReady(): boolean; + /** + * @param {HTMLElement} dom Element to compile + * @description Compile Onsen UI components + */ + compile(dom: HTMLElement): void; + /** + * @return {Boolean} Will be true if the app is running in Cordova + * @description Returns true if running inside Cordova + */ + isWebView(): boolean; + /** + * @param {String} page Page name. Can be either an HTML file or an containing a component + * @param {Object} [options] Parameter object + * @param {Object} [options.parentScope] Parent scope of the dialog. Used to bind models and access scope methods from the dialog + * @return {Promise} Promise object that resolves to the alert dialog component object + * @description Create a alert dialog instance from a template + */ + createAlertDialog(page: string): any; + /** + * @param {String} page Page name. Can be either an HTML file or an containing a component + * @param {Object} [options] Parameter object + * @param {Object} [options.parentScope] Parent scope of the dialog. Used to bind models and access scope methods from the dialog + * @return {Promise} Promise object that resolves to the dialog component object + * @description Create a dialog instance from a template + */ + createDialog(page: string): any; + /** + * @param {String} page Page name. Can be either an HTML file or an containing a component + * @param {Object} [options] Parameter object + * @param {Object} [options.parentScope] Parent scope of the dialog. Used to bind models and access scope methods from the dialog + * @return {Promise} Promise object that resolves to the popover component object + * @description Create a popover instance from a template + */ + createPopover(page: string): any; + + /** + * @description Utility methods to create different kinds of alert dialogs. There are three methods available: alert, confirm and prompt + */ + notification: onsNotification; + + /** + * @description Utility methods for orientation detection + */ + orientation: onsOrientation; + + /** + * @description Utility methods to detect current platform + */ + platform: onsPlatform; +} + + +interface alertOptions { + message?: string; + messageHTML?: string; + buttonLabel?: string; + buttonLabels?: stringArray; + primaryButtonIndex?: number; + cancelable?: boolean; + animation?: string; + title?: string; + modifier?: string; + callback?: any; +} + +interface onsNotification { + /** + * @param {Object} options Parameter object + * @param {String} [options.message] Alert message + * @param {String} [options.messageHTML] Alert message in HTML + * @param {String} [options.buttonLabel] Label for confirmation button. Default is "OK" + * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide" + * @param {String} [options.title] Dialog title. Default is "Alert" + * @param {String} [options.modifier] Modifier for the dialog + * @param {Function} [options.callback] Function that executes after dialog has been closed + * @description + * Display an alert dialog to show the user a message + * The content of the message can be either simple text or HTML + * Must specify either message or messageHTML + */ + alert(options: alertOptions): void; + /** + * @param {Object} options Parameter object + * @param {String} [options.message] Confirmation question + * @param {String} [options.messageHTML] Dialog content in HTML + * @param {Array} [options.buttonLabels] Labels for the buttons. Default is ["Cancel", "OK"] + * @param {Number} [options.primaryButtonIndex] Index of primary button. Default is 1 + * @param {Boolean} [options.cancelable] Whether the dialog is cancelable or not. Default is false + * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide" + * @param {String} [options.title] Dialog title. Default is "Confirm" + * @param {String} [options.modifier] Modifier for the dialog + * @param {Function} [options.callback] + * Function that executes after the dialog has been closed + * Argument for the function is the index of the button that was pressed or -1 if the dialog was canceled + * @description + * Display a dialog to ask the user for confirmation + * The default button labels are "Cancel" and "OK" but they can be customized + * Must specify either message or messageHTML + */ + confirm(options: alertOptions): void; + /** + * @param {Object} options Parameter object + * @param {String} [options.message] Prompt question + * @param {String} [options.messageHTML] Dialog content in HTML + * @param {String} [options.buttonLabel] Label for confirmation button. Default is "OK" + * @param {Number} [options.primaryButtonIndex] Index of primary button. Default is 1 + * @param {Boolean} [options.cancelable] Whether the dialog is cancelable or not. Default is false + * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide" + * @param {String} [options.title] Dialog title. Default is "Alert" + * @param {String} [options.modifier] Modifier for the dialog + * @param {Function} [options.callback] + * Function that executes after the dialog has been closed + * Argument for the function is the value of the input field or null if the dialog was canceled + * @description + * Display a dialog with a prompt to ask the user a question + * Must specify either message or messageHTML + */ + prompt(options: alertOptions): void; +} + +interface onsOrientation { + /** + * @return {Boolean} Will be true if the current orientation is portrait mode + * @description Returns whether the current screen orientation is portrait or not + */ + isPortrait(): boolean; + /** + * @return {Boolean} Will be true if the current orientation is landscape mode + * @description Returns whether the current screen orientation is landscape or not + */ + isLandscape(): boolean; + /** + * @description Add an event listener + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + on(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Add an event listener that's only triggered once + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + once(eventName: string, listener: (eventObject: any) => any): void; + /** + * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed + * @param {String} eventName Name of the event + * @param {Function} listener Function to execute when the event is triggered + */ + off(eventName: string, listener?: (eventObject: any) => any): void; +} + +interface onsPlatform { + /** + * @description Returns whether app is running in Cordova + * @return {Boolean} + */ + isWebView(): boolean; + + /** + * @description Returns whether the OS is iOS + * @return {Boolean} + */ + isIOS(): boolean; + + /** + * @description Returns whether the OS is Android + * @return {Boolean} + */ + isAndroid(): boolean; + + /** + * @description Returns whether the device is iPhone + * @return {Boolean} + */ + isIPhone(): boolean; + + /** + * @description Returns whether the device is iPad + * @return {Boolean} + */ + isIPad(): boolean; + + /** + * @description Returns whether the device is BlackBerry + * @return {Boolean} + */ + isBlackBerry(): boolean; + + /** + * @description Returns whether the browser is Opera + * @return {Boolean} + */ + isOpera(): boolean; + + /** + * @description Returns whether the browser is Firefox + * @return {Boolean} + */ + isFirefox(): boolean; + + /** + * @description Returns whether the browser is Safari + * @return {Boolean} + */ + isSafari(): boolean; + + /** + * @description Returns whether the browser is Chrome + * @return {Boolean} + */ + isChrome(): boolean; + + /** + * @description Returns whether the browser is Internet Explorer + * @return {Boolean} + */ + isIE(): boolean; + + /** + * @description Returns whether the iOS version is 7 or above + * @return {Boolean} + */ + isIOS7above(): boolean; +} + +declare var ons: onsStatic; From ae8cc62b357e25cd55cd3133eadd34632c95dc06 Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Thu, 2 Apr 2015 15:14:50 +0200 Subject: [PATCH 12/31] on-finished typings --- on-finished/on-finished.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 on-finished/on-finished.d.ts diff --git a/on-finished/on-finished.d.ts b/on-finished/on-finished.d.ts new file mode 100644 index 000000000..b3916f513 --- /dev/null +++ b/on-finished/on-finished.d.ts @@ -0,0 +1,10 @@ +// Type definitions for on-finished v2.2.0 +// Project: https://github.com/jshttp/on-finished +// Definitions by: Honza Dvorsky +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'on-finished' { + + export function onFinished(msg:any, listener:Function):any; + export function isFinished(msg:any):boolean; +} From 2100d88b02ee42e5af6f3c31a9d4c741d4c83c64 Mon Sep 17 00:00:00 2001 From: bilou84 Date: Thu, 2 Apr 2015 19:29:09 +0200 Subject: [PATCH 13/31] threejs/three.d.Ts: Make optional parameters actually optional --- threejs/three.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index b74844407..a9255f3b5 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1211,11 +1211,11 @@ declare module THREE { getObjectByProperty( name: string, value: string, recursive?: boolean ): Object3D; - getWorldPosition(optionalTarget: Vector3): Vector3; - getWorldQuaternion(optionalTarget: Quaternion): Quaternion; - getWorldRotation(optionalTarget: Euler): Euler; - getWorldScale(optionalTarget: Vector3): Vector3; - getWorldDirection(optionalTarget: Vector3): Vector3; + getWorldPosition(optionalTarget?: Vector3): Vector3; + getWorldQuaternion(optionalTarget?: Quaternion): Quaternion; + getWorldRotation(optionalTarget?: Euler): Euler; + getWorldScale(optionalTarget?: Vector3): Vector3; + getWorldDirection(optionalTarget?: Vector3): Vector3; /** * Translates object along arbitrary axis by distance. From d7e1bba687a3d947e681376ba963c2204e3dd71a Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Thu, 2 Apr 2015 19:32:47 +0200 Subject: [PATCH 14/31] adding on-finished tests --- on-finished/on-finished-tests.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 on-finished/on-finished-tests.ts diff --git a/on-finished/on-finished-tests.ts b/on-finished/on-finished-tests.ts new file mode 100644 index 000000000..8e2b4734b --- /dev/null +++ b/on-finished/on-finished-tests.ts @@ -0,0 +1,12 @@ +/// + +function test_finished() { + + var msg = {}; + + var ret = onFinished(msg, () => { + //callback + }); + + var finished: boolean = isFinished(msg); +} From f2a11bab3bc599d5113bafb61913c36bc2fc666f Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Mon, 30 Mar 2015 12:43:32 -0400 Subject: [PATCH 15/31] Add webcomponents.js 0.6.0 typings --- webcomponents.js/webcomponents.js-tests.ts | 39 ++++++++++++++++++ webcomponents.js/webcomponents.js.d.ts | 48 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 webcomponents.js/webcomponents.js-tests.ts create mode 100644 webcomponents.js/webcomponents.js.d.ts diff --git a/webcomponents.js/webcomponents.js-tests.ts b/webcomponents.js/webcomponents.js-tests.ts new file mode 100644 index 000000000..316f9dd8e --- /dev/null +++ b/webcomponents.js/webcomponents.js-tests.ts @@ -0,0 +1,39 @@ +/// + +/* + * Custom Elements + */ +var fooProto = Object.create(HTMLElement.prototype, { + createdCallback() { + // `this` should be the created element + this.getElementsByTagName("a"); + } +}); + +document.registerElement("x-foo", { + prototype: fooProto +}); + +window.CustomElements.hasNative; +window.CustomElements.flags; +window.CustomElements.ready; +window.CustomElements.useNative; + +/* + * HTMLImports + */ + +window.HTMLImports.isIE; +window.HTMLImports.rootDocument.querySelectorAll("div"); +window.HTMLImports.useNative; +window.HTMLImports.whenReady(() => { + return window.HTMLImports.ready === true; +}); + +document.querySelectorAll(`link[type=${window.HTMLImports.IMPORT_LINK_TYPE}`); + +/* + * Web Components + */ +window.WebComponents.flags; + diff --git a/webcomponents.js/webcomponents.js.d.ts b/webcomponents.js/webcomponents.js.d.ts new file mode 100644 index 000000000..43e85373f --- /dev/null +++ b/webcomponents.js/webcomponents.js.d.ts @@ -0,0 +1,48 @@ +// Type definitions for webcomponents.js 0.6.0 +// Project: https://github.com/webcomponents/webcomponentsjs +// Definitions by: Adi Dahiya +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module webcomponents { + + export interface CustomElementInit { + prototype: HTMLElement; + extends?: string; + } + + export interface CustomElementsPolyfill { + hasNative: boolean; + flags: any; + ready: boolean; + useNative: boolean; + } + + export interface HTMLImportsPolyfill { + IMPORT_LINK_TYPE: string; + isIE: boolean; + flags: any; + ready: boolean; + rootDocument: Document; + useNative: boolean; + whenReady(callback: () => void): void; + } + + export interface Polyfill { + flags: any; + } + +} + +declare module "webcomponents.js" { + export = webcomponents; +} + +interface Document { + registerElement(name: string, prototype: webcomponents.CustomElementInit): void; +} + +interface Window { + CustomElements: webcomponents.CustomElementsPolyfill; + HTMLImports: webcomponents.HTMLImportsPolyfill; + WebComponents: webcomponents.Polyfill; +} From 145e8af07a0120fb82c83b493d5adbde895c6cb7 Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Thu, 2 Apr 2015 20:13:08 +0200 Subject: [PATCH 16/31] on-finished fixed tests --- on-finished/on-finished-tests.ts | 11 +++++++---- on-finished/on-finished.d.ts | 8 +++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/on-finished/on-finished-tests.ts b/on-finished/on-finished-tests.ts index 8e2b4734b..15a757718 100644 --- a/on-finished/on-finished-tests.ts +++ b/on-finished/on-finished-tests.ts @@ -1,12 +1,15 @@ -/// +/// +/// + +import events = require('events'); function test_finished() { - var msg = {}; + var e = new events.EventEmitter(); - var ret = onFinished(msg, () => { + var ret: NodeJS.EventEmitter = OnFinished.onFinished(e, () => { //callback }); - var finished: boolean = isFinished(msg); + var finished: boolean = OnFinished.isFinished(e); } diff --git a/on-finished/on-finished.d.ts b/on-finished/on-finished.d.ts index b3916f513..e4e35c995 100644 --- a/on-finished/on-finished.d.ts +++ b/on-finished/on-finished.d.ts @@ -3,8 +3,10 @@ // Definitions by: Honza Dvorsky // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module 'on-finished' { +/// - export function onFinished(msg:any, listener:Function):any; - export function isFinished(msg:any):boolean; +declare module OnFinished { + + export function onFinished(msg:NodeJS.EventEmitter, listener:Function): NodeJS.EventEmitter; + export function isFinished(msg:NodeJS.EventEmitter):boolean; } From 11e9b11d5e6b4c8f32eb515525eb6fece52881ad Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Thu, 2 Apr 2015 20:26:16 +0200 Subject: [PATCH 17/31] fix to match the name of the module --- on-finished/on-finished-tests.ts | 1 + on-finished/on-finished.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/on-finished/on-finished-tests.ts b/on-finished/on-finished-tests.ts index 15a757718..455ee2923 100644 --- a/on-finished/on-finished-tests.ts +++ b/on-finished/on-finished-tests.ts @@ -2,6 +2,7 @@ /// import events = require('events'); +import OnFinished = require('on-finished'); function test_finished() { diff --git a/on-finished/on-finished.d.ts b/on-finished/on-finished.d.ts index e4e35c995..b595b9012 100644 --- a/on-finished/on-finished.d.ts +++ b/on-finished/on-finished.d.ts @@ -5,7 +5,7 @@ /// -declare module OnFinished { +declare module 'on-finished' { export function onFinished(msg:NodeJS.EventEmitter, listener:Function): NodeJS.EventEmitter; export function isFinished(msg:NodeJS.EventEmitter):boolean; From 8f124a0b79156174fb3cff70124a231ff19ba45a Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Thu, 2 Apr 2015 20:38:58 +0200 Subject: [PATCH 18/31] Added definitions for 'he' v0.5.0, a high quality Html Entity encoding/decoding lib. --- he/he-tests.ts | 52 ++++++++++++++++++++++ he/he.d.ts | 114 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 he/he-tests.ts create mode 100644 he/he.d.ts diff --git a/he/he-tests.ts b/he/he-tests.ts new file mode 100644 index 000000000..395eb94ef --- /dev/null +++ b/he/he-tests.ts @@ -0,0 +1,52 @@ +/// + +import he = require('he'); + +function main() { + var result: string; + + result = he.encode('foo \xa9 bar \u2260 baz qux'); + // 'foo © bar ≠ baz qux' + + he.encode('foo \0 bar'); + // 'foo \0 bar' + + // Passing an `options` object to `encode`, to explicitly disallow named references: + he.encode('foo \xa9 bar \u2260 baz qux', { + 'useNamedReferences': false + }); + + he.encode('foo \xa9 bar \u2260 baz qux', { + 'encodeEverything': true + }); + + he.encode('foo \xa9 bar \u2260 baz qux', { + 'encodeEverything': true, + 'useNamedReferences': true + }); + + he.encode('\x01', { + 'strict': false + }); + // '' + + he.encode('foo © and & ampersand', { + 'allowUnsafeSymbols': true + }); + + // Override the global default setting: + he.encode.options.useNamedReferences = true; + + he.decode('foo © bar ≠ baz 𝌆 qux'); + + he.decode('foo&bar', { + 'isAttributeValue': false + }); + + he.decode('foo&bar', { + 'strict': false + }); + + he.decode.options.isAttributeValue = true; + he.escape(''); +} diff --git a/he/he.d.ts b/he/he.d.ts new file mode 100644 index 000000000..6c96840c2 --- /dev/null +++ b/he/he.d.ts @@ -0,0 +1,114 @@ +// Type definitions for he v0.5.0 +// Project: https://github.com/mathiasbynens/he +// Definitions by: Simon Edwards +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// he - "HTML Entities" - A high quality pair of HTML encode and decode functions. + +declare module "he" { + + var version: string; + + interface EncodeOptions { + /** + * The default value for the useNamedReferences option is false. This + * means that encode() will not use any named character references + * (e.g. ©) in the output — hexadecimal escapes (e.g. ©) will + * be used instead. Set it to true to enable the use of named references. + */ + useNamedReferences?: boolean; + + /** + * The default value for the encodeEverything option is false. This means + * that encode() will not use any character references for printable ASCII + * symbols that don’t need escaping. Set it to true to encode every symbol + * in the input string. When set to true, this option takes precedence over + * allowUnsafeSymbols (i.e. setting the latter to true in such a case has + * no effect). + */ + encodeEverything?: boolean; + + /** + * The default value for the strict option is false. This means that + * encode() will encode any HTML text content you feed it, even if it + * contains any symbols that cause parse errors. To throw an error when such + * invalid HTML is encountered, set the strict option to true. This option + * makes it possible to use he as part of HTML parsers and HTML validators. + */ + strict?: boolean; + + /** + * The default value for the allowUnsafeSymbols option is false. This means + * that characters that are unsafe for use in HTML content (&, <, >, ", ', + * and `) will be encoded. When set to true, only non-ASCII characters will + * be encoded. If the encodeEverything option is set to true, this option + * will be ignored. + */ + allowUnsafeSymbols?: boolean; + } + + interface Encode { + /** + * Encode a string of text + * + * This function takes a string of text and encodes (by default) any symbols + * that aren’t printable ASCII symbols and &, <, >, ", ', and `, replacing + * them with character references. + * + * As long as the input string contains allowed code points only, the return + * value of this function is always valid HTML. Any (invalid) code points + * that cannot be represented using a character reference in the input are + * not encoded. + */ + (text: string, options?: EncodeOptions): string; + + options: EncodeOptions; + } + var encode: Encode; + + interface DecodeOptions { + /** + * The default value for the isAttributeValue option is false. This means + * that decode() will decode the string as if it were used in a text + * context in an HTML document. HTML has different rules for parsing + * character references in attribute values — set this option to true to + * treat the input string as if it were used as an attribute value. + */ + isAttributeValue?: boolean; + + /** + * The default value for the strict option is false. This means that + * decode() will decode any HTML text content you feed it, even if it + * contains any entities that cause parse errors. To throw an error when + * such invalid HTML is encountered, set the strict option to true. This + * option makes it possible to use he as part of HTML parsers and HTML + * validators. + */ + strict?: boolean; + } + + interface Decode { + /** + * Decode a string of HTML text + * + * This function takes a string of HTML and decodes any named and numerical + * character references in it using the algorithm described in section + * 12.2.4.69 of the HTML spec. + */ + (html: string, options?: DecodeOptions): string; + + options: DecodeOptions; + } + var decode: Decode; + + /** + * Escape XML entities + * + * This function takes a string of text and escapes it for use in text + * contexts in XML or HTML documents. Only the following characters are + * escaped: &, <, >, ", ', and `. + */ + function escape(text: string): string; + + var unescape: Decode; +} From d5da919d44a23a618aee1e1f67e12dcdb8362db2 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Thu, 2 Apr 2015 19:25:39 -0300 Subject: [PATCH 19/31] fixes for new version --- object-path/object-path-tests.ts | 162 ++++--- object-path/object-path.d.ts | 706 ++++++++++++++++++++----------- 2 files changed, 563 insertions(+), 305 deletions(-) diff --git a/object-path/object-path-tests.ts b/object-path/object-path-tests.ts index 5984c78a8..d29cec141 100644 --- a/object-path/object-path-tests.ts +++ b/object-path/object-path-tests.ts @@ -1,68 +1,94 @@ -/// - -var - object = { - one: 1, - two: { - three: 3, - four: ['4'] - } - }, - array: any[] = [], - Null:any = null; - -objectPath.del(array) === ['12']; -objectPath.del(object) === object; -objectPath.del(object) === object; - -objectPath.del() === void 0; -objectPath.del(object, ['1','2','3']); -objectPath.del(object, [1,2,3]); -objectPath.del(object, 1); -objectPath.del(object, 'one').one === 1; - -objectPath.coalesce(object, ['1','2']) === void 0; -objectPath.coalesce(object, ['1',['2','1']]) === void 0; -objectPath.coalesce(object, ['1',['2','1']], 1) === 1; -objectPath.coalesce(object, [1,1], 1) === 1; -objectPath.coalesce(object, >[1,[1,1]], 1) === 1; - -objectPath.ensureExists(object, '1.2', 2); -objectPath.ensureExists(object, 1, 2); -objectPath.ensureExists(object, [1,2], 2); -objectPath.ensureExists(object, ['1','2'], 2); -objectPath.ensureExists(object, ['1','2'], 2) === 3; -objectPath.ensureExists(object, ['1','2'], 2) === [[]]; - -objectPath.push(object, 1, 1,2,3,4); -objectPath.push(object, 1, 1,'2', 3, false); -objectPath.push(object, 'one.four', 1,'2', 3, false); -objectPath.push(object, ['one','two'], [1,'2', 3, false]); - -objectPath.get(array) === array; -objectPath.get(Null) === Null; -objectPath.get() === void 0; -objectPath.get(object, 'one') === 1; -objectPath.get(object, ['two','three']) === 3; -objectPath.get(object, ['three'], 3) === 3; -objectPath.get(object, 'three', 3) === 3; -objectPath.get(object, 0, 3) === 3; -objectPath.get(object, 0, '3') === '3'; -objectPath.get(object, 0, ['1','2']) === ['1','2']; -objectPath.get(object, 0) === 10; - -objectPath.set(object, '1.2', true); -objectPath.set(object, ['1','2'], true); -objectPath.set(object, [1, 2], true); -objectPath.set(object, '1.2', true, true); -objectPath.set(object, '1.2', true, false); -objectPath.set(object, '1.2', true, false) === ['string']; -objectPath.set(object, '1.2', true, false) === object; - -objectPath.insert(object, '1.2', 1); -objectPath.insert(object, ['1','2'], 1); -objectPath.insert(object, 1, 1); -objectPath.insert(object, [1,2], 1); -objectPath.insert(object, '1.2', 1, 2); -objectPath.insert(object, ['1.2'], 1, 6); - +/// + +import ObjectPath = require('object-path'); + +var + object = { + one: 1, + two: { + three: 3, + four: ['4'] + } + }, + array: any[] = [], + Null:any = null; + +var obj = ObjectPath(object); + +obj.del(array); +obj.coalesce([1,2]); +obj.ensureExists('1.2', 1); +obj.push(1, 'value'); +obj.get(array); +obj.set(array, 'value'); +obj.insert(1, 10); + +objectPath.del(array) === ['12']; +objectPath.del(object) === object; +objectPath.del(object) === object; +obj.del() === object; + +objectPath.has(object, ['1','2','3']) === true; +objectPath.has(object, ['1.2.3']) === false; +objectPath.has(object, [1,2,3]) === true; +objectPath.has(object, 1) === false; +objectPath.has() === false; + +objectPath.del() === void 0; +objectPath.del(object, ['1','2','3']); +objectPath.del(object, [1,2,3]); +objectPath.del(object, 1); +objectPath.del(object, 'one').one === 1; +obj.del('one').one === 1; + +objectPath.coalesce(object, ['1','2']) === void 0; +objectPath.coalesce(object, ['1',['2','1']]) === void 0; +objectPath.coalesce(object, ['1',['2','1']], 1) === 1; +objectPath.coalesce(object, [1,1], 1) === 1; +objectPath.coalesce(object, >[1,[1,1]], 1) === 1; +obj.coalesce(>[1,[1,1]], 1) === 1; + +objectPath.ensureExists(object, '1.2', 2); +objectPath.ensureExists(object, 1, 2); +objectPath.ensureExists(object, [1,2], 2); +objectPath.ensureExists(object, ['1','2'], 2); +objectPath.ensureExists(object, ['1','2'], 2) === 3; +objectPath.ensureExists(object, ['1','2'], 2) === [[]]; +obj.ensureExists(['1','2'], 2) === [[]]; + +objectPath.push(object, 1, 1,2,3,4); +objectPath.push(object, 1, 1,'2', 3, false); +objectPath.push(object, 'one.four', 1,'2', 3, false); +objectPath.push(object, ['one','two'], [1,'2', 3, false]); +obj.push(['one','two'], [1,'2', 3, false]); + +objectPath.get(array) === array; +objectPath.get(Null) === Null; +objectPath.get() === void 0; +objectPath.get(object, 'one') === 1; +objectPath.get(object, ['two','three']) === 3; +objectPath.get(object, ['three'], 3) === 3; +objectPath.get(object, 'three', 3) === 3; +objectPath.get(object, 0, 3) === 3; +objectPath.get(object, 0, '3') === '3'; +objectPath.get(object, 0, ['1','2']) === ['1','2']; +objectPath.get(object, 0) === 10; +obj.get(0) === 10; + +objectPath.set(object, '1.2', true); +objectPath.set(object, ['1','2'], true); +objectPath.set(object, [1, 2], true); +objectPath.set(object, '1.2', true, true); +objectPath.set(object, '1.2', true, false); +objectPath.set(object, '1.2', true, false) === ['string']; +objectPath.set(object, '1.2', true, false) === object; +obj.set('1.2', true, false) === object; + +objectPath.insert(object, '1.2', 1); +objectPath.insert(object, ['1','2'], 1); +objectPath.insert(object, 1, 1); +objectPath.insert(object, [1,2], 1); +objectPath.insert(object, '1.2', 1, 2); +objectPath.insert(object, ['1.2'], 1, 6); +obj.insert(['1.2'], 1, 6); + diff --git a/object-path/object-path.d.ts b/object-path/object-path.d.ts index fe38f8702..711a305dc 100644 --- a/object-path/object-path.d.ts +++ b/object-path/object-path.d.ts @@ -1,238 +1,470 @@ -// Type definitions for objectPath v0.6.0 -// Project: https://github.com/mariocasciaro/object-path -// Definitions by: Paulo Cesar -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare var objectPath: objectPath.IObjectPathStatic; - -declare module objectPath { - - interface IStringArray { - [index: number]: string; - } - - interface INumberArray { - [index: number]: number; - } - - interface IObjectPathStatic { - /*======== Del =========*/ - - /** - * Deletes a member from object or array - * @param {object} object - * @param {string[]|string} path - * @return object - */ - del(object: T, path: IStringArray): T; - /** - * @see objectPath.del - */ - del(object: T, path: INumberArray): T; - /** - * @see objectPath.del - */ - del(object: T, path: number): T; - /** - * @see objectPath.del - */ - del(object: T, path: string): T; - /** - * @see objectPath.del - */ - del(object: T): T; - /** - * @see objectPath.del - */ - del():void; - - /*======== Get =========*/ - /** - * Get a path from an object - * @param {object} object - * @param {string|string[]|number|number[]} path - * @param {*} [defaultValue=undefined] - */ - get(object: T, path: string, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(object: T, path: IStringArray, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(object: T, path: number, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(object: T, path: INumberArray, defaultValue?: TResult): TResult; - /** - * @see objectPath.get - */ - get(object: T): T; - /** - * @see objectPath.get - */ - get():void; - - /*======== Set =========*/ - /** - * Set a path to a value - * @param {object} object - * @param {string|string[]|number|number[]} path - * @param {*} value - * @param {boolean} [doNotReplace=false] - * @return Any existing value on the path if any - */ - set(object: T, path: string, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(object: T, path: number, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(object: T, path: IStringArray, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(object: T, path: INumberArray, value: any, doNotReplace?:boolean): TExisting; - /** - * @see objectPath.set - */ - set(object: T): T; - /** - * @see objectPath.set - */ - set():void; - - /*======== Push =========*/ - /** - * Create (if path isn't an array) and push the value to it. Can push unlimited number of values - * @param {object} object - */ - push(object: T, path: INumberArray, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(object: T, path: IStringArray, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(object: T, path: number, ...args:any[]):void; - /** - * @see objectPath.push - */ - push(object: T, path: string, ...args:any[]):void; - /** - * @see objectPath.push - */ - push():void; - - /*======== Coalesce =========*/ - /** - * Get the first non undefined property - * @param {object} object - * @param {string[]|string[][]|number[]|number[][]} paths - * @param {*} defaultValue - * @return {*} - */ - coalesce(object: T, paths: IStringArray, defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(object: T, paths: INumberArray, defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(object: T, paths: IStringArray[], defaultValue?: any):TResult; - /** - * @see objectPath.coalesce - */ - coalesce(object: T, paths: INumberArray[], defaultValue?: any):TResult; - - /*======== Empty =========*/ - /** - * Empty a path. Arrays are set to length 0, objects have all elements deleted, strings - * are set to empty, numbers to 0, everything else is set to null - * @param {object} object - * @param {string|string[]|number[]} path - */ - empty(object: T, path: string):TResult; - /** - * @see objectPath.empty - */ - empty(object: T, path: INumberArray):TResult; - /** - * @see objectPath.empty - */ - empty(object: T, path: IStringArray):TResult; - /** - * @see objectPath.empty - */ - empty(object: T, path: number):TResult; - /** - * @see objectPath.empty - */ - empty(object: T):T; - /** - * @see objectPath.empty - */ - empty():void; - - /*======== EnsureExists =========*/ - /** - * Set a value if it doesn't exist, do nothing if it does - * @param {object} object - * @param {string|string[]|number|number[]} path - */ - ensureExists(object: T, path: string, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(object: T, path: number, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(object: T, path: INumberArray, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(object: T, path: IStringArray, value: any):TResult; - /** - * @see objectPath.ensureExists - */ - ensureExists(object: T): T; - /** - * @see objectPath.ensureExists - */ - ensureExists():void; - - /*======== Insert =========*/ - /** - * Insert an item in an array path - * @param {object} object - * @param {string|string[]|number|number[]} path - * @param {*} value - * @param {number} [at=0] - */ - insert(object: T, path: string, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(object: T, path: INumberArray, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(object: T, path: IStringArray, value: any, at?: number):void; - /** - * @see objectPath.insert - */ - insert(object: T, path: number, value: any, at?: number):void; - } - -} - -declare module 'objectPath' { - export = objectPath; +// Type definitions for objectPath v0.9.x +// Project: https://github.com/mariocasciaro/object-path +// Definitions by: Paulo Cesar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var objectPath: objectPath.IObjectPathStatic; + +declare module objectPath { + + interface IStringArray { + [index: number]: string; + } + + interface INumberArray { + [index: number]: number; + } + + interface IObjectPathStatic { + /** + * Binds an object + */ + (object: T): IObjectPathBound; + + /*======== Del =========*/ + + /** + * Deletes a member from object or array + * @param {object} object + * @param {string[]|string} path + * @return object + */ + del(object: T, path: IStringArray): T; + /** + * @see objectPath.del + */ + del(object: T, path: INumberArray): T; + /** + * @see objectPath.del + */ + del(object: T, path: number): T; + /** + * @see objectPath.del + */ + del(object: T, path: string): T; + /** + * @see objectPath.del + */ + del(object: T): T; + /** + * @see objectPath.del + */ + del():void; + + /*======== Has =========*/ + /** + * Tests path existence + * @param {object} object + * @param {string[]|string} path + * @return object + */ + has(object: T, path: IStringArray): boolean; + /** + * @see objectPath.has + */ + has(object: T, path: INumberArray): boolean; + /** + * @see objectPath.has + */ + has(object: T, path: string): boolean; + /** + * @see objectPath.has + */ + has(object: T, path: number): boolean; + /** + * @see objectPath.has + */ + has(object: T): boolean; + /** + * @see objectPath.has + */ + has(): boolean; + + /*======== Get =========*/ + /** + * Get a path from an object + * @param {object} object + * @param {string|string[]|number|number[]} path + * @param {*} [defaultValue=undefined] + */ + get(object: T, path: string, defaultValue?: TResult): TResult; + /** + * @see objectPath.get + */ + get(object: T, path: IStringArray, defaultValue?: TResult): TResult; + /** + * @see objectPath.get + */ + get(object: T, path: number, defaultValue?: TResult): TResult; + /** + * @see objectPath.get + */ + get(object: T, path: INumberArray, defaultValue?: TResult): TResult; + /** + * @see objectPath.get + */ + get(object: T): T; + /** + * @see objectPath.get + */ + get():void; + + /*======== Set =========*/ + /** + * Set a path to a value + * @param {object} object + * @param {string|string[]|number|number[]} path + * @param {*} value + * @param {boolean} [doNotReplace=false] + * @return Any existing value on the path if any + */ + set(object: T, path: string, value: any, doNotReplace?:boolean): TExisting; + /** + * @see objectPath.set + */ + set(object: T, path: number, value: any, doNotReplace?:boolean): TExisting; + /** + * @see objectPath.set + */ + set(object: T, path: IStringArray, value: any, doNotReplace?:boolean): TExisting; + /** + * @see objectPath.set + */ + set(object: T, path: INumberArray, value: any, doNotReplace?:boolean): TExisting; + /** + * @see objectPath.set + */ + set(object: T): T; + /** + * @see objectPath.set + */ + set():void; + + /*======== Push =========*/ + /** + * Create (if path isn't an array) and push the value to it. Can push unlimited number of values + * @param {object} object + */ + push(object: T, path: INumberArray, ...args:any[]):void; + /** + * @see objectPath.push + */ + push(object: T, path: IStringArray, ...args:any[]):void; + /** + * @see objectPath.push + */ + push(object: T, path: number, ...args:any[]):void; + /** + * @see objectPath.push + */ + push(object: T, path: string, ...args:any[]):void; + /** + * @see objectPath.push + */ + push():void; + + /*======== Coalesce =========*/ + /** + * Get the first non undefined property + * @param {object} object + * @param {string[]|string[][]|number[]|number[][]} paths + * @param {*} defaultValue + * @return {*} + */ + coalesce(object: T, paths: IStringArray, defaultValue?: any):TResult; + /** + * @see objectPath.coalesce + */ + coalesce(object: T, paths: INumberArray, defaultValue?: any):TResult; + /** + * @see objectPath.coalesce + */ + coalesce(object: T, paths: IStringArray[], defaultValue?: any):TResult; + /** + * @see objectPath.coalesce + */ + coalesce(object: T, paths: INumberArray[], defaultValue?: any):TResult; + + /*======== Empty =========*/ + /** + * Empty a path. Arrays are set to length 0, objects have all elements deleted, strings + * are set to empty, numbers to 0, everything else is set to null + * @param {object} object + * @param {string|string[]|number[]} path + */ + empty(object: T, path: string):TResult; + /** + * @see objectPath.empty + */ + empty(object: T, path: INumberArray):TResult; + /** + * @see objectPath.empty + */ + empty(object: T, path: IStringArray):TResult; + /** + * @see objectPath.empty + */ + empty(object: T, path: number):TResult; + /** + * @see objectPath.empty + */ + empty(object: T):T; + /** + * @see objectPath.empty + */ + empty():void; + + /*======== EnsureExists =========*/ + /** + * Set a value if it doesn't exist, do nothing if it does + * @param {object} object + * @param {string|string[]|number|number[]} path + */ + ensureExists(object: T, path: string, value: any):TResult; + /** + * @see objectPath.ensureExists + */ + ensureExists(object: T, path: number, value: any):TResult; + /** + * @see objectPath.ensureExists + */ + ensureExists(object: T, path: INumberArray, value: any):TResult; + /** + * @see objectPath.ensureExists + */ + ensureExists(object: T, path: IStringArray, value: any):TResult; + /** + * @see objectPath.ensureExists + */ + ensureExists(object: T): T; + /** + * @see objectPath.ensureExists + */ + ensureExists():void; + + /*======== Insert =========*/ + /** + * Insert an item in an array path + * @param {object} object + * @param {string|string[]|number|number[]} path + * @param {*} value + * @param {number} [at=0] + */ + insert(object: T, path: string, value: any, at?: number):void; + /** + * @see objectPath.insert + */ + insert(object: T, path: INumberArray, value: any, at?: number):void; + /** + * @see objectPath.insert + */ + insert(object: T, path: IStringArray, value: any, at?: number):void; + /** + * @see objectPath.insert + */ + insert(object: T, path: number, value: any, at?: number):void; + } + + interface IObjectPathBound { + /*======== Del =========*/ + + /** + * @see objectPath.ensureExists + */ + del(path: IStringArray): T; + /** + * @see objectPath.del + */ + del(path: INumberArray): T; + /** + * @see objectPath.del + */ + del(path: number): T; + /** + * @see objectPath.del + */ + del(path: string): T; + /** + * @see objectPath.del + */ + del(): T; + + /*======== Has =========*/ + /** + * @see objectPath.ensureExists + */ + has(path: IStringArray): boolean; + /** + * @see objectPath.has + */ + has(path: INumberArray): boolean; + /** + * @see objectPath.has + */ + has(path: string): boolean; + /** + * @see objectPath.has + */ + has(path: number): boolean; + /** + * @see objectPath.has + */ + has(): boolean; + + /*======== Get =========*/ + /** + * @see objectPath.ensureExists + */ + get(path: string, defaultValue?: TResult): TResult; + /** + * @see objectPath.get + */ + get(path: IStringArray, defaultValue?: TResult): TResult; + /** + * @see objectPath.get + */ + get(path: number, defaultValue?: TResult): TResult; + /** + * @see objectPath.get + */ + get(path: INumberArray, defaultValue?: TResult): TResult; + /** + * @see objectPath.get + */ + get(): T; + + /*======== Set =========*/ + /** + * @see objectPath.ensureExists + */ + set(path: string, value: any, doNotReplace?:boolean): TExisting; + /** + * @see objectPath.set + */ + set(path: number, value: any, doNotReplace?:boolean): TExisting; + /** + * @see objectPath.set + */ + set(path: IStringArray, value: any, doNotReplace?:boolean): TExisting; + /** + * @see objectPath.set + */ + set(path: INumberArray, value: any, doNotReplace?:boolean): TExisting; + /** + * @see objectPath.set + */ + set(): T; + + /*======== Push =========*/ + /** + * @see objectPath.ensureExists + */ + push(path: INumberArray, ...args:any[]):void; + /** + * @see objectPath.push + */ + push(path: IStringArray, ...args:any[]):void; + /** + * @see objectPath.push + */ + push(path: number, ...args:any[]):void; + /** + * @see objectPath.push + */ + push(path: string, ...args:any[]):void; + /** + * @see objectPath.push + */ + push():void; + + /*======== Coalesce =========*/ + /** + * @see objectPath.ensureExists + */ + coalesce(paths: IStringArray, defaultValue?: any):TResult; + /** + * @see objectPath.coalesce + */ + coalesce(paths: INumberArray, defaultValue?: any):TResult; + /** + * @see objectPath.coalesce + */ + coalesce(paths: IStringArray[], defaultValue?: any):TResult; + /** + * @see objectPath.coalesce + */ + coalesce(paths: INumberArray[], defaultValue?: any):TResult; + + /*======== Empty =========*/ + /** + * @see objectPath.ensureExists + */ + empty(path: string):TResult; + /** + * @see objectPath.empty + */ + empty(path: INumberArray):TResult; + /** + * @see objectPath.empty + */ + empty(path: IStringArray):TResult; + /** + * @see objectPath.empty + */ + empty(path: number):TResult; + /** + * @see objectPath.empty + */ + empty():T; + + /*======== EnsureExists =========*/ + /** + * @see objectPath.ensureExists + */ + ensureExists(path: string, value: any):TResult; + /** + * @see objectPath.ensureExists + */ + ensureExists(path: number, value: any):TResult; + /** + * @see objectPath.ensureExists + */ + ensureExists(path: INumberArray, value: any):TResult; + /** + * @see objectPath.ensureExists + */ + ensureExists(path: IStringArray, value: any):TResult; + /** + * @see objectPath.ensureExists + */ + ensureExists(): T; + + /*======== Insert =========*/ + /** + * @see objectPath.insert + */ + insert(path: string, value: any, at?: number):void; + /** + * @see objectPath.insert + */ + insert(path: INumberArray, value: any, at?: number):void; + /** + * @see objectPath.insert + */ + insert(path: IStringArray, value: any, at?: number):void; + /** + * @see objectPath.insert + */ + insert(path: number, value: any, at?: number):void; + } +} + +// browser version +declare module 'objectPath' { + export = objectPath; +} + +// node version +declare module 'object-path' { + export = objectPath; } \ No newline at end of file From c20dc7f503c50e70ca60cbd2ebe30a686d7d22ad Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Fri, 3 Apr 2015 03:09:09 +0200 Subject: [PATCH 20/31] finally figured out how to have a callable module with extra functions --- on-finished/on-finished-tests.ts | 6 +++--- on-finished/on-finished.d.ts | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/on-finished/on-finished-tests.ts b/on-finished/on-finished-tests.ts index 455ee2923..c3956ac6b 100644 --- a/on-finished/on-finished-tests.ts +++ b/on-finished/on-finished-tests.ts @@ -2,15 +2,15 @@ /// import events = require('events'); -import OnFinished = require('on-finished'); +import onFinished = require('on-finished'); function test_finished() { var e = new events.EventEmitter(); - var ret: NodeJS.EventEmitter = OnFinished.onFinished(e, () => { + var ret: NodeJS.EventEmitter = onFinished(e, () => { //callback }); - var finished: boolean = OnFinished.isFinished(e); + var finished: boolean = onFinished.isFinished(e); } diff --git a/on-finished/on-finished.d.ts b/on-finished/on-finished.d.ts index b595b9012..0ca4f2286 100644 --- a/on-finished/on-finished.d.ts +++ b/on-finished/on-finished.d.ts @@ -5,8 +5,14 @@ /// + declare module 'on-finished' { - export function onFinished(msg:NodeJS.EventEmitter, listener:Function): NodeJS.EventEmitter; - export function isFinished(msg:NodeJS.EventEmitter):boolean; + function onFinished(msg:NodeJS.EventEmitter, listener:Function): NodeJS.EventEmitter; + + module onFinished { + export function isFinished(msg:NodeJS.EventEmitter):boolean; + } + + export = onFinished; } From daaabe797ecb2e54f03fc9742011a11cd1965413 Mon Sep 17 00:00:00 2001 From: John Jeffery Date: Fri, 3 Apr 2015 20:00:02 +1000 Subject: [PATCH 21/31] Add definitions for on-headers (github/jshttp/on-headers) --- on-headers/on-headers-tests.ts | 20 ++++++++++++++++++++ on-headers/on-headers.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 on-headers/on-headers-tests.ts create mode 100644 on-headers/on-headers.d.ts diff --git a/on-headers/on-headers-tests.ts b/on-headers/on-headers-tests.ts new file mode 100644 index 000000000..11f33c4ef --- /dev/null +++ b/on-headers/on-headers-tests.ts @@ -0,0 +1,20 @@ +/// + +import http = require('http') +import onHeaders = require('on-headers') + +http.createServer(onRequest) + .listen(3000); + +function onRequest(req: http.ServerRequest, res: http.ServerResponse) { + onHeaders(res, addPoweredBy); + res.setHeader('Content-Type', 'text/plain') + res.end('hello!'); +} + +function addPoweredBy(): void { + // set if not set by end of request + if (!this.getHeader('X-Powered-By')) { + this.setHeader('X-Powered-By', 'Node.js'); + } +} diff --git a/on-headers/on-headers.d.ts b/on-headers/on-headers.d.ts new file mode 100644 index 000000000..bf873fd82 --- /dev/null +++ b/on-headers/on-headers.d.ts @@ -0,0 +1,33 @@ +// Type definitions for serve-favicon 2.1.6 +// Project: https://github.com/jshttp/on-headers +// Definitions by: John Jeffery +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "on-headers" { + import http = require("http"); + + /** + * This will add the listener to fire when headers are emitted for res. + * The listener is passed the response object as its context (this). + * Headers are considered emitted only once, right before they + * are sent to the client. + * + * When this is called multiple times on the same res, the listeners + * are fired in the reverse order they were added. + * + * @param res HTTP server response object + * @param listener Function to call prior to headers being emitted, + * the response object is passed as this context. + */ + function onHeaders(res: http.ServerResponse, listener: Function):void; + + // Note that this definition might be able to be improved in a future + // version of typescript. At the moment it is not possible to declare + // the type of the 'this' context for a function, but it might be included + // in a future typescript version. + // https://github.com/Microsoft/TypeScript/issues/229 + + export = onHeaders; +} \ No newline at end of file From 8d687affd58b4997bf8023273c0d4208790824fd Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Fri, 3 Apr 2015 07:45:37 -0400 Subject: [PATCH 22/31] notifyjs - adding missing `timeout` options --- notifyjs/notifyjs.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/notifyjs/notifyjs.d.ts b/notifyjs/notifyjs.d.ts index f36b8fbcd..0cff4e0c5 100644 --- a/notifyjs/notifyjs.d.ts +++ b/notifyjs/notifyjs.d.ts @@ -72,6 +72,11 @@ declare module notifyjs { * unique identifier to stop duplicate notifications */ tag? : string; + + /** + * number of seconds to close the notification automatically + */ + timeout? : number; /** * callback when notification is shown From 9c32ba187d1ece61fe7e64d758bba50dc999b47d Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Fri, 3 Apr 2015 07:50:35 -0400 Subject: [PATCH 23/31] notifyjs - adding missing `timeout` option to tests --- notifyjs/notifyjs-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/notifyjs/notifyjs-tests.ts b/notifyjs/notifyjs-tests.ts index 8771224c8..1b1d7f906 100644 --- a/notifyjs/notifyjs-tests.ts +++ b/notifyjs/notifyjs-tests.ts @@ -14,6 +14,7 @@ function test_Notify_constructor() { body : "fuga", icon : "./logo.png", tag : "user", + timeout : 1000, notifyShow : (e:Event)=> console.log("notifyShow", e), notifyClose : ()=> console.log("notifyClose"), notifyClick : ()=> console.log("notifyClick"), From d3a2d074709fc7df48e9e6da530f0f036d928c4d Mon Sep 17 00:00:00 2001 From: Dave Allen Date: Fri, 3 Apr 2015 10:40:49 -0700 Subject: [PATCH 24/31] Updated for Meteor version 1.1.0.1 --- meteor/README.md | 38 +- meteor/meteor-tests.ts | 132 +++-- meteor/meteor.d.ts | 1176 ++++++++++++++++++++++------------------ 3 files changed, 736 insertions(+), 610 deletions(-) diff --git a/meteor/README.md b/meteor/README.md index ae8178f2c..8f93e1816 100644 --- a/meteor/README.md +++ b/meteor/README.md @@ -1,6 +1,6 @@ # Meteor Type Definitions -These are the definitions for version 1.0.3.1 of Meteor. +These are the definitions for version 1.1.0.1 of Meteor. Although these definitions can be downloaded separately for use, the recommended way to use these definitions in a Meteor application is by installing the [typescript-libs](https://atmospherejs.com/meteortypescript/typescript-libs) Meteor smart package from atmosphere. The smart package contains TypeScript @@ -16,25 +16,21 @@ to generate the official [Meteor docs] (http://docs.meteor.com/). ## Usage -1. If you are using the smart package, add a symbolic link to the definitions from within some directory within your project (e.g. ".typescript" or "lib"). The -definitions can be found somewhere deep within `/.meteor/...`. The following will probably work: +1. Add a symbolic link to the definitions from within some directory within your project (e.g. ".typescript" or "lib"). The definitions can be found somewhere +deep within `/.meteor/...`. The following will probably work: $ ln -s ../.meteor/local/build/programs/server/assets/packages/meteortypescript_typescript-libs/definitions package_defs - If the definitions can't be found within the .meteor directory, you will have to manually pull down the definitions from github and add them to your project: - If you are just using the *meteor.d.ts* file from this source, you can just add the file to any directory in your project (e.g. ".typescript" or "lib"). - 2. Install the [Typescript compiler for Meteor](https://github.com/meteor-typescript/meteor-typescript-compiler) or an [IDE which can transpile TypeScript to JavaScript](#transpiling-typescript). 3. From the typescript files, add references. Reference the definition files with a single line: /// (substitute path in your project) - Or you can reference definition files individually: - + /// (substitue path in your project) /// /// @@ -46,26 +42,28 @@ definitions can be found somewhere deep within `/.meteor/...`. ### References -Try to stay away from referencing *file.ts*, rather generate a *file.d.ts* using `tsc --reference file.ts`, and reference it in your file. Compilation will -be much faster and code cleaner - it's always better to split definition from implemention. +Meteor code can run on the client and the server, for this reason you should try to stay away from referencing *file.ts* directly: you may get unexpected results. +Rather generate a *file.d.ts* using `tsc --reference file.ts`, and reference it in your file. + +Compilation will be much faster and code cleaner - it's always better to split definition from implementation anyways. ### Templates -When specifying template *helpers*, *events*, and functions for *created*, *rendered*, and *destroyed*, you will need to use a "bracket notation" instead of the "dot notation": +With the exception of the **body** and **head** templates, Meteor's Template dot notation cannot be used (ie. *Template.mytemplate*). Thanks to Typescript static typing checks, you will need to used the *bracket notation* to access the Template. - Template['myTemplateName']['helpers']({ + + Template['myTemplateName'].helpers({ foo: function () { return Session.get("foo"); } }); - Template['myTemplateName']['rendered'] = function ( ) { ... } + Template['myTemplateName'].rendered = function ( ) { ... } + -This is because TypeScript enforces typing and it will throw an error saying "myTemplateName" does not exist when using the dot notation. +### Form fields -### Accessing a Form field - -Trying to read a form field value? use `(evt.target).value`. +Form fields typically need to be casted to . For instance to read a form field value, use `(evt.target).value`. ### Global variables @@ -77,7 +75,7 @@ Preface any global variable declarations with a TypeScript "declare var" stateme ### Collections -The majority of extra work required to use TypeScript with Meteor is creating and maintaining the collection interfaces. However, doing so also provides the +The majority of extra work required to use TypeScript with Meteor is creating and maintaining the collection interfaces. However, doing so also provides the additional benefit of succinctly documenting collection schema definitions (that are actually enforced). To define collections, you will need to create an interface representing the collection and then declare a Collection type variable with that interface type (as a generic): @@ -113,7 +111,7 @@ for all of you custom definitions. e.g. contents of ".typescript/custom_defs/cu /// /// /// - + ## Transpiling TypeScript @@ -132,4 +130,4 @@ Then, within WebStorm, go to Preferences -> File Watchers -> "+" symbol and add Last option, is to compile code from the command line. With node and the typescript compiler installed: - $ tsc *.ts \ No newline at end of file + $ tsc *.ts diff --git a/meteor/meteor-tests.ts b/meteor/meteor-tests.ts index e4c5b9066..ec2ad3b81 100644 --- a/meteor/meteor-tests.ts +++ b/meteor/meteor-tests.ts @@ -8,21 +8,15 @@ /*********************************** Begin setup for tests ******************************/ - -// A developer must declare a var Template like this in a separate file to use this TypeScript type definition file -//interface ITemplate { -// adminDashboard: Meteor.Template; -// chat: Meteor.Template; -//} -//declare var Template: ITemplate; - var Rooms = new Mongo.Collection('rooms'); var Messages = new Mongo.Collection('messages'); -var Monkeys = new Mongo.Collection('monkeys'); -var x = new Mongo.Collection('x'); -var y = new Mongo.Collection('y'); - -var check = function(str1, str2) {}; +interface MonkeyDAO { + _id: string; + name: string; +} +var Monkeys = new Mongo.Collection('monkeys'); +//var x = new Mongo.Collection('x'); +//var y = new Mongo.Collection('y'); /********************************** End setup for tests *********************************/ @@ -98,8 +92,8 @@ Tracker.autorun(function () { }); console.log("Current room has " + - Counts.find(Session.get("roomId")).count + - " messages."); +Counts.find(Session.get("roomId")).count + +" messages."); /** * From Publish and Subscribe, Meteor.subscribe section @@ -124,7 +118,7 @@ Meteor.methods({ var you_want_to_throw_an_error = true; if (you_want_to_throw_an_error) - throw new Meteor.Error("404", "Can't find my pants"); + throw new Meteor.Error("404", "Can't find my pants"); return "some return value"; }, @@ -146,15 +140,15 @@ var result = Meteor.call('foo', 1, 2); // DA: I added the "var" keyword in there interface ChatroomsDAO { - _id?: string; + _id?: string; } interface MessagesDAO { - _id?: string; + _id?: string; } var Chatrooms = new Mongo.Collection("chatrooms"); Messages = new Mongo.Collection("messages"); -var myMessages = Messages.find({userId: Session.get('myUserId')}).fetch(); +var myMessages = Messages.find({userId: Session.get('myUserId')}).fetch(); Messages.insert({text: "Hello, world!"}); @@ -171,10 +165,10 @@ Posts.insert({title: "Hello world", body: "First post"}); * since there is already a Collection constructor with a different signature * var Scratchpad = new Mongo.Collection; -for (var i = 0; i < 10; i++) - Scratchpad.insert({number: i * 2}); -assert(Scratchpad.find({number: {$lt: 9}}).count() === 5); -**/ + for (var i = 0; i < 10; i++) + Scratchpad.insert({number: i * 2}); + assert(Scratchpad.find({number: {$lt: 9}}).count() === 5); + **/ var Animal = function (doc) { // _.extend(this, doc); @@ -185,11 +179,16 @@ Animal.prototype = { makeNoise: function () { console.log(this.sound); } +}; + + +interface AnimalDAO { + _id: string; + makeNoise: () => void; } - // Define a Collection that uses Animal as its document -var Animals = new Mongo.Collection("Animals", { +var Animals = new Mongo.Collection("Animals", { transform: function (doc) { return new Animal(doc); } }); @@ -225,8 +224,8 @@ Template['adminDashboard'].events({ Meteor.methods({ declareWinners: function () { Players.update({score: {$gt: 10}}, - {$addToSet: {badges: "Winner"}}, - {multi: true}); + {$addToSet: {badges: "Winner"}}, + {multi: true}); } }); @@ -348,7 +347,7 @@ Session.equals("key", value); */ Meteor.publish("userData", function () { return Meteor.users.find({_id: this.userId}, - {fields: {'other': 1, 'things': 1}}); + {fields: {'other': 1, 'things': 1}}); }); Meteor.users.deny({update: function () { return true; }}); @@ -412,8 +411,8 @@ Accounts.emailTemplates.enrollAccount.subject = function (user) { }; Accounts.emailTemplates.enrollAccount.text = function (user, url) { return "You have been selected to participate in building a better future!" - + " To activate your account, simply click the link below:\n\n" - + url; + + " To activate your account, simply click the link below:\n\n" + + url; }; /** @@ -424,6 +423,36 @@ Template['adminDashboard'].helpers({ return Session.get("foo"); } }); +Template['newTemplate'].helpers({ + helperName: function () { + } +}); + +Template['newTemplate'].created = function () { + +}; + +Template['newTemplate'].rendered = function () { + +}; + +Template['newTemplate'].destroyed = function () { + +}; + +Template['newTemplate'].events({ + 'click .something': function (event) { + } +}); + +Template.registerHelper('testHelper', function() { + return 'tester'; +}); + +var instance = Template.instance(); +var data = Template.currentData(); +var data = Template.parentData(1); +var body = Template.body; /** * From Match section @@ -481,10 +510,9 @@ Tracker.autorun(function (c) { * From Deps, Deps.Computation */ if (Tracker.active) { - Tracker.onInvalidate(function () { - x.destroy(); - y.finalize(); - }); + Tracker.onInvalidate(function () { + console.log('invalidated'); + }); } /** @@ -494,15 +522,15 @@ var weather = "sunny"; var weatherDep = new Tracker.Dependency; var getWeather = function () { - weatherDep.depend(); - return weather; + weatherDep.depend(); + return weather; }; var setWeather = function (w) { - weather = w; - // (could add logic here to only call changed() - // if the new value is different from the old) - weatherDep.changed(); + weather = w; + // (could add logic here to only call changed() + // if the new value is different from the old) + weatherDep.changed(); }; /** @@ -512,7 +540,7 @@ Meteor.methods({checkTwitter: function (userId) { check(userId, String); this.unblock(); var result = HTTP.call("GET", "http://api.twitter.com/xyz", - {params: {user: userId}}); + {params: {user: userId}}); if (result.statusCode === 200) return true return false; @@ -520,12 +548,12 @@ Meteor.methods({checkTwitter: function (userId) { HTTP.call("POST", "http://api.twitter.com/xyz", - {data: {some: "json", stuff: 1}}, - function (error, result) { - if (result.statusCode === 200) { - Session.set("twizzled", true); - } - }); + {data: {some: "json", stuff: 1}}, + function (error, result) { + if (result.statusCode === 200) { + Session.set("twizzled", true); + } + }); /** * From Email, Email.send section @@ -542,9 +570,9 @@ Meteor.methods({ // In your client code: asynchronously send an email Meteor.call('sendEmail', - 'alice@example.com', - 'Hello from Meteor!', - 'This is a test of Email.send.'); + 'alice@example.com', + 'Hello from Meteor!', + 'This is a test of Email.send.'); var testTemplate = new Blaze.Template(); var testView = new Blaze.View(); @@ -562,8 +590,8 @@ Blaze.toHTMLWithData(testTemplate, function() {}); Blaze.toHTMLWithData(testView, {test: 1}); Blaze.toHTMLWithData(testView, function() {}); -var reactiveVar1 = new ReactiveVar('test value'); -var reactiveVar2 = new ReactiveVar('test value', function(oldVal) { return true; }); +var reactiveVar1 = new ReactiveVar('test value'); +var reactiveVar2 = new ReactiveVar('test value', function(oldVal) { return true; }); var varValue: string = reactiveVar1.get(); reactiveVar1.set('new value'); \ No newline at end of file diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts index e64547096..4118fbe06 100644 --- a/meteor/meteor.d.ts +++ b/meteor/meteor.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Meteor 1.0.3.1 +// Type definitions for Meteor 1.1.0.1 // Project: http://www.meteor.com/ // Definitions by: Dave Allen // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -7,344 +7,419 @@ * These are the modules and interfaces that can't be automatically generated from the Meteor data.js file */ -interface EJSON extends JSON {} -interface TemplateStatic { - new(): Template; - [templateName: string]: Meteor.TemplatePage; +interface EJSONable { + [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSON.CustomType; } +interface JSONable { + [key: string]: number | string | boolean | Object | number[] | string[] | Object[]; +} +interface EJSON extends EJSONable {} declare module Match { - var Any; - var String; - var Integer; - var Boolean; - var undefined; - //function null(); // not allowed in TypeScript - var Object; - function Optional(pattern):boolean; - function ObjectIncluding(dico):boolean; - function OneOf(...patterns); - function Where(condition); + var Any; + var String; + var Integer; + var Boolean; + var undefined; + //function null(); // not allowed in TypeScript + var Object; + function Optional(pattern):boolean; + function ObjectIncluding(dico):boolean; + function OneOf(...patterns); + function Where(condition); } declare module Meteor { - //interface EJSONObject extends Object {} + /** Start definitions for Template **/ + interface Event { + type:string; + target:HTMLElement; + currentTarget:HTMLElement; + which: number; + stopPropagation():void; + stopImmediatePropagation():void; + preventDefault():void; + isPropagationStopped():boolean; + isImmediatePropagationStopped():boolean; + isDefaultPrevented():boolean; + } - /** Start definitions for Template **/ - // DA: "Template" needs to support these functions: - // Template..rendered - // Template..created - // Template..destroyed - // Template..helpers - // Template..events - // and - // Template.currentData - // Template.parentData, etc. + interface EventHandlerFunction extends Function { + (event?:Meteor.Event):void; + } - interface Event { - type:string; - target:HTMLElement; - currentTarget:HTMLElement; - which: number; - stopPropagation():void; - stopImmediatePropagation():void; - preventDefault():void; - isPropagationStopped():boolean; - isImmediatePropagationStopped():boolean; - isDefaultPrevented():boolean; - } + interface EventMap { + [id:string]:Meteor.EventHandlerFunction; + } + /** End definitions for Template **/ - interface EventHandlerFunction extends Function { - (event?:Meteor.Event):any; - } + interface LoginWithExternalServiceOptions { + requestPermissions?: string[]; + requestOfflineToken?: Boolean; + forceApprovalPrompt?: Boolean; + userEmail?: string; + loginStyle?: string; + } - interface EventMap { - [id:string]:Meteor.EventHandlerFunction; - } + function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - interface TemplatePage { - rendered: Function; - created: Function; - destroyed: Function; - events(eventMap:Meteor.EventMap): void; - helpers(helpers:{[id:string]: any}): void; - } - /** End definitions for Template **/ + interface UserEmail { + address:string; + verified:boolean; + } - interface LoginWithExternalServiceOptions { - requestPermissions?: string[]; - requestOfflineToken?: Boolean; - forceApprovalPrompt?: Boolean; - userEmail?: string; - loginStyle?: string; - } + interface User { + _id?:string; + username?:string; + emails?:Meteor.UserEmail[]; + createdAt?: number; + profile?: any; + services?: any; + } - function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + interface SubscriptionHandle { + stop(): void; + ready(): boolean; + } - interface UserEmail { - address:string; - verified:boolean; - } + interface Tinytest { + add(name:string, func:Function); + addAsync(name:string, func:Function); + } - interface User { - _id?:string; - username?:string; - emails?:Meteor.UserEmail[]; - createdAt?: number; - profile?: any; - services?: any; - } + enum StatusEnum { + connected, + connecting, + failed, + waiting, + offline + } - interface SubscriptionHandle { - stop(): void; - ready(): boolean; - } + interface LiveQueryHandle { + stop(): void; + } - interface Tinytest { - add(name:string, func:Function); - addAsync(name:string, func:Function); - } + interface EmailFields { + subject?: Function; + text?: Function; + } - enum StatusEnum { - connected, - connecting, - failed, - waiting, - offline - } + interface EmailTemplates { + from: string; + siteName: string; + resetPassword: Meteor.EmailFields; + enrollAccount: Meteor.EmailFields; + verifyEmail: Meteor.EmailFields; + } - interface LiveQueryHandle { - stop(): void; - } + interface Error { + error: number; + reason?: string; + details?: string; + } - interface EmailFields { - subject?: Function; - text?: Function; - } - - interface EmailTemplates { - from: string; - siteName: string; - resetPassword: Meteor.EmailFields; - enrollAccount: Meteor.EmailFields; - verifyEmail: Meteor.EmailFields; - } - - interface Error { - error: number; - reason?: string; - details?: string; - } - - interface Connection { - id: string; - close: Function; - onClose: Function; - clientAddress: string; - httpHeaders: Object; - } + interface Connection { + id: string; + close: Function; + onClose: Function; + clientAddress: string; + httpHeaders: Object; + } } declare module Mongo { - interface Selector extends Object {} - interface Modifier {} - interface SortSpecifier {} - interface FieldSpecifier { - [id: string]: Number; - } - enum IdGenerationEnum { - STRING, - MONGO - } - interface AllowDenyOptions { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; - fetch?: string[]; - transform?: Function; - } + interface Selector extends Object {} + interface Modifier {} + interface SortSpecifier {} + interface FieldSpecifier { + [id: string]: Number; + } + enum IdGenerationEnum { + STRING, + MONGO + } + interface AllowDenyOptions { + insert?: (userId:string, doc) => boolean; + update?: (userId, doc, fieldNames, modifier) => boolean; + remove?: (userId, doc) => boolean; + fetch?: string[]; + transform?: Function; + } } declare module HTTP { - interface HTTPRequest { - content?:string; - data?:any; - query?:string; - params?:{[id:string]:string}; - auth?:string; - headers?:{[id:string]:string}; - timeout?:number; - followRedirects?:boolean; - } - interface HTTPResponse { - statusCode:number; - content:string; - // response is not always json - data:any; - headers:{[id:string]:string}; - } + interface HTTPRequest { + content?:string; + data?:any; + query?:string; + params?:{[id:string]:string}; + auth?:string; + headers?:{[id:string]:string}; + timeout?:number; + followRedirects?:boolean; + } + + interface HTTPResponse { + statusCode?:number; + headers?:{[id:string]: string}; + content?:string; + data?:any; + } + + function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?:Function):HTTP.HTTPResponse; + function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; + function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; + function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; + function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; + } declare module Email { - interface EmailMessage { - from: string; - to: any; // string or string[] - cc?: any; // string or string[] - bcc?: any; // string or string[] - replyTo?: any; // string or string[] - subject: string; - text?: string; - html?: string; - headers?: {[id: string]: string}; - } + interface EmailMessage { + from: string; + to: any; // string or string[] + cc?: any; // string or string[] + bcc?: any; // string or string[] + replyTo?: any; // string or string[] + subject: string; + text?: string; + html?: string; + headers?: {[id: string]: string}; + } } declare module DDP { - interface DDPStatic { - subscribe(name, ...rest); - call(method:string, ...parameters):void; - apply(method:string, ...parameters):void; - methods(IMeteorMethodsDictionary); - status():DDPStatus; - reconnect(); - disconnect(); - onReconnect(); - } + interface DDPStatic { + subscribe(name, ...rest); + call(method:string, ...parameters):void; + apply(method:string, ...parameters):void; + methods(IMeteorMethodsDictionary); + status():DDPStatus; + reconnect(); + disconnect(); + onReconnect(); + } - interface DDPStatus { - connected: boolean; - status: Meteor.StatusEnum; - retryCount: number; - //To turn this into an interval until the next reconnection, use retryTime - (new Date()).getTime() - retryTime?: number; - reason?: string; - } + interface DDPStatus { + connected: boolean; + status: Meteor.StatusEnum; + retryCount: number; + //To turn this into an interval until the next reconnection, use retryTime - (new Date()).getTime() + retryTime?: number; + reason?: string; + } } declare module Random { - function id(numberOfChars?: number): string; - function secret(numberOfChars?: number): string; - function fraction():number; - function hexString(numberOfDigits:number):string; // @param numberOfDigits, @returns a random hex string of the given length - function choice(array:any[]):string; // @param array, @return a random element in array - function choice(str:string):string; // @param str, @return a random char in str + function id(numberOfChars?: number): string; + function secret(numberOfChars?: number): string; + function fraction():number; + function hexString(numberOfDigits:number):string; // @param numberOfDigits, @returns a random hex string of the given length + function choice(array:any[]):string; // @param array, @return a random element in array + function choice(str:string):string; // @param str, @return a random char in str } declare module Blaze { - interface View { - name: string; - parentView: Blaze.View; - isCreated: boolean; - isRendered: boolean; - isDestroyed: boolean; - renderCount: number; - autorun(runFunc: Function): void; - onViewCreated(func: Function): void; - onViewReady(func: Function): void; - onViewDestroyed(func: Function): void; - firstNode(): Node; - lastNode(): Node; - template: Blaze.Template; - templateInstance(): any; - } - interface Template { - viewName: string; - renderFunction: Function; - constructView(): Blaze.View; - } + interface View { + name: string; + parentView: Blaze.View; + isCreated: boolean; + isRendered: boolean; + isDestroyed: boolean; + renderCount: number; + autorun(runFunc: Function): void; + onViewCreated(func: Function): void; + onViewReady(func: Function): void; + onViewDestroyed(func: Function): void; + firstNode(): Node; + lastNode(): Node; + template: Blaze.Template; + templateInstance(): any; + } + interface Template { + viewName: string; + renderFunction: Function; + constructView(): Blaze.View; + } } +declare module BrowserPolicy { + + interface framing { + disallow():void; + restrictToOrigin(origin:string):void; + allowAll():void; + } + interface content { + allowEval():void; + allowInlineStyles():void; + allowInlineScripts():void; + allowSameOriginForAll():void; + allowDataUrlForAll():void; + allowOriginForAll(origin:string):void; + allowImageOrigin(origin:string):void; + allowFrameOrigin(origin:string):void; + allowContentTypeSniffing():void; + allowAllContentOrigin():void; + allowAllContentDataUrl():void; + allowAllContentSameOrigin():void; + + disallowAll():void; + disallowInlineStyles():void; + disallowEval():void; + disallowInlineScripts():void; + disallowFont():void; + disallowObject():void; + disallowAllContent():void; + //TODO: add the basic content types + // allowOrigin(origin) + // allowDataUrl() + // allowSameOrigin() + // disallow() + } +} + +declare module Tracker { + export var ComputationFunction: (computation: Tracker.Computation) => void; + +} + +declare var IterationCallback: (doc: T, index: number, cursor: Mongo.Cursor) => void; + /** * These modules and interfaces are automatically generated from the Meteor api.js file */ declare module Accounts { - var ui: { - config(options: { - requestPermissions?: Object; - requestOfflineToken?: Object; - forceApprovalPrompt?: Object; - passwordSignupFields?: string; - }): void; - }; - var emailTemplates: Meteor.EmailTemplates; + function changePassword(oldPassword: string, newPassword: string, callback?: Function): void; function config(options: { - sendVerificationEmail?: boolean; - forbidClientAccountCreation?: Boolean; - restrictCreationByEmailDomain?: string | Function; - loginExpirationInDays?: number; - oauthSecretKey?: string; - }): void; - function validateLoginAttempt(func: Function): {stop: Function}; - function onLogin(func: Function): {stop: Function}; - function onLoginFailure(func: Function): {stop: Function}; + sendVerificationEmail?: boolean; + forbidClientAccountCreation?: boolean; + restrictCreationByEmailDomain?: string | Function; + loginExpirationInDays?: number; + oauthSecretKey?: string; + }): void; + function createUser(options: { + username?: string; + email?: string; + password?: string; + profile?: Object; + }, callback?: Function): string; + var emailTemplates: Meteor.EmailTemplates; + function forgotPassword(options: { + email?: string; + }, callback?: Function): void; function onCreateUser(func: Function): void; - function validateNewUser(func: Function): void; - function onResetPasswordLink(callback: Function): void; function onEmailVerificationLink(callback: Function): void; function onEnrollmentLink(callback: Function): void; - function createUser(options: { - username?: string; - email?: string; - password?: string; - profile?: Object; - }, callback?: Function): string; - function changePassword(oldPassword: string, newPassword: string, callback?: Function): void; - function forgotPassword(options: { - email?: string; - }, callback?: Function): void; + function onLogin(func: Function): {stop: Function}; + function onLoginFailure(func: Function): {stop: Function}; + function onResetPasswordLink(callback: Function): void; function resetPassword(token: string, newPassword: string, callback?: Function): void; - function verifyEmail(token: string, callback?: Function): void; - function setPassword(userId: string, newPassword: string): void; - function sendResetPasswordEmail(userId: string, email?: string): void; function sendEnrollmentEmail(userId: string, email?: string): void; + function sendResetPasswordEmail(userId: string, email?: string): void; function sendVerificationEmail(userId: string, email?: string): void; + function setPassword(userId: string, newPassword: string, options?: { + logout?: Object; + }): void; + var ui: { + config(options: { + requestPermissions?: Object; + requestOfflineToken?: Object; + forceApprovalPrompt?: Object; + passwordSignupFields?: string; + }): void; + }; + function validateLoginAttempt(func: Function): {stop: Function}; + function validateNewUser(func: Function): void; + function verifyEmail(token: string, callback?: Function): void; +} + +declare module App { + function accessRule(domainRule: string, options?: { + launchExternal?: boolean; + }); /** TODO: add return value **/ +function configurePlugin(pluginName: string, config: Object): void; + function icons(icons: Object): void; + function info(options: { + id?: string; + version?: string; + name?: string; + description?: string; + author?: string; + email?: string; + website?: string; + }): void; + function launchScreens(launchScreens: Object): void; + function setPreference(name: string, value: string): void; +} + +declare module Assets { + function getBinary(assetPath: string, asyncCallback?: Function): EJSON; + function getText(assetPath: string, asyncCallback?: Function): string; } declare module Blaze { - var currentView: Blaze.View; - function With(data: Object | Function, contentFunc: Function): Blaze.View; - function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; - function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; - function isTemplate(value: any): boolean; - function render(templateOrView: Template | Blaze.View, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View; - function renderWithData(templateOrView: Template | Blaze.View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View; - function remove(renderedView: Blaze.View): void; - function toHTML(templateOrView: Template | Blaze.View): string; - function toHTMLWithData(templateOrView: Template | Blaze.View, data: Object | Function): string; - function getData(elementOrView?: HTMLElement | Blaze.View): Object; - function getView(element?: HTMLElement): Blaze.View; - function Template(viewName?: string, renderFunction?: Function): void; - interface Template{ + function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; + var Template: TemplateStatic; + interface TemplateStatic { + new(viewName?: string, renderFunction?: Function): Template; + // It should be [templateName: string]: TemplateInstance but this is not possible -- user will need to cast to TemplateInstance + [templateName: string]: any | Template; // added "any" to make it work + head: Template; + find(selector:string):Blaze.Template; + findAll(selector:string):Blaze.Template[]; + $:any; + } + interface Template { } - function TemplateInstance(view: Blaze.View): void; - interface TemplateInstance{ + var TemplateInstance: TemplateInstanceStatic; + interface TemplateInstanceStatic { + new(view: Blaze.View): TemplateInstance; + } + interface TemplateInstance { + $(selector: string): any; + autorun(runFunc: Function): Object; data: Object; - view: Object; + find(selector?: string): Blaze.TemplateInstance; + findAll(selector: string): Blaze.TemplateInstance[]; firstNode: Object; lastNode: Object; - $(selector: string): Node[]; - findAll(selector: string): HTMLElement[]; - find(selector?: string): HTMLElement; - autorun(runFunc: Function): Object; + subscribe(name: string, ...args): Meteor.SubscriptionHandle; + subscriptionsReady(): boolean; + view: Object; } - function View(name?: string, renderFunction?: Function): void; - interface View{ + function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; + var View: ViewStatic; + interface ViewStatic { + new(name?: string, renderFunction?: Function): View; + } + interface View { } + function With(data: Object | Function, contentFunc: Function): Blaze.View; + var currentView: Blaze.View; + function getData(elementOrView?: HTMLElement | Blaze.View): Object; + function getView(element?: HTMLElement): Blaze.View; + function isTemplate(value: any): boolean; + function remove(renderedView: Blaze.View): void; + function render(templateOrView: Template | Blaze.View, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View; + function renderWithData(templateOrView: Template | Blaze.View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View; + function toHTML(templateOrView: Template | Blaze.View): string; + function toHTMLWithData(templateOrView: Template | Blaze.View, data: Object | Function): string; } -declare module Match { - function test(value: any, pattern: any): boolean; +declare module Cordova { + function depends(dependencies:{[id:string]:string}): void; } declare module DDP { @@ -352,330 +427,355 @@ declare module DDP { } declare module EJSON { - var newBinary: any; - function addType(name: string, factory: Function): void; - function toJSONValue(val: EJSON): JSON; - function fromJSONValue(val: JSON): any; - function stringify(val: EJSON, options?: { - indent?: boolean | number | string; - canonical?: Boolean; - }): string; - function parse(str: string): EJSON; - function isBinary(x: Object): boolean; - function equals(a: EJSON, b: EJSON, options?: { - keyOrderSensitive?: boolean; - }): boolean; - function clone(val:T): T; - function CustomType(): void; - interface CustomType{ - typeName(): string; - toJSONValue(): JSON; + var CustomType: CustomTypeStatic; + interface CustomTypeStatic { + new(): CustomType; + } + interface CustomType { clone(): EJSON.CustomType; equals(other: Object): boolean; + toJSONValue(): JSON; + typeName(): string; } + function addType(name: string, factory: (val: EJSONable) => JSONable): void; + function clone(val:T): T; + function equals(a: EJSON, b: EJSON, options?: { + keyOrderSensitive?: boolean; + }): boolean; + function fromJSONValue(val: JSON): any; + function isBinary(x: Object): boolean; + var newBinary: any; + function parse(str: string): EJSON; + function stringify(val: EJSON, options?: { + indent?: boolean | number | string; + canonical?: boolean; + }): string; + function toJSONValue(val: EJSON): JSON; +} + +declare module Match { + function test(value: any, pattern: any): boolean; } declare module Meteor { - var users: Mongo.Collection; - var isClient: boolean; - var isServer: boolean; - var settings: {[id:string]: any}; - var isCordova: boolean; - var release: string; - function userId(): string; - function loggingIn(): boolean; - function user(): Meteor.User; - function logout(callback?: Function): void; - function logoutOtherClients(callback?: Function): void; - function loginWith(options?: { - requestPermissions?: string[]; - requestOfflineToken?: boolean; - forceApprovalPrompt?: Boolean; - userEmail?: string; - loginStyle?: string; - }, callback?: Function): void; - function loginWithPassword(user: Object | string, password: string, callback?: Function): void; - function subscribe(name: string, ...args): SubscriptionHandle; - function call(name: string, ...args): void; - function apply(name: string, args: EJSON[], options?: { - wait?: boolean; - onResultReceived?: Function; - }, asyncCallback?: Function): void; - function status(): Meteor.StatusEnum; - function reconnect(): void; - function disconnect(): void; - function onConnection(callback: Function): void; - function publish(name: string, func: Function): void; - function methods(methods: Object): void; - function wrapAsync(func: Function, context?: Object): any; - function startup(func: Function): void; - function setTimeout(func: Function, delay: number): number; - function setInterval(func: Function, delay: number): number; - function clearInterval(id: number): void; - function clearTimeout(id: number): void; - function absoluteUrl(path?: string, options?: { - secure?: boolean; - replaceLocalhost?: Boolean; - rootUrl?: string; - }): string; - function Error(error: string, reason?: string, details?: string): void; - interface Error{ + var Error: ErrorStatic; + interface ErrorStatic { + new(error: string, reason?: string, details?: string): Error; + } + interface Error { } + function absoluteUrl(path?: string, options?: { + secure?: boolean; + replaceLocalhost?: boolean; + rootUrl?: string; + }): string; + function apply(name: string, args: EJSONable[], options?: { + wait?: boolean; + onResultReceived?: Function; + }, asyncCallback?: Function): any; + function call(name: string, ...args): any; + function clearInterval(id: number): void; + function clearTimeout(id: number): void; + function disconnect(): void; + var isClient: boolean; + var isCordova: boolean; + var isServer: boolean; + function loggingIn(): boolean; + function loginWith(options?: { + requestPermissions?: string[]; + requestOfflineToken?: boolean; + forceApprovalPrompt?: boolean; + userEmail?: string; + loginStyle?: string; + }, callback?: Function): void; + function loginWithPassword(user: Object | string, password: string, callback?: Function): void; + function logout(callback?: Function): void; + function logoutOtherClients(callback?: Function): void; + function methods(methods: Object): void; + function onConnection(callback: Function): void; + function publish(name: string, func: Function): void; + function reconnect(): void; + var release: string; + function setInterval(func: Function, delay: number): number; + function setTimeout(func: Function, delay: number): number; + var settings: {[id:string]: any}; + function startup(func: Function): void; + function status(): Meteor.StatusEnum; + function subscribe(name: string, ...args): Meteor.SubscriptionHandle; + function user(): Meteor.User; + function userId(): string; + var users: Mongo.Collection; + function wrapAsync(func: Function, context?: Object): any; } declare module Mongo { - function Collection(name: string, options?: { - connection?: Object; - idGeneration?: string; - transform?: Function; - }): void; - interface Collection{ - insert(doc: Object, callback?: Function): string; - update(selector: Mongo.Selector, modifier: Mongo.Modifier, options?: { - multi?: boolean; - upsert?: Boolean; - }, callback?: Function): number; - find(selector?: Mongo.Selector, options?: { - sort?: Mongo.SortSpecifier; - skip?: number; - limit?: number; - fields?: Mongo.FieldSpecifier; - reactive?: boolean; - transform?: Function; - }): Mongo.Cursor; - findOne(selector?: Mongo.Selector, options?: { - sort?: Mongo.SortSpecifier; - skip?: number; - fields?: Mongo.FieldSpecifier; - reactive?: boolean; - transform?: Function; - }): T; - remove(selector: Mongo.Selector, callback?: Function): void; - upsert(selector: Mongo.Selector, modifier: Mongo.Modifier, options?: { - multi?: boolean; - }, callback?: Function): {numberAffected?: number; insertedId?: string;}; + var Collection: CollectionStatic; + interface CollectionStatic { + new(name: string, options?: { + connection?: Object; + idGeneration?: string; + transform?: Function; + }): Collection; + } + interface Collection { allow(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; - fetch?: string[]; - transform?: Function; - }): boolean; + insert?: (userId:string, doc) => boolean; + update?: (userId, doc, fieldNames, modifier) => boolean; + remove?: (userId, doc) => boolean; + fetch?: string[]; + transform?: Function; + }): boolean; deny(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; - fetch?: string[]; - transform?: Function; - }): boolean; + insert?: (userId:string, doc) => boolean; + update?: (userId, doc, fieldNames, modifier) => boolean; + remove?: (userId, doc) => boolean; + fetch?: string[]; + transform?: Function; + }): boolean; + find(selector?: Mongo.Selector, options?: { + sort?: Mongo.SortSpecifier; + skip?: number; + limit?: number; + fields?: Mongo.FieldSpecifier; + reactive?: boolean; + transform?: Function; + }): Mongo.Cursor; + findOne(selector?: Mongo.Selector, options?: { + sort?: Mongo.SortSpecifier; + skip?: number; + fields?: Mongo.FieldSpecifier; + reactive?: boolean; + transform?: Function; + }): T; + insert(doc: Object, callback?: Function): string; + remove(selector: Mongo.Selector, callback?: Function): void; + update(selector: Mongo.Selector, modifier: Mongo.Modifier, options?: { + multi?: boolean; + upsert?: boolean; + }, callback?: Function): number; + upsert(selector: Mongo.Selector, modifier: Mongo.Modifier, options?: { + multi?: boolean; + }, callback?: Function): {numberAffected?: number; insertedId?: string;}; + _ensureIndex(indexName: string, options?: {[key: string]: any}): void; } - function ObjectID(hexString: string): void; - interface ObjectID{ + var Cursor: CursorStatic; + interface CursorStatic { + new(): Cursor; } - - function Cursor(): void; - interface Cursor{ - forEach(callback: Function, thisArg?: any): void; - map(callback: Function, thisArg?: any): void; - fetch(): Array; + interface Cursor { count(): number; + fetch(): Array; + forEach(callback: (doc: T, index: number, cursor: Mongo.Cursor) => void, thisArg?: any): void; + map(callback: (doc: T, index: number, cursor: Mongo.Cursor) => void, thisArg?: any): Array; observe(callbacks: Object): Meteor.LiveQueryHandle; observeChanges(callbacks: Object): Meteor.LiveQueryHandle; } -} - -declare module Tracker { - var active: boolean; - var currentComputation: Tracker.Computation; - function Computation(): void; - interface Computation{ - stopped: boolean; - invalidated: boolean; - firstRun: boolean; - onInvalidate(callback: Function): void; - invalidate(): void; - stop(): void; + var ObjectID: ObjectIDStatic; + interface ObjectIDStatic { + new(hexString: string): ObjectID; + } + interface ObjectID { } - function flush(): void; - function autorun(runFunc: Function): Tracker.Computation; - function nonreactive(func: Function): void; - function onInvalidate(callback: Function): void; - function afterFlush(callback: Function): void; - function Dependency(): void; - interface Dependency{ - depend(fromComputation?: Tracker.Computation): boolean - changed(): void; - hasDependents(): boolean - } - -} - -declare module Assets { - function getText(assetPath: string, asyncCallback?: Function): string; - function getBinary(assetPath: string, asyncCallback?: Function): EJSON; -} - -declare module App { - function info(options: { - id?: string; - version?: string; - name?: string; - description?: string; - author?: string; - email?: string; - website?: string; - }): void; - function setPreference(name: string, value: string): void; - function configurePlugin(pluginName: string, config: Object): void; - function icons(icons: Object): void; - function launchScreens(launchScreens: Object): void; -} - -declare module Package { - function describe(options: { - summary?: string; - version?: string; - name?: string; - git?: string; - documentation?: string; - }): void; - function onUse(func: Function): void; - function onTest(func: Function): void; - function registerBuildPlugin(options?: { - name?: string; - use?: string | string[]; - sources?: string[]; - npmDependencies?: Object; - }): void; } declare module Npm { function depends(dependencies:{[id:string]:string}): void; - function require(name: string): void; + function require(name: string): any; } -declare module Cordova { - function depends(dependencies:{[id:string]:string}): void; +declare module Package { + function describe(options: { + summary?: string; + version?: string; + name?: string; + git?: string; + documentation?: string; + }): void; + function onTest(func: Function): void; + function onUse(func: Function): void; + function registerBuildPlugin(options?: { + name?: string; + use?: string | string[]; + sources?: string[]; + npmDependencies?: Object; + }): void; +} + +declare module Tracker { + function Computation(): void; + interface Computation { + firstRun: boolean; + invalidate(): void; + invalidated: boolean; + onInvalidate(callback: Function): void; + stop(): void; + stopped: boolean; + } + + var Dependency: DependencyStatic; + interface DependencyStatic { + new(): Dependency; + } + interface Dependency { + changed(): void; + depend(fromComputation?: Tracker.Computation): boolean; + hasDependents(): boolean; + } + + var active: boolean; + function afterFlush(callback: Function): void; + function autorun(runFunc: (computation: Tracker.Computation) => void, options?: { + onError?: Function; + }): Tracker.Computation; + var currentComputation: Tracker.Computation; + function flush(): void; + function nonreactive(func: Function): void; + function onInvalidate(callback: Function): void; } declare module Session { - function set(key: string, value: EJSON | any /** Undefined **/): void; - function setDefault(key: string, value: EJSON | any /** Undefined **/): void; - function get(key: string): any; function equals(key: string, value: string | number | boolean | any /** Null **/ | any /** Undefined **/): boolean; + function get(key: string): any; + function set(key: string, value: EJSONable | any /** Undefined **/): void; + function setDefault(key: string, value: EJSONable | any /** Undefined **/): void; } declare module HTTP { function call(method: string, url: string, options?: { - content?: string; - data?: Object; - query?: string; - params?: Object; - auth?: string; - headers?: Object; - timeout?: number; - followRedirects?: boolean; - }, asyncCallback?: Function): HTTP.HTTPResponse; + content?: string; + data?: Object; + query?: string; + params?: Object; + auth?: string; + headers?: Object; + timeout?: number; + followRedirects?: boolean; + npmRequestOptions?: Object; + }, asyncCallback?: Function): HTTP.HTTPResponse; + function del(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; function get(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; function post(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; function put(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; - function del(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; } declare module Email { function send(options: { - from?: string; - to?: string | string[]; - cc?: string | string[]; - bcc?: string | string[]; - replyTo?: string | string[]; - subject?: string; - text?: string; - html?: string; - headers?: Object; - }): void; + from?: string; + to?: string | string[]; + cc?: string | string[]; + bcc?: string | string[]; + replyTo?: string | string[]; + subject?: string; + text?: string; + html?: string; + headers?: Object; + attachments?: Object[]; + }): void; } -declare function Subscription(): void; -interface Subscription{ - connection: Meteor.Connection; - userId: string; - error(error: Error): void; - stop(): void; - onStop(func: Function): void; - added(collection: string, id: string, fields: Object): void; - changed(collection: string, id: string, fields: Object): void; - removed(collection: string, id: string): void; - ready(): void; +declare var CompileStep: CompileStepStatic; +interface CompileStepStatic { + new(): CompileStep; +} +interface CompileStep { + addAsset(options: { + }, path: string, data: any /** Buffer **/ | string); /** TODO: add return value **/ + addHtml(options: { + section?: string; + data?: string; + }); /** TODO: add return value **/ + addJavaScript(options: { + path?: string; + data?: string; + sourcePath?: string; + }); /** TODO: add return value **/ + addStylesheet(options: { + }, path: string, data: string, sourceMap: string); /** TODO: add return value **/ + arch; /** TODO: add return value **/ + declaredExports; /** TODO: add return value **/ + error(options: { + }, message: string, sourcePath?: string, line?: number, func?: string); /** TODO: add return value **/ + fileOptions; /** TODO: add return value **/ + fullInputPath; /** TODO: add return value **/ + inputPath; /** TODO: add return value **/ + inputSize; /** TODO: add return value **/ + packageName; /** TODO: add return value **/ + pathForSourceMap; /** TODO: add return value **/ + read(n?: number): any; + rootOutputPath; /** TODO: add return value **/ } -declare function ReactiveVar(initialValue: T, equalsFunc?: Function): void; -interface ReactiveVar{ +declare var PackageAPI: PackageAPIStatic; +interface PackageAPIStatic { + new(): PackageAPI; +} +interface PackageAPI { + addFiles(filename: string | string[], architecture?: string): void; + export(exportedObject: string, architecture?: string): void; + imply(packageSpecs: string | string[]): void; + use(packageNames: string | string[], architecture?: string, options?: { + weak?: boolean; + unordered?: boolean; + }): void; + versionsFrom(meteorRelease: string | string[]): void; +} + +declare var ReactiveVar: ReactiveVarStatic; +interface ReactiveVarStatic { + new(initialValue: T, equalsFunc?: Function): ReactiveVar; +} +interface ReactiveVar { get(): T; set(newValue: T): void; } +declare var Subscription: SubscriptionStatic; +interface SubscriptionStatic { + new(): Subscription; +} +interface Subscription { + added(collection: string, id: string, fields: Object): void; + changed(collection: string, id: string, fields: Object): void; + connection: Meteor.Connection; + error(error: Error): void; + onStop(func: Function): void; + ready(): void; + removed(collection: string, id: string): void; + stop(): void; + userId: string; +} + declare var Template: TemplateStatic; -// TemplateStatic interface should be defined separately at top with static methods -interface Template{ - onCreated: Function; - onRendered: Function; - onDestroyed: Function; - created: Function; - rendered: Function; - destroyed: Function; - body: TemplateStatic; - helpers(helpers:{[id:string]: any}): void; - events(eventMap: {[actions: string]: Function}): void; - instance(): Blaze.TemplateInstance; +interface TemplateStatic { + new(): Template; + // It should be [templateName: string]: TemplateInstance but this is not possible -- user will need to cast to TemplateInstance + [templateName: string]: any | Template; // added "any" to make it work + head: Template; + find(selector:string):Blaze.Template; + findAll(selector:string):Blaze.Template[]; + $:any; + body: Template; currentData(): {}; + instance(): Blaze.TemplateInstance; parentData(numLevels?: number): {}; registerHelper(name: string, helperFunction: Function): void; } - -declare function CompileStep(): void; -interface CompileStep{ - inputSize; /** TODO: add return value **/ - inputPath; /** TODO: add return value **/ - fullInputPath; /** TODO: add return value **/ - pathForSourceMap; /** TODO: add return value **/ - packageName; /** TODO: add return value **/ - rootOutputPath; /** TODO: add return value **/ - arch; /** TODO: add return value **/ - fileOptions; /** TODO: add return value **/ - declaredExports; /** TODO: add return value **/ - read(n?: number); /** TODO: add return value **/ - addHtml(options: { - section?: string; - data?: string; - }); /** TODO: add return value **/ - addStylesheet(options: { - }, path: string, data: string, sourceMap: string); /** TODO: add return value **/ - addJavaScript(options: { - path?: string; - data?: string; - sourcePath?: string; - }); /** TODO: add return value **/ - addAsset(options: { - }, path: string, data: any /** Buffer **/ | string); /** TODO: add return value **/ - error(options: { - }, message: string, sourcePath?: string, line?: number, func?: string); /** TODO: add return value **/ -} - -declare function PackageAPI(): void; -interface PackageAPI{ - use(packageNames: string | string[], architecture?: string, options?: { - weak?: boolean; - unordered?: Boolean; - }): void; - imply(packageSpecs: string | string[]): void; - addFiles(filename: string | string[], architecture?: string): void; - versionsFrom(meteorRelease: string | string[]): void; - export(exportedObject: string, architecture?: string): void; +interface Template { + created: Function; + destroyed: Function; + events(eventMap: {[actions: string]: Function}): void; + helpers(helpers:{[id:string]: any}): void; + onCreated: Function; + onDestroyed: Function; + onRendered: Function; + rendered: Function; } +declare function MethodInvocation(options: { +}); /** TODO: add return value **/ +declare function check(value: any, pattern: any): void; From 174cb68639b2aead57748eb67546dec9302b2d00 Mon Sep 17 00:00:00 2001 From: ryan-codingintrigue Date: Sat, 4 Apr 2015 09:21:51 +0100 Subject: [PATCH 25/31] Added type definitions for jQuery Window --- jquery.window/jquery.window-tests.ts | 139 ++++++++ jquery.window/jquery.window.d.ts | 460 +++++++++++++++++++++++++++ 2 files changed, 599 insertions(+) create mode 100644 jquery.window/jquery.window-tests.ts create mode 100644 jquery.window/jquery.window.d.ts diff --git a/jquery.window/jquery.window-tests.ts b/jquery.window/jquery.window-tests.ts new file mode 100644 index 000000000..0b5fa7e83 --- /dev/null +++ b/jquery.window/jquery.window-tests.ts @@ -0,0 +1,139 @@ +/// +/// + +function example_1() { + $.window({ + title: "Cyclops Studio", + url: "http://apps.fstoke.me/" + }); +} + +function example_2() { + $.window({ + showModal: true, + modalOpacity: 0.5, + icon: "http://www.fstoke.me/favicon.ico", + title: "Professional JavaScript for Web Developers", + content: $("#window_block2").html(), // load window_block2 html content + footerContent: " This is a nice plugin :^)" + }); +}; + +function example_3() { + // prepare customerized static attributes, see static attributes + // Note: you should call this method before starting to create window instances, or windows might display wrong. + $.window.prepare({ + dock: 'bottom', // change the dock direction: 'left', 'right', 'top', 'bottom' + animationSpeed: 200, // set animation speed + minWinLong: 180 // set minimized window long dimension width in pixel + }); + + // limit window within body + $.window({ + icon: 'http://www.fstoke.me/favicon.ico', + title: "This window only can be dragged within body boundary", + content: "
I only can be dragged within body element." + + "

Really? Really? You can try it... :)
", + checkBoundary: true, + x: 80, + y: 80 + }); + + // limit window within a element + $("#my_boundary_panel").window({ + icon: 'http://mail.google.com/favicon.ico', + title: "This window only can be dragged within its parent element", + content: "
I only can be dragged within my boss...@@
", + checkBoundary: true, + width: 200, + height: 160, + maxWidth: 400, + maxHeight: 300, + x: 80, + y: 80 + }); + + // assign the dock area + $.window.prepare({ + dock: 'bottom', // change the dock direction: 'left', 'right', 'top', 'bottom' + dockArea: $('#myDockArea'), // set the dock area + animationSpeed: 200, // set animation speed + minWinLong: 180 // set minimized window long dimension width in pixel + }); +} + +function example_4() { + $.window({ + title: "Un-draggable & Un-resizable Window", + content: "
I can't be dragged...
" + + "I can't be resized too...

Of course, maximize and minimize are also disabled...

" + + "So... What can I do? I only can be closed. @_@
", + draggable: false, + resizable: false, + maximizable: false, + minimizable: false, + showModal: true + }); +} + +function example_5() { + var log = console.log; + $.window({ + title: "complext window", + content: $("#window_block5").html(), // load window_block5 html content + x: 150, // the x-axis value on screen, if -1 means put on screen center + y: 100, // the y-axis value on screen, if -1 means put on screen center + width: 600, // window width + height: 300, // window height + minWidth: 200, // the minimum width, if -1 means no checking + minHeight: 100, // the minimum height, if -1 means no checking + maxWidth: 700, // the minimum width, if -1 means no checking + maxHeight: 400, // the minimum height, if -1 means no checking + scrollable: false, // a boolean flag to show scroll bar or not + onOpen: (wnd: JQueryWindow.Window) => { // a callback function while container is added into body + alert('open'); + }, + onShow: (wnd: JQueryWindow.Window) => { // a callback function while whole window display routine is finished + alert('show'); + }, + onClose: (wnd: JQueryWindow.Window) => { // a callback function while user click close button + alert('close'); + }, + onSelect: (wnd: JQueryWindow.Window) => { // a callback function while user select the window + log('select'); + }, + onUnselect: (wnd: JQueryWindow.Window) => { // a callback function while window unselected + log('unelect'); + }, + onDrag: (wnd: JQueryWindow.Window) => { // a callback function while window is going to drag + log('drag'); + }, + afterDrag: (wnd: JQueryWindow.Window) => { // a callback function after window dragged + log('after dragged'); + }, + onResize: (wnd: JQueryWindow.Window) => { // a callback function while window is going to resize + log('resize'); + }, + afterResize: (wnd: JQueryWindow.Window) => { // a callback function after window resized + log('after resized'); + }, + onMinimize: (wnd: JQueryWindow.Window) => { // a callback function while window is going to minimize + log('minimize'); + }, + afterMinimize: (wnd: JQueryWindow.Window) => { // a callback function after window minimized + log('after minimized'); + }, + onMaximize: (wnd: JQueryWindow.Window) => { // a callback function while window is going to maximize + log('maximize'); + }, + afterMaximize: (wnd: JQueryWindow.Window) => { // a callback function after window maximized + log('after maximized'); + }, + onCascade: (wnd: JQueryWindow.Window) => { // a callback function while window is going to cascade + log('cascade'); + }, + afterCascade: (wnd: JQueryWindow.Window) => { // a callback function after window cascaded + log('after cascaded'); + } + }); +} \ No newline at end of file diff --git a/jquery.window/jquery.window.d.ts b/jquery.window/jquery.window.d.ts new file mode 100644 index 000000000..8fb4bbc81 --- /dev/null +++ b/jquery.window/jquery.window.d.ts @@ -0,0 +1,460 @@ +// Type definitions for Window plugin for jQuery 5.0.4 +// Project: http://fstoke.me/jquery/window/ +// Definitions by: Ryan Graham +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQueryWindow { + // Instance methods + interface Window { + /** + get window id + **/ + getWindowId(): string; + /** + get window container's parent panel, it's a jQuery object + **/ + getCaller(): JQuery; + /** + get window container panel, it's a jQuery object + **/ + getContainer(): JQuery; + /** + get window header panel, it's a jQuery object + **/ + getHeader(): JQuery; + /** + get window frame panel, it's a jQuery object + **/ + getFrame(): JQuery; + /** + get window footer panel, it's a jQuery object + **/ + getFooter(): JQuery; + /** + set current window as screen center + **/ + alignCenter(): void; + /** + set current window as horizontal center + **/ + alignHorizontalCenter(): void; + /** + set current window as vertical center + **/ + alignVerticalCenter(): void; + /** + select current window, it will increase the original z-index value with 2 + **/ + select(): void; + /** + unselect current window, it will set the z-index as original options.z + **/ + unselect(): void; + /** + move current window to target position or shift it by passed distance + **/ + move(x: number, y: number, bShift: boolean): void; + /** + resize current window to target width/height + **/ + resize(width: number, height: number): void; + /** + maximize current window + **/ + maximize(): void; + /** + minimize current window + **/ + minimize(): void; + /** + restore current window, it could be maximized or cascade status + **/ + restore(): void; + /** + close current window + **/ + close(quiet: boolean): void; + /** + hide current window + **/ + hide(): void; + /** + show current window + **/ + show(): void; + /** + change window title + **/ + setTitle(title: string): void; + /** + change iframe url + **/ + setUrl(url: string): void; + /** + change frame content + **/ + setContent(content: string|JQuery|HTMLElement): void; + /** + change footer content + **/ + setFooterContent(content: string|JQuery|HTMLElement): void; + /** + get window title text + **/ + getTitle(): string; + /** + get url string + **/ + getUrl(): string; + /** + get frame html content + **/ + getContent(): string; + /** + get footer html content + **/ + getFooterContent(): string; + /** + get window maximized status + **/ + isMaximized(): boolean; + /** + get window minmized status + **/ + isMinimized(): boolean; + /** + get window selected status + **/ + isSelected(): boolean; + /** + set window icon + **/ + setIcon(iconUrl: string): void; + /** + show window icon + **/ + showIcon(): void; + /** + hide window icon + **/ + hideIcon(): void; + } + + // Static methods + interface Static { + (options: WindowOptions): JQueryWindow.Window; + /** + initialize with customerized static setting attributes + **/ + prepare(options?: StaticOptions): void; + /** + close all created windows + **/ + closeAll(quiet?: boolean): void; + /** + hide all created windows + **/ + hideAll(): void; + /** + show all created windows + **/ + showAll(): void; + /** + return all created windows instance + **/ + getAll(): Array; + /** + get the window instance by passed window id + **/ + getWindow(windowId: string): JQueryWindow.Window; + /** + get the selected window instance + **/ + getSelectedWindow(): JQueryWindow.Window; + } + + // Static options + interface StaticOptions { + /** + the direction of minimized window dock at. the available values are [left, right, top, bottom] + **/ + dock?: string; + /** + the area which the windows will dock at + **/ + dockArea?: JQuery|HTMLElement; + /** + the speed of animations: maximize, minimize, restore, shift, in milliseconds + **/ + animationSpeed?: number; + /** + the narrow dimension of minimized window + **/ + minWinNarrow?: number; + /** + the long dimension of minimized window + **/ + minWinLong?: number; + /** + to handle browser scrollbar when window status changed(maximize, minimize, cascade) + **/ + handleScrollbar?: boolean; + /** + to decide show log in firebug, IE8, chrome console + **/ + showLog?: boolean; + } + + // Instance options + interface WindowOptions { + /** + an icon image url string. if this attribute is given, it will force to replace the original favicon of remote page on window. or you can set it as null to hide icon. + **/ + icon?: string; + /** + the title text of window + **/ + title: string; + /** + the target url of iframe ready to load. + **/ + url?: string; + /** + this attribute only works when url is null. when passing a jquery object or a element, it will clone the original one to append. + **/ + content?: string|JQuery|HTMLElement; + /** + same as content attribute, but it's put on footer panel. + **/ + footerContent?: string|JQuery|HTMLElement; + /** + container extra class + **/ + containerClass?: string; + /** + header extra class + **/ + headerClass?: string; + /** + frame extra class + **/ + frameClass?: string; + /** + footer extra class + **/ + footerClass?: string; + /** + selected header extra class + **/ + selectedHeaderClass?: string; + /** + the x-axis value on screen(or caller element), if -1 means put on screen(or caller element) center + **/ + x?: number; + /** + the y-axis value on screen(or caller element), if -1 means put on screen(or caller element) center + **/ + y?: number; + /** + the css z-index value + **/ + z?: number; + /** + window width + **/ + width?: number; + /** + window height + **/ + height?: number; + /** + the minimum width, if -1 means no checking + **/ + minWidth?: number; + /** + the minimum height, if -1 means no checking + **/ + minHeight?: number; + /** + the maximum width, if -1 means no checking + **/ + maxWidth?: number; + /** + the maximum height, if -1 means no checking + **/ + maxHeight?: number; + /** + to control show modal on background + **/ + showModal?: boolean; + /** + the opacity of modal dialog + **/ + modalOpacity?: number; + /** + to control show footer panel + **/ + showFooter?: boolean; + /** + to control display window as round corner + **/ + showRoundCorner?: boolean; + /** + to control window closable + **/ + closable?: boolean; + /** + to control window minimizable + **/ + minimizable?: boolean; + /** + to control window maximizable + **/ + maximizable?: boolean; + /** + to control window with remote url could be bookmarked + **/ + bookmarkable?: boolean; + /** + to control window draggable + **/ + draggable?: boolean; + /** + to control window resizable + **/ + resizable?: boolean; + /** + to show scroll bar or not + **/ + scrollable?: boolean; + /** + to check window dialog overflow html body or caller element + **/ + checkBoundary?: boolean; + /** + to limit window only can be dragged within browser window. this attribute only works when checkBoundary is true and caller is null. + **/ + withinBrowserWindow?: boolean; + /** + to describe the customized button display and callback function + **/ + custBtns?: Array; + /** + a callback function while container is added into body + **/ + onOpen?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while whole window display routine is finished + **/ + onShow?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while user click close button + **/ + onClose?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while user select the window + **/ + onSelect?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while window unselected + **/ + onUnselect?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while window is going to drag + **/ + onDrag?: (wnd: JQueryWindow.Window) => void; + /** + a callback function after window dragged + **/ + afterDrag?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while window is going to resize + **/ + onResize?: (wnd: JQueryWindow.Window) => void; + /** + a callback function after window resized + **/ + afterResize?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while window is going to minimize + **/ + onMinimize?: (wnd: JQueryWindow.Window) => void; + /** + a callback function after window minimized + **/ + afterMinimize?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while window is going to maximize + **/ + onMaximize?: (wnd: JQueryWindow.Window) => void; + /** + a callback function after window maximized + **/ + afterMaximize?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while window is going to cascade + **/ + onCascade?: (wnd: JQueryWindow.Window) => void; + /** + a callback function after window cascaded + **/ + afterCascade?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while iframe ready to connect remoting url. this attribute only works while url attribute is given + **/ + onIframeStart?: (wnd: JQueryWindow.Window) => void; + /** + a callback function while iframe load finished. this attribute only works while url attribute is given + **/ + onIframeEnd?: (wnd: JQueryWindow.Window) => void; + /** + if null means no check, or pass a string to show warning message while iframe is going to redirect current top page + **/ + iframeRedirectCheckMsg?: string; + /** + random the new created window position, it only works when options x,y value both are -1 + **/ + createRandomOffset?: { x: number; y: number }; + } + + // Button definition + interface Button { + /** + + **/ + id: string; + /** + + **/ + title?: string; + /** + + **/ + clazz?: string; + /** + + **/ + style?: string; + /** + + **/ + image: string; + /** + + **/ + callback: (btn: JQueryWindow.Button, wnd: JQueryWindow.Window) => void; + } + +} + +// Register with JQuery instance +interface JQuery { + window(options: JQueryWindow.WindowOptions): JQueryWindow.Window; +} + +// Register with JQuery static +interface JQueryStatic { + window: JQueryWindow.Static; +} \ No newline at end of file From 6f4b2a49b992f46c75052864fe74de54ff80bde8 Mon Sep 17 00:00:00 2001 From: Tadeusz Hucal Date: Sun, 5 Apr 2015 13:08:56 +0200 Subject: [PATCH 26/31] Added definitions for Angular Growl 2 --- angular-growl-v2/angular-growl-v2-test.ts | 53 ++++++ angular-growl-v2/angular-growl-v2.d.ts | 211 ++++++++++++++++++++++ 2 files changed, 264 insertions(+) create mode 100644 angular-growl-v2/angular-growl-v2-test.ts create mode 100644 angular-growl-v2/angular-growl-v2.d.ts diff --git a/angular-growl-v2/angular-growl-v2-test.ts b/angular-growl-v2/angular-growl-v2-test.ts new file mode 100644 index 000000000..c9297932e --- /dev/null +++ b/angular-growl-v2/angular-growl-v2-test.ts @@ -0,0 +1,53 @@ +/// + +var app = angular.module("ag", ["pascalprecht.translate", "$httpProvider"]); + +app.config((growlProvider:angular.growl.IGrowlProvider, $httpProvider:angular.IHttpProvider) => { + var ttl:angular.growl.IGrowlTTLConfig = { + success: 5000, + error: 4000 + }; + + growlProvider.globalTimeToLive(ttl); + growlProvider.globalTimeToLive(5000); + growlProvider.globalDisableCloseButton(true); + growlProvider.globalDisableIcons(true); + growlProvider.globalReversedOrder(false); + growlProvider.globalDisableCountDown(true); + growlProvider.messageVariableKey("someKey"); + growlProvider.globalInlineMessages(false); + growlProvider.globalPosition("top-center"); + growlProvider.messagesKey("someKey"); + growlProvider.messageTextKey("someKey"); + growlProvider.messageTitleKey("someKey"); + growlProvider.messageSeverityKey("someKey"); + growlProvider.onlyUniqueMessages(false); + + $httpProvider.interceptors.push(growlProvider.serverMessagesInterceptor); +}); + +app.controller("Ctrl", ($scope:angular.IScope, growl:angular.growl.IGrowlService) => { + var config:angular.growl.IGrowlMessageConfig = { + ttl: 5000, + disableCountDown: true, + disableCloseButton: true + }; + + var message = "Some message"; + + growl.warning(message); + growl.warning(message, config); + growl.error(message); + growl.error(message, config); + growl.info(message); + growl.info(message, config); + growl.success(message); + growl.success(message, config); + growl.general(message); + growl.general(message, config); + growl.general(message, config, "error"); + growl.onlyUnique(); + growl.reverseOrder(); + growl.inlineMessages(); + growl.position(); +}); diff --git a/angular-growl-v2/angular-growl-v2.d.ts b/angular-growl-v2/angular-growl-v2.d.ts new file mode 100644 index 000000000..1c324723f --- /dev/null +++ b/angular-growl-v2/angular-growl-v2.d.ts @@ -0,0 +1,211 @@ +// Type definitions for Angular Growl 2 v.0.7.3 +// Project: http://janstevens.github.io/angular-growl-2 +// Definitions by: Tadeusz Hucal +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.growl { + + /** + * Global Time-To-Leave configuration. + */ + interface IGrowlTTLConfig { + success?: number; + error?: number; + warning?: number; + info?: number; + } + + /** + * Custom configuration used in single message call. + */ + interface IGrowlMessageConfig { + title?: string; + ttl?: number; + disableCountDown?: boolean; + disableIcons?: boolean; + disableCloseButton?: boolean; + referenceId?: number; + onclose?: Function; + onopen?: Function; + } + + /** + * Growl message with configuration. + */ + interface IGrowlMessage extends IGrowlMessageConfig { + text: string; + } + + /** + * Growl service provider. + */ + interface IGrowlProvider extends angular.IServiceProvider { + /** + * Pre-defined server error interceptor. + */ + serverMessagesInterceptor: (string|Function)[]; + + /** + * Set default TTL settings. + * @param ttl configuration of TTL for different type of message + */ + globalTimeToLive(ttl: IGrowlTTLConfig): void; + /** + * Set default TTL settings. + * @param ttl ttl in milliseconds + */ + globalTimeToLive(ttl: number): void; + /** + * Set default setting for disabling close button. + * @param disableCloseButton + */ + globalDisableCloseButton(disableCloseButton: boolean): void; + /** + * Set default setting for disabling icons. + * @param disableIcons + */ + globalDisableIcons(disableIcons: boolean): void; + /** + * Set reversing order of displaying new messages. + * @param reverseOrder + */ + globalReversedOrder(reverseOrder: boolean): void + /** + * Set default setting for displaying message disappear countdown. + * @param disableCountDown + */ + globalDisableCountDown(disableCountDown: boolean): void; + /** + * Set default allowance for inline messages. + * @param inline + */ + globalInlineMessages(inline: boolean): void; + /** + * Set default message position. + * @param position + */ + globalPosition(position: string): void; + /** + * Enable/disable displaying only unique messages. + * @param onlyUniqueMessages + */ + onlyUniqueMessages(onlyUniqueMessages: boolean): void; + + /** + * Set key where messages are stored (for http interceptor). + * @param messageVariableKey + */ + messagesKey(messageKey: string): void; + /** + * Set key where message text is stored (for http interceptor). + * @param messageVariableKey + */ + messageTextKey(messageTextKey: string): void; + /** + * Set key where title of message is stored (for http interceptor). + * @param messageVariableKey + */ + messageTitleKey(messageTitleKey: string): void; + /** + * Set key where severity of message is stored (for http interceptor). + * @param messageVariableKey + */ + messageSeverityKey(messageSeverityKey: string): void; + /** + * Set key where variables for message are stored (for http interceptor). + * @param messageVariableKey + */ + messageVariableKey(messageVariableKey: string): void; + } + + /** + * Growl service. + */ + interface IGrowlService { + /** + * Show warning message. + * @param message text to display (or code for angular-translate) + */ + warning(message: string): IGrowlMessage; + /** + * Show warning message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + warning(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show error message. + * @param message text to display (or code for angular-translate) + */ + error(message: string): IGrowlMessage; + /** + * Show error message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + error(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show information message. + * @param message text to display (or code for angular-translate) + */ + info(message: string): IGrowlMessage; + /** + * Show information message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + info(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show success message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + success(message: string): IGrowlMessage; + /** + * Show success message. + * @param message text to display (or code for angular-translate) + */ + success(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + */ + general(message: string): IGrowlMessage; + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + general(message: string, config: IGrowlMessageConfig): IGrowlMessage; + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + * @param severity message severity (error, warning, success, info). + */ + general(message: string, config: IGrowlMessageConfig, severity: string): IGrowlMessage; + + /** + * Get current setting for displaying only unique messages. + */ + onlyUnique(): boolean; + /** + * Get current setting for reversing messages order. + */ + reverseOrder(): boolean; + /** + * Get current allowance for inline messages. + */ + inlineMessages(): boolean; + /** + * Get current messages position. + */ + position(): string; + } +} From a3a294fb4fe220ccd6ee34db73d823be1e33da39 Mon Sep 17 00:00:00 2001 From: Ken Sheedlo Date: Sun, 5 Apr 2015 19:46:19 -0700 Subject: [PATCH 27/31] Add support for headers as object in whatwg-fetch The current typing supports passing headers through the Headers class, but the spec also supports passing headers as an object mapping header names to header values. See the [Github example](https://github.com/github/fetch#post-json). --- whatwg-fetch/whatwg-fetch-tests.ts | 12 +++++++++++- whatwg-fetch/whatwg-fetch.d.ts | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/whatwg-fetch/whatwg-fetch-tests.ts b/whatwg-fetch/whatwg-fetch-tests.ts index cc3e6320a..5248f5d1d 100644 --- a/whatwg-fetch/whatwg-fetch-tests.ts +++ b/whatwg-fetch/whatwg-fetch-tests.ts @@ -11,6 +11,16 @@ function test_fetchUrlWithOptions() { handlePromise(window.fetch("http://www.andlabs.net/html5/uCOR.php", requestOptions)); } +function test_fetchUrlWithHeadersObject() { + var requestOptions: RequestInit = { + method: "POST", + headers: { + 'Content-Type': 'application/json' + } + }; + handlePromise(window.fetch("http://www.andlabs.net/html5/uCOR.php", requestOptions)); +} + function test_fetchUrl() { handlePromise(window.fetch("http://www.andlabs.net/html5/uCOR.php")); } @@ -21,4 +31,4 @@ function handlePromise(promise: Promise) { }).then((text) => { console.log(text); }); -} \ No newline at end of file +} diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index d847463bd..4a4a9612c 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -19,7 +19,7 @@ declare class Request { interface RequestInit { method?: string; - headers?: HeaderInit; + headers?: HeaderInit|{ [index: string]: string }; body?: BodyInit; mode?: RequestMode; credentials?: RequestCredentials; @@ -81,4 +81,4 @@ declare type RequestInfo = Request|string; interface Window { fetch(url: string, init?: RequestInit): Promise; -} \ No newline at end of file +} From 9760752081c6d5487b7caa38427afc7ee8183a95 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 7 Apr 2015 12:55:13 +0900 Subject: [PATCH 28/31] Added tests --- onsenui/onsenui-tests.ts | 216 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 onsenui/onsenui-tests.ts diff --git a/onsenui/onsenui-tests.ts b/onsenui/onsenui-tests.ts new file mode 100644 index 000000000..58b72da6e --- /dev/null +++ b/onsenui/onsenui-tests.ts @@ -0,0 +1,216 @@ +/// + +function onsStatic(): void { + ons.ready(function(): void { + alert('Ready!'); + }); + ons.bootstrap(); + ons.enableAutoStatusBarFill(); + ons.disableAutoStatusBarFill(); + ons.findParentComponentUntil('ons-page'); + ons.findComponent('.class1'); + ons.setDefaultDeviceBackButtonListener(null); + ons.disableDeviceBackButtonHandler(); + ons.enableDeviceBackButtonHandler(); + ons.isReady(); + var content: HTMLElement = document.getElementById('#my-content'); + content.innerHTML = 'Test Button'; + ons.compile(content); + ons.isWebView(); + ons.createAlertDialog('myPage.html'); + ons.createDialog('myPage.html'); + ons.createPopover('myPage.html'); + + var options: alertOptions = { + message: 'text message' + }; + ons.notification.alert(options); + ons.notification.confirm(options); + ons.notification.prompt(options); + + var potrait: boolean = ons.orientation.isPortrait(); + var isLandscape: boolean = ons.orientation.isLandscape(); + ons.orientation.on('eventName', null); + ons.orientation.once('eventName', null); + ons.orientation.off('eventName', null); + + var web: boolean = ons.platform.isWebView(); + var ios: boolean = ons.platform.isIOS(); + var iPhone: boolean = ons.platform.isIPhone(); + var iPad: boolean = ons.platform.isIPad(); + var blackBerry: boolean = ons.platform.isBlackBerry(); + var opera: boolean = ons.platform.isOpera(); + var firefox: boolean = ons.platform.isFirefox(); + var safari: boolean = ons.platform.isSafari(); + var chrome: boolean = ons.platform.isChrome(); + var ie: boolean = ons.platform.isIE(); + var ios7above: boolean = ons.platform.isIOS7above(); + +} + +function onsPage(page: PageView): void { + var DBBHandler: any = page.getDeviceBackButtonHandler(); +} + +function onsCarousel(carousel: CarouselView): void { + carousel.next(); + carousel.prev(); + carousel.first(); + carousel.last(); + carousel.setSwipeable(true); + var swipeable: boolean = carousel.isSwipeable(); + carousel.setActiveCarouselItemIndex(0); + carousel.getActiveCarouselItemIndex(); + var autoScrollEnabled: boolean = carousel.isAutoScrollEnabled(); + carousel.setAutoScrollEnabled(true); + carousel.getAutoScrollRatio(); + carousel.setOverscrollable(true); + var overscrollable: boolean = carousel.isOverscrollable(); + carousel.refresh(); + var disabled: boolean = carousel.isDisabled(); + carousel.setDisabled(false); + carousel.on('eventName', null); + carousel.once('eventName', null); + carousel.off('eventName', null); +} + +function onsPullHook(pullHook: PullHookView): void { + pullHook.setDisabled(false); + var disabled: boolean = pullHook.isDisabled(); + pullHook.setHeight(15); + pullHook.setThresholdHeight(4); + pullHook.on('eventName', null); + pullHook.once('eventName', null); + pullHook.off('eventName', null); +} + +function onsSplitView(splitViewVar: SplitView): void { + splitViewVar.setMainPage('myPage.html'); + splitViewVar.setSecondaryPage('myPage2.html'); + splitViewVar.update(); + splitViewVar.on('eventName', null); + splitViewVar.once('eventName', null); + splitViewVar.off('eventName', null); +} + +function onsAlertDialog(alertDialog: AlertDialogView): void { + var options: dialogOptions = { + animation: 'default' + }; + alertDialog.show(options); + alertDialog.hide(options); + var shown: boolean = alertDialog.isShown(); + alertDialog.destroy(); + alertDialog.setCancelable(true); + var cancelable: boolean = alertDialog.isCancelable(); + alertDialog.setDisabled(false); + var disabled: boolean = alertDialog.isDisabled(); + alertDialog.on('eventName', null); + alertDialog.once('eventName', null); + alertDialog.off('eventName', null); +} + +function onsDialog(dialog: DialogView): void { + var options: dialogOptions = { + animation: 'default' + }; + dialog.show(options); + dialog.hide(options); + var shown: boolean = dialog.isShown(); + dialog.destroy(); + var DBBHandler: any = dialog.getDeviceBackButtonHandler(); + dialog.setCancelable(true); + var cancelable: boolean = dialog.isCancelable(); + dialog.setDisabled(false); + var disabled: boolean = dialog.isDisabled(); + dialog.on('eventName', null); + dialog.once('eventName', null); + dialog.off('eventName', null); +} + +function onsButton(button: ButtonView): void { + button.startSpin(); + button.stopSpin(); + var spinning: boolean = button.isSpinning(); + button.setSpinAnimation('slide-left'); + button.setDisabled(false); + var disabled: boolean = button.isDisabled(); +} + +function onsSwitch(switchVar: SwitchView): void { + var checked: boolean = switchVar.isChecked(); + switchVar.setChecked(true); + var checkbox: HTMLElement = switchVar.getCheckboxElement(); + switchVar.on('eventName', null); + switchVar.once('eventName', null); + switchVar.off('eventName', null); +} + +function onsModal(modal: ModalView): void { + modal.toggle(); + modal.show(); + modal.hide(); + var DBBHandler: boolean = modal.getDeviceBackButtonHandler(); +} + +function onsNavigator(navigator: NavigatorView): void { + var options: navigatorOptions = { + animation: 'slide' + }; + navigator.pushPage('myPage.html'); + navigator.insertPage(2, 'myPage2.html'); + navigator.popPage(); + navigator.resetToPage('myPage.html'); + var currentPage: any = navigator.getCurrentPage(); + var pages: objectArray = navigator.getPages(); + var DBBHandler: any = navigator.getDeviceBackButtonHandler(); + navigator.on('eventName', null); + navigator.once('eventName', null); + navigator.off('eventName', null); +} + +function onsSlidingMenu(slidingMenu: SlidingMenuView): void { + var options: slidingMenuOptions = { + closeMenu: true + }; + slidingMenu.setMainPage('myPage.html', options); + slidingMenu.setMenuPage('myMenu.html', options); + slidingMenu.openMenu(options); + slidingMenu.closeMenu(options); + slidingMenu.toggleMenu(options); + var opened: boolean = slidingMenu.isMenuOpened(); + var DBBHandler: any = slidingMenu.getDeviceBackButtonHandler(); + slidingMenu.setSwipeable(true); + slidingMenu.on('eventName', null); + slidingMenu.once('eventName', null); + slidingMenu.off('eventName', null); +} + +function onsTabbar(tabBar: TabbarView): void { + var options: tabbarOptions = { + keepPage: true + }; + tabBar.setActiveTab(2, options); + var activeTab: number = tabBar.getActiveTab(); + tabBar.loadPage('myPage.html'); + tabBar.on('eventName', null); + tabBar.once('eventName', null); + tabBar.off('eventName', null); +} + +function onsPopover(popover: PopoverView): void { + var options: popoverOptions = { + animation: 'fade' + } + popover.show('#element5', options); + popover.hide(options); + var shown: boolean = popover.isShown(); + popover.destroy(); + popover.setCancelable(true); + var cancelable: boolean = popover.isCancelable(); + popover.setDisabled(true); + var disabled: boolean = popover.isDisabled(); + popover.on('eventName', null); + popover.once('eventName', null); + popover.off('eventName', null); +} From 8e701011b8b38e76a97d2908869ba34e332180ab Mon Sep 17 00:00:00 2001 From: AndreasGassmann Date: Tue, 7 Apr 2015 08:10:50 +0200 Subject: [PATCH 29/31] Add support for 'passReqToCallback' to passport-local When 'passReqToCallback' is true, 'req' will be passed as the first argument to the verify callback. --- passport-local/passport-local.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/passport-local/passport-local.d.ts b/passport-local/passport-local.d.ts index 6b3cbef38..d61e51b15 100644 --- a/passport-local/passport-local.d.ts +++ b/passport-local/passport-local.d.ts @@ -13,6 +13,7 @@ declare module 'passport-local' { interface IStrategyOptions { usernameField?: string; passwordField?: string; + passReqToCallback?: boolean; } interface IVerifyOptions { @@ -20,6 +21,7 @@ declare module 'passport-local' { } interface VerifyFunction { + (req: express.Request, username: string, password: string, done: (error: any, user?: any, options?: IVerifyOptions) => void): void; (username: string, password: string, done: (error: any, user?: any, options?: IVerifyOptions) => void): void; } From 72cfe4041287b3b2014ba3df7a68f0958995f424 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 7 Apr 2015 23:18:27 +0900 Subject: [PATCH 30/31] create old jquery.dataTables definition backup --- .../jquery.dataTables-1.9.4.d.ts | 479 ++++++++++++++++++ 1 file changed, 479 insertions(+) create mode 100755 jquery.dataTables/jquery.dataTables-1.9.4.d.ts diff --git a/jquery.dataTables/jquery.dataTables-1.9.4.d.ts b/jquery.dataTables/jquery.dataTables-1.9.4.d.ts new file mode 100755 index 000000000..9884b78e2 --- /dev/null +++ b/jquery.dataTables/jquery.dataTables-1.9.4.d.ts @@ -0,0 +1,479 @@ +// Type definitions for JQuery DataTables 1.9.4 +// Project: http://www.datatables.net +// Definitions by: Armin Sander +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// missing: +// - Static methods that are defined in JQueryStatic.fn are not typed. +// - Plugin and extension definitions are not typed. + +interface JQuery +{ + dataTable(param? :DataTables.Options) : DataTables.DataTable; +} + +declare module DataTables +{ + export interface DataTable + { + /// Perform a jQuery selector action on the table's TR elements (from the tbody) and return the resulting jQuery object. + $(selector:string, opts?:RowParams): JQuery; + $(selector:Node[], opts?:RowParams): JQuery; + $(selector:JQuery, opts?:RowParams): JQuery; + + /// Almost identical to $ in operation, but in this case returns the data for the matched rows. + _(selector:string, opts?:RowParams): any[]; + _(selector:Node[], opts?:RowParams): any[]; + _(selector:JQuery, opts?:RowParams): any[]; + + /// Add a single new row or multiple rows of data to the table. + fnAddData(data:any, redraw?:boolean) : number[]; + + /// This function will make DataTables recalculate the column sizes. + fnAdjustColumnSizing(redraw? : boolean) : void; + + /// Quickly and simply clear a table + fnClearTable(redraw? : boolean) : void; + + /// The exact opposite of 'opening' a row, this function will close any rows which are currently 'open'. + fnClose(node: Node) : number; + + /// Remove a row for the table + fnDeleteRow(index: number, callback?: () => void, redraw?: boolean) : any[]; + fnDeleteRow(tr: Node, callback?: () => void, redraw?: boolean) : any[]; + + /// Restore the table to it's original state in the DOM by removing all of DataTables enhancements, + /// alterations to the DOM structure of the table and event listeners. + fnDestroy(remove?: boolean) : void; + + /// Redraw the table + fnDraw(complete? : boolean) : void; + + /// Filter the input based on data + fnFilter(input: string, column? : number, regex?: boolean, smart? : boolean, showGlobal?: boolean, caseInsensitive? : boolean) : void; + + /// Get the data for the whole table, an individual row or an individual cell based on the provided parameters. + fnGetData(row?: Node, col? : number) : any; + fnGetData(row?: number, col? : number) : any; + + /// Get an array of the TR nodes that are used in the table's body. + fnGetNodes(row? : number) : any; // Node[] | Node + + /// Get the array indexes of a particular cell from it's DOM element and column index including hidden columns + fnGetPosition(node: Node) : any; // number | number[] + + /// Check to see if a row is 'open' or not. + fnIsOpen(tr: Node) : boolean; + + /// This function will place a new row directly after a row which is currently on display on the page, + /// with the HTML contents that is passed into the function. + fnOpen(node: Node, html: string, clazz: string) : Node; + fnOpen(node: Node, html: Node, clazz: string) : Node; + fnOpen(node: Node, html: JQuery, clazz: string) : Node; + + /// Change the pagination - provides the internal logic for pagination in a simple API function. + fnPageChange(action: string, redraw?: boolean) : void; + fnPageChange(page: number, redraw?: boolean) : void; + + /// Show a particular column + fnSetColumnVis(column: number, show: boolean, redraw?: boolean) : void; + + /// Get the settings for a particular table for external manipulation + fnSettings() : Settings; + + /// Sort the table by a particular column + fnSort(col: number) : void; + fnSort(col: any[][]) : void; + + /// Attach a sort listener to an element for a given column + fnSortListener(node: Node, column: number, callback? : () => void): void; + + /// Update a table cell or row - this method will accept either a single value to update the cell with, + /// an array of values with one element for each column or an object in the same format as the original data source. + fnUpdate(data: any, row: Node, column?:number, redraw?: boolean, action? : boolean) : number; + fnUpdate(data: any, dataIndex: number, column?:number, redraw?: boolean, action? : boolean) : number; + + /// Provide a common method for plug-ins to check the version of DataTables being used, + /// in order to ensure compatibility. + fnVersionCheck(version: string) : boolean; + } + + export interface Static + { + /// Provide a common method for plug-ins to check the version of DataTables being used, + /// in order to ensure compatibility. + fnVersionCheck(version: string) : boolean; + + /// Check if a TABLE node is a DataTable table already or not. + fnIsDataTable(table: Node) : boolean; + + /// Get all DataTable tables that have been initialised. + fnTables(visible? : boolean) : Node[]; + } + + export interface RowParams + { + /// Select TR elements that meet the current filter criterion ("applied") or all TR elements (i.e. no filter). + filter?: string; + + /// Order of the TR elements in the processed array. + /// Can be either 'current', whereby the current sorting of the table is used, or + /// 'original' whereby the original order the data was read into the table is used. + order?: string; + + /// Limit the selection to the currently displayed page + /// ("current") or not ("all"). If 'current' is given, then order is assumed to be + /// 'current' and filter is 'applied', regardless of what they might be given as. + page?: string; + } + + export interface Options + { + aaData?: any[]; + aaSorting?: any[]; + aaSortingFixed?: any[]; + ajax?: any; + aLengthMenu?: any[]; + aoColumns?: ColumnOptions[]; + aoColumnDefs?: ColumnDef[]; + aoSearchCols?: any[]; + asStripClasses?: string[]; + bAutoWidth?: boolean; + bDeferRender?: boolean; + bDestroy?: boolean; + bFilter?: boolean; + bInfo?: boolean; + bJQueryUI?: boolean; + bLengthChange?: boolean; + bPaginate?: boolean; + bProcessing?: boolean; + bRetrieve?: boolean; + bScrollAutoCss?: boolean; + bScrollCollapse?: boolean; + bScrollInfinite?: boolean; + bServerSide?: boolean; + bSort?: boolean; + bSortCellsTop?: boolean; + bSortClasses?: boolean; + bStateSave?: boolean; + fnCookieCallback?: CookieCallback; + fnCreatedRow?: RowCreatedCallback; + fnDrawCallback?: DrawCallback; + fnFooterCallback?: FooterCallback; + fnFormatNumber?: FormatNumber; + fnHeaderCallback?: HeaderCallback; + fnInfoCallback?: InfoCallback; + fnInitComplete?: InitComplete; + fnPreDrawCallback?: PreDrawCallback; + fnRowCallback?: RowCallback; + + fnStateLoadCallback?: StateLoadCallback; + fnStateLoadParams?: StateLoadParams; + fnStateLoaded?: StateLoaded; + fnStateSaveCallback?: StateSaveCallback; + fnStateSaveParams?: StateSaveParams; + iCookieDuration?: number; + iDeferLoading?: any; + iDisplayLength?: number; + iDisplayStart?: number; + iScrollLoadGap?: number; + iTabIndex?: number; + oLanguage?: LanguageOptions; + oSearch?: any; + sAjaxDataProp?: string; + sAjaxSource?: string; + sCookiePrefix?: string; + sDom?: string; + sPaginationType?: string; + sScrollX?: string; + sScrollXInner?: string; + sScrollY?: string; + sServerMethod? : string; + } + + export interface LanguageOptions + { + oAria? : AriaOptions; + oPaginate? : PaginateOptions; + sEmptyTable?: string; + sInfo?: string; + sInfoEmpty?: string; + sInfoFiltered?: string; + sInfoPostFix?: string; + sInfoThousands?: string; + sLengthMenu?: string; + sLoadingRecords?: string; + sProcessing?: string; + sSearch?: string; + sUrl?: string; + sZeroRecords?: string; + } + + export interface AriaOptions + { + sSortAscending?: string; + sSortDescending?: string; + } + + export interface PaginateOptions + { + sFirst?: string; + sLast?: string; + sNext?: string; + sPrevious?: string; + } + + export interface ColumnOptions + { + aDataSort?: number[]; + asSorting?: string[]; + bSearchable? : boolean; + bSortable? : boolean; + bVisible? : boolean; + _bAutoType? : boolean; + fnCreatedCell?: CreatedCell; + iDataSort?: number; + mData?: any; + mRender?: any; + sCellType?: string; + sClass?: string; + sContentPadding?: string; + sDefaultContent?: string; + sName?: string; + sSortDataType?: string; + sSortingClass?: string; + sTitle?: string; + sType?: string; + sWidth?: string; + } + + export interface ColumnDef extends ColumnOptions + { + aTargets: any[]; + } + + export interface Settings + { + oFeatures : Features; + oScroll: ScrollingSettings; + oLanguage : { fnInfoCallback : InfoCallback; }; + oBrowser : { bScrollOversize : boolean; }; + aanFeatures: Node[][]; + aoData: Row[]; + aiDisplay: number[]; + aiDisplayMaster: number[]; + aoColumns: Column[]; + aoHeader: any[]; + aoFooter: any[]; + asDataSearch: string[]; + oPreviousSearch: any; + aoPreSearchCols: any[]; + aaSorting: any[][]; + aaSortingFixed: any[][]; + asStripeClasses: string[]; + asDestroyStripes: string[]; + sDestroyWidth: number; + aoRowCallback: RowCallback[]; + aoHeaderCallback: HeaderCallback[]; + aoFooterCallback: FooterCallback[]; + aoDrawCallback: DrawCallback[]; + aoRowCreatedCallback: RowCreatedCallback[]; + aoPreDrawCallback: PreDrawCallback[]; + aoInitComplete: InitComplete[]; + aoStateSaveParams: StateSaveParams[]; + aoStateLoadParams: StateLoadParams[]; + aoStateLoaded: StateLoaded[]; + sTableId: string; + nTable: Node; + nTHead: Node; + nTFoot: Node; + nTBody: Node; + nTableWrapper: Node; + bDeferLoading: boolean; + bInitialized: boolean; + aoOpenRows: any[]; + sDom: string; + sPaginationType: string; + iCookieDuration: number; + sCookiePrefix: string; + fnCookieCallback: CookieCallback; + aoStateSave: StateSaveCallback[]; + aoStateLoad: StateLoadCallback[]; + oLoadedState: any; + sAjaxSource: string; + sAjaxDataProp: string; + bAjaxDataGet: boolean; + jqXHR: any; + fnServerData: any; + aoServerParams: any[]; + sServerMethod: string; + fnFormatNumber: FormatNumber; + aLengthMenu: any[]; + iDraw: number; + bDrawing: boolean; + iDrawError: number; + _iDisplayLength: number; + _iDisplayStart: number; + _iDisplayEnd: number; + _iRecordsTotal: number; + _iRecordsDisplay: number; + bJUI: boolean; + oClasses: any; + bFiltered: boolean; + bSorted: boolean; + bSortCellsTop: boolean; + oInit: any; + aoDestroyCallback: any[]; + fnRecordsTotal: () => number; + fnRecordsDisplay: () => number; + fnDisplayEnd: () => number; + oInstance : any; + sInstance: string; + iTabIndex: number; + nScrollHead: Node; + nScrollFoot: Node; + } + + export interface Features + { + bAutoWidth: boolean; + bDeferRender: boolean; + bFilter: boolean; + bInfo: boolean; + bLengthChange: boolean; + bPaginate: boolean; + bProcessing: boolean; + bServerSide: boolean; + bSort: boolean; + bSortClasses: boolean; + bStateSave: boolean; + } + + export interface ScrollingSettings + { + bAutoCss : boolean; + bCollapse: boolean; + bInfinite: boolean; + iBarWidth: number; + iLoadGap: number; + sX: string; + sY: string; + } + + export interface Row + { + nTr: Node; + _aData: any; + _aSortData: any[]; + _anHidden: Node[]; + _sRowStripe: string; + } + + export interface Column + { + aDataSort: any; + asSorting: string[]; + bSearchable : boolean; + bSortable : boolean; + bVisible : boolean; + _bAutoType : boolean; + fnCreatedCell: CreatedCell; + fnGetData: (data: any, specific: string) => any; + fnSetData: (data: any, value: any) => void; + mData: any; + mRender: any; + nTh: Node; + nIf: Node; + sClass: string; + sContentPadding: string; + sDefaultContent: string; + sName: string; + sSortDataType: string; + sSortingClass: string; + sSortingClassJUI: string; + sTitle: string; + sType: string; + sWidth: string; + sWidthOrig: string; + } + + export interface CookieCallback + { + (name: string, data: any, expires: string, path: string, cookie: string) : void; + } + + export interface RowCreatedCallback + { + (row: Node, data: any[], dataIndex: number) : void; + } + + export interface DrawCallback + { + (settings: Settings) : void; + } + + export interface FooterCallback + { + (foot: Element, data: any[], start:number, end:number, display: number[]) : void; + } + + export interface FormatNumber + { + (toFormat: number) : string; + } + + export interface HeaderCallback + { + (head: Element, data: any[], start:number, end:number, display: number[]) : void; + } + + export interface InfoCallback + { + (settings: Settings, start: number, end: number, max:number, total: number, pre: string) : string; + } + + export interface InitComplete + { + (settings: Settings, json: any) : void; + } + + export interface PreDrawCallback + { + (settings: Settings) : boolean; + } + + export interface RowCallback + { + (row : Settings, data: any[], displayIndex: number, displayIndexFull: number) : void; + } + + export interface StateLoadCallback + { + (settings: Settings) : any; + } + + export interface StateLoadParams + { + (settings: Settings, data: any) : void; + } + + export interface StateLoaded + { + (settings: Settings, data: any) : void; + } + + export interface StateSaveCallback + { + (settings: any, data:any) : void; + } + + export interface StateSaveParams + { + (settings: any, data:any) : void; + } + + export interface CreatedCell + { + (nTd: Node, cellData: any, rowData: any, row: number, col: number) : void; + } +} From 954c64c100478ebb0b3cd1d9949237c2ee6c2a9d Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 8 Apr 2015 08:20:27 +0900 Subject: [PATCH 31/31] update CONTRIBUTORS.md --- CONTRIBUTORS.md | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index c2a12283a..9cc1579e0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -12,6 +12,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](amplifyjs/amplifyjs.d.ts) [AmplifyJs](http://amplifyjs.com) by [Jonas Eriksson](https://github.com/joeriks) * [:link:](amqp-rpc/amqp-rpc.d.ts) [amqp-rpc](https://github.com/demchenkoe/node-amqp-rpc) by [Wonshik Kim](https://github.com/wokim) * [:link:](angular-file-upload/angular-file-upload.d.ts) [Angular File Upload](https://github.com/danialfarid/angular-file-upload) by [John Reilly](https://github.com/johnnyreilly) +* [:link:](angular-growl-v2/angular-growl-v2.d.ts) [Angular Growl 2 v.0.7.3](http://janstevens.github.io/angular-growl-2) by [Tadeusz Hucal](https://github.com/mkp05) * [:link:](angularjs/angular.d.ts) [Angular JS](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) * [:link:](angularjs/angular-animate.d.ts) [Angular JS (ngAnimate module)](http://angularjs.org) by [Michel Salib](https://github.com/michelsalib), [Adi Dahiya](https://github.com/adidahiya), [Raphael Schweizer](https://github.com/rasch) * [:link:](angularjs/angular-cookies.d.ts) [Angular JS (ngCookies module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) @@ -41,6 +42,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](any-db/any-db.d.ts) [any-db](https://github.com/grncdr/node-any-db) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](any-db-transaction/any-db-transaction.d.ts) [any-db-transaction](https://github.com/grncdr/node-any-db-transaction) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](cordova/cordova.d.ts) [Apache Cordova](http://cordova.apache.org) by [Microsoft Open Technologies Inc.](http://msopentech.com) +* [:link:](cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts) [Apache Cordova Email Composer plugin](https://github.com/katzer/cordova-plugin-email-composer) by [Dave Taylor](http://davetayls.me) * [:link:](polymer/polymer.app-router.d.ts) [app-router](https://github.com/erikringsmuth/app-router) by [Louis Grignon](https://github.com/lgrignon) * [:link:](appframework/appframework.d.ts) [AppFramework](http://app-framework-software.intel.com) by [kyo_ago](https://github.com/kyo-ago) * [:link:](arbiter/Arbiter.d.ts) [Arbiter.js](http://arbiterjs.com) by [Arash Shakery](https://github.com/arash16) @@ -57,6 +59,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](atpl/atpl.d.ts) [atpl](https://github.com/soywiz/atpl.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](auth0/auth0.d.ts) [Auth0.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) +* [:link:](auth0.lock/auth0.lock.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](autobahn/autobahn.d.ts) [AutobahnJS](http://autobahn.ws/js) by [Elad Zelingher](https://github.com/darkl) * [:link:](aws-sdk/aws-sdk.d.ts) [aws-sdk](https://github.com/aws/aws-sdk-js) by [midknight41](https://github.com/midknight41) * [:link:](axios/axios.d.ts) [axios](https://github.com/mzabriskie/axios) by [Marcel Buesing](https://github.com/marcelbuesing) @@ -275,8 +278,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm) * [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat) * [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) -* [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) +* [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com) * [:link:](gulp-concat/gulp-concat.d.ts) [gulp-concat](http://github.com/wearefractal/gulp-concat) by [Keita Kagurazaka](https://github.com/k-kagurazaka) @@ -302,6 +305,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](hapi/hapi.d.ts) [hapi](http://github.com/spumko/hapi) by [Jason Swearingen](http://github.com/jasonswearingen) * [:link:](hasher/hasher.d.ts) [Hasher.js](https://github.com/millermedeiros/hasher) by [flyfishMT](https://github.com/flyfishMT) * [:link:](hashmap/hashmap.d.ts) [HashMap](https://github.com/flesler/hashmap) by [Rafał Wrzeszcz](http://wrzasq.pl) +* [:link:](he/he.d.ts) [he](https://github.com/mathiasbynens/he) by [Simon Edwards](https://github.com/sedwards2009) * [:link:](Headroom/headroom.d.ts) [headroom.js](http://wicky.nillia.ms/headroom.js) by [Jakub Olek](https://github.com/hakubo) * [:link:](heatmap.js/heatmap.d.ts) [heatmap.js](https://github.com/pa7/heatmap.js) by [Yang Guan](https://github.com/lookuptable) * [:link:](hellojs/hellojs.d.ts) [hello.js](http://adodson.com/hello.js) by [Pavel Zika](https://github.com/PavelPZ) @@ -322,6 +326,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](icheck/icheck.d.ts) [iCheck](http://damirfoy.com/iCheck) by [Dániel Tar](https://github.com/qcz) * [:link:](imagemagick/imagemagick.d.ts) [imagemagick](http://github.com/rsms/node-imagemagick) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](imap/imap.d.ts) [imap](https://www.npmjs.com/package/imap) by [Peter Snider](https://github.com/psnider) +* [:link:](imgur-rest-api/imgur-rest-api.d.ts) [Imgur REST API v3](https://api.imgur.com) by [Luke William Westby](http://github.com/lukewestby) * [:link:](impress/impress.d.ts) [Impress.js](https://github.com/bartaz/impress.js) by [Boris Yankov](https://github.com/borisyankov) * [:link:](inflection/inflection.d.ts) [inflection](https://github.com/dreamerslab/node.inflection) by [Shogo Iwano](https://github.com/shiwano) * [:link:](ini/ini.d.ts) [ini](https://github.com/isaacs/ini) by [Marcin Porębski](https://github.com/marcinporebski) @@ -360,7 +365,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.contextMenu/jquery.contextMenu.d.ts) [jQuery contextMenu](http://medialize.github.com/jQuery-contextMenu) by [Natan Vivo](https://github.com/nvivo) * [:link:](jquery.cookie/jquery.cookie.d.ts) [jQuery Cookie Plugin](https://github.com/carhartl/jquery-cookie) by [Roy Goode](https://github.com/RoyGoode) * [:link:](jquery.cycle2/jquery.cycle2.d.ts) [jQuery Cycle2 version (build 20140216)](http://jquery.malsup.com/cycle2) by [Donny Nadolny](https://github.com/dnadolny) -* [:link:](jquery.dataTables/jquery.dataTables.d.ts) [JQuery DataTables](http://www.datatables.net) by [Armin Sander](https://github.com/pragmatrix) +* [:link:](jquery.dataTables/jquery.dataTables.d.ts) [JQuery DataTables](http://www.datatables.net) by [Kiarash Ghiaseddin](https://github.com/Silver-Connection/DefinitelyTyped), [Omid Rad](https://github.com/omidkrad), [Armin Sander](https://github.com/pragmatrix) * [:link:](jquery.fileupload/jquery.fileupload.d.ts) [jQuery File Upload Plugin](https://github.com/blueimp/jQuery-File-Upload) by [Rob Alarcon](https://github.com/rob-alarcon) * [:link:](jquery.joyride/jquery.joyride.d.ts) [jQuery JoyRide Plugin](https://github.com/zurb/joyride) by [Vincent Bortone](https://github.com/vbortone) * [:link:](jqgrid/jqgrid.d.ts) [jQuery jqgrid Plugin](https://github.com/tonytomov/jqGrid) by [Lokesh Peta](https://github.com/lokeshpeta) @@ -379,6 +384,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.ui.datetimepicker/jquery.ui.datetimepicker.d.ts) [jQuery UI DateTimePicker](http://trentrichardson.com/examples/timepicker) by [dougajmcdonald](https://github.com/dougajmcdonald) * [:link:](jquery.ui.layout/jquery.ui.layout.d.ts) [jQuery UI Layout Plug-in](http://layout.jquery-dev.net) by [Steve Fenton](https://github.com/Steve-Fenton) * [:link:](jquery.timepicker/jquery.timepicker.d.ts) [jQuery UI Timepicker](http://fgelinas.com/code/timepicker) by [Anwar Javed](https://github.com/anwarjaved) +* [:link:](jquery-fullscreen/jquery-fullscreen.d.ts) [jquery-fullscreen](https://github.com/kayahr/jquery-fullscreen-plugin) by [Bruno Grieder](https://github.com/bgrieder) * [:link:](jquery-handsontable/jquery-handsontable.d.ts) [jquery-handsontable](http://handsontable.com) by [Ted John](https://github.com/intelorca) * [:link:](jquery.menuaim/jquery.menuaim.d.ts) [jQuery-menu-aim](https://github.com/kamens/jQuery-menu-aim) by [Robert Fonseca-Ensor](http://www.robfe.com) * [:link:](jquery.pjax/jquery.pjax.d.ts) [jquery-pjax](https://github.com/defunkt/jquery-pjax) by [Junle Li](https://github.com/lijunle) @@ -590,9 +596,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](xml2js/xml2js.d.ts) [node-xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) by [Michel Salib](https://github.com/michelsalib), [Jason McNeil](https://github.com/jasonrm) * [:link:](node/node.d.ts) [Node.js](http://nodejs.org) by [Microsoft TypeScript](http://typescriptlang.org), [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped) * [:link:](restify/restify.d.ts) [node.js REST framework](https://github.com/mcavage/node-restify) by [Bret Little](https://github.com/blittle) +* [:link:](acl/acl-redisBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](acl/acl-mongodbBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](acl/acl.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) -* [:link:](acl/acl-redisBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](mdns/mdns.d.ts) [node_mdns](https://github.com/agnat/node_mdns) by [Stefan Steinhart](https://github.com/reppners) * [:link:](node_redis/node_redis.d.ts) [node_redis](https://github.com/mranney/node_redis) by [Boris Yankov](https://github.com/borisyankov) * [:link:](each/each.d.ts) [NodeEach](http://www.adaltas.com/projects/node-each) by [Michael Zabka](https://github.com/misak113) @@ -609,9 +615,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](nprogress/NProgress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) * [:link:](numeraljs/numeraljs.d.ts) [Numeral.js](https://github.com/adamwdraper/Numeral-js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](object-hash/object-hash.d.ts) [object-hash](https://github.com/puleos/object-hash) by [Michael Zabka](https://github.com/misak113) -* [:link:](object-path/object-path.d.ts) [objectPath](https://github.com/mariocasciaro/object-path) by [Paulo Cesar](https://github.com/pocesar) +* [:link:](object-path/object-path.d.ts) [objectPath v0.9.x](https://github.com/mariocasciaro/object-path) by [Paulo Cesar](https://github.com/pocesar) * [:link:](oboe/oboe.d.ts) [oboe](https://github.com/jimhigson/oboe.js) by [Jared Klopper](https://github.com/optical) * [:link:](oclazyload/oclazyload.d.ts) [oc.LazyLoad](https://github.com/ocombe/ocLazyLoad) by [Roland Zwaga](https://github.com/rolandzwaga) +* [:link:](on-finished/on-finished.d.ts) [on-finished](https://github.com/jshttp/on-finished) by [Honza Dvorsky](http://github.com/czechboy0) +* [:link:](onsenui/onsenui.d.ts) [Onsen UI](http://onsen.io) by [Fran Dios](https://github.com/frankdiox) * [:link:](open/open.d.ts) [open](https://github.com/jjrdn/node-open) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](openlayers/openlayers.d.ts) [OpenLayers.js](https://github.com/openlayers/openlayers) by [Ilya Bolkhovsky](https://github.com/bolhovsky) * [:link:](opn/opn.d.ts) [opn](https://github.com/sindresorhus/opn) by [Shinnosuke Watanabe](https://github.com/shinnn) @@ -636,6 +644,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](phantom/phantom.d.ts) [PhantomJS bridge for NodeJS](https://github.com/sgentle/phantomjs-node) by [horiuchi](https://github.com/horiuchi) * [:link:](phantomjs/phantomjs.d.ts) [PhantomJS v1.9.0 API](https://github.com/ariya/phantomjs/wiki/API-Reference) by [Jed Hunsaker](https://github.com/jedhunsaker), [Mike Keesey](https://github.com/keesey) * [:link:](phonegap/phonegap.d.ts) [PhoneGap](http://phonegap.com) by [Boris Yankov](https://github.com/borisyankov), [Dick van den Brink](https://github.com/DickvdBrink) +* [:link:](photoswipe/photoswipe.d.ts) [PhotoSwipe](http://photoswipe.com) by [Xiaohan Zhang](https://github.com/hellochar) * [:link:](physijs/physijs.d.ts) [Physijs](http://chandlerprall.github.io/Physijs) by [Satoru Kimura](https://github.com/gyohk) * [:link:](pickadate/pickadate.d.ts) [pickadate.js](https://github.com/amsul/pickadate.js) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](pixi/pixi.d.ts) [PIXI](https://github.com/GoodBoyDigital/pixi.js) by [xperiments](http://github.com/xperiments) @@ -646,8 +655,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](podcast/podcast.d.ts) [podcast](http://github.com/maxnowack/node-podcast) by [Niklas Mollenhauer](https://github.com/nikeee) * [:link:](poly2tri/poly2tri.d.ts) [poly2tri](http://github.com/r3mi/poly2tri.js) by [Elemar Junior](https://github.com/elemarjr) * [:link:](polymer/polymer.d.ts) [polymer](https://github.com/polymer) by [Louis Grignon](https://github.com/lgrignon) -* [:link:](polymer/polymer.paper-toast.d.ts) [polymer's paper-toast](https://github.com/Polymer/paper-toast) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.paper-dialog.d.ts) [polymer's paper-dialog](https://github.com/Polymer/paper-dialog) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.core-drawer-panel.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-drawer-panel) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.core-overlay.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.paper-toast.d.ts) [polymer's paper-toast](https://github.com/Polymer/paper-toast) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.core-selector.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) * [:link:](popcorn/popcorn.d.ts) [Popcorn](https://github.com/mozilla/popcorn-js) by [grapswiz](https://github.com/grapswiz) * [:link:](pouchDB/pouch.d.ts) [Pouch](http://pouchdb.com) by [Bill Sears](https://github.com/MrBigDog2U) * [:link:](power-assert/power-assert.d.ts) [power-assert](https://github.com/twada/power-assert) by [vvakame](https://github.com/vvakame) @@ -722,6 +734,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](semver/semver.d.ts) [semver](https://github.com/isaacs/node-semver) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](sendgrid/sendgrid.d.ts) [sendgrid](https://github.com/sendgrid/sendgrid-nodejs) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](sequelize/sequelize.d.ts) [Sequelize 2.0.0 dev13](http://sequelizejs.com) by [samuelneff](https://github.com/samuelneff), [Peter Harris](https://github.com/codeanimal) +* [:link:](on-headers/on-headers.d.ts) [serve-favicon](https://github.com/jshttp/on-headers) by [John Jeffery](https://github.com/jjeffery) * [:link:](serve-favicon/serve-favicon.d.ts) [serve-favicon](https://github.com/expressjs/serve-favicon) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](serve-static/serve-static.d.ts) [serve-static](https://github.com/expressjs/serve-static) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](sharedworker/SharedWorker.d.ts) [SharedWorker](http://www.w3.org/TR/workers) by [Toshiya Nakakura](https://github.com/nakakura) @@ -740,6 +753,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sipml/sipml.d.ts) [SIPml5](http://sipml5.org) by [A. Groenenboom](https://github.com/chookies) * [:link:](sjcl/sjcl.d.ts) [sjcl](http://crypto.stanford.edu/sjcl) by [Eugene Chernyshov](https://github.com/Evgenus) * [:link:](slickgrid/SlickGrid.d.ts) [SlickGrid](https://github.com/mleibman/SlickGrid) by [Josh Baldwin](https://github.com/jbaldwin) +* [:link:](slickgrid/slick.autotooltips.d.ts) [SlickGrid AutoToolTips Plugin](https://github.com/mleibman/SlickGrid) by [Ryo Iwamoto](https://github.com/ryiwamoto) * [:link:](slickgrid/slick.headerbuttons.d.ts) [SlickGrid HeaderButtons Plugin](https://github.com/mleibman/SlickGrid) by [Derek Cicerone](https://github.com/derekcicerone) * [:link:](slickgrid/slick.rowselectionmodel.d.ts) [SlickGrid RowSelectionModel Plugin](https://github.com/mleibman/SlickGrid) by [Derek Cicerone](https://github.com/derekcicerone) * [:link:](smoothie/smoothie.d.ts) [Smoothie Charts](https://github.com/joewalnes/smoothie) by [Drew Noakes](https://drewnoakes.com), [Mike H. Hawley](https://github.com/mikehhawley) @@ -758,6 +772,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sprintf/sprintf.d.ts) [sprintff](https://github.com/maritz/node-sprintff) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](sharepoint/SharePoint.d.ts) [sptypescript](http://sptypescript.codeplex.com) by [Stanislav Vyshchepan](http://gandjustas.blogspot.ru), [Andrey Markeev](http://markeev.com) * [:link:](sqlite3/sqlite3.d.ts) [sqlite3](https://github.com/mapbox/node-sqlite3) by [Nick Malaguti](https://github.com/nmalaguti) +* [:link:](squirejs/squirejs.d.ts) [Squire](https://github.com/iammerrick/Squire.js) by [Bradley Ayers](https://github.com/bradleyayers) * [:link:](stack-mapper/stack-mapper.d.ts) [stack-mapper](https://github.com/thlorenz/stack-mapper) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](stampit/stampit.d.ts) [stampit](https://github.com/ericelliott/stampit) by [Vasyl Boroviak](https://github.com/koresar) * [:link:](stats/stats.d.ts) [Stats.js r12](http://github.com/mrdoob/stats.js) by [Gregory Dalton](https://github.com/gregolai) @@ -779,6 +794,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](swig/swig.d.ts) [swig](http://github.com/paularmstrong/swig) by [Peter Harris](https://github.com/CodeAnimal), [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](swiper/swiper.d.ts) [Swiper](https://github.com/nolimits4web/Swiper) by [Sebastián Galiano](https://github.com/sgaliano) * [:link:](swipeview/swipeview.d.ts) [SwipeView](http://cubiq.org/swipeview) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](switchery/switchery.d.ts) [switchery](https://github.com/abpetkov/switchery) by [Bruno Grieder](https://github.com/bgrieder) * [:link:](swiz/swiz.d.ts) [swiz](https://github.com/racker/node-swiz) by [Jeff Goddard](https://github.com/jedigo) * [:link:](tape/tape.d.ts) [tape](https://github.com/substack/tape) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](tar/tar.d.ts) [tar](https://github.com/npm/node-tar) by [Maxime LUCE](https://github.com/SomaticIT) @@ -808,7 +824,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](timezonecomplete/timezonecomplete.d.ts) [timezonecomplete](https://github.com/SpiritIT/timezonecomplete) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](tv4/tv4.d.ts) [Tiny Validator tv4](https://github.com/geraintluff/tv4) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](tinycolor/tinycolor.d.ts) [tinycolor](https://github.com/bgrins/TinyColor) by [Mordechai Zuber](https://github.com/M-Zuber) -* [:link:](titanium/titanium.d.ts) [Titanium Movile 3.1.3.GA](http://www.appcelerator.com) by [Airam Rguez](https://github.com/airamrguez) +* [:link:](titanium/titanium.d.ts) [Titanium Mobile](http://www.appcelerator.com) by [Craig Younkins](https://github.com/cyounkins) * [:link:](tmp/tmp.d.ts) [tmp](https://www.npmjs.com/package/tmp) by [Jared Klopper](https://github.com/optical) * [:link:](toastr/toastr.d.ts) [Toastr](https://github.com/CodeSeven/toastr) by [Boris Yankov](https://github.com/borisyankov) * [:link:](sencha_touch/SenchaTouch.d.ts) [Touch](http://www.sencha.com/products/touch) by [Brian Kotek](https://github.com/brian428) @@ -840,6 +856,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](validator/validator.d.ts) [validator.js](https://github.com/chriso/validator.js) by [tgfjt](https://github.com/tgfjt) * [:link:](vega/vega.d.ts) [Vega](http://trifacta.github.io/vega) by [Tom Crockett](http://github.com/pelotom) * [:link:](velocity-animate/velocity-animate.d.ts) [Velocity](http://velocityjs.org) by [Greg Smith](https://github.com/smrq) +* [:link:](vex-js/vex-js.d.ts) [Vex](https://github.com/HubSpot/vex) by [Greg Cohan](https://github.com/gdcohan) * [:link:](videojs/videojs.d.ts) [Video.js](https://github.com/zencoder/video-js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](vimeo/froogaloop.d.ts) [Vimeo](http://developer.vimeo.com/player/js-api) by [Daz Wilkin](https://github.com/DazWilkin) * [:link:](vinyl/vinyl.d.ts) [vinyl](https://github.com/wearefractal/vinyl) by [vvakame](https://github.com/vvakame), [jedmao](https://github.com/jedmao) @@ -853,12 +870,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](webmidi/webmidi.d.ts) [Web MIDI API](http://www.w3.org/TR/webmidi) by [Toshiya Nakakura](https://github.com/nakakura) * [:link:](webspeechapi/webspeechapi.d.ts) [Web Speech API](https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html) by [SaschaNaz](https://github.com/saschanaz) * [:link:](webcola/webcola.d.ts) [webcola](https://github.com/tgdwyer/WebCola) by [Qinfeng Chen](https://github.com/qinfchen) +* [:link:](webcomponents.js/webcomponents.js.d.ts) [webcomponents.js](https://github.com/webcomponents/webcomponentsjs) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](webcrypto/WebCrypto.d.ts) [WebCrypto](http://www.w3.org/TR/WebCryptoAPI) by [Lucas Dixon](https://github.com/iislucas) * [:link:](webix/webix.d.ts) [Webix UI](http://webix.com) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](webrtc/MediaStream.d.ts) [WebRTC](http://dev.w3.org/2011/webrtc) by [Ken Smith](https://github.com/smithkl42) * [:link:](websocket/websocket.d.ts) [websocket](https://github.com/Worlize/WebSocket-Node) by [Paul Loyd](https://github.com/loyd) * [:link:](when/when.d.ts) [When](https://github.com/cujojs/when) by [Derek Cicerone](https://github.com/derekcicerone), [Wim Looman](https://github.com/Nemo157) * [:link:](which/which.d.ts) [which](https://github.com/isaacs/node-which) by [vvakame](https://github.com/vvakame) +* [:link:](jquery.window/jquery.window.d.ts) [Window plugin for jQuery](http://fstoke.me/jquery/window) by [Ryan Graham](https://github.com/ryan-codingintrigue) * [:link:](windows-service/windows-service.d.ts) [windows-service](https://bitbucket.org/stephenwvickers/node-windows-service) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](winjs/winjs.d.ts) [WinJS](http://try.buildwinjs.com) by [TypeScript samples](https://www.typescriptlang.org), [Adam Hewitt](https://github.com/adamhewitt627), [Craig Treasure](https://github.com/craigktreasure), [Jeff Fisher](https://github.com/xirzec) * [:link:](winrt/winrt.d.ts) [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) by [TypeScript samples](https://www.typescriptlang.org) @@ -872,6 +891,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](xpath/xpath.d.ts) [xpath](https://github.com/goto100/xpath) by [Andrew Bradley](https://github.com/cspotcode) * [:link:](xregexp/xregexp.d.ts) [XRegExp](http://xregexp.com) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](xsockets/XSockets.d.ts) [XSockets.NET](http://xsockets.net) by [Jeffery Grajkowski](https://github.com/pushplay) +* [:link:](yamljs/yamljs.d.ts) [yamljs](https://github.com/jeremyfa/yaml.js) by [Tim Jonischkat](http://www.tim-jonischkat.de) * [:link:](yargs/yargs.d.ts) [yargs](https://github.com/chevex/yargs) by [Martin Poelstra](https://github.com/poelstra) * [:link:](yeoman-generator/yeoman-generator.d.ts) [yeoman-generator](https://github.com/yeoman/generator) by [Kentaro Okuno](http://github.com/armorik83) * [:link:](yosay/yosay.d.ts) [yosay](https://github.com/yeoman/yosay) by [Kentaro Okuno](http://github.com/armorik83)