native-document 1.0.235 → 1.0.236

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.235",
3
+ "version": "1.0.236",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -49,6 +49,7 @@ export default function ListGroup(label, props = {}) {
49
49
  selectByCheckbox: $(false),
50
50
  selectByClick: $(false),
51
51
  loopOnKeyboard: $(false),
52
+ hideIfEmpty: null,
52
53
  props,
53
54
  };
54
55
  }
@@ -133,3 +134,10 @@ ListGroup.prototype.data = function(data) {
133
134
  this.$description.data = data;
134
135
  return this;
135
136
  };
137
+ /**
138
+ * @return {this}
139
+ */
140
+ ListGroup.prototype.hideIfEmpty = function() {
141
+ this.$description.hideIfEmpty = true;
142
+ return this;
143
+ };
@@ -44,6 +44,7 @@ export interface ListGroupInterface {
44
44
  item(label: ValidChild, iconOrBuilder?: ValidChild | ((item: ListItemInterface) => void), builder?: (item: ListItemInterface) => void): this;
45
45
  group(label: ValidChild, iconOrBuilder?: ValidChild | ((group: ListGroupInterface) => void), builder?: (group: ListGroupInterface) => void): this;
46
46
  divider(): this;
47
+ hideIfEmpty(): this;
47
48
  from(source: ObservableArray<unknown> | unknown[], builder: (item: unknown) => ListItemInterface | ListGroupInterface): this;
48
49
 
49
50
  // HasEventEmitter
@@ -26,7 +26,13 @@ export default function ListGroupRender($desc, instance) {
26
26
  content.push(Ul({ class: 'list-group-items' }, ForEachArray($desc.items, $desc.itemBuilder)));
27
27
  }
28
28
 
29
- return Li(instance.resolveProps(), content);
29
+ const node = Li(instance.resolveProps(), content);
30
+
31
+ if($desc.hideIfEmpty) {
32
+ return ShowIf($desc.items.isTruthy(), node);
33
+ }
34
+
35
+ return node;
30
36
  }
31
37
 
32
38
  function buildGroupHeader($desc, instance) {