@entryscape/rdforms 10.13.0 → 10.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rdforms.bmd.js +1 -1
- package/dist/rdforms.bootstrap.js +1 -1
- package/dist/rdforms.jquery.js +5 -5
- package/dist/rdforms.node.js +1 -1
- package/dist/rdforms.react.js +1 -1
- package/package.json +1 -1
- package/src/template/ItemStore.js +5 -0
- package/src/template/bundleLoader.js +10 -8
- package/src/view/View.js +1 -0
- package/src/view/react/choiceEditors/ChoiceLookupAndInlineSearch.js +1 -0
- package/src/view/react/choiceEditors/ChoiceSelector.js +1 -0
- package/src/view/renderingContext.js +2 -0
package/package.json
CHANGED
|
@@ -265,6 +265,11 @@ export default class ItemStore {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
if (id != null) {
|
|
268
|
+
if (this._registry[id]) {
|
|
269
|
+
console.log(`RDForms conflict with item id ${id}, overwriting item from bundle "${
|
|
270
|
+
this._registry[id].getBundle()?.getPath() || ''}" with item from bundle "${
|
|
271
|
+
item.getBundle()?.getPath() || ''}".`);
|
|
272
|
+
}
|
|
268
273
|
this._registry[id] = item;
|
|
269
274
|
if (bundle != null) {
|
|
270
275
|
bundle.addItem(item);
|
|
@@ -18,7 +18,7 @@ const stopFetchingOrJustLog = (iteration, length, templateId) => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Return the first
|
|
21
|
+
* Return the first successfully fetched bundle from a list of urls or throw en error if none could be fetched
|
|
22
22
|
*
|
|
23
23
|
* @param {Array<String>} urls
|
|
24
24
|
* @returns {Promise<Response | never | void>}
|
|
@@ -27,14 +27,16 @@ const fetchBundle = async (urls) => {
|
|
|
27
27
|
const totalUrls = urls.length;
|
|
28
28
|
let response;
|
|
29
29
|
let bundle;
|
|
30
|
+
let path;
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
for (let i = 0; i < totalUrls; i++) {
|
|
33
34
|
// try to fetch the bundle, fails only if there's some network error. A 404 is not an error
|
|
35
|
+
path = urls[i];
|
|
34
36
|
try {
|
|
35
|
-
response = await fetch(
|
|
37
|
+
response = await fetch(path);
|
|
36
38
|
} catch (e) {
|
|
37
|
-
throw Error(`A network error ocurred while trying to fetch bundle ${
|
|
39
|
+
throw Error(`A network error ocurred while trying to fetch bundle ${path}`);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
// check if we got a 2xx
|
|
@@ -48,18 +50,18 @@ const fetchBundle = async (urls) => {
|
|
|
48
50
|
bundle = await response.json();
|
|
49
51
|
break;
|
|
50
52
|
} else {
|
|
51
|
-
throw new Error(`Failed fetching template ${
|
|
53
|
+
throw new Error(`Failed fetching template ${path}. Expected a JSON file and got ${contentType}`);
|
|
52
54
|
}
|
|
53
55
|
} catch (e) {
|
|
54
|
-
stopFetchingOrJustLog(i, totalUrls,
|
|
56
|
+
stopFetchingOrJustLog(i, totalUrls, path);
|
|
55
57
|
}
|
|
56
58
|
// got back something that's not a 2xx
|
|
57
59
|
} else {
|
|
58
|
-
stopFetchingOrJustLog(i, totalUrls,
|
|
60
|
+
stopFetchingOrJustLog(i, totalUrls, path);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
return bundle;
|
|
64
|
+
return {path, source: bundle};
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
/**
|
|
@@ -76,7 +78,7 @@ const promisifyBundles = bundles => bundles.map(bundle =>
|
|
|
76
78
|
* @param {ItemStore} itemStore
|
|
77
79
|
* @param {array} bundles
|
|
78
80
|
*/
|
|
79
|
-
const registerBundles = (itemStore, bundles = []) => bundles.map(
|
|
81
|
+
const registerBundles = (itemStore, bundles = []) => bundles.map(bundle => itemStore.registerBundle(bundle));
|
|
80
82
|
|
|
81
83
|
/**
|
|
82
84
|
*
|
package/src/view/View.js
CHANGED
|
@@ -11,6 +11,7 @@ export default class View {
|
|
|
11
11
|
constructor(params, srcNodeRef) {
|
|
12
12
|
this._viewId = viewCounter;
|
|
13
13
|
viewCounter += 1;
|
|
14
|
+
this.renderingParams = params.renderingParams || {};
|
|
14
15
|
this.locale = params.locale;
|
|
15
16
|
this.defaultTextLanguage = params.defaultTextLanguage;
|
|
16
17
|
this.messages = params.messages;
|
|
@@ -122,6 +122,7 @@ export default (props) => {
|
|
|
122
122
|
getOptionDisabled={option => option.mismatch === true}
|
|
123
123
|
renderInput={renderInput}
|
|
124
124
|
disablePortal
|
|
125
|
+
{...props.context.view.renderingParams.ChoiceLookupAndInlineSearch}
|
|
125
126
|
/>
|
|
126
127
|
<ShowButton {...props} onClick={showHandler} disabled={!!ngId}/>
|
|
127
128
|
{value && value.original.upgrade && (
|
|
@@ -328,6 +328,7 @@ const groupPresenter = (fieldDiv, binding, context) => {
|
|
|
328
328
|
// eslint-disable-next-line no-new
|
|
329
329
|
new Cls({
|
|
330
330
|
parentView: context.view,
|
|
331
|
+
renderingParams: context.view.renderingParams,
|
|
331
332
|
messages: context.view.messages,
|
|
332
333
|
binding,
|
|
333
334
|
topLevel: false,
|
|
@@ -350,6 +351,7 @@ const groupEditor = (fieldDiv, binding, context) => {
|
|
|
350
351
|
const Cls = context.view.constructor;
|
|
351
352
|
const subView = new Cls({
|
|
352
353
|
parentView: context.view,
|
|
354
|
+
renderingParams: context.view.renderingParams,
|
|
353
355
|
messages: context.view.messages,
|
|
354
356
|
languages: context.view.languages,
|
|
355
357
|
binding,
|