-
Notifications
You must be signed in to change notification settings - Fork 5
/
cosmoz-omnitable-item.html
57 lines (49 loc) · 1.48 KB
/
cosmoz-omnitable-item.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
<link rel="import" href="../shadycss/apply-shim.html">
<link rel="import" href="../polymer/polymer-element.html"/>
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html" />
<link rel="import" href="../paper-item/paper-item-shared-styles.html" />
<dom-module id="cosmoz-omnitable-item">
<template>
<style include="paper-item-shared-styles">
/* polymer-cli v1.7.x linter breaks with empty line */
</style>
<style>
:host {
@apply --layout-horizontal;
@apply --layout-center;
@apply --paper-font-subhead;
@apply --paper-item;
white-space: nowrap;
}
</style>
<span>[[ label ]]</span>
</template>
<script>
window.Cosmoz = window.Cosmoz || {};
class OmnitableItem extends Polymer.Element {
static get is() {
return 'cosmoz-omnitable-item';
}
static get properties() {
return {
label: {
type: String,
observer: '_labelChanged'
}
};
}
// HACK: ensure paper-dropdown-menu updates current selected item label after translation change
// See https://github.com/PolymerElements/paper-dropdown-menu/issues/197
_labelChanged() {
if (!this.classList.contains('iron-selected')) {
return;
}
const detail = { item: this };
this.dispatchEvent(new CustomEvent('iron-deselect', { detail }));
this.dispatchEvent(new CustomEvent('iron-select', { detail }));
}
}
customElements.define(OmnitableItem.is, OmnitableItem);
Cosmoz.OmnitableItem = OmnitableItem;
</script>
</dom-module>