jsf.js_next_gen 4.0.0-beta-23 → 4.0.0
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/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/README.md +7 -22
- package/dist/docs/assets/main.js +56 -52
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +23 -0
- package/dist/docs/functions/faces.ajax.addOnError.html +6 -4
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
- package/dist/docs/functions/faces.ajax.request.html +7 -7
- package/dist/docs/functions/faces.ajax.response.html +0 -1
- package/dist/docs/functions/faces.push.close.html +4 -2
- package/dist/docs/functions/faces.push.init.html +19 -7
- package/dist/docs/functions/faces.push.open.html +4 -2
- package/dist/docs/functions/faces.util.chain.html +3 -3
- package/dist/docs/functions/myfaces.ab.html +9 -4
- package/dist/docs/functions/myfaces.onOnDomReady.html +72 -0
- package/dist/docs/index.html +7 -18
- package/dist/docs/modules/myfaces.html +3 -1
- package/dist/docs/variables/myfaces.oam.html +2 -1
- package/dist/window/faces-development.js +2147 -1779
- 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 +17 -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 +2156 -1777
- 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 +17 -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 +19 -18
- package/pom.xml +1 -1
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +24 -7
- package/src/main/typescript/api/_api.ts +79 -37
- package/src/main/typescript/api/jsf.ts +18 -0
- package/src/main/typescript/impl/AjaxImpl.ts +168 -78
- package/src/main/typescript/impl/PushImpl.ts +63 -38
- package/src/main/typescript/impl/core/Const.ts +52 -39
- package/src/main/typescript/impl/util/Assertions.ts +16 -8
- package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
- package/src/main/typescript/impl/util/AsyncRunnable.ts +4 -4
- package/src/main/typescript/impl/util/ExtDomQuery.ts +58 -45
- package/src/main/typescript/impl/util/FileUtils.ts +104 -0
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
- package/src/main/typescript/impl/util/Lang.ts +30 -31
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
- package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +202 -131
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +79 -166
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -68
- package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +19 -22
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +108 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
- package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
- package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +242 -11
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +373 -35
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
- package/src/main/typescript/test.xml +6 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +72 -31
- package/target/api/_api.js.map +1 -1
- package/target/api/jsf.js +11 -0
- package/target/api/jsf.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 +144 -59
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +66 -35
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +51 -38
- 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 +12 -7
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +58 -40
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +96 -0
- package/target/impl/util/FileUtils.js.map +1 -0
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +79 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/impl/util/Lang.js +29 -30
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/URLCodec.js +77 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/util/XhrQueueController.js +82 -0
- package/target/impl/util/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/ErrorData.js +10 -8
- package/target/impl/xhrCore/ErrorData.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 +70 -23
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +44 -29
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +182 -116
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +68 -156
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrQueHandler.js +11 -0
- package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
- package/target/impl/xhrCore/XhrQueueController.js +62 -0
- package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/XhrRequest.js +68 -59
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +23 -14
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +16 -16
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +100 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.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/myfaces/OnLoadSpec.js +57 -0
- package/target/test/myfaces/OnLoadSpec.js.map +1 -0
- package/target/test/xhrCore/EventTests.spec.js +1 -1
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +217 -9
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +34 -2
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +308 -24
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
- package/target/test/xhrCore/XhrFormDataTest.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/tmp.xml +36 -0
- package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/target/types/index.js +0 -18
- package/target/types/index.js.map +0 -1
|
@@ -18,8 +18,8 @@ exports.XhrFormData = void 0;
|
|
|
18
18
|
*/
|
|
19
19
|
const mona_dish_1 = require("mona-dish");
|
|
20
20
|
const Const_1 = require("../core/Const");
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
const FileUtils_1 = require("../util/FileUtils");
|
|
22
|
+
const defaultParamsMapper = (key, item) => [key, item];
|
|
23
23
|
/**
|
|
24
24
|
* A unified form data class
|
|
25
25
|
* which builds upon our configuration.
|
|
@@ -28,22 +28,24 @@ const ExtDomQuery_1 = require("../util/ExtDomQuery");
|
|
|
28
28
|
* due to api constraints on the HTML Form object in IE11
|
|
29
29
|
* and due to the url encoding constraint given by the faces.js spec
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* internal storage format
|
|
33
|
+
* every value is stored as an array
|
|
34
|
+
* even scalar ones!
|
|
34
35
|
*/
|
|
35
36
|
class XhrFormData extends mona_dish_1.Config {
|
|
36
37
|
/**
|
|
37
38
|
* data collector from a given form
|
|
38
39
|
*
|
|
39
40
|
* @param dataSource either a form as DomQuery object or an encoded url string
|
|
40
|
-
* @param
|
|
41
|
+
* @param paramsMapper a remapper for the params keys and values
|
|
41
42
|
* @param executes the executes id list for the elements to being processed
|
|
42
43
|
* @param partialIds partial ids to collect, to reduce the data sent down
|
|
43
44
|
*/
|
|
44
|
-
constructor(dataSource,
|
|
45
|
+
constructor(dataSource, paramsMapper = defaultParamsMapper, executes, partialIds) {
|
|
45
46
|
super({});
|
|
46
47
|
this.dataSource = dataSource;
|
|
48
|
+
this.paramsMapper = paramsMapper;
|
|
47
49
|
this.partialIds = partialIds;
|
|
48
50
|
/**
|
|
49
51
|
* Checks if the given datasource is a multipart request source
|
|
@@ -53,106 +55,43 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
53
55
|
* instead of an encoded string files cannot be sent that way
|
|
54
56
|
*/
|
|
55
57
|
this.isMultipartRequest = false;
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.assignEncodedString(viewState);
|
|
67
|
-
}
|
|
68
|
-
if (executes) {
|
|
69
|
-
this.postInit(...executes);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* generic post init code, for now, this peforms some post assign data post processing
|
|
74
|
-
* @param executes
|
|
75
|
-
*/
|
|
76
|
-
postInit(...executes) {
|
|
77
|
-
let fetchInput = (id) => {
|
|
78
|
-
if (id == Const_1.IDENT_ALL) {
|
|
79
|
-
return mona_dish_1.DQ.querySelectorAllDeep("input[type='file']");
|
|
80
|
-
}
|
|
81
|
-
else if (id == Const_1.IDENT_FORM) {
|
|
82
|
-
return this.dataSource.querySelectorAllDeep("input[type='file']");
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
let element = mona_dish_1.DQ.byId(id, true);
|
|
86
|
-
return this.getFileInputs(element);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
let inputExists = (item) => {
|
|
90
|
-
return item.isPresent();
|
|
91
|
-
};
|
|
92
|
-
this.isMultipartRequest = mona_dish_1.LazyStream.of(...executes)
|
|
93
|
-
.map(fetchInput)
|
|
94
|
-
.filter(inputExists)
|
|
95
|
-
.first().isPresent();
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* special case view state handling
|
|
99
|
-
*
|
|
100
|
-
* @param form the form holding the view state value
|
|
101
|
-
*/
|
|
102
|
-
applyViewState(form) {
|
|
103
|
-
let viewState = form.byId(Const_1.P_VIEWSTATE, true).inputValue;
|
|
104
|
-
this.appendIf(viewState.isPresent(), Const_1.P_VIEWSTATE).value = viewState.value;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* assigns an url encoded string to this xhrFormData object
|
|
108
|
-
* as key value entry
|
|
109
|
-
* @param encoded
|
|
110
|
-
*/
|
|
111
|
-
assignEncodedString(encoded) {
|
|
112
|
-
// this code filters out empty strings as key value pairs
|
|
113
|
-
let keyValueEntries = decodeURIComponent(encoded).split(/&/gi)
|
|
114
|
-
.filter(item => !!(item || '')
|
|
115
|
-
.replace(/\s+/g, ''));
|
|
116
|
-
this.assignString(keyValueEntries);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* assign a set of key value pairs passed as array ['key=val1', 'key2=val2']
|
|
120
|
-
* @param keyValueEntries
|
|
121
|
-
*/
|
|
122
|
-
assignString(keyValueEntries) {
|
|
123
|
-
let toMerge = new ExtDomQuery_1.ExtConfig({});
|
|
124
|
-
function splitToKeyVal(line) {
|
|
125
|
-
return line.split(/=(.*)/gi);
|
|
126
|
-
}
|
|
127
|
-
function fixKeyWithoutVal(keyVal) {
|
|
128
|
-
var _a, _b;
|
|
129
|
-
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;
|
|
130
|
-
}
|
|
131
|
-
mona_dish_1.Stream.of(...keyValueEntries)
|
|
132
|
-
//split only the first =
|
|
133
|
-
.map(line => splitToKeyVal(line))
|
|
134
|
-
//special case of having keys without values
|
|
135
|
-
.map(keyVal => fixKeyWithoutVal(keyVal))
|
|
136
|
-
.each(keyVal => {
|
|
137
|
-
var _a, _b;
|
|
138
|
-
toMerge.append(keyVal[0]).value = (_b = (_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal.splice(1)) === null || _a === void 0 ? void 0 : _a.join("")) !== null && _b !== void 0 ? _b : "";
|
|
139
|
-
});
|
|
140
|
-
//merge with overwrite but no append! (aka no double entries are allowed)
|
|
141
|
-
this.shallowMerge(toMerge);
|
|
58
|
+
//encode and append the issuing item if not a partial ids array of ids is passed
|
|
59
|
+
/*
|
|
60
|
+
* Spec. 13.3.1
|
|
61
|
+
* Collect and encode input elements.
|
|
62
|
+
* Additionally the hidden element jakarta.faces.ViewState
|
|
63
|
+
* Enhancement partial page submit
|
|
64
|
+
*/
|
|
65
|
+
this.resolveRequestType(this.dataSource, executes);
|
|
66
|
+
this.encodeSubmittableFields(this.dataSource, this.partialIds);
|
|
67
|
+
this.applyViewState(this.dataSource);
|
|
142
68
|
}
|
|
143
69
|
/**
|
|
144
70
|
* @returns a Form data representation, this is needed for file submits
|
|
145
71
|
*/
|
|
146
72
|
toFormData() {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
73
|
+
/*
|
|
74
|
+
* expands key: [item1, item2]
|
|
75
|
+
* to: [{key: key, value: item1}, {key: key, value: item2}]
|
|
76
|
+
*/
|
|
77
|
+
let expandAssocArray = ([key, item]) => mona_dish_1.Stream.of(...item).map(value => {
|
|
78
|
+
return { key, value };
|
|
79
|
+
});
|
|
80
|
+
/*
|
|
81
|
+
* remaps the incoming {key, value} tuples
|
|
82
|
+
* to naming container prefixed keys and values
|
|
83
|
+
*/
|
|
84
|
+
let remapForNamingContainer = ({ key, value }) => {
|
|
85
|
+
key = this.remapKeyForNamingContainer(key);
|
|
86
|
+
return { key, value };
|
|
87
|
+
};
|
|
88
|
+
/*
|
|
89
|
+
* collects everything into a FormData object
|
|
90
|
+
*/
|
|
91
|
+
return mona_dish_1.Stream.ofAssoc(this.value)
|
|
92
|
+
.flatMap(expandAssocArray)
|
|
93
|
+
.map(remapForNamingContainer)
|
|
94
|
+
.collect(new mona_dish_1.FormDataCollector());
|
|
156
95
|
}
|
|
157
96
|
/**
|
|
158
97
|
* returns an encoded string representation of our xhr form data
|
|
@@ -160,48 +99,31 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
160
99
|
* @param defaultStr optional default value if nothing is there to encode
|
|
161
100
|
*/
|
|
162
101
|
toString(defaultStr = Const_1.EMPTY_STR) {
|
|
163
|
-
|
|
164
|
-
return defaultStr;
|
|
165
|
-
}
|
|
166
|
-
let entries = mona_dish_1.LazyStream.of(...Object.keys(this.value))
|
|
167
|
-
.filter(key => this.value.hasOwnProperty(key))
|
|
168
|
-
.flatMap(key => mona_dish_1.Stream.of(...this.value[key]).map(val => [key, val]).collect(new mona_dish_1.ArrayCollector()))
|
|
169
|
-
.map(keyVal => {
|
|
170
|
-
return `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
|
|
171
|
-
})
|
|
172
|
-
.collect(new mona_dish_1.ArrayCollector());
|
|
173
|
-
return entries.join("&");
|
|
102
|
+
return (0, FileUtils_1.encodeFormData)(this, this.paramsMapper, defaultStr);
|
|
174
103
|
}
|
|
175
104
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @param
|
|
178
|
-
*
|
|
105
|
+
* generic post init code, for now, this performs some post assign data post-processing
|
|
106
|
+
* @param executes the executable dom nodes which need to be processed into the form data, which we can send
|
|
107
|
+
* in our ajax request
|
|
179
108
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return rootFileInputs.concat(childFileInputs);
|
|
109
|
+
resolveRequestType(rootElement, executes) {
|
|
110
|
+
if (!executes || executes.indexOf(Const_1.IDENT_NONE) != -1) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.isMultipartRequest = rootElement.isMultipartCandidate(true);
|
|
186
114
|
}
|
|
187
115
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
116
|
+
* special case view state handling
|
|
117
|
+
*
|
|
118
|
+
* @param form the form holding the view state value
|
|
190
119
|
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
/*
|
|
194
|
-
* Spec. 13.3.1
|
|
195
|
-
* Collect and encode input elements.
|
|
196
|
-
* Additionally the hidden element jakarta.faces.ViewState
|
|
197
|
-
* Enhancement partial page submit
|
|
198
|
-
*
|
|
199
|
-
*/
|
|
200
|
-
this.encodeSubmittableFields(this, this.dataSource, this.partialIds);
|
|
201
|
-
if (this.getIf(Const_1.P_VIEWSTATE).isPresent()) {
|
|
120
|
+
applyViewState(form) {
|
|
121
|
+
if (this.getIf((0, Const_1.$nsp)(Const_1.P_VIEWSTATE)).isPresent()) {
|
|
202
122
|
return;
|
|
203
123
|
}
|
|
204
|
-
|
|
124
|
+
let viewStateElement = form.querySelectorAllDeep(`[name*='${(0, Const_1.$nsp)(Const_1.P_VIEWSTATE)}'`);
|
|
125
|
+
let viewState = viewStateElement.inputValue;
|
|
126
|
+
this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;
|
|
205
127
|
}
|
|
206
128
|
/**
|
|
207
129
|
* determines fields to submit
|
|
@@ -209,27 +131,17 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
209
131
|
* @param {Node} parentItem - form element item is nested in
|
|
210
132
|
* @param {Array} partialIds - ids fo PPS
|
|
211
133
|
*/
|
|
212
|
-
encodeSubmittableFields(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
else {
|
|
221
|
-
if (parentItem.isAbsent())
|
|
222
|
-
throw 'NO_PAR_ITEM';
|
|
223
|
-
toEncode = parentItem;
|
|
224
|
-
}
|
|
225
|
-
//lets encode the form elements
|
|
226
|
-
this.shallowMerge(toEncode.deepElements.encodeFormElement());
|
|
134
|
+
encodeSubmittableFields(parentItem, partialIds) {
|
|
135
|
+
const formInputs = (0, FileUtils_1.getFormInputsAsStream)(parentItem);
|
|
136
|
+
const mergeIntoThis = ([key, value]) => this.append(key).value = value;
|
|
137
|
+
const namingContainerRemap = ([key, value]) => this.paramsMapper(key, value);
|
|
138
|
+
formInputs
|
|
139
|
+
.map(FileUtils_1.fixEmmptyParameters)
|
|
140
|
+
.map(namingContainerRemap)
|
|
141
|
+
.each(mergeIntoThis);
|
|
227
142
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
.each(key => {
|
|
231
|
-
mona_dish_1.Stream.of(...this.value[key]).each(item => ret.append(key, item));
|
|
232
|
-
});
|
|
143
|
+
remapKeyForNamingContainer(key) {
|
|
144
|
+
return this.paramsMapper(key, "")[0];
|
|
233
145
|
}
|
|
234
146
|
}
|
|
235
147
|
exports.XhrFormData = XhrFormData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XhrFormData.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/xhrCore/XhrFormData.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,
|
|
1
|
+
{"version":3,"file":"XhrFormData.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/xhrCore/XhrFormData.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yCAAgE;AAChE,yCAAuE;AAEvE,iDAG2B;AAI3B,MAAM,mBAAmB,GAA8B,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAGlF;;;;;;;;;;;;GAYG;AACH,MAAa,WAAY,SAAQ,kBAAM;IAUnC;;;;;;;OAOG;IACH,YAAoB,UAAc,EAAU,eAA0C,mBAAmB,EAAE,QAAmB,EAAU,UAAqB;QACzJ,KAAK,CAAC,EAAE,CAAC,CAAC;QADM,eAAU,GAAV,UAAU,CAAI;QAAU,iBAAY,GAAZ,YAAY,CAAiD;QAA+B,eAAU,GAAV,UAAU,CAAW;QAjB7J;;;;;;WAMG;QACH,uBAAkB,GAAY,KAAK,CAAC;QAYhC,gFAAgF;QAChF;;;;;WAKG;QACH,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/D,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,UAAU;QACN;;;WAGG;QACH,IAAI,gBAAgB,GAAG,CAAC,CAAC,GAAG,EAAE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delay
|
|
5
|
+
-> push runnable into the queue
|
|
6
|
+
-> task running Y -> EOP
|
|
7
|
+
-> task running N -> trigger queue loop
|
|
8
|
+
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
let activeTimeout = null;
|
|
12
|
+
function debounce(runnable, timeout) {
|
|
13
|
+
if (!!activeTimeout) {
|
|
14
|
+
clearTimeout(activeTimeout);
|
|
15
|
+
}
|
|
16
|
+
if (timeout > 0) {
|
|
17
|
+
activeTimeout = setTimeout(() => {
|
|
18
|
+
try {
|
|
19
|
+
runnable();
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
clearTimeout(activeTimeout);
|
|
23
|
+
activeTimeout = null;
|
|
24
|
+
}
|
|
25
|
+
}, timeout);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
runnable();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class XhrQueueController {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.queue = [];
|
|
34
|
+
this.taskRunning = false;
|
|
35
|
+
document.body.addEventListener("xhrNext", () => this.next());
|
|
36
|
+
document.body.addEventListener("xhrClear", () => this.clear());
|
|
37
|
+
}
|
|
38
|
+
enqueue(request, timeOut) {
|
|
39
|
+
debounce(() => {
|
|
40
|
+
if (!this.taskRunning) {
|
|
41
|
+
this.signalTaskRunning();
|
|
42
|
+
request.start();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.queue.push(request);
|
|
46
|
+
}
|
|
47
|
+
}, timeOut);
|
|
48
|
+
}
|
|
49
|
+
signalTaskRunning() {
|
|
50
|
+
this.taskRunning = true;
|
|
51
|
+
}
|
|
52
|
+
next() {
|
|
53
|
+
const next = this.queue.shift();
|
|
54
|
+
this.taskRunning = !!this.queue.length;
|
|
55
|
+
next === null || next === void 0 ? void 0 : next.start();
|
|
56
|
+
}
|
|
57
|
+
clear() {
|
|
58
|
+
this.queue.length = 0;
|
|
59
|
+
this.taskRunning = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=XhrQueueController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XhrQueueController.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/xhrCore/XhrQueueController.ts"],"names":[],"mappings":";AAAA;;;;;;;EAOE;;AAOF,IAAI,aAAa,GAAG,IAAI,CAAC;AACzB,SAAS,QAAQ,CAAC,QAAQ,EAAE,OAAO;IAC/B,IAAG,CAAC,CAAC,aAAa,EAAE;QAChB,YAAY,CAAC,aAAa,CAAC,CAAC;KAC/B;IACD,IAAG,OAAO,GAAG,CAAC,EAAE;QACZ,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,IAAI;gBACJ,QAAQ,EAAE,CAAC;aACV;oBAAS;gBACN,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC5B,aAAa,GAAG,IAAI,CAAC;aACxB;QACL,CAAC,EAAE,OAAO,CAAC,CAAC;KACf;SAAM;QACH,QAAQ,EAAE,CAAC;KACd;AACL,CAAC;AAED,MAAM,kBAAkB;IAIpB;QAHA,UAAK,GAAG,EAAE,CAAC;QACX,gBAAW,GAAG,KAAK,CAAC;QAGhB,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7D,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,CAAC,OAAmB,EAAE,OAAe;QACxC,QAAQ,CAAC,GAAG,EAAE;YACV,IAAG,CAAC,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACzB,OAAO,CAAC,KAAK,EAAE,CAAC;aACnB;iBAAM;gBACH,IAAI,CAAC,KAAK,CAA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