You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2024/11/25 21:21:36 UTC
(myfaces-tobago) branch tobago-5.x updated: feat: Show progress on file upload (#5728)
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/tobago-5.x by this push:
new e13a068a06 feat: Show progress on file upload (#5728)
e13a068a06 is described below
commit e13a068a0610c2ca7c8983176975a6ceb01bb1da
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Mon Nov 25 22:21:30 2024 +0100
feat: Show progress on file upload (#5728)
PoC: logging is implemented now
issue: TOBAGO-2365
---
tobago-theme/package-lock.json | 14 +++++------
tobago-theme/package.json | 2 +-
.../tobago-theme-standard/src/main/js/jsf.js | 2 +-
.../tobago-theme-standard/src/main/js/jsf.js.map | 2 +-
.../tobago-theme-standard/src/main/js/tobago.js | 2 +-
.../src/main/js/tobago.js.map | 2 +-
.../tobago-theme-standard/src/main/ts/jsf.d.ts | 11 ++++++--
.../src/main/ts/tobago-behavior.ts | 29 ++++++++++++++++++++--
.../src/main/ts/tobago-file.ts | 4 +--
9 files changed, 50 insertions(+), 18 deletions(-)
diff --git a/tobago-theme/package-lock.json b/tobago-theme/package-lock.json
index 4f41c2fafc..b21ec4624e 100644
--- a/tobago-theme/package-lock.json
+++ b/tobago-theme/package-lock.json
@@ -12,7 +12,7 @@
"@trevoreyre/autocomplete-js": "3.0.3",
"bootstrap": "5.3.3",
"bootstrap-icons": "1.11.3",
- "jsf.js_next_gen": "4.0.4-beta.2",
+ "jsf.js_next_gen": "4.0.4-beta.3",
"lit-html": "3.2.1"
},
"devDependencies": {
@@ -5255,9 +5255,9 @@
}
},
"node_modules/jsf.js_next_gen": {
- "version": "4.0.4-beta.2",
- "resolved": "https://registry.npmjs.org/jsf.js_next_gen/-/jsf.js_next_gen-4.0.4-beta.2.tgz",
- "integrity": "sha512-oIItgP8UWmh8Tgc9Z8E3J9/BE7SCD+0Mjv52IDzfxRO3o2tytJfjh36raeGFxoYs6OVTdyHk9SpxE5xPgjczVA==",
+ "version": "4.0.4-beta.3",
+ "resolved": "https://registry.npmjs.org/jsf.js_next_gen/-/jsf.js_next_gen-4.0.4-beta.3.tgz",
+ "integrity": "sha512-uJvDdYmBbxevD7mHiF1MZe9ubiHzw5KcLaDQi6I+BnGR1fQy9Q3WKIeO5lJkSGEYjVCNgSduD5LrBycQEomEjQ==",
"license": "Apache-2.0",
"dependencies": {
"mona-dish": "0.28.12"
@@ -11016,9 +11016,9 @@
"dev": true
},
"jsf.js_next_gen": {
- "version": "4.0.4-beta.2",
- "resolved": "https://registry.npmjs.org/jsf.js_next_gen/-/jsf.js_next_gen-4.0.4-beta.2.tgz",
- "integrity": "sha512-oIItgP8UWmh8Tgc9Z8E3J9/BE7SCD+0Mjv52IDzfxRO3o2tytJfjh36raeGFxoYs6OVTdyHk9SpxE5xPgjczVA==",
+ "version": "4.0.4-beta.3",
+ "resolved": "https://registry.npmjs.org/jsf.js_next_gen/-/jsf.js_next_gen-4.0.4-beta.3.tgz",
+ "integrity": "sha512-uJvDdYmBbxevD7mHiF1MZe9ubiHzw5KcLaDQi6I+BnGR1fQy9Q3WKIeO5lJkSGEYjVCNgSduD5LrBycQEomEjQ==",
"requires": {
"mona-dish": "0.28.12"
}
diff --git a/tobago-theme/package.json b/tobago-theme/package.json
index 4166d8b496..88dfa83d65 100644
--- a/tobago-theme/package.json
+++ b/tobago-theme/package.json
@@ -70,7 +70,7 @@
"@trevoreyre/autocomplete-js": "3.0.3",
"bootstrap": "5.3.3",
"bootstrap-icons": "1.11.3",
- "jsf.js_next_gen": "4.0.4-beta.2",
+ "jsf.js_next_gen": "4.0.4-beta.3",
"lit-html": "3.2.1"
},
"devDependencies": {
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/jsf.js b/tobago-theme/tobago-theme-standard/src/main/js/jsf.js
index 5ba2d3b0ef..e60999abb3 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/jsf.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/jsf.js
@@ -1,3 +1,3 @@
/*! For license information please see jsf.js.LICENSE.txt */
-(()=>{"use strict";var e={771:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deepEqual=t.shallowMerge=t.simpleShallowMerge=t.deepCopy=t.buildPath=t.resolve=t.appendIf=t.assignIf=t.append=t.assign=void 0;const r=n(86);class s{constructor(e){this.parent=e}set value(e){}get value(){return this.parent}}function l(e,...t){if(t.length<1)return new s(e);const n=d(e,...t);return new class{set value(e){n.target[n.key]=e}get value(){return n.target[n.key]}}}function o(e,...t){if(t.le [...]
+(()=>{"use strict";var e={771:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deepEqual=t.shallowMerge=t.simpleShallowMerge=t.deepCopy=t.buildPath=t.resolve=t.appendIf=t.assignIf=t.append=t.assign=void 0;const r=n(86);class s{constructor(e){this.parent=e}set value(e){}get value(){return this.parent}}function l(e,...t){if(t.length<1)return new s(e);const n=d(e,...t);return new class{set value(e){n.target[n.key]=e}get value(){return n.target[n.key]}}}function o(e,...t){if(t.le [...]
//# sourceMappingURL=jsf.js.map
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/jsf.js.map b/tobago-theme/tobago-theme-standard/src/main/js/jsf.js.map
index 9a22745332..1fbdd276b9 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/jsf.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/jsf.js.map
@@ -1 +1 @@
-{"version":3,"file":"jsf.js","mappings":";yNAuBA,cAKA,MAAMA,EACF,WAAAC,CAAoBC,GAAA,KAAAA,OAAAA,CAAc,CAElC,SAAIC,CAAMA,GACV,CACA,SAAIA,GACA,OAAOC,KAAKF,MAChB,EASJ,SAAgBG,EAAUC,KAAiCC,GACvD,GAAIA,EAAWC,OAAS,EACpB,OAAO,IAAIR,EAAaM,GAE5B,MAAMG,EAAeC,EAAUJ,KAAWC,GAU1C,OATgC,IAAI,MAChC,SAAIJ,CAAMA,GACNM,EAAaH,OAAOG,EAAaE,KAAOR,CAC5C,CAEA,SAAIA,GACA,OAAOM,EAAaH,OAAOG,EAAaE,IAC5C,EAGR,CAGA,SAAgBC,EAAUN,KAAiCC,GACvD,GAAIA,EAAWC,OAAS,EACpB,OAAO,IAAIR,EAAaM,GAE5B,MAAMG,EAAeC,EAAUJ,KAAWC,GAgB1C,OAfg [...]
\ No newline at end of file
+{"version":3,"file":"jsf.js","mappings":";yNAuBA,cAKA,MAAMA,EACF,WAAAC,CAAoBC,GAAA,KAAAA,OAAAA,CAAc,CAElC,SAAIC,CAAMA,GACV,CACA,SAAIA,GACA,OAAOC,KAAKF,MAChB,EASJ,SAAgBG,EAAUC,KAAiCC,GACvD,GAAIA,EAAWC,OAAS,EACpB,OAAO,IAAIR,EAAaM,GAE5B,MAAMG,EAAeC,EAAUJ,KAAWC,GAU1C,OATgC,IAAI,MAChC,SAAIJ,CAAMA,GACNM,EAAaH,OAAOG,EAAaE,KAAOR,CAC5C,CAEA,SAAIA,GACA,OAAOM,EAAaH,OAAOG,EAAaE,IAC5C,EAGR,CAGA,SAAgBC,EAAUN,KAAiCC,GACvD,GAAIA,EAAWC,OAAS,EACpB,OAAO,IAAIR,EAAaM,GAE5B,MAAMG,EAAeC,EAAUJ,KAAWC,GAgB1C,OAfg [...]
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
index 4c9ace654f..7fb96d67e0 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -15,5 +15,5 @@ const pt=new Map,gt={set(e,t,s){pt.has(e)||pt.set(e,new Map);const i=pt.get(e);i
${s>0?" tabindex='"+String(s)+"'":""}
@click="${this.removeBadge.bind(this)}"
@focus="${this.focusEvent.bind(this)}"
- @blur="${this.blurEvent.bind(this)}"><i class='bi-x-lg'></i></button>`}removeBadge(e){var t;const s=e.target.closest(".btn-group").dataset.tobagoValue,i=this.hiddenSelect.querySelector(`[value="${s}"]`);i.selected=!1;const n=this.badges.querySelector(`[data-tobago-value="${s}"]`),o=n.previousElementSibling,r="SPAN"===(null===(t=n.nextElementSibling)||void 0===t?void 0:t.tagName)?n.nextElementSibling:null;o?o.querySelector("button.btn.badge").focus():r?r.querySelector("button.btn.ba [...]
+ @blur="${this.blurEvent.bind(this)}"><i class='bi-x-lg'></i></button>`}removeBadge(e){var t;const s=e.target.closest(".btn-group").dataset.tobagoValue,i=this.hiddenSelect.querySelector(`[value="${s}"]`);i.selected=!1;const n=this.badges.querySelector(`[data-tobago-value="${s}"]`),o=n.previousElementSibling,r="SPAN"===(null===(t=n.nextElementSibling)||void 0===t?void 0:t.tagName)?n.nextElementSibling:null;o?o.querySelector("button.btn.badge").focus():r?r.querySelector("button.btn.ba [...]
//# sourceMappingURL=tobago.js.map
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
index bdb3b9cbc5..595a4420e7 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.js","sources":["../ts/tobago-css.ts","../ts/tobago-key.ts","../ts/tobago-bar.ts","../ts/tobago-date.ts","../ts/tobago-menu-store.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-css.ts","../ts/tobago-key.ts","../ts/tobago-bar.ts","../ts/tobago-date.ts","../ts/tobago-menu-store.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles [...]
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/jsf.d.ts b/tobago-theme/tobago-theme-standard/src/main/ts/jsf.d.ts
index f59f2c5f26..5db720326d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/jsf.d.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/jsf.d.ts
@@ -24,8 +24,15 @@ interface Options {
delay?: number,
resetValues?: boolean,
myfaces?: {
- upload: {
- onProgress: ((upload: XMLHttpRequestUpload, event: ProgressEvent) => any)
+ upload?: {
+ progress?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
+ preinit?: (upload: XMLHttpRequestUpload) => any,
+ loadstart?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
+ load?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
+ loadend?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
+ error?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
+ abort?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
+ timeout?: (upload: XMLHttpRequestUpload, event: ProgressEvent) => any,
}
}
}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
index c7a7ffe489..38abb82524 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-behavior.ts
@@ -139,8 +139,33 @@ class Behavior extends HTMLElement {
},
myfaces: {
upload: {
- onProgress: (upload: XMLHttpRequestUpload, event: ProgressEvent) => {
- console.debug(`Progress: ${event.loaded} of ${event.total}`);
+ progress: (upload: XMLHttpRequestUpload, event: ProgressEvent) => {
+ console.debug(`progress: ${event.loaded} of ${event.total}`);
+ // console.error("*********************************");
+ // console.error(this);
+ // console.error("*********************************");
+ // (this.actionElement as File).showProgress(event.loaded, event.total);
+ },
+ preinit: (upload: XMLHttpRequestUpload) => {
+ console.debug(`preinit`);
+ },
+ loadstart: (upload: XMLHttpRequestUpload, event: ProgressEvent) => {
+ console.debug(`loadstart: ${event.loaded} of ${event.total}`);
+ },
+ load: (upload: XMLHttpRequestUpload, event: ProgressEvent) => {
+ console.debug(`load: ${event.loaded} of ${event.total}`);
+ },
+ loadend: (upload: XMLHttpRequestUpload, event: ProgressEvent) => {
+ console.debug(`loadend: ${event.loaded} of ${event.total}`);
+ },
+ error: (upload: XMLHttpRequestUpload, event: ProgressEvent) => {
+ console.debug(`error: ${event.loaded} of ${event.total}`);
+ },
+ abort: (upload: XMLHttpRequestUpload, event: ProgressEvent) => {
+ console.debug(`abort: ${event.loaded} of ${event.total}`);
+ },
+ timeout: (upload: XMLHttpRequestUpload, event: ProgressEvent) => {
+ console.debug(`timeout: ${event.loaded} of ${event.total}`);
}
}
}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-file.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-file.ts
index 484f723992..125bce4cec 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-file.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-file.ts
@@ -41,11 +41,11 @@ export class File extends HTMLElement {
get maxSize(): number {
const number = Number.parseInt(this.getAttribute("max-size"));
return Number.isNaN(number) ? 0 : number;
- }
+ }
get maxSizeMessage(): string {
return this.getAttribute("max-size-message");
- }
+ }
static isTypeFile(event: DragEvent): boolean {
if (event.dataTransfer) {