forked from predixdesignsystem/px-data-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpx-data-table-column-demo.html
209 lines (196 loc) · 8.98 KB
/
px-data-table-column-demo.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>px-data-table-column Demo</title>
<!-- Import custom element. Note: see comment about relative paths to dependencies in the *.html file referenced below -->
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="css/px-data-table-demo-styles.html"/>
<style include="px-data-table-demo-styles" is="custom-style"></style>
<link rel="import" href="../iron-ajax/iron-ajax.html" />
<link rel="import" href="../px-theme/px-theme-styles.html">
<style include="px-theme-styles" is="custom-style"></style>
<link rel="import" href="../px-api-viewer/px-api-viewer.html" />
<link rel="import" href="../px-tabs/px-tab-set.html" />
<link rel="import" href="../px-polymer-font-awesome/px-polymer-font-awesome.html" />
<link rel="import" href="px-data-table.html"/>
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<link rel="import" href="../px-demo-snippet/px-demo-snippet.html">
<link rel="import" href="../px-polymer-font-awesome/px-polymer-font-awesome.html">
<!-- Requires Webcomponents.js polyfill is provided by the page for browsers that don't support html imports -->
</head>
<body>
<!-- Wrap elements with auto-binding template to -->
<!-- allow use of Polymer bindings in main document -->
<template id="just-for-demo" is="dom-bind" >
<!-- description -->
<div class="hero u-p++ text--shadow">
<a class="actionable flex flex--right flex--middle" href="https://github.com/PredixDev/px-data-table" target="_blank"><iron-icon class="menu__open" icon="fa:fa-github"></iron-icon>View on Github</a>
<h1 class="delta">px-data-table-column</h1>
<p>
The optional Data Table Column sub-component provides the ability to override and customize the behavior of individual columns.
</p>
<div class="flex">
<img class="u-mr--" src="https://img.shields.io/travis/PredixDev/px-data-table.svg?style=flat-square" alt="Travis" onerror="this.style.display='none'"/>
<img class="u-mr--" src="https://img.shields.io/bower/v/px-data-table.svg?style=flat-square" alt="Bower" onerror="this.style.display='none'"/>
<img class="u-mr--" src="https://img.shields.io/github/issues-raw/PredixDev/px-data-table.svg?style=flat-square" alt="Issues" onerror="this.style.display='none'"/>
</div>
</div>
<br />
<!-- mega demo -->
<div style="position: relative;" class="u-pb++ flex flex--col" id="defaultTab">
<div class="tabContainer u-pt++ u-pl++">
<px-tab-set selected="{{selected}}" bare no-bottom-border>
<template is="dom-repeat" items="{{optionsArray}}">
<px-tab>Option {{indexPlusOne(index)}}</px-tab>
</template>
</px-tab-set>
</div>
<px-tab-pages selected="{{selected}}">
<template is="dom-repeat" items="{{optionsArray}}">
<section class="tab-page">
<div class="mega-demo flex u-ph++ u-pb++">
<!-- Properties -->
<div class="properties u-ph+ u-pb+ u-mt+">
<p class="epsilon">Properties</p>
<p class="zeta">
Note: the following properties are not dynamically reflected at this time, but you can view the differences by using the "Option" tabs above. The options are only tied to the first column in the example data table.
</p>
<div class="u-mb-">Label: <input id="label{{indexPlusOne(index)}}" class="text-input" type="text" placeholder="First" value="{{item.label::input}}" disabled /></div>
<div class="u-mb-">Type: <input id="type{{indexPlusOne(index)}}" class="text-input" type="text" placeholder="string" value="{{item.type::input}}" disabled /></div>
<div class="flex u-mb-">
<input id="sortable{{indexPlusOne(index)}}" type="checkbox" checked="{{item.sortable::change}}" disabled>
<div class="u-ml-">Sortable</div>
</div>
<div class="flex u-mb-">
<input id="filterable{{indexPlusOne(index)}}" type="checkbox" checked="{{item.filterable::change}}" disabled>
<div class="u-ml-">Filterable</div>
</div>
<div class="flex u-mb-">
<input id="editable{{indexPlusOne(index)}}" type="checkbox" checked="{{item.editable::change}}" disabled>
<div class="u-ml-">Editable</div>
</div>
</div>
<div class="demoContainer clearfix u-mt+">
<!-- demo -->
<div class="flex flex--col">
<div class="demo u-p+">
<px-data-table table-data="{{data}}" filterable="true">
<px-data-table-column type="{{item.type}}" dropdown-items="{{dropdownItems}}" name="{{item.name}}" label="{{item.label}}" sortable="{{item.sortable}}" editable="{{item.editable}}" filterable="{{item.filterable}}"></px-data-table-column>
<px-data-table-column name="last"></px-data-table-column>
<px-data-table-column name="email"></px-data-table-column>
</px-data-table>
</div>
<div class="flex__item">
<px-demo-snippet
element-properties={{item}}
element-name="px-data-table-column"
parent-name="px-data-table">
</px-demo-snippet>
</div>
</div>
</div>
</div>
<div class="apiContainer">
<div class="flex flex--col api u-mt++" >
<div class="flex">
<div class="flex__item">
<div class="flex flex--col childrenAssociated">
<div class="componentHeader">Child Component</div>
<div class="componentList">
<ul>
<li><a href="px-data-table-highlight-demo.html">px-data-table-highlight</a></li>
</ul>
</div>
</div>
</div>
<div class="flex__item">
<div class="flex flex--col">
<div class="componentHeader">Associated Components</div>
<div class="componentList">
<ul>
<li><a href="index.html">px-data-table</a></li>
<li><a href="http://predixdev.github.io/px-dropdown/px-dropdown/index.html">px-dropdown</a></li>
<li><a href="https://predixdev.github.io/px-validation/px-validation/index.html">px-validation</a></li>
</ul>
</div>
</div>
</div>
</div>
<div>
<px-api-viewer source="px-data-table-column"></px-api-viewer>
</div>
</div>
</div>
</section>
</template>
</px-tab-pages>
</div>
<footer class="footer flex flex--center">
<div class="footer__container u-pv++">
<div>
<a href="https://ge.com/digital" >
<img src="monogram-wdmk.png" alt="GE Monogram" class="footer__img">
</a>
</div>
<div class="footer__list">
<ul class="list-inline list-inline--delimited">
<li>
<a href="http://predix.io/legal" class="footer__list--lnk">Legal</a>
</li>
<li>
<a href="mailto:[email protected]" class="footer__list--lnk">Contact Us</a>
</li>
<li>Copyright © 2016 General Electric Company. All rights reserved.</li>
</ul>
</div>
</div>
</footer>
</template>
<script>
window.addEventListener('WebComponentsReady', function() {
var template = document.querySelector('template[is=dom-bind]'),
dropdownItems = [{"key":"one","val":"Mike"},{"key":"two","val":"Maria"},{"key":"three","val":"Wei"}],
optionsArray = [
{
"name": "first",
"label": "",
"sortable": true,
"filterable": true,
"editable": true,
"type": "string",
"dropdownItems": false,
"parentComponent": ["<px-data-table table-data={{data}}>","</px-data-table>"]
},
{
"name": "first",
"label": "First Name",
"sortable": false,
"filterable": false,
"editable": true,
"type": "dropdown",
"dropdownItems": dropdownItems,
"parentComponent": ["<px-data-table table-data={{data}}>","</px-data-table>"]
}
];
var ironAjaxEl = document.createElement('iron-ajax'),
data;
ironAjaxEl.handleAs = "json";
ironAjaxEl.url = "contacts-mini.json";
ironAjaxEl.addEventListener('response', function(evt) {
data = evt.detail.response;
template.data = data;
});
ironAjaxEl.generateRequest();
var indexPlusOne = function(num) {
return num + 1;
};
template.selected = "0";
template.optionsArray = optionsArray;
template.indexPlusOne = indexPlusOne;
template.dropdownItems = dropdownItems;
});
</script>
</body>
</html>