From c6f98d59285656f179eea80662e86f7cf5329e59 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Mon, 30 Nov 2020 18:51:52 +0100 Subject: Add aria-labels Add aria-labels to odlux framework and apps Issue-ID: CCSDK-2886 Signed-off-by: Aijana Schumann Change-Id: If1fdf9f8a805b567dd65bcf2cfb029b71f9235b7 --- sdnr/wt/odlux/framework/src/app.tsx | 15 ------ .../src/components/material-table/index.tsx | 9 ++-- .../src/components/material-table/tableFilter.tsx | 4 +- .../src/components/material-table/tableToolbar.tsx | 3 +- .../src/components/material-ui/treeView.tsx | 9 ++-- .../framework/src/components/objectDump/index.tsx | 56 +++++++++++++++++----- 6 files changed, 58 insertions(+), 38 deletions(-) (limited to 'sdnr/wt/odlux/framework') diff --git a/sdnr/wt/odlux/framework/src/app.tsx b/sdnr/wt/odlux/framework/src/app.tsx index 85b0dfb34..791f46d0a 100644 --- a/sdnr/wt/odlux/framework/src/app.tsx +++ b/sdnr/wt/odlux/framework/src/app.tsx @@ -15,21 +15,6 @@ * the License. * ============LICENSE_END========================================================================== */ -/****************************************************************************** - * Copyright 2018 highstreet technologies GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *****************************************************************************/ import * as React from 'react'; import * as ReactDOM from 'react-dom'; diff --git a/sdnr/wt/odlux/framework/src/components/material-table/index.tsx b/sdnr/wt/odlux/framework/src/components/material-table/index.tsx index c5be81914..f6d0b0d47 100644 --- a/sdnr/wt/odlux/framework/src/components/material-table/index.tsx +++ b/sdnr/wt/odlux/framework/src/components/material-table/index.tsx @@ -118,7 +118,7 @@ type MaterialTableComponentBaseProps = WithStyles & { disableFilter?: boolean; customActionButtons?: { icon: React.ComponentType, tooltip?: string, onClick: () => void }[]; onHandleClick?(event: React.MouseEvent, rowData: TData): void; - createContextMenu?: (row: TData) => React.ReactElement, React.ComponentType>>[]; + createContextMenu?: (row: TData) => React.ReactElement, React.ComponentType>>[]; }; type MaterialTableComponentPropsWithRows = MaterialTableComponentBaseProps & { rows: TData[]; asynchronus?: boolean; }; @@ -162,7 +162,7 @@ class MaterialTableComponent extends React.Component extends React.Component extends React.Component { const style = col.width ? { width: col.width } : {}; return ( - + {col.type === ColumnType.custom && col.customControl ? : col.type === ColumnType.boolean @@ -283,6 +283,7 @@ class MaterialTableComponent extends React.Component + ? - : } + : } ); }, this)} diff --git a/sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx b/sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx index 59dc49c50..96bcbf375 100644 --- a/sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx +++ b/sdnr/wt/odlux/framework/src/components/material-table/tableToolbar.tsx @@ -130,6 +130,7 @@ class TableToolbarComponent extends React.Component @@ -138,7 +139,7 @@ class TableToolbarComponent extends React.Component - Export as CSV + { this.props.onExportToCsv(); this.handleClose()}}>Export as CSV diff --git a/sdnr/wt/odlux/framework/src/components/material-ui/treeView.tsx b/sdnr/wt/odlux/framework/src/components/material-ui/treeView.tsx index adf0b8e5a..e62b42472 100644 --- a/sdnr/wt/odlux/framework/src/components/material-ui/treeView.tsx +++ b/sdnr/wt/odlux/framework/src/components/material-ui/treeView.tsx @@ -18,7 +18,7 @@ import * as React from 'react'; import { withStyles, WithStyles, createStyles, Theme } from '@material-ui/core/styles'; -import { List, ListItem, TextField, ListItemText, ListItemIcon, WithTheme, withTheme, Omit } from '@material-ui/core'; +import { List, ListItem, TextField, ListItemText, ListItemIcon, WithTheme, withTheme, Omit, Typography } from '@material-ui/core'; import { SvgIconProps } from '@material-ui/core/SvgIcon'; import FileIcon from '@material-ui/icons/InsertDriveFile'; @@ -62,7 +62,7 @@ type TreeViewComponentState = { expandedItems: ExternalTreeItem[]; /** The index of the active iten or undefined if no item is active. */ activeItem?: ExternalTreeItem; - /** The search term or undefined if search is corrently not active. */ + /** The search term or undefined if search is currently not active. */ searchTerm?: string; searchTermValue?: string; } @@ -153,7 +153,8 @@ class TreeViewComponent extends React.Component {children} - {enableSearchBar && || null} + {enableSearchBar && || null} + {enableSearchBar && (searchTerm === undefined || searchTerm.length===0 )&& Please search for an inventory identifier or use *.} {this.renderItems(items, searchTerm && searchTerm.toLowerCase())} @@ -216,7 +217,7 @@ class TreeViewComponent extends React.Component -1 || expanded || (!isTreeViewComponentWithExternalStateProps(this.props) && item.isMatch || depth === 1)) || !searchTerm || forceRender) ? ( - + { // display the left icon (this.props.useFolderIcons && {isFolder ? : }) || diff --git a/sdnr/wt/odlux/framework/src/components/objectDump/index.tsx b/sdnr/wt/odlux/framework/src/components/objectDump/index.tsx index d449f5cd3..d2de7cc02 100644 --- a/sdnr/wt/odlux/framework/src/components/objectDump/index.tsx +++ b/sdnr/wt/odlux/framework/src/components/objectDump/index.tsx @@ -70,20 +70,50 @@ const useSimpleTableStyles = makeStyles({ color: "white", padding: "5px", backgroundColor: "#cccccc", + }, td: { verticalAlign: "top", padding: "0.5rem 1rem", - borderBottom: "2px solid #DDD" + border: "2px solid #DDD" }, object: { }, objectTh: { - backgroundColor: "#4444cc", + backgroundColor: "#cccccc", }, objectTd: { padding: "0.5rem 1rem", - borderBottom: "2px solid #DDD" + border: "2px solid #DDD" + }, + chevron: { + '&:before': { + borderStyle: 'solid', + borderWidth: '0.25em 0.25em 0 0', + content: '\'\'', + display: 'inline-block', + height: '0.45em', + left: '0.15em', + position: 'relative', + top: '0.15em', + transform: 'rotate(-45deg)', + transition: 'all 0.3s', + verticalAlign: 'top', + width: '0.45em', + } + + }, + right: { + '&:before': { + left: '0', + transform: 'rotate(45deg)', + } + }, + bottom: { + '&:before': { + left: '0', + transform: 'rotate(135deg)', + } }, }); @@ -93,6 +123,7 @@ type SimpleTableProps = { label?: JSX.Element | string | null; cols?: number; expand?: boolean; + ariaLabel?: string; } const SimpleTable: React.FC = (props) => { @@ -110,11 +141,11 @@ const SimpleTable: React.FC = (props) => { }; return ( - +
{label && ( - + ) || null @@ -130,6 +161,7 @@ type ObjectRendererProps = { label?: JSX.Element | string | null; expand?: boolean; object: { [key: string]: any }; + ariaLabel?: string; }; const ObjectRenderer: React.FC = (props) => { @@ -137,13 +169,13 @@ const ObjectRenderer: React.FC = (props) => { const classes = useSimpleTableStyles(); return ( - + { Object.keys(object).map(key => { return ( - - - + + + ); }) @@ -165,9 +197,9 @@ const ArrayRenderer: React.FC = (props) => { return null; }; -export const renderObject = (object: any): JSX.Element | string => { +export const renderObject = (object: any, ariaLabel?: string): JSX.Element | string => { if (isString(object) || isNumber(object) || isBoolean(object)) { return String(object); } - return ; + return ; }; -- cgit 1.2.3-korg
- {label} + { label }
{String(key)} {renderObject(object[key])}
{String(key)} {renderObject(object[key], "sub-element")}