@startinblox/core 0.17.28 → 0.17.30

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.
@@ -19,36 +19,15 @@ const FormFileMixin = {
19
19
  },
20
20
 
21
21
  attached() {
22
- document.addEventListener('click', async e => {
23
- const solidForm = this.element.parentNode.parentNode; //solid-form with solid-form-file/image
24
-
25
- const formValue = await solidForm.component.getFormValue(); //to get modificated values
26
- //if reset button clicked
27
-
28
- if (e.target.getAttribute('type') === 'reset' && solidForm.contains(e.target)) {
29
- //if edition form and value or if creation form
30
- if (!solidForm.component.isCreationForm(formValue) && this.initialValue !== '' || solidForm.component.isCreationForm(formValue)) this.value = this.initialValue; //if edition form and no value
31
- else if (!solidForm.component.isCreationForm(formValue) && this.initialValue === '') this.value = this.initialValue = '';
32
- this.listAttributes['resetButtonHidden'] = true;
33
- this.planRender();
34
- } // if submit button clicked
35
-
36
-
37
- if (e.target.getAttribute('type') === 'submit' && solidForm.contains(e.target)) {
38
- if (solidForm.getAttribute('next') || solidForm.component.isCreationForm(formValue)) {
39
- this.value = this.initialValue;
40
- this.initialValue = '';
41
- }
42
-
43
- if (!solidForm.component.isCreationForm(formValue)) {
44
- this.initialValue = this.value;
45
- }
46
-
22
+ document.addEventListener('reset', e => {
23
+ if (e.target && e.target.contains(this.element)) {
24
+ this.value = this.initialValue;
47
25
  this.listAttributes['resetButtonHidden'] = true;
48
26
  this.planRender();
27
+ const dataHolder = this.element.querySelector('input[data-holder]');
28
+ dataHolder.value = this.value;
29
+ dataHolder.dispatchEvent(new Event('change'));
49
30
  }
50
-
51
- ;
52
31
  });
53
32
  },
54
33
 
@@ -61,6 +40,7 @@ const FormFileMixin = {
61
40
 
62
41
  const filePicker = this.element.querySelector('input[type="file"]');
63
42
  if (filePicker.files.length < 1) return;
43
+ const dataHolder = this.element.querySelector('input[data-holder]');
64
44
  this.listAttributes['output'] = '⏳';
65
45
  this.planRender();
66
46
  const file = filePicker.files[0];
@@ -69,18 +49,7 @@ const FormFileMixin = {
69
49
  store.fetchAuthn(this.uploadUrl, {
70
50
  method: 'POST',
71
51
  body: formData
72
- }).then(response => {
73
- const location = response.headers.get('location');
74
-
75
- if (location == null) {
76
- this.listAttributes['output'] = 'header location not found!';
77
- } else {
78
- this.value = location;
79
- this.listAttributes['output'] = '';
80
- this.listAttributes['resetButtonHidden'] = false;
81
- this.planRender();
82
- }
83
- }).catch(error => {
52
+ }).then(response => this.updateFile(dataHolder, response)).catch(error => {
84
53
  this.listAttributes['fileValue'] = '';
85
54
  this.listAttributes['output'] = 'upload error';
86
55
  this.planRender();
@@ -88,15 +57,35 @@ const FormFileMixin = {
88
57
  });
89
58
  },
90
59
 
60
+ updateFile(dataHolder, response) {
61
+ const location = response.headers.get('location');
62
+
63
+ if (location == null) {
64
+ this.listAttributes['output'] = 'header location not found!';
65
+ } else {
66
+ this.value = location;
67
+ this.listAttributes['output'] = '';
68
+ this.listAttributes['resetButtonHidden'] = false;
69
+ dataHolder.value = location;
70
+ dataHolder.dispatchEvent(new Event('change'));
71
+ this.planRender();
72
+ }
73
+ },
74
+
91
75
  resetFile(event) {
92
76
  event.preventDefault();
93
77
  this.value = '';
94
78
  const filePicker = this.element.querySelector('input[type="file"]');
95
- if (filePicker) filePicker.value = '';
79
+ const dataHolder = this.element.querySelector('input[data-holder]');
80
+
81
+ if (filePicker && dataHolder) {
82
+ filePicker.value = dataHolder.value = '';
83
+ }
84
+
96
85
  this.listAttributes['fileValue'] = '';
97
86
  this.listAttributes['output'] = '';
98
- this.listAttributes['resetButtonHidden'] = true; // this.input.dispatchEvent(new Event('change'));
99
-
87
+ this.listAttributes['resetButtonHidden'] = true;
88
+ dataHolder.dispatchEvent(new Event('change'));
100
89
  this.planRender();
101
90
  }
102
91
 
@@ -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","solidForm","element","parentNode","formValue","component","getFormValue","target","getAttribute","contains","isCreationForm","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,EAAmC,MAAOC,CAAP,IAAa;AAC9C,YAAMC,SAAS,GAAG,KAAKC,OAAL,CAAaC,UAAb,CAAwBA,UAA1C,CAD8C,CACQ;;AACtD,YAAMC,SAAS,GAAG,MAAMH,SAAS,CAACI,SAAV,CAAoBC,YAApB,EAAxB,CAF8C,CAEc;AAE5D;;AACA,UAAKN,CAAC,CAACO,MAAH,CAA0BC,YAA1B,CAAuC,MAAvC,MAAmD,OAAnD,IAA8DP,SAAS,CAACQ,QAAV,CAAmBT,CAAC,CAACO,MAArB,CAAlE,EAAgG;AAC9F;AACA,YAAK,CAACN,SAAS,CAACI,SAAV,CAAoBK,cAApB,CAAmCN,SA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A3B,CAAnB;AACA,QAAID,UAAJ,EAAgBA,UAAU,CAACF,KAAX,GAAmB,EAAnB;AAChB,SAAKlB,cAAL,CAAoB,WAApB,IAAmC,EAAnC;AACA,SAAKA,cAAL,CAAoB,QAApB,IAAgC,EAAhC;AACA,SAAKA,cAAL,CAAoB,mBAApB,IAA2C,IAA3C,CAPe,CAQf;;AACA,SAAKmB,UAAL;AACD;;AA7FmB,CAAtB;AAgGA,SACE7B,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('click', async (e) => {\n const solidForm = this.element.parentNode.parentNode; //solid-form with solid-form-file/image\n const formValue = await solidForm.component.getFormValue(); //to get modificated values\n\n //if reset button clicked\n if ((e.target as HTMLElement).getAttribute('type') === 'reset' && solidForm.contains(e.target)) {\n //if edition form and value or if creation form\n if ((!solidForm.component.isCreationForm(formValue) && this.initialValue !== '') || solidForm.component.isCreationForm(formValue)) this.value = this.initialValue;\n //if edition form and no value\n else if (!solidForm.component.isCreationForm(formValue) && (this.initialValue === '')) this.value = this.initialValue = '';\n this.listAttributes['resetButtonHidden'] = true;\n this.planRender();\n }\n // if submit button clicked\n if ((e.target as HTMLElement).getAttribute('type') === 'submit' && solidForm.contains(e.target)) {\n if (solidForm.getAttribute('next') || solidForm.component.isCreationForm(formValue)) {\n this.value = this.initialValue;\n this.initialValue = '';\n }\n if (!solidForm.component.isCreationForm(formValue)) {\n this.initialValue = this.value;\n }\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}"]}
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","dataHolder","querySelector","dispatchEvent","Event","filePicker","files","length","file","formData","FormData","append","fetchAuthn","method","body","then","response","updateFile","catch","error","console","location","headers","get","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,CAAo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,CAACC,cAAN;AACA,SAAK1B,KAAL,GAAa,EAAb;AACA,UAAMM,UAAU,GAAG,KAAKP,OAAL,CAAaI,aAAb,CAA2B,oBAA3B,CAAnB;AACA,UAAMD,UAAU,GAAG,KAAKH,OAAL,CAAaI,aAAb,CAA2B,oBAA3B,CAAnB;;AAEA,QAAIG,UAAU,IAAIJ,UAAlB,EAA+B;AAC7BI,MAAAA,UAAU,CAACN,KAAX,GAAmBE,UAAU,CAACF,KAAX,GAAmB,EAAtC;AACD;;AAED,SAAKX,cAAL,CAAoB,WAApB,IAAmC,EAAnC;AACA,SAAKA,cAAL,CAAoB,QAApB,IAAgC,EAAhC;AACA,SAAKA,cAAL,CAAoB,mBAApB,IAA2C,IAA3C;AACAa,IAAAA,UAAU,CAACE,aAAX,CAAyB,IAAIC,KAAJ,CAAU,QAAV,CAAzB;AACA,SAAKJ,UAAL;AACD;;AA1FmB,CAAtB;AA6FA,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 const dataHolder = this.element.querySelector('input[data-holder]');\n dataHolder.value = this.value;\n dataHolder.dispatchEvent(new Event('change'));\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 const dataHolder = this.element.querySelector('input[data-holder]');\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 => this.updateFile(dataHolder, response) )\n .catch(error => {\n this.listAttributes['fileValue'] = '';\n this.listAttributes['output'] = 'upload error';\n this.planRender();\n console.error(error);\n });\n },\n\n updateFile(dataHolder: HTMLInputElement, response: 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\n dataHolder.value = location;\n dataHolder.dispatchEvent(new Event('change'));\n\n this.planRender();\n }\n },\n\n resetFile(event) {\n event.preventDefault();\n this.value = '';\n const filePicker = this.element.querySelector('input[type=\"file\"]');\n const dataHolder = this.element.querySelector('input[data-holder]');\n\n if (filePicker && dataHolder ) {\n filePicker.value = dataHolder.value = '';\n }\n\n this.listAttributes['fileValue'] = '';\n this.listAttributes['output'] = '';\n this.listAttributes['resetButtonHidden'] = true;\n dataHolder.dispatchEvent(new Event('change'));\n this.planRender();\n }\n}\n\nexport {\n FormFileMixin\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "0.17.28",
3
+ "version": "0.17.30",
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",