@startinblox/core 0.17.24 → 0.17.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,7 +8,7 @@ const FormFileMixin = {
|
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
initialState: {
|
|
11
|
-
initialValue:
|
|
11
|
+
initialValue: ''
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
created() {
|
|
@@ -31,7 +31,7 @@ const FormFileMixin = {
|
|
|
31
31
|
selectFile() {
|
|
32
32
|
if (this.uploadUrl === null) return;
|
|
33
33
|
|
|
34
|
-
if (this.initialValue ===
|
|
34
|
+
if (this.initialValue === '') {
|
|
35
35
|
this.initialValue = this.value;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["formFileMixin.ts"],"names":["store","FormFileMixin","name","attributes","uploadUrl","type","String","default","initialState","initialValue","created","listAttributes","selectFile","bind","resetFile","attached","document","addEventListener","e","target","contains","element","value","planRender","filePicker","querySelector","files","length","file","formData","FormData","append","fetchAuthn","method","body","then","response","location","headers","get","catch","error","console","event","preventDefault"],"mappings":"AAAA,SAASA,KAAT,QAAsB,wBAAtB;AAEA,MAAMC,aAAa,GAAG;AACpBC,EAAAA,IAAI,EAAE,iBADc;AAEpBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,SAAS,EAAE;AACTC,MAAAA,IAAI,EAAEC,MADG;AAETC,MAAAA,OAAO,EAAE;AAFA;AADD,GAFQ;AAQpBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,YAAY,EAAE;AADF,GARM;;AAWpBC,EAAAA,OAAO,GAAG;AACR,SAAKC,cAAL,CAAoB,QAApB,IAAgC,EAAhC;AACA,SAAKA,cAAL,CAAoB,mBAApB,IAA2C,IAA3C;AACA,SAAKA,cAAL,CAAoB,YAApB,IAAoC,KAAKC,UAAL,CAAgBC,IAAhB,CAAqB,IAArB,CAApC;AACA,SAAKF,cAAL,CAAoB,WAApB,IAAmC,KAAKG,SAAL,CAAeD,IAAf,CAAoB,IAApB,CAAnC;AACD,GAhBmB;;AAiBpBE,EAAAA,QAAQ,GAAG;AACTC,IAAAA,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,EAAoCC,CAAD,IAAO;AACxC,UAAIA,CAAC,CAACC,MAAF,IAAaD,CAAC,CAACC,MAAH,CAA0BC,QAA1B,CAAmC,KAAKC,OAAxC,CAAhB,EAAkE;AAChE,aAAKC,KAAL,GAAa,KAAKb,YAAlB;AACA,aAAKE,cAAL,CAAoB,mBAApB,IAA2C,IAA3C;AACA,aAAKY,UAAL;AACD;AACF,KAND;AAOD,GAzBmB;;AA0BpBX,EAAAA,UAAU,GAAG;AACX,QAAI,KAAKR,SAAL,KAAmB,IAAvB,EAA6B;;AAE7B,QAAI,KAAKK,YAAL,KAAsB,
|
|
1
|
+
{"version":3,"sources":["formFileMixin.ts"],"names":["store","FormFileMixin","name","attributes","uploadUrl","type","String","default","initialState","initialValue","created","listAttributes","selectFile","bind","resetFile","attached","document","addEventListener","e","target","contains","element","value","planRender","filePicker","querySelector","files","length","file","formData","FormData","append","fetchAuthn","method","body","then","response","location","headers","get","catch","error","console","event","preventDefault"],"mappings":"AAAA,SAASA,KAAT,QAAsB,wBAAtB;AAEA,MAAMC,aAAa,GAAG;AACpBC,EAAAA,IAAI,EAAE,iBADc;AAEpBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,SAAS,EAAE;AACTC,MAAAA,IAAI,EAAEC,MADG;AAETC,MAAAA,OAAO,EAAE;AAFA;AADD,GAFQ;AAQpBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,YAAY,EAAE;AADF,GARM;;AAWpBC,EAAAA,OAAO,GAAG;AACR,SAAKC,cAAL,CAAoB,QAApB,IAAgC,EAAhC;AACA,SAAKA,cAAL,CAAoB,mBAApB,IAA2C,IAA3C;AACA,SAAKA,cAAL,CAAoB,YAApB,IAAoC,KAAKC,UAA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D,QAAQ,CAACE,OAAT,CAAiBC,GAAjB,CAAqB,UAArB,CAAjB;;AACA,UAAIF,QAAQ,IAAI,IAAhB,EAAsB;AACpB,aAAK1B,cAAL,CAAoB,QAApB,IAAgC,4BAAhC;AACD,OAFD,MAEO;AACL,aAAKW,KAAL,GAAae,QAAb;AACA,aAAK1B,cAAL,CAAoB,QAApB,IAAgC,EAAhC;AACA,aAAKA,cAAL,CAAoB,mBAApB,IAA2C,KAA3C;AACA,aAAKY,UAAL;AACD;AACF,KAdH,EAeGiB,KAfH,CAeSC,KAAK,IAAI;AACd,WAAK9B,cAAL,CAAoB,WAApB,IAAmC,EAAnC;AACA,WAAKA,cAAL,CAAoB,QAApB,IAAgC,cAAhC;AACA,WAAKY,UAAL;AACAmB,MAAAA,OAAO,CAACD,KAAR,CAAcA,KAAd;AACD,KApBH;AAqBD,GA/DmB;;AAgEpB3B,EAAAA,SAAS,CAAC6B,KAAD,EAAQ;AACfA,IAAAA,KAAK,CAACC,cAAN;AACA,SAAKtB,KAAL,GAAa,EAAb;AACA,UAAME,UAAU,GAAG,KAAKH,OAAL,CAAaI,aAAb,CAA2B,oBAA3B,CAAnB;AACA,QAAID,UAAJ,EAAgBA,UAAU,CAACF,KAAX,GAAmB,EAAnB;AAChB,SAAKX,cAAL,CAAoB,WAApB,IAAmC,EAAnC;AACA,SAAKA,cAAL,CAAoB,QAApB,IAAgC,EAAhC;AACA,SAAKA,cAAL,CAAoB,mBAApB,IAA2C,IAA3C,CAPe,CAQf;;AACA,SAAKY,UAAL;AACD;;AA1EmB,CAAtB;AA6EA,SACEtB,aADF","sourcesContent":["import { store } from \"../../libs/store/store\";\n\nconst FormFileMixin = {\n name: 'form-file-mixin',\n attributes: {\n uploadUrl: {\n type: String,\n default: ''\n },\n },\n initialState: {\n initialValue: ''\n },\n created() {\n this.listAttributes['output'] = '';\n this.listAttributes['resetButtonHidden'] = true;\n this.listAttributes['selectFile'] = this.selectFile.bind(this);\n this.listAttributes['resetFile'] = this.resetFile.bind(this);\n },\n attached() {\n document.addEventListener('reset', (e) => {\n if (e.target && (e.target as HTMLElement).contains(this.element)) {\n this.value = this.initialValue;\n this.listAttributes['resetButtonHidden'] = true;\n this.planRender();\n }\n })\n },\n selectFile() {\n if (this.uploadUrl === null) return;\n\n if (this.initialValue === '') {\n this.initialValue = this.value;\n }\n\n const filePicker = this.element.querySelector('input[type=\"file\"]');\n if (filePicker.files!.length < 1) return;\n\n this.listAttributes['output'] = '⏳';\n this.planRender();\n\n const file = filePicker.files![0];\n const formData = new FormData();\n formData.append('file', file);\n store.fetchAuthn(this.uploadUrl, {\n method: 'POST',\n body: formData,\n })\n .then(response => {\n const location = response.headers.get('location');\n if (location == null) {\n this.listAttributes['output'] = 'header location not found!';\n } else {\n this.value = location;\n this.listAttributes['output'] = '';\n this.listAttributes['resetButtonHidden'] = false;\n this.planRender();\n }\n })\n .catch(error => {\n this.listAttributes['fileValue'] = '';\n this.listAttributes['output'] = 'upload error';\n this.planRender();\n console.error(error);\n });\n },\n resetFile(event) {\n event.preventDefault();\n this.value = '';\n const filePicker = this.element.querySelector('input[type=\"file\"]');\n if (filePicker) filePicker.value = '';\n this.listAttributes['fileValue'] = '';\n this.listAttributes['output'] = '';\n this.listAttributes['resetButtonHidden'] = true;\n // this.input.dispatchEvent(new Event('change'));\n this.planRender();\n }\n}\n\nexport {\n FormFileMixin\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startinblox/core",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.25",
|
|
4
4
|
"description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|