@limetech/lime-elements 35.0.0-next.9 → 35.0.1-next.2
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/dist/cjs/{_arrayIncludesWith-36a6fafb.js → _arrayIncludesWith-29083f83.js} +5 -4
- package/dist/cjs/{_assignValue-c9fc3712.js → _assignValue-7c18d8d6.js} +1 -1
- package/dist/cjs/_defineProperty-8f56146d.js +13 -0
- package/dist/cjs/{_defineProperty-8351e789.js → _getNative-60328036.js} +0 -9
- package/dist/cjs/checkbox.template-b6c6562c.js +43 -0
- package/dist/cjs/{component-f7ef9087.js → component-66df95e7.js} +190 -132
- package/dist/cjs/{component-f532119f.js → component-67144c1c.js} +47 -3
- package/dist/cjs/{component-ed21410d.js → component-ae3bfacf.js} +367 -235
- package/dist/cjs/{component-2faaa141.js → component-cf490570.js} +213 -143
- package/dist/cjs/{component-10dbdd60.js → component-dd795ff0.js} +7 -5
- package/dist/cjs/{dateFormatter-26eac73a.js → dateFormatter-05d80b12.js} +37 -31
- package/dist/cjs/identity-6dc34885.js +44 -0
- package/dist/cjs/{index-e63a89d7.js → index-2a28697b.js} +27 -1
- package/dist/cjs/{isEqual-e3b9c27c.js → isEqual-d2a13a24.js} +13 -55
- package/dist/cjs/lime-elements.cjs.js +3 -3
- package/dist/cjs/limel-badge.cjs.entry.js +4 -4
- package/dist/cjs/limel-banner.cjs.entry.js +2 -2
- package/dist/cjs/limel-button-group.cjs.entry.js +3 -3
- package/dist/cjs/limel-button.cjs.entry.js +3 -3
- package/dist/cjs/limel-checkbox.cjs.entry.js +136 -90
- package/dist/cjs/limel-chip-set.cjs.entry.js +235 -191
- package/dist/cjs/limel-circular-progress.cjs.entry.js +3 -3
- package/dist/cjs/limel-code-editor.cjs.entry.js +51 -24
- package/dist/cjs/limel-collapsible-section.cjs.entry.js +2 -2
- package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +7 -6
- package/dist/cjs/limel-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/limel-config.cjs.entry.js +2 -2
- package/dist/cjs/limel-date-picker.cjs.entry.js +8 -8
- package/dist/cjs/limel-dialog.cjs.entry.js +35 -19
- package/dist/cjs/limel-file.cjs.entry.js +11 -9
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +987 -669
- package/dist/cjs/limel-flex-container.cjs.entry.js +6 -2
- package/dist/cjs/limel-form.cjs.entry.js +19985 -20009
- package/dist/cjs/limel-grid.cjs.entry.js +2 -2
- package/dist/cjs/limel-header.cjs.entry.js +2 -2
- package/dist/cjs/limel-icon-button.cjs.entry.js +6 -6
- package/dist/cjs/limel-icon.cjs.entry.js +2 -2
- package/dist/cjs/limel-input-field.cjs.entry.js +12 -10
- package/dist/cjs/limel-linear-progress.cjs.entry.js +4 -4
- package/dist/cjs/limel-list_3.cjs.entry.js +154 -91
- package/dist/cjs/limel-menu-list.cjs.entry.js +87 -74
- package/dist/cjs/limel-menu.cjs.entry.js +6 -5
- package/dist/cjs/limel-picker.cjs.entry.js +6 -8
- package/dist/cjs/limel-popover-surface.cjs.entry.js +3 -3
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js +2 -2
- package/dist/cjs/limel-progress-flow.cjs.entry.js +2 -2
- package/dist/cjs/limel-select.cjs.entry.js +6 -6
- package/dist/cjs/limel-slider.cjs.entry.js +34 -7
- package/dist/cjs/limel-snackbar.cjs.entry.js +79 -73
- package/dist/cjs/limel-spinner.cjs.entry.js +2 -2
- package/dist/cjs/limel-switch.cjs.entry.js +498 -202
- package/dist/cjs/limel-tab-bar.cjs.entry.js +269 -190
- package/dist/cjs/limel-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/limel-table.cjs.entry.js +79 -17
- package/dist/cjs/limel-tooltip_2.cjs.entry.js +3 -3
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{moment-d287c0ed.js → moment-5cfac5cd.js} +94 -79
- package/dist/cjs/{pickBy-88b0430a.js → pickBy-3ef47bf2.js} +6 -5
- package/dist/cjs/{zipObject-4050a45f.js → zipObject-93a471fa.js} +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/badge/badge.css +9 -15
- package/dist/collection/components/badge/badge.js +2 -2
- package/dist/collection/components/button/button.css +333 -145
- package/dist/collection/components/button-group/button-group.css +30 -5
- package/dist/collection/components/checkbox/checkbox.css +71 -20
- package/dist/collection/components/checkbox/checkbox.js +5 -4
- package/dist/collection/components/checkbox/checkbox.template.js +24 -20
- package/dist/collection/components/chip-set/chip-set.css +367 -34
- package/dist/collection/components/circular-progress/circular-progress.css +2 -2
- package/dist/collection/components/code-editor/code-editor.css +8 -13
- package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.css +1 -1
- package/dist/collection/components/dialog/dialog.css +153 -109
- package/dist/collection/components/dialog/dialog.js +36 -11
- package/dist/collection/components/file/icon-background-colors.js +2 -1
- package/dist/collection/components/file/icon-fill-colors.js +2 -1
- package/dist/collection/components/file/icons.js +1 -1
- package/dist/collection/components/flex-container/flex-container.js +10 -0
- package/dist/collection/components/form/fields/schema-field.js +0 -1
- package/dist/collection/components/form/form.css +5 -1
- package/dist/collection/components/form/form.js +34 -0
- package/dist/collection/components/form/form.types.js +0 -1
- package/dist/collection/components/form/templates/common.js +4 -1
- package/dist/collection/components/icon-button/icon-button.css +116 -59
- package/dist/collection/components/icon-button/icon-button.js +1 -0
- package/dist/collection/components/input-field/input-field.css +344 -29
- package/dist/collection/components/input-field/input-field.js +5 -3
- package/dist/collection/components/linear-progress/linear-progress.css +14 -2
- package/dist/collection/components/list/list-renderer.js +1 -4
- package/dist/collection/components/list/list.css +938 -93
- package/dist/collection/components/list/list.js +13 -6
- package/dist/collection/components/menu-list/menu-list-renderer.js +1 -4
- package/dist/collection/components/menu-list/menu-list.css +938 -93
- package/dist/collection/components/menu-surface/menu-surface.css +31 -7
- package/dist/collection/components/picker/picker.js +6 -7
- package/dist/collection/components/popover-surface/popover-surface.css +1 -0
- package/dist/collection/components/select/select.css +424 -17
- package/dist/collection/components/select/select.template.js +1 -1
- package/dist/collection/components/slider/slider.css +49 -2
- package/dist/collection/components/snackbar/snackbar.css +588 -301
- package/dist/collection/components/switch/switch.css +592 -222
- package/dist/collection/components/switch/switch.js +18 -12
- package/dist/collection/components/tab-bar/tab-bar.css +77 -48
- package/dist/collection/components/table/table.css +219 -165
- package/dist/collection/components/table/table.js +99 -15
- package/dist/collection/components/table/table.types.js +0 -1
- package/dist/collection/style/functions.scss +3 -1
- package/dist/collection/style/internal/lime-theme.scss +30 -31
- package/dist/collection/style/internal/lime-typography.scss +55 -56
- package/dist/esm/{_arrayIncludesWith-b5d3fd9e.js → _arrayIncludesWith-969bccda.js} +4 -3
- package/dist/esm/{_assignValue-08fe10bc.js → _assignValue-fb2bf80a.js} +1 -1
- package/dist/esm/_defineProperty-2105cb48.js +11 -0
- package/dist/esm/{_defineProperty-8c869077.js → _getNative-93d6bfe9.js} +1 -9
- package/dist/esm/checkbox.template-2f1bbc98.js +41 -0
- package/dist/esm/{component-89e0ce26.js → component-19eb6e2b.js} +7 -5
- package/dist/esm/{component-2630c3d7.js → component-288691f3.js} +367 -235
- package/dist/esm/{component-d682c974.js → component-410aad5a.js} +44 -4
- package/dist/esm/{component-429e92ee.js → component-5b4ac85a.js} +213 -143
- package/dist/esm/{component-834d85a1.js → component-fffa3419.js} +190 -132
- package/dist/esm/{dateFormatter-c9b41548.js → dateFormatter-2cad0292.js} +37 -31
- package/dist/esm/identity-87aa3962.js +41 -0
- package/dist/esm/{index-2316f345.js → index-11cd0b60.js} +27 -1
- package/dist/esm/{isArrayLike-dd37ba9a.js → isArrayLike-385e0f31.js} +1 -1
- package/dist/esm/{isEqual-4f22635f.js → isEqual-c5a636a4.js} +3 -43
- package/dist/esm/lime-elements.js +3 -3
- package/dist/esm/limel-badge.entry.js +4 -4
- package/dist/esm/limel-banner.entry.js +2 -2
- package/dist/esm/limel-button-group.entry.js +3 -3
- package/dist/esm/limel-button.entry.js +3 -3
- package/dist/esm/limel-checkbox.entry.js +136 -90
- package/dist/esm/limel-chip-set.entry.js +235 -191
- package/dist/esm/limel-circular-progress.entry.js +3 -3
- package/dist/esm/limel-code-editor.entry.js +51 -24
- package/dist/esm/limel-collapsible-section.entry.js +2 -2
- package/dist/esm/limel-color-picker-palette_2.entry.js +7 -6
- package/dist/esm/limel-color-picker.entry.js +2 -2
- package/dist/esm/limel-config.entry.js +2 -2
- package/dist/esm/limel-date-picker.entry.js +8 -8
- package/dist/esm/limel-dialog.entry.js +35 -19
- package/dist/esm/limel-file.entry.js +11 -9
- package/dist/esm/limel-flatpickr-adapter.entry.js +988 -670
- package/dist/esm/limel-flex-container.entry.js +6 -2
- package/dist/esm/limel-form.entry.js +19966 -19990
- package/dist/esm/limel-grid.entry.js +2 -2
- package/dist/esm/limel-header.entry.js +2 -2
- package/dist/esm/limel-icon-button.entry.js +6 -6
- package/dist/esm/limel-icon.entry.js +2 -2
- package/dist/esm/limel-input-field.entry.js +12 -10
- package/dist/esm/limel-linear-progress.entry.js +4 -4
- package/dist/esm/limel-list_3.entry.js +154 -91
- package/dist/esm/limel-menu-list.entry.js +87 -74
- package/dist/esm/limel-menu.entry.js +6 -5
- package/dist/esm/limel-picker.entry.js +6 -8
- package/dist/esm/limel-popover-surface.entry.js +3 -3
- package/dist/esm/limel-progress-flow-item.entry.js +2 -2
- package/dist/esm/limel-progress-flow.entry.js +2 -2
- package/dist/esm/limel-select.entry.js +6 -6
- package/dist/esm/limel-slider.entry.js +34 -7
- package/dist/esm/limel-snackbar.entry.js +79 -73
- package/dist/esm/limel-spinner.entry.js +2 -2
- package/dist/esm/limel-switch.entry.js +498 -202
- package/dist/esm/limel-tab-bar.entry.js +269 -190
- package/dist/esm/limel-tab-panel.entry.js +2 -2
- package/dist/esm/limel-table.entry.js +80 -18
- package/dist/esm/limel-tooltip_2.entry.js +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{moment-8dadd938.js → moment-367e51c5.js} +94 -79
- package/dist/esm/{pickBy-8a849e46.js → pickBy-d359eb12.js} +4 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{zipObject-22e88ce9.js → zipObject-2bb1968e.js} +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-101af376.entry.js +1 -0
- package/dist/lime-elements/p-1a9a961a.entry.js +11 -0
- package/dist/lime-elements/p-1c284626.js +73 -0
- package/dist/lime-elements/p-1ede893b.js +1 -0
- package/dist/lime-elements/p-2639edf9.entry.js +73 -0
- package/dist/lime-elements/p-2754e134.entry.js +1 -0
- package/dist/lime-elements/p-2da6e2a3.entry.js +1 -0
- package/dist/lime-elements/p-36ecbd03.entry.js +1 -0
- package/dist/lime-elements/p-3af5f9ad.js +3 -0
- package/dist/lime-elements/p-404e1465.entry.js +1 -0
- package/dist/lime-elements/p-42b67933.entry.js +1 -0
- package/dist/lime-elements/p-440454ed.entry.js +1 -0
- package/dist/lime-elements/{p-076bd4dc.js → p-48d4ef20.js} +3 -3
- package/dist/lime-elements/p-4c3358cb.js +1 -0
- package/dist/lime-elements/p-4d5a874a.entry.js +1 -0
- package/dist/lime-elements/p-53e01330.entry.js +1 -0
- package/dist/lime-elements/p-5908c21d.entry.js +1 -0
- package/dist/lime-elements/p-5fdb83c9.js +1 -0
- package/dist/lime-elements/p-63e25a0a.entry.js +1 -0
- package/dist/lime-elements/p-669626e5.js +1 -0
- package/dist/lime-elements/p-6966b5df.entry.js +1 -0
- package/dist/lime-elements/p-6e7809a6.entry.js +1 -0
- package/dist/lime-elements/p-705334c1.entry.js +1 -0
- package/dist/lime-elements/p-71efe2ca.entry.js +37 -0
- package/dist/lime-elements/p-7cda574b.js +1 -0
- package/dist/lime-elements/p-83ea517b.entry.js +1 -0
- package/dist/lime-elements/p-84f933f7.entry.js +16 -0
- package/dist/lime-elements/p-8827628d.entry.js +131 -0
- package/dist/lime-elements/{p-8ad5e143.entry.js → p-94899019.entry.js} +1 -1
- package/dist/lime-elements/p-95f275ab.entry.js +1 -0
- package/dist/lime-elements/p-97d6c4a6.entry.js +1 -0
- package/dist/lime-elements/{p-7f43b0c4.js → p-9acf7b5d.js} +1 -1
- package/dist/lime-elements/p-a465084b.entry.js +82 -0
- package/dist/lime-elements/p-a5af84a7.entry.js +1 -0
- package/dist/lime-elements/p-ad8cb388.js +1 -0
- package/dist/lime-elements/p-ade76f1d.js +1 -0
- package/dist/lime-elements/p-af0ec482.entry.js +16 -0
- package/dist/lime-elements/{p-090bc949.js → p-b28128d2.js} +1 -1
- package/dist/lime-elements/p-b91dc1ef.entry.js +1 -0
- package/dist/lime-elements/p-b95e80c9.entry.js +1 -0
- package/dist/lime-elements/p-bd8c9384.entry.js +1 -0
- package/dist/lime-elements/p-c7953a05.entry.js +82 -0
- package/dist/lime-elements/p-c80acfb2.entry.js +59 -0
- package/dist/lime-elements/p-cbc43682.js +81 -0
- package/dist/lime-elements/{p-ace9affc.js → p-d0a7de87.js} +2 -2
- package/dist/lime-elements/p-d1ee4501.entry.js +37 -0
- package/dist/lime-elements/p-d74fa89e.entry.js +1 -0
- package/dist/lime-elements/{p-e1928c0e.js → p-d76f896d.js} +1 -1
- package/dist/lime-elements/p-dfba92de.js +126 -0
- package/dist/lime-elements/p-dfbe015e.entry.js +1 -0
- package/dist/lime-elements/p-e80dd2ff.entry.js +1 -0
- package/dist/lime-elements/p-e83dddcd.entry.js +126 -0
- package/dist/lime-elements/p-e98d76e8.entry.js +59 -0
- package/dist/lime-elements/{p-92146da6.js → p-e9a95b8f.js} +1 -1
- package/dist/lime-elements/p-ed65468d.entry.js +1 -0
- package/dist/lime-elements/p-f0c9dadd.entry.js +1 -0
- package/dist/lime-elements/p-f9bfbeb3.entry.js +82 -0
- package/dist/lime-elements/p-fa607ed3.js +1 -0
- package/dist/lime-elements/style/functions.scss +3 -1
- package/dist/lime-elements/style/internal/lime-theme.scss +30 -31
- package/dist/lime-elements/style/internal/lime-typography.scss +55 -56
- package/dist/types/components/badge/badge.d.ts +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +3 -2
- package/dist/types/components/checkbox/checkbox.template.d.ts +1 -0
- package/dist/types/components/dialog/dialog.d.ts +11 -5
- package/dist/types/components/dialog/dialog.types.d.ts +4 -0
- package/dist/types/components/flex-container/flex-container.d.ts +7 -0
- package/dist/types/components/form/fields/array-field.d.ts +0 -1
- package/dist/types/components/form/fields/object-field.d.ts +2 -2
- package/dist/types/components/form/form.d.ts +8 -1
- package/dist/types/components/form/form.types.d.ts +6 -0
- package/dist/types/components/picker/picker.d.ts +2 -1
- package/dist/types/components/switch/switch.d.ts +2 -2
- package/dist/types/components/table/table.d.ts +10 -1
- package/dist/types/components/table/table.types.d.ts +13 -0
- package/dist/types/components.d.ts +23 -7
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/package.json +31 -44
- package/dist/cjs/checkbox.template-50eb8b76.js +0 -39
- package/dist/esm/checkbox.template-50f7c07b.js +0 -37
- package/dist/lime-elements/p-041ae00c.entry.js +0 -1
- package/dist/lime-elements/p-0ce9165f.entry.js +0 -1
- package/dist/lime-elements/p-0fd208f3.entry.js +0 -82
- package/dist/lime-elements/p-143705b1.entry.js +0 -1
- package/dist/lime-elements/p-1876a96a.entry.js +0 -1
- package/dist/lime-elements/p-1a64b531.js +0 -1
- package/dist/lime-elements/p-1fb5340d.entry.js +0 -1
- package/dist/lime-elements/p-250f55be.js +0 -1
- package/dist/lime-elements/p-29f054cc.entry.js +0 -37
- package/dist/lime-elements/p-31fecf5d.entry.js +0 -1
- package/dist/lime-elements/p-34c7872e.entry.js +0 -1
- package/dist/lime-elements/p-379955f4.js +0 -1
- package/dist/lime-elements/p-3ae6bb75.entry.js +0 -82
- package/dist/lime-elements/p-3ae6dfba.entry.js +0 -73
- package/dist/lime-elements/p-426d11b4.js +0 -1
- package/dist/lime-elements/p-440084ea.js +0 -1
- package/dist/lime-elements/p-468e940e.entry.js +0 -16
- package/dist/lime-elements/p-4932c029.entry.js +0 -1
- package/dist/lime-elements/p-4b5af81b.entry.js +0 -1
- package/dist/lime-elements/p-510bb5a4.entry.js +0 -1
- package/dist/lime-elements/p-58cbe99d.entry.js +0 -1
- package/dist/lime-elements/p-597cbe05.entry.js +0 -1
- package/dist/lime-elements/p-6003f817.entry.js +0 -1
- package/dist/lime-elements/p-668795a7.js +0 -73
- package/dist/lime-elements/p-714fde78.entry.js +0 -1
- package/dist/lime-elements/p-7476efe0.entry.js +0 -1
- package/dist/lime-elements/p-887d5bda.entry.js +0 -1
- package/dist/lime-elements/p-8a2c1038.entry.js +0 -16
- package/dist/lime-elements/p-902347b9.js +0 -81
- package/dist/lime-elements/p-90c6fa15.js +0 -126
- package/dist/lime-elements/p-90f3e17c.entry.js +0 -37
- package/dist/lime-elements/p-a2cf74c1.entry.js +0 -1
- package/dist/lime-elements/p-a397bab7.js +0 -3
- package/dist/lime-elements/p-a4c532a7.entry.js +0 -1
- package/dist/lime-elements/p-be56ffab.entry.js +0 -1
- package/dist/lime-elements/p-c306c953.entry.js +0 -1
- package/dist/lime-elements/p-c35874db.entry.js +0 -1
- package/dist/lime-elements/p-c8c8a946.entry.js +0 -59
- package/dist/lime-elements/p-ca664c9f.entry.js +0 -1
- package/dist/lime-elements/p-d2c74396.entry.js +0 -1
- package/dist/lime-elements/p-d48ad9f7.entry.js +0 -126
- package/dist/lime-elements/p-d93a3b07.entry.js +0 -16
- package/dist/lime-elements/p-df8faeb4.entry.js +0 -59
- package/dist/lime-elements/p-dfe0a58b.entry.js +0 -1
- package/dist/lime-elements/p-e275f502.entry.js +0 -37
- package/dist/lime-elements/p-e881e98d.entry.js +0 -1
- package/dist/lime-elements/p-f2c706b8.entry.js +0 -131
- package/dist/lime-elements/p-f83213b8.js +0 -1
- package/dist/lime-elements/p-fc30b8e3.entry.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const component = require('./component-
|
|
3
|
+
const component = require('./component-67144c1c.js');
|
|
4
4
|
const ponyfill = require('./ponyfill-98ca4766.js');
|
|
5
5
|
const keyboard = require('./keyboard-9477d3a8.js');
|
|
6
6
|
const util = require('./util-b0f5741e.js');
|
|
@@ -56,10 +56,23 @@ var numbers$1 = {
|
|
|
56
56
|
TRANSITION_OPEN_DURATION: 120,
|
|
57
57
|
/** Total duration of menu-surface close animation. */
|
|
58
58
|
TRANSITION_CLOSE_DURATION: 75,
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Margin left to the edge of the viewport when menu-surface is at maximum
|
|
61
|
+
* possible height. Also used as a viewport margin.
|
|
62
|
+
*/
|
|
60
63
|
MARGIN_TO_EDGE: 32,
|
|
61
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Ratio of anchor width to menu-surface width for switching from corner
|
|
66
|
+
* positioning to center positioning.
|
|
67
|
+
*/
|
|
62
68
|
ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
|
|
69
|
+
/**
|
|
70
|
+
* Amount of time to wait before restoring focus when closing the menu
|
|
71
|
+
* surface. This is important because if a touch event triggered the menu
|
|
72
|
+
* close, and the subsequent mouse event occurs after focus is restored, then
|
|
73
|
+
* the restored focus would be lost.
|
|
74
|
+
*/
|
|
75
|
+
TOUCH_EVENT_WAIT_MS: 30,
|
|
63
76
|
};
|
|
64
77
|
/**
|
|
65
78
|
* Enum for bits in the {@see Corner) bitmap.
|
|
@@ -558,16 +571,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
558
571
|
__extends$1(MDCListFoundation, _super);
|
|
559
572
|
function MDCListFoundation(adapter) {
|
|
560
573
|
var _this = _super.call(this, __assign$1(__assign$1({}, MDCListFoundation.defaultAdapter), adapter)) || this;
|
|
561
|
-
_this.
|
|
562
|
-
_this.
|
|
563
|
-
_this.
|
|
564
|
-
_this.
|
|
574
|
+
_this.wrapFocus = false;
|
|
575
|
+
_this.isVertical = true;
|
|
576
|
+
_this.isSingleSelectionList = false;
|
|
577
|
+
_this.selectedIndex = numbers.UNSET_INDEX;
|
|
565
578
|
_this.focusedItemIndex = numbers.UNSET_INDEX;
|
|
566
|
-
_this.
|
|
567
|
-
_this.
|
|
568
|
-
_this.
|
|
569
|
-
_this.
|
|
570
|
-
_this.
|
|
579
|
+
_this.useActivatedClass = false;
|
|
580
|
+
_this.useSelectedAttr = false;
|
|
581
|
+
_this.ariaCurrentAttrValue = null;
|
|
582
|
+
_this.isCheckboxList = false;
|
|
583
|
+
_this.isRadioList = false;
|
|
571
584
|
_this.hasTypeahead = false;
|
|
572
585
|
// Transiently holds current typeahead prefix from user.
|
|
573
586
|
_this.typeaheadState = initState();
|
|
@@ -626,10 +639,10 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
626
639
|
}
|
|
627
640
|
// TODO(b/172274142): consider all items when determining the list's type.
|
|
628
641
|
if (this.adapter.hasCheckboxAtIndex(0)) {
|
|
629
|
-
this.
|
|
642
|
+
this.isCheckboxList = true;
|
|
630
643
|
}
|
|
631
644
|
else if (this.adapter.hasRadioAtIndex(0)) {
|
|
632
|
-
this.
|
|
645
|
+
this.isRadioList = true;
|
|
633
646
|
}
|
|
634
647
|
else {
|
|
635
648
|
this.maybeInitializeSingleSelection();
|
|
@@ -638,25 +651,27 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
638
651
|
this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();
|
|
639
652
|
}
|
|
640
653
|
};
|
|
641
|
-
/**
|
|
642
|
-
|
|
643
|
-
|
|
654
|
+
/** Returns the index of the item that was last focused. */
|
|
655
|
+
MDCListFoundation.prototype.getFocusedItemIndex = function () {
|
|
656
|
+
return this.focusedItemIndex;
|
|
657
|
+
};
|
|
658
|
+
/** Toggles focus wrapping with keyboard navigation. */
|
|
644
659
|
MDCListFoundation.prototype.setWrapFocus = function (value) {
|
|
645
|
-
this.
|
|
660
|
+
this.wrapFocus = value;
|
|
646
661
|
};
|
|
647
662
|
/**
|
|
648
|
-
*
|
|
663
|
+
* Toggles orientation direction for keyboard navigation (true for vertical,
|
|
664
|
+
* false for horizontal).
|
|
649
665
|
*/
|
|
650
666
|
MDCListFoundation.prototype.setVerticalOrientation = function (value) {
|
|
651
|
-
this.
|
|
667
|
+
this.isVertical = value;
|
|
652
668
|
};
|
|
653
|
-
/**
|
|
654
|
-
* Sets the isSingleSelectionList_ private variable.
|
|
655
|
-
*/
|
|
669
|
+
/** Toggles single-selection behavior. */
|
|
656
670
|
MDCListFoundation.prototype.setSingleSelection = function (value) {
|
|
657
|
-
this.
|
|
671
|
+
this.isSingleSelectionList = value;
|
|
658
672
|
if (value) {
|
|
659
673
|
this.maybeInitializeSingleSelection();
|
|
674
|
+
this.selectedIndex = this.getSelectedIndexFromDOM();
|
|
660
675
|
}
|
|
661
676
|
};
|
|
662
677
|
/**
|
|
@@ -664,6 +679,19 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
664
679
|
* initializes the internal state to match the selected item.
|
|
665
680
|
*/
|
|
666
681
|
MDCListFoundation.prototype.maybeInitializeSingleSelection = function () {
|
|
682
|
+
var selectedItemIndex = this.getSelectedIndexFromDOM();
|
|
683
|
+
if (selectedItemIndex === numbers.UNSET_INDEX)
|
|
684
|
+
return;
|
|
685
|
+
var hasActivatedClass = this.adapter.listItemAtIndexHasClass(selectedItemIndex, cssClasses.LIST_ITEM_ACTIVATED_CLASS);
|
|
686
|
+
if (hasActivatedClass) {
|
|
687
|
+
this.setUseActivatedClass(true);
|
|
688
|
+
}
|
|
689
|
+
this.isSingleSelectionList = true;
|
|
690
|
+
this.selectedIndex = selectedItemIndex;
|
|
691
|
+
};
|
|
692
|
+
/** @return Index of the first selected item based on the DOM state. */
|
|
693
|
+
MDCListFoundation.prototype.getSelectedIndexFromDOM = function () {
|
|
694
|
+
var selectedIndex = numbers.UNSET_INDEX;
|
|
667
695
|
var listItemsCount = this.adapter.getListItemCount();
|
|
668
696
|
for (var i = 0; i < listItemsCount; i++) {
|
|
669
697
|
var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses.LIST_ITEM_SELECTED_CLASS);
|
|
@@ -671,13 +699,10 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
671
699
|
if (!(hasSelectedClass || hasActivatedClass)) {
|
|
672
700
|
continue;
|
|
673
701
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
}
|
|
677
|
-
this.isSingleSelectionList_ = true;
|
|
678
|
-
this.selectedIndex_ = i;
|
|
679
|
-
return;
|
|
702
|
+
selectedIndex = i;
|
|
703
|
+
break;
|
|
680
704
|
}
|
|
705
|
+
return selectedIndex;
|
|
681
706
|
};
|
|
682
707
|
/**
|
|
683
708
|
* Sets whether typeahead is enabled on the list.
|
|
@@ -696,39 +721,39 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
696
721
|
return this.hasTypeahead &&
|
|
697
722
|
isTypingInProgress(this.typeaheadState);
|
|
698
723
|
};
|
|
699
|
-
/**
|
|
700
|
-
* Sets the useActivatedClass_ private variable.
|
|
701
|
-
*/
|
|
724
|
+
/** Toggle use of the "activated" CSS class. */
|
|
702
725
|
MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) {
|
|
703
|
-
this.
|
|
726
|
+
this.useActivatedClass = useActivated;
|
|
704
727
|
};
|
|
705
728
|
/**
|
|
706
|
-
*
|
|
729
|
+
* Toggles use of the selected attribute (true for aria-selected, false for
|
|
730
|
+
* aria-checked).
|
|
707
731
|
*/
|
|
708
732
|
MDCListFoundation.prototype.setUseSelectedAttribute = function (useSelected) {
|
|
709
|
-
this.
|
|
733
|
+
this.useSelectedAttr = useSelected;
|
|
710
734
|
};
|
|
711
735
|
MDCListFoundation.prototype.getSelectedIndex = function () {
|
|
712
|
-
return this.
|
|
736
|
+
return this.selectedIndex;
|
|
713
737
|
};
|
|
714
|
-
MDCListFoundation.prototype.setSelectedIndex = function (index) {
|
|
715
|
-
|
|
738
|
+
MDCListFoundation.prototype.setSelectedIndex = function (index, _a) {
|
|
739
|
+
var _b = _a === void 0 ? {} : _a, forceUpdate = _b.forceUpdate;
|
|
740
|
+
if (!this.isIndexValid(index)) {
|
|
716
741
|
return;
|
|
717
742
|
}
|
|
718
|
-
if (this.
|
|
719
|
-
this.
|
|
743
|
+
if (this.isCheckboxList) {
|
|
744
|
+
this.setCheckboxAtIndex(index);
|
|
720
745
|
}
|
|
721
|
-
else if (this.
|
|
722
|
-
this.
|
|
746
|
+
else if (this.isRadioList) {
|
|
747
|
+
this.setRadioAtIndex(index);
|
|
723
748
|
}
|
|
724
749
|
else {
|
|
725
|
-
this.
|
|
750
|
+
this.setSingleSelectionAtIndex(index, { forceUpdate: forceUpdate });
|
|
726
751
|
}
|
|
727
752
|
};
|
|
728
753
|
/**
|
|
729
754
|
* Focus in handler for the list items.
|
|
730
755
|
*/
|
|
731
|
-
MDCListFoundation.prototype.handleFocusIn = function (
|
|
756
|
+
MDCListFoundation.prototype.handleFocusIn = function (listItemIndex) {
|
|
732
757
|
if (listItemIndex >= 0) {
|
|
733
758
|
this.focusedItemIndex = listItemIndex;
|
|
734
759
|
this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '0');
|
|
@@ -738,7 +763,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
738
763
|
/**
|
|
739
764
|
* Focus out handler for the list items.
|
|
740
765
|
*/
|
|
741
|
-
MDCListFoundation.prototype.handleFocusOut = function (
|
|
766
|
+
MDCListFoundation.prototype.handleFocusOut = function (listItemIndex) {
|
|
742
767
|
var _this = this;
|
|
743
768
|
if (listItemIndex >= 0) {
|
|
744
769
|
this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '-1');
|
|
@@ -767,7 +792,8 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
767
792
|
var isEnd = keyboard.normalizeKey(event) === 'End';
|
|
768
793
|
var isEnter = keyboard.normalizeKey(event) === 'Enter';
|
|
769
794
|
var isSpace = keyboard.normalizeKey(event) === 'Spacebar';
|
|
770
|
-
// Have to check both upper and lower case, because having caps lock on
|
|
795
|
+
// Have to check both upper and lower case, because having caps lock on
|
|
796
|
+
// affects the value.
|
|
771
797
|
var isLetterA = event.key === 'A' || event.key === 'a';
|
|
772
798
|
if (this.adapter.isRootFocused()) {
|
|
773
799
|
if (isArrowUp || isEnd) {
|
|
@@ -804,12 +830,12 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
804
830
|
return;
|
|
805
831
|
}
|
|
806
832
|
}
|
|
807
|
-
if ((this.
|
|
808
|
-
(!this.
|
|
833
|
+
if ((this.isVertical && isArrowDown) ||
|
|
834
|
+
(!this.isVertical && isArrowRight)) {
|
|
809
835
|
preventDefaultEvent(event);
|
|
810
836
|
this.focusNextElement(currentIndex);
|
|
811
837
|
}
|
|
812
|
-
else if ((this.
|
|
838
|
+
else if ((this.isVertical && isArrowUp) || (!this.isVertical && isArrowLeft)) {
|
|
813
839
|
preventDefaultEvent(event);
|
|
814
840
|
this.focusPrevElement(currentIndex);
|
|
815
841
|
}
|
|
@@ -821,9 +847,11 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
821
847
|
preventDefaultEvent(event);
|
|
822
848
|
this.focusLastElement();
|
|
823
849
|
}
|
|
824
|
-
else if (isLetterA && event.ctrlKey && this.
|
|
850
|
+
else if (isLetterA && event.ctrlKey && this.isCheckboxList) {
|
|
825
851
|
event.preventDefault();
|
|
826
|
-
this.toggleAll(this.
|
|
852
|
+
this.toggleAll(this.selectedIndex === numbers.UNSET_INDEX ?
|
|
853
|
+
[] :
|
|
854
|
+
this.selectedIndex);
|
|
827
855
|
}
|
|
828
856
|
else if (isEnter || isSpace) {
|
|
829
857
|
if (isRootListItem) {
|
|
@@ -838,8 +866,8 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
838
866
|
return;
|
|
839
867
|
}
|
|
840
868
|
if (!this.isTypeaheadInProgress()) {
|
|
841
|
-
if (this.
|
|
842
|
-
this.
|
|
869
|
+
if (this.isSelectableList()) {
|
|
870
|
+
this.setSelectedIndexOnAction(currentIndex);
|
|
843
871
|
}
|
|
844
872
|
this.adapter.notifyAction(currentIndex);
|
|
845
873
|
}
|
|
@@ -869,8 +897,8 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
869
897
|
if (this.adapter.listItemAtIndexHasClass(index, cssClasses.LIST_ITEM_DISABLED_CLASS)) {
|
|
870
898
|
return;
|
|
871
899
|
}
|
|
872
|
-
if (this.
|
|
873
|
-
this.
|
|
900
|
+
if (this.isSelectableList()) {
|
|
901
|
+
this.setSelectedIndexOnAction(index, toggleCheckbox);
|
|
874
902
|
}
|
|
875
903
|
this.adapter.notifyAction(index);
|
|
876
904
|
};
|
|
@@ -881,7 +909,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
881
909
|
var count = this.adapter.getListItemCount();
|
|
882
910
|
var nextIndex = index + 1;
|
|
883
911
|
if (nextIndex >= count) {
|
|
884
|
-
if (this.
|
|
912
|
+
if (this.wrapFocus) {
|
|
885
913
|
nextIndex = 0;
|
|
886
914
|
}
|
|
887
915
|
else {
|
|
@@ -898,7 +926,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
898
926
|
MDCListFoundation.prototype.focusPrevElement = function (index) {
|
|
899
927
|
var prevIndex = index - 1;
|
|
900
928
|
if (prevIndex < 0) {
|
|
901
|
-
if (this.
|
|
929
|
+
if (this.wrapFocus) {
|
|
902
930
|
prevIndex = this.adapter.getListItemCount() - 1;
|
|
903
931
|
}
|
|
904
932
|
else {
|
|
@@ -928,7 +956,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
928
956
|
* @param isEnabled Sets the list item to enabled or disabled.
|
|
929
957
|
*/
|
|
930
958
|
MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) {
|
|
931
|
-
if (!this.
|
|
959
|
+
if (!this.isIndexValid(itemIndex)) {
|
|
932
960
|
return;
|
|
933
961
|
}
|
|
934
962
|
if (isEnabled) {
|
|
@@ -940,41 +968,42 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
940
968
|
this.adapter.setAttributeForElementIndex(itemIndex, strings.ARIA_DISABLED, 'true');
|
|
941
969
|
}
|
|
942
970
|
};
|
|
943
|
-
MDCListFoundation.prototype.
|
|
944
|
-
|
|
971
|
+
MDCListFoundation.prototype.setSingleSelectionAtIndex = function (index, _a) {
|
|
972
|
+
var _b = _a === void 0 ? {} : _a, forceUpdate = _b.forceUpdate;
|
|
973
|
+
if (this.selectedIndex === index && !forceUpdate) {
|
|
945
974
|
return;
|
|
946
975
|
}
|
|
947
976
|
var selectedClassName = cssClasses.LIST_ITEM_SELECTED_CLASS;
|
|
948
|
-
if (this.
|
|
977
|
+
if (this.useActivatedClass) {
|
|
949
978
|
selectedClassName = cssClasses.LIST_ITEM_ACTIVATED_CLASS;
|
|
950
979
|
}
|
|
951
|
-
if (this.
|
|
952
|
-
this.adapter.removeClassForElementIndex(this.
|
|
980
|
+
if (this.selectedIndex !== numbers.UNSET_INDEX) {
|
|
981
|
+
this.adapter.removeClassForElementIndex(this.selectedIndex, selectedClassName);
|
|
953
982
|
}
|
|
954
|
-
this.
|
|
983
|
+
this.setAriaForSingleSelectionAtIndex(index);
|
|
955
984
|
this.setTabindexAtIndex(index);
|
|
956
985
|
if (index !== numbers.UNSET_INDEX) {
|
|
957
986
|
this.adapter.addClassForElementIndex(index, selectedClassName);
|
|
958
987
|
}
|
|
959
|
-
this.
|
|
988
|
+
this.selectedIndex = index;
|
|
960
989
|
};
|
|
961
990
|
/**
|
|
962
991
|
* Sets aria attribute for single selection at given index.
|
|
963
992
|
*/
|
|
964
|
-
MDCListFoundation.prototype.
|
|
993
|
+
MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex = function (index) {
|
|
965
994
|
// Detect the presence of aria-current and get the value only during list
|
|
966
995
|
// initialization when it is in unset state.
|
|
967
|
-
if (this.
|
|
968
|
-
this.
|
|
996
|
+
if (this.selectedIndex === numbers.UNSET_INDEX) {
|
|
997
|
+
this.ariaCurrentAttrValue =
|
|
969
998
|
this.adapter.getAttributeForElementIndex(index, strings.ARIA_CURRENT);
|
|
970
999
|
}
|
|
971
|
-
var isAriaCurrent = this.
|
|
1000
|
+
var isAriaCurrent = this.ariaCurrentAttrValue !== null;
|
|
972
1001
|
var ariaAttribute = isAriaCurrent ? strings.ARIA_CURRENT : strings.ARIA_SELECTED;
|
|
973
|
-
if (this.
|
|
974
|
-
this.adapter.setAttributeForElementIndex(this.
|
|
1002
|
+
if (this.selectedIndex !== numbers.UNSET_INDEX) {
|
|
1003
|
+
this.adapter.setAttributeForElementIndex(this.selectedIndex, ariaAttribute, 'false');
|
|
975
1004
|
}
|
|
976
1005
|
if (index !== numbers.UNSET_INDEX) {
|
|
977
|
-
var ariaAttributeValue = isAriaCurrent ? this.
|
|
1006
|
+
var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue : 'true';
|
|
978
1007
|
this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
|
|
979
1008
|
}
|
|
980
1009
|
};
|
|
@@ -982,22 +1011,22 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
982
1011
|
* Returns the attribute to use for indicating selection status.
|
|
983
1012
|
*/
|
|
984
1013
|
MDCListFoundation.prototype.getSelectionAttribute = function () {
|
|
985
|
-
return this.
|
|
1014
|
+
return this.useSelectedAttr ? strings.ARIA_SELECTED : strings.ARIA_CHECKED;
|
|
986
1015
|
};
|
|
987
1016
|
/**
|
|
988
1017
|
* Toggles radio at give index. Radio doesn't change the checked state if it
|
|
989
1018
|
* is already checked.
|
|
990
1019
|
*/
|
|
991
|
-
MDCListFoundation.prototype.
|
|
1020
|
+
MDCListFoundation.prototype.setRadioAtIndex = function (index) {
|
|
992
1021
|
var selectionAttribute = this.getSelectionAttribute();
|
|
993
1022
|
this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true);
|
|
994
|
-
if (this.
|
|
995
|
-
this.adapter.setAttributeForElementIndex(this.
|
|
1023
|
+
if (this.selectedIndex !== numbers.UNSET_INDEX) {
|
|
1024
|
+
this.adapter.setAttributeForElementIndex(this.selectedIndex, selectionAttribute, 'false');
|
|
996
1025
|
}
|
|
997
1026
|
this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true');
|
|
998
|
-
this.
|
|
1027
|
+
this.selectedIndex = index;
|
|
999
1028
|
};
|
|
1000
|
-
MDCListFoundation.prototype.
|
|
1029
|
+
MDCListFoundation.prototype.setCheckboxAtIndex = function (index) {
|
|
1001
1030
|
var selectionAttribute = this.getSelectionAttribute();
|
|
1002
1031
|
for (var i = 0; i < this.adapter.getListItemCount(); i++) {
|
|
1003
1032
|
var isChecked = false;
|
|
@@ -1007,7 +1036,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1007
1036
|
this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
|
|
1008
1037
|
this.adapter.setAttributeForElementIndex(i, selectionAttribute, isChecked ? 'true' : 'false');
|
|
1009
1038
|
}
|
|
1010
|
-
this.
|
|
1039
|
+
this.selectedIndex = index;
|
|
1011
1040
|
};
|
|
1012
1041
|
MDCListFoundation.prototype.setTabindexAtIndex = function (index) {
|
|
1013
1042
|
if (this.focusedItemIndex === numbers.UNSET_INDEX && index !== 0) {
|
|
@@ -1022,9 +1051,9 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1022
1051
|
// Set the previous selection's tabindex to -1. We need this because
|
|
1023
1052
|
// in selection menus that are not visible, programmatically setting an
|
|
1024
1053
|
// option will not change focus but will change where tabindex should be 0.
|
|
1025
|
-
if (!(this.
|
|
1026
|
-
this.
|
|
1027
|
-
this.adapter.setAttributeForElementIndex(this.
|
|
1054
|
+
if (!(this.selectedIndex instanceof Array) &&
|
|
1055
|
+
this.selectedIndex !== index) {
|
|
1056
|
+
this.adapter.setAttributeForElementIndex(this.selectedIndex, 'tabindex', '-1');
|
|
1028
1057
|
}
|
|
1029
1058
|
if (index !== numbers.UNSET_INDEX) {
|
|
1030
1059
|
this.adapter.setAttributeForElementIndex(index, 'tabindex', '0');
|
|
@@ -1034,53 +1063,56 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1034
1063
|
* @return Return true if it is single selectin list, checkbox list or radio
|
|
1035
1064
|
* list.
|
|
1036
1065
|
*/
|
|
1037
|
-
MDCListFoundation.prototype.
|
|
1038
|
-
return this.
|
|
1039
|
-
this.
|
|
1066
|
+
MDCListFoundation.prototype.isSelectableList = function () {
|
|
1067
|
+
return this.isSingleSelectionList || this.isCheckboxList ||
|
|
1068
|
+
this.isRadioList;
|
|
1040
1069
|
};
|
|
1041
1070
|
MDCListFoundation.prototype.setTabindexToFirstSelectedOrFocusedItem = function () {
|
|
1042
1071
|
var targetIndex = this.getFirstSelectedOrFocusedItemIndex();
|
|
1043
1072
|
this.setTabindexAtIndex(targetIndex);
|
|
1044
1073
|
};
|
|
1045
1074
|
MDCListFoundation.prototype.getFirstSelectedOrFocusedItemIndex = function () {
|
|
1046
|
-
|
|
1047
|
-
if (this.
|
|
1048
|
-
|
|
1049
|
-
this.selectedIndex_ !== numbers.UNSET_INDEX) {
|
|
1050
|
-
targetIndex = this.selectedIndex_;
|
|
1051
|
-
}
|
|
1052
|
-
else if (isNumberArray(this.selectedIndex_) &&
|
|
1053
|
-
this.selectedIndex_.length > 0) {
|
|
1054
|
-
targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { return Math.min(currentIndex, minIndex); });
|
|
1055
|
-
}
|
|
1075
|
+
// Action lists retain focus on the most recently focused item.
|
|
1076
|
+
if (!this.isSelectableList()) {
|
|
1077
|
+
return Math.max(this.focusedItemIndex, 0);
|
|
1056
1078
|
}
|
|
1057
|
-
|
|
1079
|
+
// Single-selection lists focus the selected item.
|
|
1080
|
+
if (typeof this.selectedIndex === 'number' &&
|
|
1081
|
+
this.selectedIndex !== numbers.UNSET_INDEX) {
|
|
1082
|
+
return this.selectedIndex;
|
|
1083
|
+
}
|
|
1084
|
+
// Multiple-selection lists focus the first selected item.
|
|
1085
|
+
if (isNumberArray(this.selectedIndex) && this.selectedIndex.length > 0) {
|
|
1086
|
+
return this.selectedIndex.reduce(function (minIndex, currentIndex) { return Math.min(minIndex, currentIndex); });
|
|
1087
|
+
}
|
|
1088
|
+
// Selection lists without a selection focus the first item.
|
|
1089
|
+
return 0;
|
|
1058
1090
|
};
|
|
1059
|
-
MDCListFoundation.prototype.
|
|
1091
|
+
MDCListFoundation.prototype.isIndexValid = function (index) {
|
|
1060
1092
|
var _this = this;
|
|
1061
1093
|
if (index instanceof Array) {
|
|
1062
|
-
if (!this.
|
|
1094
|
+
if (!this.isCheckboxList) {
|
|
1063
1095
|
throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
|
|
1064
1096
|
}
|
|
1065
1097
|
if (index.length === 0) {
|
|
1066
1098
|
return true;
|
|
1067
1099
|
}
|
|
1068
1100
|
else {
|
|
1069
|
-
return index.some(function (i) { return _this.
|
|
1101
|
+
return index.some(function (i) { return _this.isIndexInRange(i); });
|
|
1070
1102
|
}
|
|
1071
1103
|
}
|
|
1072
1104
|
else if (typeof index === 'number') {
|
|
1073
|
-
if (this.
|
|
1105
|
+
if (this.isCheckboxList) {
|
|
1074
1106
|
throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + index);
|
|
1075
1107
|
}
|
|
1076
|
-
return this.
|
|
1077
|
-
this.
|
|
1108
|
+
return this.isIndexInRange(index) ||
|
|
1109
|
+
this.isSingleSelectionList && index === numbers.UNSET_INDEX;
|
|
1078
1110
|
}
|
|
1079
1111
|
else {
|
|
1080
1112
|
return false;
|
|
1081
1113
|
}
|
|
1082
1114
|
};
|
|
1083
|
-
MDCListFoundation.prototype.
|
|
1115
|
+
MDCListFoundation.prototype.isIndexInRange = function (index) {
|
|
1084
1116
|
var listSize = this.adapter.getListItemCount();
|
|
1085
1117
|
return index >= 0 && index < listSize;
|
|
1086
1118
|
};
|
|
@@ -1089,16 +1121,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1089
1121
|
* toggleCheckbox value. User interaction should not toggle list item(s) when
|
|
1090
1122
|
* disabled.
|
|
1091
1123
|
*/
|
|
1092
|
-
MDCListFoundation.prototype.
|
|
1124
|
+
MDCListFoundation.prototype.setSelectedIndexOnAction = function (index, toggleCheckbox) {
|
|
1093
1125
|
if (toggleCheckbox === void 0) { toggleCheckbox = true; }
|
|
1094
|
-
if (this.
|
|
1095
|
-
this.
|
|
1126
|
+
if (this.isCheckboxList) {
|
|
1127
|
+
this.toggleCheckboxAtIndex(index, toggleCheckbox);
|
|
1096
1128
|
}
|
|
1097
1129
|
else {
|
|
1098
1130
|
this.setSelectedIndex(index);
|
|
1099
1131
|
}
|
|
1100
1132
|
};
|
|
1101
|
-
MDCListFoundation.prototype.
|
|
1133
|
+
MDCListFoundation.prototype.toggleCheckboxAtIndex = function (index, toggleCheckbox) {
|
|
1102
1134
|
var selectionAttribute = this.getSelectionAttribute();
|
|
1103
1135
|
var isChecked = this.adapter.isCheckboxCheckedAtIndex(index);
|
|
1104
1136
|
if (toggleCheckbox) {
|
|
@@ -1108,16 +1140,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1108
1140
|
this.adapter.setAttributeForElementIndex(index, selectionAttribute, isChecked ? 'true' : 'false');
|
|
1109
1141
|
// If none of the checkbox items are selected and selectedIndex is not
|
|
1110
1142
|
// initialized then provide a default value.
|
|
1111
|
-
var selectedIndexes = this.
|
|
1143
|
+
var selectedIndexes = this.selectedIndex === numbers.UNSET_INDEX ?
|
|
1112
1144
|
[] :
|
|
1113
|
-
this.
|
|
1145
|
+
this.selectedIndex.slice();
|
|
1114
1146
|
if (isChecked) {
|
|
1115
1147
|
selectedIndexes.push(index);
|
|
1116
1148
|
}
|
|
1117
1149
|
else {
|
|
1118
1150
|
selectedIndexes = selectedIndexes.filter(function (i) { return i !== index; });
|
|
1119
1151
|
}
|
|
1120
|
-
this.
|
|
1152
|
+
this.selectedIndex = selectedIndexes;
|
|
1121
1153
|
};
|
|
1122
1154
|
MDCListFoundation.prototype.focusItemAtIndex = function (index) {
|
|
1123
1155
|
this.adapter.focusItemAtIndex(index);
|
|
@@ -1127,7 +1159,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1127
1159
|
var count = this.adapter.getListItemCount();
|
|
1128
1160
|
// If all items are selected, deselect everything.
|
|
1129
1161
|
if (currentlySelectedIndexes.length === count) {
|
|
1130
|
-
this.
|
|
1162
|
+
this.setCheckboxAtIndex([]);
|
|
1131
1163
|
}
|
|
1132
1164
|
else {
|
|
1133
1165
|
// Otherwise select all enabled options.
|
|
@@ -1138,7 +1170,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1138
1170
|
allIndexes.push(i);
|
|
1139
1171
|
}
|
|
1140
1172
|
}
|
|
1141
|
-
this.
|
|
1173
|
+
this.setCheckboxAtIndex(allIndexes);
|
|
1142
1174
|
}
|
|
1143
1175
|
};
|
|
1144
1176
|
/**
|
|
@@ -1526,7 +1558,7 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1526
1558
|
*/
|
|
1527
1559
|
MDCList.prototype.handleFocusInEvent = function (evt) {
|
|
1528
1560
|
var index = this.getListItemIndex(evt.target);
|
|
1529
|
-
this.foundation.handleFocusIn(
|
|
1561
|
+
this.foundation.handleFocusIn(index);
|
|
1530
1562
|
};
|
|
1531
1563
|
/**
|
|
1532
1564
|
* Used to figure out which element was clicked before sending the event to
|
|
@@ -1534,7 +1566,7 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1534
1566
|
*/
|
|
1535
1567
|
MDCList.prototype.handleFocusOutEvent = function (evt) {
|
|
1536
1568
|
var index = this.getListItemIndex(evt.target);
|
|
1537
|
-
this.foundation.handleFocusOut(
|
|
1569
|
+
this.foundation.handleFocusOut(index);
|
|
1538
1570
|
};
|
|
1539
1571
|
/**
|
|
1540
1572
|
* Used to figure out which element was focused when keydown event occurred
|
|
@@ -1746,7 +1778,8 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
1746
1778
|
cancelAnimationFrame(this.animationRequestId);
|
|
1747
1779
|
};
|
|
1748
1780
|
/**
|
|
1749
|
-
* @param corner Default anchor corner alignment of top-left menu surface
|
|
1781
|
+
* @param corner Default anchor corner alignment of top-left menu surface
|
|
1782
|
+
* corner.
|
|
1750
1783
|
*/
|
|
1751
1784
|
MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
|
|
1752
1785
|
this.anchorCorner = corner;
|
|
@@ -1770,10 +1803,18 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
1770
1803
|
MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
|
|
1771
1804
|
this.isHoistedElement = isHoisted;
|
|
1772
1805
|
};
|
|
1773
|
-
/**
|
|
1806
|
+
/**
|
|
1807
|
+
* Used to set the menu-surface calculations based on a fixed position menu.
|
|
1808
|
+
*/
|
|
1774
1809
|
MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
|
|
1775
1810
|
this.isFixedPosition = isFixedPosition;
|
|
1776
1811
|
};
|
|
1812
|
+
/**
|
|
1813
|
+
* @return Returns true if menu is in fixed (`position: fixed`) position.
|
|
1814
|
+
*/
|
|
1815
|
+
MDCMenuSurfaceFoundation.prototype.isFixed = function () {
|
|
1816
|
+
return this.isFixedPosition;
|
|
1817
|
+
};
|
|
1777
1818
|
/** Sets the menu-surface position on the page. */
|
|
1778
1819
|
MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
|
|
1779
1820
|
this.position.x = this.isFinite(x) ? x : 0;
|
|
@@ -1816,9 +1857,9 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
1816
1857
|
else {
|
|
1817
1858
|
this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
|
|
1818
1859
|
this.animationRequestId = requestAnimationFrame(function () {
|
|
1819
|
-
_this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
|
|
1820
1860
|
_this.dimensions = _this.adapter.getInnerDimensions();
|
|
1821
1861
|
_this.autoposition();
|
|
1862
|
+
_this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
|
|
1822
1863
|
_this.openAnimationEndTimerId = setTimeout(function () {
|
|
1823
1864
|
_this.openAnimationEndTimerId = 0;
|
|
1824
1865
|
_this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
|
|
@@ -1894,11 +1935,14 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
1894
1935
|
_a[horizontalAlignment] = horizontalOffset,
|
|
1895
1936
|
_a[verticalAlignment] = verticalOffset,
|
|
1896
1937
|
_a);
|
|
1897
|
-
// Center align when anchor width is comparable or greater than menu
|
|
1898
|
-
|
|
1938
|
+
// Center align when anchor width is comparable or greater than menu
|
|
1939
|
+
// surface, otherwise keep corner.
|
|
1940
|
+
if (anchorSize.width / surfaceSize.width >
|
|
1941
|
+
numbers$1.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
|
|
1899
1942
|
horizontalAlignment = 'center';
|
|
1900
1943
|
}
|
|
1901
|
-
// If the menu-surface has been hoisted to the body, it's no longer relative
|
|
1944
|
+
// If the menu-surface has been hoisted to the body, it's no longer relative
|
|
1945
|
+
// to the anchor element
|
|
1902
1946
|
if (this.isHoistedElement || this.isFixedPosition) {
|
|
1903
1947
|
this.adjustPositionForHoistedElement(position);
|
|
1904
1948
|
}
|
|
@@ -2022,7 +2066,8 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2022
2066
|
};
|
|
2023
2067
|
/**
|
|
2024
2068
|
* @param corner Origin corner of the menu surface.
|
|
2025
|
-
* @return Maximum height of the menu surface, based on available space. 0
|
|
2069
|
+
* @return Maximum height of the menu surface, based on available space. 0
|
|
2070
|
+
* indicates should not be set.
|
|
2026
2071
|
*/
|
|
2027
2072
|
MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) {
|
|
2028
2073
|
if (this.maxHeight > 0) {
|
|
@@ -2051,7 +2096,8 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2051
2096
|
};
|
|
2052
2097
|
/**
|
|
2053
2098
|
* @param corner Origin corner of the menu surface.
|
|
2054
|
-
* @return Horizontal offset of menu surface origin corner from corresponding
|
|
2099
|
+
* @return Horizontal offset of menu surface origin corner from corresponding
|
|
2100
|
+
* anchor corner.
|
|
2055
2101
|
*/
|
|
2056
2102
|
MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) {
|
|
2057
2103
|
var anchorSize = this.measurements.anchorSize;
|
|
@@ -2078,7 +2124,8 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2078
2124
|
};
|
|
2079
2125
|
/**
|
|
2080
2126
|
* @param corner Origin corner of the menu surface.
|
|
2081
|
-
* @return Vertical offset of menu surface origin corner from corresponding
|
|
2127
|
+
* @return Vertical offset of menu surface origin corner from corresponding
|
|
2128
|
+
* anchor corner.
|
|
2082
2129
|
*/
|
|
2083
2130
|
MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) {
|
|
2084
2131
|
var anchorSize = this.measurements.anchorSize;
|
|
@@ -2096,7 +2143,10 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2096
2143
|
}
|
|
2097
2144
|
return y;
|
|
2098
2145
|
};
|
|
2099
|
-
/**
|
|
2146
|
+
/**
|
|
2147
|
+
* Calculates the offsets for positioning the menu-surface when the
|
|
2148
|
+
* menu-surface has been hoisted to the body.
|
|
2149
|
+
*/
|
|
2100
2150
|
MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) {
|
|
2101
2151
|
var e_1, _a;
|
|
2102
2152
|
var _b = this.measurements, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance, surfaceSize = _b.surfaceSize, viewportSize = _b.viewportSize;
|
|
@@ -2110,11 +2160,11 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2110
2160
|
position[prop] = (viewportSize.width - surfaceSize.width) / 2;
|
|
2111
2161
|
continue;
|
|
2112
2162
|
}
|
|
2113
|
-
// Hoisted surfaces need to have the anchor elements location on the page
|
|
2114
|
-
// position properties for proper alignment on the body.
|
|
2163
|
+
// Hoisted surfaces need to have the anchor elements location on the page
|
|
2164
|
+
// added to the position properties for proper alignment on the body.
|
|
2115
2165
|
value += viewportDistance[prop];
|
|
2116
|
-
// Surfaces that are absolutely positioned need to have additional
|
|
2117
|
-
// and bottom positioning.
|
|
2166
|
+
// Surfaces that are absolutely positioned need to have additional
|
|
2167
|
+
// calculations for scroll and bottom positioning.
|
|
2118
2168
|
if (!this.isFixedPosition) {
|
|
2119
2169
|
if (prop === 'top') {
|
|
2120
2170
|
value += windowScroll.y;
|
|
@@ -2141,15 +2191,23 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2141
2191
|
}
|
|
2142
2192
|
};
|
|
2143
2193
|
/**
|
|
2144
|
-
* The last focused element when the menu surface was opened should regain
|
|
2145
|
-
* focused on or within the menu surface when it is
|
|
2194
|
+
* The last focused element when the menu surface was opened should regain
|
|
2195
|
+
* focus, if the user is focused on or within the menu surface when it is
|
|
2196
|
+
* closed.
|
|
2146
2197
|
*/
|
|
2147
2198
|
MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () {
|
|
2199
|
+
var _this = this;
|
|
2148
2200
|
var isRootFocused = this.adapter.isFocused();
|
|
2149
2201
|
var childHasFocus = document.activeElement &&
|
|
2150
2202
|
this.adapter.isElementInContainer(document.activeElement);
|
|
2151
2203
|
if (isRootFocused || childHasFocus) {
|
|
2152
|
-
|
|
2204
|
+
// Wait before restoring focus when closing the menu surface. This is
|
|
2205
|
+
// important because if a touch event triggered the menu close, and the
|
|
2206
|
+
// subsequent mouse event occurs after focus is restored, then the
|
|
2207
|
+
// restored focus would be lost.
|
|
2208
|
+
setTimeout(function () {
|
|
2209
|
+
_this.adapter.restoreFocus();
|
|
2210
|
+
}, numbers$1.TOUCH_EVENT_WAIT_MS);
|
|
2153
2211
|
}
|
|
2154
2212
|
};
|
|
2155
2213
|
MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {
|