-
Notifications
You must be signed in to change notification settings - Fork 20
/
px-data-grid-select-all.html
113 lines (95 loc) · 2.97 KB
/
px-data-grid-select-all.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--
Copyright (c) 2018, General Electric
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="css/px-data-grid-select-all-styles.html">
<link rel="import" href="px-data-grid-sorter.html">
<dom-module id="px-data-grid-select-all">
<template>
<style include="px-data-grid-select-all-styles"></style>
<vaadin-checkbox
aria-label="Select All"
on-checked-changed="_onSelectAllCheckedChanged"
checked="[[checked]]"
indeterminate="[[indeterminate]]"></vaadin-checkbox>
<template is="dom-if" if="[[allowSortBySelection]]">
<px-data-grid-sorter path="--selection--">
([[count]])
</px-date-grid-sorter>
</template>
<template is="dom-if" if="[[!allowSortBySelection]]">
([[count]])
</template>
</template>
<script>
{
/**
* `<px-data-grid-select-all>` is a helper element for the `<px-data-grid>`
* to be used to offer master select all and sorting functionality in
* multiselect mode.
* @memberof Predix
* @mixes Polymer.Element
*/
class DataGridSelectAllElement extends Polymer.Element {
static get is() {
return 'px-data-grid-select-all';
}
static get properties() {
return {
/**
* If checkbox is in indeterminate mode
*/
indeterminate: {
type: Boolean,
value: false
},
/**
* If checkbox is currently checked
*/
checked: {
type: Boolean,
value: false
},
/**
* Count of selected items
*/
count: {
type: Number,
value: 0
},
/**
* If user is allowed to sort by selection
*/
allowSortBySelection: {
type: Boolean,
value: false
},
checkListener: {
type: Function
}
};
}
_onSelectAllCheckedChanged(e) {
if (this.checkListener) {
this.checkListener(e);
}
}
}
customElements.define(DataGridSelectAllElement.is, DataGridSelectAllElement);
/**
* @namespace Predix
*/
window.Predix = window.Predix || {};
Predix.DataGridSelectAllElement = DataGridSelectAllElement;
}
</script>
</dom-module>