Browse Source

【2025】【组件库】Tag组件补充优化

niehaoyu 4 months ago
parent
commit
fd085b5f05

+ 2 - 2
PDF Office/KMComponentLibrary/KMComponentLibrary.xcodeproj/project.pbxproj

@@ -930,10 +930,10 @@
 		BB5A9C5D2CB64D4800F64C1F /* ToolTips */ = {
 			isa = PBXGroup;
 			children = (
+				BB5A9C612CB64D4800F64C1F /* ComponentToolTipProperty.swift */,
 				BB5A9C5E2CB64D4800F64C1F /* ComponentToolTip.xib */,
 				BB5A9C5F2CB64D4800F64C1F /* ComponentToolTip.swift */,
 				BB5A9C602CB64D4800F64C1F /* ComponentToolTipsHelp.xib */,
-				BB5A9C612CB64D4800F64C1F /* ComponentToolTipProperty.swift */,
 				BB5A9C622CB64D4800F64C1F /* ComponentToolTipsHelp.swift */,
 			);
 			path = ToolTips;
@@ -942,9 +942,9 @@
 		BB5A9C642CB64D4800F64C1F /* Tag */ = {
 			isa = PBXGroup;
 			children = (
-				BB5A9C652CB64D4800F64C1F /* ComponentTag.xib */,
 				BB5A9C662CB64D4800F64C1F /* ComponentTagProperty.swift */,
 				BB5A9C672CB64D4800F64C1F /* ComponentTag.swift */,
+				BB5A9C652CB64D4800F64C1F /* ComponentTag.xib */,
 				BB5A9C682CB64D4800F64C1F /* ComponentTagRound */,
 			);
 			path = Tag;

+ 69 - 63
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Tag/ComponentTag.swift

@@ -68,67 +68,65 @@ public class ComponentTag: ComponentBaseXibView {
         
         self.titleLabel.stringValue = self.properties.text
         
-        self.properties.propertyInfo.viewWidth = 100
-        
     }
     
     func refreshUI() {
         
-        var fillColor: NSColor?
-        var borderColor: NSColor?
-        var cornerRadius: CGFloat = 0
-        var borderWidth: CGFloat = 0
-        var textColor: NSColor?
-        var textFont: NSFont?
-        
-        if self.properties.state == .normal {
-            fillColor = self.properties.propertyInfo.color_nor
-            borderColor = self.properties.propertyInfo.borderColor_nor
-            cornerRadius = 0
-            borderWidth = 0
-            textColor = self.properties.propertyInfo.textColor
-            textFont = self.properties.propertyInfo.textFont
+        var fillColor: NSColor = properties.propertyInfo.color_nor
+        var borderColor: NSColor = properties.propertyInfo.borderColor_nor
+        var cornerRadius: CGFloat = properties.propertyInfo.cornerRadius
+        var borderWidth: CGFloat = properties.propertyInfo.borderWidth
+        var textColor: NSColor = properties.propertyInfo.textColor
+        var textFont: NSFont = properties.propertyInfo.textFont
+        
+        if properties.tagType == .rounded ||
+            properties.tagType == .rounded_secondary {
+            
+            cornerRadius = CGRectGetHeight(self.bounds)/2.0
             
-        } else if properties.state == .hover {
-            fillColor = self.properties.propertyInfo.color_hov
-            borderColor = self.properties.propertyInfo.borderColor_hov
-            cornerRadius = self.properties.propertyInfo.cornerRadius
+        } else if properties.tagType == .checkable {
             borderWidth = 0
-            textColor = self.properties.propertyInfo.textColor_hov
-            textFont = self.properties.propertyInfo.textFont
             
-        } else if properties.state == .pressed {
-            fillColor = self.properties.propertyInfo.color_active
-            borderColor = self.properties.propertyInfo.borderColor_active
-            cornerRadius = self.properties.propertyInfo.cornerRadius
-            borderWidth = 1
-            textColor = self.properties.propertyInfo.textColor_Active
-            textFont = self.properties.propertyInfo.textFont_Sel_Hov
-            if self.isMouseEnter == true {
-                fillColor = self.properties.propertyInfo.color_Sel_Hov
-                borderColor = self.properties.propertyInfo.borderColor_active
-                cornerRadius = self.properties.propertyInfo.cornerRadius
+            if properties.state == .hover {
+                fillColor = properties.propertyInfo.color_hov
+                borderColor = properties.propertyInfo.borderColor_hov
+                textColor = properties.propertyInfo.textColor_hov
+                
+            } else if properties.state == .pressed {
+                fillColor = properties.propertyInfo.color_active
                 borderWidth = 1
-                textColor = self.properties.propertyInfo.textColor_Sel_Hov
-                textFont = self.properties.propertyInfo.textFont_Sel_Hov
+                borderColor = properties.propertyInfo.borderColor_active
+                textFont = properties.propertyInfo.textFont_Sel_Hov
+                textColor = properties.propertyInfo.textColor_Active
+                
+                if isMouseEnter {
+                    fillColor = properties.propertyInfo.color_Sel_Hov
+                    textColor = properties.propertyInfo.textColor_Sel_Hov
+                    
+                }
             }
         }
         
-        if let color = fillColor {
-            self.contendBox.fillColor = color
-        }
-        if let color = borderColor {
-            self.contendBox.borderColor = color
-        }
+        self.contendBox.fillColor = fillColor
+        self.contendBox.borderColor = borderColor
         self.contendBox.cornerRadius = cornerRadius
         self.contendBox.borderWidth = borderWidth
+        
         self.titleLabel.font = textFont
-        if let color = textColor {
-            self.titleLabel.textColor = color
-        }
+        self.titleLabel.textColor = textColor
+        
         
         let titleSize = self.titleLabel.sizeThatFits(NSSize(width: CGFloat(MAXFLOAT), height: 20))
-        self.properties.propertyInfo.viewWidth = titleSize.width + 16
+        self.properties.propertyInfo.viewWidth = titleSize.width + 16 - 2
+        
+        if properties.tagType == .mark_Blue ||
+            properties.tagType == .mark_Blue_secondary ||
+            properties.tagType == .mark_Dark ||
+            properties.tagType == .mark_Dark_secondary ||
+            properties.tagType == .mark_New ||
+            properties.tagType == .mark_New_secondary {
+            self.properties.propertyInfo.viewWidth = titleSize.width + 8 - 2
+        }
         
     }
     
@@ -148,12 +146,14 @@ public class ComponentTag: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
         
-        if self.properties.state != .pressed {
-            self.properties.state = .hover
+        if properties.tagType == .checkable {
+            if self.properties.state != .pressed {
+                self.properties.state = .hover
+            }
+            self.isMouseEnter = true
+            
+            self.refreshUI()
         }
-        self.isMouseEnter = true
-        
-        self.refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -165,32 +165,38 @@ public class ComponentTag: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.state != .pressed {
-            self.properties.state = .normal
+        if properties.tagType == .checkable {
+            if self.properties.state != .pressed {
+                self.properties.state = .normal
+            }
+            self.isMouseEnter = false
+            
+            self.refreshUI()
         }
-        self.isMouseEnter = false
-        
-        self.refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
     
-        if self.properties.state != .pressed {
-            self.properties.state = .pressed
-        } else {
-            self.properties.state = .hover
+        if properties.tagType == .checkable {
+            if self.properties.state != .pressed {
+                self.properties.state = .pressed
+            } else {
+                self.properties.state = .hover
+            }
+            
+            self.refreshUI()
         }
         
-        self.refreshUI()
-        
     }
     
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
          
-        if let target = target, let action = action {
-            _ = target.perform(action, with: self)
+        if properties.tagType == .checkable {
+            if let target = target, let action = action {
+                _ = target.perform(action, with: self)
+            }
         }
     }
 }

+ 1 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Tag/ComponentTag.xib

@@ -26,7 +26,7 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dox-T7-u5B">
-                                <rect key="frame" x="158" y="29" width="37" height="16"/>
+                                <rect key="frame" x="159" y="28" width="37" height="16"/>
                                 <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="HhA-Z8-v1I">
                                     <font key="font" usesAppearanceFont="YES"/>
                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>

+ 145 - 79
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Tag/ComponentTagProperty.swift

@@ -8,18 +8,38 @@
 import Foundation
 import AppKit
 
+@objc public enum ComponentTagType : Int {
+    case rounded = 0
+    case rounded_secondary
+    case checkable
+    case mark_Blue
+    case mark_Blue_secondary
+    case mark_Dark
+    case mark_Dark_secondary
+    case mark_New
+    case mark_New_secondary
+}
+
+
 public class ComponentTagProperty: NSObject {
     
-    public var size: ComponentSize = .m
+    public var tagType: ComponentTagType = .rounded
+    public var size: ComponentSize = .s
     public var state: ComponentState = .normal
+    public var isSelected: Bool = false
     public var text: String = "" //文字信息
         
     public var propertyInfo = TagPropertyInfo()
     
-    public init(size: ComponentSize = .m,
+    public init(tagType: ComponentTagType = .rounded,
+                size: ComponentSize = .s,
                 state: ComponentState = .normal,
+                isSelected: Bool = false,
                 text: String = "") {
+        self.tagType = tagType
         self.size = size
+        self.state = state
+        self.isSelected = isSelected
         self.text = text
     }
     
@@ -27,9 +47,9 @@ public class ComponentTagProperty: NSObject {
 
 public class TagPropertyInfo: ComponentPropertyInfo {
      
-    var color_Sel_Hov: NSColor?
-    var textColor_Sel_Hov: NSColor?
-    var textFont_Sel_Hov: NSFont?
+    var color_Sel_Hov: NSColor = NSColor.clear
+    var textColor_Sel_Hov: NSColor = NSColor.clear
+    var textFont_Sel_Hov: NSFont = NSFont.systemFont(ofSize: 14)
     
     //MARK: - Function
     override init() {
@@ -43,92 +63,138 @@ public class TagPropertyInfo: ComponentPropertyInfo {
 extension ComponentLibrary {
     
     func configTagComponent(properties: ComponentTagProperty) -> Void {
-        
-        properties.propertyInfo.color_nor = NSColor.clear
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("colorFill/hov") {
-            let currentValue = value as! [String : Any]
-            properties.propertyInfo.color_hov = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
-        } else {
-            properties.propertyInfo.color_hov = NSColor.clear
-        }
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("colorPrimary/bg-opacity-light") {
-            let currentValue = value as! [String : Any]
-            properties.propertyInfo.color_active = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
-        } else {
-            properties.propertyInfo.color_active = NSColor.clear
-        }
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("colorPrimary/bg-opacity-dark") {
-            let currentValue = value as! [String : Any]
-            properties.propertyInfo.color_Sel_Hov = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
-        } else {
-            properties.propertyInfo.color_Sel_Hov = NSColor.clear
-        }
-        
+         
+        properties.propertyInfo.borderWidth = 0
         properties.propertyInfo.borderColor_nor = NSColor.clear
-        properties.propertyInfo.borderColor_hov = NSColor.clear
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("colorPrimary/border1") {
-            let currentValue = value as! [String : Any]
-            properties.propertyInfo.borderColor_active = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
-        } else {
-            properties.propertyInfo.borderColor_active = NSColor.clear
-        }
         
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("radius/xs") {
-            let currentValue = value as! CGFloat
-            properties.propertyInfo.cornerRadius = currentValue
-        }
-        
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("colorText/2") {
-            let currentValue = value as! [String : Any]
-            properties.propertyInfo.textColor = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
-        } else {
-            properties.propertyInfo.textColor = NSColor.clear
-        }
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("colorText/2") {
-            let currentValue = value as! [String : Any]
-            properties.propertyInfo.textColor_hov = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
-        } else {
-            properties.propertyInfo.textColor_hov = NSColor.clear
-        }
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("colorPrimary/text") {
-            let currentValue = value as! [String : Any]
-            properties.propertyInfo.textColor_Active = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
-        } else {
-            properties.propertyInfo.textColor_Active = NSColor.clear
-        }
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("colorPrimary/textLight") {
-            let currentValue = value as! [String : Any]
-            properties.propertyInfo.textColor_Sel_Hov = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
-        } else {
-            properties.propertyInfo.textColor_Sel_Hov = NSColor.clear
+        if properties.tagType == .rounded {
+            properties.propertyInfo.color_nor = ComponentLibrary.shared.getComponentColorFromKey("colorFill/black40")
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/white1")
+            
+        } else if properties.tagType == .rounded_secondary {
+            properties.propertyInfo.color_nor = ComponentLibrary.shared.getComponentColorFromKey("colorFill/hov")
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+            
+        } else if properties.tagType == .checkable {
+            properties.propertyInfo.color_nor = NSColor.clear
+            properties.propertyInfo.color_hov = ComponentLibrary.shared.getComponentColorFromKey("colorFill/hov")
+            properties.propertyInfo.color_active = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/bg-opacity-light")
+            properties.propertyInfo.color_Sel_Hov = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/bg-opacity-dark")
+            
+            properties.propertyInfo.borderColor_nor = NSColor.clear
+            properties.propertyInfo.borderColor_hov = NSColor.clear
+            properties.propertyInfo.borderColor_active = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/border1")
+            
+            
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+            properties.propertyInfo.textColor_hov = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+            properties.propertyInfo.textColor_Active = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/text")
+            properties.propertyInfo.textColor_Sel_Hov = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/textLight")
+
+        } else if properties.tagType == .mark_Blue {
+            properties.propertyInfo.color_nor = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/base")
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/white1")
+            
+        } else if properties.tagType == .mark_Blue_secondary {
+            properties.propertyInfo.color_nor = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/bg-opacity-light")
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/text")
+            properties.propertyInfo.borderWidth = 1
+            properties.propertyInfo.borderColor_nor = ComponentLibrary.shared.getComponentColorFromKey("colorPrimary/border1")
+            
+        } else if properties.tagType == .mark_Dark {
+            properties.propertyInfo.color_nor = ComponentLibrary.shared.getComponentColorFromKey("colorFill/dark")
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/white1")
+            
+        } else if properties.tagType == .mark_Dark_secondary {
+            properties.propertyInfo.color_nor = ComponentLibrary.shared.getComponentColorFromKey("colorFill/4")
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
+            properties.propertyInfo.borderWidth = 1
+            properties.propertyInfo.borderColor_nor = ComponentLibrary.shared.getComponentColorFromKey("colorBorder/2")
+            
+        } else if properties.tagType == .mark_New {
+            properties.propertyInfo.color_nor = ComponentLibrary.shared.getComponentColorFromKey("colorSuccess/fillHov")
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/white1")
+            
+        } else if properties.tagType == .mark_New_secondary {
+            properties.propertyInfo.color_nor = NSColor(red: 65/255, green: 197/255, blue: 136/255, alpha: 0.1)
+            properties.propertyInfo.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorSuccess/text")
+            properties.propertyInfo.borderWidth = 1
+            properties.propertyInfo.borderColor_nor = ComponentLibrary.shared.getComponentColorFromKey("colorSuccess/fillHov")
+            
         }
         
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("mac/body-s-regular") {
-            let currentValue = value as! [String : Any]
+        if properties.tagType == .rounded ||
+            properties.tagType == .rounded_secondary {
             
-            if let fontSize = currentValue["fontSize"] as? Float,
-               let fontFamily = currentValue["fontFamily"] as? String,
-               let fontWeight = currentValue["fontWeight"] as? String {
+            if let value = ComponentLibrary.shared.getComponentValueFromKey("mac/body-s-regular") {
+                let currentValue = value as! [String : Any]
                 
-                let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: fontFamily, NSFontDescriptor.AttributeName.face: fontWeight])
-                if let newFont = NSFont(descriptor: attributeFontDescriptor, size: CGFloat(fontSize)) {
-                    properties.propertyInfo.textFont = newFont
+                if let fontSize = currentValue["fontSize"] as? Float,
+                   let fontFamily = currentValue["fontFamily"] as? String,
+                   let fontWeight = currentValue["fontWeight"] as? String {
+                    
+                    let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: fontFamily, NSFontDescriptor.AttributeName.face: fontWeight])
+                    if let newFont = NSFont(descriptor: attributeFontDescriptor, size: CGFloat(fontSize)) {
+                        properties.propertyInfo.textFont = newFont
+                    }
                 }
             }
-        }
-        
-        if let value = ComponentLibrary.shared.getComponentValueFromKey("mac/body-s-medium") {
-            let currentValue = value as! [String : Any]
             
-            if let fontSize = currentValue["fontSize"] as? Float,
-               let fontFamily = currentValue["fontFamily"] as? String,
-               let fontWeight = currentValue["fontWeight"] as? String {
+        } else if properties.tagType == .mark_Blue ||
+                    properties.tagType == .mark_Blue_secondary ||
+                    properties.tagType == .mark_Dark ||
+                    properties.tagType == .mark_Dark_secondary ||
+                    properties.tagType == .mark_New ||
+                    properties.tagType == .mark_New_secondary {
+            
+            if let value = ComponentLibrary.shared.getComponentValueFromKey("mac/body-xs-medium") {
+                let currentValue = value as! [String : Any]
                 
-                let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: fontFamily, NSFontDescriptor.AttributeName.face: fontWeight])
-                if let newFont = NSFont(descriptor: attributeFontDescriptor, size: CGFloat(fontSize)) {
-                    properties.propertyInfo.textFont_Sel_Hov = newFont
+                if let fontSize = currentValue["fontSize"] as? Float,
+                   let fontFamily = currentValue["fontFamily"] as? String,
+                   let fontWeight = currentValue["fontWeight"] as? String {
+                    
+                    let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: fontFamily, NSFontDescriptor.AttributeName.face: fontWeight])
+                    if let newFont = NSFont(descriptor: attributeFontDescriptor, size: CGFloat(fontSize)) {
+                        properties.propertyInfo.textFont = newFont
+                    }
                 }
             }
+            
+        } else if properties.tagType == .checkable {
+            if let value = ComponentLibrary.shared.getComponentValueFromKey("mac/body-s-regular") {
+                let currentValue = value as! [String : Any]
+                
+                if let fontSize = currentValue["fontSize"] as? Float,
+                   let fontFamily = currentValue["fontFamily"] as? String,
+                   let fontWeight = currentValue["fontWeight"] as? String {
+                    
+                    let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: fontFamily, NSFontDescriptor.AttributeName.face: fontWeight])
+                    if let newFont = NSFont(descriptor: attributeFontDescriptor, size: CGFloat(fontSize)) {
+                        properties.propertyInfo.textFont = newFont
+                    }
+                }
+            }
+            
+            if let value = ComponentLibrary.shared.getComponentValueFromKey("mac/body-s-medium") {
+                let currentValue = value as! [String : Any]
+                
+                if let fontSize = currentValue["fontSize"] as? Float,
+                   let fontFamily = currentValue["fontFamily"] as? String,
+                   let fontWeight = currentValue["fontWeight"] as? String {
+                    
+                    let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: fontFamily, NSFontDescriptor.AttributeName.face: fontWeight])
+                    if let newFont = NSFont(descriptor: attributeFontDescriptor, size: CGFloat(fontSize)) {
+                        properties.propertyInfo.textFont_Sel_Hov = newFont
+                    }
+                }
+            }
+            
+        }
+         
+        if let value = ComponentLibrary.shared.getComponentValueFromKey("radius/xs") {
+            let currentValue = value as! CGFloat
+            properties.propertyInfo.cornerRadius = currentValue
         }
          
         if properties.size == .s {

+ 12 - 11
PDF Office/PDF Master/KMClass/ComponentLibraryDemo/Demo/AlertControllerVC.swift

@@ -23,10 +23,9 @@ class AlertControllerVC: NSViewController {
     @IBOutlet weak var tagSizeBox: NSComboBox!
     @IBOutlet weak var tagTextField: NSTextField!
     
-    @IBOutlet weak var tagRoundItem: ComponentTagRound!
     @IBOutlet weak var tagRoundSecondaryBtn: NSButton!
-    @IBOutlet weak var tagRoundWidthConst: NSLayoutConstraint!
-     
+    @IBOutlet var tagTypeBox: NSComboBox!
+    
     @IBOutlet weak var tagWidthConst: NSLayoutConstraint!
     @IBOutlet weak var tagHeightConst: NSLayoutConstraint!
     
@@ -35,6 +34,7 @@ class AlertControllerVC: NSViewController {
         // Do view setup here.
         
         self.typeBox.selectItem(at: 0)
+        self.tagTypeBox.selectItem(at: 0)
         
         self.reloadData()
     }
@@ -71,27 +71,28 @@ class AlertControllerVC: NSViewController {
         if self.showCancelBtn.state == .on {
             cancelBtnString = "Cancel"
         }
-        let property = ComponentAlertProperty(messageType: type, title: title, subTitle: subTitle, detailButtonString: detailBtnString, cancelButtonString: cancelBtnString)
+        let property = ComponentAlertProperty(messageType: type, 
+                                              title: title, subTitle: subTitle, detailButtonString: detailBtnString, cancelButtonString: cancelBtnString)
         
         self.alertItem.properties = property
         self.alertItem.showInView(self.leftBox.contentView)
         
+        //Tag
         var tagSize: ComponentSize = .m
         if self.tagSizeBox.indexOfSelectedItem == 1 {
             tagSize = .s
         }
         let tagText: String = self.tagTextField.stringValue
-        let tagProperty = ComponentTagProperty(size: tagSize, state: .normal, text: tagText)
+        let tagProperty = ComponentTagProperty(tagType: ComponentTagType(rawValue: self.tagTypeBox.indexOfSelectedItem)!,
+                                               size: tagSize,
+                                               state: .normal,
+                                               isSelected: true,
+                                               text: tagText)
         self.tagItem.properties = tagProperty
         
         self.tagWidthConst.constant = self.tagItem.properties.propertyInfo.viewWidth
         self.tagHeightConst.constant = self.tagItem.properties.propertyInfo.viewHeight
-         
-        let tagRoundProperty = ComponentTagRoundProperty(secondary: self.tagRoundSecondaryBtn.state == .on,
-                                                         text: "Text")
-        
-        self.tagRoundItem.properties = tagRoundProperty
-        self.tagRoundWidthConst.constant = self.tagRoundItem.properties.propertyInfo.viewWidth
+          
         
     }
     

+ 35 - 11
PDF Office/PDF Master/KMClass/ComponentLibraryDemo/Demo/AlertControllerVC.xib

@@ -15,11 +15,10 @@
                 <outlet property="subTitleField" destination="mvQ-eT-Dwj" id="BAr-cr-s7E"/>
                 <outlet property="tagHeightConst" destination="ueZ-2z-EWQ" id="ICQ-wF-zXU"/>
                 <outlet property="tagItem" destination="ABs-BX-gxX" id="4Vg-u9-oXP"/>
-                <outlet property="tagRoundItem" destination="TWj-tk-lAr" id="2Nz-nD-F8c"/>
                 <outlet property="tagRoundSecondaryBtn" destination="2bU-FX-EbZ" id="mHU-2c-yEf"/>
-                <outlet property="tagRoundWidthConst" destination="WSi-IR-Ab8" id="1qP-c3-fXA"/>
                 <outlet property="tagSizeBox" destination="MLO-6W-JfF" id="1V5-Ml-KMg"/>
                 <outlet property="tagTextField" destination="V9S-6y-Ccc" id="diO-eK-ZnI"/>
+                <outlet property="tagTypeBox" destination="tlx-9D-two" id="fEZ-il-ca4"/>
                 <outlet property="tagWidthConst" destination="Wn7-wg-C6v" id="nrm-fx-zFS"/>
                 <outlet property="titleField" destination="ECt-dT-wXd" id="Di7-n2-8TC"/>
                 <outlet property="typeBox" destination="zoZ-yW-RHS" id="Q3X-zv-ZfV"/>
@@ -57,17 +56,8 @@
                                     <constraint firstAttribute="height" constant="20" id="ueZ-2z-EWQ"/>
                                 </constraints>
                             </customView>
-                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="TWj-tk-lAr" customClass="ComponentTagRound" customModule="KMComponentLibrary">
-                                <rect key="frame" x="40" y="212" width="100" height="20"/>
-                                <constraints>
-                                    <constraint firstAttribute="height" constant="20" id="UzP-07-Np6"/>
-                                    <constraint firstAttribute="width" constant="100" id="WSi-IR-Ab8"/>
-                                </constraints>
-                            </customView>
                         </subviews>
                         <constraints>
-                            <constraint firstItem="TWj-tk-lAr" firstAttribute="leading" secondItem="dsd-tZ-tac" secondAttribute="leading" constant="40" id="6N5-nN-4Cf"/>
-                            <constraint firstItem="TWj-tk-lAr" firstAttribute="top" secondItem="ABs-BX-gxX" secondAttribute="bottom" constant="20" id="8pL-Xh-fxI"/>
                             <constraint firstItem="ABs-BX-gxX" firstAttribute="top" secondItem="t0q-PA-5oP" secondAttribute="bottom" constant="10" id="Wrt-0m-fvn"/>
                             <constraint firstItem="t0q-PA-5oP" firstAttribute="top" secondItem="dsd-tZ-tac" secondAttribute="top" constant="180" id="ls1-ES-WtP"/>
                             <constraint firstItem="t0q-PA-5oP" firstAttribute="leading" secondItem="dsd-tZ-tac" secondAttribute="leading" constant="40" id="vR5-af-7Lc"/>
@@ -194,6 +184,36 @@
                                     <action selector="clickAction:" target="-2" id="ZZk-Im-2ag"/>
                                 </connections>
                             </button>
+                            <comboBox focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tlx-9D-two">
+                                <rect key="frame" x="53" y="181" width="83" height="23"/>
+                                <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="center" title="Round" drawsBackground="YES" completes="NO" numberOfVisibleItems="6" id="gqF-Wq-nSv">
+                                    <font key="font" metaFont="system"/>
+                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    <objectValues>
+                                        <string>Round</string>
+                                        <string>Round_sec</string>
+                                        <string>Checkable</string>
+                                        <string>Mark-Blue</string>
+                                        <string>Mark-Blue_Sec</string>
+                                        <string>Mark_Dark</string>
+                                        <string>Mark_Dark_Sec</string>
+                                        <string>Mark_New</string>
+                                        <string>Mark_New_sec</string>
+                                    </objectValues>
+                                </comboBoxCell>
+                                <connections>
+                                    <action selector="clickAction:" target="-2" id="hVj-Xe-4gD"/>
+                                </connections>
+                            </comboBox>
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="g8o-Rd-dUw">
+                                <rect key="frame" x="8" y="185" width="38" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Type:" id="aWu-KO-YrC">
+                                    <font key="font" metaFont="system"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
                         </subviews>
                         <constraints>
                             <constraint firstItem="mvQ-eT-Dwj" firstAttribute="leading" secondItem="9AS-Hl-MEC" secondAttribute="leading" constant="10" id="9JK-Ol-If1"/>
@@ -201,6 +221,7 @@
                             <constraint firstItem="A8O-ak-L4p" firstAttribute="leading" secondItem="9AS-Hl-MEC" secondAttribute="leading" constant="10" id="I1a-Xm-zDO"/>
                             <constraint firstItem="zoZ-yW-RHS" firstAttribute="leading" secondItem="4Dg-8t-MxX" secondAttribute="trailing" constant="5" id="Jkk-zv-7sR"/>
                             <constraint firstItem="ECt-dT-wXd" firstAttribute="top" secondItem="cA3-gZ-BEW" secondAttribute="bottom" constant="10" id="Lxv-oO-ZuV"/>
+                            <constraint firstItem="tlx-9D-two" firstAttribute="leading" secondItem="g8o-Rd-dUw" secondAttribute="trailing" constant="10" id="Mqi-fG-xfs"/>
                             <constraint firstItem="V9S-6y-Ccc" firstAttribute="leading" secondItem="9AS-Hl-MEC" secondAttribute="leading" constant="10" id="Np9-ko-BWq"/>
                             <constraint firstItem="2bU-FX-EbZ" firstAttribute="top" secondItem="V9S-6y-Ccc" secondAttribute="bottom" constant="40" id="Pcr-39-vlM"/>
                             <constraint firstItem="MLO-6W-JfF" firstAttribute="centerY" secondItem="rmh-A7-k1P" secondAttribute="centerY" id="Qbs-4X-mgZ"/>
@@ -217,10 +238,13 @@
                             <constraint firstItem="zoZ-yW-RHS" firstAttribute="centerY" secondItem="4Dg-8t-MxX" secondAttribute="centerY" id="j26-wL-4DV"/>
                             <constraint firstItem="cA3-gZ-BEW" firstAttribute="top" secondItem="LrD-NN-OD8" secondAttribute="bottom" constant="10" id="jfG-b0-LQ5"/>
                             <constraint firstItem="LrD-NN-OD8" firstAttribute="leading" secondItem="9AS-Hl-MEC" secondAttribute="leading" constant="10" id="kVx-Lm-RxS"/>
+                            <constraint firstItem="g8o-Rd-dUw" firstAttribute="leading" secondItem="9AS-Hl-MEC" secondAttribute="leading" constant="10" id="l1v-aA-rmB"/>
                             <constraint firstItem="MLO-6W-JfF" firstAttribute="leading" secondItem="rmh-A7-k1P" secondAttribute="trailing" constant="10" id="l2x-EO-ZBO"/>
                             <constraint firstAttribute="trailing" secondItem="zoZ-yW-RHS" secondAttribute="trailing" constant="69" id="oOW-JY-GUE"/>
                             <constraint firstItem="rmh-A7-k1P" firstAttribute="leading" secondItem="9AS-Hl-MEC" secondAttribute="leading" constant="10" id="owa-oz-qOO"/>
                             <constraint firstItem="2bU-FX-EbZ" firstAttribute="leading" secondItem="9AS-Hl-MEC" secondAttribute="leading" constant="10" id="pM6-LI-6Pv"/>
+                            <constraint firstItem="g8o-Rd-dUw" firstAttribute="top" secondItem="V9S-6y-Ccc" secondAttribute="bottom" constant="10" id="vsZ-Cw-Z9i"/>
+                            <constraint firstItem="tlx-9D-two" firstAttribute="centerY" secondItem="g8o-Rd-dUw" secondAttribute="centerY" id="wH2-J5-ooo"/>
                             <constraint firstAttribute="trailing" secondItem="ECt-dT-wXd" secondAttribute="trailing" constant="10" id="wu4-bQ-kpv"/>
                         </constraints>
                     </view>