-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuba-entity-list-view-behavior.html
47 lines (46 loc) · 1.15 KB
/
cuba-entity-list-view-behavior.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<script>
/**
* @polymerBehavior CubaEntityListViewBehavior
*/
CubaEntityListViewBehavior = {
properties: {
active: {
type: Boolean,
value: false
},
entities: Array,
entitiesCount: Number,
moreDataAvailable: {
type: Boolean,
computed: '_computeMoreDataAvailable(entities, entitiesCount, entities.*)',
value: false
},
dataLoading: {
type: Boolean,
notify: true
},
selectedEntity: {
type: Object,
notify: true
}
},
reload: function() {
return this.$.data.load();
},
remove: function(entity) {
return this.$.data.remove(entity);
},
_loadMore: function() {
this.$.data.loadMore();
},
_computeMoreDataAvailable: function(entities, entitiesCount) {
return entities != null && entitiesCount != null && entities.length < entitiesCount;
},
_handleItemTap: function(event) {
this.fire('item-tap', event.model.item);
},
_handleSelectionChange: function(event) {
this.selectedEntity = this.$.entitiesList.itemForElement(event.detail.item);
}
}
</script>