mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added types for vue2-datepicker component (#27108)
* Created types for vue2-datepicker * Added missing new line * Enabled strictNullChecks
This commit is contained in:
parent
b68ae4872a
commit
83f67fa71c
57
types/vue2-datepicker/index.d.ts
vendored
Normal file
57
types/vue2-datepicker/index.d.ts
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
// Type definitions for vue2-datepicker 2.0
|
||||
// Project: https://github.com/mengxiong10/vue2-datepicker
|
||||
// Definitions by: ChristianStornowski <https://github.com/ChristianStornowski>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Component } from "vue/types/options";
|
||||
|
||||
declare namespace Datepicker {
|
||||
interface Shortcuts {
|
||||
text: string;
|
||||
start: Date;
|
||||
end: Date;
|
||||
}
|
||||
|
||||
interface TimePickerOptions {
|
||||
start: string;
|
||||
step: string;
|
||||
end: string;
|
||||
}
|
||||
|
||||
interface Lang {
|
||||
days: string[];
|
||||
months: string[];
|
||||
pickers: string[];
|
||||
placeholder: {
|
||||
date: string;
|
||||
dateRange: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare const Datepicker: Component<any, any, any, {
|
||||
type?: string;
|
||||
range?: boolean;
|
||||
format?: string;
|
||||
lang?: string | Datepicker.Lang;
|
||||
clearable?: boolean;
|
||||
confirm?: boolean;
|
||||
editable?: boolean;
|
||||
disabled?: boolean;
|
||||
placeholder?: string;
|
||||
width?: number | string;
|
||||
notBefore?: string | Date;
|
||||
notAfter?: string | Date;
|
||||
disabledDays?: number[] | string[] | ((date: Date) => Date[]);
|
||||
shortcuts?: boolean | Datepicker.Shortcuts[]
|
||||
timePickerOptions?: Datepicker.TimePickerOptions[] | (() => Datepicker.TimePickerOptions[]);
|
||||
minuteStep?: number;
|
||||
firstDayOfWeek?: number;
|
||||
inputClass?: string;
|
||||
inputName?: string;
|
||||
confirmText?: string;
|
||||
rangeSeparator?: string;
|
||||
}>;
|
||||
|
||||
export default Datepicker;
|
||||
6
types/vue2-datepicker/package.json
Normal file
6
types/vue2-datepicker/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"vue": ">=2.0.0"
|
||||
}
|
||||
}
|
||||
23
types/vue2-datepicker/tsconfig.json
Normal file
23
types/vue2-datepicker/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"vue2-datepicker-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/vue2-datepicker/tslint.json
Normal file
1
types/vue2-datepicker/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
23
types/vue2-datepicker/vue2-datepicker-tests.ts
Normal file
23
types/vue2-datepicker/vue2-datepicker-tests.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import Vue from 'vue';
|
||||
import DatePicker from "vue2-datepicker";
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
components: {
|
||||
DatePicker
|
||||
},
|
||||
template: `
|
||||
<date-picker
|
||||
:placeholder="placeholder"
|
||||
v-model="dateOfBirth"
|
||||
format="YYYY-MM-DD"
|
||||
lang="en">
|
||||
<template slot="calendar-icon">
|
||||
<span class="input-datepicker__icon"></span>
|
||||
</template>
|
||||
</date-picker>
|
||||
`,
|
||||
data() {
|
||||
return { dateOfBirth: new Date() };
|
||||
}
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user