@entryscape/rdforms 10.8.0 → 10.8.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 +5 -5
- package/dist/rdforms.bootstrap.js +8 -8
- package/dist/rdforms.jquery.js +4 -4
- package/dist/rdforms.react.js +12 -12
- package/package.json +1 -1
- package/src/view/Editor.js +3 -0
- package/src/view/View.js +29 -4
package/package.json
CHANGED
package/src/view/Editor.js
CHANGED
|
@@ -28,6 +28,9 @@ const showNow = (editor, item, bindings, includeLevel) => {
|
|
|
28
28
|
if (groupedItemsArr.length === 0) {
|
|
29
29
|
return true; // Corresponds to an extention or pure heading, since no children.
|
|
30
30
|
}
|
|
31
|
+
if (item.hasStyle('atLeastOneChild') || item.hasStyle('exactlyOneChild')) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
31
34
|
if (bindings[0].getItemGroupedChildBindings().find((childBindings, idx) =>
|
|
32
35
|
showNow(editor, groupedItemsArr[idx], childBindings, includeLevel))) {
|
|
33
36
|
return true;
|
package/src/view/View.js
CHANGED
|
@@ -20,9 +20,18 @@ export default class View {
|
|
|
20
20
|
this.compact = params.compact !== false;
|
|
21
21
|
this.showDescription = params.showDescription === true;
|
|
22
22
|
this.styleCls = params.styleCls || '';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
if (Array.isArray(params.filterPredicates)) {
|
|
24
|
+
this.filterPredicates =
|
|
25
|
+
params.filterPredicates.reduce((prev, current) => { prev[current] = true; return prev; }, {});
|
|
26
|
+
} else if (typeof params.filterPredicates === 'object') {
|
|
27
|
+
this.filterPredicates = params.filterPredicates;
|
|
28
|
+
} else if (typeof params.filterPredicates === 'string') {
|
|
29
|
+
this.filterPredicates = params.filterPredicates.split(',')
|
|
30
|
+
.reduce((prev, current) => { prev[current] = true; return prev; }, {});
|
|
31
|
+
} else {
|
|
32
|
+
this.filterPredicates = null;
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
this.restrictToItem = params.restrictToItem;
|
|
27
36
|
this.fuzzy = params.fuzzy === true;
|
|
28
37
|
this.markOrigin = params.markOrigin !== false;
|
|
@@ -350,7 +359,23 @@ export default class View {
|
|
|
350
359
|
const prop = item.getProperty();
|
|
351
360
|
// Exclude if property matches.
|
|
352
361
|
if (prop) {
|
|
353
|
-
|
|
362
|
+
// Check if we are in a root-like position,
|
|
363
|
+
// i.e. either directly at the root or further down below groups without property set.
|
|
364
|
+
let rootLike = true;
|
|
365
|
+
let view = this;
|
|
366
|
+
while (view.parentView) {
|
|
367
|
+
if (view.getBinding().getItem().getProperty()) {
|
|
368
|
+
rootLike = false;
|
|
369
|
+
}
|
|
370
|
+
view = view.parentView;
|
|
371
|
+
}
|
|
372
|
+
const shortedProp = namespaces.shortenKnown(prop);
|
|
373
|
+
if (rootLike) {
|
|
374
|
+
return fp[prop] === true || fp[shortedProp] === true ||
|
|
375
|
+
fp[`*${prop}`] === true || fp[`${shortedProp}`] === true;
|
|
376
|
+
} else {
|
|
377
|
+
return fp[`*${prop}`] === true || fp[`*${shortedProp}`] === true;
|
|
378
|
+
}
|
|
354
379
|
} else if (item.getType() === 'group') {
|
|
355
380
|
// Exclude group headers if all children hidden
|
|
356
381
|
const childBindings = item.getChildren() || [];
|