1 |
|
2 | Copyright IBM Corp. 2016, 2018
|
3 |
|
4 | This source code is licensed under the Apache-2.0 license found in the
|
5 | LICENSE file in the root directory of this source tree.
|
6 | -->
|
7 |
|
8 | {{#if hasToolbar}}
|
9 | <div class="{{@root.prefix}}--data-table-container {{#if sticky}}{{@root.prefix}}--data-table--max-width{{/if}}" data-table{{#if hasExpandAll}} data-table-demo-expand-all-manager{{/if}}>
|
10 | <div class="{{@root.prefix}}--data-table-header">
|
11 | <h4 class="{{@root.prefix}}--data-table-header__title">{{title}}</h4>
|
12 | <p class="{{@root.prefix}}--data-table-header__description">{{optionalHelper}}</p>
|
13 | </div>
|
14 |
|
15 | <section class="{{@root.prefix}}--table-toolbar {{#if small}} {{@root.prefix}}--table-toolbar--small {{/if}}">
|
16 | {{#if batchActions}}
|
17 |
|
18 | <div class="{{@root.prefix}}--batch-actions" aria-label="Table Action Bar">
|
19 | <div class="{{@root.prefix}}--action-list">
|
20 | <button class="{{@root.prefix}}--btn {{@root.prefix}}--btn--primary{{#if small}} {{@root.prefix}}--btn--sm{{/if}}" type="button">
|
21 | Delete
|
22 | {{ carbon-icon 'Delete16' class=(add @root.prefix '--btn__icon')}}
|
23 | </button>
|
24 | <button class="{{@root.prefix}}--btn {{@root.prefix}}--btn--primary{{#if small}} {{@root.prefix}}--btn--sm{{/if}}" type="button">
|
25 | Save
|
26 | {{ carbon-icon 'Save16' class=(add @root.prefix '--btn__icon')}}
|
27 | </button>
|
28 | <button class="{{@root.prefix}}--btn {{@root.prefix}}--btn--primary{{#if small}} {{@root.prefix}}--btn--sm{{/if}}" type="button">
|
29 | Download
|
30 | {{ carbon-icon 'Download16' class=(add @root.prefix '--btn__icon')}}
|
31 | </button>
|
32 | <button data-event="action-bar-cancel" class="{{@root.prefix}}--btn {{@root.prefix}}--btn--primary {{@root.prefix}}--batch-summary__cancel{{#if small}} {{@root.prefix}}--btn--sm{{/if}}">{{cancelLabel}}</button>
|
33 | </div>
|
34 | <div class="{{@root.prefix}}--batch-summary">
|
35 | <p class="{{@root.prefix}}--batch-summary__para">{{{selectedItemsCounterLabel}}}</p>
|
36 | </div>
|
37 | </div>
|
38 | {{/if}}
|
39 |
|
40 | {{#if toolbarActions}}
|
41 | <div class="{{@root.prefix}}--toolbar-content">
|
42 |
|
43 | {{#is state "default"}}
|
44 | <div class="{{@root.prefix}}--toolbar-search-container-expandable">
|
45 | <div data-search class="{{@root.prefix}}--search {{@root.prefix}}--search--sm" role="search">
|
46 | <div class="{{@root.prefix}}--search-magnifier" tabindex="0">
|
47 | {{ carbon-icon 'Search16' class=(add @root.prefix '--toolbar-action__icon')}}
|
48 | </div>
|
49 | <label id="{{searchLabelId}}" class="{{@root.prefix}}--label" for="{{searchInputId}}">{{searchLabel}}</label>
|
50 | <input class="{{@root.prefix}}--search-input" type="text" id="{{searchInputId}}" role="search" placeholder="{{searchLabel}}" aria-labelledby="{{searchLabelId}}">
|
51 | <button class="{{@root.prefix}}--search-close {{@root.prefix}}--search-close--hidden" title="{{clearSearchLabel}}" aria-label="{{clearSearchLabel}}">
|
52 | {{ carbon-icon 'Close16'}}
|
53 | </button>
|
54 | </div>
|
55 | </div>
|
56 | {{/is}}
|
57 |
|
58 |
|
59 | {{#is state "persistent-search"}}
|
60 | <div class="{{@root.prefix}}--toolbar-search-container-persistent">
|
61 | <div data-search class="{{@root.prefix}}--search {{@root.prefix}}--search--sm" role="search">
|
62 | <div class="{{@root.prefix}}--search-magnifier">
|
63 | {{ carbon-icon 'Search16'}}
|
64 | </div>
|
65 | <label id="{{searchLabelId}}" class="{{@root.prefix}}--label" for="{{searchInputId}}">{{searchLabel}}</label>
|
66 | <input class="{{@root.prefix}}--search-input" type="text" id="{{searchInputId}}" role="search" placeholder="{{searchLabel}}" aria-labelledby="{{searchLabelId}}">
|
67 | <button class="{{@root.prefix}}--search-close {{@root.prefix}}--search-close--hidden" title="{{clearSearchLabel}}" aria-label="{{clearSearchLabel}}">
|
68 | {{ carbon-icon 'Close16'}}
|
69 | </button>
|
70 | </div>
|
71 | </div>
|
72 | {{/is}}
|
73 |
|
74 |
|
75 | {{#each toolbarActionsX as |toolbar|}}
|
76 | <div class="{{@root.prefix}}--overflow-menu {{@root.prefix}}--toolbar-action" data-overflow-menu role="button" tabindex="0" aria-label="Overflow" aria-haspopup="true"
|
77 | aria-expanded="false" {{#if disabled}} disabled {{/if}}>
|
78 | {{ carbon-icon 'Settings16' class=(add @root.prefix '--toolbar-action__icon')}}
|
79 | <ul class="{{@root.prefix}}--overflow-menu-options {{@root.prefix}}--overflow-menu--flip" tabindex="-1" role="menu" aria-label="Overflow" data-floating-menu-direction="bottom">
|
80 | {{#each toolbar.overflowItems}}
|
81 | <li class="{{@root.prefix}}--overflow-menu-options__option {{#if (not ../../small)}} {{@root.prefix}}--overflow-menu--data-table {{/if}}" role="presentation">
|
82 | <button class="{{@root.prefix}}--overflow-menu-options__btn" role="menuitem" {{#if primaryFocus}} data-floating-menu-primary-focus {{/if}}>
|
83 | <div class="{{@root.prefix}}--overflow-menu-options__option-content">
|
84 | {{label}}
|
85 | </div>
|
86 | </button>
|
87 | </li>
|
88 | {{/each}}
|
89 | </ul>
|
90 | </div>
|
91 | {{/each}}
|
92 |
|
93 |
|
94 | <button class="{{@root.prefix}}--btn {{@root.prefix}}--btn--sm {{@root.prefix}}--btn--primary">
|
95 | {{#if small }} Primary {{else}} Primary Button {{/if}}
|
96 | {{ carbon-icon 'Add20' class=(add @root.prefix '--btn__icon') }}
|
97 | </button>
|
98 | </div>
|
99 | {{/if}}
|
100 | </section>
|
101 | {{/if}}
|
102 |
|
103 |
|
104 | {{#if sticky}}
|
105 | <section class="{{@root.prefix}}--data-table_inner-container">
|
106 | {{/if}}
|
107 |
|
108 | <table class="{{@root.prefix}}--data-table {{#if truncate}}{{@root.prefix}}--data-table--overflow-truncate{{/if}}{{#if sticky}} {{@root.prefix}}--data-table--sticky-header{{/if}}{{#if zebra}} {{@root.prefix}}--data-table--zebra{{/if}}{{#if small}} {{@root.prefix}}--data-table--compact{{/if}}{{#if tall}} {{@root.prefix}}--data-table--tall{{/if}}{{#if sort}} {{@root.prefix}}--data-table--sort{{/if}}{{#if displayOverflowMenus}} {{@root.prefix}}--data-table--visible-overflow-menu{{/if}} {{#if short}}{{@root.prefix}}--data-table--short{{/if}} {{#if static}}{{@root.prefix}}--data-table--static{{/if}}" >
|
109 | <thead>
|
110 | <tr>
|
111 | {{#each columns}}
|
112 | <th {{#if checkbox}} class="{{@root.prefix}}--table-column-checkbox"{{/if}}{{#if menu}} class="{{@root.prefix}}--table-column-menu"{{/if}}{{#if section}} class="{{@root.prefix}}--table-expand"{{/if}}{{#if numerical}} class="{{@root.prefix}}--data-table--numerical-cell"{{/if}}{{#if section}} data-event="expandAll"{{/if}}>
|
113 |
|
114 | {{#if checkbox}}
|
115 | <input data-event="select-all" id="{{checkboxId}}" class="{{@root.prefix}}--checkbox" type="checkbox" value="{{checkboxValue}}" name="{{checkboxName}}">
|
116 | <label for="{{checkboxId}}" class="{{@root.prefix}}--checkbox-label" aria-label="{{title}}"></label>
|
117 | {{else if (and section ../hasExpandAll)}}
|
118 | <button class="{{@root.prefix}}--table-expand__button">
|
119 | {{ carbon-icon 'ChevronRight16' class=(add @root.prefix '--table-expand__svg') }}
|
120 | </button>
|
121 | {{else if (not menu)}}
|
122 |
|
123 | {{#if sortable}}
|
124 | <button class="{{@root.prefix}}--table-sort" data-event="sort" title="{{title}}">
|
125 | <span class="{{@root.prefix}}--table-header-label">{{title}}</span>
|
126 | {{carbon-icon 'ArrowDown16' class=(add @root.prefix '--table-sort__icon')}}
|
127 | {{carbon-icon 'Arrows16' class=(add @root.prefix '--table-sort__icon-unsorted')}}
|
128 | {{#if ../truncate}}
|
129 | <div id="label-tooltip" role="tooltip" data-floating-menu-direction="bottom" class="{{@root.prefix}}--tooltip" data-avoid-focus-on-open>
|
130 | <span class="{{@root.prefix}}--tooltip__caret"></span>
|
131 | <p class="{{@root.prefix}}--tooltip__text">{{title}}</p>
|
132 | </div>
|
133 | {{/if}}
|
134 | </button>
|
135 |
|
136 | {{else if small}}
|
137 | {{title}}
|
138 | {{else}}
|
139 | <span class="{{@root.prefix}}--table-header-label">{{title}}</span>
|
140 | {{/if}}
|
141 | {{/if}}
|
142 | </th>
|
143 | {{/each}}
|
144 | </tr>
|
145 | </thead>
|
146 | <tbody>
|
147 | {{#each rows as |row|}}
|
148 | <tr{{#if row.sectionContent}} class="{{@root.prefix}}--parent-row" data-parent-row {{/if}} {{#if row.disabled}} class="{{@root.prefix}}--row-disabled" {{/if}}>
|
149 | {{#each ../columns as |column|}}
|
150 | {{#with (lookup row column.name) as |data|}}
|
151 |
|
152 | {{#if column.section}}
|
153 | <td class="{{@root.prefix}}--table-expand" data-event="expand">
|
154 | <button class="{{@root.prefix}}--table-expand__button">
|
155 | {{ carbon-icon 'ChevronRight16' class=(add @root.prefix '--table-expand__svg') }}
|
156 | </button>
|
157 | </td>
|
158 |
|
159 | {{else if column.checkbox}}
|
160 | <td class="{{@root.prefix}}--table-column-checkbox">
|
161 | <input data-event="select" id="{{data.id}}" class="{{@root.prefix}}--checkbox" type="checkbox" value="{{data.value}}" name="{{data.name}}" {{#if row.disabled}} disabled {{/if}}>
|
162 | <label for="{{data.id}}" class="{{@root.prefix}}--checkbox-label" aria-label="{{data.label}}"></label>
|
163 | </td>
|
164 |
|
165 | {{else if column.additionalIcons}}
|
166 | <td class="{{@root.prefix}}--table-column-icon">
|
167 | <button {{#if row.disabled}} disabled {{/if}}>
|
168 | {{{data.svg}}}
|
169 | </button>
|
170 | </td>
|
171 |
|
172 | {{else if column.menu}}
|
173 | <td class="{{@root.prefix}}--table-column-menu">
|
174 | <div data-overflow-menu role="menu" tabindex="0" aria-label="{{data.label}}" class="{{@root.prefix}}--overflow-menu">
|
175 | {{ carbon-icon 'OverflowMenuVertical16' class=(add @root.prefix '--overflow-menu__icon') }}
|
176 | <ul class="{{@root.prefix}}--overflow-menu-options{{#if data.flip}} {{@root.prefix}}--overflow-menu--flip{{/if}}">
|
177 |
|
178 | <li class="{{@root.prefix}}--overflow-menu-options__option {{@root.prefix}}--table-row--menu-option">
|
179 | <button class="{{@root.prefix}}--overflow-menu-options__btn" onclick="console.log('keyboard action')">
|
180 | <div class="{{@root.prefix}}--overflow-menu-options__option-content">
|
181 | {{ carbon-icon 'Edit16' }} Edit
|
182 | </div>
|
183 | </button>
|
184 | </li>
|
185 | <li class="{{@root.prefix}}--overflow-menu-options__option {{@root.prefix}}--table-row--menu-option">
|
186 | <button class="{{@root.prefix}}--overflow-menu-options__btn" onclick="console.log('keyboard action')">
|
187 | <div class="{{@root.prefix}}--overflow-menu-options__option-content">
|
188 | {{ carbon-icon 'Download16' }} Download
|
189 | </div>
|
190 | </button>
|
191 | </li>
|
192 | <li class="{{@root.prefix}}--overflow-menu-options__option {{@root.prefix}}--table-row--menu-option">
|
193 | <button class="{{@root.prefix}}--overflow-menu-options__btn" onclick="console.log('keyboard action')">
|
194 | <div class="{{@root.prefix}}--overflow-menu-options__option-content">
|
195 | {{ carbon-icon 'Save16' }} Save
|
196 | </div>
|
197 | </button>
|
198 | </li>
|
199 | <li class="{{@root.prefix}}--overflow-menu-options__option {{@root.prefix}}--table-row--menu-option">
|
200 | <button class="{{@root.prefix}}--overflow-menu-options__btn" onclick="console.log('keyboard action')">
|
201 | <div class="{{@root.prefix}}--overflow-menu-options__option-content">
|
202 | {{ carbon-icon 'Delete16' }} Delete
|
203 | </div>
|
204 | </button>
|
205 | </li>
|
206 |
|
207 | </ul>
|
208 | </div>
|
209 | </td>
|
210 |
|
211 | {{else if (and row.editable column.editing)}}
|
212 | <td class="{{@root.prefix}}--data-table-cell--editable {{@root.prefix}}--data-table-cell--editing">
|
213 | <div class="{{@root.prefix}}--data-table__edit-field">
|
214 | <label class="{{@root.prefix}}--label" for="edit-cell:{{row.id}}:{{column.name}}">Edit Name: {{data}}</label>
|
215 | <input type="text" class="{{@root.prefix}}--text-input" id="edit-cell:{{row.id}}:{{column.name}}" value="{{data}}">
|
216 | </div>
|
217 | <div class="{{@root.prefix}}--data-table__edit-actions">
|
218 | <button class="{{@root.prefix}}--btn {{@root.prefix}}--btn--secondary {{@root.prefix}}--btn--sm">{{../../../cancelLabel}}</button>
|
219 | <button class="{{@root.prefix}}--btn {{@root.prefix}}--btn--primary {{@root.prefix}}--btn--sm">{{../../../saveLabel}}</button>
|
220 | </div>
|
221 | </td>
|
222 | {{else if column.editable}}
|
223 | <td class="{{@root.prefix}}--data-table-cell--editable"><span class="{{@root.prefix}}--data-table-cell__content">{{data}}</span></td>
|
224 |
|
225 | {{else}}
|
226 | <td {{#if column.numerical}} class="{{@root.prefix}}--data-table--numerical-cell" {{/if}}>
|
227 |
|
228 | {{#if ../../truncate}}
|
229 | <span class="{{@root.prefix}}--table-cell-content" aria-describedby="label-tooltip">{{data}}
|
230 | {{#if ../../../tall }}
|
231 | {{#if (and row.secondaryText column.secondary)}}
|
232 | <div class="{{@root.prefix}}--data-table--cell-secondary-text">
|
233 | {{row.secondaryText}}
|
234 | </div>
|
235 | {{/if}}
|
236 | {{/if}}
|
237 | </span>
|
238 | <div id="label-tooltip" role="tooltip" data-floating-menu-direction="bottom" class="{{@root.prefix}}--tooltip" data-avoid-focus-on-open>
|
239 | <span class="{{@root.prefix}}--tooltip__caret"></span>
|
240 | <p class="{{@root.prefix}}--tooltip__text">{{data}}</p>
|
241 | </div>
|
242 |
|
243 | {{else}}
|
244 | {{data}}
|
245 | {{#if ../../../tall}}
|
246 | {{#if (and row.secondaryText column.secondary)}}
|
247 | <div class="{{@root.prefix}}--data-table--cell-secondary-text">
|
248 | {{row.secondaryText}}
|
249 | </div>
|
250 | {{/if}}
|
251 | {{/if}}
|
252 | {{/if}}
|
253 | </td>
|
254 | {{/if}}
|
255 | {{/with}}
|
256 | {{/each}}
|
257 | </tr>
|
258 |
|
259 | {{#if row.sectionContent}}
|
260 | <tr class="{{@root.prefix}}--expandable-row {{@root.prefix}}--expandable-row--hidden" data-child-row>
|
261 | <td colspan="{{../columns.length}}">
|
262 | <div class="{{@root.prefix}}--child-row-inner-container">
|
263 | {{{row.sectionContent}}}
|
264 | </div>
|
265 | </td>
|
266 | </tr>
|
267 | {{/if}}
|
268 | {{/each}}
|
269 | </tbody>
|
270 | </table>
|
271 | {{#if sticky}}
|
272 | </section>
|
273 | {{/if}}
|
274 |
|
275 |
|
276 | {{#if hasPager}}
|
277 | <div class="{{@root.prefix}}--pagination" data-pagination>
|
278 | <div class="{{@root.prefix}}--pagination__left">
|
279 | <label
|
280 | id="select-id-pagination-count-label"
|
281 | class="{{@root.prefix}}--pagination__text"
|
282 | for="select-id-pagination-count"
|
283 | >
|
284 | Items per page:
|
285 | </label>
|
286 | <div class="{{@root.prefix}}--select {{@root.prefix}}--select--inline {{@root.prefix}}--select__item-count">
|
287 | <select
|
288 | class="{{@root.prefix}}--select-input"
|
289 | id="select-id-pagination-count"
|
290 | aria-label="select number of items per page"
|
291 | tabindex="0"
|
292 | data-items-per-page
|
293 | >
|
294 | <option class="{{@root.prefix}}--select-option" value="10" selected>10</option>
|
295 | <option class="{{@root.prefix}}--select-option" value="20">20</option>
|
296 | <option class="{{@root.prefix}}--select-option" value="30">30</option>
|
297 | <option class="{{@root.prefix}}--select-option" value="40">40</option>
|
298 | <option class="{{@root.prefix}}--select-option" value="50">50</option>
|
299 | </select>
|
300 | {{ carbon-icon 'ChevronDownGlyph' class=(add @root.prefix '--select__arrow') }}
|
301 | </div>
|
302 | <span class="{{@root.prefix}}--pagination__text">
|
303 | <span data-displayed-item-range>1-10</span> of
|
304 | <span data-total-items>50</span> items
|
305 | </span>
|
306 | </div>
|
307 | <div class="{{@root.prefix}}--pagination__right">
|
308 | <div class="{{@root.prefix}}--select {{@root.prefix}}--select--inline {{@root.prefix}}--select__page-number">
|
309 | <select
|
310 | class="{{@root.prefix}}--select-input"
|
311 | id="select-id-pagination-page"
|
312 | aria-label="select page number to view"
|
313 | tabindex="0"
|
314 | data-page-number-input
|
315 | >
|
316 | <option class="{{@root.prefix}}--select-option" value="1" selected>1</option>
|
317 | <option class="{{@root.prefix}}--select-option" value="2">2</option>
|
318 | <option class="{{@root.prefix}}--select-option" value="3">3</option>
|
319 | <option class="{{@root.prefix}}--select-option" value="4">4</option>
|
320 | <option class="{{@root.prefix}}--select-option" value="5">5</option>
|
321 | </select>
|
322 | {{ carbon-icon 'ChevronDownGlyph' class=(add @root.prefix '--select__arrow')}}
|
323 | </div>
|
324 | <label
|
325 | id="select-id-pagination-page-label"
|
326 | class="{{@root.prefix}}--pagination__text"
|
327 | for="select-id-pagination-page"
|
328 | >
|
329 | of 5 pages
|
330 | </label>
|
331 | <button class="{{@root.prefix}}--pagination__button {{@root.prefix}}--pagination__button--backward" tabindex="0" data-page-backward aria-label="Backward button">
|
332 | {{ carbon-icon 'CaretLeft20' class=(add @root.prefix '--pagination__nav-arrow')}}
|
333 | </button>
|
334 | <button class="{{@root.prefix}}--pagination__button {{@root.prefix}}--pagination__button--forward" tabindex="0" data-page-forward aria-label="Forward button">
|
335 | {{ carbon-icon 'CaretRight20' class=(add @root.prefix '--pagination__nav-arrow')}}
|
336 | </button>
|
337 | </div>
|
338 | </div>
|
339 | {{/if}}
|
340 | {{#if (not small)}}</div>{{/if}}
|
341 |
|
\ | No newline at end of file |