jsf.js_next_gen 1.0.0-beta-16 → 1.0.0-beta-18
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/window/jsf-development.js +318 -212
- 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 +2 -2
- package/src/main/typescript/impl/AjaxImpl.ts +84 -48
- package/src/main/typescript/impl/util/AsyncQueue.ts +30 -17
- package/src/main/typescript/impl/util/AsyncRunnable.ts +5 -3
- package/src/main/typescript/impl/util/ExtDomQuery.ts +8 -8
- package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +31 -11
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +86 -90
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +34 -28
- package/target/impl/AjaxImpl.js +80 -39
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/util/AsyncQueue.js +28 -15
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +7 -7
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js +3 -3
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +3 -3
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +31 -9
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +86 -88
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +32 -27
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
|
@@ -1575,6 +1575,8 @@ var DomQuery = /** @class */ (function () {
|
|
|
1575
1575
|
if (files === null || files === void 0 ? void 0 : files.length) {
|
|
1576
1576
|
//xhr level2
|
|
1577
1577
|
target.append(name).value = files[0];
|
|
1578
|
+
//TODO we have to know that the entry is a file element, so that we can reuse
|
|
1579
|
+
//this information
|
|
1578
1580
|
}
|
|
1579
1581
|
else {
|
|
1580
1582
|
target.append(name).value = element.inputValue.value;
|
|
@@ -2699,6 +2701,14 @@ exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.Form
|
|
|
2699
2701
|
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
2700
2702
|
/**
|
|
2701
2703
|
* special status of the datasource location pointer
|
|
2704
|
+
* if an access, outside of the possible data boundaries is happening
|
|
2705
|
+
* (example for instance current without a first next call, or next
|
|
2706
|
+
* which goes over the last possible dataset), an iteration status return
|
|
2707
|
+
* value is returned marking this boundary instead of a classical element
|
|
2708
|
+
*
|
|
2709
|
+
* Note this is only internally used but must be implemented to fullfill
|
|
2710
|
+
* internal contracts, the end user will never see those values if he uses
|
|
2711
|
+
* streams!
|
|
2702
2712
|
*/
|
|
2703
2713
|
var ITERATION_STATUS;
|
|
2704
2714
|
(function (ITERATION_STATUS) {
|
|
@@ -2910,33 +2920,50 @@ var FlatMapStreamDataSource = /** @class */ (function () {
|
|
|
2910
2920
|
};
|
|
2911
2921
|
FlatMapStreamDataSource.prototype.lookAhead = function (cnt) {
|
|
2912
2922
|
var _a;
|
|
2923
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2913
2924
|
//easy access trial
|
|
2914
2925
|
if ((this === null || this === void 0 ? void 0 : this.activeDataSource) && ((_a = this === null || this === void 0 ? void 0 : this.activeDataSource) === null || _a === void 0 ? void 0 : _a.lookAhead(cnt)) != ITERATION_STATUS.EO_STRM) {
|
|
2915
2926
|
//this should coverr 95% of all accesses
|
|
2916
2927
|
return this === null || this === void 0 ? void 0 : this.activeDataSource.lookAhead(cnt);
|
|
2917
2928
|
}
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2929
|
+
/**
|
|
2930
|
+
* we only can determine how many elems datasource has by going up
|
|
2931
|
+
* (for now this suffices, however not ideal, we might have to introduce a numElements or so)
|
|
2932
|
+
* @param datasource
|
|
2933
|
+
*/
|
|
2934
|
+
function howManyElems(datasource) {
|
|
2935
|
+
var cnt = 1;
|
|
2936
|
+
while (datasource.lookAhead(cnt) !== ITERATION_STATUS.EO_STRM) {
|
|
2937
|
+
cnt++;
|
|
2925
2938
|
}
|
|
2926
|
-
|
|
2939
|
+
return cnt - 1;
|
|
2940
|
+
}
|
|
2941
|
+
function readjustSkip(dataSource) {
|
|
2942
|
+
var skippedElems = (dataSource) ? howManyElems(dataSource) : 0;
|
|
2943
|
+
cnt = cnt - skippedElems;
|
|
2944
|
+
}
|
|
2945
|
+
if (this.activeDataSource) {
|
|
2946
|
+
readjustSkip(this.activeDataSource);
|
|
2947
|
+
}
|
|
2948
|
+
//the idea is basically to look into the streams subsequentially for a match
|
|
2949
|
+
//after each stream we have to take into consideration that the skipCnt is
|
|
2950
|
+
//reduced by the number of datasets we already have looked into in the previous stream/datasource
|
|
2951
|
+
//unfortunately for now we have to loop into them so we introduce a small o2 here
|
|
2952
|
+
for (var dsLoop = 1; true; dsLoop++) {
|
|
2953
|
+
var currDatasource = this.inputDataSource.lookAhead(dsLoop);
|
|
2954
|
+
//we have looped out
|
|
2955
|
+
if (currDatasource === ITERATION_STATUS.EO_STRM) {
|
|
2956
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2957
|
+
}
|
|
2958
|
+
var mapped = this.mapFunc(currDatasource);
|
|
2927
2959
|
//it either comes in as datasource or as array
|
|
2928
2960
|
var currentDataSource = this.toDatasource(mapped);
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
return foundItem;
|
|
2936
|
-
}
|
|
2937
|
-
}*/
|
|
2938
|
-
}
|
|
2939
|
-
return ITERATION_STATUS.EO_STRM;
|
|
2961
|
+
var ret = currentDataSource.lookAhead(cnt);
|
|
2962
|
+
if (ret != ITERATION_STATUS.EO_STRM) {
|
|
2963
|
+
return ret;
|
|
2964
|
+
}
|
|
2965
|
+
readjustSkip(currDatasource);
|
|
2966
|
+
}
|
|
2940
2967
|
};
|
|
2941
2968
|
FlatMapStreamDataSource.prototype.toDatasource = function (mapped) {
|
|
2942
2969
|
var ds = Array.isArray(mapped) ? new (ArrayStreamDataSource.bind.apply(ArrayStreamDataSource, __spreadArray([void 0], mapped, false)))() : mapped;
|
|
@@ -4077,6 +4104,54 @@ var BlockFilter;
|
|
|
4077
4104
|
*/
|
|
4078
4105
|
var Implementation;
|
|
4079
4106
|
(function (Implementation) {
|
|
4107
|
+
/*
|
|
4108
|
+
Small internal explanation, this code is optimized for readability
|
|
4109
|
+
and cuts off a ton of old legacy code.
|
|
4110
|
+
Aka older browsers are not supported anymore.
|
|
4111
|
+
We use a self written helper library to keep the number of exernal
|
|
4112
|
+
code dependencies down.
|
|
4113
|
+
The library is called mona-dish and started as a small sideproject of mine
|
|
4114
|
+
it provides following
|
|
4115
|
+
|
|
4116
|
+
a) Monad like structures for querying because this keeps the code denser and adds abstractions
|
|
4117
|
+
that always was the strong point of jquery and it still is better in this regard than what ecmascript provides
|
|
4118
|
+
|
|
4119
|
+
b) Streams and lazystreams like java has, a pull like construct, ecmascript does not have anything like Lazystreams.
|
|
4120
|
+
Another option would have been rxjs but that would have introduced a code dependency and probably more code. We might
|
|
4121
|
+
move to RXJS if the need arises however. But for now I would rather stick with my small self grown library which works
|
|
4122
|
+
quite well and where I can patch quickly (I have used it in several industrial projects, so it works well
|
|
4123
|
+
and is heavily fortified by unit tests (140 testcases as time of writing this))
|
|
4124
|
+
|
|
4125
|
+
c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be
|
|
4126
|
+
transformed into different data representations
|
|
4127
|
+
|
|
4128
|
+
examples:
|
|
4129
|
+
internalCtx.assign(MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;
|
|
4130
|
+
passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID
|
|
4131
|
+
|
|
4132
|
+
basically an abbreviation for
|
|
4133
|
+
|
|
4134
|
+
internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};
|
|
4135
|
+
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};
|
|
4136
|
+
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;
|
|
4137
|
+
|
|
4138
|
+
|
|
4139
|
+
internalCtx.assign(condition, MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;
|
|
4140
|
+
passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID if condition === true otherwise it is ignored
|
|
4141
|
+
|
|
4142
|
+
abbreviates:
|
|
4143
|
+
if(condition) {
|
|
4144
|
+
internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};
|
|
4145
|
+
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};
|
|
4146
|
+
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
|
|
4150
|
+
d) Optional constructs, while under heavy debate we only use them lightly where the api requires it from mona-dish
|
|
4151
|
+
|
|
4152
|
+
Note the inclusion of this library uses a reduced build which only includes the part of it, which we really use
|
|
4153
|
+
|
|
4154
|
+
*/
|
|
4080
4155
|
var trim = mona_dish_1.Lang.trim;
|
|
4081
4156
|
var getMessage = Lang_1.ExtLang.getMessage;
|
|
4082
4157
|
var getGlobalConfig = Lang_1.ExtLang.getGlobalConfig;
|
|
@@ -4146,8 +4221,9 @@ var Implementation;
|
|
|
4146
4221
|
funcs[_i - 2] = arguments[_i];
|
|
4147
4222
|
}
|
|
4148
4223
|
return mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, funcs).map(function (func) { return resolveAndExecute(source, event, func); })
|
|
4149
|
-
// we use the return false == stop as an early stop
|
|
4224
|
+
// we use the return false == stop as an early stop, onElem stops at the first false
|
|
4150
4225
|
.onElem(function (opResult) { return opResult; })
|
|
4226
|
+
//last ensures we run until the first false is returned
|
|
4151
4227
|
.last().value;
|
|
4152
4228
|
}
|
|
4153
4229
|
Implementation.chain = chain;
|
|
@@ -4173,14 +4249,25 @@ var Implementation;
|
|
|
4173
4249
|
var _a, _b, _c;
|
|
4174
4250
|
var _d = (0, RequestDataResolver_1.resolveDefaults)(event, opts, el), resolvedEvent = _d.resolvedEvent, options = _d.options, elem = _d.elem, elementId = _d.elementId, requestCtx = _d.requestCtx, internalCtx = _d.internalCtx, windowId = _d.windowId, isResetValues = _d.isResetValues;
|
|
4175
4251
|
Assertions_1.Assertions.assertRequestIntegrity(options, elem);
|
|
4252
|
+
/**
|
|
4253
|
+
* fetch the parent form
|
|
4254
|
+
*
|
|
4255
|
+
* note we also add an override possibility here
|
|
4256
|
+
* so that people can use dummy forms and work
|
|
4257
|
+
* with detached objects
|
|
4258
|
+
*/
|
|
4259
|
+
var form = (0, RequestDataResolver_1.resolveForm)(requestCtx, elem, resolvedEvent);
|
|
4260
|
+
var formId = form.id.value;
|
|
4261
|
+
var delay = (0, RequestDataResolver_1.resolveDelay)(options);
|
|
4262
|
+
var timeout = (0, RequestDataResolver_1.resolveTimeout)(options);
|
|
4176
4263
|
requestCtx.assignIf(!!windowId, Const_1.P_WINDOW_ID).value = windowId;
|
|
4177
4264
|
requestCtx.assign(Const_1.CTX_PARAM_PASS_THR).value = filterPassthroughValues(options.value);
|
|
4178
4265
|
requestCtx.assignIf(!!resolvedEvent, Const_1.CTX_PARAM_PASS_THR, Const_1.P_EVT).value = resolvedEvent === null || resolvedEvent === void 0 ? void 0 : resolvedEvent.type;
|
|
4179
4266
|
/**
|
|
4180
4267
|
* ajax pass through context with the source
|
|
4181
|
-
*
|
|
4268
|
+
* onresolved Event and onerror Event
|
|
4182
4269
|
*/
|
|
4183
|
-
requestCtx.assign(Const_1.SOURCE).value = elementId
|
|
4270
|
+
requestCtx.assign(Const_1.SOURCE).value = elementId;
|
|
4184
4271
|
/**
|
|
4185
4272
|
* on resolvedEvent and onError...
|
|
4186
4273
|
* those values will be traversed later on
|
|
@@ -4192,26 +4279,14 @@ var Implementation;
|
|
|
4192
4279
|
* lets drag the myfaces config params also in
|
|
4193
4280
|
*/
|
|
4194
4281
|
requestCtx.assign(Const_1.MYFACES).value = (_c = options.value) === null || _c === void 0 ? void 0 : _c.myfaces;
|
|
4195
|
-
/**
|
|
4196
|
-
* fetch the parent form
|
|
4197
|
-
*
|
|
4198
|
-
* note we also add an override possibility here
|
|
4199
|
-
* so that people can use dummy forms and work
|
|
4200
|
-
* with detached objects
|
|
4201
|
-
*/
|
|
4202
|
-
var form = (0, RequestDataResolver_1.resolveForm)(requestCtx, elem, resolvedEvent);
|
|
4203
4282
|
/**
|
|
4204
4283
|
* binding contract the javax.faces.source must be set
|
|
4205
4284
|
*/
|
|
4206
|
-
requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, Const_1.P_PARTIAL_SOURCE).value = elementId
|
|
4285
|
+
requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, Const_1.P_PARTIAL_SOURCE).value = elementId;
|
|
4207
4286
|
/**
|
|
4208
4287
|
* javax.faces.partial.ajax must be set to true
|
|
4209
4288
|
*/
|
|
4210
4289
|
requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, Const_1.P_AJAX).value = true;
|
|
4211
|
-
/**
|
|
4212
|
-
* binding contract the javax.faces.source must be set
|
|
4213
|
-
*/
|
|
4214
|
-
requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, Const_1.P_PARTIAL_SOURCE).value = elementId.value;
|
|
4215
4290
|
/**
|
|
4216
4291
|
* if resetValues is set to true
|
|
4217
4292
|
* then we have to set javax.faces.resetValues as well
|
|
@@ -4220,22 +4295,20 @@ var Implementation;
|
|
|
4220
4295
|
* the specs jsdoc
|
|
4221
4296
|
*/
|
|
4222
4297
|
requestCtx.assignIf(isResetValues, Const_1.CTX_PARAM_PASS_THR, Const_1.P_RESET_VALUES).value = true;
|
|
4223
|
-
//additional meta information to speed things up, note internal non jsf
|
|
4224
|
-
//pass through options are stored under _mfInternal in the context
|
|
4225
|
-
internalCtx.assign(Const_1.CTX_PARAM_SRC_FRM_ID).value =
|
|
4226
|
-
|
|
4298
|
+
// additional meta information to speed things up, note internal non jsf
|
|
4299
|
+
// pass through options are stored under _mfInternal in the context
|
|
4300
|
+
internalCtx.assign(Const_1.CTX_PARAM_SRC_FRM_ID).value = formId;
|
|
4301
|
+
// mojarra compatibility, mojarra is sending the form id as well
|
|
4302
|
+
// this is not documented behavior but can be determined by running
|
|
4303
|
+
// mojarra under blackbox conditions.
|
|
4304
|
+
// I assume it does the same as our formId_submit=1 so leaving it out
|
|
4305
|
+
// won't hurt but for the sake of compatibility we are going to add it
|
|
4306
|
+
requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, formId).value = formId;
|
|
4307
|
+
internalCtx.assign(Const_1.CTX_PARAM_SRC_CTL_ID).value = elementId;
|
|
4227
4308
|
internalCtx.assign(Const_1.CTX_PARAM_TR_TYPE).value = Const_1.REQ_TYPE_POST;
|
|
4228
|
-
//mojarra compatibility, mojarra is sending the form id as well
|
|
4229
|
-
//this is not documented behavior but can be determined by running
|
|
4230
|
-
//mojarra under blackbox conditions
|
|
4231
|
-
//i assume it does the same as our formId_submit=1 so leaving it out
|
|
4232
|
-
//wont hurt but for the sake of compatibility we are going to add it
|
|
4233
|
-
requestCtx.assign(Const_1.CTX_PARAM_PASS_THR, form.id.value).value = form.id.value;
|
|
4234
4309
|
assignClientWindowId(form, requestCtx);
|
|
4235
|
-
assignExecute(options, requestCtx, form, elementId
|
|
4236
|
-
assignRender(options, requestCtx, form, elementId
|
|
4237
|
-
var delay = (0, RequestDataResolver_1.resolveDelay)(options);
|
|
4238
|
-
var timeout = (0, RequestDataResolver_1.resolveTimeout)(options);
|
|
4310
|
+
assignExecute(options, requestCtx, form, elementId);
|
|
4311
|
+
assignRender(options, requestCtx, form, elementId);
|
|
4239
4312
|
//now we enqueue the request as asynchronous runnable into our request
|
|
4240
4313
|
//queue and let the queue take over the rest
|
|
4241
4314
|
Implementation.queueHandler.addRequestToQueue(elem, form, requestCtx, internalCtx, delay, timeout);
|
|
@@ -4257,7 +4330,6 @@ var Implementation;
|
|
|
4257
4330
|
* @param errorListener the error listener handler
|
|
4258
4331
|
*/
|
|
4259
4332
|
function addOnError(errorListener) {
|
|
4260
|
-
/*error handling already done in the assert of the queue*/
|
|
4261
4333
|
errorQueue.push(errorListener);
|
|
4262
4334
|
}
|
|
4263
4335
|
Implementation.addOnError = addOnError;
|
|
@@ -4267,7 +4339,6 @@ var Implementation;
|
|
|
4267
4339
|
* @param eventListener the event listener handler
|
|
4268
4340
|
*/
|
|
4269
4341
|
function addOnEvent(eventListener) {
|
|
4270
|
-
/*error handling already done in the assert of the queue*/
|
|
4271
4342
|
eventQueue.push(eventListener);
|
|
4272
4343
|
}
|
|
4273
4344
|
Implementation.addOnEvent = addOnEvent;
|
|
@@ -4420,7 +4491,7 @@ var Implementation;
|
|
|
4420
4491
|
Implementation.getViewState = getViewState;
|
|
4421
4492
|
/**
|
|
4422
4493
|
* this at the first sight looks like a weird construct, but we need to do it this way
|
|
4423
|
-
* for testing, we cannot proxy addRequestToQueue from the testing frameworks directly
|
|
4494
|
+
* for testing, we cannot proxy addRequestToQueue from the testing frameworks directly,
|
|
4424
4495
|
* but we need to keep it under unit tests.
|
|
4425
4496
|
*/
|
|
4426
4497
|
Implementation.queueHandler = {
|
|
@@ -4511,11 +4582,8 @@ var Implementation;
|
|
|
4511
4582
|
var iterValues = (userValues) ? trim(userValues).split(/\s+/gi) : [];
|
|
4512
4583
|
var ret = [];
|
|
4513
4584
|
var processed = {};
|
|
4514
|
-
//
|
|
4515
|
-
//
|
|
4516
|
-
//this is more readable than the old indexed based solution
|
|
4517
|
-
//and not really slower because we had to build up the index in our old solution
|
|
4518
|
-
//anyway
|
|
4585
|
+
// in this case we do not use lazy stream because it wont bring any code reduction
|
|
4586
|
+
// or speedup
|
|
4519
4587
|
for (var cnt = 0; cnt < iterValues.length; cnt++) {
|
|
4520
4588
|
//avoid doubles
|
|
4521
4589
|
if (iterValues[cnt] in processed) {
|
|
@@ -4583,7 +4651,7 @@ var Implementation;
|
|
|
4583
4651
|
}
|
|
4584
4652
|
else {
|
|
4585
4653
|
//either a function or a string can be passed in case of a string we have to wrap it into another function
|
|
4586
|
-
//it
|
|
4654
|
+
//it is not a plain executable code but a definition
|
|
4587
4655
|
var sourceCode = trim(func);
|
|
4588
4656
|
if (sourceCode.indexOf("function ") == 0) {
|
|
4589
4657
|
sourceCode = "return ".concat(sourceCode, " (event)");
|
|
@@ -5253,7 +5321,7 @@ exports.AsynchronousQueue = void 0;
|
|
|
5253
5321
|
*
|
|
5254
5322
|
* Every callback must be of async runnable
|
|
5255
5323
|
* which is sort of an extended promise which has
|
|
5256
|
-
* added a
|
|
5324
|
+
* added a dedicated cancel and start point
|
|
5257
5325
|
*
|
|
5258
5326
|
* This interface can be used as wrapper contract
|
|
5259
5327
|
* for normal promises if needed.
|
|
@@ -5263,6 +5331,9 @@ var AsynchronousQueue = /** @class */ (function () {
|
|
|
5263
5331
|
this.runnableQueue = [];
|
|
5264
5332
|
}
|
|
5265
5333
|
Object.defineProperty(AsynchronousQueue.prototype, "isEmpty", {
|
|
5334
|
+
/**
|
|
5335
|
+
* simple is empty accessor, returns true if queue is empty atm
|
|
5336
|
+
*/
|
|
5266
5337
|
get: function () {
|
|
5267
5338
|
return !this.runnableQueue.length;
|
|
5268
5339
|
},
|
|
@@ -5270,7 +5341,7 @@ var AsynchronousQueue = /** @class */ (function () {
|
|
|
5270
5341
|
configurable: true
|
|
5271
5342
|
});
|
|
5272
5343
|
/**
|
|
5273
|
-
*
|
|
5344
|
+
* enqueues an element and starts the
|
|
5274
5345
|
* asynchronous work loop if not already running
|
|
5275
5346
|
*
|
|
5276
5347
|
* @param element the element to be queued and processed
|
|
@@ -5292,13 +5363,36 @@ var AsynchronousQueue = /** @class */ (function () {
|
|
|
5292
5363
|
this.appendElement(element);
|
|
5293
5364
|
}
|
|
5294
5365
|
};
|
|
5366
|
+
/**
|
|
5367
|
+
* fetches the next element from the queue (first in first out order)
|
|
5368
|
+
*/
|
|
5295
5369
|
AsynchronousQueue.prototype.dequeue = function () {
|
|
5296
5370
|
return this.runnableQueue.shift();
|
|
5297
5371
|
};
|
|
5372
|
+
/**
|
|
5373
|
+
* clears up all elements from the queue
|
|
5374
|
+
*/
|
|
5298
5375
|
AsynchronousQueue.prototype.cleanup = function () {
|
|
5299
5376
|
this.currentlyRunning = null;
|
|
5300
5377
|
this.runnableQueue.length = 0;
|
|
5301
5378
|
};
|
|
5379
|
+
/**
|
|
5380
|
+
* cancels the currently running element and then cleans up the queue
|
|
5381
|
+
* aka cancel the queue entirely
|
|
5382
|
+
*/
|
|
5383
|
+
AsynchronousQueue.prototype.cancel = function () {
|
|
5384
|
+
try {
|
|
5385
|
+
if (this.currentlyRunning) {
|
|
5386
|
+
this.currentlyRunning.cancel();
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
finally {
|
|
5390
|
+
this.cleanup();
|
|
5391
|
+
}
|
|
5392
|
+
};
|
|
5393
|
+
AsynchronousQueue.prototype.callForNextElementToProcess = function () {
|
|
5394
|
+
this.runEntry();
|
|
5395
|
+
};
|
|
5302
5396
|
AsynchronousQueue.prototype.appendElement = function (element) {
|
|
5303
5397
|
//only if the first element is added we start with a trigger
|
|
5304
5398
|
//otherwise a process already is running and not finished yet at that
|
|
@@ -5331,19 +5425,6 @@ var AsynchronousQueue = /** @class */ (function () {
|
|
|
5331
5425
|
//(the browser engine will take care of that)
|
|
5332
5426
|
function () { return _this.callForNextElementToProcess(); }).start();
|
|
5333
5427
|
};
|
|
5334
|
-
AsynchronousQueue.prototype.cancel = function () {
|
|
5335
|
-
try {
|
|
5336
|
-
if (this.currentlyRunning) {
|
|
5337
|
-
this.currentlyRunning.cancel();
|
|
5338
|
-
}
|
|
5339
|
-
}
|
|
5340
|
-
finally {
|
|
5341
|
-
this.cleanup();
|
|
5342
|
-
}
|
|
5343
|
-
};
|
|
5344
|
-
AsynchronousQueue.prototype.callForNextElementToProcess = function () {
|
|
5345
|
-
this.runEntry();
|
|
5346
|
-
};
|
|
5347
5428
|
return AsynchronousQueue;
|
|
5348
5429
|
}());
|
|
5349
5430
|
exports.AsynchronousQueue = AsynchronousQueue;
|
|
@@ -5386,9 +5467,9 @@ var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/im
|
|
|
5386
5467
|
*/
|
|
5387
5468
|
var IS_JSF_SOURCE = function (source) {
|
|
5388
5469
|
return source && !!((source === null || source === void 0 ? void 0 : source.search(/\/javax\.faces\.resource.*\/jsf\.js.*/)) != -1 ||
|
|
5389
|
-
(source === null || source === void 0 ? void 0 : source.search(/\/jsf
|
|
5390
|
-
(source === null || source === void 0 ? void 0 : source.search(/\/jsf
|
|
5391
|
-
(source === null || source === void 0 ? void 0 : source.search(/\/jsf[
|
|
5470
|
+
(source === null || source === void 0 ? void 0 : source.search(/\/jsf-development\.js.*/)) != -1 ||
|
|
5471
|
+
(source === null || source === void 0 ? void 0 : source.search(/\/jsf-uncompressed\.js.*/)) != -1 ||
|
|
5472
|
+
(source === null || source === void 0 ? void 0 : source.search(/\/jsf[^.]*\.js.*ln=javax.faces.*/gi)) != -1);
|
|
5392
5473
|
};
|
|
5393
5474
|
/**
|
|
5394
5475
|
* namespace myfaces.testscripts can be used as extension point for internal
|
|
@@ -5399,7 +5480,7 @@ var IS_JSF_SOURCE = function (source) {
|
|
|
5399
5480
|
* @constructor
|
|
5400
5481
|
*/
|
|
5401
5482
|
var IS_INTERNAL_SOURCE = function (source) {
|
|
5402
|
-
return source.search(/\/jsf[
|
|
5483
|
+
return source.search(/\/jsf[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
|
|
5403
5484
|
};
|
|
5404
5485
|
var ATTR_SRC = 'src';
|
|
5405
5486
|
/**
|
|
@@ -5510,7 +5591,7 @@ var ExtDomquery = /** @class */ (function (_super) {
|
|
|
5510
5591
|
}).first();
|
|
5511
5592
|
};
|
|
5512
5593
|
ExtDomquery.prototype.globalEval = function (code, nonce) {
|
|
5513
|
-
return _super.prototype.globalEval.call(this, code, nonce !== null && nonce !== void 0 ? nonce : this.nonce);
|
|
5594
|
+
return new ExtDomquery(_super.prototype.globalEval.call(this, code, nonce !== null && nonce !== void 0 ? nonce : this.nonce));
|
|
5514
5595
|
};
|
|
5515
5596
|
/**
|
|
5516
5597
|
* decorated run scripts which takes our jsf extensions into consideration
|
|
@@ -5528,13 +5609,13 @@ var ExtDomquery = /** @class */ (function (_super) {
|
|
|
5528
5609
|
* byId producer
|
|
5529
5610
|
*
|
|
5530
5611
|
* @param selector id
|
|
5612
|
+
* @param deep whether the search should go into embedded shadow dom elements
|
|
5531
5613
|
* @return a DomQuery containing the found elements
|
|
5532
5614
|
*/
|
|
5533
5615
|
ExtDomquery.byId = function (selector, deep) {
|
|
5534
5616
|
if (deep === void 0) { deep = false; }
|
|
5535
5617
|
var ret = mona_dish_1.DomQuery.byId(selector, deep);
|
|
5536
|
-
|
|
5537
|
-
return ret;
|
|
5618
|
+
return new ExtDomquery(ret);
|
|
5538
5619
|
};
|
|
5539
5620
|
return ExtDomquery;
|
|
5540
5621
|
}(mona_dish_1.DQ));
|
|
@@ -5888,8 +5969,8 @@ var EventData = /** @class */ (function () {
|
|
|
5888
5969
|
eventData.type = Const_1.EVENT;
|
|
5889
5970
|
eventData.status = name;
|
|
5890
5971
|
var sourceId = context.getIf(Const_1.SOURCE)
|
|
5891
|
-
.
|
|
5892
|
-
.
|
|
5972
|
+
.orElseLazy(function () { return context.getIf(Const_1.P_PARTIAL_SOURCE).value; })
|
|
5973
|
+
.orElseLazy(function () { return context.getIf(Const_1.CTX_PARAM_PASS_THR, Const_1.P_PARTIAL_SOURCE).value; }).value;
|
|
5893
5974
|
if (sourceId) {
|
|
5894
5975
|
eventData.source = mona_dish_1.DQ.byId(sourceId, true).first().value.value;
|
|
5895
5976
|
}
|
|
@@ -5951,7 +6032,7 @@ var ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/t
|
|
|
5951
6032
|
*/
|
|
5952
6033
|
function resolveHandlerFunc(requestContext, responseContext, funcName) {
|
|
5953
6034
|
return responseContext.getIf(funcName)
|
|
5954
|
-
.
|
|
6035
|
+
.orElseLazy(function () { return requestContext.getIf(funcName).value; })
|
|
5955
6036
|
.orElse(Const_1.EMPTY_FUNC).value;
|
|
5956
6037
|
}
|
|
5957
6038
|
exports.resolveHandlerFunc = resolveHandlerFunc;
|
|
@@ -5978,7 +6059,7 @@ exports.resolveFinalUrl = resolveFinalUrl;
|
|
|
5978
6059
|
*/
|
|
5979
6060
|
function resolveForm(requestCtx, elem, event) {
|
|
5980
6061
|
var _a, _b, _c;
|
|
5981
|
-
var configId = (_c = (_b = (_a = requestCtx.value) === null || _a === void 0 ? void 0 : _a.myfaces) === null || _b === void 0 ? void 0 : _b.form) !== null && _c !== void 0 ? _c : Const_1.MF_NONE;
|
|
6062
|
+
var configId = (_c = (_b = (_a = requestCtx.value) === null || _a === void 0 ? void 0 : _a.myfaces) === null || _b === void 0 ? void 0 : _b.form) !== null && _c !== void 0 ? _c : Const_1.MF_NONE;
|
|
5982
6063
|
return mona_dish_1.DQ
|
|
5983
6064
|
.byId(configId, true)
|
|
5984
6065
|
.orElseLazy(function () { return Lang_1.ExtLang.getForm(elem.getAsElem(0).value, event); });
|
|
@@ -6051,7 +6132,7 @@ function resolveDefaults(event, opts, el) {
|
|
|
6051
6132
|
if (opts === void 0) { opts = {}; }
|
|
6052
6133
|
if (el === void 0) { el = null; }
|
|
6053
6134
|
//deep copy the options, so that further transformations to not backfire into the callers
|
|
6054
|
-
var resolvedEvent = event, options = new mona_dish_1.Config(opts).deepCopy, elem = mona_dish_1.DQ.byId(el || resolvedEvent.target, true), elementId = elem.id, requestCtx = new mona_dish_1.Config({}), internalCtx = new mona_dish_1.Config({}), windowId = resolveWindowId(options), isResetValues = true === ((_a = options.value) === null || _a === void 0 ? void 0 : _a.resetValues);
|
|
6135
|
+
var resolvedEvent = event, options = new mona_dish_1.Config(opts).deepCopy, elem = mona_dish_1.DQ.byId(el || resolvedEvent.target, true), elementId = elem.id.value, requestCtx = new mona_dish_1.Config({}), internalCtx = new mona_dish_1.Config({}), windowId = resolveWindowId(options), isResetValues = true === ((_a = options.value) === null || _a === void 0 ? void 0 : _a.resetValues);
|
|
6055
6136
|
return { resolvedEvent: resolvedEvent, options: options, elem: elem, elementId: elementId, requestCtx: requestCtx, internalCtx: internalCtx, windowId: windowId, isResetValues: isResetValues };
|
|
6056
6137
|
}
|
|
6057
6138
|
exports.resolveDefaults = resolveDefaults;
|
|
@@ -6156,9 +6237,9 @@ exports.resolveSourceElement = resolveSourceElement;
|
|
|
6156
6237
|
function resolveSourceForm(internalContext, elem) {
|
|
6157
6238
|
var sourceFormId = internalContext.getIf(Const_1.CTX_PARAM_SRC_FRM_ID);
|
|
6158
6239
|
var sourceForm = new mona_dish_2.DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null);
|
|
6159
|
-
sourceForm = sourceForm.
|
|
6160
|
-
.
|
|
6161
|
-
.
|
|
6240
|
+
sourceForm = sourceForm.orElseLazy(function () { return elem.parents(Const_1.TAG_FORM); })
|
|
6241
|
+
.orElseLazy(function () { return elem.querySelectorAll(Const_1.TAG_FORM); })
|
|
6242
|
+
.orElseLazy(function () { return mona_dish_2.DQ.querySelectorAll(Const_1.TAG_FORM); });
|
|
6162
6243
|
return sourceForm;
|
|
6163
6244
|
}
|
|
6164
6245
|
exports.resolveSourceForm = resolveSourceForm;
|
|
@@ -6408,6 +6489,11 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6408
6489
|
this.externalContext = externalContext;
|
|
6409
6490
|
this.internalContext = internalContext;
|
|
6410
6491
|
}
|
|
6492
|
+
/**
|
|
6493
|
+
* head replacement
|
|
6494
|
+
* @param shadowDocument incoming shadow head data (aka cdata as xml reference or dom element)
|
|
6495
|
+
* the data incoming must represent the html representation of the head itself one way or the other
|
|
6496
|
+
*/
|
|
6411
6497
|
ResponseProcessor.prototype.replaceHead = function (shadowDocument) {
|
|
6412
6498
|
var shadowHead = shadowDocument.querySelectorAll(Const_1.TAG_HEAD);
|
|
6413
6499
|
if (!shadowHead.isPresent()) {
|
|
@@ -6416,6 +6502,9 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6416
6502
|
var oldHead = mona_dish_1.DQ.querySelectorAll(Const_1.TAG_HEAD);
|
|
6417
6503
|
//delete all to avoid script and style overlays
|
|
6418
6504
|
oldHead.querySelectorAll(Const_1.SEL_SCRIPTS_STYLES).delete();
|
|
6505
|
+
// we cannot replace new elements in the head, but we can eval the elements
|
|
6506
|
+
// eval means the scripts will get attached (eval script attach method)
|
|
6507
|
+
// but this is done by DomQuery not in this code
|
|
6419
6508
|
this.storeForEval(shadowHead);
|
|
6420
6509
|
};
|
|
6421
6510
|
/**
|
|
@@ -6434,6 +6523,8 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6434
6523
|
var shadowInnerHTML = shadowBody.html().value;
|
|
6435
6524
|
var resultingBody = mona_dish_1.DQ.querySelectorAll(Const_1.TAG_BODY).html(shadowInnerHTML);
|
|
6436
6525
|
var updateForms = resultingBody.querySelectorAll(Const_1.TAG_FORM);
|
|
6526
|
+
// main difference, we cannot replace the body itself, but only its content
|
|
6527
|
+
// we need a separate step for post processing the incoming attributes, like classes, styles etc...
|
|
6437
6528
|
resultingBody.copyAttrs(shadowBody);
|
|
6438
6529
|
this.storeForPostProcessing(updateForms, resultingBody);
|
|
6439
6530
|
};
|
|
@@ -6473,9 +6564,6 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6473
6564
|
this.triggerOnError(errorData);
|
|
6474
6565
|
AjaxImpl_1.Implementation.sendError(errorData);
|
|
6475
6566
|
};
|
|
6476
|
-
ResponseProcessor.prototype.triggerOnError = function (errorData) {
|
|
6477
|
-
this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
|
|
6478
|
-
};
|
|
6479
6567
|
/**
|
|
6480
6568
|
* process the redirect operation
|
|
6481
6569
|
*
|
|
@@ -6495,11 +6583,15 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6495
6583
|
*/
|
|
6496
6584
|
ResponseProcessor.prototype.update = function (node, cdataBlock) {
|
|
6497
6585
|
var result = ExtDomQuery_1.ExtDomquery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
|
|
6498
|
-
var sourceForm = result === null || result === void 0 ? void 0 : result.parents(Const_1.TAG_FORM).
|
|
6586
|
+
var sourceForm = result === null || result === void 0 ? void 0 : result.parents(Const_1.TAG_FORM).orElseLazy(function () { return result.byTagName(Const_1.TAG_FORM, true); });
|
|
6499
6587
|
if (sourceForm) {
|
|
6500
6588
|
this.storeForPostProcessing(sourceForm, result);
|
|
6501
6589
|
}
|
|
6502
6590
|
};
|
|
6591
|
+
/**
|
|
6592
|
+
* Delete handler, simply deleetes the node referenced by the xml data
|
|
6593
|
+
* @param node
|
|
6594
|
+
*/
|
|
6503
6595
|
ResponseProcessor.prototype.delete = function (node) {
|
|
6504
6596
|
mona_dish_1.DQ.byId(node.id.value, true).delete();
|
|
6505
6597
|
};
|
|
@@ -6522,7 +6614,7 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6522
6614
|
this.replaceBody(shadowDocument);
|
|
6523
6615
|
};
|
|
6524
6616
|
/**
|
|
6525
|
-
*
|
|
6617
|
+
* Insert handling, either before or after
|
|
6526
6618
|
*
|
|
6527
6619
|
* @param node
|
|
6528
6620
|
*/
|
|
@@ -6542,7 +6634,7 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6542
6634
|
}
|
|
6543
6635
|
};
|
|
6544
6636
|
/**
|
|
6545
|
-
*
|
|
6637
|
+
* Handler for the case <insert << before id="...
|
|
6546
6638
|
*
|
|
6547
6639
|
* @param node the node hosting the insert data
|
|
6548
6640
|
*/
|
|
@@ -6568,7 +6660,7 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6568
6660
|
});
|
|
6569
6661
|
};
|
|
6570
6662
|
/**
|
|
6571
|
-
*
|
|
6663
|
+
* Process the viewState update, update the affected
|
|
6572
6664
|
* forms with their respective new viewstate values
|
|
6573
6665
|
*
|
|
6574
6666
|
*/
|
|
@@ -6596,7 +6688,10 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6596
6688
|
updateElems.runScripts();
|
|
6597
6689
|
};
|
|
6598
6690
|
/**
|
|
6599
|
-
*
|
|
6691
|
+
* Postprocessing view state fixing
|
|
6692
|
+
* this appends basically the incoming view states to the forms.
|
|
6693
|
+
* It is called from outside after all forms have been processed basically
|
|
6694
|
+
* as last lifecycle step, before going into the next request.
|
|
6600
6695
|
*/
|
|
6601
6696
|
ResponseProcessor.prototype.fixViewStates = function () {
|
|
6602
6697
|
var _this = this;
|
|
@@ -6609,6 +6704,10 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6609
6704
|
_this.appendViewStateToForms(new mona_dish_1.DomQuery(affectedForms, affectedForms2), value.value);
|
|
6610
6705
|
});
|
|
6611
6706
|
};
|
|
6707
|
+
/**
|
|
6708
|
+
* same as with view states before applies the incoming client windows as last step after the rest of the processing
|
|
6709
|
+
* is done.
|
|
6710
|
+
*/
|
|
6612
6711
|
ResponseProcessor.prototype.fixClientWindow = function () {
|
|
6613
6712
|
var _this = this;
|
|
6614
6713
|
mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
|
|
@@ -6624,9 +6723,10 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6624
6723
|
* all processing done we can close the request and send the appropriate events
|
|
6625
6724
|
*/
|
|
6626
6725
|
ResponseProcessor.prototype.done = function () {
|
|
6726
|
+
var _this = this;
|
|
6627
6727
|
var eventData = EventData_1.EventData.createFromRequest(this.request.value, this.externalContext, Const_1.SUCCESS);
|
|
6628
6728
|
//because some frameworks might decorate them over the context in the response
|
|
6629
|
-
var eventHandler = this.externalContext.getIf(Const_1.ON_EVENT).
|
|
6729
|
+
var eventHandler = this.externalContext.getIf(Const_1.ON_EVENT).orElseLazy(function () { return _this.internalContext.getIf(Const_1.ON_EVENT).value; }).orElse(Const_1.EMPTY_FUNC).value;
|
|
6630
6730
|
AjaxImpl_1.Implementation.sendEvent(eventData, eventHandler);
|
|
6631
6731
|
};
|
|
6632
6732
|
/**
|
|
@@ -6726,6 +6826,9 @@ var ResponseProcessor = /** @class */ (function () {
|
|
|
6726
6826
|
((_d = (_c = node === null || node === void 0 ? void 0 : node.id) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.indexOf([separatorChar, Const_1.P_CLIENT_WINDOW].join(Const_1.EMPTY_STR))) != -1 ||
|
|
6727
6827
|
((_f = (_e = node === null || node === void 0 ? void 0 : node.id) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.indexOf([Const_1.P_CLIENT_WINDOW, separatorChar].join(Const_1.EMPTY_STR))) != -1);
|
|
6728
6828
|
};
|
|
6829
|
+
ResponseProcessor.prototype.triggerOnError = function (errorData) {
|
|
6830
|
+
this.externalContext.getIf(Const_1.ON_ERROR).orElse(this.internalContext.getIf(Const_1.ON_ERROR).value).orElse(Const_1.EMPTY_FUNC).value(errorData);
|
|
6831
|
+
};
|
|
6729
6832
|
return ResponseProcessor;
|
|
6730
6833
|
}());
|
|
6731
6834
|
exports.ResponseProcessor = ResponseProcessor;
|
|
@@ -6782,9 +6885,8 @@ exports.XhrFormData = void 0;
|
|
|
6782
6885
|
* limitations under the License.
|
|
6783
6886
|
*/
|
|
6784
6887
|
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6785
|
-
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6786
|
-
var isString = mona_dish_1.Lang.isString;
|
|
6787
6888
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
6889
|
+
var isString = mona_dish_1.Lang.isString;
|
|
6788
6890
|
/**
|
|
6789
6891
|
* A unified form data class
|
|
6790
6892
|
* which builds upon our configuration.
|
|
@@ -6793,10 +6895,9 @@ var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/im
|
|
|
6793
6895
|
* due to api constraints on the HTML Form object in IE11
|
|
6794
6896
|
* and due to the url encoding constraint given by the jsf.js spec
|
|
6795
6897
|
*
|
|
6796
|
-
* TODO not ideal. too many encoding calls
|
|
6797
6898
|
* probably only one needed and one overlay!
|
|
6798
|
-
* the entire
|
|
6799
|
-
* that
|
|
6899
|
+
* the entire file input storing probably is redundant now
|
|
6900
|
+
* that dom query has been fixed //TODO check this
|
|
6800
6901
|
*/
|
|
6801
6902
|
var XhrFormData = /** @class */ (function (_super) {
|
|
6802
6903
|
__extends(XhrFormData, _super);
|
|
@@ -6804,101 +6905,93 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6804
6905
|
* data collector from a given form
|
|
6805
6906
|
*
|
|
6806
6907
|
* @param dataSource either a form as DomQuery object or an encoded url string
|
|
6807
|
-
* @param
|
|
6908
|
+
* @param viewState the form view state or an external viewstate coming in as string
|
|
6909
|
+
* @param executes the executes id list for the elements to being processed
|
|
6910
|
+
* @param partialIds partial ids to collect, to reduce the data sent down
|
|
6808
6911
|
*/
|
|
6809
|
-
function XhrFormData(dataSource,
|
|
6912
|
+
function XhrFormData(dataSource, viewState, executes, partialIds) {
|
|
6810
6913
|
var _this = _super.call(this, {}) || this;
|
|
6811
6914
|
_this.dataSource = dataSource;
|
|
6812
|
-
_this.
|
|
6813
|
-
|
|
6915
|
+
_this.partialIds = partialIds;
|
|
6916
|
+
/**
|
|
6917
|
+
* Checks if the given datasource is a multipart request source
|
|
6918
|
+
* multipart is only needed if one of the executes is a file input
|
|
6919
|
+
* since file inputs are stateless, they fall out of the view state
|
|
6920
|
+
* and need special handling. With file submits we have to send a formData object
|
|
6921
|
+
* instead of an encoded string files cannot be sent that way
|
|
6922
|
+
*/
|
|
6923
|
+
_this.isMultipartRequest = false;
|
|
6814
6924
|
//a call to getViewState before must pass the encoded line
|
|
6815
|
-
//a call from getViewState passes the form element as datasource
|
|
6925
|
+
//a call from getViewState passes the form element as datasource,
|
|
6816
6926
|
//so we have two call points
|
|
6817
6927
|
if (isString(dataSource)) {
|
|
6818
6928
|
_this.assignEncodedString(_this.dataSource);
|
|
6819
6929
|
}
|
|
6820
6930
|
else {
|
|
6821
|
-
_this.
|
|
6931
|
+
_this.applyFormDataToConfig();
|
|
6932
|
+
}
|
|
6933
|
+
if ('undefined' != typeof viewState) {
|
|
6934
|
+
_this.assignEncodedString(viewState);
|
|
6935
|
+
}
|
|
6936
|
+
if (executes) {
|
|
6937
|
+
_this.postInit.apply(_this, executes);
|
|
6822
6938
|
}
|
|
6823
6939
|
return _this;
|
|
6824
6940
|
}
|
|
6825
6941
|
/**
|
|
6826
|
-
* generic
|
|
6942
|
+
* generic post init code, for now, this peforms some post assign data post processing
|
|
6827
6943
|
* @param executes
|
|
6828
6944
|
*/
|
|
6829
|
-
XhrFormData.prototype.
|
|
6945
|
+
XhrFormData.prototype.postInit = function () {
|
|
6830
6946
|
var _this = this;
|
|
6831
6947
|
var executes = [];
|
|
6832
6948
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6833
6949
|
executes[_i] = arguments[_i];
|
|
6834
6950
|
}
|
|
6835
6951
|
var fetchInput = function (id) {
|
|
6836
|
-
if (id ==
|
|
6837
|
-
return
|
|
6952
|
+
if (id == Const_1.IDENT_ALL) {
|
|
6953
|
+
return mona_dish_1.DQ.querySelectorAllDeep("input[type='file']");
|
|
6838
6954
|
}
|
|
6839
|
-
else if (id ==
|
|
6955
|
+
else if (id == Const_1.IDENT_FORM) {
|
|
6840
6956
|
return _this.dataSource.querySelectorAllDeep("input[type='file']");
|
|
6841
6957
|
}
|
|
6842
6958
|
else {
|
|
6843
|
-
var element =
|
|
6959
|
+
var element = mona_dish_1.DQ.byId(id, true);
|
|
6844
6960
|
return _this.getFileInputs(element);
|
|
6845
6961
|
}
|
|
6846
6962
|
};
|
|
6847
6963
|
var inputExists = function (item) {
|
|
6848
6964
|
return item.isPresent();
|
|
6849
6965
|
};
|
|
6850
|
-
|
|
6851
|
-
_this.fileInputs[_this.resolveSubmitIdentifier(item.getAsElem(0).value)] = true;
|
|
6852
|
-
};
|
|
6853
|
-
mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, executes).map(fetchInput)
|
|
6966
|
+
this.isMultipartRequest = mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, executes).map(fetchInput)
|
|
6854
6967
|
.filter(inputExists)
|
|
6855
|
-
.
|
|
6856
|
-
};
|
|
6857
|
-
XhrFormData.prototype.getFileInputs = function (rootElment) {
|
|
6858
|
-
var rootFileInputs = rootElment
|
|
6859
|
-
.filter(function (elem) { return elem.matchesSelector("input[type='file']"); });
|
|
6860
|
-
var childFileInputs = rootElment
|
|
6861
|
-
.querySelectorAll("input[type='file']");
|
|
6862
|
-
var ret = rootFileInputs.concat(childFileInputs);
|
|
6863
|
-
return ret;
|
|
6864
|
-
};
|
|
6865
|
-
XhrFormData.prototype.handleFormSource = function () {
|
|
6866
|
-
//encode and append the issuing item if not a partial ids array of ids is passed
|
|
6867
|
-
/*
|
|
6868
|
-
* Spec. 13.3.1
|
|
6869
|
-
* Collect and encode input elements.
|
|
6870
|
-
* Additionally the hidden element javax.faces.ViewState
|
|
6871
|
-
* Enhancement partial page submit
|
|
6872
|
-
*
|
|
6873
|
-
*/
|
|
6874
|
-
this.encodeSubmittableFields(this, this.dataSource, this.partialIdsArray);
|
|
6875
|
-
if (this.getIf(Const_1.P_VIEWSTATE).isPresent()) {
|
|
6876
|
-
return;
|
|
6877
|
-
}
|
|
6878
|
-
this.applyViewState(this.dataSource);
|
|
6968
|
+
.first().isPresent();
|
|
6879
6969
|
};
|
|
6880
6970
|
/**
|
|
6881
|
-
* special case
|
|
6971
|
+
* special case view state handling
|
|
6882
6972
|
*
|
|
6883
|
-
* @param form the form holding the
|
|
6973
|
+
* @param form the form holding the view state value
|
|
6884
6974
|
*/
|
|
6885
6975
|
XhrFormData.prototype.applyViewState = function (form) {
|
|
6886
6976
|
var viewState = form.byId(Const_1.P_VIEWSTATE, true).inputValue;
|
|
6887
6977
|
this.appendIf(viewState.isPresent(), Const_1.P_VIEWSTATE).value = viewState.value;
|
|
6888
6978
|
};
|
|
6889
6979
|
/**
|
|
6890
|
-
*
|
|
6980
|
+
* assigns an url encoded string to this xhrFormData object
|
|
6891
6981
|
* as key value entry
|
|
6892
6982
|
* @param encoded
|
|
6893
6983
|
*/
|
|
6894
6984
|
XhrFormData.prototype.assignEncodedString = function (encoded) {
|
|
6895
|
-
//
|
|
6896
|
-
//this code filters out empty strings as key value pairs
|
|
6985
|
+
// this code filters out empty strings as key value pairs
|
|
6897
6986
|
var keyValueEntries = decodeURIComponent(encoded).split(/&/gi)
|
|
6898
6987
|
.filter(function (item) { return !!(item || '')
|
|
6899
6988
|
.replace(/\s+/g, ''); });
|
|
6900
6989
|
this.assignString(keyValueEntries);
|
|
6901
6990
|
};
|
|
6991
|
+
/**
|
|
6992
|
+
* assign a set of key value pairs passed as array ['key=val1', 'key2=val2']
|
|
6993
|
+
* @param keyValueEntries
|
|
6994
|
+
*/
|
|
6902
6995
|
XhrFormData.prototype.assignString = function (keyValueEntries) {
|
|
6903
6996
|
var toMerge = new mona_dish_1.Config({});
|
|
6904
6997
|
function splitToKeyVal(line) {
|
|
@@ -6908,7 +7001,7 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6908
7001
|
var _a, _b;
|
|
6909
7002
|
return keyVal.length < 3 ? [(_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal[0]) !== null && _a !== void 0 ? _a : [], (_b = keyVal === null || keyVal === void 0 ? void 0 : keyVal[1]) !== null && _b !== void 0 ? _b : []] : keyVal;
|
|
6910
7003
|
}
|
|
6911
|
-
|
|
7004
|
+
mona_dish_1.Stream.of.apply(mona_dish_1.Stream, keyValueEntries).map(function (line) { return splitToKeyVal(line); })
|
|
6912
7005
|
//special case of having keys without values
|
|
6913
7006
|
.map(function (keyVal) { return fixKeyWithoutVal(keyVal); })
|
|
6914
7007
|
.each(function (keyVal) {
|
|
@@ -6918,28 +7011,12 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6918
7011
|
//merge with overwrite but no append! (aka no double entries are allowed)
|
|
6919
7012
|
this.shallowMerge(toMerge);
|
|
6920
7013
|
};
|
|
6921
|
-
// noinspection JSUnusedGlobalSymbols
|
|
6922
7014
|
/**
|
|
6923
|
-
* @returns a Form data representation
|
|
7015
|
+
* @returns a Form data representation, this is needed for file submits
|
|
6924
7016
|
*/
|
|
6925
7017
|
XhrFormData.prototype.toFormData = function () {
|
|
6926
|
-
var _this = this;
|
|
6927
7018
|
var ret = new FormData();
|
|
6928
|
-
|
|
6929
|
-
.each(function (key) {
|
|
6930
|
-
mona_dish_2.Stream.of.apply(mona_dish_2.Stream, _this.value[key]).each(function (item) { return ret.append(key, item); });
|
|
6931
|
-
});
|
|
6932
|
-
mona_dish_2.Stream.of.apply(mona_dish_2.Stream, Object.keys(this.fileInputs)).each(function (key) {
|
|
6933
|
-
mona_dish_2.DQ.querySelectorAllDeep("[name='".concat(key, "'], [id=\"").concat(key, "\"]")).eachElem(function (elem) {
|
|
6934
|
-
var _a;
|
|
6935
|
-
var identifier = _this.resolveSubmitIdentifier(elem);
|
|
6936
|
-
if (!((_a = elem === null || elem === void 0 ? void 0 : elem.files) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
6937
|
-
ret.append(identifier, elem.value);
|
|
6938
|
-
return;
|
|
6939
|
-
}
|
|
6940
|
-
ret.append(identifier, elem.files[0]);
|
|
6941
|
-
});
|
|
6942
|
-
});
|
|
7019
|
+
this.appendInputs(ret);
|
|
6943
7020
|
return ret;
|
|
6944
7021
|
};
|
|
6945
7022
|
XhrFormData.prototype.resolveSubmitIdentifier = function (elem) {
|
|
@@ -6960,13 +7037,44 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6960
7037
|
return defaultStr;
|
|
6961
7038
|
}
|
|
6962
7039
|
var entries = mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, Object.keys(this.value)).filter(function (key) { return _this.value.hasOwnProperty(key); })
|
|
6963
|
-
.flatMap(function (key) { return
|
|
7040
|
+
.flatMap(function (key) { return mona_dish_1.Stream.of.apply(mona_dish_1.Stream, _this.value[key]).map(function (val) { return [key, val]; }).collect(new mona_dish_1.ArrayCollector()); })
|
|
6964
7041
|
.map(function (keyVal) {
|
|
6965
7042
|
return "".concat(encodeURIComponent(keyVal[0]), "=").concat(encodeURIComponent(keyVal[1]));
|
|
6966
7043
|
})
|
|
6967
7044
|
.collect(new mona_dish_1.ArrayCollector());
|
|
6968
7045
|
return entries.join("&");
|
|
6969
7046
|
};
|
|
7047
|
+
/**
|
|
7048
|
+
* helper to fetch all file inputs from as given root element
|
|
7049
|
+
* @param rootElement
|
|
7050
|
+
* @private
|
|
7051
|
+
*/
|
|
7052
|
+
XhrFormData.prototype.getFileInputs = function (rootElement) {
|
|
7053
|
+
var rootFileInputs = rootElement
|
|
7054
|
+
.filter(function (elem) { return elem.matchesSelector("input[type='file']"); });
|
|
7055
|
+
var childFileInputs = rootElement
|
|
7056
|
+
.querySelectorAll("input[type='file']");
|
|
7057
|
+
return rootFileInputs.concat(childFileInputs);
|
|
7058
|
+
};
|
|
7059
|
+
/**
|
|
7060
|
+
* encode the given fields and apply the view state
|
|
7061
|
+
* @private
|
|
7062
|
+
*/
|
|
7063
|
+
XhrFormData.prototype.applyFormDataToConfig = function () {
|
|
7064
|
+
//encode and append the issuing item if not a partial ids array of ids is passed
|
|
7065
|
+
/*
|
|
7066
|
+
* Spec. 13.3.1
|
|
7067
|
+
* Collect and encode input elements.
|
|
7068
|
+
* Additionally the hidden element javax.faces.ViewState
|
|
7069
|
+
* Enhancement partial page submit
|
|
7070
|
+
*
|
|
7071
|
+
*/
|
|
7072
|
+
this.encodeSubmittableFields(this, this.dataSource, this.partialIds);
|
|
7073
|
+
if (this.getIf(Const_1.P_VIEWSTATE).isPresent()) {
|
|
7074
|
+
return;
|
|
7075
|
+
}
|
|
7076
|
+
this.applyViewState(this.dataSource);
|
|
7077
|
+
};
|
|
6970
7078
|
/**
|
|
6971
7079
|
* determines fields to submit
|
|
6972
7080
|
* @param {Object} targetBuf - the target form buffer receiving the data
|
|
@@ -6975,33 +7083,26 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
6975
7083
|
*/
|
|
6976
7084
|
XhrFormData.prototype.encodeSubmittableFields = function (targetBuf, parentItem, partialIds) {
|
|
6977
7085
|
var toEncode = null;
|
|
6978
|
-
if (this.
|
|
6979
|
-
//in case of our myfaces reduced ppr we
|
|
6980
|
-
//only submit the partials
|
|
7086
|
+
if (this.partialIds && this.partialIds.length) {
|
|
7087
|
+
// in case of our myfaces reduced ppr we
|
|
7088
|
+
// only submit the partials
|
|
6981
7089
|
this._value = {};
|
|
6982
|
-
toEncode = new (
|
|
7090
|
+
toEncode = new (mona_dish_1.DQ.bind.apply(mona_dish_1.DQ, __spreadArray([void 0], this.partialIds, false)))();
|
|
6983
7091
|
}
|
|
6984
7092
|
else {
|
|
6985
7093
|
if (parentItem.isAbsent())
|
|
6986
|
-
throw
|
|
7094
|
+
throw 'NO_PAR_ITEM';
|
|
6987
7095
|
toEncode = parentItem;
|
|
6988
7096
|
}
|
|
6989
7097
|
//lets encode the form elements
|
|
6990
7098
|
this.shallowMerge(toEncode.deepElements.encodeFormElement());
|
|
6991
7099
|
};
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
*/
|
|
6999
|
-
get: function () {
|
|
7000
|
-
return !!Object.keys(this.fileInputs).length;
|
|
7001
|
-
},
|
|
7002
|
-
enumerable: false,
|
|
7003
|
-
configurable: true
|
|
7004
|
-
});
|
|
7100
|
+
XhrFormData.prototype.appendInputs = function (ret) {
|
|
7101
|
+
var _this = this;
|
|
7102
|
+
mona_dish_1.Stream.of.apply(mona_dish_1.Stream, Object.keys(this.value)).each(function (key) {
|
|
7103
|
+
mona_dish_1.Stream.of.apply(mona_dish_1.Stream, _this.value[key]).each(function (item) { return ret.append(key, item); });
|
|
7104
|
+
});
|
|
7105
|
+
};
|
|
7005
7106
|
return XhrFormData;
|
|
7006
7107
|
}(mona_dish_1.Config));
|
|
7007
7108
|
exports.XhrFormData = XhrFormData;
|
|
@@ -7052,6 +7153,7 @@ var XhrRequest = /** @class */ (function () {
|
|
|
7052
7153
|
*
|
|
7053
7154
|
* Optional Parameters
|
|
7054
7155
|
*
|
|
7156
|
+
* @param internalContext internal context with internal info which is passed through, not used by the user
|
|
7055
7157
|
* @param partialIdsArray an optional restricting partial ids array for encoding
|
|
7056
7158
|
* @param timeout optional xhr timeout
|
|
7057
7159
|
* @param ajaxType optional request type, default "POST"
|
|
@@ -7102,17 +7204,21 @@ var XhrRequest = /** @class */ (function () {
|
|
|
7102
7204
|
var viewState = jsf.getViewState(formElement);
|
|
7103
7205
|
//encoded we need to decode
|
|
7104
7206
|
//We generated a base representation of the current form
|
|
7105
|
-
var formData = new XhrFormData_1.XhrFormData(this.sourceForm);
|
|
7106
7207
|
//in case someone has overloaded the viewstate with addtional decorators we merge
|
|
7107
7208
|
//that in, there is no way around it, the spec allows it and getViewState
|
|
7108
7209
|
//must be called, so whatever getViewState delivers has higher priority then
|
|
7109
7210
|
//whatever the formData object delivers
|
|
7110
|
-
|
|
7111
|
-
|
|
7211
|
+
//the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
|
|
7212
|
+
//ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
|
|
7213
|
+
//anyway TODO remove the partial ids array
|
|
7214
|
+
var formData = new XhrFormData_1.XhrFormData(this.sourceForm, viewState, executesArr(), this.partialIdsArray);
|
|
7112
7215
|
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
7113
7216
|
//next step the pass through parameters are merged in for post params
|
|
7114
7217
|
var requestContext = this.requestContext;
|
|
7115
7218
|
var passThroughParams = requestContext.getIf(Const_1.CTX_PARAM_PASS_THR);
|
|
7219
|
+
// this is an extension where we allow pass through parameters to be sent down additionally
|
|
7220
|
+
// this can be used and is used in the impl to enrich the post request parameters with additional
|
|
7221
|
+
// information
|
|
7116
7222
|
formData.shallowMerge(passThroughParams, true, true);
|
|
7117
7223
|
this.responseContext = passThroughParams.deepCopy;
|
|
7118
7224
|
//we have to shift the internal passthroughs around to build up our response context
|
|
@@ -7133,7 +7239,7 @@ var XhrRequest = /** @class */ (function () {
|
|
|
7133
7239
|
ignoreErr(function () { return xhrObject.setRequestHeader(Const_1.HEAD_FACES_REQ, Const_1.VAL_AJAX); });
|
|
7134
7240
|
//probably not needed anymore, will test this
|
|
7135
7241
|
//some webkit based mobile browsers do not follow the w3c spec of
|
|
7136
|
-
// setting
|
|
7242
|
+
// setting, they accept headers automatically
|
|
7137
7243
|
ignoreErr(function () { return xhrObject.setRequestHeader(Const_1.REQ_ACCEPT, Const_1.STD_ACCEPT); });
|
|
7138
7244
|
this.sendEvent(Const_1.BEGIN);
|
|
7139
7245
|
this.sendRequest(formData);
|
|
@@ -7190,19 +7296,19 @@ var XhrRequest = /** @class */ (function () {
|
|
|
7190
7296
|
var _this = this;
|
|
7191
7297
|
var xhrObject = this.xhrObject;
|
|
7192
7298
|
xhrObject.onabort = function () {
|
|
7193
|
-
_this.onAbort(
|
|
7299
|
+
_this.onAbort(reject);
|
|
7194
7300
|
};
|
|
7195
7301
|
xhrObject.ontimeout = function () {
|
|
7196
|
-
_this.onTimeout(
|
|
7302
|
+
_this.onTimeout(reject);
|
|
7197
7303
|
};
|
|
7198
7304
|
xhrObject.onload = function () {
|
|
7199
|
-
_this.onSuccess(
|
|
7305
|
+
_this.onSuccess(resolve);
|
|
7200
7306
|
};
|
|
7201
7307
|
xhrObject.onloadend = function () {
|
|
7202
|
-
_this.onDone(_this.xhrObject, resolve
|
|
7308
|
+
_this.onDone(_this.xhrObject, resolve);
|
|
7203
7309
|
};
|
|
7204
7310
|
xhrObject.onerror = function (errorData) {
|
|
7205
|
-
_this.onError(errorData,
|
|
7311
|
+
_this.onError(errorData, reject);
|
|
7206
7312
|
};
|
|
7207
7313
|
};
|
|
7208
7314
|
/*
|
|
@@ -7211,24 +7317,24 @@ var XhrRequest = /** @class */ (function () {
|
|
|
7211
7317
|
* Those methods are the callbacks called by
|
|
7212
7318
|
* the xhr object depending on its own state
|
|
7213
7319
|
*/
|
|
7214
|
-
XhrRequest.prototype.onAbort = function (
|
|
7320
|
+
XhrRequest.prototype.onAbort = function (reject) {
|
|
7215
7321
|
reject();
|
|
7216
7322
|
};
|
|
7217
|
-
XhrRequest.prototype.onTimeout = function (
|
|
7323
|
+
XhrRequest.prototype.onTimeout = function (reject) {
|
|
7218
7324
|
this.sendEvent(Const_1.STATE_EVT_TIMEOUT);
|
|
7219
7325
|
reject();
|
|
7220
7326
|
};
|
|
7221
|
-
XhrRequest.prototype.onSuccess = function (
|
|
7327
|
+
XhrRequest.prototype.onSuccess = function (resolve) {
|
|
7222
7328
|
var _a, _b;
|
|
7223
7329
|
this.sendEvent(Const_1.COMPLETE);
|
|
7224
7330
|
//malforms always result in empty response xml
|
|
7225
7331
|
if (!((_a = this === null || this === void 0 ? void 0 : this.xhrObject) === null || _a === void 0 ? void 0 : _a.responseXML)) {
|
|
7226
|
-
this.handleMalFormedXML(resolve
|
|
7332
|
+
this.handleMalFormedXML(resolve);
|
|
7227
7333
|
return;
|
|
7228
7334
|
}
|
|
7229
7335
|
jsf.ajax.response(this.xhrObject, (_b = this.responseContext.value) !== null && _b !== void 0 ? _b : {});
|
|
7230
7336
|
};
|
|
7231
|
-
XhrRequest.prototype.handleMalFormedXML = function (resolve
|
|
7337
|
+
XhrRequest.prototype.handleMalFormedXML = function (resolve) {
|
|
7232
7338
|
var _a;
|
|
7233
7339
|
this.stopProgress = true;
|
|
7234
7340
|
var errorData = {
|
|
@@ -7250,16 +7356,27 @@ var XhrRequest = /** @class */ (function () {
|
|
|
7250
7356
|
}
|
|
7251
7357
|
//non blocking non clearing
|
|
7252
7358
|
};
|
|
7253
|
-
XhrRequest.prototype.onDone = function (data, resolve
|
|
7359
|
+
XhrRequest.prototype.onDone = function (data, resolve) {
|
|
7254
7360
|
if (this.stopProgress) {
|
|
7255
7361
|
return;
|
|
7256
7362
|
}
|
|
7257
7363
|
resolve(data);
|
|
7258
7364
|
};
|
|
7259
|
-
XhrRequest.prototype.onError = function (errorData,
|
|
7365
|
+
XhrRequest.prototype.onError = function (errorData, reject) {
|
|
7260
7366
|
this.handleError(errorData);
|
|
7261
7367
|
reject();
|
|
7262
7368
|
};
|
|
7369
|
+
XhrRequest.prototype.sendRequest = function (formData) {
|
|
7370
|
+
var isPost = this.ajaxType != Const_1.REQ_TYPE_GET;
|
|
7371
|
+
if (formData.isMultipartRequest) {
|
|
7372
|
+
//in case of a multipart request we send in a formData object as body
|
|
7373
|
+
this.xhrObject.send((isPost) ? formData.toFormData() : null);
|
|
7374
|
+
}
|
|
7375
|
+
else {
|
|
7376
|
+
//in case of a normal request we send it normally
|
|
7377
|
+
this.xhrObject.send((isPost) ? formData.toString() : null);
|
|
7378
|
+
}
|
|
7379
|
+
};
|
|
7263
7380
|
/*
|
|
7264
7381
|
* other helpers
|
|
7265
7382
|
*/
|
|
@@ -7284,17 +7401,6 @@ var XhrRequest = /** @class */ (function () {
|
|
|
7284
7401
|
var eventHandler = (0, RequestDataResolver_1.resolveHandlerFunc)(this.requestContext, this.responseContext, Const_1.ON_ERROR);
|
|
7285
7402
|
AjaxImpl_1.Implementation.sendError(errorData, eventHandler);
|
|
7286
7403
|
};
|
|
7287
|
-
XhrRequest.prototype.sendRequest = function (formData) {
|
|
7288
|
-
var isPost = this.ajaxType != Const_1.REQ_TYPE_GET;
|
|
7289
|
-
if (formData.isMultipartRequest) {
|
|
7290
|
-
//in case of a multipart request we send in a formData object as body
|
|
7291
|
-
this.xhrObject.send((isPost) ? formData.toFormData() : null);
|
|
7292
|
-
}
|
|
7293
|
-
else {
|
|
7294
|
-
//in case of a normal request we send it normally
|
|
7295
|
-
this.xhrObject.send((isPost) ? formData.toString() : null);
|
|
7296
|
-
}
|
|
7297
|
-
};
|
|
7298
7404
|
return XhrRequest;
|
|
7299
7405
|
}());
|
|
7300
7406
|
exports.XhrRequest = XhrRequest;
|