@shortfuse/materialdesignweb 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.browserslistrc +2 -1
- package/.eslintrc.json +188 -30
- package/.stylelintrc.json +643 -2
- package/.vscode/launch.json +20 -5
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +36 -0
- package/README.md +82 -2
- package/adapters/datatable/column.js +176 -0
- package/adapters/datatable/index.js +253 -437
- package/adapters/dom/index.js +586 -0
- package/adapters/list/index.js +36 -113
- package/adapters/search/index.js +153 -180
- package/components/appbar/_spec.scss +165 -0
- package/components/appbar/_theme.scss +0 -0
- package/components/appbar/index.scss +2 -0
- package/components/banner/_spec.scss +83 -0
- package/components/banner/_theme.scss +0 -0
- package/components/banner/index.scss +2 -0
- package/components/bottomnav/README.md +4 -4
- package/components/bottomnav/_spec.scss +149 -0
- package/components/bottomnav/_theme.scss +0 -0
- package/components/bottomnav/index.js +100 -120
- package/components/bottomnav/index.scss +2 -0
- package/components/bottomnav/item.js +88 -0
- package/components/button/README.md +16 -22
- package/components/button/_spec.scss +162 -0
- package/components/button/_theme.scss +42 -0
- package/components/button/index.eta +32 -0
- package/components/button/index.js +37 -48
- package/components/button/index.pug +18 -0
- package/components/button/index.scss +2 -0
- package/components/card/_spec.scss +241 -0
- package/components/card/_theme.scss +0 -0
- package/components/card/index.scss +2 -0
- package/components/chip/_spec.scss +111 -0
- package/components/chip/_theme.scss +105 -0
- package/components/chip/index.js +23 -0
- package/components/chip/index.scss +2 -0
- package/components/chip/item.js +20 -0
- package/components/datatable/_spec.scss +225 -0
- package/components/datatable/_theme.scss +128 -0
- package/components/datatable/cell.js +44 -0
- package/components/datatable/columnheader.js +46 -0
- package/components/datatable/index.js +339 -443
- package/components/datatable/index.scss +2 -0
- package/components/datatable/row.js +48 -0
- package/components/datatable/rowheader.js +18 -0
- package/components/dialog/_spec.scss +203 -0
- package/components/dialog/_theme.scss +7 -0
- package/components/dialog/index.js +512 -437
- package/components/dialog/index.scss +2 -0
- package/components/divider/_spec.scss +11 -0
- package/components/divider/_theme.scss +0 -0
- package/components/divider/index.scss +2 -0
- package/components/elevation/_spec.scss +9 -0
- package/components/elevation/_theme.scss +0 -0
- package/components/elevation/index.scss +2 -0
- package/components/fab/{style.scss → _spec.scss} +104 -79
- package/components/fab/_theme.scss +0 -0
- package/components/fab/index.js +85 -79
- package/components/fab/index.scss +2 -0
- package/components/grid/_spec.scss +169 -0
- package/components/grid/_theme.scss +0 -0
- package/components/grid/index.scss +2 -0
- package/components/layout/_mixins.scss +11 -0
- package/components/layout/_spec.scss +916 -0
- package/components/layout/_theme.scss +19 -0
- package/components/layout/index.js +454 -0
- package/components/layout/index.scss +2 -0
- package/components/list/_spec.scss +363 -0
- package/components/list/_theme.scss +102 -0
- package/components/list/content.js +106 -0
- package/components/list/index.js +234 -79
- package/components/list/index.scss +2 -0
- package/components/list/item.js +167 -0
- package/components/list/secondary.js +45 -0
- package/components/menu/_spec.scss +329 -0
- package/components/menu/_theme.scss +0 -0
- package/components/menu/index.js +636 -651
- package/components/menu/index.scss +2 -0
- package/components/menu/item.js +231 -0
- package/components/progress/_spec.scss +156 -0
- package/components/progress/_theme.scss +0 -0
- package/components/progress/index.js +29 -13
- package/components/progress/index.scss +2 -0
- package/components/selection/_spec.scss +376 -0
- package/components/selection/_theme.scss +134 -0
- package/components/selection/index.eta +60 -0
- package/components/selection/index.js +70 -0
- package/components/selection/index.pug +30 -0
- package/components/selection/index.scss +2 -0
- package/components/selection/input.js +54 -0
- package/components/selection/radiogroup.js +40 -0
- package/components/slider/{style.scss → _spec.scss} +31 -34
- package/components/slider/_theme.scss +0 -0
- package/components/slider/index.scss +2 -0
- package/components/snackbar/_spec.scss +150 -0
- package/components/snackbar/_theme.scss +0 -0
- package/components/snackbar/index.js +293 -206
- package/components/snackbar/index.scss +2 -0
- package/components/tab/_spec.scss +220 -0
- package/components/tab/_theme.scss +0 -0
- package/components/tab/content.js +210 -0
- package/components/tab/index.js +229 -213
- package/components/tab/index.scss +2 -0
- package/components/tab/item.js +88 -0
- package/components/tab/list.js +196 -0
- package/components/tab/panel.js +54 -0
- package/components/textfield/README.md +4 -4
- package/components/textfield/_spec.scss +763 -0
- package/components/textfield/_theme.scss +264 -0
- package/components/textfield/index.eta +74 -0
- package/components/textfield/index.js +132 -138
- package/components/textfield/index.pug +30 -0
- package/components/textfield/index.scss +2 -0
- package/components/tooltip/_spec.scss +185 -0
- package/components/tooltip/_theme.scss +0 -0
- package/components/tooltip/index.scss +2 -0
- package/components/type/_spec.scss +227 -0
- package/components/type/_theme.scss +0 -0
- package/components/type/index.scss +2 -0
- package/core/_breakpoint.scss +189 -0
- package/core/_elevation.scss +78 -0
- package/core/_length.scss +8 -0
- package/core/_motion.scss +31 -0
- package/core/_platform.scss +12 -0
- package/core/_type.scss +128 -0
- package/core/aria/attributes.js +141 -0
- package/core/aria/button.js +49 -0
- package/core/aria/keyboard.js +92 -0
- package/core/aria/rovingtabindex.js +175 -0
- package/core/aria/tab.js +59 -0
- package/core/document/index.js +39 -0
- package/core/dom.js +180 -0
- package/core/overlay/_spec.scss +28 -0
- package/core/overlay/_theme.scss +147 -0
- package/core/overlay/index.js +95 -0
- package/core/overlay/index.scss +2 -0
- package/core/ripple/_spec.scss +196 -0
- package/core/ripple/_theme.scss +20 -0
- package/core/ripple/index.js +286 -0
- package/core/ripple/index.scss +2 -0
- package/core/theme/_aliases.scss +15 -0
- package/core/theme/_config.scss +8 -0
- package/core/theme/_functions.scss +22 -0
- package/{components/theming/palettes.scss → core/theme/_palettes.scss} +173 -151
- package/core/theme/_spec.scss +0 -0
- package/core/theme/_theme.scss +268 -0
- package/core/theme/index.js +50 -0
- package/core/theme/index.scss +4 -0
- package/core/throttler.js +42 -0
- package/core/transition/index.js +465 -0
- package/docs/_flex.scss +28 -0
- package/docs/_menuoptions.js +183 -0
- package/docs/_partials/_androidnavbar.eta +5 -0
- package/docs/_partials/_androidstatusbar.eta +13 -0
- package/docs/_partials/_appbar.eta +27 -0
- package/docs/_partials/_buttontest.eta +31 -0
- package/docs/_partials/_header.eta +146 -0
- package/docs/_partials/_navlistitem.eta +16 -0
- package/docs/_partials/_target.eta +1 -0
- package/docs/_sample-utils.js +88 -0
- package/docs/{src/storage.js → _storage.js} +0 -0
- package/docs/docs.scss +331 -0
- package/docs/framework.scss +26 -0
- package/docs/index.eta +12 -0
- package/docs/index.js +7 -0
- package/docs/pages/appbar.eta +108 -0
- package/docs/pages/appbar.js +0 -0
- package/docs/pages/bottomnav.eta +188 -0
- package/docs/pages/bottomnav.js +118 -0
- package/docs/pages/button.eta +124 -0
- package/docs/pages/button.js +224 -0
- package/docs/pages/card.eta +90 -0
- package/docs/pages/card.js +175 -0
- package/docs/pages/chip.eta +122 -0
- package/docs/pages/chip.js +80 -0
- package/docs/pages/color.eta +143 -0
- package/docs/pages/color.js +261 -0
- package/docs/pages/datatable.eta +323 -0
- package/docs/pages/datatable.js +160 -0
- package/docs/pages/dialog.eta +184 -0
- package/docs/{src/components → pages}/dialog.js +35 -48
- package/docs/pages/dom.eta +26 -0
- package/docs/pages/dom.js +140 -0
- package/docs/pages/elevation.eta +35 -0
- package/docs/pages/elevation.js +0 -0
- package/docs/pages/fab.eta +99 -0
- package/docs/{src/components → pages}/fab.js +6 -13
- package/docs/pages/grid.eta +135 -0
- package/docs/pages/grid.js +128 -0
- package/docs/pages/layout.eta +8 -0
- package/docs/pages/layout.js +0 -0
- package/docs/pages/list.eta +465 -0
- package/docs/pages/list.js +8 -0
- package/docs/pages/menu.eta +274 -0
- package/docs/{src/components → pages}/menu.js +26 -42
- package/docs/pages/overlay.eta +69 -0
- package/docs/pages/overlay.js +3 -0
- package/docs/pages/progress.eta +23 -0
- package/docs/{src/components → pages}/progress.js +2 -4
- package/docs/pages/ripple.eta +27 -0
- package/docs/pages/ripple.js +3 -0
- package/docs/pages/search.eta +242 -0
- package/docs/pages/search.js +226 -0
- package/docs/pages/selection.eta +107 -0
- package/docs/pages/selection.js +12 -0
- package/docs/pages/slider.eta +23 -0
- package/docs/pages/slider.js +0 -0
- package/docs/pages/snackbar.eta +83 -0
- package/docs/{src/components → pages}/snackbar.js +31 -36
- package/docs/pages/tab.eta +407 -0
- package/docs/pages/tab.js +152 -0
- package/docs/pages/textfield.eta +487 -0
- package/docs/{src/components → pages}/textfield.js +41 -45
- package/docs/pages/tooltip.eta +92 -0
- package/docs/pages/tooltip.js +0 -0
- package/docs/pages/transition.eta +117 -0
- package/docs/pages/transition.js +52 -0
- package/docs/pages/type.eta +31 -0
- package/docs/pages/type.js +0 -0
- package/docs/postrender.js +41 -0
- package/docs/prerender.js +16 -0
- package/docs/pwa/_dialogs.eta +143 -0
- package/docs/pwa/_menus.eta +16 -0
- package/docs/pwa/pwa-prerender.js +3 -0
- package/docs/pwa/pwa.eta +478 -0
- package/docs/pwa/pwa.js +298 -0
- package/docs/pwa/pwa.scss +31 -0
- package/docs/themes/theme-colored.scss +15 -0
- package/docs/themes/theme-default.scss +3 -0
- package/index.scss +27 -0
- package/jsconfig.json +8 -2
- package/package.json +54 -27
- package/scripts/deploy-docs.sh +9 -0
- package/templates/index.eta +2 -0
- package/templates/index.pug +3 -0
- package/tsconfig.json +16 -0
- package/utils/function.js +3 -0
- package/webpack.config.js +224 -68
- package/_index.scss +0 -4
- package/components/all-components.scss +0 -21
- package/components/bottomnav/style.scss +0 -190
- package/components/bottomnav/theming.scss +0 -76
- package/components/button/style.scss +0 -315
- package/components/button/theming.scss +0 -134
- package/components/card/style.scss +0 -175
- package/components/card/theming.scss +0 -43
- package/components/common/dom.js +0 -51
- package/components/common/functions.scss +0 -174
- package/components/common/mixins.scss +0 -122
- package/components/common/motion.scss +0 -36
- package/components/common/type.scss +0 -104
- package/components/common/variables.scss +0 -46
- package/components/datatable/style.scss +0 -257
- package/components/datatable/theming.scss +0 -119
- package/components/dialog/style.scss +0 -159
- package/components/dialog/theming.scss +0 -29
- package/components/divider/style.scss +0 -7
- package/components/divider/theming.scss +0 -20
- package/components/elevation/style.scss +0 -32
- package/components/layout/style.scss +0 -223
- package/components/list/style.scss +0 -358
- package/components/list/theming.scss +0 -83
- package/components/menu/style.scss +0 -280
- package/components/menu/theming.scss +0 -80
- package/components/navdrawer/index.js +0 -200
- package/components/navdrawer/style.scss +0 -595
- package/components/navdrawer/theming.scss +0 -62
- package/components/progress/style.scss +0 -136
- package/components/ripple/index.js +0 -63
- package/components/ripple/ripple.scss +0 -122
- package/components/selection/style.scss +0 -320
- package/components/selection/theming.scss +0 -98
- package/components/snackbar/style.scss +0 -212
- package/components/switch/style.scss +0 -3
- package/components/tab/style.scss +0 -275
- package/components/tab/theming.scss +0 -34
- package/components/template/theming.scss +0 -31
- package/components/textfield/style.scss +0 -795
- package/components/textfield/theming.scss +0 -256
- package/components/theming/globals.scss +0 -25
- package/components/theming/theming.scss +0 -559
- package/components/toolbar/style.scss +0 -190
- package/components/toolbar/theming.scss +0 -32
- package/components/tooltip/style.scss +0 -135
- package/components/type/style.scss +0 -167
- package/components/type/theming.scss +0 -25
- package/docs/bottomnav.html +0 -1
- package/docs/bottomnav.min.js +0 -2
- package/docs/bottomnav.min.js.map +0 -1
- package/docs/button.html +0 -1
- package/docs/button.min.js +0 -2
- package/docs/button.min.js.map +0 -1
- package/docs/card.html +0 -1
- package/docs/card.min.js +0 -2
- package/docs/card.min.js.map +0 -1
- package/docs/components.min.css +0 -1
- package/docs/components.min.js +0 -2
- package/docs/components.min.js.map +0 -1
- package/docs/datatable.html +0 -1
- package/docs/datatable.min.js +0 -2
- package/docs/datatable.min.js.map +0 -1
- package/docs/dialog.html +0 -1
- package/docs/dialog.min.js +0 -2
- package/docs/dialog.min.js.map +0 -1
- package/docs/docs.min.css +0 -1
- package/docs/docs.min.js +0 -2
- package/docs/docs.min.js.map +0 -1
- package/docs/elevation.html +0 -1
- package/docs/elevation.min.js +0 -2
- package/docs/elevation.min.js.map +0 -1
- package/docs/fab.html +0 -1
- package/docs/fab.min.js +0 -2
- package/docs/fab.min.js.map +0 -1
- package/docs/index.html +0 -1
- package/docs/index.min.js +0 -2
- package/docs/index.min.js.map +0 -1
- package/docs/layout.html +0 -1
- package/docs/layout.min.js +0 -2
- package/docs/layout.min.js.map +0 -1
- package/docs/list.html +0 -1
- package/docs/list.min.js +0 -2
- package/docs/list.min.js.map +0 -1
- package/docs/menu.html +0 -1
- package/docs/menu.min.js +0 -2
- package/docs/menu.min.js.map +0 -1
- package/docs/navdrawer.html +0 -1
- package/docs/navdrawer.min.js +0 -2
- package/docs/navdrawer.min.js.map +0 -1
- package/docs/prerender.min.js +0 -2
- package/docs/prerender.min.js.map +0 -1
- package/docs/progress.html +0 -1
- package/docs/progress.min.js +0 -2
- package/docs/progress.min.js.map +0 -1
- package/docs/search.html +0 -1
- package/docs/search.min.js +0 -2
- package/docs/search.min.js.map +0 -1
- package/docs/selection.html +0 -1
- package/docs/selection.min.js +0 -2
- package/docs/selection.min.js.map +0 -1
- package/docs/slider.html +0 -1
- package/docs/slider.min.js +0 -2
- package/docs/slider.min.js.map +0 -1
- package/docs/snackbar.html +0 -1
- package/docs/snackbar.min.js +0 -2
- package/docs/snackbar.min.js.map +0 -1
- package/docs/src/components/bottomnav.js +0 -16
- package/docs/src/components/bottomnav.pug +0 -112
- package/docs/src/components/button.js +0 -156
- package/docs/src/components/button.pug +0 -194
- package/docs/src/components/card.js +0 -136
- package/docs/src/components/card.pug +0 -133
- package/docs/src/components/datatable.js +0 -183
- package/docs/src/components/datatable.pug +0 -324
- package/docs/src/components/dialog.pug +0 -138
- package/docs/src/components/elevation.js +0 -3
- package/docs/src/components/elevation.pug +0 -17
- package/docs/src/components/fab.pug +0 -84
- package/docs/src/components/layout.js +0 -116
- package/docs/src/components/layout.pug +0 -104
- package/docs/src/components/list.js +0 -15
- package/docs/src/components/list.pug +0 -293
- package/docs/src/components/menu.pug +0 -292
- package/docs/src/components/navdrawer.js +0 -112
- package/docs/src/components/navdrawer.pug +0 -113
- package/docs/src/components/progress.pug +0 -17
- package/docs/src/components/search.js +0 -206
- package/docs/src/components/search.pug +0 -149
- package/docs/src/components/selection.js +0 -6
- package/docs/src/components/selection.pug +0 -116
- package/docs/src/components/slider.js +0 -3
- package/docs/src/components/slider.pug +0 -19
- package/docs/src/components/snackbar.pug +0 -145
- package/docs/src/components/tab.js +0 -137
- package/docs/src/components/tab.pug +0 -329
- package/docs/src/components/textfield.pug +0 -416
- package/docs/src/components/toolbar.js +0 -6
- package/docs/src/components/toolbar.pug +0 -86
- package/docs/src/components/tooltip.js +0 -6
- package/docs/src/components/tooltip.pug +0 -76
- package/docs/src/components/type.js +0 -6
- package/docs/src/components/type.pug +0 -34
- package/docs/src/components.scss +0 -1
- package/docs/src/docs.scss +0 -284
- package/docs/src/index.js +0 -3
- package/docs/src/index.pug +0 -6
- package/docs/src/menuoptions.js +0 -136
- package/docs/src/mixins.pug +0 -139
- package/docs/src/prerender.js +0 -26
- package/docs/src/sample-utils.js +0 -108
- package/docs/src/targetHandler.js +0 -50
- package/docs/src/theming.ie11.scss +0 -18
- package/docs/src/theming.scss +0 -18
- package/docs/tab.html +0 -1
- package/docs/tab.min.js +0 -2
- package/docs/tab.min.js.map +0 -1
- package/docs/textfield.html +0 -2
- package/docs/textfield.min.js +0 -2
- package/docs/textfield.min.js.map +0 -1
- package/docs/theming.ie11.min.css +0 -1
- package/docs/theming.ie11.min.js +0 -2
- package/docs/theming.ie11.min.js.map +0 -1
- package/docs/theming.min.css +0 -1
- package/docs/theming.min.js +0 -2
- package/docs/theming.min.js.map +0 -1
- package/docs/toolbar.html +0 -1
- package/docs/toolbar.min.js +0 -2
- package/docs/toolbar.min.js.map +0 -1
- package/docs/tooltip.html +0 -1
- package/docs/tooltip.min.js +0 -2
- package/docs/tooltip.min.js.map +0 -1
- package/docs/type.html +0 -1
- package/docs/type.min.js +0 -2
- package/docs/type.min.js.map +0 -1
- package/index.js +0 -16
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
<% var T = '../../templates/index.eta' %>
|
|
2
|
+
<% layout('../_partials/_header.eta', {page: 'datatable'}) %>
|
|
3
|
+
<div class="mdw-grid" mdw-margin-top mdw-margin-bottom>
|
|
4
|
+
<div class="mdw-grid__item" mdw-colspan="100%">
|
|
5
|
+
<div class="mdw-card mdw-theme" mdw-surface="card" mdw-border-ink>
|
|
6
|
+
<div class="mdw-datatable mdw-theme" mdw-ink="primary" style="overflow-x:auto;">
|
|
7
|
+
<table>
|
|
8
|
+
<caption>Standard HTML Table (CSS Only)</caption>
|
|
9
|
+
<thead>
|
|
10
|
+
<tr>
|
|
11
|
+
<th>Dessert (100g serving)</th>
|
|
12
|
+
<th>Calories</th>
|
|
13
|
+
<th>Fat (g)</th>
|
|
14
|
+
<th>Carbs (g)</th>
|
|
15
|
+
<th>Protein (g)</th>
|
|
16
|
+
<th>Sodium (mg)</th>
|
|
17
|
+
<th>Calcium (%)</th>
|
|
18
|
+
<th>Iron (%)</th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<tr>
|
|
23
|
+
<td>Frozen Yogurt</td>
|
|
24
|
+
<td>159</td>
|
|
25
|
+
<td>6.0</td>
|
|
26
|
+
<td>24</td>
|
|
27
|
+
<td>4.0</td>
|
|
28
|
+
<td>87</td>
|
|
29
|
+
<td>14%</td>
|
|
30
|
+
<td>1%</td>
|
|
31
|
+
</tr>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>Ice cream sandwich</td>
|
|
34
|
+
<td>237</td>
|
|
35
|
+
<td>9.0</td>
|
|
36
|
+
<td>37</td>
|
|
37
|
+
<td>4.3</td>
|
|
38
|
+
<td>129</td>
|
|
39
|
+
<td>8%</td>
|
|
40
|
+
<td>1%</td>
|
|
41
|
+
</tr>
|
|
42
|
+
<tr>
|
|
43
|
+
<td>Eclair</td>
|
|
44
|
+
<td>262</td>
|
|
45
|
+
<td>16.0</td>
|
|
46
|
+
<td>24</td>
|
|
47
|
+
<td>6.0</td>
|
|
48
|
+
<td>337</td>
|
|
49
|
+
<td>6%</td>
|
|
50
|
+
<td>7%</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td>Cupcake</td>
|
|
54
|
+
<td>305</td>
|
|
55
|
+
<td>3.7</td>
|
|
56
|
+
<td>67</td>
|
|
57
|
+
<td>4.3</td>
|
|
58
|
+
<td>413</td>
|
|
59
|
+
<td>3%</td>
|
|
60
|
+
<td>8%</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<td>Gingerbread</td>
|
|
64
|
+
<td>356</td>
|
|
65
|
+
<td>16.0</td>
|
|
66
|
+
<td>49</td>
|
|
67
|
+
<td>3.9</td>
|
|
68
|
+
<td>327</td>
|
|
69
|
+
<td>7%</td>
|
|
70
|
+
<td>16%</td>
|
|
71
|
+
</tr>
|
|
72
|
+
<tr>
|
|
73
|
+
<td>Jelly bean</td>
|
|
74
|
+
<td>375</td>
|
|
75
|
+
<td>0.0</td>
|
|
76
|
+
<td>94</td>
|
|
77
|
+
<td>0.0</td>
|
|
78
|
+
<td>50</td>
|
|
79
|
+
<td>0%</td>
|
|
80
|
+
<td>0%</td>
|
|
81
|
+
</tr>
|
|
82
|
+
<tr>
|
|
83
|
+
<td>Lollipop</td>
|
|
84
|
+
<td>392</td>
|
|
85
|
+
<td>0.2</td>
|
|
86
|
+
<td>98</td>
|
|
87
|
+
<td>0</td>
|
|
88
|
+
<td>38</td>
|
|
89
|
+
<td>0%</td>
|
|
90
|
+
<td>2%</td>
|
|
91
|
+
</tr>
|
|
92
|
+
<tr>
|
|
93
|
+
<td>Honeycomb</td>
|
|
94
|
+
<td>408</td>
|
|
95
|
+
<td>3.2</td>
|
|
96
|
+
<td>87</td>
|
|
97
|
+
<td>6.5</td>
|
|
98
|
+
<td>562</td>
|
|
99
|
+
<td>0%</td>
|
|
100
|
+
<td>45%</td>
|
|
101
|
+
</tr>
|
|
102
|
+
<tr>
|
|
103
|
+
<td>Donut</td>
|
|
104
|
+
<td>452</td>
|
|
105
|
+
<td>25.0</td>
|
|
106
|
+
<td>51</td>
|
|
107
|
+
<td>4.9</td>
|
|
108
|
+
<td>326</td>
|
|
109
|
+
<td>2%</td>
|
|
110
|
+
<td>22%</td>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr>
|
|
113
|
+
<td>Kitkat</td>
|
|
114
|
+
<td>518</td>
|
|
115
|
+
<td>26.0</td>
|
|
116
|
+
<td>65</td>
|
|
117
|
+
<td>7</td>
|
|
118
|
+
<td>54</td>
|
|
119
|
+
<td>12%</td>
|
|
120
|
+
<td>6%</td>
|
|
121
|
+
</tr>
|
|
122
|
+
</tbody>
|
|
123
|
+
</table>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="mdw-grid__item" mdw-colspan="100%">
|
|
128
|
+
<div class="mdw-card mdw-theme" mdw-surface="card" mdw-border-ink>
|
|
129
|
+
<div class="mdw-datatable js mdw-theme" mdw-ink="primary" mdw-cell-focusable>
|
|
130
|
+
<div class="mdw-datatable__header">
|
|
131
|
+
<div class="mdw-datatable__header-text">Customized HTML Table</div>
|
|
132
|
+
</div>
|
|
133
|
+
<div class="mdw-datatable__scroller">
|
|
134
|
+
<table>
|
|
135
|
+
<thead>
|
|
136
|
+
<tr>
|
|
137
|
+
<th aria-sort="none" mdw-text mdw-primary-column><span class="mdw-datatable__sort-icon material-icons">arrow_downward</span>Dessert (100g serving)</th>
|
|
138
|
+
<th aria-sort="ascending" mdw-number><span class="mdw-datatable__sort-icon material-icons">arrow_downward</span><span class="mdw-tooltip__wrapper"><span class="mdw-tooltip__target">Calories</span><div class="mdw-tooltip mdw-theme" mdw-surface="background 700" mdw-dark>The total amount of food energy in the given serving size.</div></span></th>
|
|
139
|
+
<th aria-sort="none" mdw-number><span class="mdw-datatable__sort-icon material-icons">arrow_downward</span>Fat (g)</th>
|
|
140
|
+
<th aria-sort="none" mdw-number><span class="mdw-datatable__sort-icon material-icons">arrow_downward</span>Carbs (g)</th>
|
|
141
|
+
<th aria-sort="none" mdw-number><span class="mdw-datatable__sort-icon material-icons">arrow_downward</span>Protein (g)</th>
|
|
142
|
+
<th aria-sort="none" mdw-number><span class="mdw-datatable__sort-icon material-icons">arrow_downward</span>Sodium (mg)</th>
|
|
143
|
+
<th aria-sort="none" mdw-number><span class="mdw-datatable__sort-icon material-icons">arrow_downward</span>Calcium (%)</th>
|
|
144
|
+
<th aria-sort="none" mdw-number><span class="mdw-datatable__sort-icon material-icons">arrow_downward</span>Iron (%)</th>
|
|
145
|
+
</tr>
|
|
146
|
+
</thead>
|
|
147
|
+
<tbody>
|
|
148
|
+
<tr>
|
|
149
|
+
<td mdw-text mdw-primary-column>Frozen Yogurt</td>
|
|
150
|
+
<td mdw-number>159</td>
|
|
151
|
+
<td mdw-number>6.0</td>
|
|
152
|
+
<td mdw-number>24</td>
|
|
153
|
+
<td mdw-number>4.0</td>
|
|
154
|
+
<td mdw-number>87</td>
|
|
155
|
+
<td mdw-number>14%</td>
|
|
156
|
+
<td mdw-number>1%</td>
|
|
157
|
+
</tr>
|
|
158
|
+
<tr>
|
|
159
|
+
<td mdw-text mdw-primary-column>Ice cream sandwich</td>
|
|
160
|
+
<td mdw-number>237</td>
|
|
161
|
+
<td mdw-number>9.0</td>
|
|
162
|
+
<td mdw-number>37</td>
|
|
163
|
+
<td mdw-number>4.3</td>
|
|
164
|
+
<td mdw-number>129</td>
|
|
165
|
+
<td mdw-number>8%</td>
|
|
166
|
+
<td mdw-number>1%</td>
|
|
167
|
+
</tr>
|
|
168
|
+
<tr>
|
|
169
|
+
<td mdw-text mdw-primary-column>Eclair</td>
|
|
170
|
+
<td mdw-number>262</td>
|
|
171
|
+
<td mdw-number>16.0</td>
|
|
172
|
+
<td mdw-number>24</td>
|
|
173
|
+
<td mdw-number>6.0</td>
|
|
174
|
+
<td mdw-number>337</td>
|
|
175
|
+
<td mdw-number>6%</td>
|
|
176
|
+
<td mdw-number>7%</td>
|
|
177
|
+
</tr>
|
|
178
|
+
<tr>
|
|
179
|
+
<td mdw-text mdw-primary-column>Cupcake</td>
|
|
180
|
+
<td mdw-number>305</td>
|
|
181
|
+
<td mdw-number>3.7</td>
|
|
182
|
+
<td mdw-number>67</td>
|
|
183
|
+
<td mdw-number>4.3</td>
|
|
184
|
+
<td mdw-number>413</td>
|
|
185
|
+
<td mdw-number>3%</td>
|
|
186
|
+
<td mdw-number>8%</td>
|
|
187
|
+
</tr>
|
|
188
|
+
<tr>
|
|
189
|
+
<td mdw-text mdw-primary-column>Gingerbread</td>
|
|
190
|
+
<td mdw-number>356</td>
|
|
191
|
+
<td mdw-number>16.0</td>
|
|
192
|
+
<td mdw-number>49</td>
|
|
193
|
+
<td mdw-number>3.9</td>
|
|
194
|
+
<td mdw-number>327</td>
|
|
195
|
+
<td mdw-number>7%</td>
|
|
196
|
+
<td mdw-number>16%</td>
|
|
197
|
+
</tr>
|
|
198
|
+
<tr>
|
|
199
|
+
<td mdw-text mdw-primary-column>Jelly bean</td>
|
|
200
|
+
<td mdw-number>375</td>
|
|
201
|
+
<td mdw-number>0.0</td>
|
|
202
|
+
<td mdw-number>94</td>
|
|
203
|
+
<td mdw-number>0.0</td>
|
|
204
|
+
<td mdw-number>50</td>
|
|
205
|
+
<td mdw-number>0%</td>
|
|
206
|
+
<td mdw-number>0%</td>
|
|
207
|
+
</tr>
|
|
208
|
+
<tr>
|
|
209
|
+
<td mdw-text mdw-primary-column>Lollipop</td>
|
|
210
|
+
<td mdw-number>392</td>
|
|
211
|
+
<td mdw-number>0.2</td>
|
|
212
|
+
<td mdw-number>98</td>
|
|
213
|
+
<td mdw-number>0</td>
|
|
214
|
+
<td mdw-number>38</td>
|
|
215
|
+
<td mdw-number>0%</td>
|
|
216
|
+
<td mdw-number>2%</td>
|
|
217
|
+
</tr>
|
|
218
|
+
<tr>
|
|
219
|
+
<td mdw-text mdw-primary-column>Honeycomb</td>
|
|
220
|
+
<td mdw-number>408</td>
|
|
221
|
+
<td mdw-number>3.2</td>
|
|
222
|
+
<td mdw-number>87</td>
|
|
223
|
+
<td mdw-number>6.5</td>
|
|
224
|
+
<td mdw-number>562</td>
|
|
225
|
+
<td mdw-number>0%</td>
|
|
226
|
+
<td mdw-number>45%</td>
|
|
227
|
+
</tr>
|
|
228
|
+
<tr>
|
|
229
|
+
<td mdw-text mdw-primary-column>Donut</td>
|
|
230
|
+
<td mdw-number>452</td>
|
|
231
|
+
<td mdw-number>25.0</td>
|
|
232
|
+
<td mdw-number>51</td>
|
|
233
|
+
<td mdw-number>4.9</td>
|
|
234
|
+
<td mdw-number>326</td>
|
|
235
|
+
<td mdw-number>2%</td>
|
|
236
|
+
<td mdw-number>22%</td>
|
|
237
|
+
</tr>
|
|
238
|
+
<tr>
|
|
239
|
+
<td mdw-text mdw-primary-column>Kitkat</td>
|
|
240
|
+
<td mdw-number>518</td>
|
|
241
|
+
<td mdw-number>26.0</td>
|
|
242
|
+
<td mdw-number>65</td>
|
|
243
|
+
<td mdw-number>7</td>
|
|
244
|
+
<td mdw-number>54</td>
|
|
245
|
+
<td mdw-number>12%</td>
|
|
246
|
+
<td mdw-number>6%</td>
|
|
247
|
+
</tr>
|
|
248
|
+
</tbody>
|
|
249
|
+
</table>
|
|
250
|
+
</div>
|
|
251
|
+
<div class="mdw-datatable__footer">
|
|
252
|
+
<div class="mdw-datatable__footer-options">
|
|
253
|
+
<div>Rows per page</div>
|
|
254
|
+
<label class="mdw-textfield" mdw-solo>
|
|
255
|
+
<select class="mdw-textfield__input">
|
|
256
|
+
<option class="mdw-theme" mdw-surface="card" value="10">10</option>
|
|
257
|
+
<option class="mdw-theme" mdw-surface="card" value="25">25</option>
|
|
258
|
+
<option class="mdw-theme" mdw-surface="card" value="50">50</option>
|
|
259
|
+
<option class="mdw-theme" mdw-surface="card" value="100">100</option>
|
|
260
|
+
</select>
|
|
261
|
+
<div class="mdw-textfield__icon" mdw-dropdown></div>
|
|
262
|
+
</label>
|
|
263
|
+
</div>
|
|
264
|
+
<div class="mdw-datatable__footer-details">1-10 of 10</div>
|
|
265
|
+
<div class="mdw-datatable__footer-controls">
|
|
266
|
+
<%~ includeFile(T, { button: { icon:true, disabled:true , class:'material-icons', text:'chevron_left' }}) %>
|
|
267
|
+
<%~ includeFile(T, { button: { icon: true, disabled:true , class:'material-icons', text:'chevron_right' }}) %>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
<div class="mdw-grid__item" mdw-colspan="100%">
|
|
274
|
+
<div class="mdw-card mdw-theme" mdw-surface="card" mdw-border-ink>
|
|
275
|
+
<div class="mdw-datatable js mdw-theme" id="dynamic-table" mdw-ink="primary" mdw-row-focusable style="max-height:80vh;">
|
|
276
|
+
<div class="mdw-datatable__header">
|
|
277
|
+
<div class="mdw-datatable__header-text">Data Table Adapter</div>
|
|
278
|
+
<div class="mdw-datatable__header-controls">
|
|
279
|
+
<div class="mdw-menu__wrapper">
|
|
280
|
+
<%~ includeFile(T, { button: { icon:true, ink:'primary' , class:'material-icons', attributes: {'mdw-overlay-default':"medium", 'aria-pressed':"false"}, text:'filter_list' }}) %>
|
|
281
|
+
<div class="mdw-menu" mdw-position="end">
|
|
282
|
+
<div class="mdw-menu__popup mdw-theme" mdw-surface="card">
|
|
283
|
+
<div class="mdw-menu__item" aria-checked="true" data-filter="none">
|
|
284
|
+
<div class="mdw-menu__radio mdw-theme material-icons" mdw-ink="medium">check</div>
|
|
285
|
+
<div class="mdw-menu__text">No filter</div>
|
|
286
|
+
</div>
|
|
287
|
+
<div class="mdw-menu__item" data-filter="md">
|
|
288
|
+
<div class="mdw-menu__radio mdw-theme material-icons" mdw-ink="medium">check</div>
|
|
289
|
+
<div class="mdw-menu__text">Contains 'md'</div>
|
|
290
|
+
</div>
|
|
291
|
+
<div class="mdw-menu__item" data-filter="div9">
|
|
292
|
+
<div class="mdw-menu__radio mdw-theme material-icons" mdw-ink="medium">check</div>
|
|
293
|
+
<div class="mdw-menu__text">Random divisible by 9</div>
|
|
294
|
+
</div>
|
|
295
|
+
<div class="mdw-menu__item" data-filter="bool">
|
|
296
|
+
<div class="mdw-menu__radio mdw-theme material-icons" mdw-ink="medium">check</div>
|
|
297
|
+
<div class="mdw-menu__text">bool is checked</div>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
<div class="mdw-menu__wrapper">
|
|
303
|
+
<%~ includeFile(T, { button: { icon:true, ink:'medium' , class:'material-icons', text:'more_vert' }}) %>
|
|
304
|
+
<div class="mdw-menu" mdw-position="end">
|
|
305
|
+
<div class="mdw-menu__popup mdw-theme" mdw-surface="card">
|
|
306
|
+
<div class="mdw-menu__item" aria-checked="true" data-option="throttle">
|
|
307
|
+
<div class="mdw-menu__check mdw-theme material-icons" mdw-ink="medium">check</div>
|
|
308
|
+
<div class="mdw-menu__text">Throttle</div>
|
|
309
|
+
</div>
|
|
310
|
+
<div class="mdw-menu__item" aria-checked="true" data-option="paginate">
|
|
311
|
+
<div class="mdw-menu__check mdw-theme material-icons" mdw-ink="medium">check</div>
|
|
312
|
+
<div class="mdw-menu__text">Paginate</div>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
</div>
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
<script src="datatable.min.js"></script>
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import DataTableAdapter from '../../adapters/datatable/index.js';
|
|
2
|
+
import * as Button from '../../components/button/index.js';
|
|
3
|
+
import * as DataTable from '../../components/datatable/index.js';
|
|
4
|
+
import * as Menu from '../../components/menu/index.js';
|
|
5
|
+
import * as MenuItem from '../../components/menu/item.js';
|
|
6
|
+
import * as Selection from '../../components/selection/index.js';
|
|
7
|
+
|
|
8
|
+
/** @return {void} */
|
|
9
|
+
function initializeMdwComponents() {
|
|
10
|
+
for (const element of document.querySelectorAll('.mdw-datatable.js')) { DataTable.attach(element); }
|
|
11
|
+
for (const element of document.getElementsByClassName('mdw-button')) { Button.attach(element); }
|
|
12
|
+
for (const element of document.getElementsByClassName('mdw-selection')) { Selection.attach(element); }
|
|
13
|
+
for (const element of document.getElementsByClassName('mdw-menu')) { Menu.attach(element); }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} CustomData
|
|
18
|
+
* @prop {boolean} selected
|
|
19
|
+
* @prop {string} text
|
|
20
|
+
* @prop {string} text2
|
|
21
|
+
* @prop {boolean} check1
|
|
22
|
+
* @prop {number} increment
|
|
23
|
+
* @prop {number} random
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** @type {DataTableAdapter<CustomData>} */
|
|
27
|
+
let dynamicTableAdapter = null;
|
|
28
|
+
/** @return {void} */
|
|
29
|
+
function buildDynamicTable() {
|
|
30
|
+
/** @type {CustomData[]} */
|
|
31
|
+
const datasource = [];
|
|
32
|
+
let count = 1;
|
|
33
|
+
const addDatasourceObject = () => {
|
|
34
|
+
datasource.push({
|
|
35
|
+
selected: false,
|
|
36
|
+
text: Math.random().toString(36).slice(2),
|
|
37
|
+
text2: Math.random().toString(36).slice(2),
|
|
38
|
+
check1: Math.random() > 0.5,
|
|
39
|
+
increment: count,
|
|
40
|
+
random: Math.floor(Math.random() * 99_999),
|
|
41
|
+
});
|
|
42
|
+
count += 1;
|
|
43
|
+
};
|
|
44
|
+
for (let i = 0; i < 256; i += 1) {
|
|
45
|
+
addDatasourceObject();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const datatable = document.getElementById('dynamic-table');
|
|
49
|
+
dynamicTableAdapter = new DataTableAdapter({ datatable, datasource });
|
|
50
|
+
dynamicTableAdapter.addColumn({
|
|
51
|
+
key: 'selected',
|
|
52
|
+
type: 'checkbox',
|
|
53
|
+
rowSelector: true,
|
|
54
|
+
});
|
|
55
|
+
dynamicTableAdapter.addColumn({
|
|
56
|
+
key: 'text',
|
|
57
|
+
name: 'Primary Column (full-width)',
|
|
58
|
+
primaryColumn: true,
|
|
59
|
+
sortable: true,
|
|
60
|
+
type: 'text',
|
|
61
|
+
});
|
|
62
|
+
dynamicTableAdapter.addColumn({
|
|
63
|
+
key: 'text2',
|
|
64
|
+
name: 'Text field',
|
|
65
|
+
sortable: true,
|
|
66
|
+
type: 'text',
|
|
67
|
+
});
|
|
68
|
+
dynamicTableAdapter.addColumn({
|
|
69
|
+
key: 'check1',
|
|
70
|
+
name: 'bool',
|
|
71
|
+
type: 'checkbox',
|
|
72
|
+
tooltip: 'Non-selection boolean value',
|
|
73
|
+
sortable: true,
|
|
74
|
+
});
|
|
75
|
+
dynamicTableAdapter.addColumn({
|
|
76
|
+
key: 'increment',
|
|
77
|
+
name: 'Increment',
|
|
78
|
+
type: 'number',
|
|
79
|
+
sortable: true,
|
|
80
|
+
});
|
|
81
|
+
dynamicTableAdapter.addColumn({
|
|
82
|
+
key: 'random',
|
|
83
|
+
name: 'Random',
|
|
84
|
+
sortable: true,
|
|
85
|
+
type: 'number',
|
|
86
|
+
});
|
|
87
|
+
dynamicTableAdapter.setUseLazyRendering(true);
|
|
88
|
+
dynamicTableAdapter.setPagination();
|
|
89
|
+
dynamicTableAdapter.refresh();
|
|
90
|
+
const buttons = dynamicTableAdapter.element.querySelectorAll('.mdw-datatable__header-controls .mdw-button');
|
|
91
|
+
const filterButton = buttons[0];
|
|
92
|
+
const optionsButton = buttons[1];
|
|
93
|
+
const menus = dynamicTableAdapter.element.querySelectorAll('.mdw-datatable__header-controls .mdw-menu');
|
|
94
|
+
const filterMenu = menus[0];
|
|
95
|
+
const optionsMenu = menus[1];
|
|
96
|
+
Menu.attach(filterMenu);
|
|
97
|
+
Menu.attach(optionsMenu);
|
|
98
|
+
|
|
99
|
+
filterButton.addEventListener('click', (/** @type {MouseEvent} */ event) => Menu.show(filterMenu, event));
|
|
100
|
+
optionsButton.addEventListener('click', (/** @type {MouseEvent} */ event) => Menu.show(optionsMenu, event));
|
|
101
|
+
|
|
102
|
+
filterMenu.addEventListener(MenuItem.CHECK_EVENT, (event) => {
|
|
103
|
+
const menuItem = /** @type {HTMLElement} */ (event.target);
|
|
104
|
+
switch (menuItem.dataset.filter) {
|
|
105
|
+
default:
|
|
106
|
+
case 'none':
|
|
107
|
+
dynamicTableAdapter.setFilter(null);
|
|
108
|
+
break;
|
|
109
|
+
case 'md':
|
|
110
|
+
dynamicTableAdapter.setFilter((data) => data.text.includes('md') || data.text2.includes('md'));
|
|
111
|
+
break;
|
|
112
|
+
case 'div9':
|
|
113
|
+
dynamicTableAdapter.setFilter((data) => data.random % 9 === 0);
|
|
114
|
+
break;
|
|
115
|
+
case 'bool':
|
|
116
|
+
dynamicTableAdapter.setFilter((data) => data.check1);
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
dynamicTableAdapter.refresh();
|
|
120
|
+
if (dynamicTableAdapter.filter) {
|
|
121
|
+
filterButton.setAttribute('aria-pressed', 'true');
|
|
122
|
+
} else {
|
|
123
|
+
filterButton.setAttribute('aria-pressed', 'false');
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
filterMenu.addEventListener(MenuItem.ACTIVATE_EVENT, () => Menu.hide(filterMenu));
|
|
127
|
+
|
|
128
|
+
optionsMenu.addEventListener(MenuItem.CHECK_EVENT, (event) => {
|
|
129
|
+
const menuItem = /** @type {HTMLElement} */ (event.target);
|
|
130
|
+
switch (menuItem.dataset.option) {
|
|
131
|
+
default:
|
|
132
|
+
break;
|
|
133
|
+
case 'throttle':
|
|
134
|
+
dynamicTableAdapter.setUseLazyRendering(true);
|
|
135
|
+
break;
|
|
136
|
+
case 'paginate':
|
|
137
|
+
dynamicTableAdapter.setPagination();
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
dynamicTableAdapter.refresh();
|
|
141
|
+
});
|
|
142
|
+
optionsMenu.addEventListener(MenuItem.UNCHECK_EVENT, (event) => {
|
|
143
|
+
const menuItem = /** @type {HTMLElement} */ (event.target);
|
|
144
|
+
switch (menuItem.dataset.option) {
|
|
145
|
+
default:
|
|
146
|
+
break;
|
|
147
|
+
case 'throttle':
|
|
148
|
+
dynamicTableAdapter.setUseLazyRendering(false);
|
|
149
|
+
break;
|
|
150
|
+
case 'paginate':
|
|
151
|
+
dynamicTableAdapter.setPagination({ disabled: true });
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
dynamicTableAdapter.refresh();
|
|
155
|
+
});
|
|
156
|
+
optionsMenu.addEventListener(MenuItem.ACTIVATE_EVENT, () => Menu.hide(optionsMenu));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
initializeMdwComponents();
|
|
160
|
+
buildDynamicTable();
|