diff --git a/notNeededPackages.json b/notNeededPackages.json index 8fa7f1aa44..a8a262b5f4 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -402,6 +402,12 @@ "sourceRepoURL": "https://github.com/PeculiarVentures/graphene", "asOfVersion": "2.0.31" }, + { + "libraryName": "griddle-react", + "typingsPackageName": "griddle-react", + "sourceRepoURL": "https://github.com/griddlegriddle/griddle", + "asOfVersion": "1.3.0" + }, { "libraryName": "gulp-typescript", "typingsPackageName": "gulp-typescript", diff --git a/types/griddle-react/index.d.ts b/types/griddle-react/index.d.ts deleted file mode 100644 index ea40fb2130..0000000000 --- a/types/griddle-react/index.d.ts +++ /dev/null @@ -1,168 +0,0 @@ -// Type definitions for griddle-react 0.7 -// Project: https://github.com/griddlegriddle/griddle -// Definitions by: David Hara -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/* -The MIT License (MIT) - -Copyright (c) 2016 David Hara - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -import * as React from 'react'; - -type ReactClass = React.ComponentClass | React.StatelessComponent; - -export interface CustomColumnComponentProps { - data: any; - rowData: T; - metaData: ColumnMetaData; -} - -export interface CustomRowComponentProps { - data: T; -} - -export interface CustomGridComponentProps { - data: T[]; -} - -export interface CustomPagerComponentProps { - currentPage: number; - maxPage: number; - nextText: string; - previousText: string; - next(): void; - previous(): void; - setPage(number: number): void; -} - -export interface CustomHeaderComponentProps { - filterByColumn?(filter: string, columnName: string): void; - columnName: string; - displayName: string; -} - -export interface CustomFilterComponentProps { - placeholderText?: string; - changeFilter(val: any): void; -} - -export interface ColumnMetaData { - columnName: string; - cssClassName?: string; - customComponent?: ReactClass>; - customHeaderComponent?: ReactClass; - customHeaderComponentProps?: {}; - displayName?: string; - locked?: boolean; - order?: number; - sortable?: boolean; - visible?: boolean; -} - -export type BodyCssClassNameFunction = (rowData: T) => string; - -export interface RowMetaData { - bodyCssClassName?: BodyCssClassNameFunction | string; -} - -export interface GriddleProps { - columns?: string[]; - columnMetadata?: Array>; - rowMetadata?: RowMetaData; - results?: T[]; - resultsPerPage?: number; - initialSort?: string; - initialSortAscending?: boolean; - gridClassName?: string; - tableClassName?: string; - customFormatClassName?: string; - settingsText?: string; - filterPlaceholderText?: string; - nextText?: string; - previousText?: string; - maxRowsText?: string; - enableCustomFormatText?: string; - childrenColumnName?: string; - metadataColumns?: string[]; - showFilter?: boolean; - showSettings?: boolean; - useCustomRowComponent?: boolean; - useCustomGridComponent?: boolean; - useCustomPagerComponent?: boolean; - useCustomFilterer?: boolean; - useCustomFilterComponent?: boolean; - useGriddleStyles?: boolean; - customRowComponent?: ReactClass>; - customGridComponent?: ReactClass>; - customPagerComponent?: ReactClass; - customFilterComponent?: ReactClass; - customFilterer?(items: T[], query: any): T[]; - enableToggleCustom?: boolean; - noDataMessage?: string; - noDataClassName?: string; - customNoDataComponent?: ReactClass; - showTableHeading?: boolean; - showPager?: boolean; - useFixedHeader?: boolean; - useExternal?: boolean; - externalSetPage?(index: number): void; - externalChangeSort?(sort: string, sortAscending: boolean): void; - externalSetFilter?(filter: string): void; - externalSetPageSize?(size: number): void; - externalMaxPage?: number; - externalCurrentPage?: number; - externalSortColumn?: string; - externalSortAscending?: boolean; - externalLoadingComponent?: ReactClass; - externalIsLoading?: boolean; - enableInfiniteScroll?: boolean; - bodyHeight?: number; - paddingHeight?: number; - rowHeight?: number; - infiniteScrollLoadTreshold?: number; - useFixedLayout?: boolean; - isSubGriddle?: boolean; - enableSort?: boolean; - sortAscendingClassName?: string; - sortDescendingClassName?: string; - parentRowCollapsedClassName?: string; - parentRowExpandedClassName?: string; - settingsToggleClassName?: string; - nextClassName?: string; - previousClassName?: string; - sortAscendingComponent?: string | React.ReactElement; - sortDescendingComponent?: string | React.ReactElement; - sortDefaultComponent?: string | React.ReactElement; - parentRowCollapsedComponent?: string | React.ReactElement; - parentRowExpandedComponent?: string | React.ReactElement; - settingsIconComponent?: string | React.ReactElement; - nextIconComponent?: string | React.ReactElement; - previousIconComponent?: string | React.ReactElement; - onRowClick?(): void; -} - -declare class Griddle extends React.Component> { -} - -export default Griddle; diff --git a/types/griddle-react/test/CustomColumnComponent.tsx b/types/griddle-react/test/CustomColumnComponent.tsx deleted file mode 100644 index f344796538..0000000000 --- a/types/griddle-react/test/CustomColumnComponent.tsx +++ /dev/null @@ -1,70 +0,0 @@ -/* -Licensed under the MIT License (MIT) - -Copyright (c) 2016 David Hara -*/ - -import * as React from 'react'; -import Griddle, { CustomColumnComponentProps } from 'griddle-react'; - -interface MyCustomResult { - name: string; - test: string; -} - -class LinkComponent extends React.Component> { - render() { - const url = `speakers/${this.props.rowData.test}/${this.props.data}`; - return {this.props.data}; - } -} - -const StatelessFunctionComponent = (props: CustomColumnComponentProps) => { - const url = `speakers/${props.rowData.test}/${props.data}`; - return {props.data}; -}; - -const columnMeta = [ - { - columnName: "name", - order: 1, - locked: false, - visible: true, - customComponent: StatelessFunctionComponent - }]; - -const results: MyCustomResult[] = [ - { - name: 'David Hara', - test: 'blah' - }, - { - name: 'Hara, David', - test: 'blah2' - } -]; - -const rowMetaData = { - bodyCssClassName: (rowData: MyCustomResult) => { - return rowData.test; - } -}; - -class CustomColumnComponentGrid extends React.Component { - render() { - type TypedGriddle = new () => Griddle; - const TypedGriddle = Griddle as TypedGriddle; - - return ( - } - sortDescendingComponent={} - customRowComponent={LinkComponent} /> - ); - } -} - -export default CustomColumnComponentGrid; diff --git a/types/griddle-react/test/CustomFilterComponent.tsx b/types/griddle-react/test/CustomFilterComponent.tsx deleted file mode 100644 index 5c8b8d629c..0000000000 --- a/types/griddle-react/test/CustomFilterComponent.tsx +++ /dev/null @@ -1,89 +0,0 @@ -/* -Licensed under the MIT License (MIT) - -Copyright (c) 2016 David Hara -*/ - -import * as _ from 'lodash'; -import * as React from 'react'; -import Griddle, { CustomFilterComponentProps } from 'griddle-react'; - -const CustomFilterFunction = (items: ResultType[], query: string): ResultType[] => { - return _.filter(items, (item) => { - let match = false; - _.forIn(item, (value, key) => { - if (String(value).toLowerCase().indexOf(query.toLowerCase()) >= 0) { - match = true; - return; - } - }); - - return match; - }); -}; - -class CustomFilterComponent extends React.Component { - query = ''; - - searchChange(event: React.FormEvent) { - this.query = event.currentTarget.value; - this.props.changeFilter(this.query); - } - - render() { - return ( -
- -
- ); - } -} - -interface ResultType { - id: number; - name: string; - city: string; - state: string; - country: string; - company: string; - favoriteNumber: number; -} - -const someData: ResultType[] = [ - { - id: 0, - name: "Mayer Leonard", - city: "Kapowsin", - state: "Hawaii", - country: "United Kingdom", - company: "Ovolo", - favoriteNumber: 7 - }, - { - id: 1, - name: "Koch Becker", - city: "Johnsonburg", - state: "New Jersey", - country: "Madagascar", - company: "Eventage", - favoriteNumber: 2 - } -]; - -class CustomFilterComponentGrid extends React.Component { - render() { - type TypedGriddle = new () => Griddle; - const TypedGriddle = Griddle as TypedGriddle; - - return ( - - ); - } -} - -export default CustomFilterComponentGrid; diff --git a/types/griddle-react/test/CustomHeaderComponent.tsx b/types/griddle-react/test/CustomHeaderComponent.tsx deleted file mode 100644 index c5256956fc..0000000000 --- a/types/griddle-react/test/CustomHeaderComponent.tsx +++ /dev/null @@ -1,94 +0,0 @@ -/* -Licensed under the MIT License (MIT) - -Copyright (c) 2016 David Hara -*/ - -import * as React from 'react'; -import Griddle, { ColumnMetaData, CustomHeaderComponentProps } from 'griddle-react'; - -interface MoreCustomHeaderComponentProps extends CustomHeaderComponentProps { - color: string; -} - -class HeaderComponent extends React.Component { - textOnClick(e: React.FormEvent) { - e.stopPropagation(); - } - - filterText(e: React.FormEvent) { - this.props.filterByColumn(e.currentTarget.value, this.props.columnName); - } - - render() { - return ( - -
{this.props.displayName}
- -
- ); - } -} - -interface ResultType { - id: number; - name: string; - city: string; - state: string; - country: string; - company: string; - favoriteNumber: number; -} - -const someData: ResultType[] = [ - { - id: 0, - name: "Mayer Leonard", - city: "Kapowsin", - state: "Hawaii", - country: "United Kingdom", - company: "Ovolo", - favoriteNumber: 7 - }, - { - id: 1, - name: "Koch Becker", - city: "Johnsonburg", - state: "New Jersey", - country: "Madagascar", - company: "Eventage", - favoriteNumber: 2 - } -]; - -const columnMeta: Array> = [ - { - columnName: 'name', - order: 1, - sortable: false, - visible: true, - }, - { - columnName: 'city', - customHeaderComponent: HeaderComponent, - customHeaderComponentProps: {color: 'red'} - }, - { - columnName: 'state', - customHeaderComponent: HeaderComponent, - customHeaderComponentProps: {color: 'blue'} - } -]; - -class CustomHeaderComponentGrid extends React.Component { - render() { - type TypedGriddle = new () => Griddle; - const TypedGriddle = Griddle as TypedGriddle; - - return ( - - ); - } -} - -export default CustomHeaderComponentGrid; diff --git a/types/griddle-react/test/index.tsx b/types/griddle-react/test/index.tsx deleted file mode 100644 index b42513a34d..0000000000 --- a/types/griddle-react/test/index.tsx +++ /dev/null @@ -1,78 +0,0 @@ -/* -Licensed under the MIT License (MIT) - -Copyright (c) 2016 David Hara -*/ - -import * as React from 'react'; -import { render } from 'react-dom'; -import Griddle, { CustomColumnComponentProps } from 'griddle-react'; -import CustomColumnComponentGrid from './CustomColumnComponent'; -import CustomHeaderComponentGrid from './CustomHeaderComponent'; -import CustomFilterComponentGrid from './CustomFilterComponent'; - -interface MyCustomResult { - name: string; - test: string; -} - -class LinkComponent extends React.Component> { - render() { - const url = `speakers/${this.props.rowData.test}/${this.props.data}`; - return {this.props.data}; - } -} - -const StatelessFunctionComponent = (props: CustomColumnComponentProps) => { - const url = `speakers/${props.rowData.test}/${props.data}`; - return {props.data}; -}; - -const columnMeta = [ - { - columnName: "name", - order: 1, - locked: false, - visible: true, - customComponent: StatelessFunctionComponent - }]; - -const results: MyCustomResult[] = [ - { - name: 'David Hara', - test: 'blah' - }, - { - name: 'Hara, David', - test: 'blah2' - } -]; - -const rowMetaData = { - bodyCssClassName: (rowData: MyCustomResult) => { - return rowData.test; - } -}; - -type TypedGriddle = new () => Griddle; -const TypedGriddle = Griddle as TypedGriddle; - -render( -
-

Custom Column Component Grid

- -

Custom Header Component Grid

- -

Custom Filter Component Grid

- - } - sortDescendingComponent={} - customRowComponent={LinkComponent} - /> -
, - document.getElementById('root') -); diff --git a/types/griddle-react/tsconfig.json b/types/griddle-react/tsconfig.json deleted file mode 100644 index 8f233e8e23..0000000000 --- a/types/griddle-react/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "jsx": "preserve", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "test/index.tsx", - "test/CustomColumnComponent.tsx", - "test/CustomFilterComponent.tsx", - "test/CustomHeaderComponent.tsx" - ] -} \ No newline at end of file diff --git a/types/griddle-react/tslint.json b/types/griddle-react/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/griddle-react/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -}