@@ -2,6 +2,7 @@ import { Component, Host, h, State, Prop } from '@stencil/core';
22
33@Component ( {
44 tag : 'table-search-modal' ,
5+ styleUrl : 'table-search-modal.css' ,
56 scoped : true ,
67} )
78export class TableSearchModal {
@@ -21,8 +22,8 @@ export class TableSearchModal {
2122 @State ( ) selectedSearchOption : string = '' ;
2223 @State ( ) selectedTextSearchOption : string = '' ;
2324 @State ( ) selectedNumberSearchOption : string = '' ;
24- @State ( ) colName : string = "" ;
25-
25+ @State ( ) colName : string = '' ;
26+ @ State ( )
2627 componentWillLoad ( ) {
2728 this . colName = this . alias ;
2829 if ( this . type !== null ) {
@@ -36,11 +37,11 @@ export class TableSearchModal {
3637 }
3738
3839 clearFields ( ) {
39- this . value = "" ;
40- this . colName = "" ;
41- this . selectedSearchOption = "" ;
42- this . selectedTextSearchOption = "" ;
43- this . selectedNumberSearchOption = "" ;
40+ this . value = '' ;
41+ this . colName = '' ;
42+ this . selectedSearchOption = '' ;
43+ this . selectedTextSearchOption = '' ;
44+ this . selectedNumberSearchOption = '' ;
4445 }
4546
4647 toggleModalState ( ) {
@@ -49,7 +50,7 @@ export class TableSearchModal {
4950
5051 submitHandler ( e ) {
5152 e . preventDefault ( ) ;
52- if ( this . selectedSearchOption !== "" ) {
53+ if ( this . selectedSearchOption !== '' ) {
5354 this . searchMethod ( this . value , this . alias , this . selectedSearchOption , this . selectedTextSearchOption , this . selectedNumberSearchOption ) ;
5455 this . toggleModalState ( ) ;
5556 this . clearFields ( ) ;
@@ -62,17 +63,14 @@ export class TableSearchModal {
6263
6364 radioSearchTypeHandler = event => {
6465 this . selectedSearchOption = event . target . value ;
65- console . log ( this . selectedSearchOption ) ;
6666 } ;
6767
6868 radioTextSearchOptionHandler = event => {
6969 this . selectedTextSearchOption = event . target . value ;
70- console . log ( this . selectedTextSearchOption ) ;
7170 } ;
7271
7372 radioNumberSearchOptionHandler = event => {
7473 this . selectedNumberSearchOption = event . target . value ;
75- console . log ( this . selectedNumberSearchOption ) ;
7674 } ;
7775
7876 render ( ) {
@@ -85,21 +83,21 @@ export class TableSearchModal {
8583
8684 { /* Main Modal */ }
8785 { this . isModalOpen && (
88- < form onSubmit = { e => this . submitHandler ( e ) } class = "pt-6 space-y-3" action = "/invite" >
89- < div class = "fixed z-12 inset-0 overflow-y-auto" aria-labelledby = "modal-title" role = "dialog" aria-modal = "true" >
86+ < form onSubmit = { e => this . submitHandler ( e ) } class = "pt-6 space-y-3" >
87+ < div class = "fixed z-12 inset-0 overflow-y-auto" >
9088 < div class = "flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" >
91- < div class = "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden = "true" > </ div >
89+ < div class = "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" > </ div >
9290
9391 { /* <!-- This element is to trick the browser into centering the modal contents. --> */ }
94- < span class = "hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden = "true" >
92+ < span class = "hidden sm:inline-block sm:align-middle sm:h-screen" >
9593 ​
9694 </ span >
9795
9896 < div class = "relative inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full" >
9997 < div class = "bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4" >
100- < div class = "sm:flex sm:items-start" >
101- < div class = "mt-3 text-center sm:mt-0 sm:ml-4 sm: text-left" >
102- < h3 class = "text-lg leading-6 font-medium text-gray-900 my-2" id = "modal-title" >
98+ < div >
99+ < div class = "mt-3 text-center sm:mt-0 sm:text-left" >
100+ < h3 class = "text-lg leading-6 font-semibold text-gray-600 my-2" id = "modal-title" >
103101 Search in { this . alias }
104102 </ h3 >
105103 < div class = "mt-2" >
@@ -108,22 +106,27 @@ export class TableSearchModal {
108106 clickHandler = { this . radioSearchTypeHandler }
109107 labels = { this . searchOptions }
110108 name = "SearchMethod"
109+ label = "Data Type"
111110 align = "horizontal"
112111 checked = { this . type }
113112 > </ radio-button-multiple >
114113 </ div >
115-
114+ { this . selectedSearchOption !== this . type ? (
115+ < p style = { { marginBottom : '10px' } } class = "px-3 py-2 bg-yellow-200 text-gray-800 border-l-4 w-full my-2" >
116+ You have overridden the auto-detected type, some functinalities may not work properly{ ' ' }
117+ </ p >
118+ ) : null }
116119 { this . selectedSearchOption === 'string' && (
117120 < div >
118- < label class = "block" htmlFor = "searchText" >
119- Enter text to be searched.
121+ < label class = "block pb-2 " htmlFor = "searchText" >
122+ Search Key
120123 </ label >
121124 < input
122- type = "name "
125+ type = "text "
123126 name = "searchText"
124127 required
125- placeholder = "india "
126- class = "border w-96 px-2 py-1 rounded-md text-sm"
128+ placeholder = "Type something to search "
129+ class = "mb-2 border px-2 p-2 rounded-md text-sm w-full "
127130 value = { this . value }
128131 onInput = { event => this . handleChange ( event ) }
129132 />
@@ -132,22 +135,23 @@ export class TableSearchModal {
132135 clickHandler = { this . radioTextSearchOptionHandler }
133136 labels = { this . textSearchOptions }
134137 name = "TextSearchOption"
138+ label = "Search Method"
135139 align = "horizontal"
136140 > </ radio-button-multiple >
137141 </ div >
138142 ) }
139143
140144 { this . selectedSearchOption === 'number' && (
141145 < div >
142- < label class = "block" htmlFor = "searchNumber" >
146+ < label class = "block py-2 " htmlFor = "searchNumber" >
143147 Enter number to be searched.
144148 </ label >
145149 < input
146150 type = "number"
147151 name = "searchNumber"
148152 required
149- placeholder = "123 "
150- class = "border w-96 px-2 py-1 rounded-md text-sm"
153+ placeholder = "Type a number to search "
154+ class = "border w-full px-2 py-1 rounded-md text-sm mb-2 "
151155 value = { this . value }
152156 onInput = { event => this . handleChange ( event ) }
153157 />
@@ -156,6 +160,7 @@ export class TableSearchModal {
156160 clickHandler = { this . radioNumberSearchOptionHandler }
157161 labels = { this . numberSearchOptions }
158162 name = "NumberSearchOption"
163+ label = "Search Method"
159164 align = "horizontal"
160165 > </ radio-button-multiple >
161166 </ div >
0 commit comments