From d0e2954956dc8865dc3fc76447a237627c8127b8 Mon Sep 17 00:00:00 2001 From: unknown <n.santhanam@redkarma.eu> Date: Wed, 3 Mar 2021 14:57:41 +0530 Subject: [PATCH] TMSS-624 Changes updated based on review comments --- SAS/TMSS/frontend/tmss_webapp/src/App.css | 4 ++++ .../src/components/Spreadsheet/CustomDateComp.js | 12 ++++++------ .../src/components/Spreadsheet/numericEditor.js | 7 ++++--- .../src/routes/Scheduling/excelview.schedulingset.js | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/SAS/TMSS/frontend/tmss_webapp/src/App.css b/SAS/TMSS/frontend/tmss_webapp/src/App.css index 10770087e40..00313600a1d 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/App.css +++ b/SAS/TMSS/frontend/tmss_webapp/src/App.css @@ -236,4 +236,8 @@ div[data-schemapath='root.$schema'] { .numericAgGridField { outline: none !important; border: none !important; +} + +.today-calendar-btn { + display: none; } \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComp.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComp.js index 2622ec5b11c..5eeb13d88c5 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComp.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComp.js @@ -37,8 +37,10 @@ export default class CustomDateComp extends Component { d dateFormat="dd-M-yy" value= {this.state.date} onChange= {e => {this.updateDateChanges(e)}} - onBlur= {e => {this.updateDateChanges(e)}} - //data-testid="start" + // onBlur= {e => {this.updateDateChanges(e)}} + //data-testid="start" + todayButtonClassName="today-calendar-btn" + showButtonBar showTime= {true} showSeconds= {true} hourFormat= "24" @@ -48,10 +50,8 @@ export default class CustomDateComp extends Component { } - updateDateChanges(e){ - if(e.value){ - this.setState({date : e.value}); - } + updateDateChanges(e){ + this.setState({date : e.value || ''}); } ondatechange(e){ diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/numericEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/numericEditor.js index f468acd222a..f5f88721c73 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/numericEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/numericEditor.js @@ -112,17 +112,18 @@ export default class NumericEditor extends Component { event = event || window.event; return typeof event.which === 'undefined' ? event.keyCode : event.which; } - + isCharNumeric(charStr) { - return !!/\d/.test(charStr); + return !!/^\d*\.?\d*$/.test(charStr); } isKeyPressedNumeric(event) { const charCode = this.getCharCodeFromEvent(event); const charStr = event.key ? event.key : String.fromCharCode(charCode); - return this.isCharNumeric(charStr); + return `${event.target.value + charStr}`.split('.').length <= 2 && this.isCharNumeric(charStr); } + render() { return ( <input diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js index 32719968723..e521c1316af 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js @@ -455,7 +455,7 @@ export class SchedulingSetCreate extends Component { return { backgroundColor: ''}; } }, }; - cellProps['angle3'] = {isgroup: true, cellStyle: function(params) { if (params.value){ + cellProps['angle3'] = {isgroup: true, cellEditor: 'numericEditor',cellStyle: function(params) { if (params.value){ if (!params.colDef.field.startsWith('gdef') && !Number(params.value)) { return { backgroundColor: BG_COLOR}; } @@ -586,7 +586,7 @@ export class SchedulingSetCreate extends Component { } } }, }, - {headerName: 'Offset Window From',field: 'offset_from', cellStyle: function(params) { + {headerName: 'Offset Window From',field: 'offset_from', cellEditor: 'numericEditor',cellStyle: function(params) { if (params.value){ if (params.value === 'undefined' || params.value === ''){ -- GitLab