@@ -33,7 +33,7 @@ const rule: FioriRuleDefinition = createFioriRule({
3333 continue ;
3434 }
3535 for ( const page of app . pages ) {
36- problems . push ( ...handleCopyInTable ( app . type , page , parsedApp ) ) ;
36+ problems . push ( ...handleCopyInTable ( page , parsedApp ) ) ;
3737 }
3838 }
3939 return problems ;
@@ -58,26 +58,21 @@ const rule: FioriRuleDefinition = createFioriRule({
5858
5959/**
6060 *
61- * @param appType
6261 * @param page
6362 * @param parsedApp
6463 * @returns
6564 */
66- function handleCopyInTable (
67- appType : 'fe-v4' | 'fe-v2' ,
68- page : FeV4PageType | FeV2PageType ,
69- parsedApp : ParsedApp
70- ) : CopyToClipboard [ ] {
65+ function handleCopyInTable ( page : FeV4PageType | FeV2PageType , parsedApp : ParsedApp ) : CopyToClipboard [ ] {
7166 const problems : CopyToClipboard [ ] = [ ] ;
7267 if ( page . type === 'list-report-page' ) {
7368 for ( const table of page . lookup [ 'table' ] ?? [ ] ) {
74- checkConfiguration ( appType , page , table , parsedApp , problems ) ;
69+ checkConfiguration ( page , table , parsedApp , problems ) ;
7570 }
7671 } else if ( page . type === 'object-page' ) {
7772 for ( const tableSection of page . sections . filter ( ( section ) => section . type === 'table-section' ) ) {
7873 const table = tableSection . children . find ( ( element ) => element . type === 'table' ) ;
7974 if ( table ) {
80- checkConfiguration ( appType , page , table , parsedApp , problems , tableSection . annotation ?. label ) ;
75+ checkConfiguration ( page , table , parsedApp , problems , tableSection . annotation ?. label ) ;
8176 }
8277 }
8378 }
@@ -86,15 +81,22 @@ function handleCopyInTable(
8681
8782/**
8883 *
89- * @param appType
84+ * @param table
85+ * @returns
86+ */
87+ function isV2Table ( table : TableV2 | TableV4 ) : table is TableV2 {
88+ return 'copy' in ( table as TableV2 ) . configuration ;
89+ }
90+
91+ /**
92+ *
9093 * @param page
9194 * @param table
9295 * @param parsedApp
9396 * @param problems
9497 * @param pageSectionName
9598 */
9699function checkConfiguration (
97- appType : 'fe-v4' | 'fe-v2' ,
98100 page : FeV4PageType | FeV2PageType ,
99101 table : TableV4 | TableV2 ,
100102 parsedApp : ParsedApp ,
@@ -103,10 +105,10 @@ function checkConfiguration(
103105) : void {
104106 let config ;
105107 let wrongValue = false ;
106- if ( appType === 'fe-v2' ) {
107- config = ( table as TableV2 ) . configuration . copy ;
108- } else if ( appType === 'fe-v4' ) {
109- config = ( table as TableV4 ) . configuration . disableCopyToClipboard ;
108+ if ( isV2Table ( table ) ) {
109+ config = table . configuration . copy ;
110+ } else {
111+ config = table . configuration . disableCopyToClipboard ;
110112 wrongValue = true ;
111113 }
112114 if ( config ?. valueInFile === wrongValue ) {
0 commit comments