mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #21655 from allipierre/master
jquery confirmdialog Plugin
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import * as concaveman from 'concaveman';
|
||||
|
||||
var points = [[10, 20], [30, 12.5]];
|
||||
var polygon = concaveman(points);
|
||||
var polygon = concaveman(points);
|
||||
|
||||
Vendored
+3
-2
@@ -3,10 +3,11 @@
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module "concaveman" {
|
||||
/**
|
||||
* A very fast 2D concave hull algorithm in JavaScript (generates a general outline of a point set).
|
||||
*
|
||||
*
|
||||
* @name concaveman
|
||||
* @param {Array<Array<number>>} points is an array of [x, y] points.
|
||||
* @param {number} [concavity=2] is a relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull. You can use values lower than 1, but they can produce pretty crazy shapes.
|
||||
@@ -15,7 +16,7 @@ declare module "concaveman" {
|
||||
* @example
|
||||
* var points = [[10, 20], [30, 12.5], ...];
|
||||
* var polygon = concaveman(points);
|
||||
*
|
||||
*
|
||||
* //=hull
|
||||
*/
|
||||
function concaveman(points: number[][], concavity?: number, lengthThreshold?: number): number[][];
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
class Confirm {
|
||||
private title_: string;
|
||||
private conTent_: string;
|
||||
constructor(title: string, content: string) {
|
||||
this.title_ = title;
|
||||
this.conTent_ = content;
|
||||
}
|
||||
|
||||
confirm() {
|
||||
$.confirm({
|
||||
title: 'Confirm!',
|
||||
content: 'Simple confirm!',
|
||||
buttons: {
|
||||
confirm: () => {
|
||||
$.alert('Confirmed!');
|
||||
},
|
||||
cancel: (cancel: string) => {
|
||||
$.alert('Canceled! ' + cancel);
|
||||
},
|
||||
somethingElse: {
|
||||
text: 'Something else',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter', 'shift'],
|
||||
action: () => {
|
||||
alert('Something else?');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
alert() {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Simple alert!',
|
||||
});
|
||||
}
|
||||
|
||||
globalSettings() {
|
||||
jconfirm.defaults = {
|
||||
title: 'Hello',
|
||||
titleClass: '',
|
||||
type: 'default',
|
||||
typeAnimated: true,
|
||||
draggable: true,
|
||||
dragWindowGap: 15,
|
||||
dragWindowBorder: true,
|
||||
animateFromElement: true,
|
||||
smoothContent: true,
|
||||
content: 'Are you sure to continue?',
|
||||
buttons: {},
|
||||
defaultButtons: {
|
||||
ok: {
|
||||
action: () => {
|
||||
}
|
||||
},
|
||||
close: {
|
||||
action: () => {
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
icon: '',
|
||||
lazyOpen: false,
|
||||
bgOpacity: null,
|
||||
theme: 'light',
|
||||
animation: 'scale',
|
||||
closeAnimation: 'scale',
|
||||
animationSpeed: 400,
|
||||
animationBounce: 1,
|
||||
rtl: false,
|
||||
container: 'body',
|
||||
containerFluid: false,
|
||||
backgroundDismiss: false,
|
||||
backgroundDismissAnimation: 'shake',
|
||||
autoClose: false,
|
||||
closeIcon: null,
|
||||
closeIconClass: false,
|
||||
watchInterval: 100,
|
||||
columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1',
|
||||
boxWidth: '50%',
|
||||
scrollToPreviousElement: true,
|
||||
scrollToPreviousElementAnimate: true,
|
||||
useBootstrap: true,
|
||||
offsetTop: 40,
|
||||
offsetBottom: 40,
|
||||
bootstrapClasses: {
|
||||
container: 'container',
|
||||
containerFluid: 'container-fluid',
|
||||
row: 'row',
|
||||
},
|
||||
onContentReady: () => {},
|
||||
onOpenBefore: () => {},
|
||||
onOpen: () => {},
|
||||
onClose: () => {},
|
||||
onDestroy: () => {},
|
||||
onAction: () => {}
|
||||
};
|
||||
}
|
||||
|
||||
api() {
|
||||
const jc = $.confirm({
|
||||
title: 'awesome',
|
||||
onContentReady: () => {
|
||||
jc.setTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
confirm_84() {
|
||||
$.confirm({
|
||||
closeIcon: true,
|
||||
buttons: {
|
||||
buttonA: {
|
||||
text: 'button a',
|
||||
action: (buttonA: string) => {
|
||||
return false; // prevent the modal from closing
|
||||
}
|
||||
},
|
||||
resetButton: (resetButton: string) => {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let firstName = 'Pierre';
|
||||
let lastName = 'Yotti';
|
||||
let type = new Confirm(firstName, lastName);
|
||||
Vendored
+93
@@ -0,0 +1,93 @@
|
||||
// Type definitions for confirmdialog 3.3
|
||||
// Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js
|
||||
// Definitions by: Alli Pierre Yotti <https://github.com/allipierre>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
interface JQueryStatic {
|
||||
/**
|
||||
* confirm Dialog
|
||||
* {confirmOptions} pOtions
|
||||
*/
|
||||
confirm(pOtions: options.confirmOptions | string, title?: string): any;
|
||||
|
||||
/**
|
||||
* confirm alert
|
||||
* {any} pMessage
|
||||
*/
|
||||
alert(pMessage?: any, title?: string): any;
|
||||
|
||||
/**
|
||||
* confirm Dialog
|
||||
* {any} pMessage
|
||||
*/
|
||||
dialog(pOtions: options.confirmOptions | string): any;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* confirm Dialog
|
||||
* {confirmOptions} pOtions
|
||||
*/
|
||||
confirm(pOtions: options.confirmOptions | string, title?: string): any;
|
||||
|
||||
/**
|
||||
* confirm alert
|
||||
* {any} pMessage
|
||||
*/
|
||||
alert(pMessage?: any, title?: string): any;
|
||||
|
||||
/**
|
||||
* confirm Dialog
|
||||
* {any} pMessage
|
||||
*/
|
||||
dialog(pOtions: options.confirmOptions): any;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
setContentAppend: any;
|
||||
}
|
||||
|
||||
declare namespace options {
|
||||
interface confirmOptions {
|
||||
buttons?: any;
|
||||
title?: string | boolean;
|
||||
content?: any;
|
||||
onContentReady?: any;
|
||||
lazyOpen?: boolean;
|
||||
closeIcon?: any;
|
||||
type?: string;
|
||||
typeAnimated?: boolean;
|
||||
icon?: string;
|
||||
closeIconClass?: string;
|
||||
columnClass?: string;
|
||||
containerFluid?: boolean;
|
||||
boxWidth?: string;
|
||||
useBootstrap?: boolean;
|
||||
bootstrapClasses?: any;
|
||||
draggable?: boolean;
|
||||
dragWindowBorder?: boolean;
|
||||
dragWindowGap?: number;
|
||||
contentLoaded?: () => void;
|
||||
autoClose?: string;
|
||||
backgroundDismiss?: any;
|
||||
backgroundDismissAnimation?: string;
|
||||
escapeKey?: string | boolean;
|
||||
onOpenBefore?: () => void;
|
||||
onOpen?: () => void;
|
||||
onClose?: () => void;
|
||||
onDestroy?: () => void;
|
||||
onAction?: () => void;
|
||||
}
|
||||
|
||||
interface buttonOptionss {
|
||||
cancel?: () => void;
|
||||
confirm?: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace jconfirm {
|
||||
let defaults: any;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"target": "es6"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"confirmdialog-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for notifier 1.0
|
||||
// Project: https://github.com/allipierre/jquery-notifier
|
||||
// Definitions by: Alli Pierre Yotti <https://github.com/allipierre>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace notifier {
|
||||
/**
|
||||
* notifier.show(title, msg, type, icon, timeout);
|
||||
* {title} title
|
||||
* {msg} msg
|
||||
* {type} type
|
||||
* {icon} icon
|
||||
* {timeout} timeout
|
||||
*/
|
||||
function show(title: string, msg: string, type: string, icon: string, timeout?: number): string | number;
|
||||
|
||||
function hide(notificationId: string | number): boolean;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
notifier.show('Hello!', 'I am a default notification.', '', '', 0);
|
||||
notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', '', 0);
|
||||
notifier.show('Well Done!', 'You just submit your resume successfuly.', '', '', 0);
|
||||
notifier.show('Warning!', 'The data presented here can be change.', '', '', 0);
|
||||
notifier.show('Sorry!', 'Could not complete your transaction.', '', '', 0);
|
||||
|
||||
notifier.show('Default!', 'I am a default notification.', '', 'img/clock-48.png', 0);
|
||||
notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 0);
|
||||
notifier.show('Well Done!', 'You just submit your resume successfuly.', '', 'img/ok-48.png', 0);
|
||||
notifier.show('Warning!', 'The data presented here can be change.', '', 'img/medium_priority-48.png', 0);
|
||||
notifier.show('Sorry!', 'Could not complete your transaction.', '', 'img/high_priority-48.png', 0);
|
||||
|
||||
notifier.show('Default!', 'I am a default notification.', '', 'img/clock-48.png', 4000);
|
||||
notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 4000);
|
||||
notifier.show('Well Done!', 'You just submit your resume successfuly.', '', 'img/ok-48.png', 4000);
|
||||
notifier.show('Warning!', 'The data presented here can be change.', '', 'img/medium_priority-48.png', 4000);
|
||||
notifier.show('Sorry!', 'Could not complete your transaction.', '', 'img/high_priority-48.png', 4000);
|
||||
|
||||
let notificationId: string | number;
|
||||
|
||||
let showNotification = () => {
|
||||
notificationId = notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 4000);
|
||||
};
|
||||
|
||||
let hideNotification = () => {
|
||||
notifier.hide(notificationId);
|
||||
};
|
||||
|
||||
document.querySelector('#btn-nt-show').addEventListener('click', showNotification);
|
||||
|
||||
document.querySelector('#btn-nt-hide').addEventListener('click', hideNotification);
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery-notifier-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user