@@ -22,7 +22,7 @@ import TabStyles from '@/styles/tab-styles';
22
22
import NavStyles from '@/styles/nav-styles' ;
23
23
24
24
import {
25
- pathIsInSearch , invalidCharsRegEx , sleep , rapidocApiKey ,
25
+ pathIsInSearch , findProperties , invalidCharsRegEx , sleep , rapidocApiKey ,
26
26
} from '@/utils/common-utils' ;
27
27
import ProcessSpec from '@/utils/spec-parser' ;
28
28
import mainBodyTemplate from '@/templates/main-body-template' ;
@@ -76,6 +76,7 @@ export default class RapiDoc extends LitElement {
76
76
allowSpecUrlLoad : { type : String , attribute : 'allow-spec-url-load' } ,
77
77
allowSpecFileLoad : { type : String , attribute : 'allow-spec-file-load' } ,
78
78
allowSearch : { type : String , attribute : 'allow-search' } ,
79
+ allowSearchByParams : { type : String , attribute : 'allow-search-by-params' } ,
79
80
allowServerSelection : { type : String , attribute : 'allow-server-selection' } ,
80
81
showComponents : { type : String , attribute : 'show-components' } ,
81
82
@@ -108,6 +109,7 @@ export default class RapiDoc extends LitElement {
108
109
// Internal Attributes
109
110
selectedContentId : { type : String } ,
110
111
112
+ isSearchByPropertiesModalShow : { type : Boolean } ,
111
113
} ;
112
114
}
113
115
@@ -349,6 +351,7 @@ export default class RapiDoc extends LitElement {
349
351
this . responseAreaHeight = '300px' ;
350
352
}
351
353
if ( ! this . allowTry || ! 'true, false,' . includes ( `${ this . allowTry } ,` ) ) { this . allowTry = 'true' ; }
354
+ if ( ! this . allowSearchByParams || ! 'true, false,' . includes ( `${ this . allowSearchByParams } ,` ) ) { this . allowSearchByParams = 'false' ; }
352
355
if ( ! this . apiKeyValue ) { this . apiKeyValue = '-' ; }
353
356
if ( ! this . apiKeyLocation ) { this . apiKeyLocation = 'header' ; }
354
357
if ( ! this . apiKeyName ) { this . apiKeyName = '' ; }
@@ -363,6 +366,7 @@ export default class RapiDoc extends LitElement {
363
366
if ( ! this . showInfo || ! 'true, false,' . includes ( `${ this . showInfo } ,` ) ) { this . showInfo = 'true' ; }
364
367
if ( ! this . showComponents || ! 'true false' . includes ( this . showComponents ) ) { this . showComponents = 'false' ; }
365
368
if ( ! this . infoDescriptionHeadingsInNavBar || ! 'true, false,' . includes ( `${ this . infoDescriptionHeadingsInNavBar } ,` ) ) { this . infoDescriptionHeadingsInNavBar = 'false' ; }
369
+ if ( ! this . isSearchByPropertiesModalShow ) { this . isSearchByPropertiesModalShow = false ; }
366
370
367
371
marked . setOptions ( {
368
372
highlight : ( code , lang ) => {
@@ -538,6 +542,23 @@ export default class RapiDoc extends LitElement {
538
542
this . matchPaths = '' ;
539
543
}
540
544
545
+ onSearchByPropertiesChange ( e ) {
546
+ this . matchProperties = findProperties ( e . target . value . toLowerCase ( ) , this . resolvedSpec . tags ) ;
547
+ if ( this . matchProperties ) {
548
+ this . requestUpdate ( ) ;
549
+ }
550
+ }
551
+
552
+ showSearchModal ( ) {
553
+ this . isSearchByPropertiesModalShow = true ;
554
+ this . requestUpdate ( ) ;
555
+ }
556
+
557
+ hideSearchModal ( ) {
558
+ this . isSearchByPropertiesModalShow = false ;
559
+ this . requestUpdate ( ) ;
560
+ }
561
+
541
562
// Public Method
542
563
async loadSpec ( specUrl ) {
543
564
if ( ! specUrl ) {
@@ -691,6 +712,7 @@ export default class RapiDoc extends LitElement {
691
712
}
692
713
navEl . classList . add ( 'active' ) ;
693
714
window . history . replaceState ( null , null , `${ window . location . href . split ( '#' ) [ 0 ] } #${ targetElId } ` ) ;
715
+ this . hideSearchModal ( ) ;
694
716
setTimeout ( ( ) => {
695
717
this . isIntersectionObserverActive = true ;
696
718
} , 300 ) ;
0 commit comments