Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add typings file #34

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 42 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.3.3-beta.0",
"description": "React Super Treeview",
"main": "dist/main.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=6.7.0",
"npm": ">=4.0.0"
Expand Down Expand Up @@ -68,7 +69,7 @@
"html-webpack-plugin": "^2.30.1",
"mocha": "^4.0.1",
"mocha-webpack": "^1.1.0",
"node-sass": "^4.11.0",
"node-sass": "^4.12.0",
"null-loader": "^0.1.1",
"react": "^15.5.10",
"react-dom": "^15.5.10",
Expand Down
35 changes: 35 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as React from "react";

export type TreeNode = {
id: number,
name: string
children?: Array<TreeNode>
isExpanded?: boolean
isChecked?: boolean
isChildrenLoading?: boolean
}

export type TreeViewProps = {
data: Array<TreeNode>
onUpdateCb?: (updatedData: Array<TreeNode>) => void
isCheckable?: (node: TreeNode, depth: number) => boolean
isDeletable?: (node: TreeNode, depth: number) => boolean
isExpandable?: (node: TreeNode, depth: number) => boolean
getStyleClassCb?: (node: TreeNode, depth: number) => string
deleteElement?: any;
depth?: number
keywordChildrenLoading?: string
keywordKey?: string
keywordLabel?: string
loadingElement?: any;
noChildrenAvailableMessage?: string
onCheckToggleCb?: (nodes: Array<TreeNode>, dept: number) => void
onDeleteCb?: (node: TreeNode, updatedData: Array<TreeNode>, depth: number) => void
onExpandToggleCb?: (node: TreeNode, depth: number) => void
transitionEnterTimeout?: number
transitionExitTimeout?: number
}

declare class SuperTreeView extends React.Component<TreeViewProps> {}

export default SuperTreeView
12 changes: 8 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ const config = {
},
plugins: [
new ExtractTextPlugin('style.css'),
new CopyWebpackPlugin([{
from: 'src/style.scss',
dest: 'dist/[name].[ext]'
}])
new CopyWebpackPlugin([
{
from: 'src/style.scss'
},
{
from: 'src/index.d.ts'
}
])
],

externals: [
Expand Down