jsf.js_next_gen 4.0.0-RC.13 → 4.0.0-RC.15
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/faces-development.js +344 -231
- 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.LICENSE.txt +0 -2
- 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 +344 -231
- 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.LICENSE.txt +0 -2
- 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 +4 -4
- package/src/main/typescript/@types/definitions/index.d.ts +2 -0
- package/src/main/typescript/api/_api.ts +2 -2
- package/src/main/typescript/impl/AjaxImpl.ts +78 -38
- package/src/main/typescript/impl/core/Const.ts +42 -38
- package/src/main/typescript/impl/util/Assertions.ts +2 -2
- package/src/main/typescript/impl/util/ExtDomQuery.ts +2 -2
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +63 -0
- package/src/main/typescript/impl/util/Lang.ts +8 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +35 -27
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +4 -4
- package/src/main/typescript/impl/xhrCore/Response.ts +25 -25
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +113 -121
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +1 -1
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +8 -7
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +19 -0
- package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -3
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +195 -0
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +2 -0
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +20 -13
- package/target/api/_api.js +1 -1
- package/target/api/_api.js.map +1 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/AjaxImpl.js +70 -29
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +43 -36
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/Context.js +10 -0
- package/target/impl/core/Context.js.map +1 -0
- package/target/impl/util/Assertions.js +1 -1
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +2 -2
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +58 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/impl/util/Lang.js +7 -9
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +1 -1
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestContext.js +11 -0
- package/target/impl/xhrCore/RequestContext.js.map +1 -0
- package/target/impl/xhrCore/RequestDataResolver.js +28 -18
- 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/Response.js +13 -13
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +94 -109
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +1 -1
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +7 -8
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +18 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +2 -2
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +2 -2
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +199 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +17 -13
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsf.js_next_gen",
|
|
3
|
-
"version": "4.0.0-RC.
|
|
3
|
+
"version": "4.0.0-RC.15",
|
|
4
4
|
"description": "A next generation typescript reimplementation of jsf.js",
|
|
5
5
|
"main": "dist/window/faces.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
24
24
|
"@types/chai": "^4.3.4",
|
|
25
|
-
"@types/mocha": "^10.0.
|
|
25
|
+
"@types/mocha": "^10.0.1",
|
|
26
26
|
"@types/node": "^18.11.9",
|
|
27
27
|
"@types/sinon": "^10.0.13",
|
|
28
28
|
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"nyc": "^15.1.0",
|
|
38
38
|
"replace-in-file": "^6.3.5",
|
|
39
39
|
"rxjs": "^7.5.7",
|
|
40
|
-
"sinon": "^
|
|
40
|
+
"sinon": "^15.0.0",
|
|
41
41
|
"terser-webpack-plugin": "^5.3.6",
|
|
42
42
|
"ts-loader": "^9.4.1",
|
|
43
43
|
"ts-node": "^10.9.1",
|
|
@@ -48,6 +48,6 @@
|
|
|
48
48
|
"webpack-dev-server": "^4.11.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"mona-dish": "^0.23.
|
|
51
|
+
"mona-dish": "^0.23.10"
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import {Implementation} from "../impl/AjaxImpl";
|
|
17
17
|
import {PushImpl} from "../impl/PushImpl";
|
|
18
18
|
import {oam as _oam} from "../myfaces/OamSubmit";
|
|
19
|
-
import {$nsp,
|
|
19
|
+
import {$nsp, CTX_OPTIONS_EXECUTE, CTX_PARAM_RENDER, P_BEHAVIOR_EVENT} from "../impl/core/Const";
|
|
20
20
|
import {ErrorData} from "../impl/xhrCore/ErrorData";
|
|
21
21
|
import {EventData} from "../impl/xhrCore/EventData";
|
|
22
22
|
|
|
@@ -257,7 +257,7 @@ export module myfaces {
|
|
|
257
257
|
options[$nsp(P_BEHAVIOR_EVENT)] = eventName;
|
|
258
258
|
}
|
|
259
259
|
if (execute) {
|
|
260
|
-
options[
|
|
260
|
+
options[CTX_OPTIONS_EXECUTE] = execute;
|
|
261
261
|
}
|
|
262
262
|
if (render) {
|
|
263
263
|
options[CTX_PARAM_RENDER] = render;
|
|
@@ -21,17 +21,16 @@ import {AsynchronousQueue} from "./util/AsyncQueue";
|
|
|
21
21
|
import {AssocArrayCollector, Config, DQ, Lang, LazyStream, Optional, Stream} from "mona-dish";
|
|
22
22
|
import {Assertions} from "./util/Assertions";
|
|
23
23
|
import {XhrFormData} from "./xhrCore/XhrFormData";
|
|
24
|
-
import {ExtDomQuery} from "./util/ExtDomQuery";
|
|
24
|
+
import {ExtConfig, ExtDomQuery} from "./util/ExtDomQuery";
|
|
25
25
|
import {ErrorData} from "./xhrCore/ErrorData";
|
|
26
26
|
import {EventData} from "./xhrCore/EventData";
|
|
27
27
|
import {ExtLang} from "./util/Lang";
|
|
28
28
|
|
|
29
29
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
CTX_OPTIONS_EXECUTE,
|
|
31
|
+
CTX_PARAM_REQ_PASS_THR,
|
|
32
32
|
CTX_PARAM_SRC_CTL_ID,
|
|
33
33
|
CTX_PARAM_SRC_FRM_ID,
|
|
34
|
-
CTX_PARAM_TR_TYPE,
|
|
35
34
|
IDENT_ALL,
|
|
36
35
|
IDENT_FORM,
|
|
37
36
|
IDENT_NONE,
|
|
@@ -48,15 +47,14 @@ import {
|
|
|
48
47
|
P_RESET_VALUES,
|
|
49
48
|
P_WINDOW_ID,
|
|
50
49
|
CTX_PARAM_RENDER,
|
|
51
|
-
REQ_TYPE_POST,
|
|
52
50
|
SOURCE,
|
|
53
|
-
|
|
51
|
+
HTML_TAG_FORM, CTX_OPTIONS_PARAMS, VIEW_ID, $faces, EMPTY_STR
|
|
54
52
|
} from "./core/Const";
|
|
55
53
|
import {
|
|
56
54
|
resolveDefaults,
|
|
57
55
|
resolveDelay,
|
|
58
56
|
resolveForm,
|
|
59
|
-
resolveTimeout
|
|
57
|
+
resolveTimeout, resolveViewId
|
|
60
58
|
} from "./xhrCore/RequestDataResolver";
|
|
61
59
|
|
|
62
60
|
/*
|
|
@@ -243,15 +241,14 @@ export module Implementation {
|
|
|
243
241
|
export function request(el: ElemDef, event?: Event, opts ?: Options) {
|
|
244
242
|
|
|
245
243
|
const {
|
|
246
|
-
resolvedEvent,
|
|
247
244
|
options,
|
|
248
245
|
elem,
|
|
249
246
|
elementId,
|
|
250
|
-
requestCtx,
|
|
251
|
-
internalCtx,
|
|
252
247
|
windowId,
|
|
253
248
|
isResetValues
|
|
254
249
|
} = resolveDefaults(event, opts, el);
|
|
250
|
+
const requestCtx = new ExtConfig({});
|
|
251
|
+
const internalCtx = new ExtConfig({});
|
|
255
252
|
|
|
256
253
|
Assertions.assertRequestIntegrity(options, elem);
|
|
257
254
|
|
|
@@ -262,7 +259,8 @@ export module Implementation {
|
|
|
262
259
|
* so that people can use dummy forms and work
|
|
263
260
|
* with detached objects
|
|
264
261
|
*/
|
|
265
|
-
const form: DQ = resolveForm(
|
|
262
|
+
const form: DQ = resolveForm(elem, event);
|
|
263
|
+
const viewId: string = resolveViewId(form);
|
|
266
264
|
const formId = form.id.value;
|
|
267
265
|
const delay: number = resolveDelay(options);
|
|
268
266
|
const timeout: number = resolveTimeout(options);
|
|
@@ -270,12 +268,12 @@ export module Implementation {
|
|
|
270
268
|
requestCtx.assignIf(!!windowId, P_WINDOW_ID).value = windowId;
|
|
271
269
|
|
|
272
270
|
// old non spec behavior will be removed after it is clear whether the removal breaks any code
|
|
273
|
-
requestCtx.assign(
|
|
271
|
+
requestCtx.assign(CTX_PARAM_REQ_PASS_THR).value = extractLegacyParams(options.value);
|
|
274
272
|
|
|
275
273
|
// spec conform behavior, all passthrough params must be under "passthrough
|
|
276
|
-
const params = remapArrayToAssocArr(options.getIf(
|
|
277
|
-
requestCtx.getIf(
|
|
278
|
-
requestCtx.assignIf(!!
|
|
274
|
+
const params = remapArrayToAssocArr(options.getIf(CTX_OPTIONS_PARAMS).orElse({}).value);
|
|
275
|
+
requestCtx.getIf(CTX_PARAM_REQ_PASS_THR).shallowMerge(new Config(params), true);
|
|
276
|
+
requestCtx.assignIf(!!event, CTX_PARAM_REQ_PASS_THR, P_EVT).value = event?.type;
|
|
279
277
|
|
|
280
278
|
/**
|
|
281
279
|
* ajax pass through context with the source
|
|
@@ -283,6 +281,8 @@ export module Implementation {
|
|
|
283
281
|
*/
|
|
284
282
|
requestCtx.assign(SOURCE).value = elementId;
|
|
285
283
|
|
|
284
|
+
requestCtx.assign(VIEW_ID).value = viewId;
|
|
285
|
+
|
|
286
286
|
/**
|
|
287
287
|
* on resolvedEvent and onError...
|
|
288
288
|
* those values will be traversed later on
|
|
@@ -299,12 +299,12 @@ export module Implementation {
|
|
|
299
299
|
/**
|
|
300
300
|
* binding contract the jakarta.faces.source must be set
|
|
301
301
|
*/
|
|
302
|
-
requestCtx.assign(
|
|
302
|
+
requestCtx.assign(CTX_PARAM_REQ_PASS_THR, P_PARTIAL_SOURCE).value = elementId;
|
|
303
303
|
|
|
304
304
|
/**
|
|
305
305
|
* jakarta.faces.partial.ajax must be set to true
|
|
306
306
|
*/
|
|
307
|
-
requestCtx.assign(
|
|
307
|
+
requestCtx.assign(CTX_PARAM_REQ_PASS_THR, P_AJAX).value = true;
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
310
|
* if resetValues is set to true
|
|
@@ -313,7 +313,7 @@ export module Implementation {
|
|
|
313
313
|
* the value has to be explicitly true, according to
|
|
314
314
|
* the specs jsdoc
|
|
315
315
|
*/
|
|
316
|
-
requestCtx.assignIf(isResetValues,
|
|
316
|
+
requestCtx.assignIf(isResetValues, CTX_PARAM_REQ_PASS_THR, P_RESET_VALUES).value = true;
|
|
317
317
|
|
|
318
318
|
// additional meta information to speed things up, note internal non jsf
|
|
319
319
|
// pass through options are stored under _mfInternal in the context
|
|
@@ -324,9 +324,8 @@ export module Implementation {
|
|
|
324
324
|
// mojarra under blackbox conditions.
|
|
325
325
|
// I assume it does the same as our formId_submit=1 so leaving it out
|
|
326
326
|
// won't hurt but for the sake of compatibility we are going to add it
|
|
327
|
-
requestCtx.assign(
|
|
327
|
+
requestCtx.assign(CTX_PARAM_REQ_PASS_THR, formId).value = formId;
|
|
328
328
|
internalCtx.assign(CTX_PARAM_SRC_CTL_ID).value = elementId;
|
|
329
|
-
internalCtx.assign(CTX_PARAM_TR_TYPE).value = REQ_TYPE_POST;
|
|
330
329
|
|
|
331
330
|
assignClientWindowId(form, requestCtx);
|
|
332
331
|
assignExecute(options, requestCtx, form, elementId);
|
|
@@ -512,7 +511,7 @@ export module Implementation {
|
|
|
512
511
|
*/
|
|
513
512
|
|
|
514
513
|
let element: DQ = DQ.byId(form, true);
|
|
515
|
-
if (!element.isTag(
|
|
514
|
+
if (!element.isTag(HTML_TAG_FORM)) {
|
|
516
515
|
throw new Error(getMessage("ERR_VIEWSTATE"));
|
|
517
516
|
}
|
|
518
517
|
|
|
@@ -553,7 +552,7 @@ export module Implementation {
|
|
|
553
552
|
*/
|
|
554
553
|
function assignRender(requestOptions: Config, targetContext: Config, issuingForm: DQ, sourceElementId: string) {
|
|
555
554
|
if (requestOptions.getIf(CTX_PARAM_RENDER).isPresent()) {
|
|
556
|
-
remapDefaultConstants(targetContext.getIf(
|
|
555
|
+
remapDefaultConstants(targetContext.getIf(CTX_PARAM_REQ_PASS_THR).get({}), P_RENDER, <string>requestOptions.getIf(CTX_PARAM_RENDER).value, issuingForm, <any>sourceElementId, targetContext.getIf(VIEW_ID).value);
|
|
557
556
|
}
|
|
558
557
|
}
|
|
559
558
|
|
|
@@ -571,15 +570,15 @@ export module Implementation {
|
|
|
571
570
|
*/
|
|
572
571
|
function assignExecute(requestOptions: Config, targetContext: Config, issuingForm: DQ, sourceElementId: string) {
|
|
573
572
|
|
|
574
|
-
if (requestOptions.getIf(
|
|
573
|
+
if (requestOptions.getIf(CTX_OPTIONS_EXECUTE).isPresent()) {
|
|
575
574
|
/*the options must be a blank delimited list of strings*/
|
|
576
575
|
/*compliance with Mojarra which automatically adds @this to an execute
|
|
577
576
|
* the spec rev 2.0a however states, if none is issued nothing at all should be sent down
|
|
578
577
|
*/
|
|
579
|
-
requestOptions.assign(
|
|
580
|
-
remapDefaultConstants(targetContext.getIf(
|
|
578
|
+
requestOptions.assign(CTX_OPTIONS_EXECUTE).value = [requestOptions.getIf(CTX_OPTIONS_EXECUTE).value, IDENT_THIS].join(" ");
|
|
579
|
+
remapDefaultConstants(targetContext.getIf(CTX_PARAM_REQ_PASS_THR).get({}), P_EXECUTE, <string>requestOptions.getIf(CTX_OPTIONS_EXECUTE).value, issuingForm, <any>sourceElementId, targetContext.getIf(VIEW_ID).value);
|
|
581
580
|
} else {
|
|
582
|
-
targetContext.assign(
|
|
581
|
+
targetContext.assign(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).value = sourceElementId;
|
|
583
582
|
}
|
|
584
583
|
}
|
|
585
584
|
|
|
@@ -591,16 +590,16 @@ export module Implementation {
|
|
|
591
590
|
*/
|
|
592
591
|
function assignClientWindowId(form: DQ, targetContext: Config) {
|
|
593
592
|
|
|
594
|
-
let clientWindow = (
|
|
593
|
+
let clientWindow = $faces().getClientWindow(form.getAsElem(0).value);
|
|
595
594
|
if (clientWindow) {
|
|
596
|
-
targetContext.assign(
|
|
595
|
+
targetContext.assign(CTX_PARAM_REQ_PASS_THR, P_CLIENT_WINDOW).value = clientWindow;
|
|
597
596
|
}
|
|
598
597
|
}
|
|
599
598
|
|
|
600
599
|
/**
|
|
601
600
|
* transforms the user values to the expected one
|
|
602
601
|
* with the proper none all form and this handling
|
|
603
|
-
* (note we also could use a simple string replace but then
|
|
602
|
+
* (note we also could use a simple string replace, but then
|
|
604
603
|
* we would have had double entries under some circumstances)
|
|
605
604
|
*
|
|
606
605
|
* there are several standardized constants which need a special treatment
|
|
@@ -611,14 +610,55 @@ export module Implementation {
|
|
|
611
610
|
* @param userValues the passed user values (aka input string which needs to be transformed)
|
|
612
611
|
* @param issuingForm the form where the issuing element originates
|
|
613
612
|
* @param issuingElementId the issuing element
|
|
613
|
+
* @param rootNamingContainerId the naming container id ("" default if none is given)
|
|
614
614
|
*/
|
|
615
|
-
function remapDefaultConstants(targetConfig: Config, targetKey: string, userValues: string, issuingForm: DQ, issuingElementId: string): Config {
|
|
615
|
+
function remapDefaultConstants(targetConfig: Config, targetKey: string, userValues: string, issuingForm: DQ, issuingElementId: string, rootNamingContainerId: string = ""): Config {
|
|
616
616
|
//a cleaner implementation of the transform list method
|
|
617
|
-
|
|
617
|
+
const SEP = $faces().separatorchar;
|
|
618
618
|
let iterValues: string[] = (userValues) ? trim(userValues).split(/\s+/gi) : [];
|
|
619
619
|
let ret = [];
|
|
620
620
|
let processed: {[key: string]: boolean} = {};
|
|
621
621
|
|
|
622
|
+
/**
|
|
623
|
+
* remaps the client ids for the portlet case so that the server
|
|
624
|
+
* can deal with them either prefixed ir not
|
|
625
|
+
* also resolves the absolute id case (it was assumed the server does this, but
|
|
626
|
+
* apparently the RI does not, so we have to follow the RI behavior here)
|
|
627
|
+
* @param componentIdToTransform the componentId which needs post processing
|
|
628
|
+
*/
|
|
629
|
+
const remapNamingContainer = componentIdToTransform => {
|
|
630
|
+
// pattern :<anything> must be prepended by viewRoot if there is one,
|
|
631
|
+
// otherwise we are in a not namespaced then only the id has to match
|
|
632
|
+
const rootNamingContainerPrefix = (rootNamingContainerId.length) ? rootNamingContainerId+SEP : EMPTY_STR;
|
|
633
|
+
let formClientId = issuingForm.id.value;
|
|
634
|
+
// nearest parent naming container relative to the form
|
|
635
|
+
const nearestNamingContainer = formClientId.substring(0, formClientId.lastIndexOf(SEP));
|
|
636
|
+
const nearestNamingContainerPrefix = (nearestNamingContainer.length) ? nearestNamingContainer + SEP : EMPTY_STR;
|
|
637
|
+
// Absolute search expressions, always start with SEP or the name of the root naming container
|
|
638
|
+
const hasLeadingSep = componentIdToTransform.indexOf(SEP) === 0;
|
|
639
|
+
const isAbsolutSearchExpr = hasLeadingSep || (rootNamingContainerId.length
|
|
640
|
+
&& componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0);
|
|
641
|
+
|
|
642
|
+
if (isAbsolutSearchExpr) {
|
|
643
|
+
//we cut off the leading sep if there is one
|
|
644
|
+
componentIdToTransform = hasLeadingSep ? componentIdToTransform.substring(1) : componentIdToTransform;
|
|
645
|
+
componentIdToTransform = componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0 ? componentIdToTransform.substring(rootNamingContainerPrefix.length) : componentIdToTransform;
|
|
646
|
+
//now we prepend either the prefix or "" from the cut-off string to get the final result
|
|
647
|
+
return [rootNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR);
|
|
648
|
+
} else { //relative search according to the javadoc
|
|
649
|
+
//we cut off the root naming container id from the form
|
|
650
|
+
if (formClientId.indexOf(rootNamingContainerPrefix) == 0) {
|
|
651
|
+
formClientId = formClientId.substring(rootNamingContainerPrefix.length);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
//If prependId = true, the outer form id must be present in the id if same form
|
|
655
|
+
let hasPrependId = componentIdToTransform.indexOf(formClientId) == 0;
|
|
656
|
+
return hasPrependId ?
|
|
657
|
+
[rootNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR) :
|
|
658
|
+
[nearestNamingContainerPrefix, componentIdToTransform.substring(componentIdToTransform.lastIndexOf(SEP) + 1)].join(EMPTY_STR);
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
|
|
622
662
|
// in this case we do not use lazy stream because it wont bring any code reduction
|
|
623
663
|
// or speedup
|
|
624
664
|
for (let cnt = 0; cnt < iterValues.length; cnt++) {
|
|
@@ -636,39 +676,39 @@ export module Implementation {
|
|
|
636
676
|
return targetConfig;
|
|
637
677
|
//@form pushes the issuing form id into our list
|
|
638
678
|
case IDENT_FORM:
|
|
639
|
-
ret.push(issuingForm.id.value);
|
|
679
|
+
ret.push(remapNamingContainer(issuingForm.id.value));
|
|
640
680
|
processed[issuingForm.id.value] = true;
|
|
641
681
|
break;
|
|
642
682
|
//@this is replaced with the current issuing element id
|
|
643
683
|
case IDENT_THIS:
|
|
644
684
|
if (!(issuingElementId in processed)) {
|
|
645
|
-
ret.push(issuingElementId);
|
|
685
|
+
ret.push(remapNamingContainer(issuingElementId));
|
|
646
686
|
processed[issuingElementId] = true;
|
|
647
687
|
}
|
|
648
688
|
break;
|
|
649
689
|
default:
|
|
650
|
-
ret.push(iterValues[cnt]);
|
|
690
|
+
ret.push(remapNamingContainer(iterValues[cnt]));
|
|
651
691
|
processed[iterValues[cnt]] = true;
|
|
652
692
|
}
|
|
653
693
|
}
|
|
654
|
-
|
|
694
|
+
|
|
655
695
|
targetConfig.assign(targetKey).value = ret.join(" ");
|
|
656
696
|
return targetConfig;
|
|
657
697
|
}
|
|
658
698
|
|
|
659
699
|
/**
|
|
660
700
|
* Filter the options given with a blacklist, so that only
|
|
661
|
-
* the values required for
|
|
701
|
+
* the values required for params-through are processed in the ajax request
|
|
662
702
|
*
|
|
663
703
|
* Note this is a bug carried over from the old implementation
|
|
664
704
|
* the spec conform behavior is to use params for passthrough values
|
|
665
|
-
* this will be removed soon, after it is cleared up
|
|
705
|
+
* this will be removed soon, after it is cleared up whether removing
|
|
666
706
|
* it breaks any legacy code
|
|
667
707
|
*
|
|
668
708
|
* @param {Context} mappedOpts the options to be filtered
|
|
669
709
|
* @deprecated
|
|
670
710
|
*/
|
|
671
|
-
function
|
|
711
|
+
function extractLegacyParams(mappedOpts: Options): Context {
|
|
672
712
|
//we now can use the full code reduction given by our stream api
|
|
673
713
|
//to filter
|
|
674
714
|
return Stream.ofAssoc(mappedOpts)
|
|
@@ -17,8 +17,11 @@
|
|
|
17
17
|
/*
|
|
18
18
|
* [export const] constants
|
|
19
19
|
*/
|
|
20
|
+
|
|
21
|
+
|
|
20
22
|
export const P_PARTIAL_SOURCE = "jakarta.faces.source";
|
|
21
23
|
export const PARTIAL_ID = "partialId";
|
|
24
|
+
export const VIEW_ID = "myfaves.viewId";
|
|
22
25
|
export const P_VIEWSTATE = "jakarta.faces.ViewState";
|
|
23
26
|
export const P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
|
|
24
27
|
export const P_VIEWROOT = "jakarta.faces.ViewRoot";
|
|
@@ -91,21 +94,17 @@ export const SERVER_ERROR = "serverError";
|
|
|
91
94
|
export const CLIENT_ERROR = "clientError";
|
|
92
95
|
export const TIMEOUT_EVENT = "timeout";
|
|
93
96
|
|
|
94
|
-
export const
|
|
95
|
-
|
|
96
|
-
export const
|
|
97
|
-
export const
|
|
98
|
-
export const
|
|
99
|
-
export const
|
|
100
|
-
export const CTX_PARAM_SPEC_PARAMS = "params";
|
|
101
|
-
|
|
102
|
-
export const CTX_PARAM_DELAY = "delay";
|
|
103
|
-
export const CTX_PARAM_TIMEOUT = "timeout";
|
|
104
|
-
export const CTX_PARAM_RST = "resetValues";
|
|
105
|
-
export const CTX_PARAM_EXECUTE = "execute";
|
|
106
|
-
|
|
107
|
-
export const STAGE_DEVELOPMENT = "Development";
|
|
97
|
+
export const CTX_OPTIONS_PARAMS = "params";
|
|
98
|
+
export const CTX_OPTIONS_DELAY = "delay";
|
|
99
|
+
export const DELAY_NONE = 'none';
|
|
100
|
+
export const CTX_OPTIONS_TIMEOUT = "timeout";
|
|
101
|
+
export const CTX_OPTIONS_RESET = "resetValues";
|
|
102
|
+
export const CTX_OPTIONS_EXECUTE = "execute";
|
|
108
103
|
|
|
104
|
+
export const CTX_PARAM_MF_INTERNAL = "myfaces.internal";
|
|
105
|
+
export const CTX_PARAM_SRC_FRM_ID = "myfaces.source.formId";
|
|
106
|
+
export const CTX_PARAM_SRC_CTL_ID = "myfaces.source.controlId";
|
|
107
|
+
export const CTX_PARAM_REQ_PASS_THR = "myfaces.request.passThrough";
|
|
109
108
|
|
|
110
109
|
export const CONTENT_TYPE = "Content-Type";
|
|
111
110
|
export const HEAD_FACES_REQ = "Faces-Request";
|
|
@@ -122,13 +121,12 @@ export const MULTIPART = "multipart/form-data";
|
|
|
122
121
|
export const NO_TIMEOUT = 0;
|
|
123
122
|
export const STD_ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
|
|
124
123
|
|
|
125
|
-
export const
|
|
126
|
-
export const
|
|
127
|
-
export const
|
|
128
|
-
export const
|
|
129
|
-
export const
|
|
130
|
-
|
|
131
|
-
export const TAG_ATTR = "attribute";
|
|
124
|
+
export const HTML_TAG_HEAD = "HEAD";
|
|
125
|
+
export const HTML_TAG_FORM = "FORM";
|
|
126
|
+
export const HTML_TAG_BODY = "BODY";
|
|
127
|
+
export const HTML_TAG_LINK = "LINK";
|
|
128
|
+
export const HTML_TAG_SCRIPT = "SCRIPT";
|
|
129
|
+
export const HTML_TAG_STYLE = "STYLE";
|
|
132
130
|
|
|
133
131
|
|
|
134
132
|
export const SEL_VIEWSTATE_ELEM = "[name='" + P_VIEWSTATE + "']";
|
|
@@ -146,38 +144,40 @@ export const ATTR_VALUE = "value";
|
|
|
146
144
|
export const ATTR_ID = "id";
|
|
147
145
|
|
|
148
146
|
/*partial response types*/
|
|
149
|
-
export const
|
|
147
|
+
export const XML_TAG_PARTIAL_RESP = "partial-response";
|
|
150
148
|
|
|
151
149
|
/*partial commands*/
|
|
152
|
-
export const
|
|
153
|
-
export const
|
|
154
|
-
export const
|
|
155
|
-
export const
|
|
156
|
-
export const
|
|
157
|
-
export const
|
|
158
|
-
export const
|
|
159
|
-
export const
|
|
160
|
-
export const
|
|
150
|
+
export const XML_TAG_CHANGES = "changes";
|
|
151
|
+
export const XML_TAG_UPDATE = "update";
|
|
152
|
+
export const XML_TAG_DELETE = "delete";
|
|
153
|
+
export const XML_TAG_INSERT = "insert";
|
|
154
|
+
export const XML_TAG_EVAL = "eval";
|
|
155
|
+
export const XML_TAG_ERROR = "error";
|
|
156
|
+
export const XML_TAG_ATTRIBUTES = "attributes";
|
|
157
|
+
export const XML_TAG_EXTENSION = "extension";
|
|
158
|
+
export const XML_TAG_REDIRECT = "redirect";
|
|
159
|
+
export const XML_TAG_BEFORE = "before";
|
|
160
|
+
export const XML_TAG_AFTER = "after";
|
|
161
|
+
export const XML_TAG_ATTR = "attribute";
|
|
162
|
+
|
|
161
163
|
|
|
162
164
|
/*other constants*/
|
|
163
165
|
|
|
164
|
-
export const UPDATE_FORMS = "
|
|
165
|
-
export const UPDATE_ELEMS = "
|
|
166
|
+
export const UPDATE_FORMS = "myfaces.updateForms";
|
|
167
|
+
export const UPDATE_ELEMS = "myfaces.updateElems";
|
|
166
168
|
|
|
167
169
|
//we want the head elements to be processed before we process the body
|
|
168
170
|
//but after the inner html is done
|
|
169
|
-
export const DEFERRED_HEAD_INSERTS = "
|
|
171
|
+
export const DEFERRED_HEAD_INSERTS = "myfaces.headElems";
|
|
170
172
|
|
|
171
173
|
export const MYFACES = "myfaces";
|
|
172
174
|
|
|
173
|
-
export const SEL_SCRIPTS_STYLES = "script, style, link";
|
|
174
|
-
|
|
175
175
|
export const MF_NONE = "__mf_none__";
|
|
176
176
|
|
|
177
177
|
export const REASON_EXPIRED = "Expired";
|
|
178
178
|
|
|
179
|
-
export const APPLIED_VST = "appliedViewState";
|
|
180
|
-
export const APPLIED_CLIENT_WINDOW = "appliedClientWindow";
|
|
179
|
+
export const APPLIED_VST = "myfaces.appliedViewState";
|
|
180
|
+
export const APPLIED_CLIENT_WINDOW = "myfaces.appliedClientWindow";
|
|
181
181
|
|
|
182
182
|
export const RECONNECT_INTERVAL = 500;
|
|
183
183
|
export const MAX_RECONNECT_ATTEMPTS = 25;
|
|
@@ -192,6 +192,10 @@ export const UNKNOWN = "UNKNOWN";
|
|
|
192
192
|
* changed to a simple value passthrough
|
|
193
193
|
*/
|
|
194
194
|
|
|
195
|
+
export function $faces(): FacesAPI {
|
|
196
|
+
return (window?.faces ?? window?.jsf) as FacesAPI;
|
|
197
|
+
}
|
|
198
|
+
|
|
195
199
|
export function $nsp(inputNamespace?: any): any {
|
|
196
200
|
if((!inputNamespace) || !inputNamespace?.replace) {
|
|
197
201
|
return inputNamespace;
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
ON_ERROR,
|
|
24
24
|
ON_EVENT,
|
|
25
25
|
PHASE_PROCESS_RESPONSE,
|
|
26
|
-
|
|
26
|
+
XML_TAG_PARTIAL_RESP
|
|
27
27
|
} from "../core/Const";
|
|
28
28
|
import {ExtLang} from "./Lang";
|
|
29
29
|
|
|
@@ -60,7 +60,7 @@ export module Assertions {
|
|
|
60
60
|
export function assertValidXMLResponse(responseXML: XMLQuery) : void | never {
|
|
61
61
|
assert(!responseXML.isAbsent(), EMPTY_RESPONSE, PHASE_PROCESS_RESPONSE);
|
|
62
62
|
assert(!responseXML.isXMLParserError(), responseXML.parserErrorText(EMPTY_STR), PHASE_PROCESS_RESPONSE);
|
|
63
|
-
assert(responseXML.querySelectorAll(
|
|
63
|
+
assert(responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP).isPresent(), ERR_NO_PARTIAL_RESPONSE, PHASE_PROCESS_RESPONSE);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -201,8 +201,8 @@ export class ExtDomQuery extends DQ {
|
|
|
201
201
|
return true;
|
|
202
202
|
}
|
|
203
203
|
let reference = element.attr("href")
|
|
204
|
-
.
|
|
205
|
-
.
|
|
204
|
+
.orElseLazy(() => element.attr("src").value)
|
|
205
|
+
.orElseLazy(() => element.attr("rel").value);
|
|
206
206
|
|
|
207
207
|
if (!reference.isPresent()) {
|
|
208
208
|
return true;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
3
|
+
* this work for additional information regarding copyright ownership.
|
|
4
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
5
|
+
* (the "License"); you may not use this file except in compliance with
|
|
6
|
+
* the License. You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {DomQuery, DQ, DQ$} from "mona-dish";
|
|
19
|
+
import {$faces, $nsp, HTML_CLIENT_WINDOW, HTML_VIEWSTATE, P_CLIENT_WINDOW, P_VIEWSTATE} from "../core/Const";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Builder for hidden inputs.
|
|
23
|
+
* ATM only ViewState and Client window
|
|
24
|
+
* are supported (per spec)
|
|
25
|
+
*
|
|
26
|
+
* Improves readability in the response processor!
|
|
27
|
+
*/
|
|
28
|
+
export class HiddenInputBuilder {
|
|
29
|
+
private namingContainerId?: string;
|
|
30
|
+
private parent?: DomQuery;
|
|
31
|
+
private readonly name: string;
|
|
32
|
+
private readonly template: string;
|
|
33
|
+
|
|
34
|
+
constructor(private selector: string) {
|
|
35
|
+
const isViewState = selector.indexOf($nsp(P_VIEWSTATE)) != -1;
|
|
36
|
+
this.name = isViewState ? P_VIEWSTATE : P_CLIENT_WINDOW
|
|
37
|
+
this.template = isViewState ? HTML_VIEWSTATE : HTML_CLIENT_WINDOW
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
withNamingContainerId(namingContainer: string): HiddenInputBuilder {
|
|
41
|
+
this.namingContainerId = namingContainer;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
withParent(parent: DomQuery): HiddenInputBuilder {
|
|
46
|
+
this.parent = parent;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
build(): DomQuery {
|
|
52
|
+
//TODO naming container id?
|
|
53
|
+
const cnt = DQ$(`[name='${$nsp(this.name)}']`).length;
|
|
54
|
+
const SEP = $faces().separatorchar;
|
|
55
|
+
const newElement = DQ.fromMarkup($nsp(this.template));
|
|
56
|
+
newElement.id.value = ((this.namingContainerId?.length) ?
|
|
57
|
+
[this.namingContainerId, $nsp(this.name), cnt]:
|
|
58
|
+
[$nsp(this.name), cnt]).join(SEP);
|
|
59
|
+
|
|
60
|
+
this?.parent?.append(newElement);
|
|
61
|
+
return newElement;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*
|
|
16
|
-
* todo replace singleton with module definition
|
|
17
|
-
*
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
import {Lang as LangBase, Config, Optional, DomQuery, DQ, Stream} from "mona-dish";
|
|
21
19
|
import {Messages} from "../i18n/Messages";
|
|
22
|
-
import {EMPTY_STR,
|
|
20
|
+
import {EMPTY_STR, HTML_TAG_FORM} from "../core/Const";
|
|
23
21
|
import {getEventTarget} from "../xhrCore/RequestDataResolver";
|
|
24
22
|
|
|
25
23
|
|
|
@@ -162,23 +160,23 @@ export module ExtLang {
|
|
|
162
160
|
let queryElem = new DQ(elem);
|
|
163
161
|
let eventTarget = (event) ? new DQ(getEventTarget(event)) : DomQuery.absent;
|
|
164
162
|
|
|
165
|
-
if (queryElem.isTag(
|
|
163
|
+
if (queryElem.isTag(HTML_TAG_FORM)) {
|
|
166
164
|
return queryElem;
|
|
167
165
|
}
|
|
168
166
|
|
|
169
167
|
//html 5 for handling
|
|
170
|
-
if (queryElem.attr(
|
|
171
|
-
let formId = queryElem.attr(
|
|
168
|
+
if (queryElem.attr(HTML_TAG_FORM).isPresent()) {
|
|
169
|
+
let formId = queryElem.attr(HTML_TAG_FORM).value;
|
|
172
170
|
let foundForm = DQ.byId(formId, true);
|
|
173
171
|
if (foundForm.isPresent()) {
|
|
174
172
|
return foundForm;
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
175
|
|
|
178
|
-
let form = queryElem.firstParent(
|
|
179
|
-
.orElseLazy(() => queryElem.byTagName(
|
|
180
|
-
.orElseLazy(() => eventTarget.firstParent(
|
|
181
|
-
.orElseLazy(() => eventTarget.byTagName(
|
|
176
|
+
let form = queryElem.firstParent(HTML_TAG_FORM)
|
|
177
|
+
.orElseLazy(() => queryElem.byTagName(HTML_TAG_FORM, true))
|
|
178
|
+
.orElseLazy(() => eventTarget.firstParent(HTML_TAG_FORM))
|
|
179
|
+
.orElseLazy(() => eventTarget.byTagName(HTML_TAG_FORM))
|
|
182
180
|
.first();
|
|
183
181
|
|
|
184
182
|
assertFormExists(form);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import {Config, DQ} from "mona-dish";
|
|
17
|
-
import {BEGIN,
|
|
17
|
+
import {BEGIN, CTX_PARAM_REQ_PASS_THR, EVENT, P_PARTIAL_SOURCE, SOURCE} from "../core/Const";
|
|
18
18
|
|
|
19
19
|
export class EventData implements IEventData{
|
|
20
20
|
type: string;
|
|
@@ -33,7 +33,7 @@ export class EventData implements IEventData{
|
|
|
33
33
|
|
|
34
34
|
let sourceId: string = context.getIf(SOURCE)
|
|
35
35
|
.orElseLazy(() => context.getIf(P_PARTIAL_SOURCE).value)
|
|
36
|
-
.orElseLazy(() => context.getIf(
|
|
36
|
+
.orElseLazy(() => context.getIf(CTX_PARAM_REQ_PASS_THR, P_PARTIAL_SOURCE).value)
|
|
37
37
|
.value;
|
|
38
38
|
if (sourceId) {
|
|
39
39
|
eventData.source = DQ.byId(sourceId, true).first().value.value;
|