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
|
@@ -14,14 +14,17 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import {Config, DomQuery, DQ} from "mona-dish";
|
|
18
18
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
$faces,
|
|
20
|
+
$nsp,
|
|
21
|
+
CTX_OPTIONS_DELAY,
|
|
22
|
+
CTX_OPTIONS_TIMEOUT,
|
|
23
|
+
DELAY_NONE,
|
|
21
24
|
EMPTY_FUNC,
|
|
22
25
|
EMPTY_STR,
|
|
23
26
|
ENCODED_URL,
|
|
24
|
-
|
|
27
|
+
P_VIEWSTATE,
|
|
25
28
|
REQ_TYPE_GET,
|
|
26
29
|
REQ_TYPE_POST
|
|
27
30
|
} from "../core/Const";
|
|
@@ -69,20 +72,26 @@ export function resolveFinalUrl(sourceForm: DomQuery, formData: XhrFormData, aja
|
|
|
69
72
|
* it is either the id or the parent form of the element or an embedded form
|
|
70
73
|
* of the element
|
|
71
74
|
*
|
|
72
|
-
* @param requestCtx
|
|
73
75
|
* @param elem
|
|
74
76
|
* @param event
|
|
75
77
|
*/
|
|
76
|
-
export function resolveForm(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
export function resolveForm(elem: DQ, event: Event): DQ {
|
|
79
|
+
return ExtLang.getForm(elem.getAsElem(0).value, event);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function resolveViewId(form: DQ): string {
|
|
83
|
+
const viewState = form.querySelectorAll(`input[type='hidden'][name*='${$nsp(P_VIEWSTATE)}']`).id.orElse("").value;
|
|
84
|
+
const divider = $faces().separatorchar;
|
|
85
|
+
const viewId = viewState.split(divider, 2)[0];
|
|
86
|
+
if(viewId.indexOf($nsp(P_VIEWSTATE)) === -1) {
|
|
87
|
+
return viewId;
|
|
88
|
+
}
|
|
89
|
+
return "";
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
export function resolveTimeout(options: Config): number {
|
|
84
93
|
let getCfg = ExtLang.getLocalOrGlobalConfig;
|
|
85
|
-
return options.getIf(
|
|
94
|
+
return options.getIf(CTX_OPTIONS_TIMEOUT).value ?? getCfg(options.value, CTX_OPTIONS_TIMEOUT, 0);
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
/**
|
|
@@ -91,14 +100,12 @@ export function resolveTimeout(options: Config): number {
|
|
|
91
100
|
* @param options ... the options object, in most cases it will host the delay value
|
|
92
101
|
*/
|
|
93
102
|
export function resolveDelay(options: Config): number {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//
|
|
97
|
-
let ret = options.getIf(
|
|
103
|
+
// null, 'none', or undefined will automatically be mapped to 0 aka no delay
|
|
104
|
+
// the config delay will be dropped not needed anymore, it does not really
|
|
105
|
+
// make sense anymore now that it is part of a local spec
|
|
106
|
+
let ret = options.getIf(CTX_OPTIONS_DELAY).orElse(0).value;
|
|
98
107
|
// if delay === none, no delay must be used, aka delay 0
|
|
99
|
-
|
|
100
|
-
ret = 0;
|
|
101
|
-
}
|
|
108
|
+
ret = (DELAY_NONE === ret) ? 0 : ret;
|
|
102
109
|
// negative, or invalid values will automatically get a js exception
|
|
103
110
|
Assertions.assertDelay(ret);
|
|
104
111
|
return ret;
|
|
@@ -148,14 +155,15 @@ export function getEventTarget(evt: Event): Element {
|
|
|
148
155
|
* @param opts
|
|
149
156
|
* @param el
|
|
150
157
|
*/
|
|
151
|
-
export function resolveDefaults(event: Event, opts: Options | [[string, any]] , el: Element | string = null) {
|
|
158
|
+
export function resolveDefaults(event: Event, opts: Options | [[string, any]] , el: Element | string = null): any {
|
|
152
159
|
//deep copy the options, so that further transformations to not backfire into the callers
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
const elem = DQ.byId(el || <Element>event.target, true);
|
|
161
|
+
const options = new ExtConfig(opts).deepCopy as ExtConfig;
|
|
162
|
+
return {
|
|
163
|
+
options: options,
|
|
164
|
+
elem: elem,
|
|
165
|
+
elementId: elem.id.value,
|
|
166
|
+
windowId: resolveWindowId(options),
|
|
167
|
+
isResetValues: true === options.value?.resetValues
|
|
168
|
+
};
|
|
161
169
|
}
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
CTX_PARAM_SRC_FRM_ID,
|
|
26
26
|
SEL_RESPONSE_XML,
|
|
27
27
|
SOURCE,
|
|
28
|
-
|
|
28
|
+
HTML_TAG_FORM,
|
|
29
29
|
UPDATE_ELEMS,
|
|
30
30
|
UPDATE_FORMS,
|
|
31
31
|
DEFERRED_HEAD_INSERTS
|
|
@@ -106,9 +106,9 @@ export function resolveSourceForm(internalContext: Config, elem: DQ): DQ {
|
|
|
106
106
|
let sourceFormId = internalContext.getIf(CTX_PARAM_SRC_FRM_ID);
|
|
107
107
|
let sourceForm = new DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null);
|
|
108
108
|
|
|
109
|
-
sourceForm = sourceForm.orElseLazy(() => elem.firstParent(
|
|
110
|
-
.orElseLazy(() => elem.querySelectorAll(
|
|
111
|
-
.orElseLazy(() => DQ.querySelectorAll(
|
|
109
|
+
sourceForm = sourceForm.orElseLazy(() => elem.firstParent(HTML_TAG_FORM))
|
|
110
|
+
.orElseLazy(() => elem.querySelectorAll(HTML_TAG_FORM))
|
|
111
|
+
.orElseLazy(() => DQ.querySelectorAll(HTML_TAG_FORM));
|
|
112
112
|
|
|
113
113
|
return sourceForm;
|
|
114
114
|
}
|
|
@@ -20,23 +20,23 @@ import {ResponseProcessor} from "./ResponseProcessor";
|
|
|
20
20
|
import {IResponseProcessor} from "./IResponseProcessor";
|
|
21
21
|
import {
|
|
22
22
|
$nsp,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
XML_TAG_ATTRIBUTES,
|
|
24
|
+
XML_TAG_CHANGES,
|
|
25
|
+
XML_TAG_DELETE,
|
|
26
|
+
XML_TAG_ERROR,
|
|
27
|
+
XML_TAG_EVAL,
|
|
28
|
+
XML_TAG_EXTENSION,
|
|
29
|
+
XML_TAG_INSERT,
|
|
30
|
+
XML_TAG_REDIRECT,
|
|
31
|
+
XML_TAG_UPDATE, P_RESOURCE,
|
|
32
32
|
P_VIEWBODY,
|
|
33
33
|
P_VIEWHEAD,
|
|
34
34
|
P_VIEWROOT,
|
|
35
35
|
PARTIAL_ID,
|
|
36
|
-
|
|
36
|
+
XML_TAG_PARTIAL_RESP,
|
|
37
37
|
RESPONSE_XML,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
XML_TAG_AFTER,
|
|
39
|
+
XML_TAG_BEFORE
|
|
40
40
|
} from "../core/Const";
|
|
41
41
|
import {resolveContexts, resolveResponseXML} from "./ResonseDataResolver";
|
|
42
42
|
import {ExtConfig} from "../util/ExtDomQuery";
|
|
@@ -67,7 +67,7 @@ export module Response {
|
|
|
67
67
|
internalContext.assign(RESPONSE_XML).value = responseXML;
|
|
68
68
|
|
|
69
69
|
// we now process the partial tags, or in none given raise an error
|
|
70
|
-
responseXML.querySelectorAll(
|
|
70
|
+
responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP)
|
|
71
71
|
.each(item => processPartialTag(<XMLQuery>item, responseProcessor, internalContext));
|
|
72
72
|
|
|
73
73
|
// We now process the viewStates, client windows and the elements to be evaluated are delayed.
|
|
@@ -89,18 +89,18 @@ export module Response {
|
|
|
89
89
|
function processPartialTag(node: XMLQuery, responseProcessor: IResponseProcessor, internalContext) {
|
|
90
90
|
|
|
91
91
|
internalContext.assign(PARTIAL_ID).value = node.id;
|
|
92
|
-
const SEL_SUB_TAGS = [
|
|
92
|
+
const SEL_SUB_TAGS = [XML_TAG_ERROR, XML_TAG_REDIRECT, XML_TAG_CHANGES].join(",");
|
|
93
93
|
|
|
94
94
|
// now we can process the main operations
|
|
95
95
|
node.querySelectorAll(SEL_SUB_TAGS).each((node: XMLQuery) => {
|
|
96
96
|
switch (node.tagName.value) {
|
|
97
|
-
case
|
|
97
|
+
case XML_TAG_ERROR:
|
|
98
98
|
responseProcessor.error(node);
|
|
99
99
|
break;
|
|
100
|
-
case
|
|
100
|
+
case XML_TAG_REDIRECT:
|
|
101
101
|
responseProcessor.redirect(node);
|
|
102
102
|
break;
|
|
103
|
-
case
|
|
103
|
+
case XML_TAG_CHANGES:
|
|
104
104
|
processChangesTag(node, responseProcessor);
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
@@ -110,7 +110,7 @@ export module Response {
|
|
|
110
110
|
|
|
111
111
|
let processInsert = function (responseProcessor: IResponseProcessor, node: XMLQuery) {
|
|
112
112
|
// path1 insert after as child tags
|
|
113
|
-
if(node.querySelectorAll([
|
|
113
|
+
if(node.querySelectorAll([XML_TAG_BEFORE, XML_TAG_AFTER].join(",")).length) {
|
|
114
114
|
responseProcessor.insertWithSubTags(node);
|
|
115
115
|
} else { // insert before after with id
|
|
116
116
|
responseProcessor.insert(node);
|
|
@@ -125,31 +125,31 @@ export module Response {
|
|
|
125
125
|
* @param responseProcessor
|
|
126
126
|
*/
|
|
127
127
|
function processChangesTag(node: XMLQuery, responseProcessor: IResponseProcessor): boolean {
|
|
128
|
-
const ALLOWED_TAGS = [
|
|
128
|
+
const ALLOWED_TAGS = [XML_TAG_UPDATE, XML_TAG_EVAL, XML_TAG_INSERT, XML_TAG_DELETE, XML_TAG_ATTRIBUTES, XML_TAG_EXTENSION].join(", ");
|
|
129
129
|
node.querySelectorAll(ALLOWED_TAGS).each(
|
|
130
130
|
(node: XMLQuery) => {
|
|
131
131
|
switch (node.tagName.value) {
|
|
132
|
-
case
|
|
132
|
+
case XML_TAG_UPDATE:
|
|
133
133
|
processUpdateTag(node, responseProcessor);
|
|
134
134
|
break;
|
|
135
135
|
|
|
136
|
-
case
|
|
136
|
+
case XML_TAG_EVAL:
|
|
137
137
|
responseProcessor.eval(node);
|
|
138
138
|
break;
|
|
139
139
|
|
|
140
|
-
case
|
|
140
|
+
case XML_TAG_INSERT:
|
|
141
141
|
processInsert(responseProcessor, node);
|
|
142
142
|
break;
|
|
143
143
|
|
|
144
|
-
case
|
|
144
|
+
case XML_TAG_DELETE:
|
|
145
145
|
responseProcessor.delete(node);
|
|
146
146
|
break;
|
|
147
147
|
|
|
148
|
-
case
|
|
148
|
+
case XML_TAG_ATTRIBUTES:
|
|
149
149
|
responseProcessor.attributes(node);
|
|
150
150
|
break;
|
|
151
151
|
|
|
152
|
-
case
|
|
152
|
+
case XML_TAG_EXTENSION:
|
|
153
153
|
break;
|
|
154
154
|
}
|
|
155
155
|
}
|