|
| 1 | +import EffectButton from '../../button/Effect.mjs'; |
| 2 | + |
| 3 | +/** |
| 4 | + * @class Neo.tab.header.EffectButton |
| 5 | + * @extends Neo.button.Effect |
| 6 | + */ |
| 7 | +class EffectTabButton extends EffectButton { |
| 8 | + static config = { |
| 9 | + /** |
| 10 | + * @member {String} className='Neo.tab.header.EffectButton' |
| 11 | + * @protected |
| 12 | + */ |
| 13 | + className: 'Neo.tab.header.EffectButton', |
| 14 | + /** |
| 15 | + * @member {String} ntype='tab-header-effect-button' |
| 16 | + * @protected |
| 17 | + */ |
| 18 | + ntype: 'tab-header-effect-button', |
| 19 | + /** |
| 20 | + * @member {String[]} baseCls=['neo-tab-header-button', 'neo-button'] |
| 21 | + */ |
| 22 | + baseCls: ['neo-tab-header-button', 'neo-button'], |
| 23 | + /** |
| 24 | + * Specify a role tag attribute for the vdom root. |
| 25 | + * @member {String|null} role='tab' |
| 26 | + */ |
| 27 | + role: 'tab', |
| 28 | + /** |
| 29 | + * @member {Boolean} useActiveTabIndicator_=true |
| 30 | + */ |
| 31 | + useActiveTabIndicator_: true |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * Builds the top-level VDOM object. |
| 36 | + * @returns {Object} |
| 37 | + * @protected |
| 38 | + */ |
| 39 | + getVdomConfig() { |
| 40 | + let vdomConfig = super.getVdomConfig(); |
| 41 | + |
| 42 | + vdomConfig.role = this.role; |
| 43 | + |
| 44 | + if (this.pressed) { |
| 45 | + vdomConfig['aria-selected'] = true; |
| 46 | + } |
| 47 | + |
| 48 | + return vdomConfig; |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * Builds the array of child nodes (the 'cn' property). |
| 53 | + * @returns {Object[]} |
| 54 | + * @protected |
| 55 | + */ |
| 56 | + getVdomChildren() { |
| 57 | + let children = super.getVdomChildren(); |
| 58 | + |
| 59 | + children.push({ |
| 60 | + cls : ['neo-tab-button-indicator'], |
| 61 | + removeDom: !this.useActiveTabIndicator |
| 62 | + }); |
| 63 | + |
| 64 | + return children; |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * @param {Object} data |
| 69 | + */ |
| 70 | + showRipple(data) { |
| 71 | + !this.pressed && super.showRipple(data); |
| 72 | + } |
| 73 | +} |
| 74 | + |
| 75 | +export default Neo.setupClass(EffectTabButton); |
0 commit comments