mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
providing type definitions for jquery-editable-select (#18356)
* providing type definitions for jquery-editable-select * fixing linting errors for jquery-editable-select * re-enabling disabled linting rule ban-types for jquery-editable-select
This commit is contained in:
parent
0eb19c926a
commit
4afabfed53
71
types/jquery-editable-select/index.d.ts
vendored
Normal file
71
types/jquery-editable-select/index.d.ts
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
// Type definitions for jquery-editable-select 2.2
|
||||
// Project: https://github.com/indrimuska/jquery-editable-select
|
||||
// Definitions by: Vincent Biret <https://github.com/baywet>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
declare namespace JQueryEditableSelect {
|
||||
interface EditableSelectOptions {
|
||||
/**
|
||||
* Filter (or not) items in list while typing.
|
||||
*/
|
||||
filter?: boolean;
|
||||
/**
|
||||
* Easing used for showing and hiding the dropdown list.
|
||||
*/
|
||||
effects?: 'default' | 'slide' | 'fade';
|
||||
/**
|
||||
* Duration of the easings (in milliseconds).
|
||||
*/
|
||||
duration?: number | 'fast' | 'slow';
|
||||
/**
|
||||
* Where to append the dropdown list in the DOM.
|
||||
*/
|
||||
appendTo?: string | JQuery;
|
||||
/**
|
||||
* How dropdown list is triggered.
|
||||
*/
|
||||
trigger?: 'focus'| 'manual';
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Transforms the <select> into a typeahead field. Accepts an optional options object.
|
||||
*
|
||||
* @param options Options setting the editable select behavior
|
||||
*/
|
||||
editableSelect(options?: JQueryEditableSelect.EditableSelectOptions): JQuery;
|
||||
/**
|
||||
* Manually shows/hide/filters/clears/destorys the dropdown list.
|
||||
*
|
||||
* @param action Action to apply
|
||||
*/
|
||||
editableSelect(action: 'show'| 'hide'| 'filter' | 'clear'| 'destroy'): void;
|
||||
/**
|
||||
* Manually sets the value of the text field to the value of the $element passed as parameter.
|
||||
*
|
||||
* @param action Action to apply, must be 'select'
|
||||
* @param element element to select (it must be one of the elements in the dropdown list)
|
||||
*/
|
||||
editableSelect(action: 'select', element: JQuery): void;
|
||||
/**
|
||||
* Adds a new option in the dropdown list
|
||||
*
|
||||
* @param action Action to apply, must be 'add'
|
||||
* @param text Test to be displayed
|
||||
* @param index position to insert the element at.
|
||||
* @param attrs optional attributes to add to the element
|
||||
* @param data optional data to add to the element
|
||||
*/
|
||||
editableSelect(action: 'add', text: string , index?: number, attrs?: Array<{name: string, value: string}>, data?: string): void;
|
||||
/**
|
||||
* Removes an option in the dropdown list at the given index.
|
||||
*
|
||||
* @param action Action to apply, must be 'remove'
|
||||
* @param index position of the element to remove.
|
||||
*/
|
||||
editableSelect(action: 'remove', index: number): void;
|
||||
}
|
||||
15
types/jquery-editable-select/jquery-editable-select-tests.ts
Normal file
15
types/jquery-editable-select/jquery-editable-select-tests.ts
Normal file
@ -0,0 +1,15 @@
|
||||
function test_editable_select() {
|
||||
$("#select").editableSelect();
|
||||
$("#select").editableSelect({ filter: true, duration: 'slow', effects: 'default', appendTo: '.someelementclass', trigger: 'focus'});
|
||||
$("#select").editableSelect('remove', 0);
|
||||
$("#select").editableSelect('destroy');
|
||||
$("#select").editableSelect('hide');
|
||||
$("#select").editableSelect('show');
|
||||
$("#select").editableSelect('filter');
|
||||
$("#select").editableSelect('clear');
|
||||
$("#select").editableSelect('select', $('#option1'));
|
||||
$("#select").editableSelect('add', 'some text');
|
||||
$("#select").editableSelect('add', 'some text', 0);
|
||||
$("#select").editableSelect('add', 'some text', 0, [{name: 'attribute1', value: 'attribute1value'}]);
|
||||
$("#select").editableSelect('add', 'some text', 0, [{name: 'attribute1', value: 'attribute1value'}], 'some data');
|
||||
}
|
||||
23
types/jquery-editable-select/tsconfig.json
Normal file
23
types/jquery-editable-select/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery-editable-select-tests.ts"
|
||||
]
|
||||
}
|
||||
5
types/jquery-editable-select/tslint.json
Normal file
5
types/jquery-editable-select/tslint.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user