Skip to content

Commit

Permalink
layout.Card: slideDirection_ #5400
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiu committed Apr 20, 2024
1 parent 805f9bc commit a0f4ff9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/layout/card/MainContainer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MainContainer extends ConfigurationViewport {

return [{
module : Radio,
checked : layout.slideDirection === 'bottom-left',
checked : layout.slideDirection === 'horizontal',
hideValueLabel: false,
labelText : 'slideDirection',
listeners : {change: me.onRadioLayoutChange.bind(me, 'slideDirection', 'horizontal')},
Expand Down Expand Up @@ -126,7 +126,7 @@ class MainContainer extends ConfigurationViewport {
*/
onRadioLayoutChange(config, value, opts) {
if (opts.value === true) { // we only want to listen to check events, not uncheck
this.exampleComponent.layout[config] = value;
this.getItem('card-container').layout[config] = value;
}
}

Expand Down
25 changes: 24 additions & 1 deletion src/layout/Card.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ class Card extends Base {
* @static
*/
static itemCls = 'neo-layout-card-item'
/**
* Valid values for slideDirection
* @member {String[]} iconPositions=['horizontal','vertical',null]
* @protected
* @static
*/
static slideDirections = ['horizontal', 'vertical', null]

static config = {
/**
Expand All @@ -47,7 +54,12 @@ class Card extends Base {
* This will keep the instances & vdom trees
* @member {Boolean} removeInactiveCards=true
*/
removeInactiveCards: true
removeInactiveCards: true,
/*
* Valid values: 'horizontal', 'vertical', null
* @member {String|null} slideDirection_=null
*/
slideDirection_: null
}

/**
Expand Down Expand Up @@ -164,6 +176,17 @@ class Card extends Base {
container.wrapperCls = wrapperCls;
}

/**
* Triggered before the slideDirection config gets changed
* @param {String} value
* @param {String} oldValue
* @returns {String}
* @protected
*/
beforeSetSlideDirection(value, oldValue) {
return this.beforeSetEnumValue(value, oldValue, 'slideDirection')
}

/**
* Loads a component.Base module which is defined via module: () => import('...')
* @param {Object} item
Expand Down

0 comments on commit a0f4ff9

Please sign in to comment.