askmethat-rating: Provides own types (#20958)

This commit is contained in:
Andy
2017-10-24 11:22:50 -07:00
committed by Sheetal Nandi
parent 8072f4c709
commit 9a3107a350
5 changed files with 6 additions and 185 deletions
+6
View File
@@ -54,6 +54,12 @@
"sourceRepoURL": "https://github.com/ranisalt/node-argon2",
"asOfVersion": "0.15.0"
},
{
"libraryName": "askmethat-rating",
"typingsPackageName": "askmethat-rating",
"sourceRepoURL": "https://github.com/AlexTeixeira/Askmethat-Rating",
"asOfVersion": "0.4.0"
},
{
"libraryName": "aws-sdk",
"typingsPackageName": "aws-sdk",
@@ -1,18 +0,0 @@
import { AskmethatRating, AskmethatRatingSteps } from "askmethat-rating";
const options = {
backgroundColor: "#e5e500",
hoverColor: "#ffff66",
fontClass: "fa fa-star",
minRating: 1,
maxRating: 5,
readonly: false,
step: AskmethatRatingSteps["OnePerOneStep"],
inputName: "AskmethatRating"
};
const div = document.createElement("div");
const amcRating = new AskmethatRating(div, 2 , options);
options.readonly = true;
amcRating.defaultOptions = options;
-142
View File
@@ -1,142 +0,0 @@
// Type definitions for askmethat-rating 0.3
// Project: https://alexteixeira.github.io/Askmethat-Rating/
// Definitions by: Alexandre Teixeira <https://github.com/AlexTeixeira>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export enum AskmethatRatingSteps {
/**
* Step 0.1 per 0.1
*/
DecimalStep = 0,
/**
* Step 0.5 per 0.5
*/
HalfStep = 1,
/**
* Step 1 per 1
*/
OnePerOneStep = 2,
}
export interface AskmethatRatingOptions {
hoverColor?: string;
/**
* Color when the rating is not hovered
*/
backgroundColor?: string;
/**
* Mininmum rating that the user can set
*/
minRating?: number;
/**
* Maximum rating that the plugin display
*/
maxRating?: number;
/**
* Class to display as rating (FontAwesome or Rating for exemple)
*/
fontClass: string;
/**
* Set the rating to readonly
*/
readonly: boolean;
/**
* The stepping for the rating
*/
step: AskmethatRatingSteps;
/**
* Input name (Default is AskmethatRating)
*/
inputName: string;
}
export class AskmethatRating {
private parentElement;
private pValue;
private styleSheet;
private changeEvent;
private ratingClick;
private mouseMove;
/**
* @function get the current value for the rating
*/
/**
* @function set a new value for the rating
*
* @param _value this is the new value you want to set to the rating
* @returns the current number
*/
value: number;
/**
* Default option base on @type IAskmethatRatingOptions
*/
private _defaultOptions;
/**
* @function get the default option for the rating
*
* @return options based on @type AskmethatRatingOptions
*/
/**
* @function set the default option for the rating
*
* @return options based on @type AskmethatRatingOptions
*/
defaultOptions: AskmethatRatingOptions;
/**
* constructor with div element, default rating value & default options
*
* @param element This is the html container for the rating elements
* @param defaultValue Default value set when the plugin render the rating
* @param options Default option base on AskmethatRatingOptions type
*/
constructor(element: HTMLDivElement, defaultValue?: number, options?: any);
/**
* render a new rating, by default value is the minRating
*
* @param value this is the default value set when the plugin is rendered, by default IAskmethatRatingOptions.minRating
*/
render(value?: number): void;
/**
* @function when a rating is clicked
* @param {type} event : Event {event object}
*/
private onRatingClick(event?);
/**
* @function Calculate the value according to the step provided in options
* @param {Number} value:number the current value
* @return {Number} the new value according to step
*/
protected getValueAccordingToStep(value: number): number;
/**
* @function mouse event enter in rating
* @param {type} event?: Event {event}
*/
private onMouseMove(event?);
/**
* @function mouse out event in rating
* @param {type} event?: Event {event}
*/
private onMouseLeave(event?);
/**
* @function set or unset the active class and color
* @param {HTMLSpanElement} current : current span element
* @param {number} current : value needed for the if
*/
protected setOrUnsetActive(value: number): void;
/**
* Check if disabled attribute is added or removed from the input
* Update readonly status if needed for the rating
*/
private mutationEvent();
/**
* This is fired by mutation observer when an attribute changed in the hidden input
* Is protected to have some unit tests
* @param {MutationRecord[]} mutations list of mutations record
*/
protected mutationDisableEvent(mutations: MutationRecord[]): void;
/**
* @function static method to retrieve with identifier the value
* @param {string} identifier: string container identifier
* @return {number} current rating
*/
static value(identifier: string): number;
}
-24
View File
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"askmethat-rating-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }