jsf.js_next_gen 4.0.3-beta.5 → 4.0.4-beta.1
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/README.md +12 -1
- package/dist/window/faces-development.js +38 -6
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +38 -6
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.map +1 -1
- package/package.json +1 -1
- package/src/main/typescript/impl/AjaxImpl.ts +7 -1
- package/src/main/typescript/impl/core/Const.ts +1 -0
- package/src/main/typescript/impl/util/AsyncRunnable.ts +19 -0
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +17 -3
- package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +63 -0
- package/target/impl/AjaxImpl.js +7 -2
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +3 -2
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +16 -0
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +12 -2
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/xhrCore/XhrRequestProgress.spec.js +91 -0
- package/target/test/xhrCore/XhrRequestProgress.spec.js.map +1 -0
|
@@ -4478,7 +4478,7 @@ var Implementation;
|
|
|
4478
4478
|
* b) passThrough handling with a map copy with a filter map block map
|
|
4479
4479
|
*/
|
|
4480
4480
|
function request(el, event, opts) {
|
|
4481
|
-
var _a, _b, _c, _d, _e;
|
|
4481
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4482
4482
|
const { options, elem, elementId, windowId, isResetValues } = (0, RequestDataResolver_1.resolveDefaults)(event, opts, el);
|
|
4483
4483
|
const requestCtx = new ExtDomQuery_1.ExtConfig({});
|
|
4484
4484
|
const internalCtx = new ExtDomQuery_1.ExtConfig({});
|
|
@@ -4544,6 +4544,11 @@ var Implementation;
|
|
|
4544
4544
|
// additional meta information to speed things up, note internal non jsf
|
|
4545
4545
|
// pass through options are stored under _mfInternal in the context
|
|
4546
4546
|
internalCtx.assign(Const_1.CTX_PARAM_SRC_FRM_ID).value = formId;
|
|
4547
|
+
/**
|
|
4548
|
+
* special myfaces only internal parameter for onProgress until we have an official api
|
|
4549
|
+
* that way we can track the progress of a xhr request (useful for file uploads)
|
|
4550
|
+
*/
|
|
4551
|
+
internalCtx.assign(Const_1.CTX_PARAM_ON_PROGRESS).value = (_e = (_d = options.value) === null || _d === void 0 ? void 0 : _d.myfaces) === null || _e === void 0 ? void 0 : _e.onProgress;
|
|
4547
4552
|
// mojarra compatibility, mojarra is sending the form id as well
|
|
4548
4553
|
// this is not documented behavior but can be determined by running
|
|
4549
4554
|
// mojarra under blackbox conditions.
|
|
@@ -4552,7 +4557,7 @@ var Implementation;
|
|
|
4552
4557
|
requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, formId).value = formId;
|
|
4553
4558
|
internalCtx.assign(Const_1.CTX_PARAM_SRC_CTL_ID).value = elementId;
|
|
4554
4559
|
// reintroduction of PPS as per myfaces 2.3 (myfaces.pps = true, only the executes are submitted)
|
|
4555
|
-
internalCtx.assign(Const_1.CTX_PARAM_PPS).value = (
|
|
4560
|
+
internalCtx.assign(Const_1.CTX_PARAM_PPS).value = (_g = (_f = extractMyFacesParams(options.value)) === null || _f === void 0 ? void 0 : _f[Const_1.MYFACES_OPTION_PPS]) !== null && _g !== void 0 ? _g : false;
|
|
4556
4561
|
assignClientWindowId(form, requestCtx);
|
|
4557
4562
|
assignExecute(options, requestCtx, form, elementId);
|
|
4558
4563
|
assignRender(options, requestCtx, form, elementId);
|
|
@@ -5304,8 +5309,8 @@ var PushImpl;
|
|
|
5304
5309
|
*/
|
|
5305
5310
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5306
5311
|
exports.CTX_OPTIONS_PARAMS = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTP_ERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_EVT = exports.P_RENDER_OVERRIDE = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_CLIENT_WINDOW = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_RESOURCE = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_CLIENT_WINDOW = exports.P_VIEWSTATE = exports.VIEW_ID = exports.NAMING_CONTAINER_ID = exports.P_AJAX_SOURCE = exports.NAMED_VIEWROOT = exports.XML_ATTR_NAMED_VIEWROOT = void 0;
|
|
5307
|
-
exports.
|
|
5308
|
-
exports.$nsp = exports.$faces = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = exports.REASON_EXPIRED = exports.MF_NONE = exports.MYFACES = exports.DEFERRED_HEAD_INSERTS = exports.UPDATE_ELEMS = exports.UPDATE_FORMS = exports.XML_TAG_ATTR = exports.XML_TAG_AFTER = exports.XML_TAG_BEFORE = void 0;
|
|
5312
|
+
exports.XML_TAG_EXTENSION = exports.XML_TAG_ATTRIBUTES = exports.XML_TAG_ERROR = exports.XML_TAG_EVAL = exports.XML_TAG_INSERT = exports.XML_TAG_DELETE = exports.XML_TAG_UPDATE = exports.XML_TAG_CHANGES = exports.XML_TAG_PARTIAL_RESP = exports.ATTR_ID = exports.ATTR_VALUE = exports.ATTR_NAME = exports.ATTR_URL = exports.MYFACES_OPTION_PPS = exports.ERR_NO_PARTIAL_RESPONSE = exports.PHASE_PROCESS_RESPONSE = exports.SEL_RESPONSE_XML = exports.SEL_CLIENT_WINDOW_ELEM = exports.SEL_VIEWSTATE_ELEM = exports.HTML_TAG_STYLE = exports.HTML_TAG_SCRIPT = exports.HTML_TAG_LINK = exports.HTML_TAG_BODY = exports.HTML_TAG_FORM = exports.HTML_TAG_HEAD = exports.STD_ACCEPT = exports.NO_TIMEOUT = exports.MULTIPART = exports.URL_ENCODED = exports.STATE_EVT_COMPLETE = exports.STATE_EVT_TIMEOUT = exports.STATE_EVT_BEGIN = exports.REQ_TYPE_POST = exports.REQ_TYPE_GET = exports.ENCODED_URL = exports.VAL_AJAX = exports.REQ_ACCEPT = exports.HEAD_FACES_REQ = exports.CONTENT_TYPE = exports.CTX_PARAM_PPS = exports.CTX_PARAM_REQ_PASS_THR = exports.CTX_PARAM_SRC_CTL_ID = exports.CTX_PARAM_ON_PROGRESS = exports.CTX_PARAM_SRC_FRM_ID = exports.CTX_PARAM_MF_INTERNAL = exports.CTX_OPTIONS_EXECUTE = exports.CTX_OPTIONS_RESET = exports.CTX_OPTIONS_TIMEOUT = exports.DELAY_NONE = exports.CTX_OPTIONS_DELAY = void 0;
|
|
5313
|
+
exports.$nsp = exports.$faces = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = exports.REASON_EXPIRED = exports.MF_NONE = exports.MYFACES = exports.DEFERRED_HEAD_INSERTS = exports.UPDATE_ELEMS = exports.UPDATE_FORMS = exports.XML_TAG_ATTR = exports.XML_TAG_AFTER = exports.XML_TAG_BEFORE = exports.XML_TAG_REDIRECT = void 0;
|
|
5309
5314
|
/*
|
|
5310
5315
|
* [export const] constants
|
|
5311
5316
|
*/
|
|
@@ -5373,6 +5378,7 @@ exports.CTX_OPTIONS_RESET = "resetValues";
|
|
|
5373
5378
|
exports.CTX_OPTIONS_EXECUTE = "execute";
|
|
5374
5379
|
exports.CTX_PARAM_MF_INTERNAL = "myfaces.internal";
|
|
5375
5380
|
exports.CTX_PARAM_SRC_FRM_ID = "myfaces.source.formId";
|
|
5381
|
+
exports.CTX_PARAM_ON_PROGRESS = "myfaces.onProgress";
|
|
5376
5382
|
exports.CTX_PARAM_SRC_CTL_ID = "myfaces.source.controlId";
|
|
5377
5383
|
exports.CTX_PARAM_REQ_PASS_THR = "myfaces.request.passThrough";
|
|
5378
5384
|
exports.CTX_PARAM_PPS = "myfaces.request.pps";
|
|
@@ -5773,6 +5779,7 @@ class AsyncRunnable {
|
|
|
5773
5779
|
*/
|
|
5774
5780
|
this.catchFunctions = [];
|
|
5775
5781
|
this.thenFunctions = [];
|
|
5782
|
+
this.progressListeners = [];
|
|
5776
5783
|
}
|
|
5777
5784
|
/**
|
|
5778
5785
|
* resolve handler function which calls the then chain
|
|
@@ -5793,6 +5800,13 @@ class AsyncRunnable {
|
|
|
5793
5800
|
return catchFunc(inputVal);
|
|
5794
5801
|
}, data);
|
|
5795
5802
|
}
|
|
5803
|
+
/**
|
|
5804
|
+
* on progress handler which can show a progress of the current runnable
|
|
5805
|
+
* @param data
|
|
5806
|
+
*/
|
|
5807
|
+
onProgress(data) {
|
|
5808
|
+
this.progressListeners.forEach((listener) => listener(data));
|
|
5809
|
+
}
|
|
5796
5810
|
/**
|
|
5797
5811
|
* register a catch functor
|
|
5798
5812
|
* @param func the functor for the catch monad
|
|
@@ -5801,6 +5815,14 @@ class AsyncRunnable {
|
|
|
5801
5815
|
this.catchFunctions.push(func);
|
|
5802
5816
|
return this;
|
|
5803
5817
|
}
|
|
5818
|
+
/**
|
|
5819
|
+
* register a catch functor
|
|
5820
|
+
* @param func the functor for the catch monad
|
|
5821
|
+
*/
|
|
5822
|
+
progress(func) {
|
|
5823
|
+
this.progressListeners.push(func);
|
|
5824
|
+
return this;
|
|
5825
|
+
}
|
|
5804
5826
|
/**
|
|
5805
5827
|
* registers a finally functor
|
|
5806
5828
|
* @param func the functor for the finally handling chanin
|
|
@@ -8078,7 +8100,7 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8078
8100
|
// we omit promises here because we have to deal with cancel functionality,
|
|
8079
8101
|
// and promises to not provide that (yet) instead we have our async queue
|
|
8080
8102
|
// which uses an api internally, which is very close to promises
|
|
8081
|
-
this.registerXhrCallbacks((data) => this.resolve(data), (data) => this.reject(data));
|
|
8103
|
+
this.registerXhrCallbacks((data) => this.resolve(data), (data) => this.reject(data), (data) => this.onProgress(data));
|
|
8082
8104
|
}
|
|
8083
8105
|
start() {
|
|
8084
8106
|
let ignoreErr = failSaveExecute;
|
|
@@ -8170,7 +8192,7 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8170
8192
|
* @param resolve
|
|
8171
8193
|
* @param reject
|
|
8172
8194
|
*/
|
|
8173
|
-
registerXhrCallbacks(resolve, reject) {
|
|
8195
|
+
registerXhrCallbacks(resolve, reject, progress) {
|
|
8174
8196
|
const xhrObject = this.xhrObject;
|
|
8175
8197
|
xhrObject.onabort = () => {
|
|
8176
8198
|
this.onAbort(resolve, reject);
|
|
@@ -8184,6 +8206,10 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8184
8206
|
xhrObject.onloadend = () => {
|
|
8185
8207
|
this.onResponseProcessed(this.xhrObject, resolve);
|
|
8186
8208
|
};
|
|
8209
|
+
this.registerProgressListeners();
|
|
8210
|
+
xhrObject.onprogress = (event) => {
|
|
8211
|
+
progress(event);
|
|
8212
|
+
};
|
|
8187
8213
|
xhrObject.onerror = (errorData) => {
|
|
8188
8214
|
// Safari in rare cases triggers an error when cancelling a request internally, or when
|
|
8189
8215
|
// in this case we simply ignore the request and clear up the queue, because
|
|
@@ -8209,6 +8235,12 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8209
8235
|
this.handleError(errorData);
|
|
8210
8236
|
};
|
|
8211
8237
|
}
|
|
8238
|
+
registerProgressListeners() {
|
|
8239
|
+
let onProgress = this.internalContext.getIf(Const_1.CTX_PARAM_ON_PROGRESS);
|
|
8240
|
+
if (onProgress.isPresent()) {
|
|
8241
|
+
this.progress(onProgress.value);
|
|
8242
|
+
}
|
|
8243
|
+
}
|
|
8212
8244
|
isCancelledResponse(currentTarget) {
|
|
8213
8245
|
return (currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.status) === 0 && // cancelled internally by browser
|
|
8214
8246
|
(currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.readyState) === 4 &&
|