@@ -3,20 +3,18 @@ import * as FilePondLib from "filepond";
3
3
import { FilePond , FilePondOptions } from "filepond" ;
4
4
import filepondCSS from "filepond/dist/filepond.min.css?inline" ;
5
5
import typeahead from "typeahead-standalone" ;
6
- import { Dictionary , typeaheadResult } from "typeahead-standalone/dist/types" ;
7
6
import typeaheadCSS from "typeahead-standalone/dist/basic.css?inline" ;
7
+ import customCSS from './style.css?inline' ;
8
8
9
- const ATTRIBUTES : string [ ] = [ "base-url"
10
- ] ;
11
- export class MappingInputProvider extends HTMLElement {
9
+ const ATTRIBUTES : string [ ] = [ "base-url" ] ;
10
+ class MappingInputProvider extends HTMLElement {
12
11
shadowRoot : ShadowRoot ;
13
12
private testingFileChooser : FilePond | null = null ;
14
- private mappingchooser : typeaheadResult < Dictionary > | null = null ;
15
13
// --- Attribute accessible from the HTML tag:
16
14
baseUrl : URL = new URL ( "http://localhost:8090/" ) ;
17
-
18
15
// ---
19
16
17
+
20
18
// --- Helper methods
21
19
addCssContent ( css : string ) : void {
22
20
let styleElem : HTMLStyleElement = document . createElement ( "style" ) ;
@@ -41,13 +39,12 @@ export class MappingInputProvider extends HTMLElement {
41
39
this . shadowRoot = this . attachShadow ( { mode : "open" } ) ;
42
40
this . addCssContent ( filepondCSS ) ;
43
41
this . addCssContent ( typeaheadCSS ) ;
42
+ this . addCssContent ( customCSS ) ;
44
43
45
- {
46
- // Apply HTML Template to shadow DOM
47
- const template = document . createElement ( "template" ) ;
48
- template . innerHTML = templateContent ;
49
- this . shadowRoot . append ( template . content . cloneNode ( true ) ) ;
50
- }
44
+ // Apply HTML Template to shadow DOM
45
+ const template = document . createElement ( "template" ) ;
46
+ template . innerHTML = templateContent ;
47
+ this . shadowRoot . append ( template . content . cloneNode ( true ) ) ;
51
48
}
52
49
53
50
/**
@@ -93,7 +90,7 @@ export class MappingInputProvider extends HTMLElement {
93
90
this . shadowRoot . getElementById ( "mappingchooser" )
94
91
) ;
95
92
if ( inputElement != null ) {
96
- this . mappingchooser = typeahead ( {
93
+ typeahead ( {
97
94
input : inputElement ,
98
95
minLength : - 1 ,
99
96
highlight : true ,
@@ -148,9 +145,8 @@ export class MappingInputProvider extends HTMLElement {
148
145
this . baseUrl = newValue ;
149
146
this . connectedCallback ( ) ;
150
147
}
151
- this . testingFileChooser ;
152
- this . mappingchooser ;
153
148
}
149
+
154
150
/**
155
151
* Optional boolean parameter download used in executeMapping method, user can choose to download the result.
156
152
* It will help user chose between true, false or no parameter
@@ -186,6 +182,7 @@ export class MappingInputProvider extends HTMLElement {
186
182
}
187
183
}
188
184
}
185
+
189
186
/**
190
187
* In case if download is required triggerDownload can be used
191
188
*/
@@ -194,9 +191,9 @@ export class MappingInputProvider extends HTMLElement {
194
191
element . setAttribute ( 'href' , 'data:text/plain;charset=utf-8,' + encodeURIComponent ( JSON . stringify ( response ) ) ) ;
195
192
element . setAttribute ( 'download' , "result.json" ) ;
196
193
element . style . display = 'none' ;
197
- this . shadowRoot . appendChild ;
194
+ this . shadowRoot . appendChild ( element ) ;
198
195
element . click ( ) ;
199
- this . shadowRoot . removeChild ;
196
+ this . shadowRoot . removeChild ( element ) ;
200
197
}
201
198
}
202
199
0 commit comments