Repository: flex-asjs Updated Branches: refs/heads/develop 8da63daf5 -> 5ba5e873b
GridCellBehaviour to use with Cards or other components Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/5ba5e873 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/5ba5e873 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/5ba5e873 Branch: refs/heads/develop Commit: 5ba5e873bb6e9bb780290618981a74d515355f7b Parents: 8da63da Author: Carlos Rovira <[email protected]> Authored: Sat Jan 28 01:25:43 2017 +0100 Committer: Carlos Rovira <[email protected]> Committed: Sat Jan 28 01:25:43 2017 +0100 ---------------------------------------------------------------------- .../apache/flex/mdl/beads/GridCellBehaviour.as | 134 +++++++++++++++++++ .../src/main/resources/mdl-manifest.xml | 1 + 2 files changed, 135 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5ba5e873/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/GridCellBehaviour.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/GridCellBehaviour.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/GridCellBehaviour.as new file mode 100644 index 0000000..8e3d8ae --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/GridCellBehaviour.as @@ -0,0 +1,134 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.mdl.beads +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.UIBase; + + /** + * The GridCellBehaviour bead class is used in MDL Dialog to style other components + * to make it play nicely inside grids instead of use a GridCell component + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public class GridCellBehaviour implements IBead + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public function GridCellBehaviour() + { + } + + private var _strand:IStrand; + + private var host:UIBase; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + * @flexjsignorecoercion HTMLInputElement + * @flexjsignorecoercion org.apache.flex.core.UIBase; + */ + public function set strand(value:IStrand):void + { + _strand = value; + + COMPILE::JS + { + host = value as UIBase; + host.element.classList.add("mdl-cell"); + + if(_column != 4) + { + host.element.classList.add("mdl-cell--" + _column + "-col"); + host.typeNames = host.element.className; + } + + if(_columnDesktop) + { + host.element.classList.add("mdl-cell--" + _columnDesktop + "-col-desktop"); + host.typeNames = host.element.className; + } + } + } + + protected var _column:Number = 4; + /** + * A boolean flag to activate "mdl-cell--N-col" effect selector. + * Sets the column size for the cell to N. N is 1-12 inclusive. + * Defaults to 4. Optional on "inner" div elements + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public function get column():Number + { + return _column; + } + public function set column(value:Number):void + { + if(value > 0 || value < 13) + { + _column = value; + } + } + + protected var _columnDesktop:Number; + /** + * A boolean flag to activate "mdl-cell--N-col-desktop" effect selector. + * Sets the column size for the cell to N in desktop mode only. + * N is 1-12 inclusive. Optional on "inner" div elements + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public function get columnDesktop():Number + { + return _columnDesktop; + } + public function set columnDesktop(value:Number):void + { + COMPILE::JS + { + if(value > 0 || value < 13) + { + _columnDesktop = value; + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5ba5e873/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml index 9ab4461..007ea7d 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -78,6 +78,7 @@ <component id="NavigationLayoutContent" class="org.apache.flex.mdl.NavigationLayoutContent"/> <component id="Grid" class="org.apache.flex.mdl.Grid"/> <component id="GridCell" class="org.apache.flex.mdl.GridCell"/> + <component id="GridCellBehaviour" class="org.apache.flex.mdl.beads.GridCellBehaviour"/> <component id="Chip" class="org.apache.flex.mdl.Chip"/> <component id="ButtonChip" class="org.apache.flex.mdl.ButtonChip"/> <component id="DeletableChip" class="org.apache.flex.mdl.beads.DeletableChip"/>
