@@ -23,6 +23,7 @@ type SearchEntry = {
2323 age : string ;
2424 block : string ;
2525 category : string ;
26+ tags ?: string [ ] ;
2627} ;
2728
2829type SearchData = {
@@ -151,6 +152,27 @@ function fmtExampleString(cell: CellComponent) {
151152 return String . fromCodePoint ( ...codepoints ) ;
152153}
153154
155+ function fmtTags ( cell : CellComponent ) {
156+ const tags = cell . getValue ( ) as string [ ] ;
157+ if ( ! tags || tags . length === 0 ) {
158+ return "" ;
159+ }
160+
161+ const container = document . createElement ( "div" ) ;
162+
163+ const keys = tags . sort ( ) ;
164+
165+ for ( const key of keys ) {
166+ var el = document . createElement ( "span" ) ;
167+ el . className =
168+ "badge border border-primary text-primary me-1 mb-1 text-decoration-none" ;
169+ el . textContent = key ;
170+ container . appendChild ( el ) ;
171+ }
172+
173+ return container ;
174+ }
175+
154176function imgTooltipFn ( imgType : string ) {
155177 return function ( e : MouseEvent , cell : CellComponent , onRendered : any ) {
156178 var value = cell . getValue ( ) ;
@@ -189,28 +211,6 @@ function showError(msg: string) {
189211 document . getElementById ( "errmsg" ) ! . innerHTML = msg ;
190212}
191213
192- function tagFormatter ( cell : CellComponent ) {
193- const tags = cell . getValue ( ) as Map < string , string > ;
194- if ( ! tags || tags . size === 0 ) {
195- return "" ;
196- }
197-
198- const container = document . createElement ( "div" ) ;
199-
200- const keys = Array . from ( tags . keys ( ) ) . sort ( ) ;
201-
202- for ( const key of keys ) {
203- const value = tags . get ( key ) || "" ;
204- var el = document . createElement ( "a" ) ;
205- el . href = value ;
206- el . className = "badge border border-primary text-primary me-1 mb-1 text-decoration-none" ;
207- el . target = "_blank" ;
208- el . textContent = key ;
209- container . appendChild ( el ) ;
210- }
211-
212- return container ;
213- }
214214
215215const tickElement = `<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve"><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34 c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351 l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07 l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"></path></svg>` ;
216216
@@ -380,15 +380,15 @@ async function main() {
380380 {
381381 title : "Tags" ,
382382 field : "tags" ,
383- formatter : tagFormatter ,
383+ formatter : fmtTags ,
384384 headerSort : false ,
385385 responsive : 0 ,
386386 width : 375 ,
387387 } ,
388388 ] ,
389389 height : "100%" ,
390- initialHeaderFilter : [ { field : "ar21" , type : "=" , value : true } ] ,
391- initialSort : [ { column : "sort " , dir : "asc" } ] ,
390+ // initialHeaderFilter: [{ field: "ar21", type: "=", value: true }],
391+ initialSort : [ { column : "code " , dir : "asc" } ] ,
392392 layout : "fitDataStretch" ,
393393 placeholder : "No matches" ,
394394 responsiveLayout : "hide" ,
0 commit comments