Merge pull request #12868 from DefinitelyTyped/types-merge-20161122

Types merge 20161122
This commit is contained in:
Nathan Shively-Sanders
2016-11-22 15:13:36 -08:00
committed by GitHub
21 changed files with 2620 additions and 970 deletions

View File

@@ -52,7 +52,7 @@ DefinitelyTyped only works because of contributions by users like you!
Before you share your improvement with the world, use it yourself.
#### Test editing an exiting package
#### Test editing an existing package
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html).
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, or copy them from there and follow the steps below.
@@ -100,7 +100,7 @@ If it doesn't, you can do so yourself in the comment associated with the PR.
#### Create a new package
If you are the library author, or can make a pull request to the library, [bundle](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) types instead of publishing to DefinitelyTyped.
If you are the library author, or can make a pull request to the library, [bundle types](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) instead of publishing to DefinitelyTyped.
If you are adding typings for an NPM package, create a directory with the same name.
If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM.
@@ -192,7 +192,7 @@ Changes to the `master` branch are also manually merged into the `types-2.0` bra
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
If the module you're referencing is an external module (uses `export`), use an import.
If the module you're referenceing is an ambient module (uses `declare module`, or just declares globals), use `<reference types="" />`.
If the module you're referencing is an ambient module (uses `declare module`, or just declares globals), use `<reference types="" />`.
#### What do I do about older versions of typings?

View File

@@ -7,7 +7,35 @@ import * as moment from 'moment';
import * as angular from 'angular';
declare module 'angular' {
export namespace bootstrap.calendar {
export namespace bootstrap.calendar {
interface IEventAction {
/**
* The label of the action
*/
label: string;
/**
* CSS class to be added to the action element
*/
cssClass?: string;
/**
* The action that occurs when it's clicked
* @param args - the IEvent whose action was clicked
*/
onClick: (args: any) => void;
}
interface IEventColor {
/**
* The primary color of the event, should be darker than secondary
*/
primary: string;
/**
* The secondary color of the event, should be lighter than primary
*/
secondary: string;
}
interface IEvent {
/**
* The title of the event
@@ -16,7 +44,7 @@ declare module 'angular' {
/**
* The type of the event (determines its color). Can be important, warning, info, inverse, success or special
*/
type: string;
type?: string;
/**
* A javascript date object for when the event starts
*/
@@ -25,6 +53,14 @@ declare module 'angular' {
* Optional - a javascript date object for when the event ends
*/
endsAt?: Date;
/**
* Color of the Event
*/
color?: IEventColor;
/**
* Actions of the Event
*/
actions?: Array<IEventAction>;
/**
* If edit-event-html is set and this field is explicitly set to false then dont make it editable.
*/
@@ -53,6 +89,10 @@ declare module 'angular' {
* A CSS class (or more, just separate with spaces) that will be added to the event when it is displayed on each view. Useful for marking an event as selected / active etc
*/
cssClass?: string;
/**
* If set the event will display as all-day event
*/
allDay?: boolean;
}
interface ICalendarConfig {
@@ -134,7 +174,7 @@ declare module 'angular' {
}
interface IOnViewChangeClick {
(calendarDate: Date, calendarNextView: string): void;
(calendarDate: Date, calendarNextView: string): boolean;
}
}
}

View File

@@ -162,6 +162,8 @@ declare module 'angular' {
* Really just a regular Array object with $promise and $resolve attached to it
*/
interface IResourceArray<T> extends Array<T & IResource<T>> {
$cancelRequest(): void;
/** the promise of the original server interaction that created this collection. **/
$promise: angular.IPromise<IResourceArray<T>>;
$resolved: boolean;

View File

@@ -110,7 +110,7 @@ declare module 'angular' {
interface IUrlMatcher {
concat(pattern: string): IUrlMatcher;
exec(path: string, searchParams: {}): {};
exec(path: string, search?: any, hash?: string, options?: any): {};
parameters(): string[];
format(values: {}): string;
}

2
auth0-js/index.d.ts vendored
View File

@@ -84,7 +84,7 @@ interface Auth0Identity {
interface Auth0DecodedHash {
access_token: string;
id_token: string;
idToken: string;
profile: Auth0UserProfile;
state: any;
}

View File

@@ -16,6 +16,7 @@ declare namespace retry {
max_interval?: number;
timeout?: number;
max_tries?: number;
predicate?: any;
}
}

46
gapi/index.d.ts vendored
View File

@@ -127,27 +127,7 @@ declare namespace gapi.auth {
}
declare namespace gapi.client {
/**
* Loads the client library interface to a particular API. If a callback is not provided, a promise is returned.
* @param name The name of the API to load.
* @param version The version of the API to load.
* @return promise The promise that get's resolved after the request is finished.
*/
export function load(name: string, version: string): Promise<void>
/**
* Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method.
* @param name The name of the API to load.
* @param version The version of the API to load
* @param callback the function that is called once the API interface is loaded
* @param url optional, the url of your app - if using Google's APIs, don't set it
*/
export function load(name: string, version: string, callback: () => any, url?: string): void;
/**
* Creates a HTTP request for making RESTful requests.
* An object encapsulating the various arguments for this method.
*/
export function request(args: {
interface RequestOptions {
/**
* The URL to handle the request
*/
@@ -172,7 +152,29 @@ declare namespace gapi.client {
* If supplied, the request is executed immediately and no gapi.client.HttpRequest object is returned
*/
callback?: () => any;
}): HttpRequest<any>;
}
/**
* Loads the client library interface to a particular API. If a callback is not provided, a promise is returned.
* @param name The name of the API to load.
* @param version The version of the API to load.
* @return promise The promise that get's resolved after the request is finished.
*/
export function load(name: string, version: string): Promise<void>
/**
* Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method.
* @param name The name of the API to load.
* @param version The version of the API to load
* @param callback the function that is called once the API interface is loaded
* @param url optional, the url of your app - if using Google's APIs, don't set it
*/
export function load(name: string, version: string, callback: () => any, url?: string): void;
/**
* Creates a HTTP request for making RESTful requests.
* An object encapsulating the various arguments for this method.
*/
export function request(args: RequestOptions): HttpRequest<any>;
/**
* Creates an RPC Request directly. The method name and version identify the method to be executed and the RPC params are provided upon RPC creation.
* @param method The method to be executed.

View File

@@ -16,8 +16,9 @@
// gapi is a global var introduced by https://apis.google.com/js/api.js
declare namespace gapi.drive.realtime {
export type CollaborativeObjectType = 'EditableString' | 'Map' | 'List'
type GoogEventHandler = ((evt:ObjectChangedEvent) => void) | ((e:Event) => void) | EventListener;
export type GoogEventHandler = ((evt:ObjectChangedEvent) => void) | ((e:Event) => void) | EventListener;
// Complete
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.Collaborator
@@ -65,7 +66,7 @@ declare namespace gapi.drive.realtime {
// see gapi.drive.realtime.CollaborrativeType for possible values; for custom collaborative objects, this value is
// application-defined.
// Addition: the possible values for standard objects are EditableString, List, and Map.
type:string;
type:CollaborativeObjectType;
// Adds an event listener to the event target. The same handler can only be added once per the type.
// Even if you add the same handler multiple times using the same type then it will only be called once
@@ -107,9 +108,9 @@ declare namespace gapi.drive.realtime {
// Complete
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.CollaborativeMap
export class CollaborativeMap<V> extends CollaborativeObject {
size:string;
size:number;
static type:string; // equals "Map"
static type:'Map';
// Removes all entries.
clear():void;
@@ -154,7 +155,7 @@ declare namespace gapi.drive.realtime {
// The text of this collaborative string. Reading from this property is equivalent to calling getText(). Writing to this property is equivalent to calling setText().
text:string;
static type:string; // equals "EditableString"
static type:'EditableString';
// Appends a string to the end of this one.
append(text:string):void;
@@ -186,7 +187,7 @@ declare namespace gapi.drive.realtime {
// The length of a list cannot be extended in this way.
length:number;
static type:string; // equals "List"
static type:"List";
// Returns a copy of the contents of this collaborative list as an array.
// Changes to the returned object will not affect the original collaborative list.
@@ -344,9 +345,68 @@ declare namespace gapi.drive.realtime {
undo():void;
}
export type EventType = 'object_changed' | 'values_set' | 'values_added' | 'values_removed' | 'value_changed' |
'text_inserted' | 'text_deleted' | 'collaborator_joined' | 'collaborator_left' | 'reference_shifted' |
'document_save_state_changed' | 'undo_redo_state_changed' | 'attribute_changed';
export const EventType:{
// A collaborative object has changed. This event wraps a specific event, and bubbles to ancestors.
// Defaults to object_changed.
OBJECT_CHANGED:'object_changed'
// Values in a list are changed in place.
// Defaults to values_set.
VALUES_SET:'values_set',
// New values have been added to the list.
// values_added
VALUES_ADDED:'values_added'
// Values have been removed from the list.
// values_removed
VALUES_REMOVED:'values_removed'
// A map or custom object value has changed. Note this could be a new value or deleted value.
// value_changed
VALUE_CHANGED:'value_changed'
// Text has been inserted into a string.
// text_inserted
TEXT_INSERTED:'text_inserted'
// Text has been removed from a string.
// text_deleted
TEXT_DELETED:'text_deleted'
// A new collaborator joined the document. Listen on the gapi.drive.realtime.Document for these changes.
// collaborator_joined
COLLABORATOR_JOINED:'collaborator_joined'
// A collaborator left the document. Listen on the gapi.drive.realtime.Document for these changes.
// collaborator_left
COLLABORATOR_LEFT:'collaborator_left'
// An index reference changed.
// reference_shifted
REFERENCE_SHIFTED:'reference_shifted'
// The document save state changed. Listen on the gapi.drive.realtime.Document for these changes.
// document_save_state_changed
DOCUMENT_SAVE_STATE_CHANGED:'document_save_state_changed'
// The model canUndo/canRedo state changed. Listen on the gapi.drive.realtime.Model for these changes.
// undo_redo_state_changed
UNDO_REDO_STATE_CHANGED:'undo_redo_state_changed'
// A metadata attribute of the document changed. This is fired on changes to:
// gapi.drive.realtime.Attribute.IS_READ_ONLY
// Listen on the gapi.drive.realtime.Document for these changes.
// attribute_changed
ATTRIBUTE_CHANGED:'attribute_changed'
}
// Complete
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.BaseModelEvent
interface BaseModelEvent {
export interface BaseModelEvent {
// Whether this event bubbles.
bubbles : boolean;
@@ -373,7 +433,7 @@ declare namespace gapi.drive.realtime {
target : CollaborativeObject;
// The type of the event.
type : string;
type : EventType;
// The user id of the user that initiated this event.
userId : string;
@@ -399,6 +459,7 @@ declare namespace gapi.drive.realtime {
Array of string
The list of names from the hierarchy of compound operations that initiated the event.
Value must not be null.
isLocal
boolean
True if the event originated in the local session.
@@ -417,7 +478,7 @@ declare namespace gapi.drive.realtime {
// Complete
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.ObjectChangedEvent
interface ObjectChangedEvent extends BaseModelEvent {
export interface ObjectChangedEvent extends BaseModelEvent {
// parameters as in BaseModelEvent above except for addition of:
// events:
// Array of gapi.drive.realtime.BaseModelEvent
@@ -435,7 +496,7 @@ declare namespace gapi.drive.realtime {
new (target:CollaborativeObject, sessionId:string, userId:string, compoundOperationNames:string[],
isLocal:boolean, isUndo:boolean, isRedo:boolean, index:number,
values:V[], movedFromList:CollaborativeList<V>, movedFromIndex:number):ValuesAddedEvent<V>;
// The index of the first added value
index:number;
@@ -523,7 +584,7 @@ declare namespace gapi.drive.realtime {
"missing_property" | "not_found" | "forbidden" | "server_error" | "client_error" |
"token_refresh_required" | "invalid_element_type" | "no_write_permission" |
"fatal_network_error" | "unexpected_element";
export var ErrorType : {
export const ErrorType : {
// Another user created the document's initial state after
// gapi.drive.realtime.load was called but before the local
// creation was saved.
@@ -627,12 +688,12 @@ declare namespace gapi.drive.realtime {
opt_initializerFn? : (m:Model) => void,
opt_errorFn? : (e:gapi.drive.realtime.Error) => void
) : Document;
/* Loads an existing file by id.
https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime#.load
@Param fileId {string} Id of the file to load.
@Param onLoaded {function(non-null gapi.drive.realtime.Document)}
A callback that will be called when the realtime document is ready. The created or opened realtime document
object will be passed to this function.
@@ -649,8 +710,22 @@ declare namespace gapi.drive.realtime {
fileId:string,
onLoaded? : (d:Document) => void,
opt_initializerFn? : (m:Model) => void,
opt_errorFn? : (e:gapi.drive.realtime.Error) => void
opt_errorFn? : (e:Error) => void
):void;
export function loadAppDataDocument(
onLoaded:(x:Document) => void,
opt_initializerFn?:(x:Model) => void,
opt_errorFn?:(e:Error) => void
):void
// Loads an in-memory document from a json string.
// This document does not talk to the server and will only exist in memory for as long as the browser session exists.
export function loadFromJson(
json:string,
opt_errorFn?:(e:Error) => void
):Document
}
@@ -674,29 +749,21 @@ declare namespace gapi.drive.realtime.databinding {
}
declare namespace gapi.drive.realtime.EventType {
export var TEXT_INSERTED: string
export var TEXT_DELETED: string
export var OBJECT_CHANGED: string
// List
export var VALUES_ADDED:string;
export var VALUES_REMOVED:string;
export var VALUES_SET:string;
}
// rtclient is a global var introduced by realtime-client-utils.js
declare namespace rtclient {
// INCOMPLETE
export interface RealtimeLoader {
start():void;
load():void;
handleErrors(e:gapi.drive.realtime.Error):void;
}
interface RealtimeLoaderFactory {
new (options:LoaderOptions) : RealtimeLoader;
}
// ***********************************
// NOTE THIS IS OUT OF DATE. realtime-client-utils.js has been rewritten, with the new version "Realtime Utils 1.0.0".
// Will add typings for the new version later.
// The remainder of this file types some (not all) things in realtime-client-utils.js, found here:
// https://developers.google.com/google-apps/realtime/realtime-quickstart
// and

View File

@@ -3,10 +3,66 @@
// Definitions by: Brian Surowiec <https://github.com/xt0rted/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module HelloSign {
interface MessageEvent {
event: string;
interface SignedMessageEvent {
event: 'signature_request_signed';
signature_id: string;
}
interface DeclinedMessageEvent {
event: 'signature_request_declined';
signature_id: string;
}
interface CanceledMessageEvent {
event: 'signature_request_canceled';
}
interface SentMessageEvent {
event: 'signature_request_sent';
signature_request_id: string;
signature_request_info: {
title: string;
message: string;
signatures: Array<{
signature_id: string;
signer_email_address: string;
signer_name: string;
order: number;
status_code: string;
signed_at: number;
last_viewed_at: number;
last_reminded_at: number;
has_pin: boolean;
}>;
cc_email_addresses: Array<string>;
};
}
interface TemplateCreatedMessageEvent {
event: 'template_created';
template_id: string;
template_info: {
title: string;
message: string;
signer_roles: Array<{
name: string;
order: number;
}>;
cc_roles: Array<{
name: string;
}>;
};
}
interface ErrorMessageEvent {
event: 'error';
description: string;
}
type MessageEvent = SignedMessageEvent | DeclinedMessageEvent |
CanceledMessageEvent | SentMessageEvent | TemplateCreatedMessageEvent |
ErrorMessageEvent;
interface ClientCultures {
/**
* English (United States)
@@ -169,6 +225,20 @@ declare module HelloSign {
*/
EVENT_CANCELED: string;
/**
* The user sent a signature request
*
* @default signature_request_sent
*/
EVENT_SENT: string;
/**
* The template was created or edited
*
* @default template_created
*/
EVENT_TEMPLATE_CREATED: string;
/**
* An error occurred in the iFrame
*

View File

@@ -25,7 +25,8 @@ interface JQueryContextMenuOptions {
hide?: () => void;
};
callback?: (key: any, options: any) => any;
items: any;
items?: any;
build?: (triggerElement: JQuery, e: Event) => any;
reposition?: boolean;
className?: string;
itemClickEvent?: string;

35
jstree/index.d.ts vendored
View File

@@ -1,8 +1,8 @@
// Type definitions for jsTree v3.3.2
// Type definitions for jsTree v3.3.3
// Project: http://www.jstree.com/
// Definitions by: Adam Pluciński <https://github.com/adaskothebeast>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// 1 commit bb0473ae8cfc205585b6404ef86f650df2f6996e 2016-08-15
// 1 commit 26e99ad5ec27c1a594ed57974cb16e0987482fd5 2016-11-19
///<reference types="jquery" />
@@ -374,6 +374,12 @@ interface JSTreeStaticDefaultsCoreThemes {
*/
icons?: boolean;
/**
* a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container
* @name $.jstree.defaults.core.themes.ellipsis
*/
ellipsis?: boolean;
/**
* a boolean indicating if the tree background is striped
* @name $.jstree.defaults.core.themes.stripes
@@ -429,7 +435,7 @@ interface JSTreeStaticDefaultsCheckbox {
* @name $.jstree.defaults.checkbox.cascade
* @plugin checkbox
*/
cascade: boolean;
cascade: string;
/**
* This setting controls if checkbox are bound to the general tree selection
@@ -737,6 +743,11 @@ interface JSTree extends JQuery {
*/
teardown: () => void;
/**
* Create prototype node
*/
_create_prototype_node: () => HTMLElement;
/**
* bind all events. Used internally.
* @private
@@ -1567,6 +1578,24 @@ interface JSTree extends JQuery {
*/
toggle_icons: () => void;
/**
* show the node ellipsis
* @name show_icons()
*/
show_ellipsis: () => void;
/**
* hide the node ellipsis
* @name hide_ellipsis()
*/
hide_ellipsis: () => void;
/**
* toggle the node ellipsis
* @name toggle_icons()
*/
toggle_ellipsis: () => void;
/**
* set the node icon for a node
* @name set_icon(obj, icon)

View File

@@ -114,3 +114,15 @@ tree.get_path('nodeId');
tree.get_path('nodeId', '/');
tree.get_path('nodeId', '/', true);
var coreThemes: JSTreeStaticDefaultsCoreThemes = {
ellipsis:true
};
// tree with new theme elipsis
var treeWithNewCoreProperties = $('#treeWithNewEllipsisProperties').jstree({
core: {
themes: coreThemes
}
});

54
mapbox-gl/index.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for Mapbox GL JS v0.26.0
// Type definitions for Mapbox GL JS v0.27.0
// Project: https://github.com/mapbox/mapbox-gl-js
// Definitions by: Dominik Bruderer <https://github.com/dobrud>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -16,7 +16,9 @@ declare namespace mapboxgl {
export class Map extends Evented {
constructor(options?: MapboxOptions);
addControl(control: Control): this;
addControl(control: Control, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this;
removeControl(control: Control): this;
addClass(klass: string, options?: mapboxgl.StyleOptions): this;
@@ -36,8 +38,12 @@ declare namespace mapboxgl {
setMinZoom(minZoom?: number): this;
getMinZoom(): number;
setMaxZoom(maxZoom?: number): this;
getMaxZoom(): number;
project(lnglat: mapboxgl.LngLat | number[]): mapboxgl.Point;
unproject(point: mapboxgl.Point | number[]): mapboxgl.LngLat;
@@ -328,44 +334,34 @@ declare namespace mapboxgl {
* Control
*/
export class Control extends Evented {
addTo(map: mapboxgl.Map): this;
remove(): this;
}
/**
* ControlOptions
*/
export interface ControlOptions {
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
}
/**
* Navigation
*/
export class NavigationControl extends Control {
constructor(options?: mapboxgl.ControlOptions);
constructor();
}
/**
* Geolocate
*/
export class GeolocateControl extends Control {
constructor(options?: mapboxgl.ControlOptions);
constructor();
}
/**
* Attribution
*/
export class AttributionControl extends Control {
constructor(options?: mapboxgl.ControlOptions);
constructor();
}
/**
* Scale
*/
export class ScaleControl extends Control {
constructor(options?: {position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left', maxWidth?: number, unit?: string})
constructor(options?: {maxWidth?: number, unit?: string})
}
/**
@@ -409,6 +405,7 @@ declare namespace mapboxgl {
metadata?: any;
name?: string;
pitch?: number;
light?: Light;
sources?: any;
sprite?: string;
transition?: Transition;
@@ -421,6 +418,13 @@ declare namespace mapboxgl {
duration?: number;
}
export interface Light {
"anchor"?: "map" | "viewport";
"position"?: number[];
"color"?: string;
"intensity"?: number;
}
export interface Source {
type: "vector" | "raster" | "geojson" | "image" | "video";
}
@@ -799,8 +803,8 @@ declare namespace mapboxgl {
interactive?: boolean;
filter?: any[];
layout?: BackgroundLayout | FillLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout;
paint?: BackgroundPaint | FillPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint;
layout?: BackgroundLayout | FillLayout | FillExtrusionLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout;
paint?: BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint;
}
export interface StyleFunction {
@@ -831,8 +835,18 @@ declare namespace mapboxgl {
"fill-translate"?: number[];
"fill-translate-anchor"?: "map" | "viewport";
"fill-pattern"?: "string";
"fill-extrude-height"?: number;
"fill-extrude-base"?: number;
}
export interface FillExtrusionLayout {
visibility?: "visible" | "none";
}
export interface FillExtrusionPaint {
"fill-extrusion-opacity"?: number;
"fill-extrusion-color"?: string | StyleFunction;
"fill-extrusion-translate"?: number[];
"fill-extrusion-translate-anchor"?: "map" | "viewport";
"fill-extrusion-height"?: number | StyleFunction;
"fill-extrusion-base"?: number;
}
export interface LineLayout {

948
mapbox-gl/mapbox-gl-0.26.0.d.ts vendored Normal file
View File

@@ -0,0 +1,948 @@
// Type definitions for Mapbox GL JS v0.26.0
// Project: https://github.com/mapbox/mapbox-gl-js
// Definitions by: Dominik Bruderer <https://github.com/dobrud>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../geojson/geojson.d.ts" />
declare namespace mapboxgl {
let accessToken: string;
let version: string;
export function supported(options?: {failIfMajorPerformanceCaveat?: boolean}): boolean;
/**
* Map
*/
export class Map extends Evented {
constructor(options?: MapboxOptions);
addControl(control: Control): this;
addClass(klass: string, options?: mapboxgl.StyleOptions): this;
removeClass(klass: string, options?: mapboxgl.StyleOptions): this;
setClasses(klasses: string[], options?: mapboxgl.StyleOptions): this;
hasClass(klass: string): boolean;
getClasses(): string[];
resize(): this;
getBounds(): mapboxgl.LngLatBounds;
setMaxBounds(lnglatbounds?: mapboxgl.LngLatBounds | number[][]): this;
setMinZoom(minZoom?: number): this;
setMaxZoom(maxZoom?: number): this;
project(lnglat: mapboxgl.LngLat | number[]): mapboxgl.Point;
unproject(point: mapboxgl.Point | number[]): mapboxgl.LngLat;
queryRenderedFeatures(pointOrBox?: mapboxgl.Point|number[]|mapboxgl.Point[]|number[][], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature<GeoJSON.GeometryObject>[];
querySourceFeatures(sourceID: string, parameters: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature<GeoJSON.GeometryObject>[];
setStyle(style: mapboxgl.Style | string): this;
getStyle(): mapboxgl.Style;
addSource(id: string, source: VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw): this;
removeSource(id: string): this;
getSource(id: string): VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource;
addLayer(layer: mapboxgl.Layer, before?: string): this;
removeLayer(id: string): this;
getLayer(id: string): mapboxgl.Layer;
setFilter(layer: string, filter: any[]): this;
setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this;
getFilter(layer: string): any[];
setPaintProperty(layer: string, name: string, value: any, klass?: string): this;
getPaintProperty(layer: string, name: string, klass?: string): any;
setLayoutProperty(layer: string, name: string, value: any): this;
getLayoutProperty(layer: string, name: string, klass?: string): any;
getContainer(): HTMLElement;
getCanvasContainer(): HTMLElement;
getCanvas(): HTMLCanvasElement;
loaded(): boolean;
remove(): void;
onError(): void;
showTileBoundaries: boolean;
showCollisionBoxes: boolean;
repaint: boolean;
getCenter(): mapboxgl.LngLat;
setCenter(center: LngLat|number[], eventData?: mapboxgl.EventData): this;
panBy(offset: number[], options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
panTo(lnglat: mapboxgl.LngLat, options?: mapboxgl.AnimationOptions, eventdata?: mapboxgl.EventData): this;
getZoom(): number;
setZoom(zoom: number, eventData?: mapboxgl.EventData): this;
zoomTo(zoom: number, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
zoomIn(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
zoomOut(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
getBearing(): number;
setBearing(bearing: number, eventData?: mapboxgl.EventData): this;
rotateTo(bearing: number, options?: mapboxgl.AnimationOptions, eventData?: EventData): this;
resetNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
snapToNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
getPitch(): number;
setPitch(pitch: number, eventData?: EventData): this;
fitBounds(bounds: mapboxgl.LngLatBounds | number[][], options?: { linear?: boolean, easing?: Function, padding?: number, offset?: Point|number[],maxZoom?: number }): this;
jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this;
easeTo(options: mapboxgl.CameraOptions | mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this;
flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this;
stop(): this;
scrollZoom: ScrollZoomHandler;
boxZoom: BoxZoomHandler;
dragRotate: DragRotateHandler;
dragPan: DragPanHandler;
keyboard: KeyboardHandler;
doublClickZoom: DoubleClickZoomHandler;
touchZoomRotate: TouchZoomRotateHandler;
}
export interface MapboxOptions {
/** If true, an attribution control will be added to the map. */
attributionControl?: boolean;
bearing?: number;
/** Snap to north threshold in degrees. */
bearingSnap?: number;
/** If true, enable the "box zoom" interaction (see BoxZoomHandler) */
boxZoom?: boolean;
/** initial map center */
center?: mapboxgl.LngLat | number[];
/** Style class names with which to initialize the map */
classes?: string[];
/** ID of the container element */
container?: string | Element;
/** If true, enable the "drag to pan" interaction (see DragPanHandler). */
dragPan?: boolean;
/** If true, enable the "drag to rotate" interaction (see DragRotateHandler). */
dragRotate?: boolean;
/** If true, enable the "double click to zoom" interaction (see DoubleClickZoomHandler). */
doubleClickZoom?: boolean;
/** If true, the map will track and update the page URL according to map position */
hash?: boolean;
/** If true, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. */
failIfMayorPerformanceCaveat?: boolean;
/** If false, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input */
interactive?: boolean;
/** If true, enable keyboard shortcuts (see KeyboardHandler). */
keyboard?: boolean;
/** If set, the map is constrained to the given bounds. */
maxBounds?: mapboxgl.LngLatBounds | number[][];
/** Maximum zoom of the map */
maxZoom?: number;
/** Minimum zoom of the map */
minZoom?: number;
/** If true, The maps canvas can be exported to a PNG using map.getCanvas().toDataURL();. This is false by default as a performance optimization. */
preserveDrawingBuffer?: boolean;
pitch?: number;
/** If true, enable the "scroll to zoom" interaction */
scrollZoom?: boolean;
/** stylesheet location */
style?: mapboxgl.Style | string;
/** If true, the map will automatically resize when the browser window resizes */
trackResize?: boolean;
/** If true, enable the "pinch to rotate and zoom" interaction (see TouchZoomRotateHandler). */
touchZoomRotate?: boolean;
/** Initial zoom level */
zoom?: number;
}
/**
* BoxZoomHandler
*/
export class BoxZoomHandler {
constructor(map: mapboxgl.Map);
isEnabled(): boolean;
isActive(): boolean;
enable(): void;
disable(): void;
}
/**
* ScrollZoomHandler
*/
export class ScrollZoomHandler {
constructor(map: mapboxgl.Map);
isEnabled(): boolean;
enable(): void;
disable(): void;
}
/**
* DragPenHandler
*/
export class DragPanHandler {
constructor(map: mapboxgl.Map);
isEnabled(): boolean;
isActive(): boolean;
enable(): void;
disable(): void;
}
/**
* DragRotateHandler
*/
export class DragRotateHandler {
constructor(map: mapboxgl.Map, options?: {bearingSnap?: number, pitchWithRotate?: boolean});
isEnabled(): boolean;
isActive(): boolean;
enable(): void;
disable(): void;
}
/**
* KeyboardHandler
*/
export class KeyboardHandler {
constructor(map: mapboxgl.Map);
isEnabled(): boolean;
enable(): void;
disable(): void;
}
/**
* DoubleClickZoomHandler
*/
export class DoubleClickZoomHandler {
constructor(map: mapboxgl.Map);
isEnabled(): boolean;
enable(): void;
disable(): void;
}
/**
* TouchZoomRotateHandler
*/
export class TouchZoomRotateHandler {
constructor(map: mapboxgl.Map);
isEnabled(): boolean;
enable(): void;
disable(): void;
disableRotation(): void;
enableRotation(): void;
}
/**
* Control
*/
export class Control extends Evented {
addTo(map: mapboxgl.Map): this;
remove(): this;
}
/**
* ControlOptions
*/
export interface ControlOptions {
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
}
/**
* Navigation
*/
export class NavigationControl extends Control {
constructor(options?: mapboxgl.ControlOptions);
}
/**
* Geolocate
*/
export class GeolocateControl extends Control {
constructor(options?: mapboxgl.ControlOptions);
}
/**
* Attribution
*/
export class AttributionControl extends Control {
constructor(options?: mapboxgl.ControlOptions);
}
/**
* Scale
*/
export class ScaleControl extends Control {
constructor(options?: {position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left', maxWidth?: number, unit?: string})
}
/**
* Popup
*/
export class Popup extends Evented {
constructor(options?: mapboxgl.PopupOptions);
addTo(map: mapboxgl.Map): this;
isOpen(): boolean;
remove(): this;
getLngLat(): mapboxgl.LngLat;
setLngLat(lnglat: mapboxgl.LngLat | number[]): this;
setText(text: string): this;
setHTML(html: string): this;
setDOMContent(htmlNode: Node): this;
}
export interface PopupOptions {
closeButton?: boolean;
closeOnClick?: boolean;
anchor?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
offset?: number | Point | number[] | { [key:string]: Point | number[];};
}
export interface Style {
bearing?: number;
center?: number[];
glyphs?: string;
layers?: Layer[];
metadata?: any;
name?: string;
pitch?: number;
sources?: any;
sprite?: string;
transition?: Transition;
version: number;
zoom?: number;
}
export interface Transition {
delay?: number;
duration?: number;
}
export interface Source {
type: "vector" | "raster" | "geojson" | "image" | "video";
}
/**
* GeoJSONSource
*/
export interface GeoJSONSourceRaw extends Source, GeoJSONSourceOptions {
type: "geojson";
}
export class GeoJSONSource implements GeoJSONSourceRaw {
type: "geojson";
constructor(options?: mapboxgl.GeoJSONSourceOptions);
setData(data: GeoJSON.Feature<GeoJSON.GeometryObject> | GeoJSON.FeatureCollection<GeoJSON.GeometryObject> | String): this;
}
export interface GeoJSONSourceOptions {
data?: GeoJSON.Feature<GeoJSON.GeometryObject> | GeoJSON.FeatureCollection<GeoJSON.GeometryObject> | string;
maxzoom?: number;
buffer?: number;
tolerance?: number;
cluster?: number | boolean;
clusterRadius?: number;
clusterMaxZoom?: number;
}
/**
* VideoSource
*/
export class VideoSource implements Source, VideoSourceOptions {
type: "video";
constructor(options?: mapboxgl.VideoSourceOptions);
getVideo(): HTMLVideoElement;
setCoordinates(coordinates: number[][]): this;
}
export interface VideoSourceOptions {
urls?: string[];
coordinates?: number[][];
}
/**
* ImageSource
*/
export class ImageSource implements Source, ImageSourceOptions {
type: "image";
constructor(options?: mapboxgl.ImageSourceOptions);
setCoordinates(coordinates: number[][]): this;
}
export interface ImageSourceOptions {
url?: string;
coordinates?: number[][];
}
interface VectorSource extends Source {
type: "vector";
url?: string;
tiles?: string[];
minzoom?: number;
maxzoom?: number;
}
interface RasterSource extends Source {
type: "raster";
url: string;
tiles?: string[];
minzoom?: number;
maxzoom?: number;
tileSize?: number;
}
/**
* LngLat
*/
export class LngLat {
lng: number;
lat: number;
constructor(lng: number, lat: number);
/** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */
wrap(): mapboxgl.LngLat;
/** Return a LngLat as an array */
toArray(): number[];
/** Return a LngLat as a string */
toString(): string;
static convert(input: number[]|mapboxgl.LngLat): mapboxgl.LngLat;
}
/**
* LngLatBounds
*/
export class LngLatBounds {
sw: LngLat | number[];
ne: LngLat | number[];
constructor(sw?: LngLat, ne?: LngLat);
/** Extend the bounds to include a given LngLat or LngLatBounds. */
extend(obj: mapboxgl.LngLat | mapboxgl.LngLatBounds): this;
/** Get the point equidistant from this box's corners */
getCenter(): mapboxgl.LngLat;
/** Get southwest corner */
getSouthWest(): mapboxgl.LngLat;
/** Get northeast corner */
getNorthEast(): mapboxgl.LngLat;
/** Get northwest corner */
getNorthWest(): mapboxgl.LngLat;
/** Get southeast corner */
getSouthEast(): mapboxgl.LngLat;
/** Get west edge longitude */
getWest(): number;
/** Get south edge latitude */
getSouth(): number;
/** Get east edge longitude */
getEast(): number;
/** Get north edge latitude */
getNorth(): number;
/** Returns a LngLatBounds as an array */
toArray(): number[][];
/** Return a LngLatBounds as a string */
toString(): string;
/** Convert an array to a LngLatBounds object, or return an existing LngLatBounds object unchanged. */
static convert(input: mapboxgl.LngLatBounds | number[] | number[][]): mapboxgl.LngLatBounds;
}
/**
* Point
*/
// Todo: Pull out class to seperate definition for Module "point-geometry"
export class Point {
constructor(options?: Object);
clone(): Point;
add(p: number): Point;
sub(p: number): Point;
mult(k: number): Point;
div(k: number): Point;
rotate(a: number): Point;
matMult(m: number): Point;
unit(): Point;
perp(): Point;
round(): Point;
mag(): number;
equals(): boolean;
dist(): number;
distSqr(): number;
angle(): number;
angleTo(): number;
angleWidth(): number;
angleWidthSep(): number;
}
export class Marker {
constructor(element?: HTMLElement, options?: { offset?: Point | number[] });
addTo(map: Map): this;
remove(): this;
getLngLat(): LngLat;
setLngLat(lngLat: LngLat | number[]): this;
setPopup(popup?: Popup): this;
getPopup(): Popup;
togglePopup(): this;
}
/**
* Evented
*/
export class Evented {
on(type: string, listener: Function): this;
off(type?: string | any, listener?: Function): this;
once(type: string, listener: Function): this;
fire(type: string, data?: mapboxgl.EventData | Object): this;
listens(type: string): boolean;
}
/**
* StyleOptions
*/
export interface StyleOptions {
transition?: boolean;
}
/**
* EventData
*/
export class EventData {
type: string;
target: Map;
originalEvent: Event;
point: mapboxgl.Point;
lngLat: mapboxgl.LngLat;
}
export class MapMouseEvent {
type: string;
target: Map;
originalEvent: MouseEvent;
point: mapboxgl.Point;
lngLat: mapboxgl.LngLat;
}
export class MapTouchEvent {
type: string;
target: Map;
originalEvent: TouchEvent;
point: mapboxgl.Point;
lngLat: mapboxgl.LngLat;
points: Point[];
lngLats: LngLat[];
}
export class MapBoxZoomEvent {
originalEvent: MouseEvent;
boxZoomBounds: LngLatBounds;
}
export class MapDataEvent {
type: string;
dataType: "source" | "style" | "tile";
}
/**
* AnimationOptions
*/
export interface AnimationOptions {
/** Number in milliseconds */
duration?: number;
easing?: Function;
/** point, origin of movement relative to map center */
offset?: Point | number[];
/** When set to false, no animation happens */
animate?: boolean;
}
/**
* CameraOptions
*/
export interface CameraOptions {
/** Map center */
center?: mapboxgl.LngLat | number[];
/** Map zoom level */
zoom?: number;
/** Map rotation bearing in degrees counter-clockwise from north */
bearing?: number;
/** Map angle in degrees at which the camera is looking at the ground */
pitch?: number;
/** If zooming, the zoom center (defaults to map center) */
around?: mapboxgl.LngLat | number[];
}
/**
* FlyToOptions
*/
export interface FlyToOptions extends AnimationOptions, CameraOptions {
curve?: number;
minZoom?: number;
speed?: number;
screenSpeed?: number;
easing?: Function;
}
/**
* MapEvent
*/
export interface MapEvent {
resize?: void;
webglcontextlost?: {originalEvent: WebGLContextEvent};
webglcontextrestored?: {originalEvent: WebGLContextEvent};
remove?: void;
dataloading?: {data: mapboxgl.MapDataEvent};
data?: {data: mapboxgl.MapDataEvent};
render?: void;
contextmenu?: {data: mapboxgl.MapMouseEvent};
dblclick?: {data: mapboxgl.MapMouseEvent};
click?: {data: mapboxgl.MapMouseEvent};
touchcancel?: {data: mapboxgl.MapTouchEvent};
touchmove?: {data: mapboxgl.MapTouchEvent};
touchend?: {data: mapboxgl.MapTouchEvent};
touchstart?: {data: mapboxgl.MapTouchEvent};
mousemove?: {data: mapboxgl.MapMouseEvent};
mouseup?: {data: mapboxgl.MapMouseEvent};
mousedown?: {data: mapboxgl.MapMouseEvent};
moveend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
move?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
movestart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
mouseout?:{data: mapboxgl.MapMouseEvent};
load?: void;
zoomend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
zoom?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
zoomstart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
boxzoomcancel?: {data: mapboxgl.MapBoxZoomEvent};
boxzoomstart?: {data: mapboxgl.MapBoxZoomEvent};
boxzoomend?: {data: mapboxgl.MapBoxZoomEvent};
rotate?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
rotatestart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
rotateend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
drag?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
dragend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent};
pitch?: {data: mapboxgl.EventData};
}
export interface Layer {
id: string;
type?: "fill" | "line" | "symbol" | "circle" | "raster" | "background" | string; //TODO: Ideally we wouldn't accept string here, just these specific strings
metadata?: any;
ref?: string;
source?: string;
"source-layer"?: string;
minzoom?: number;
maxzoom?: number;
interactive?: boolean;
filter?: any[];
layout?: BackgroundLayout | FillLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout;
paint?: BackgroundPaint | FillPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint;
}
export interface StyleFunction {
stops: any[][];
property?: string;
base?: number;
type?: "identity" | "exponential" | "interval" | "categorical";
"colorSpace"?: "rgb" | "lab" | "interval";
}
export interface BackgroundLayout {
visibility?: "visible" | "none";
}
export interface BackgroundPaint {
"background-color"?: string;
"background-pattern"?: string;
"background-opacity"?: number;
}
export interface FillLayout {
visibility?: "visible" | "none";
}
export interface FillPaint {
"fill-antialias"?: boolean;
"fill-opacity"?: number | StyleFunction;
"fill-color"?: string | StyleFunction;
"fill-outline-color": string | StyleFunction;
"fill-translate"?: number[];
"fill-translate-anchor"?: "map" | "viewport";
"fill-pattern"?: "string";
"fill-extrude-height"?: number;
"fill-extrude-base"?: number;
}
export interface LineLayout {
visibility?: "visible" | "none";
"line-cap"?: "butt" | "round" | "square";
"line-join"?: "bevel" | "round" | "miter";
"line-miter-limit"?: number;
"line-round-limit"?: number;
}
export interface LinePaint {
"line-opacity"?: number;
"line-color"?: string| StyleFunction;
"line-translate"?: number[];
"line-translate-anchor"?: "map" | "viewport";
"line-width"?: number;
"line-gap-width"?: number;
"line-offset"?: number;
"line-blur"?: number;
"line-dasharray"?: number[];
"line-dasharray-transition"?: Transition;
"line-pattern"?: string;
}
export interface SymbolLayout {
visibility?: "visible" | "none";
"symbol-placement"?: "point" | "line";
"symbol-spacing"?: number;
"symbol-avoid-edges"?: boolean;
"icon-allow-overlap"?: boolean;
"icon-ignore-placement"?: boolean;
"icon-optional"?: boolean;
"icon-rotation-alignment"?: "map" | "viewport" | "auto";
"icon-size"?: number;
"icon-text-fit"?: "none" | "both" | "width" | "height";
"icon-text-fit-padding"?: number[];
"icon-image"?: string;
"icon-rotate"?: number | StyleFunction;
"icon-padding"?: number;
"icon-keep-upright"?: boolean;
"icon-offset"?: number[];
"text-pitch-alignment"?: "map" | "viewport" | "auto";
"text-rotation-alignment"?: "map" | "viewport" | "auto";
"text-field"?: string;
"text-font"?: string | string[];
"text-size"?: number;
"text-max-width"?: number;
"text-line-height"?: number;
"text-letter-spacing"?: number;
"text-justify"?: "left" | "center" | "right";
"text-anchor"?: "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
"text-max-angle"?: number;
"text-rotate"?: number;
"text-padding"?: number;
"text-keep-upright"?: boolean;
"text-transform"?: "none" | "uppercase" | "lowercase";
"text-offset"?: number[];
"text-allow-overlap"?: boolean;
"text-ignore-placement"?: boolean;
"text-optional"?: boolean;
}
export interface SymbolPaint {
"icon-opacity"?: number;
"icon-color"?: string;
"icon-halo-color"?: string;
"icon-halo-width"?: number;
"icon-halo-blur"?: number;
"icon-translate"?: number[];
"icon-translate-anchor"?: "map" | "viewport";
"text-opacity"?: number;
"text-color"?: "string";
"text-halo-color"?: "string";
"text-halo-width"?: number;
"text-halo-blur"?: number;
"text-translate"?: number[];
"text-translate-anchor"?: "map" | "viewport";
}
export interface RasterLayout {
visibility?: "visible" | "none";
}
export interface RasterPaint {
"raster-opacity"?: number;
"raster-hue-rotate"?: number;
"raster-brightness-min"?: number;
"raster-brightness-max"?: number;
"raster-saturation"?: number;
"raster-contrast"?: number;
"raster-fade-duration"?: number;
}
export interface CircleLayout {
visibility?: "visible" | "none";
}
export interface CirclePaint {
"circle-radius"?: number | StyleFunction;
"circle-radius-transition"?: Transition;
"circle-color"?: number | StyleFunction;
"circle-blur"?: number | StyleFunction;
"circle-opacity"?: number | StyleFunction;
"circle-translate"?: number[];
"circle-translate-anchor"?: "map" | "viewport";
"circle-pitch-scale"?: "map" | "viewport";
}
}
declare module 'mapbox-gl' {
export = mapboxgl;
}

1774
openlayers/index.d.ts vendored

File diff suppressed because it is too large Load Diff

343
pikaday-time/index.d.ts vendored Normal file
View File

@@ -0,0 +1,343 @@
// Type definitions for pikaday-time
// Project: https://github.com/owenmead/Pikaday
// Definitions by: Sayan Pal <https://github.com/Sayan751>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as moment from 'moment';
export as namespace Pikaday;
export = Pikaday;
declare class Pikaday {
el: HTMLElement;
constructor(options: Pikaday.PikadayOptions);
/**
* Extends the existing configuration options for Pikaday object with the options provided.
* Can be used to change/extend the configurations on runtime.
* @param options full/partial configuration options.
* @returns {} extended configurations.
*/
config(options: Pikaday.PikadayOptions): Pikaday.PikadayOptions;
/**
* Returns the selected date in a string format. If Moment.js exists
* (recommended) then Pikaday can return any format that Moment
* understands, otherwise you're stuck with JavaScript's default.
*/
toString(format?: string): string;
/**
* Returns a JavaScript Date object for the selected day, or null if
* no date is selected.
*/
getDate(): Date;
/**
* Set the current selection. This will be restricted within the bounds
* of minDate and maxDate options if they're specified. A boolean (true)
* can optionally be passed as the second parameter to prevent triggering
* of the onSelect callback, allowing the date to be set silently.
*/
setDate(date: string | Date, triggerOnSelect?: boolean): void;
/**
* Returns a Moment.js object for the selected date (Moment must be
* loaded before Pikaday).
*/
getMoment(): moment.Moment;
/**
* Set the current selection with a Moment.js object (see setDate).
*/
setMoment(moment: any): void;
/**
* Change the current view to see a specific date.
*/
gotoDate(date: Date): void;
/**
* Shortcut for picker.gotoDate(new Date())
*/
gotoToday(): void;
/**
* Change the current view by month (0: January, 1: Februrary, etc).
*/
gotoMonth(monthIndex: number): void;
/**
* Go to the next month (this will change year if necessary).
*/
nextMonth(): void;
/**
* Go to the previous month (this will change year if necessary).
*/
prevMonth(): void;
/**
* Change the year being viewed.
*/
gotoYear(year: number): void;
/**
* Update the minimum/earliest date that can be selected.
*/
setMinDate(date: Date): void;
/**
* Update the maximum/latest date that can be selected.
*/
setMaxDate(date: Date): void;
/**
* Update the range start date. For using two Pikaday instances to
* select a date range.
*/
setStartRange(date: Date): void;
/**
* Update the range end date. For using two Pikaday instances to select
* a date range.
*/
setEndRange(date: Date): void;
/**
* Update the HTML.
*/
draw(force: boolean): void;
/**
* Returns true if the picker is visible.
*/
isVisible(): boolean;
/**
* Make the picker visible.
*/
show(): void;
/**
* Hide the picker making it invisible.
*/
hide(): void;
/**
* Recalculate and change the position of the picker.
*/
adjustPosition(): void;
/**
* Hide the picker and remove all event listeners - no going back!
*/
destroy(): void;
}
// merge the Pikaday class declaration with a module
declare namespace Pikaday {
interface PikadayI18nConfig {
previousMonth: string;
nextMonth: string;
months: string[];
weekdays: string[];
weekdaysShort: string[];
}
interface PikadayOptions {
/**
* Bind the datepicker to a form field.
*/
field?: HTMLElement;
/**
* The default output format for toString() and field value.
* Requires Moment.js for custom formatting.
*/
format?: string;
/**
* Use a different element to trigger opening the datepicker.
* Default: field element.
*/
trigger?: HTMLElement;
/**
* Automatically show/hide the datepicker on field focus.
* Default: true if field is set.
*/
bound?: boolean;
/**
* Preferred position of the datepicker relative to the form field
* (e.g. 'top right'). Automatic adjustment may occur to avoid
* displaying outside the viewport. Default: 'bottom left'.
*/
position?: string;
/**
* Can be set to false to not reposition the datepicker within the
* viewport, forcing it to take the configured position. Default: true.
*/
reposition?: boolean;
/**
* DOM node to render calendar into, see container example.
* Default: undefined.
*/
container?: HTMLElement;
/**
* The initial date to view when first opened.
*/
defaultDate?: Date;
/**
* Make the defaultDate the initial selected value.
*/
setDefaultDate?: boolean;
/**
* First day of the week (0: Sunday, 1: Monday, etc).
*/
firstDay?: number;
/**
* The earliest date that can be selected (this should be a native
* Date object - e.g. new Date() or moment().toDate()).
*/
minDate?: Date;
/**
* The latest date that can be selected (this should be a native
* Date object - e.g. new Date() or moment().toDate()).
*/
maxDate?: Date;
/**
* Disallow selection of Saturdays and Sundays.
*/
disableWeekends?: boolean;
/**
* Callback function that gets passed a Date object for each day
* in view. Should return true to disable selection of that day.
*/
disableDayFn?: (date: Date) => boolean;
/**
* Number of years either side (e.g. 10) or array of upper/lower range
* (e.g. [1900, 2015]).
*/
yearRange?: number | number[];
/**
* Show the ISO week number at the head of the row. Default: false.
*/
showWeekNumber?: boolean;
/**
* Reverse the calendar for right-to-left languages. Default: false.
*/
isRTL?: boolean;
/**
* Language defaults for month and weekday names.
*/
i18n?: PikadayI18nConfig;
/**
* Additional text to append to the year in the title.
*/
yearSuffix?: string;
/**
* Render the month after the year in the title. Default: false.
*/
showMonthAfterYear?: boolean;
/**
* Render days of the calendar grid that fall in the next or previous months to the current month instead of rendering an empty table cell. Default: false.
*/
showDaysInNextAndPreviousMonths?: boolean;
/**
* Number of visible calendars.
*/
numberOfMonths?: number;
/**
* When numberOfMonths is used, this will help you to choose where the
* main calendar will be (default left, can be set to right). Only used
* for the first display or when a selected date is not already visible.
*/
mainCalendar?: string;
/**
* Define a class name that can be used as a hook for styling different
* themes. Default: null.
*/
theme?: string;
/**
* Callback function for when a date is selected.
*/
onSelect?: (date: Date) => void;
/**
* Callback function for when the picker becomes visible.
*/
onOpen?: () => void;
/**
* Callback function for when the picker is hidden.
*/
onClose?: () => void;
/**
* Callback function for when the picker draws a new month.
*/
onDraw?: () => void;
/*--pikaday-time specific addition--*/
/**
* Optional boolean property to specify whether to show time controls with calendar or not.
*/
showTime?: boolean;
/**
* Optional boolean property to specify whether to show minute controls with calendar or not.
*/
showMinutes?: boolean;
/**
* Optional boolean property to specify whether to show second controls with calendar or not.
*/
showSeconds?: boolean;
/**
* Optional boolean property to specify whether to use 24 hours format or not.
*/
use24hour?: boolean;
/**
* Optional numeric property to specify the increment step for hour.
*/
incrementHourBy?: number;
/**
* Optional numeric property to specify the increment step for minute.
*/
incrementMinuteBy?: number;
/**
* Optional numeric property to specify the increment step for second.
*/
incrementSecondBy?: number;
/**
* Optional numeric property to prevent calendar from auto-closing after date is selected.
*/
autoClose?: boolean;
/**
* Optional string added to left of time select
*/
timeLabel?: string;
}
}

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": ">=2.14.0"
}
}

View File

@@ -0,0 +1,83 @@
/// <reference types="jquery" />
import * as Pikaday from "pikaday-time";
import * as moment from "moment";
new Pikaday({field: document.getElementById('datepicker')});
new Pikaday({field: $('#datepicker')[0]});
(() => {
var field:HTMLInputElement = <HTMLInputElement>document.getElementById('datepicker');
var picker = new Pikaday({
onSelect: function (date:Date) {
field.value = picker.toString();
console.log(date.toISOString());
}
});
field.parentNode.insertBefore(picker.el, field.nextSibling);
})();
(() => {
var picker = new Pikaday({
field: document.getElementById('datepicker'),
format: 'D MMM YYYY',
onSelect: function () {
console.log(this.getMoment().format('Do MMMM YYYY'));
}
});
picker.toString();
picker.toString('YYYY-MM-DD');
picker.getDate();
picker.setDate('2015-01-01');
picker.getMoment();
picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY'));
picker.gotoDate(new Date(2014, 1));
picker.gotoToday();
picker.gotoMonth(2);
picker.nextMonth();
picker.prevMonth();
picker.gotoYear(2015);
picker.setMinDate(new Date);
picker.setMaxDate(new Date);
picker.setStartRange(new Date);
picker.setEndRange(new Date);
picker.isVisible();
picker.show();
picker.adjustPosition();
picker.hide();
picker.destroy();
})();
(() => {
var i18n: Pikaday.PikadayI18nConfig = {
previousMonth: 'Previous Month',
nextMonth: 'Next Month',
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
};
new Pikaday({i18n});
})();
(() => {
new Pikaday(
{
field: document.getElementById('datepicker'),
firstDay: 1,
minDate: new Date('2000-01-01'),
maxDate: new Date('2020-12-31'),
yearRange: [2000, 2020]
});
})();
(() => {
new Pikaday(
{
field: document.getElementById('datepicker'),
firstDay: 1,
minDate: new Date('2000-01-01'),
maxDate: new Date('2020-12-31'),
showDaysInNextAndPreviousMonths: true
});
})();

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"pikaday-time-tests.ts"
]
}

1
pikaday-time/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }

15
xlsx/index.d.ts vendored
View File

@@ -132,14 +132,21 @@ export interface ICell {
r: number;
}
export interface IRange {
s: ICell;
e: ICell;
}
export interface IUtils {
sheet_to_json<T>(worksheet: IWorkSheet, opts?: {
sheet_to_json<T>(worksheet:IWorkSheet, opts?: {
raw?: boolean;
range?: any;
header?: "A"|number|string[];
}): T[];
sheet_to_csv(worksheet: IWorkSheet): any;
sheet_to_formulae(worksheet: IWorkSheet): any;
}):T[];
sheet_to_csv(worksheet: IWorkSheet):any;
sheet_to_formulae(worksheet: IWorkSheet):any;
encode_cell(cell: ICell): any;
encode_range(s: ICell, e: ICell): any;
decode_cell(address: string): ICell;
decode_range(range: string): IRange;
}