diff --git a/SEBrowser/SEBrowser.csproj b/SEBrowser/SEBrowser.csproj index 5a5a159a..5b1b3b3b 100644 --- a/SEBrowser/SEBrowser.csproj +++ b/SEBrowser/SEBrowser.csproj @@ -487,7 +487,6 @@ - @@ -516,7 +515,6 @@ - @@ -542,6 +540,7 @@ + @@ -552,6 +551,7 @@ + diff --git a/SEBrowser/Scripts/TSX/Components/Table.tsx b/SEBrowser/Scripts/TSX/Components/Table.tsx deleted file mode 100644 index 244805b8..00000000 --- a/SEBrowser/Scripts/TSX/Components/Table.tsx +++ /dev/null @@ -1,123 +0,0 @@ -//****************************************************************************************************** -// Table.tsx - Gbtc -// -// Copyright © 2018, Grid Protection Alliance. All Rights Reserved. -// -// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See -// the NOTICE file distributed with this work for additional information regarding copyright ownership. -// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this -// file except in compliance with the License. You may obtain a copy of the License at: -// -// http://opensource.org/licenses/MIT -// -// Unless agreed to in writing, the subject software distributed under the License is distributed on an -// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the -// License for the specific language governing permissions and limitations. -// -// Code Modification History: -// ---------------------------------------------------------------------------------------------------- -// 08/02/2018 - Billy Ernest -// Generated original version of source code. -// -//****************************************************************************************************** - -import React from 'react'; -import _ from 'lodash'; - -const AngleIcon: React.FunctionComponent<{ ascending: boolean }> = (props) => - -export interface TableProps { - cols: Array<{ key: keyof (T) | null, label: string, headerStyle?: React.CSSProperties, rowStyle?: React.CSSProperties, content?(item: T, key: keyof (T), style: React.CSSProperties): React.ReactNode }>, - data: Array, - onClick: (data: { col: keyof (T), row: T, data: T[keyof (T)] }, event: React.MouseEvent) => void, - sortField: string, - ascending: boolean, - onSort(data: { col: keyof (T), asending: boolean }): void, - tableClass?: string, - tableStyle?: React.CSSProperties, - theadStyle?: React.CSSProperties, - theadClass?: string, - tbodyStyle?: React.CSSProperties, - tbodyClass?: string, - selected?(data: T): boolean, - rowStyle?: React.CSSProperties, -} - -export default class Table extends React.Component> { - constructor(props) { - super(props); - } - - - render() { - const rowComponents = this.generateRows(); - const headerComponents = this.generateHeaders(); - return ( - - {headerComponents} - {rowComponents} -
- ); - } - - generateHeaders() { - if (this.props.cols.length == 0) return null; - - const cells = this.props.cols.map((colData, index) => { - let style; - if (colData.headerStyle != undefined) { - style = colData.headerStyle; - } - else - style = {}; - - if (style.cursor == undefined) - style.cursor = 'pointer'; - - return this.handleSort({ col: colData.key, ascending: this.props.ascending })}>{colData.label}{(this.props.sortField == colData.key ? : null)} - }); - - return {cells}; - } - - generateRows() { - if (this.props.data.length == 0) return null; - - return this.props.data.map((item, index) => { - const cells = this.props.cols.map(colData => { - const style = _.clone(colData.rowStyle); - return - {colData.content != undefined ? colData.content(item, colData.key, style) : item[colData.key]} - - }); - - let style; - - if (this.props.rowStyle != undefined) { - style = _.clone(this.props.rowStyle); - } - else - style = {}; - - if (style.cursor == undefined) - style.cursor = 'pointer'; - - if (this.props.selected(item)) - style.backgroundColor = 'yellow'; - - return {cells}; - }); - } - - handleClick(data: { col: keyof (T), row: T, data: T[keyof T] }, event) { - this.props.onClick(data, event); - } - - handleSort(data) { - this.props.onSort(data); - } -}