UNPKG

covid19-dashboard

Version:

Dashboard App displaying COVID-19 numbers by country

114 lines (102 loc) 3.15 kB
import Container from '../../../node_modules/neo.mjs/src/tab/Container.mjs'; import HeaderButton from '../../../node_modules/neo.mjs/src/tab/header/Button.mjs'; /** * @class Docs.view.ContentTabContainer * @extends Neo.tab.Container */ class ContentTabContainer extends Container { static getConfig() {return { /** * @member {String} className='Docs.view.ContentTabContainer' * @protected */ className: 'Docs.view.ContentTabContainer', /** * @member {String} ntype='docs-content-tabcontainer' * @protected */ ntype: 'docs-content-tabcontainer', /** * @member {Boolean} activateInsertedTabs=true */ activateInsertedTabs: true, /** * @member {Object} contentContainerDefaults={cls:[//...]} */ contentContainerDefaults: { cls: [ 'neo-docs-tab-content-container', 'neo-tab-content-container', 'neo-container' ] }, /** * @member {Object} headerToolbarDefaults={cls:[//...]} */ headerToolbarDefaults: { cls: [ 'docs-tab-header-toolbar', 'neo-tab-header-toolbar', 'neo-toolbar' ] }, /** * @member {Array} items=[//...]] */ items: [{ ntype: 'component', html : 'Welcome to the neo.mjs docs!', style: {padding: '20px'}, tabButtonConfig: { iconCls: 'fa fa-users', text : 'Welcome!' } }], /** * @member {Boolean} sortable=true */ sortable: true }} /** * * @param {Object} config */ construct(config) { super.construct(config); let me = this, cls = me.cls; cls.unshift('docs-content-tabcontainer'); me.cls = cls; } /** * Overriding the button click listener to allow closing tabs on icon click * @param {Object} config * @param {Number} index * @returns {Object} The merged config * @protected * @override */ getTabButtonConfig(config, index) { let me = this, defaultConfig = { module : HeaderButton, flex : 'none', index : index, pressed: me.activeIndex === index, domListeners: [{ click: function(data) { let path = data.path.map(e => e.id); if (path[0].indexOf('neo-tab-header-button-') === 0) { me.activeIndex = data.component.index; } else { me.removeAt(Neo.getComponent(me.tabBarId).indexOf(path[1])) } }, scope: me }] }; return {...defaultConfig, ...config}; } } Neo.applyClassConfig(ContentTabContainer); export {ContentTabContainer as default};