Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0E57E200BD3 for ; Tue, 6 Dec 2016 22:19:54 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0CE80160B1B; Tue, 6 Dec 2016 21:19:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 307BA160B17 for ; Tue, 6 Dec 2016 22:19:53 +0100 (CET) Received: (qmail 58116 invoked by uid 500); 6 Dec 2016 21:19:52 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 58108 invoked by uid 99); 6 Dec 2016 21:19:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2016 21:19:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4B515E0159; Tue, 6 Dec 2016 21:19:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: piotrz@apache.org To: commits@flex.apache.org Message-Id: <13049fa4995c4729b9ffd2264d4c7da2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-asjs] [refs/heads/develop] - Add DeletableLinkChip - it's represents "a" like delete button in Chip component Date: Tue, 6 Dec 2016 21:19:52 +0000 (UTC) archived-at: Tue, 06 Dec 2016 21:19:54 -0000 Repository: flex-asjs Updated Branches: refs/heads/develop c90180e60 -> 300938934 Add DeletableLinkChip - it's represents "a" like delete button in Chip component Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/30093893 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/30093893 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/30093893 Branch: refs/heads/develop Commit: 3009389346804fdd9149acff123fca9fa05b4b1b Parents: c90180e Author: piotrz Authored: Tue Dec 6 22:19:47 2016 +0100 Committer: piotrz Committed: Tue Dec 6 22:19:47 2016 +0100 ---------------------------------------------------------------------- .../flexjs/MDLExample/src/main/flex/Chips.mxml | 9 ++ .../apache/flex/mdl/beads/DeletableLinkChip.as | 118 +++++++++++++++++++ .../src/main/resources/mdl-manifest.xml | 1 + 3 files changed, 128 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/30093893/examples/flexjs/MDLExample/src/main/flex/Chips.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/Chips.mxml b/examples/flexjs/MDLExample/src/main/flex/Chips.mxml index 7adc2ff..a0861e3 100644 --- a/examples/flexjs/MDLExample/src/main/flex/Chips.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/Chips.mxml @@ -58,5 +58,14 @@ limitations under the License. + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/30093893/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/DeletableLinkChip.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/DeletableLinkChip.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/DeletableLinkChip.as new file mode 100644 index 0000000..19cf733 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/DeletableLinkChip.as @@ -0,0 +1,118 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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; + import org.apache.flex.mdl.NavigationLink; + import org.apache.flex.mdl.supportClasses.MaterialIconBase; + import org.apache.flex.utils.StrandUtils; + + /** + * The DeletableLinkChip bead class is a specialty bead that can be used to add additional + * link button to Chip MDL control. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class DeletableLinkChip implements IBead + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function DeletableLinkChip() + { + } + + private var linkElement:NavigationLink; + private var _href:String; + private var _strand:IStrand; + + /** + * @flexjsignorecoercion HTMLElement + * @flexjsignorecoercion HTMLSpanElement + * @flexjsignorecoercion HTMLButtonElement + * + * @param value + */ + public function set strand(value:IStrand):void + { + _strand = value; + + COMPILE::JS + { + var host:UIBase = value as UIBase; + var element:HTMLElement = host.element as HTMLElement; + var isValidElement:Boolean = element is HTMLSpanElement || element is HTMLButtonElement; + + if (isValidElement && element.className.search("mdl-chip") > -1) + { + element.classList.add("mdl-chip--deletable"); + + linkElement = createLinkElement(); + linkElement.href = _href; + + element.appendChild(linkElement.element as HTMLElement); + } + else + { + throw new Error("Host component must be an MDL Host for Chips."); + } + } + } + + + public function set href(value:String):void + { + _href = value; + } + + /** + * @flexjsignorecoercion HTMLElement + * + * @return Link represents cancel icon + */ + COMPILE::JS + private function createLinkElement():NavigationLink + { + var iconBead:IBead = StrandUtils.loadBead(MaterialIconBase, "MaterialIconBase", _strand); + if (iconBead == null) + { + throw new Error("Missing material icon bead"); + } + + var link:NavigationLink = new NavigationLink(); + link.addBead(iconBead); + + var linkElement:HTMLElement = (link.element as HTMLElement); + linkElement.classList.remove("mdl-navigation__link"); + linkElement.classList.add("mdl-chip__action"); + + return link; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/30093893/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 e033fcb..5810af8 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -63,6 +63,7 @@ +