-
Notifications
You must be signed in to change notification settings - Fork 5
/
cosmoz-omnitable-column.html
69 lines (58 loc) · 1.75 KB
/
cosmoz-omnitable-column.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
<link rel="import" href="../shadycss/apply-shim.html">
<link rel="import" href="../polymer/polymer-element.html"/>
<link rel="import" href="cosmoz-omnitable-column-mixin.html">
<link rel="import" href="../iron-icon/iron-icon.html"/>
<link rel="import" href="../paper-input/paper-input.html"/>
<link rel="import" href="ui-helpers/cosmoz-clear-button.html">
<dom-module id="cosmoz-omnitable-column">
<template>
<template class="cell">
<span class="default-column">[[ getString(item, valuePath) ]]</span>
</template>
<template class="edit-cell">
<paper-input no-label-float type="text" on-change="_valueChanged" value="[[ getString(item, valuePath) ]]">
</paper-input>
</template>
<template class="header">
<paper-input label="[[ title ]]" value="{{ filter }}" focused="{{ headerFocused }}">
<cosmoz-clear-button suffix slot="suffix" visible="[[ hasFilter(filter.*) ]]" light on-click="resetFilter"></cosmoz-clear-button>
</paper-input>
</template>
</template>
<script>
window.Cosmoz = window.Cosmoz || {};
/**
* @polymer
* @customElement
* @appliesMixin Cosmoz.OmnitableColumnMixin
*/
class OmnitableColumn extends Cosmoz.OmnitableColumnMixin(Polymer.Element) {
static get is() {
return 'cosmoz-omnitable-column';
}
static get properties() {
return {
minWidth: {
type: String,
value: '55px'
},
editMinWidth: {
type: String,
value: '55px'
}
};
}
_serializeFilter(filter = this.filter) {
return filter || null;
}
_deserializeFilter(obj) {
return obj || null;
}
resetFilter() {
this.filter = null;
}
}
customElements.define(OmnitableColumn.is, OmnitableColumn);
Cosmoz.OmnitableColumn = OmnitableColumn;
</script>
</dom-module>