jsf.js_next_gen 4.0.0-beta-14 → 4.0.0-beta-16
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.
- package/dist/docs/assets/style.css +34 -2
- package/dist/docs/functions/faces.ajax.addOnError.html +5 -3
- package/dist/docs/functions/faces.ajax.addOnEvent.html +5 -3
- package/dist/docs/functions/faces.ajax.request.html +5 -3
- package/dist/docs/functions/faces.ajax.response.html +5 -3
- package/dist/docs/functions/faces.getClientWindow.html +5 -3
- package/dist/docs/functions/faces.getProjectStage.html +5 -3
- package/dist/docs/functions/faces.getViewState.html +5 -3
- package/dist/docs/functions/faces.push.close.html +5 -3
- package/dist/docs/functions/faces.push.init.html +5 -3
- package/dist/docs/functions/faces.push.open.html +5 -3
- package/dist/docs/functions/faces.util.chain.html +5 -3
- package/dist/docs/functions/myfaces.ab.html +5 -3
- package/dist/docs/index.html +5 -3
- package/dist/docs/modules/faces.ajax.html +5 -3
- package/dist/docs/modules/faces.html +5 -3
- package/dist/docs/modules/faces.push.html +5 -3
- package/dist/docs/modules/faces.util.html +5 -3
- package/dist/docs/modules/myfaces.html +5 -3
- package/dist/docs/modules.html +5 -3
- package/dist/docs/variables/faces.contextpath.html +5 -3
- package/dist/docs/variables/faces.implversion.html +5 -3
- package/dist/docs/variables/faces.separatorchar.html +5 -3
- package/dist/docs/variables/faces.specversion.html +5 -3
- package/dist/docs/variables/myfaces.oam.html +5 -3
- package/dist/window/faces-development.js +43 -24
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +43 -24
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +3 -3
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +28 -10
- package/target/impl/xhrCore/XhrRequest.js +26 -10
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
|
@@ -62,27 +62,28 @@ var Submittables;
|
|
|
62
62
|
Submittables["CHECKBOX"] = "checkbox";
|
|
63
63
|
})(Submittables || (Submittables = {}));
|
|
64
64
|
/**
|
|
65
|
-
* helper to fix a common problem that a system has to wait until a certain condition is reached
|
|
66
|
-
*
|
|
67
|
-
* @param root the root
|
|
68
|
-
* @param condition the condition lambda to be
|
|
65
|
+
* helper to fix a common problem that a system has to wait, until a certain condition is reached.
|
|
66
|
+
* Depending on the browser this uses either the Mutation Observer or a semi compatible interval as fallback.
|
|
67
|
+
* @param root the root DomQuery element to start from
|
|
68
|
+
* @param condition the condition lambda to be fulfilled
|
|
69
69
|
* @param options options for the search
|
|
70
70
|
*/
|
|
71
71
|
function waitUntilDom(root, condition, options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }) {
|
|
72
72
|
return new Promise((success, error) => {
|
|
73
|
+
let observer = null;
|
|
73
74
|
const MUT_ERROR = new Error("Mutation observer timeout");
|
|
74
75
|
//we do the same but for now ignore the options on the dom query
|
|
75
76
|
//we cannot use absent here, because the condition might search for an absent element
|
|
76
77
|
function findElement(root, condition) {
|
|
77
78
|
let found = null;
|
|
78
|
-
if (condition(root)) {
|
|
79
|
+
if (!!condition(root)) {
|
|
79
80
|
return root;
|
|
80
81
|
}
|
|
81
82
|
if (options.childList) {
|
|
82
|
-
found = (condition(root)) ? root : root.childNodes.
|
|
83
|
+
found = (condition(root)) ? root : root.childNodes.filter(item => condition(item)).first().value.value;
|
|
83
84
|
}
|
|
84
85
|
else if (options.subtree) {
|
|
85
|
-
found = (condition(root)) ? root : root.querySelectorAll(" * ").
|
|
86
|
+
found = (condition(root)) ? root : root.querySelectorAll(" * ").filter(item => condition(item)).first().value.value;
|
|
86
87
|
}
|
|
87
88
|
else {
|
|
88
89
|
found = (condition(root)) ? root : null;
|
|
@@ -90,22 +91,24 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
|
|
|
90
91
|
return found;
|
|
91
92
|
}
|
|
92
93
|
let foundElement = root;
|
|
93
|
-
if ((foundElement = findElement(foundElement, condition))
|
|
94
|
+
if (!!(foundElement = findElement(foundElement, condition))) {
|
|
94
95
|
success(new DomQuery(foundElement));
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
98
|
if ('undefined' != typeof MutationObserver) {
|
|
98
99
|
const mutTimeout = setTimeout(() => {
|
|
100
|
+
observer.disconnect();
|
|
99
101
|
return error(MUT_ERROR);
|
|
100
102
|
}, options.timeout);
|
|
101
103
|
const callback = (mutationList) => {
|
|
102
|
-
const found = new DomQuery(mutationList.map((mut) => mut.target)).
|
|
103
|
-
if (found) {
|
|
104
|
+
const found = new DomQuery(mutationList.map((mut) => mut.target)).filter(item => condition(item)).first();
|
|
105
|
+
if (found.isPresent()) {
|
|
104
106
|
clearTimeout(mutTimeout);
|
|
105
|
-
|
|
107
|
+
observer.disconnect();
|
|
108
|
+
success(new DomQuery(found || root));
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
|
-
|
|
111
|
+
observer = new window.MutationObserver(callback);
|
|
109
112
|
// browsers might ignore it, but we cannot break the api in the case
|
|
110
113
|
// hence no timeout is passed
|
|
111
114
|
let observableOpts = Object.assign({}, options);
|
|
@@ -117,13 +120,13 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
|
|
|
117
120
|
else { //fallback for legacy browsers without mutation observer
|
|
118
121
|
let interval = setInterval(() => {
|
|
119
122
|
let found = findElement(root, condition);
|
|
120
|
-
if (found) {
|
|
123
|
+
if (!!found) {
|
|
121
124
|
if (timeout) {
|
|
122
125
|
clearTimeout(timeout);
|
|
123
126
|
clearInterval(interval);
|
|
124
127
|
interval = null;
|
|
125
|
-
success(found);
|
|
126
128
|
}
|
|
129
|
+
success(new DomQuery(found || root));
|
|
127
130
|
}
|
|
128
131
|
}, options.interval);
|
|
129
132
|
let timeout = setTimeout(() => {
|
|
@@ -7032,13 +7035,11 @@ class XhrRequest {
|
|
|
7032
7035
|
}, data);
|
|
7033
7036
|
}
|
|
7034
7037
|
catch(func) {
|
|
7035
|
-
//this.$promise.catch(func);
|
|
7036
7038
|
this.catchFuncs.push(func);
|
|
7037
7039
|
return this;
|
|
7038
7040
|
}
|
|
7039
7041
|
finally(func) {
|
|
7040
7042
|
//no ie11 support we probably are going to revert to shims for that one
|
|
7041
|
-
//(<any>this.$promise).then(func).catch(func);
|
|
7042
7043
|
this.catchFuncs.push(func);
|
|
7043
7044
|
this.thenFunc.push(func);
|
|
7044
7045
|
return this;
|
|
@@ -7070,15 +7071,32 @@ class XhrRequest {
|
|
|
7070
7071
|
this.onDone(this.xhrObject, resolve);
|
|
7071
7072
|
};
|
|
7072
7073
|
xhrObject.onerror = (errorData) => {
|
|
7074
|
+
// some browsers trigger an error when cancelling a request internally
|
|
7075
|
+
// in this case we simply ignore the request and clear up the queue, because
|
|
7076
|
+
// it is not safe anymore to proceed with the current queue
|
|
7077
|
+
// This bypasses a Safari issue where it keeps requests hanging after page unload
|
|
7078
|
+
// and then triggers a cancel error on then instead of just stopping
|
|
7079
|
+
// and clearing the code
|
|
7080
|
+
if (this.isCancelledResponse(this.xhrObject)) {
|
|
7081
|
+
reject();
|
|
7082
|
+
this.stopProgress = true;
|
|
7083
|
+
return;
|
|
7084
|
+
}
|
|
7073
7085
|
this.onError(errorData, reject);
|
|
7074
7086
|
};
|
|
7075
7087
|
}
|
|
7088
|
+
isCancelledResponse(currentTarget) {
|
|
7089
|
+
return (currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.status) === 0 && //cancelled by browser
|
|
7090
|
+
(currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.readyState) === 4 &&
|
|
7091
|
+
(currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.responseText) === '' &&
|
|
7092
|
+
(currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.responseXML) === null;
|
|
7093
|
+
}
|
|
7076
7094
|
/*
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7095
|
+
* xhr processing callbacks
|
|
7096
|
+
*
|
|
7097
|
+
* Those methods are the callbacks called by
|
|
7098
|
+
* the xhr object depending on its own state
|
|
7099
|
+
*/
|
|
7082
7100
|
onAbort(reject) {
|
|
7083
7101
|
reject();
|
|
7084
7102
|
}
|
|
@@ -7112,13 +7130,14 @@ class XhrRequest {
|
|
|
7112
7130
|
this.handleError(errorData, true);
|
|
7113
7131
|
}
|
|
7114
7132
|
finally {
|
|
7115
|
-
//we issue a resolve in this case to allow the system to recover
|
|
7133
|
+
// we issue a resolve in this case to allow the system to recover
|
|
7134
|
+
// reject would clean up the queue
|
|
7116
7135
|
resolve(errorData);
|
|
7117
|
-
//reject();
|
|
7118
7136
|
}
|
|
7119
7137
|
//non blocking non clearing
|
|
7120
7138
|
}
|
|
7121
7139
|
onDone(data, resolve) {
|
|
7140
|
+
// if stop progress a special handling including resolve is already performed
|
|
7122
7141
|
if (this.stopProgress) {
|
|
7123
7142
|
return;
|
|
7124
7143
|
}
|
|
@@ -7147,7 +7166,7 @@ class XhrRequest {
|
|
|
7147
7166
|
try {
|
|
7148
7167
|
//user code error, we might cover
|
|
7149
7168
|
//this in onError but also we cannot swallow it
|
|
7150
|
-
//we need to resolve the local handlers
|
|
7169
|
+
//we need to resolve the local handlers lazily,
|
|
7151
7170
|
//because some frameworks might decorate them over the context in the response
|
|
7152
7171
|
let eventHandler = (0, RequestDataResolver_1.resolveHandlerFunc)(this.requestContext, this.responseContext, Const_1.ON_EVENT);
|
|
7153
7172
|
AjaxImpl_1.Implementation.sendEvent(eventData, eventHandler);
|
|
Binary file
|
|
Binary file
|