1
0
Fork 0

Add basic Accordion group extending Stacked group

* src/client/ClientDependencyFactory.js: Remove old AccordionGroupUi
    require, add new one.
* src/ui/group/AccordionGroupUi.js: New class.
* src/ui/group/GroupUi.js (postAddRow): Make virtual.
master
Mike Gerwitz 2019-01-17 11:51:09 -05:00
parent 6b3ab89e77
commit 2ecaeb568b
3 changed files with 55 additions and 4 deletions

View File

@ -36,6 +36,7 @@ var Step = require( '../step/Step' ),
Group = require( '../group/Group' ),
GroupUi = require( '../ui/group/GroupUi' ),
AccordionGroupUi = require( '../ui/group/AccordionGroupUi' ),
FlatGroupUi = require( '../ui/group/FlatGroupUi' ),
TableGroupUi = require( '../ui/group/TableGroupUi' ),
TabbedGroupUi = require( '../ui/group/TabbedGroupUi' ),
@ -44,9 +45,6 @@ var Step = require( '../step/Step' ),
SideTableGroupUi = require( '../ui/group/SideTableGroupUi' ),
CollapseTableGroupUi = require( '../ui/group/CollapseTableGroupUi' ),
// TODO: delete me
AccordionGroupUi = require( 'program/ui/AccordionGroupUi' ),
Ui = require( '../ui/Ui' ),
UiStyler = require( '../ui/UiStyler' ),
UiNotifyBar = require( '../ui/UiNotifyBar' ),

View File

@ -0,0 +1,53 @@
/**
* Flat UI group with accordion display
*
* Copyright (C) 2019 R-T Specialty, LLC.
*
* This file is part of liza.
*
* liza is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
'use strict';
const { Class } = require( 'easejs' );
const StackedGroupUi = require( './StackedGroupUi' );
/**
* Collapsable stacked group
*/
module.exports = Class( 'AccordionGroupUi' )
.extend( StackedGroupUi,
{
/**
* Make stack body collapsable when header is clicked
*
* @param {jQuery} $dl definition list for group
* @param {number} index index to make clickable
*
* @return {AccordionGroupUi} self
*/
'protected override postAddRow': function( $dl, index )
{
const header = $dl[ 0 ].firstElementChild;
header.addEventListener( 'click', () =>
{
header.parentElement.classList.toggle( 'liza-collapsed' );
} );
return this.__super( $dl, index );
},
} );

View File

@ -745,7 +745,7 @@ module.exports = Class( 'GroupUi' )
*
* @return {GroupUi} self to allow for method chaining
*/
'protected postAddRow': function( $element, index )
'virtual protected postAddRow': function( $element, index )
{
this.emit( this.__self.$('EVENT_POST_ADD_ROW'), $element, index );
return this;