Add new definitions for [@types/splitpanes] (#36364)

* Add types of [@types/vue-splitpane] package

* Add types of [@types/vue-splitpane] package

* update split type

* fix EsLint Missing semicolon

* fix Eslint Missing semicolon

* fix esLint

* fix Eslint

* Add types of [@types/splitpanes] package

* fix file rename

* fix Submit multiple components at a PR

* fix rename

* fix build rename

* Add new definitions for [@types/splitpanes]

* fix tsconfig files list

* fix tsconfig files name

* fix eslint

* fix bug dt-header add object-literal-key-quotes

* fix Consecutive

* fix stander name
This commit is contained in:
teen 2019-07-04 02:11:53 +08:00 committed by Ryan Cavanaugh
parent 47c71265ab
commit 84f0283b53
10 changed files with 214 additions and 0 deletions

85
types/splitpanes/index.d.ts vendored Normal file
View File

@ -0,0 +1,85 @@
// Type definitions for splitPanes 1.0
// Project: https://github.com/antoniandre/splitpanes
// Definitions by: teenhe <https://github.com/noonhorse>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.5
import { VueConstructor } from 'vue';
export default splitPanes;
export const splitPanes: splitPanesConstructor;
export interface positionTypes {
x: number;
y: number;
}
export interface containerTypes {
vnode: any;
offsetLeft: null | number;
offsetTop: null | number;
}
export interface touchTypes {
mouseDown: boolean;
dragging: boolean;
activeSplitter: null | number;
}
export interface splitterTapsTypes {
splitter: null | number;
timeoutId: null | object;
}
export interface splitPanesProps {
watchSlots: boolean; // 是否监控插槽 false
horizontal: boolean; // 是否水平 false
pushOtherPanes: boolean; // 支持添加 true
dblClickSplitter: boolean; // 双击分离 true
}
export interface splitPanesData {
container: containerTypes;
slotsCount: number;
vnodes: any[];
panes: any[];
splitters: any[];
touch: touchTypes;
// Detect double click on touch devices.
splitterTaps: splitterTapsTypes;
slotsCopy: string;
}
export interface splitPanesWatch {
defaultPercent: (val: any) => void;
}
export interface splitPanesMethods {
bindEvents: () => void;
onMouseDown: (e: Event, splitterIndex: number) => void;
onMouseMove: (e: Event) => void;
onMouseUp: () => void;
onSplitterClick: (e: Event, splitterIndex: number) => void;
onSplitterDblClick: (e: Event, splitterIndex: number) => void;
getCurrentMouseDrag: (e: Event) => positionTypes;
getCurrentDragPercentage: (drag: object) => number;
calculatePanesSize: (drag: object) => boolean | void;
doPushOtherPanes: (sums: object, dragPercentage: number) => any;
sumPrevPanesSize: (splitterIndex: number) => object;
sumNextPanesSize: (splitterIndex: number) => object;
findPrevExpandedPane: (splitterIndex: number) => object;
findNextExpandedPane: (splitterIndex: number) => object;
}
export interface splitPanesComputed {
defaultWidth: () => number;
}
export interface splitPanesConstructor extends VueConstructor {
props: splitPanesProps;
data: () => splitPanesData;
watch: splitPanesWatch;
methods: splitPanesMethods;
computed: splitPanesComputed;
mounted: () => void;
beforeDestroy: () => void;
beforeUpdate: () => void;
render: (createEl: any) => any;
}

View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"vue": ">=2.0.0"
}
}

View File

@ -0,0 +1,17 @@
import Vue from 'vue';
import splitPanes from 'splitpanes';
new Vue({
el: '#app',
data: {},
components: {
'split-panes': splitPanes,
},
template: `<split-panes class="default-theme" horizontal @resize="horizontalResize($event)" :dblClickSplitter="false" :push-other-panes="false">
<span splitpanes-min="2" splitpanes-size="35" splitpanes-max="85">
A
</span>
<span splitpanes-min="2" splitpanes-size="65" splitpanes-max="85">
B
</span>
</split-panes>`,
});

View File

@ -0,0 +1,16 @@
{
"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", "splitpanes-tests.ts"]
}

View File

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

49
types/vue-splitpane/index.d.ts vendored Normal file
View File

@ -0,0 +1,49 @@
// Type definitions for vue-splitpane 1.0
// Project: https://github.com/PanJiaChen/vue-split-pane/
// Definitions by: noonhorse <https://github.com/noonhorse>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.5
import { VueConstructor } from 'vue';
export default Splitpane;
export const Splitpane: SplitpaneConstructor;
export interface SplitpaneProps {
minPercent: number;
defaultPercent: number;
split: string; // = ['vertical', 'horizontal']
className: string;
}
export interface SplitpaneData {
active: boolean;
hasMoved: boolean;
height: any; // null number string
percent: number;
type: string;
resizeType: string;
}
export interface SplitpaneWatch {
defaultPercent: (val: any) => void;
}
export interface SplitpaneMethods {
onClick: () => void;
onMouseDown: () => void;
onMouseUp: () => void;
onMouseMove: (e: Event) => void;
}
export interface SplitpaneComputed {
userSelect: () => string;
cursor: () => string;
}
export interface SplitpaneConstructor extends VueConstructor {
props: SplitpaneProps;
data: () => SplitpaneData;
watch: SplitpaneWatch;
methods: SplitpaneMethods;
computed: SplitpaneComputed;
}

View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"vue": ">=2.0.0"
}
}

View File

@ -0,0 +1,16 @@
{
"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", "vue-splitpane-tests.ts"]
}

View File

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

View File

@ -0,0 +1,17 @@
import Vue from 'vue';
import splitPane from 'vue-splitpane';
new Vue({
el: '#app',
data: {},
components: {
'split-pane': splitPane,
},
template: `<split-pane v-on:resize="resize" :min-percent='20' :default-percent='30' split="vertical">
<template slot="paneL">
A
</template>
<template slot="paneR">
B
</template>
</split-pane>`,
});