Browse Source

【2025】【组件库】代码规范处理

niehaoyu 4 months ago
parent
commit
25dec16730
26 changed files with 776 additions and 808 deletions
  1. 3 3
      PDF Office/KMComponentLibrary/KMComponentLibrary.xcodeproj/project.pbxproj
  2. 45 47
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/CheckBox/ComponentCheckBox.swift
  3. 23 28
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/ComponentModal/ComponentModal.swift
  4. 39 43
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelector.swift
  5. 14 16
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorGroup.swift
  6. 8 8
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Divider/ComponentDivider.swift
  7. 61 61
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdown.swift
  8. 109 111
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentInput/ComponentInput.swift
  9. 1 1
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentInput/ComponentInput.xib
  10. 19 30
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/List/ComponentListBasicItem.swift
  11. 2 2
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/MenuItem/ComponentMenuItem.swift
  12. 32 32
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Message/ComponentMessage.swift
  13. 26 26
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Navigation/ComponentNavBarItem.swift
  14. 18 18
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Pagination/ComponentPagination.swift
  15. 27 27
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Pagination/ComponentPaginationItem.swift
  16. 28 29
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressCircle.swift
  17. 31 31
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressLine.swift
  18. 13 14
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressPopup.swift
  19. 41 42
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Radio/ComponentRadio.swift
  20. 99 98
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Select/ComponentSelect.swift
  21. 2 0
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Select/ComponentSelectProperty.swift
  22. 21 24
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/ComponentSideBarItem.swift
  23. 7 7
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/PageTurner/ComponentSidebarPageTurner.swift
  24. 79 79
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Slider/ComponentSlider.swift
  25. 1 4
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Tabs/ComponentTabsItem.swift
  26. 27 27
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Tree/ComponentTreeItem.swift

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

@@ -538,8 +538,8 @@
 		BB5A9BC02CB64D4700F64C1F /* Radio */ = {
 			isa = PBXGroup;
 			children = (
-				BB5A9BC12CB64D4700F64C1F /* ComponentRadio.xib */,
 				BB5A9BC22CB64D4700F64C1F /* ComponentRadio.swift */,
+				BB5A9BC12CB64D4700F64C1F /* ComponentRadio.xib */,
 			);
 			path = Radio;
 			sourceTree = "<group>";
@@ -759,10 +759,10 @@
 		BB5A9C152CB64D4700F64C1F /* Slider */ = {
 			isa = PBXGroup;
 			children = (
+				BB5A9C1B2CB64D4700F64C1F /* ComponentSlider.swift */,
 				BB5A9C162CB64D4700F64C1F /* ComponentSlider.xib */,
 				BB5A9C172CB64D4700F64C1F /* ComponentSliderProperty.swift */,
 				BB5A9C182CB64D4700F64C1F /* ComponentSliderPoint */,
-				BB5A9C1B2CB64D4700F64C1F /* ComponentSlider.swift */,
 			);
 			path = Slider;
 			sourceTree = "<group>";
@@ -878,8 +878,8 @@
 			isa = PBXGroup;
 			children = (
 				BB5A9C462CB64D4700F64C1F /* ComponentListBasicItem.swift */,
-				BB5A9C472CB64D4700F64C1F /* ComponentListBasicItemProperty.swift */,
 				BB5A9C482CB64D4700F64C1F /* ComponentListBasicItem.xib */,
+				BB5A9C472CB64D4700F64C1F /* ComponentListBasicItemProperty.swift */,
 			);
 			path = List;
 			sourceTree = "<group>";

+ 45 - 47
PDF Office/KMComponentLibrary/KMComponentLibrary/View/CheckBox/ComponentCheckBox.swift

@@ -44,9 +44,8 @@ public class ComponentCheckBox: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
         
-        self.contendBox.fillColor = .clear
-        self.contendBox.borderWidth = 0
-        
+        contendBox.fillColor = .clear
+        contendBox.borderWidth = 0
         
     }
     
@@ -61,15 +60,15 @@ public class ComponentCheckBox: ComponentBaseXibView {
             
             ComponentLibrary.shared.configCheckBoxComponent(properties: _properties)
              
-            self.reloadData()
+            reloadData()
         }
     }
     
     public func reloadData() {
         
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public func setTarget(_ target: AnyObject?, action: Selector?) {
@@ -79,61 +78,60 @@ public class ComponentCheckBox: ComponentBaseXibView {
      
     func setupUI() {
         
-        if (self.properties.text) != nil {
-            self.titleLabel.stringValue = self.properties.text ?? ""
-            self.titleLabel.textColor = self.properties.propertyInfo.textColor
-            if self.properties.isDisabled == true {
-                self.titleLabel.textColor = self.properties.propertyInfo.textColor_dis
+        if (properties.text) != nil {
+            titleLabel.stringValue = properties.text ?? ""
+            titleLabel.textColor = properties.propertyInfo.textColor
+            if properties.isDisabled == true {
+                titleLabel.textColor = properties.propertyInfo.textColor_dis
             }
-            self.titleLabel.font = self.properties.propertyInfo.textFont
+            titleLabel.font = properties.propertyInfo.textFont
         }
         
-        if self.properties.showhelp == true {
-            self.helpTooltips.isHidden = false
+        if properties.showhelp == true {
+            helpTooltips.isHidden = false
         } else {
-            self.helpTooltips.isHidden = true
+            helpTooltips.isHidden = true
         }
         
-        if (self.properties.text) != nil {
-            self.titleLabel.isHidden = false
+        if (properties.text) != nil {
+            titleLabel.isHidden = false
         } else {
-            self.titleLabel.isHidden = true
+            titleLabel.isHidden = true
         }
-        
     }
     
     func refreshUI() {
        
         var imageName = "checkbox_default_nor"
-        if self.properties.checkboxType == .normal {
-            if self.properties.state == .normal {
+        if properties.checkboxType == .normal {
+            if properties.state == .normal {
                 imageName = "checkbox_default_nor"
-            } else if self.properties.state == .hover {
+            } else if properties.state == .hover {
                 imageName = "checkbox_default_hov"
             }
-            if self.properties.isDisabled == true {
+            if properties.isDisabled == true {
                 imageName = "checkbox_default_dis"
             }
-        } else if self.properties.checkboxType == .indeterminate {
-            if self.properties.state == .normal {
+        } else if properties.checkboxType == .indeterminate {
+            if properties.state == .normal {
                 imageName = "checkbox_Indet_nor"
-            } else if self.properties.state == .hover {
+            } else if properties.state == .hover {
                 imageName = "checkbox_Indet_hov"
             }
-            if self.properties.isDisabled == true {
+            if properties.isDisabled == true {
                 imageName = "checkbox_Indet_dis"
             }
-        } else if self.properties.checkboxType == .selected {
-            if self.properties.state == .normal {
+        } else if properties.checkboxType == .selected {
+            if properties.state == .normal {
                 imageName = "checkbox_sel_nor"
-            } else if self.properties.state == .hover {
+            } else if properties.state == .hover {
                 imageName = "checkbox_sel_hov"
             }
-            if self.properties.isDisabled == true {
+            if properties.isDisabled == true {
                 imageName = "checkbox_sel_dis"
             }
         }
-        self.checkboxImage.image = ComponentLibrary.shared.image(forResource: imageName)
+        checkboxImage.image = ComponentLibrary.shared.image(forResource: imageName)
         
     }
     
@@ -141,10 +139,10 @@ public class ComponentCheckBox: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties.isDisabled == false {
-            self.properties.state = .hover
+        if properties.isDisabled == false {
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -155,11 +153,11 @@ public class ComponentCheckBox: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false {
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -172,22 +170,22 @@ public class ComponentCheckBox: ComponentBaseXibView {
         
         var eventContinue = true
         let point = convert(event.locationInWindow, from: nil)
-        if self.helpTooltips.isHidden == false {
-            if CGRectContainsPoint(self.helpTooltips.frame, point) {
+        if helpTooltips.isHidden == false {
+            if CGRectContainsPoint(helpTooltips.frame, point) {
                 eventContinue = false
             }
         }
         
-        if self.properties.isDisabled == false && eventContinue == true {
-            if self.properties.isDisabled == false {
-                self.properties.state = .normal
+        if properties.isDisabled == false && eventContinue == true {
+            if properties.isDisabled == false {
+                properties.state = .normal
             }
-            if self.properties.checkboxType != .selected {
-                self.properties.checkboxType = .selected
+            if properties.checkboxType != .selected {
+                properties.checkboxType = .selected
             } else {
-                self.properties.checkboxType = .normal
+                properties.checkboxType = .normal
             }
-            self.refreshUI()
+            refreshUI()
             
             if let target = target, let action = action {
                 _ = target.perform(action, with: self)

+ 23 - 28
PDF Office/KMComponentLibrary/KMComponentLibrary/View/ComponentModal/ComponentModal.swift

@@ -71,8 +71,8 @@ public class ComponentModal: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
          
-        self.cancelButton.setTarget(self, action: #selector(cancelButtonClick(_:)))
-        self.confirmButton.setTarget(self, action: #selector(confirmButtonClick(_:)))
+        cancelButton.setTarget(self, action: #selector(cancelButtonClick(_:)))
+        confirmButton.setTarget(self, action: #selector(confirmButtonClick(_:)))
         
     }
     
@@ -87,25 +87,24 @@ public class ComponentModal: ComponentBaseXibView {
             
             ComponentLibrary.shared.configModalComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
-    
     //MARK: - SetupUI
     func setupUI() {
         
-        var iconImage: NSImage? = self.properties.image
+        var iconImage: NSImage? = properties.image
         confirmButtonProperty.type = .primary
-        if self.properties.messageType == .info {
+        if properties.messageType == .info {
             iconImage = ComponentLibrary.shared.image(forResource: "message_Info")
-        } else if self.properties.messageType == .success {
+        } else if properties.messageType == .success {
             iconImage = ComponentLibrary.shared.image(forResource: "message_success")
-        } else if self.properties.messageType == .warning {
+        } else if properties.messageType == .warning {
             iconImage = ComponentLibrary.shared.image(forResource: "message_warning")
-        } else if self.properties.messageType == .error {
+        } else if properties.messageType == .error {
             iconImage = ComponentLibrary.shared.image(forResource: "message_error")
             confirmButtonProperty.type = .danger
         }
@@ -117,20 +116,20 @@ public class ComponentModal: ComponentBaseXibView {
             self.iconImage.isHidden = true
         }
         
-        self.titleLabel.stringValue = self.properties.text
-        self.subTitleLabel.stringValue = self.properties.subText
+        titleLabel.stringValue = properties.text
+        subTitleLabel.stringValue = properties.subText
          
-        self.cancelButton.properties = cancelButtonProperty
+        cancelButton.properties = cancelButtonProperty
         
-        self.confirmButton.properties = confirmButtonProperty
+        confirmButton.properties = confirmButtonProperty
         
         if self.iconImage.isHidden == true {
-            self.titleLabelLeftConst.constant = 16
-            self.titleLabelWidthConst.constant = 432
+            titleLabelLeftConst.constant = 16
+            titleLabelWidthConst.constant = 432
             
         } else {
-            self.titleLabelLeftConst.constant = 52
-            self.titleLabelWidthConst.constant = 396
+            titleLabelLeftConst.constant = 52
+            titleLabelWidthConst.constant = 396
             
         }
         
@@ -148,10 +147,8 @@ public class ComponentModal: ComponentBaseXibView {
     
     func refreshUI() {
         
-        
     }
     
-    
     @objc func cancelButtonClick(_ sender: Any) {
         if let vcWindow = windowVC.window {
             parentWindow.endSheet(vcWindow)
@@ -160,18 +157,18 @@ public class ComponentModal: ComponentBaseXibView {
     }
     
     @objc func confirmButtonClick(_ sender: Any) {
-            
-       
+        
     }
     
     //MARK: - Public Method
     public func reloadData() {
-        self.refreshUI()
+        refreshUI()
         
     }
+    
     public func show(with property: ComponentModalProperty, in window: NSWindow?) {
         
-        self.properties = property
+        properties = property
         
         var windowRect = CGRectZero
         windowRect.size.width = 480
@@ -179,8 +176,8 @@ public class ComponentModal: ComponentBaseXibView {
         windowVC.window?.setFrame(windowRect, display: false)
         
         windowVC.window?.contentView?.addSubview(self)
-        self.frame = windowVC.window?.contentView?.bounds ?? windowRect
-        self.autoresizingMask = [.width, .height]
+        frame = windowVC.window?.contentView?.bounds ?? windowRect
+        autoresizingMask = [.width, .height]
         
         if let vcWindow = windowVC.window, let superWindow = window {
             parentWindow = superWindow
@@ -191,8 +188,6 @@ public class ComponentModal: ComponentBaseXibView {
              
             }
         }
-        
-        
     }
     
 }

+ 39 - 43
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelector.swift

@@ -23,7 +23,6 @@ public class ComponentCSelector: ComponentBaseXibView {
     private weak var target: AnyObject? // 对象目标
     
     public var customData: Any? //提供给外部关联自定义数据
-     
     
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
@@ -47,8 +46,7 @@ public class ComponentCSelector: ComponentBaseXibView {
     
     public override func awakeFromNib() {
         super.awakeFromNib()
-       
-         
+        
     }
     
     // MARK: - Set & Get
@@ -61,7 +59,7 @@ public class ComponentCSelector: ComponentBaseXibView {
             
             ComponentLibrary.shared.configCSelectorComponent(properties: _properties)
             
-            self.reloadData()
+            reloadData()
         }
     }
     
@@ -69,22 +67,22 @@ public class ComponentCSelector: ComponentBaseXibView {
     func setupUI() {
         
         if properties.size == .s {
-            self.iconImgWidthConst.constant = 16
+            iconImgWidthConst.constant = 16
         } else {
-            self.iconImgWidthConst.constant = 20
+            iconImgWidthConst.constant = 20
         }
         
-        if self.properties.text?.isEmpty == false {
-            self.infoLabel.isHidden = false
-            self.infoLabel.stringValue = self.properties.text ?? ""
-            self.infoLabel.font = self.properties.propertyInfo.textFont
+        if properties.text?.isEmpty == false {
+            infoLabel.isHidden = false
+            infoLabel.stringValue = properties.text ?? ""
+            infoLabel.font = properties.propertyInfo.textFont
             
             var labelSize = CGSizeZero
-            if self.infoLabel.stringValue.count > 0 {
-                labelSize = ComponentLibrary.shared.sizeOfString(self.infoLabel.stringValue, self.infoLabel.font ?? NSFont.systemFont(ofSize: 12), 1000)
+            if infoLabel.stringValue.count > 0 {
+                labelSize = ComponentLibrary.shared.sizeOfString(infoLabel.stringValue, infoLabel.font ?? NSFont.systemFont(ofSize: 12), 1000)
             }
         } else {
-            self.infoLabel.isHidden = true
+            infoLabel.isHidden = true
         }
     }
     
@@ -96,32 +94,32 @@ public class ComponentCSelector: ComponentBaseXibView {
         
         var iconImage = properties.iconImage
         
-        if self.properties.state == .normal {
-            fillColor = self.properties.propertyInfo.color_nor
+        if properties.state == .normal {
+            fillColor = properties.propertyInfo.color_nor
             borderWidth = 0
-            borderColor = self.properties.propertyInfo.borderColor_nor
-        } else if self.properties.state == .hover {
-            fillColor = self.properties.propertyInfo.color_hov
-            borderWidth = self.properties.propertyInfo.borderWidth
-            borderColor = self.properties.propertyInfo.borderColor_hov
+            borderColor = properties.propertyInfo.borderColor_nor
+        } else if properties.state == .hover {
+            fillColor = properties.propertyInfo.color_hov
+            borderWidth = properties.propertyInfo.borderWidth
+            borderColor = properties.propertyInfo.borderColor_hov
             if let image = properties.icon_hov_Image {
                 iconImage = image
             }
-        } else if self.properties.state == .pressed {
-            fillColor = self.properties.propertyInfo.color_active
-            borderWidth = self.properties.propertyInfo.borderWidth
-            borderColor = self.properties.propertyInfo.borderColor_active
+        } else if properties.state == .pressed {
+            fillColor = properties.propertyInfo.color_active
+            borderWidth = properties.propertyInfo.borderWidth
+            borderColor = properties.propertyInfo.borderColor_active
         }
         
         self.iconImage.image = iconImage
         
         if let color = fillColor {
-            self.iconBox.fillColor = color
+            iconBox.fillColor = color
         }
-        self.iconBox.borderWidth = borderWidth
+        iconBox.borderWidth = borderWidth
         
         if let color = borderColor {
-            self.iconBox.borderColor = color
+            iconBox.borderColor = color
         }
         
     }
@@ -133,21 +131,19 @@ public class ComponentCSelector: ComponentBaseXibView {
     
     public func reloadData() {
         
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
     }
     
-   
-    
     //MARK: - MouseEvent
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties.state != .pressed {
-            self.properties.state = .hover
+        if properties.state != .pressed {
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
         
     }
     
@@ -159,31 +155,31 @@ public class ComponentCSelector: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.state != .pressed {
-            self.properties.state = .normal
+        if properties.state != .pressed {
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
         
     }
     
     public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         
-        if self.properties.state == .pressed {
-            self.properties.state = .normal
+        if properties.state == .pressed {
+            properties.state = .normal
         } else {
-            self.properties.state = .pressed
+            properties.state = .pressed
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
          
-        self.properties.state = .normal
-        self.refreshUI()
+        properties.state = .normal
+        refreshUI()
         
         if let target = target, let action = action {
             _ = target.perform(action, with: self)

+ 14 - 16
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorGroup.swift

@@ -11,7 +11,6 @@ public class ComponentCSelectorGroup: ComponentBaseXibView {
 
     @IBOutlet var contendBox: NSBox!
 
-    
     var csPropertyArr: [ComponentCSelectorProperty] = []
     
     public override func draw(_ dirtyRect: NSRect) {
@@ -37,41 +36,40 @@ public class ComponentCSelectorGroup: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
        
-         
     }
     
     public func updateItemProperty(_ propertys: [ComponentCSelectorProperty]) {
-        self.csPropertyArr = propertys
+        csPropertyArr = propertys
         
-        self.reloadData()
+        reloadData()
     }
     
     func reloadData() {
-        if self.csPropertyArr.count == 0 {
+        if csPropertyArr.count == 0 {
             return
         }
-        self.contendBox.borderWidth = 1
+        contendBox.borderWidth = 1
         
         if let value = ComponentLibrary.shared.getComponentValueFromKey("comp-field/colorFill-nor") {
             let currentValue = value as! [String : Any]
-            self.contendBox.fillColor = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
+            contendBox.fillColor = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
         } else {
-            self.contendBox.fillColor = NSColor.clear
+            contendBox.fillColor = NSColor.clear
         }
         
         if let value = ComponentLibrary.shared.getComponentValueFromKey("comp-field/colorBorder-nor") {
             let currentValue = value as! [String : Any]
-            self.contendBox.borderColor = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
+            contendBox.borderColor = ComponentLibrary.shared.getColor(rgbaDict: currentValue)
         } else {
-            self.contendBox.borderColor = NSColor.clear
+            contendBox.borderColor = NSColor.clear
         }
         
         if let value = ComponentLibrary.shared.getComponentValueFromKey("radius/xs") {
             let currentValue = value as! CGFloat
-            self.contendBox.cornerRadius = currentValue
+            contendBox.cornerRadius = currentValue
         }
         
-        if let subviews = self.contendBox.contentView?.subviews {
+        if let subviews = contendBox.contentView?.subviews {
             for view in subviews {
                 if view is ComponentCSelector {
                     view.removeFromSuperview()
@@ -80,15 +78,15 @@ public class ComponentCSelectorGroup: ComponentBaseXibView {
         }
         
         var itemXValue: CGFloat = 0
-        for i in 0...self.csPropertyArr.count - 1 {
-            let itemProperty = self.csPropertyArr[i]
+        for i in 0...csPropertyArr.count - 1 {
+            let itemProperty = csPropertyArr[i]
             let item = ComponentCSelector.init()
             item.properties = itemProperty
             let viewWidth = itemProperty.propertyInfo.viewWidth
             item.frame = CGRectMake(itemXValue, 0, viewWidth, viewWidth)
             item.autoresizingMask = [.maxXMargin,.maxYMargin]
             item.setTarget(self, action: #selector(cSelectorItemClicked(_:)))
-            self.contendBox.contentView?.addSubview(item)
+            contendBox.contentView?.addSubview(item)
             
             itemXValue += viewWidth
         }
@@ -98,7 +96,7 @@ public class ComponentCSelectorGroup: ComponentBaseXibView {
     @objc func cSelectorItemClicked(_ item: ComponentCSelector) {
         let property = item.properties
         
-        if let subviews = self.contendBox.contentView?.subviews {
+        if let subviews = contendBox.contentView?.subviews {
             for view in subviews {
                 if view is ComponentCSelector {
                     let itemView = view as! ComponentCSelector

+ 8 - 8
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Divider/ComponentDivider.swift

@@ -19,8 +19,8 @@ public class ComponentDivider: ComponentBaseXibView {
         let lineWidth: CGFloat = 1
         
         let path = NSBezierPath()
-        if self.properties.type == .horizontal {
-            if self.properties.dash == true {
+        if properties.type == .horizontal {
+            if properties.dash == true {
                 let dashPattern: [CGFloat] = [3,3]
                 path.setLineDash(dashPattern, count: dashPattern.count, phase: 0)
                 path.move(to: CGPoint(x: 0, y: bounds.height / 2))
@@ -29,8 +29,8 @@ public class ComponentDivider: ComponentBaseXibView {
                 path.move(to: CGPoint(x: 0, y: bounds.height / 2))
                 path.line(to: CGPoint(x: bounds.width, y: bounds.height / 2))
             }
-        } else if self.properties.type == .vertical {
-            if self.properties.dash == true {
+        } else if properties.type == .vertical {
+            if properties.dash == true {
                 let dashPattern: [CGFloat] = [3,3]
                 path.setLineDash(dashPattern, count: dashPattern.count, phase: 0)
                 path.move(to: CGPoint(x: bounds.width / 2, y: 0))
@@ -41,7 +41,8 @@ public class ComponentDivider: ComponentBaseXibView {
             }
         }
         path.lineWidth = lineWidth
-        self.properties.propertyInfo.borderColor_nor.setStroke()
+       
+        properties.propertyInfo.borderColor_nor.setStroke()
         path.stroke()
     }
     
@@ -61,7 +62,6 @@ public class ComponentDivider: ComponentBaseXibView {
         
     }
     
-    
     // MARK: - Set & Get
     
     public var properties : ComponentDividerProperty {
@@ -72,8 +72,8 @@ public class ComponentDivider: ComponentBaseXibView {
             _properties = newValue
             
             ComponentLibrary.shared.configDividerComponent(properties: _properties)
-            
-            self.display()
+               
+            display()
         }
     }
 

+ 61 - 61
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdown.swift

@@ -72,23 +72,23 @@ public class ComponentDropdown: ComponentBaseXibView {
 
             ComponentLibrary.shared.configDropdownComponent(properties: _properties)
 
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
     //MARK: - SetupUI
     func setupUI() {
-        self.splitCenterDivider.isHidden = true
-        self.splitRightButton.isHidden = true
+        splitCenterDivider.isHidden = true
+        splitRightButton.isHidden = true
         
         var buttonType: componentButtonType = .primary
         var buttonOnlyIcon: Bool = false
         var buttonShowLeft: Bool = false
         var buttonShowRight: Bool = false
         
-        self.rightBtnRightConst.constant = 0
+        rightBtnRightConst.constant = 0
          
         switch properties.type {
         case .default_primary:
@@ -138,8 +138,8 @@ public class ComponentDropdown: ComponentBaseXibView {
             
             break
         case .split_primary:
-            self.splitCenterDivider.isHidden = false
-            self.splitRightButton.isHidden = false
+            splitCenterDivider.isHidden = false
+            splitRightButton.isHidden = false
             
             buttonType = .primary
             buttonOnlyIcon = false
@@ -148,8 +148,8 @@ public class ComponentDropdown: ComponentBaseXibView {
             
             break
         case .split_graySecondary:
-            self.splitCenterDivider.isHidden = false
-            self.splitRightButton.isHidden = false
+            splitCenterDivider.isHidden = false
+            splitRightButton.isHidden = false
             
             buttonType = .gray
             buttonOnlyIcon = false
@@ -166,7 +166,7 @@ public class ComponentDropdown: ComponentBaseXibView {
         properties_leftButtons.onlyIcon = buttonOnlyIcon
         properties_leftButtons.showLeftIcon = buttonShowLeft
         properties_leftButtons.showRightIcon = buttonShowRight
-        properties_leftButtons.buttonText = self.properties.text
+        properties_leftButtons.buttonText = properties.text
         properties_leftButtons.isDisabled = properties.isDisabled
         properties_leftButtons.propertyInfo.cornerRadius_topRight = 0
         properties_leftButtons.propertyInfo.cornerRadius_bottomRight = 0
@@ -183,74 +183,74 @@ public class ComponentDropdown: ComponentBaseXibView {
         properties_rightButtons.propertyInfo.cornerRadius_bottomLeft = 0
         splitRightButton.properties = properties_rightButtons
         
-        self.splitCenterDivider.properties = properties_Divider
+        splitCenterDivider.properties = properties_Divider
         
-        let leftWidth = self.splitLeftButton.properties.propertyInfo.viewWidth
-        var rightWidth = self.splitRightButton.properties.propertyInfo.viewWidth
-        if self.splitRightButton.isHidden == true {
+        let leftWidth = splitLeftButton.properties.propertyInfo.viewWidth
+        var rightWidth = splitRightButton.properties.propertyInfo.viewWidth
+        if splitRightButton.isHidden == true {
             rightWidth = 0
         }
         
-        self.properties.propertyInfo.viewWidth = leftWidth + rightWidth + 1
+        properties.propertyInfo.viewWidth = leftWidth + rightWidth + 1
         
-        self.rightBtnRightConst.constant = rightWidth
+        rightBtnRightConst.constant = rightWidth
     }
     
     func refreshUI() {
         
         if true {
-            let image = self.dropdownImage(with: self.properties_leftButtons.propertyInfo.textColor)
-            self.splitLeftButton.properties.propertyInfo.rightIcon_nor = image
-            self.splitLeftButton.properties.propertyInfo.leftIcon_nor = image
-            self.splitRightButton.properties.propertyInfo.leftIcon_nor = image
+            let image = dropdownImage(with: properties_leftButtons.propertyInfo.textColor)
+            splitLeftButton.properties.propertyInfo.rightIcon_nor = image
+            splitLeftButton.properties.propertyInfo.leftIcon_nor = image
+            splitRightButton.properties.propertyInfo.leftIcon_nor = image
         }
         if true {
-            let image = self.dropdownImage(with: self.properties_leftButtons.propertyInfo.textColor_hov)
-            self.splitLeftButton.properties.propertyInfo.rightIcon_hov = image
-            self.splitLeftButton.properties.propertyInfo.leftIcon_hov = image
-            self.splitRightButton.properties.propertyInfo.leftIcon_hov = image
+            let image = dropdownImage(with: properties_leftButtons.propertyInfo.textColor_hov)
+            splitLeftButton.properties.propertyInfo.rightIcon_hov = image
+            splitLeftButton.properties.propertyInfo.leftIcon_hov = image
+            splitRightButton.properties.propertyInfo.leftIcon_hov = image
         }
         if true {
-            let image = self.dropdownImage(with: self.properties_leftButtons.propertyInfo.textColor_Active)
-            self.splitLeftButton.properties.propertyInfo.rightIcon_press = image
-            self.splitLeftButton.properties.propertyInfo.leftIcon_press = image
-            self.splitRightButton.properties.propertyInfo.leftIcon_press = image
+            let image = dropdownImage(with: properties_leftButtons.propertyInfo.textColor_Active)
+            splitLeftButton.properties.propertyInfo.rightIcon_press = image
+            splitLeftButton.properties.propertyInfo.leftIcon_press = image
+            splitRightButton.properties.propertyInfo.leftIcon_press = image
         }
         if true {
-            let image = self.dropdownImage(with: self.properties_leftButtons.propertyInfo.textColor_dis)
-            self.splitLeftButton.properties.propertyInfo.rightIcon_dis = image
-            self.splitLeftButton.properties.propertyInfo.leftIcon_dis = image
-            self.splitRightButton.properties.propertyInfo.leftIcon_dis = image
+            let image = dropdownImage(with: properties_leftButtons.propertyInfo.textColor_dis)
+            splitLeftButton.properties.propertyInfo.rightIcon_dis = image
+            splitLeftButton.properties.propertyInfo.leftIcon_dis = image
+            splitRightButton.properties.propertyInfo.leftIcon_dis = image
         }
         
-        var lineColor = self.properties.propertyInfo.divederColor_nor
-        if self.properties.state == .normal {
+        var lineColor = properties.propertyInfo.divederColor_nor
+        if properties.state == .normal {
             
-        } else if self.properties.state == .hover {
-            lineColor = self.properties.propertyInfo.divederColor_hov
-        } else if self.properties.state == .pressed {
-            lineColor = self.properties.propertyInfo.divederColor_active
+        } else if properties.state == .hover {
+            lineColor = properties.propertyInfo.divederColor_hov
+        } else if properties.state == .pressed {
+            lineColor = properties.propertyInfo.divederColor_active
         }
-        if self.properties.isDisabled == true {
-            lineColor = self.properties.propertyInfo.divederColor_dis
+        if properties.isDisabled == true {
+            lineColor = properties.propertyInfo.divederColor_dis
         }
         
         if let color = lineColor {
-            self.splitCenterDivider.properties.propertyInfo.borderColor_nor = color
-            self.splitCenterDivider.display()
+            splitCenterDivider.properties.propertyInfo.borderColor_nor = color
+            splitCenterDivider.display()
         }
         
-        self.contendBox.fillColor = self.splitLeftButton.contendBox.fillColor
-        self.contendBox.cornerRadius = self.splitLeftButton.contendBox.cornerRadius
+        contendBox.fillColor = splitLeftButton.contendBox.fillColor
+        contendBox.cornerRadius = splitLeftButton.contendBox.cornerRadius
         
-        if self.properties.type == .split_primary ||
-            self.properties.type == .split_graySecondary {
+        if properties.type == .split_primary ||
+            properties.type == .split_graySecondary {
             
         } else {
 
         }
         
-        self.splitLeftButton.refreshUI()
+        splitLeftButton.refreshUI()
     }
     
     public func reloadData() {
@@ -263,27 +263,27 @@ public class ComponentDropdown: ComponentBaseXibView {
     
     //MARK: - Private Method
     func leftButotnAction(_ sender: ComponentButton) {
-        if self.properties.type == .split_primary ||
-            self.properties.type == .split_graySecondary {
-            self.componentDelegate?.componentDropdownDidClicked?(dropdown: self)
+        if properties.type == .split_primary ||
+            properties.type == .split_graySecondary {
+            componentDelegate?.componentDropdownDidClicked?(dropdown: self)
         } else {
-            self.componentDelegate?.componentDropdownDidShowMenuItem?(dropdown: self)
+            componentDelegate?.componentDropdownDidShowMenuItem?(dropdown: self)
         }
     }
     
     func rightButotnAction(_ sender: ComponentButton) {
-        self.componentDelegate?.componentDropdownDidShowMenuItem?(dropdown: self)
+        componentDelegate?.componentDropdownDidShowMenuItem?(dropdown: self)
     }
     
     //MARK: - MouseEvent
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
         
-        if self.properties.isDisabled == false &&
+        if properties.isDisabled == false &&
             properties.state != .pressed {
-            self.properties.state = .hover
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -295,22 +295,22 @@ public class ComponentDropdown: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false &&
+        if properties.isDisabled == false &&
             properties.state != .pressed {
-            self.properties.state = .normal
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         
-//        if self.properties.isDisabled == false {
-//            self.properties.state = .pressed
+//        if properties.isDisabled == false {
+//            properties.state = .pressed
 //        }
 //        
-//        self.refreshUI()
+//        refreshUI()
         
     }
     

+ 109 - 111
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentInput/ComponentInput.swift

@@ -46,40 +46,40 @@ public class ComponentInput: ComponentBaseXibView {
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
         
-        var fillColor: NSColor = self.properties.propertyInfo.color_nor
-        var borderColor: NSColor = self.properties.propertyInfo.borderColor_nor
+        var fillColor: NSColor = properties.propertyInfo.color_nor
+        var borderColor: NSColor = properties.propertyInfo.borderColor_nor
         
         if properties.creatable {
-            if self.properties.state == .normal {
-                fillColor = self.properties.propertyInfo.color_nor
-                borderColor = self.properties.propertyInfo.borderColor_nor
+            if properties.state == .normal {
+                fillColor = properties.propertyInfo.color_nor
+                borderColor = properties.propertyInfo.borderColor_nor
                 
-            } else if self.properties.state == .hover {
-                fillColor = self.properties.propertyInfo.color_hov
-                if self.properties.isError == true {
-                    fillColor = self.properties.propertyInfo.color_error_hov
+            } else if properties.state == .hover {
+                fillColor = properties.propertyInfo.color_hov
+                if properties.isError == true {
+                    fillColor = properties.propertyInfo.color_error_hov
                 }
-                borderColor = self.properties.propertyInfo.borderColor_hov
+                borderColor = properties.propertyInfo.borderColor_hov
                 
-            } else if self.properties.state == .pressed {
-                fillColor = self.properties.propertyInfo.color_active
-                borderColor = self.properties.propertyInfo.borderColor_active
+            } else if properties.state == .pressed {
+                fillColor = properties.propertyInfo.color_active
+                borderColor = properties.propertyInfo.borderColor_active
             }
         }
         
-        if self.properties.isDisabled == true {
-            fillColor = self.properties.propertyInfo.color_dis
-            borderColor = self.properties.propertyInfo.borderColor_dis
+        if properties.isDisabled == true {
+            fillColor = properties.propertyInfo.color_dis
+            borderColor = properties.propertyInfo.borderColor_dis
         }
         
-        if self.properties.isError == true {
-            borderColor = self.properties.propertyInfo.borderColor_error
+        if properties.isError == true {
+            borderColor = properties.propertyInfo.borderColor_error
         }
         
-        let cornerRadius_topLeft: CGFloat = self.properties.propertyInfo.cornerRadius_topLeft
-        let cornerRadius_topRight: CGFloat = self.properties.propertyInfo.cornerRadius_topRight
-        let cornerRadius_bottomLeft: CGFloat = self.properties.propertyInfo.cornerRadius_bottomLeft
-        let cornerRadius_bottomRight: CGFloat = self.properties.propertyInfo.cornerRadius_bottomRight
+        let cornerRadius_topLeft: CGFloat = properties.propertyInfo.cornerRadius_topLeft
+        let cornerRadius_topRight: CGFloat = properties.propertyInfo.cornerRadius_topRight
+        let cornerRadius_bottomLeft: CGFloat = properties.propertyInfo.cornerRadius_bottomLeft
+        let cornerRadius_bottomRight: CGFloat = properties.propertyInfo.cornerRadius_bottomRight
 
         let path = NSBezierPath()
         path.lineWidth = properties.propertyInfo.borderWidth + 1
@@ -133,8 +133,8 @@ public class ComponentInput: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
   
-        self.inputField.componentDelegate = self
-        self.inputField.focusRingType = .none
+        inputField.componentDelegate = self
+        inputField.focusRingType = .none
         
         NotificationCenter.default.addObserver(self, selector: #selector(textFieldDidBeginEditingNotification(_:)), name: NSControl.textDidBeginEditingNotification, object: inputField)
         NotificationCenter.default.addObserver(self, selector: #selector(textFieldDidChangeNotification(_:)), name: NSControl.textDidChangeNotification, object: inputField)
@@ -154,179 +154,178 @@ public class ComponentInput: ComponentBaseXibView {
             
             ComponentLibrary.shared.configInputComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
     
     func setupUI() {
-        if self.properties.isError == true {
-            self.contendBoxBottomConst.constant = 18
+        if properties.isError == true {
+            contendBoxBottomConst.constant = 18
         } else {
-            self.contendBoxBottomConst.constant = 0
+            contendBoxBottomConst.constant = 0
         }
         
-        if self.properties.showPrefix == true {
-            self.leftIconImg.isHidden = false
-            self.fieldLeftConst.constant = 32
+        if properties.showPrefix == true {
+            leftIconImg.isHidden = false
+            fieldLeftConst.constant = 32
         } else {
-            self.leftIconImg.isHidden = true
-            self.fieldLeftConst.constant = properties.propertyInfo.layout_paddingLeft
+            leftIconImg.isHidden = true
+            fieldLeftConst.constant = properties.propertyInfo.layout_paddingLeft
         }
         
-        if self.properties.showSuffix == true {
-            self.rightIconImg.isHidden = false
-            self.rightImgRightConst.constant = properties.propertyInfo.layout_paddingRight
+        if properties.showSuffix == true {
+            rightIconImg.isHidden = false
+            rightImgRightConst.constant = properties.propertyInfo.layout_paddingRight
         } else {
-            self.rightIconImg.isHidden = true
-            self.fieldRightConst.constant = properties.propertyInfo.layout_paddingRight
+            rightIconImg.isHidden = true
+            fieldRightConst.constant = properties.propertyInfo.layout_paddingRight
         }
         
-        self.rightIconImg.isHidden = true
-        
-        if self.properties.showClear == true && self.properties.showSuffix == true {
-            self.rightIconImg.isHidden = false
-            self.rightImgRightConst.constant = 32
-            self.fieldRightConst.constant = 56
-        } else if self.properties.showClear == true {
-            self.fieldRightConst.constant = 32
-        } else if self.properties.showSuffix == true {
-            self.rightIconImg.isHidden = false
-            self.fieldRightConst.constant = 32
+        rightIconImg.isHidden = true
+        
+        if properties.showClear == true && properties.showSuffix == true {
+            rightIconImg.isHidden = false
+            rightImgRightConst.constant = 32
+            fieldRightConst.constant = 56
+        } else if properties.showClear == true {
+            fieldRightConst.constant = 32
+        } else if properties.showSuffix == true {
+            rightIconImg.isHidden = false
+            fieldRightConst.constant = 32
         } else {
-            self.fieldRightConst.constant = properties.propertyInfo.layout_paddingRight
+            fieldRightConst.constant = properties.propertyInfo.layout_paddingRight
         }
         
-        self.errorTipLabel.isHidden = self.properties.isError == false
+        errorTipLabel.isHidden = properties.isError == false
         
-        self.inputField.alignment = self.properties.alignment
-        self.inputField.stringValue = self.properties.text
-        self.inputField.placeholderString = self.properties.placeholder
+        inputField.alignment = properties.alignment
+        inputField.stringValue = properties.text
+        inputField.placeholderString = properties.placeholder
          
-        if self.properties.isDisabled == false && properties.creatable == true {
-            self.inputField.isEditable = true
+        if properties.isDisabled == false && properties.creatable == true {
+            inputField.isEditable = true
         } else {
-            self.inputField.isEditable = false
+            inputField.isEditable = false
         }
         
-        self.updateClearButtonState()
+        updateClearButtonState()
         
     }
     
     func refreshUI() {
         
-        self.contendBox.cornerRadius = 0
-        self.contendBox.borderWidth = 0
+        contendBox.cornerRadius = 0
+        contendBox.borderWidth = 0
         
-        var textColor: NSColor? = self.properties.propertyInfo.textColor
+        var textColor: NSColor? = properties.propertyInfo.textColor
  
-        if self.properties.isDisabled == true {
-            textColor = self.properties.propertyInfo.textColor_dis
+        if properties.isDisabled == true {
+            textColor = properties.propertyInfo.textColor_dis
         }
         
-        self.inputField.font = self.properties.propertyInfo.textFont
+        inputField.font = properties.propertyInfo.textFont
         
         if let color = textColor {
-            self.inputField.textColor = color
+            inputField.textColor = color
         }
         
-        self.errorTipLabel.textColor = self.properties.propertyInfo.errorTextColor
-        self.errorTipLabel.font = self.properties.propertyInfo.errorTextFont
+        errorTipLabel.textColor = properties.propertyInfo.errorTextColor
+        errorTipLabel.font = properties.propertyInfo.errorTextFont
         
-        self.updateClearButtonState()
+        updateClearButtonState()
         
-        self.display()
+        display()
         
     }
     
     public func reloadData() {
         
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
     }
     
     private func updateClearButtonState() {
-        if self.properties.showClear == true &&
-            self.inputField.stringValue.count > 0 &&
-            self.inputField.isResponder == true {
-            if self.properties.isDisabled == true {
-                self.clearButton.isHidden = true
+        if properties.showClear == true &&
+            inputField.stringValue.count > 0 &&
+            inputField.isResponder == true {
+            if properties.isDisabled == true {
+                clearButton.isHidden = true
             } else {
-                self.clearButton.isHidden = false
+                clearButton.isHidden = false
             }
         } else {
-            self.clearButton.isHidden = true
+            clearButton.isHidden = true
         }
-        self.clearButton.isEnabled = self.properties.isDisabled == false
+        clearButton.isEnabled = properties.isDisabled == false
     }
     
     @IBAction func clearAction(_ sender: Any) {
-        self.inputField.stringValue = ""
+        inputField.stringValue = ""
         
     }
     
     //MARK: - TextNotification
     @objc func textFieldDidBeginEditingNotification(_ notification: Notification) {
  
-        self.updateClearButtonState()
+        updateClearButtonState()
          
     }
     
     @objc func textFieldDidChangeNotification(_ notification: Notification) {
  
-        self.updateClearButtonState()
+        updateClearButtonState()
         
-        self.properties.text = self.inputField.stringValue
+        properties.text = inputField.stringValue
         
-        self.delegate?.componentInputDidChanged?(inputView: self)
+        delegate?.componentInputDidChanged?(inputView: self)
         
     }
     
     @objc func textFieldDidEndEditingNotification(_ notification: Notification) {
 
-        self.inputField.isResponder = false
-        if self.properties.isDisabled == false {
-            self.properties.state = .normal
+        inputField.isResponder = false
+        if properties.isDisabled == false {
+            properties.state = .normal
         }
         
-        self.properties.text = self.inputField.stringValue
+        properties.text = inputField.stringValue
         
-        self.refreshUI()
+        refreshUI()
         
-        self.updateClearButtonState()
+        updateClearButtonState()
         
-        self.delegate?.componentInputDidEndEditing?(inputView: self)
+        delegate?.componentInputDidEndEditing?(inputView: self)
     }
     
     //MARK: - MouseEvent
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties.isDisabled == false &&
-            self.inputField.isResponder == false{
-            self.properties.state = .hover
+        if properties.isDisabled == false &&
+            inputField.isResponder == false{
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
         super.mouseMoved(with: event)
         
-        
     }
      
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false &&
-            self.inputField.isResponder == false{
-            self.properties.state = .normal
+        if properties.isDisabled == false &&
+            inputField.isResponder == false{
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -337,11 +336,11 @@ public class ComponentInput: ComponentBaseXibView {
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
-        if self.properties.isDisabled == false &&
-            self.inputField.isResponder == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false &&
+            inputField.isResponder == false {
+            properties.state = .normal
         }
-        self.refreshUI()
+        refreshUI()
         
     }
 }
@@ -350,15 +349,14 @@ public class ComponentInput: ComponentBaseXibView {
 extension ComponentInput: ComponentTextFieldDelegate {
     
     func componentTextFieldDidResponderChanged(textField: NSTextField) {
-        if self.properties.isDisabled == false {
-            if self.inputField.isResponder {
-                self.properties.state = .pressed
+        if properties.isDisabled == false {
+            if inputField.isResponder {
+                properties.state = .pressed
             } else {
-                self.properties.state = .normal
+                properties.state = .normal
             }
         }
-        self.refreshUI()
-        
+        refreshUI()
         
     }
 }

+ 1 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Input/ComponentInput/ComponentInput.xib

@@ -45,7 +45,7 @@
                                 <constraints>
                                     <constraint firstAttribute="height" constant="20" id="xJd-f5-u53"/>
                                 </constraints>
-                                <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" placeholderString="Please enter..." id="Sqz-KL-xRq">
+                                <textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" placeholderString="Please enter..." id="Sqz-KL-xRq">
                                     <font key="font" metaFont="system"/>
                                     <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>

+ 19 - 30
PDF Office/KMComponentLibrary/KMComponentLibrary/View/List/ComponentListBasicItem.swift

@@ -17,7 +17,6 @@ public class ComponentListBasicItem: ComponentBaseXibView {
     @IBOutlet var inputField: NSTextField!
     @IBOutlet var inputLabel: NSTextField!
     
-    
     @IBOutlet var leftIconLeftConst: NSLayoutConstraint!
     @IBOutlet var fieldLeftConst: NSLayoutConstraint!
     @IBOutlet var fieldRightConst: NSLayoutConstraint!
@@ -28,12 +27,9 @@ public class ComponentListBasicItem: ComponentBaseXibView {
     
     private var _shadowInfo : ComponentShadowInfo?
     
-    
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
 
-        
-        
     }
     
     // MARK: 初始化
@@ -67,7 +63,6 @@ public class ComponentListBasicItem: ComponentBaseXibView {
     
     //MARK: - Setter and Getter
     
-    
     public var properties : ComponentListBasicItemProperty {
         get {
            return _properties
@@ -77,17 +72,15 @@ public class ComponentListBasicItem: ComponentBaseXibView {
             
             ComponentLibrary.shared.configListBasicItemComponent(properties: _properties)
              
-            self.setupUI()
+            setupUI()
              
-            self.refreshUI()
+            refreshUI()
         }
     }
-     
     
     //MARK: - SetupUI
     func setupUI() {
         
-        
         inputField.stringValue = properties.text
         inputLabel.stringValue = properties.text
         
@@ -115,7 +108,7 @@ public class ComponentListBasicItem: ComponentBaseXibView {
         }
         contendBox.fillColor = fillColor
         
-        if self.inputField.isHidden == false {
+        if inputField.isHidden == false {
             contendBox.borderWidth = properties.propertyInfo.borderWidth_editing
             contendBox.borderColor = properties.propertyInfo.borderColor_editing
             contendBox.fillColor = properties.propertyInfo.color_editing
@@ -163,17 +156,17 @@ public class ComponentListBasicItem: ComponentBaseXibView {
             fieldMaxXValue += 24
         }
         
-        self.leftIconLeftConst.constant = leftIconXValue
-        self.fieldLeftConst.constant = fieldXValue
-        self.fieldRightConst.constant = fieldMaxXValue
+        leftIconLeftConst.constant = leftIconXValue
+        fieldLeftConst.constant = fieldXValue
+        fieldRightConst.constant = fieldMaxXValue
         
     }
     
     //MARK: - Public Method
     public func reloadData() {
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
         
     }
     
@@ -193,7 +186,7 @@ public class ComponentListBasicItem: ComponentBaseXibView {
         if inputField.stringValue.isEmpty == false {
             properties.text = inputField.stringValue
         }
-        self.reloadData()
+        reloadData()
     }
     
     //MARK: - MouseEvent
@@ -204,7 +197,7 @@ public class ComponentListBasicItem: ComponentBaseXibView {
             properties.state = .hover
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -220,7 +213,7 @@ public class ComponentListBasicItem: ComponentBaseXibView {
             properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -232,8 +225,7 @@ public class ComponentListBasicItem: ComponentBaseXibView {
             properties.state = .hover
         }
         
-        self.refreshUI()
-        
+        refreshUI()
         
     }
     
@@ -241,14 +233,14 @@ public class ComponentListBasicItem: ComponentBaseXibView {
         super.mouseUp(with: event)
         
         if properties.isDisable == false {
-            let point = self.convert(event.locationInWindow, from: nil)
-            if CGRectContainsPoint(self.inputField.frame, point) ||
-                CGRectContainsPoint(self.inputLabel.frame, point) {
+            let point = convert(event.locationInWindow, from: nil)
+            if CGRectContainsPoint(inputField.frame, point) ||
+                CGRectContainsPoint(inputLabel.frame, point) {
                 if event.clickCount == 2 {
-                    self.inputField.isHidden = false
-                    self.inputLabel.isHidden = true
+                    inputField.isHidden = false
+                    inputLabel.isHidden = true
                     
-                    self.inputField.becomeFirstResponder()
+                    inputField.becomeFirstResponder()
                     DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
                         self.inputField.currentEditor()?.selectedRange = NSMakeRange(self.inputField.stringValue.count, 0)
                         
@@ -256,13 +248,10 @@ public class ComponentListBasicItem: ComponentBaseXibView {
                     }
                 }
             } else {
-                self.window?.makeFirstResponder(nil)
+                window?.makeFirstResponder(nil)
             }
         }
         
-//        if let target = target, let action = action {
-//            _ = target.perform(action, with: self)
-//        }
     }
     
 }

+ 2 - 2
PDF Office/KMComponentLibrary/KMComponentLibrary/View/MenuItem/ComponentMenuItem.swift

@@ -61,9 +61,9 @@ public class ComponentMenuItem: ComponentBaseXibView {
     @objc func propertyUpdatedNoti(_ notification: Notification) {
         
         if let objectID = notification.object as? String, objectID == properties.identifier {
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     

+ 32 - 32
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Message/ComponentMessage.swift

@@ -43,7 +43,7 @@ public class ComponentMessage: ComponentBaseXibView {
         super.awakeFromNib()
         
         let progressProperty = ComponentProgressProperty(size: .m, progressType: .circle, subType: .circle_ProgressPercent, progress: 0)
-        self.progressItem.properties = progressProperty
+        progressItem.properties = progressProperty
         
     }
     
@@ -56,46 +56,46 @@ public class ComponentMessage: ComponentBaseXibView {
             
             ComponentLibrary.shared.configMessageComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
      
     //MARK: - SetupUI
     func setupUI() {
         
-        self.contendBox.fillColor = properties.propertyInfo.color_nor
+        contendBox.fillColor = properties.propertyInfo.color_nor
         
-        self.contendBox.cornerRadius = self.properties.propertyInfo.cornerRadius
+        contendBox.cornerRadius = properties.propertyInfo.cornerRadius
         
-        self.titleLabel.stringValue = self.properties.title ?? ""
-        self.titleLabel.textColor = properties.propertyInfo.textColor
+        titleLabel.stringValue = properties.title ?? ""
+        titleLabel.textColor = properties.propertyInfo.textColor
         
-        self.titleLabel.font = self.properties.propertyInfo.textFont
+        titleLabel.font = properties.propertyInfo.textFont
         
-        self.iconImage.isHidden = true
-        self.progressItem.isHidden = true
+        iconImage.isHidden = true
+        progressItem.isHidden = true
         
-        switch self.properties.messageType {
+        switch properties.messageType {
         case .info:
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "message_Info")
-            self.iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "message_Info")
+            iconImage.isHidden = false
             
             break
         case .success:
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "message_success")
-            self.iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "message_success")
+            iconImage.isHidden = false
             
             break
         case .warning:
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "message_warning")
-            self.iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "message_warning")
+            iconImage.isHidden = false
             
             break
         case .error:
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "message_error")
-            self.iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "message_error")
+            iconImage.isHidden = false
             
             break
         case .normal_custom:
@@ -103,7 +103,7 @@ public class ComponentMessage: ComponentBaseXibView {
             
             break
         case .loading:
-            self.progressItem.isHidden = false
+            progressItem.isHidden = false
             
             break
             
@@ -111,21 +111,21 @@ public class ComponentMessage: ComponentBaseXibView {
     }
     
     func refreshUI() {
-        self.titleLabel.sizeToFit()
+        titleLabel.sizeToFit()
         
-        let layoutGap = self.properties.propertyInfo.layout_gap
+        let layoutGap = properties.propertyInfo.layout_gap
         var viewWidth: CGFloat = 0
-        viewWidth += self.titleLabel.frame.size.width
-        viewWidth += self.properties.propertyInfo.layout_paddingLeft
-        viewWidth += self.properties.propertyInfo.layout_paddingRight
+        viewWidth += titleLabel.frame.size.width
+        viewWidth += properties.propertyInfo.layout_paddingLeft
+        viewWidth += properties.propertyInfo.layout_paddingRight
         
-        if self.iconImage.isHidden == false ||
-            self.progressItem.isHidden == false {
+        if iconImage.isHidden == false ||
+            progressItem.isHidden == false {
             viewWidth += 20
             viewWidth += layoutGap
         }
-        self.properties.propertyInfo.viewWidth = viewWidth
-        self.properties.propertyInfo.viewHeight = 40
+        properties.propertyInfo.viewWidth = viewWidth
+        properties.propertyInfo.viewHeight = 40
         
         DispatchQueue.main.async {
             if self.iconImage.isHidden == false {
@@ -158,13 +158,13 @@ public class ComponentMessage: ComponentBaseXibView {
             }
         }
         
-        self.iconImage.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
-        self.titleLabel.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
+        iconImage.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
+        titleLabel.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
          
     }
     
     public func reloadData() {
-        self.refreshUI()
+        refreshUI()
         
     }
     

+ 26 - 26
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Navigation/ComponentNavBarItem.swift

@@ -59,9 +59,9 @@ public class ComponentNavBarItem: ComponentBaseXibView {
             
             ComponentLibrary.shared.configNavbarItemComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
              
-            self.refreshUI()
+            refreshUI()
         }
     }
      
@@ -69,15 +69,15 @@ public class ComponentNavBarItem: ComponentBaseXibView {
     //MARK: - SetupUI
     func setupUI() {
         
-        self.iconImage.isHidden = true
-        self.labelLeftConst.constant = 8
-        if self.properties.iconImage != nil {
-            self.iconImage.isHidden = false
-            self.labelLeftConst.constant = 36
+        iconImage.isHidden = true
+        labelLeftConst.constant = 8
+        if properties.iconImage != nil {
+            iconImage.isHidden = false
+            labelLeftConst.constant = 36
         }
         
-        self.titleLabel.stringValue = self.properties.text ?? ""
-        self.titleLabel.font = self.properties.propertyInfo.textFont
+        titleLabel.stringValue = properties.text ?? ""
+        titleLabel.font = properties.propertyInfo.textFont
         
     }
     
@@ -94,28 +94,28 @@ public class ComponentNavBarItem: ComponentBaseXibView {
         
         var fillColor: NSColor?
         
-        if self.properties.state == .normal {
-            fillColor = self.properties.propertyInfo.color_nor
-        } else if self.properties.state == .hover {
-            fillColor = self.properties.propertyInfo.color_hov
-        } else if self.properties.state == .pressed {
-            fillColor = self.properties.propertyInfo.color_active
+        if properties.state == .normal {
+            fillColor = properties.propertyInfo.color_nor
+        } else if properties.state == .hover {
+            fillColor = properties.propertyInfo.color_hov
+        } else if properties.state == .pressed {
+            fillColor = properties.propertyInfo.color_active
         }
         
         if let color = fillColor {
-            self.contendBox.fillColor = color
+            contendBox.fillColor = color
         }
-        self.contendBox.cornerRadius = self.properties.propertyInfo.cornerRadius
-        self.contendBox.borderWidth = self.properties.propertyInfo.borderWidth
+        contendBox.cornerRadius = properties.propertyInfo.cornerRadius
+        contendBox.borderWidth = properties.propertyInfo.borderWidth
         
         
     }
     
     //MARK: - Public Method
     public func reloadData() {
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
         
     }
     
@@ -129,10 +129,10 @@ public class ComponentNavBarItem: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
         
-        if self.properties.state != .pressed {
-            self.properties.state = .hover
+        if properties.state != .pressed {
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -151,15 +151,15 @@ public class ComponentNavBarItem: ComponentBaseXibView {
             properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         
-        self.properties.state = .pressed
+        properties.state = .pressed
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseUp(with event: NSEvent) {

+ 18 - 18
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Pagination/ComponentPagination.swift

@@ -69,7 +69,7 @@ public class ComponentPagination: ComponentBaseXibView {
         formatter.controlSize = true
         inputView.inputField.formatter = formatter
         inputView.delegate = self
-        inputView.properties = self.inputProperty
+        inputView.properties = inputProperty
           
         arrowLeftItem.setTarget(self, action: #selector(buttonClicked(_ :)))
         arrowRightItem.setTarget(self, action: #selector(buttonClicked(_ :)))
@@ -89,17 +89,17 @@ public class ComponentPagination: ComponentBaseXibView {
             
             ComponentLibrary.shared.configPaginationComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
      
     
     //MARK: - SetupUI
     func setupUI() {
-        self.contendBox.borderColor = NSColor.clear
-        self.contendBox.fillColor = NSColor.clear
+        contendBox.borderColor = NSColor.clear
+        contendBox.fillColor = NSColor.clear
         
         if properties.doubleArrow_show == true {
             doubleLeftItem.isHidden = false
@@ -109,7 +109,7 @@ public class ComponentPagination: ComponentBaseXibView {
             doubleRightItem.isHidden = true
         }
         
-        totalIndexField.stringValue = String(format: "%d", self.properties.totalCount)
+        totalIndexField.stringValue = String(format: "%d", properties.totalCount)
          
         formatter.minSize = 1
         formatter.maxSize = properties.totalCount
@@ -124,9 +124,9 @@ public class ComponentPagination: ComponentBaseXibView {
     
     func refreshUI() {
         
-        self.totalIndexField.textColor = self.properties.propertyInfo.textColor
+        totalIndexField.textColor = properties.propertyInfo.textColor
          
-        inputProperty.text = String(self.properties.currentIndex)
+        inputProperty.text = String(properties.currentIndex)
         inputView.reloadData()
         
         arrowLeftProperty.isDisabled = properties.currentIndex == 1
@@ -158,23 +158,23 @@ public class ComponentPagination: ComponentBaseXibView {
         }
         properties.currentIndex = curIndex
         
-        self.window?.makeFirstResponder(nil)
+        window?.makeFirstResponder(nil)
         
-        self.refreshUI()
+        refreshUI()
         
-        self.actionFinish()
+        actionFinish()
     }
     
     private func actionFinish() {
-        self.delegate?.componentPaginationDidValueChanged?(pagination: self)
+        delegate?.componentPaginationDidValueChanged?(pagination: self)
     }
     
     
     //MARK: - Public Method
     public func reloadData() {
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
     }
     
     
@@ -182,7 +182,7 @@ public class ComponentPagination: ComponentBaseXibView {
     public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
         
-//        self.window?.makeFirstResponder(nil)
+//        window?.makeFirstResponder(nil)
     }
     
     public override func mouseUp(with event: NSEvent) {
@@ -203,11 +203,11 @@ extension ComponentPagination: ComponentInputDelegate {
             
             properties.currentIndex = Int(curString) ?? curIndex
             
-            self.refreshUI()
+            refreshUI()
             
-            self.actionFinish()
+            actionFinish()
         } else {
-            self.refreshUI()
+            refreshUI()
         }
     }
 }

+ 27 - 27
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Pagination/ComponentPaginationItem.swift

@@ -55,7 +55,7 @@ public class ComponentPaginationItem: ComponentBaseXibView {
             
             ComponentLibrary.shared.configPaginationItemComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
         }
     }
      
@@ -63,67 +63,67 @@ public class ComponentPaginationItem: ComponentBaseXibView {
     //MARK: - SetupUI
     func setupUI() {
        
-        self.contendBox.borderWidth = 0
-        self.contendBox.cornerRadius = 0
-        self.contendBox.borderColor = NSColor.clear
-        self.contendBox.fillColor = NSColor.clear
+        contendBox.borderWidth = 0
+        contendBox.cornerRadius = 0
+        contendBox.borderColor = NSColor.clear
+        contendBox.fillColor = NSColor.clear
         
         var iconImage_nor: NSImage?
         var iconImage_hov: NSImage?
         var iconImage_dis: NSImage?
         
-        if self.properties.type == .arrowLeft {
+        if properties.type == .arrowLeft {
             iconImage_nor = ComponentLibrary.shared.image(forResource: "arrow_left_nor")
             iconImage_hov = ComponentLibrary.shared.image(forResource: "arrow_left_hov")
             iconImage_dis = ComponentLibrary.shared.image(forResource: "arrow_left_dis")
-        } else if self.properties.type == .arrowRight {
+        } else if properties.type == .arrowRight {
             iconImage_nor = ComponentLibrary.shared.image(forResource: "arrow_right_nor")
             iconImage_hov = ComponentLibrary.shared.image(forResource: "arrow_right_hov")
             iconImage_dis = ComponentLibrary.shared.image(forResource: "arrow_right_dis")
-        } else if self.properties.type == .doubleArrowLeft {
+        } else if properties.type == .doubleArrowLeft {
             iconImage_nor = ComponentLibrary.shared.image(forResource: "dbArrow_left_nor")
             iconImage_hov = ComponentLibrary.shared.image(forResource: "dbArrow_left_hov")
             iconImage_dis = ComponentLibrary.shared.image(forResource: "dbArrow_left_dis")
-        } else if self.properties.type == .doubleArrowRight {
+        } else if properties.type == .doubleArrowRight {
             iconImage_nor = ComponentLibrary.shared.image(forResource: "dbArrow_right_nor")
             iconImage_hov = ComponentLibrary.shared.image(forResource: "dbArrow_right_hov")
             iconImage_dis = ComponentLibrary.shared.image(forResource: "dbArrow_right_dis")
-        } else if self.properties.type == .more {
+        } else if properties.type == .more {
             iconImage_nor = ComponentLibrary.shared.image(forResource: "typemore_nor")
             iconImage_hov = ComponentLibrary.shared.image(forResource: "typemore_hov")
             iconImage_dis = ComponentLibrary.shared.image(forResource: "typemore_dis")
         }
         
-        if let image = self.properties.iconImage_nor {
+        if let image = properties.iconImage_nor {
             iconImage_nor = image
             iconImage_hov = image
             iconImage_dis = image
         }
-        if let image = self.properties.iconImage_hov {
+        if let image = properties.iconImage_hov {
             iconImage_hov = image
         }
-        if let image = self.properties.iconImage_dis {
+        if let image = properties.iconImage_dis {
             iconImage_dis = image
         }
        
-        if self.properties.state == .normal {
+        if properties.state == .normal {
             if let image = iconImage_nor {
-                self.iconImage.image = image
+                iconImage.image = image
             }
-        } else if self.properties.state == .hover {
+        } else if properties.state == .hover {
             if let image = iconImage_hov {
-                self.iconImage.image = image
+                iconImage.image = image
             }
         }
-        if self.properties.isDisabled == true {
+        if properties.isDisabled == true {
             if let image = iconImage_dis {
-                self.iconImage.image = image
+                iconImage.image = image
             }
         }
     }
     //MARK: - Public Method
     public func reloadData() {
-        self.setupUI()
+        setupUI()
         
     }
     
@@ -136,10 +136,10 @@ public class ComponentPaginationItem: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties.isDisabled == false {
-            self.properties.state = .hover
+        if properties.isDisabled == false {
+            properties.state = .hover
         }
-        self.setupUI()
+        setupUI()
         
     }
     
@@ -151,11 +151,11 @@ public class ComponentPaginationItem: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false {
+            properties.state = .normal
         }
         
-        self.setupUI()
+        setupUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -165,7 +165,7 @@ public class ComponentPaginationItem: ComponentBaseXibView {
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
-        if self.properties.isDisabled == false {
+        if properties.isDisabled == false {
             if let target = target, let action = action {
                 _ = target.perform(action, with: self)
             }

+ 28 - 29
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressCircle.swift

@@ -19,31 +19,31 @@ public class ComponentProgressCircle: ComponentBaseXibView {
     public override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
         
-        if self.properties.progressSubType == .circle_ProgressPercent ||
-            self.properties.progressSubType == .circle_ErrorPercent {
+        if properties.progressSubType == .circle_ProgressPercent ||
+            properties.progressSubType == .circle_ErrorPercent {
             
             let radius = min(bounds.width, bounds.height) / 2
             let center = CGPoint(x: bounds.midX, y: bounds.midY)
             
             let path = NSBezierPath()
             path.appendArc(withCenter: center, radius: radius-2, startAngle: 90, endAngle: -360, clockwise: true)
-            if let color = self.properties.propertyInfo.progressBaseColor {
+            if let color = properties.propertyInfo.progressBaseColor {
                 color.setStroke()
             }
-            path.lineWidth = self.properties.propertyInfo.progressBorderWidth ?? 2
+            path.lineWidth = properties.propertyInfo.progressBorderWidth ?? 2
             path.stroke()
             
             // 计算进度的起始和结束角度
-            let progress = self.properties.progress
+            let progress = properties.progress
             let startAngle = 90.0 // 12点钟位置
             let endAngle = -360.0 * progress + startAngle
             
             let progressPath = NSBezierPath()
             progressPath.appendArc(withCenter: center, radius: radius-2, startAngle: startAngle, endAngle: endAngle, clockwise: true)
-            if let color = self.properties.propertyInfo.progressTipColor {
+            if let color = properties.propertyInfo.progressTipColor {
                 color.setStroke()
             }
-            progressPath.lineWidth = self.properties.propertyInfo.progressBorderWidth ?? 0
+            progressPath.lineWidth = properties.propertyInfo.progressBorderWidth ?? 0
             progressPath.stroke()
             
         }
@@ -80,43 +80,42 @@ public class ComponentProgressCircle: ComponentBaseXibView {
             
             ComponentLibrary.shared.configProgressComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
     //MARK: - SetupUI
     func setupUI() {
-        self.iconImage.isHidden = true
-        self.indicator.stopAnimation(nil)
-        self.indicator.isHidden = true
+        iconImage.isHidden = true
+        indicator.stopAnimation(nil)
+        indicator.isHidden = true
         
-        if self.properties.progressSubType == .circle_Waiting {
-            self.iconImage.isHidden = false
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_waiting")
+        if properties.progressSubType == .circle_Waiting {
+            iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_waiting")
             
-        } else if self.properties.progressSubType == .circle_ProgressPercent {
+        } else if properties.progressSubType == .circle_ProgressPercent {
             
             
-        } else if self.properties.progressSubType == .circle_ErrorPercent {
+        } else if properties.progressSubType == .circle_ErrorPercent {
             
             
-        } else if self.properties.progressSubType == .circle_ProgressNoPercent {
-            self.indicator.isHidden = false
-            self.indicator.startAnimation(nil)
+        } else if properties.progressSubType == .circle_ProgressNoPercent {
+            indicator.isHidden = false
+            indicator.startAnimation(nil)
             
-        } else if self.properties.progressSubType == .circle_ErrorNoPercent {
-            self.iconImage.isHidden = false
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_error")
+        } else if properties.progressSubType == .circle_ErrorNoPercent {
+            iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_error")
             
-        } else if self.properties.progressSubType == .circle_Success {
-            self.iconImage.isHidden = false
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_success")
+        } else if properties.progressSubType == .circle_Success {
+            iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_success")
             
         }
-        self.display()
-        
+        display()
         
     }
     
@@ -125,7 +124,7 @@ public class ComponentProgressCircle: ComponentBaseXibView {
     }
     
     public func reloadData() {
-        self.setupUI()
+        setupUI()
         
     }
 }

+ 31 - 31
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressLine.swift

@@ -52,58 +52,58 @@ public class ComponentProgressLine: ComponentBaseXibView {
             
             ComponentLibrary.shared.configProgressComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
     //MARK: - SetupUI
     func setupUI() {
-        self.iconImage.isHidden = true
-        self.titleLabel.isHidden = true
+        iconImage.isHidden = true
+        titleLabel.isHidden = true
         
-        if self.properties.progressSubType == .line_Progressing {
-            self.titleLabel.isHidden = false
-            if let color = self.properties.propertyInfo.progressTipColor {
-                self.upBox.fillColor = color
+        if properties.progressSubType == .line_Progressing {
+            titleLabel.isHidden = false
+            if let color = properties.propertyInfo.progressTipColor {
+                upBox.fillColor = color
             }
-            self.titleLabel.stringValue = "100%"
-            self.titleLabel.sizeToFit()
+            titleLabel.stringValue = "100%"
+            titleLabel.sizeToFit()
             
-            self.bottomBox.frame = CGRectMake(0, CGRectGetHeight(self.frame)/2 - 2, CGRectGetWidth(self.frame) - CGRectGetWidth(self.titleLabel.frame) - 8, 4)
-            self.titleLabel.frame = CGRectMake(CGRectGetMaxX(self.bottomBox.frame) + 8, 0, CGRectGetWidth(self.titleLabel.frame), CGRectGetHeight(self.titleLabel.frame))
-        } else if self.properties.progressSubType == .line_Error {
-            self.iconImage.isHidden = false
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_error")
-            if let color = self.properties.propertyInfo.progressTipColor {
-                self.upBox.fillColor = color
+            bottomBox.frame = CGRectMake(0, CGRectGetHeight(frame)/2 - 2, CGRectGetWidth(frame) - CGRectGetWidth(titleLabel.frame) - 8, 4)
+            titleLabel.frame = CGRectMake(CGRectGetMaxX(bottomBox.frame) + 8, 0, CGRectGetWidth(titleLabel.frame), CGRectGetHeight(titleLabel.frame))
+        } else if properties.progressSubType == .line_Error {
+            iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_error")
+            if let color = properties.propertyInfo.progressTipColor {
+                upBox.fillColor = color
             }
-            self.bottomBox.frame = CGRectMake(0, CGRectGetHeight(self.frame)/2 - 2, CGRectGetWidth(self.frame) - 24, 4)
-        } else if self.properties.progressSubType == .line_Success {
-            self.iconImage.isHidden = false
-            self.iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_success")
-            if let color = self.properties.propertyInfo.progressTipColor {
-                self.upBox.fillColor = color
+            bottomBox.frame = CGRectMake(0, CGRectGetHeight(frame)/2 - 2, CGRectGetWidth(frame) - 24, 4)
+        } else if properties.progressSubType == .line_Success {
+            iconImage.isHidden = false
+            iconImage.image = ComponentLibrary.shared.image(forResource: "Progress_success")
+            if let color = properties.propertyInfo.progressTipColor {
+                upBox.fillColor = color
             }
-            self.bottomBox.frame = CGRectMake(0, CGRectGetHeight(self.frame)/2 - 2, CGRectGetWidth(self.frame) - 24, 4)
+            bottomBox.frame = CGRectMake(0, CGRectGetHeight(frame)/2 - 2, CGRectGetWidth(frame) - 24, 4)
         }
         
-        if let color = self.properties.propertyInfo.progressBaseColor {
-            self.bottomBox.fillColor = color
+        if let color = properties.propertyInfo.progressBaseColor {
+            bottomBox.fillColor = color
         }
         
-        self.bottomBox.borderWidth = 0
-        self.upBox.borderWidth = 0
+        bottomBox.borderWidth = 0
+        upBox.borderWidth = 0
         
     }
     
     func refreshUI() {
         
-        if self.properties.progressSubType == .line_Progressing {
-            self.titleLabel.stringValue = String(format: "%.0f%@", properties.progress*100,"%")
+        if properties.progressSubType == .line_Progressing {
+            titleLabel.stringValue = String(format: "%.0f%@", properties.progress*100,"%")
         }
-        self.upBox.frame = CGRectMake(0, 0, CGRectGetWidth(self.bottomBox.frame)*properties.progress, 4)
+        upBox.frame = CGRectMake(0, 0, CGRectGetWidth(bottomBox.frame)*properties.progress, 4)
         
     }
     

+ 13 - 14
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Progress/ComponentProgressPopup.swift

@@ -45,7 +45,7 @@ public class ComponentProgressPopup: ComponentBaseXibView {
                                                                                        progressType: .line,
                                                                                        subType: .line_Progressing,
                                                                                        progress: 0)
-        self.progressLine.properties = lineProperties
+        progressLine.properties = lineProperties
         
         let btnProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_white,
                                                                            size: .xxs,
@@ -57,7 +57,6 @@ public class ComponentProgressPopup: ComponentBaseXibView {
         
     }
     
-    
     public var properties : ComponentProgressProperty {
         get {
            return _properties
@@ -67,37 +66,37 @@ public class ComponentProgressPopup: ComponentBaseXibView {
             
             ComponentLibrary.shared.configProgressComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
     //MARK: - SetupUI
     func setupUI() {
-        self.contendBox.fillColor = self.properties.propertyInfo.color_nor
+        contendBox.fillColor = properties.propertyInfo.color_nor
         
-        self.contendBox.cornerRadius = self.properties.propertyInfo.cornerRadius
-        self.contendBox.borderWidth = self.properties.propertyInfo.borderWidth
+        contendBox.cornerRadius = properties.propertyInfo.cornerRadius
+        contendBox.borderWidth = properties.propertyInfo.borderWidth
         
-        self.titleLabel.textColor = self.properties.propertyInfo.textColor
+        titleLabel.textColor = properties.propertyInfo.textColor
         
-        self.titleLabel.font = self.properties.propertyInfo.textFont
+        titleLabel.font = properties.propertyInfo.textFont
         
-        if let string = self.properties.titleString {
-            self.titleLabel.stringValue = string
+        if let string = properties.titleString {
+            titleLabel.stringValue = string
         }
     }
     
     func refreshUI() {
-        self.progressLine.properties.progress = self.properties.progress 
+        progressLine.properties.progress = properties.progress 
         
-        self.progressLine.reloadData()
+        progressLine.reloadData()
         
     }
     
     public func reloadData() {
-        self.refreshUI()
+        refreshUI()
         
     }
     

+ 41 - 42
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Radio/ComponentRadio.swift

@@ -44,9 +44,8 @@ public class ComponentRadio: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
         
-        self.contendBox.fillColor = .clear
-        self.contendBox.borderWidth = 0
-        
+        contendBox.fillColor = .clear
+        contendBox.borderWidth = 0
         
     }
     
@@ -61,15 +60,15 @@ public class ComponentRadio: ComponentBaseXibView {
              
             ComponentLibrary.shared.configRadioComponent(properties: _properties)
             
-            self.reloadData()
+            reloadData()
         }
     }
     
     public func reloadData() {
         
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
     }
      
     public func setTarget(_ target: AnyObject?, action: Selector?) {
@@ -79,51 +78,51 @@ public class ComponentRadio: ComponentBaseXibView {
      
     func setupUI() {
         
-        if (self.properties.text) != nil {
-            self.titleLabel.stringValue = self.properties.text ?? ""
-            self.titleLabel.textColor = self.properties.propertyInfo.textColor
-            if self.properties.isDisabled == true {
-                self.titleLabel.textColor = self.properties.propertyInfo.textColor_dis
+        if (properties.text) != nil {
+            titleLabel.stringValue = properties.text ?? ""
+            titleLabel.textColor = properties.propertyInfo.textColor
+            if properties.isDisabled == true {
+                titleLabel.textColor = properties.propertyInfo.textColor_dis
             }
-            self.titleLabel.font = self.properties.propertyInfo.textFont
+            titleLabel.font = properties.propertyInfo.textFont
         }
          
-        if self.properties.showhelp == true {
-            self.helpTooltips.isHidden = false
+        if properties.showhelp == true {
+            helpTooltips.isHidden = false
         } else {
-            self.helpTooltips.isHidden = true
+            helpTooltips.isHidden = true
         }
         
-        if (self.properties.text) != nil {
-            self.titleLabel.isHidden = false
+        if (properties.text) != nil {
+            titleLabel.isHidden = false
         } else {
-            self.titleLabel.isHidden = true
+            titleLabel.isHidden = true
         }
          
     }
     
     func refreshUI() {
         var imageName = "radio_default_nor"
-        if self.properties.checkboxType == .normal {
-            if self.properties.state == .normal {
+        if properties.checkboxType == .normal {
+            if properties.state == .normal {
                 imageName = "radio_default_nor"
-            } else if self.properties.state == .hover {
+            } else if properties.state == .hover {
                 imageName = "radio_default_hov"
             }
-            if self.properties.isDisabled == true {
+            if properties.isDisabled == true {
                 imageName = "radio_default_dis"
             }
-        } else if self.properties.checkboxType == .selected {
-            if self.properties.state == .normal {
+        } else if properties.checkboxType == .selected {
+            if properties.state == .normal {
                 imageName = "radio_sel_nor"
-            } else if self.properties.state == .hover {
+            } else if properties.state == .hover {
                 imageName = "radio_sel_hov"
             }
-            if self.properties.isDisabled == true {
+            if properties.isDisabled == true {
                 imageName = "radio_sel_dis"
             }
         }
-        self.checkboxImage.image = ComponentLibrary.shared.image(forResource: imageName)
+        checkboxImage.image = ComponentLibrary.shared.image(forResource: imageName)
         
     }
     
@@ -132,10 +131,10 @@ public class ComponentRadio: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties.isDisabled == false {
-            self.properties.state = .hover
+        if properties.isDisabled == false {
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -146,11 +145,11 @@ public class ComponentRadio: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false {
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -163,22 +162,22 @@ public class ComponentRadio: ComponentBaseXibView {
         
         var eventContinue = true
         let point = convert(event.locationInWindow, from: nil)
-        if self.helpTooltips.isHidden == false {
-            if CGRectContainsPoint(self.helpTooltips.frame, point) {
+        if helpTooltips.isHidden == false {
+            if CGRectContainsPoint(helpTooltips.frame, point) {
                 eventContinue = false
             }
         }
         
-        if self.properties.isDisabled == false && eventContinue == true {
-            if self.properties.isDisabled == false {
-                self.properties.state = .normal
+        if properties.isDisabled == false && eventContinue == true {
+            if properties.isDisabled == false {
+                properties.state = .normal
             }
-            if self.properties.checkboxType != .selected {
-                self.properties.checkboxType = .selected
+            if properties.checkboxType != .selected {
+                properties.checkboxType = .selected
             } else {
-                self.properties.checkboxType = .normal
+                properties.checkboxType = .normal
             }
-            self.refreshUI()
+            refreshUI()
             
             if let target = target, let action = action {
                 _ = target.perform(action, with: self)

+ 99 - 98
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Select/ComponentSelect.swift

@@ -57,14 +57,13 @@ public class ComponentSelect: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
        
-        self.inputField.componentDelegate = self
-        self.inputField.focusRingType = .none
+        inputField.componentDelegate = self
+        inputField.focusRingType = .none
         
         NotificationCenter.default.addObserver(self, selector: #selector(textFieldDidBeginEditingNotification(_:)), name: NSControl.textDidBeginEditingNotification, object: inputField)
         NotificationCenter.default.addObserver(self, selector: #selector(textFieldDidChangeNotification(_:)), name: NSControl.textDidChangeNotification, object: inputField)
         NotificationCenter.default.addObserver(self, selector: #selector(textFieldDidEndEditingNotification(_:)), name: NSControl.textDidEndEditingNotification, object: inputField)
         
-        
     }
     
     //Setter
@@ -77,9 +76,9 @@ public class ComponentSelect: ComponentBaseXibView {
             
             ComponentLibrary.shared.configSelectComponent(properties: _properties)
             
-            self.reloadData()
+            reloadData()
             
-            self.window?.makeFirstResponder(nil)
+            window?.makeFirstResponder(nil)
             
         }
     }
@@ -87,13 +86,13 @@ public class ComponentSelect: ComponentBaseXibView {
     //MARK: - Public
     public func reloadData() {
         
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public func updateMenuItemsArr(_ propertys: [ComponentMenuitemProperty]) {
-        self.menuitemPropertys = propertys
+        menuitemPropertys = propertys
         
     }
     
@@ -101,10 +100,10 @@ public class ComponentSelect: ComponentBaseXibView {
          if index >= 0 && index < menuitemPropertys.count {
             let chooseIndex: Int = index
             let chooseProperty = menuitemPropertys[chooseIndex]
-            self.inputField.stringValue = chooseProperty.text
-            self.properties.state = .normal
-            self.refreshUI()
-            self.selItemProperty = chooseProperty
+            inputField.stringValue = chooseProperty.text
+            properties.state = .normal
+            refreshUI()
+            selItemProperty = chooseProperty
         }
     }
     
@@ -119,99 +118,99 @@ public class ComponentSelect: ComponentBaseXibView {
     
     //MARK: - SetupUI
     func setupUI() {
-        if self.properties.showLeftIcon == true {
-            self.leftIconImage.isHidden = false
-            self.leftIconWidthConst.constant = self.properties.propertyInfo.leftIconWidth ?? 16
+        if properties.showLeftIcon == true {
+            leftIconImage.isHidden = false
+            leftIconWidthConst.constant = properties.propertyInfo.leftIconWidth ?? 16
             
-            self.fieldLeftConst.constant = self.leftIconWidthConst.constant + 12
+            fieldLeftConst.constant = leftIconWidthConst.constant + 12
         } else {
-            self.leftIconImage.isHidden = true
-            self.fieldLeftConst.constant = 8
+            leftIconImage.isHidden = true
+            fieldLeftConst.constant = 8
         }
         
-        if self.properties.isError == true {
-            self.contendBoxBottomConst.constant = 18
-            self.errorTipLabel.isHidden = false
+        if properties.isError == true {
+            contendBoxBottomConst.constant = 18
+            errorTipLabel.isHidden = false
         } else {
-            self.contendBoxBottomConst.constant = 0
-            self.errorTipLabel.isHidden = true
+            contendBoxBottomConst.constant = 0
+            errorTipLabel.isHidden = true
         }
         
-        if self.properties.isDisabled == false {
-            self.inputField.isEditable = true
-            if self.properties.creatable == false {
-                self.inputField.isEditable = false
+        if properties.isDisabled == false {
+            inputField.isEditable = true
+            if properties.creatable == false {
+                inputField.isEditable = false
             }
         } else {
-            self.inputField.isEditable = false
+            inputField.isEditable = false
         }
-        self.inputField.font = self.properties.propertyInfo.textFont
-        self.inputField.stringValue = properties.text ?? ""
+        inputField.font = properties.propertyInfo.textFont
+        inputField.stringValue = properties.text ?? ""
         
-        if let chooseProperty = self.selItemProperty {
-            self.inputField.stringValue = chooseProperty.text
+        if let chooseProperty = selItemProperty {
+            inputField.stringValue = chooseProperty.text
         }
         
     }
     
     func refreshUI() {
         
-        self.contendBox.cornerRadius = self.properties.propertyInfo.cornerRadius
-        self.contendBox.borderWidth = self.properties.propertyInfo.borderWidth
+        contendBox.cornerRadius = properties.propertyInfo.cornerRadius
+        contendBox.borderWidth = properties.propertyInfo.borderWidth
          
         var fillColor: NSColor?
         var borderColor: NSColor?
-        if self.properties.state == .normal {
-            fillColor = self.properties.propertyInfo.color_nor
-            borderColor = self.properties.propertyInfo.borderColor_nor
+        if properties.state == .normal {
+            fillColor = properties.propertyInfo.color_nor
+            borderColor = properties.propertyInfo.borderColor_nor
             
-        } else if self.properties.state == .hover {
-            fillColor = self.properties.propertyInfo.color_hov
-            if self.properties.isError == true {
-                fillColor = self.properties.propertyInfo.color_error_hov
+        } else if properties.state == .hover {
+            fillColor = properties.propertyInfo.color_hov
+            if properties.isError == true {
+                fillColor = properties.propertyInfo.color_error_hov
             }
-            borderColor = self.properties.propertyInfo.borderColor_hov
+            borderColor = properties.propertyInfo.borderColor_hov
             
-        } else if self.properties.state == .pressed {
-            fillColor = self.properties.propertyInfo.color_active
-            borderColor = self.properties.propertyInfo.borderColor_active
+        } else if properties.state == .pressed {
+            fillColor = properties.propertyInfo.color_active
+            borderColor = properties.propertyInfo.borderColor_active
             
         }
         
         var textColor: NSColor = properties.propertyInfo.textColor
-        if self.properties.isDisabled == true {
-            fillColor = self.properties.propertyInfo.color_dis
-            borderColor = self.properties.propertyInfo.borderColor_dis
+        if properties.isDisabled == true {
+            fillColor = properties.propertyInfo.color_dis
+            borderColor = properties.propertyInfo.borderColor_dis
             textColor = properties.propertyInfo.textColor_dis
         }
         
-        if self.properties.isError == true {
-            borderColor = self.properties.propertyInfo.borderColor_error
+        if properties.isError == true {
+            borderColor = properties.propertyInfo.borderColor_error
         }
         
         if let color = fillColor {
-            self.contendBox.fillColor = color
+            contendBox.fillColor = color
         }
         
         if let color = borderColor {
-            self.contendBox.borderColor = color
+            contendBox.borderColor = color
         }
     
         if let placeholder = properties.placeholder {
-            self.inputField.placeholderString = placeholder
+            inputField.placeholderString = placeholder
         }
-        self.inputField.textColor = textColor
+        inputField.textColor = textColor
         
-        self.rightIconImage.image = ComponentLibrary.shared.image(forResource: "suffix")
+        rightIconImage.image = ComponentLibrary.shared.image(forResource: "suffix")
         if properties.isDisabled {
             rightIconImage.image = ComponentLibrary.shared.image(forResource: "suffix_dis")
         }
         
-        self.errorTipLabel.textColor = self.properties.propertyInfo.errorTipTextColor
+        errorTipLabel.textColor = properties.propertyInfo.errorTipTextColor
         
-        self.errorTipLabel.font = self.properties.propertyInfo.errorTipTextFont
+        errorTipLabel.font = properties.propertyInfo.errorTipTextFont
         if let errorText = properties.errorText {
-            self.errorTipLabel.stringValue = errorText
+            errorTipLabel.stringValue = errorText
         }
         
     }
@@ -222,7 +221,7 @@ public class ComponentSelect: ComponentBaseXibView {
         }
         
         var viewHeight: CGFloat = 8.0
-        for item in self.menuitemPropertys {
+        for item in menuitemPropertys {
             item.state = .normal
             item.itemSelected = false
             if item == selItemProperty {
@@ -243,13 +242,13 @@ public class ComponentSelect: ComponentBaseXibView {
         groupView.groupDelegate = self
         groupView.show(relativeTo: self)
         groupView?.updateGroupInfo(menuitemPropertys)
-        self.isGroupViewShow = true
+        isGroupViewShow = true
     }
     
     func hideGroupView() {
-        self.groupView?.removeGroupView()
+        groupView?.removeGroupView()
         
-        self.isGroupViewShow = false
+        isGroupViewShow = false
     }
     
     //MARK: - TextNotification
@@ -258,7 +257,7 @@ public class ComponentSelect: ComponentBaseXibView {
     }
     
     @objc func textFieldDidChangeNotification(_ notification: Notification) {
-        self.selItemProperty = nil
+        selItemProperty = nil
         
     }
     
@@ -270,12 +269,12 @@ public class ComponentSelect: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties.isDisabled == false &&
-            self.inputField.isResponder == false &&
-            self.isGroupViewShow == false {
-            self.properties.state = .hover
+        if properties.isDisabled == false &&
+            inputField.isResponder == false &&
+            isGroupViewShow == false {
+            properties.state = .hover
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -286,13 +285,13 @@ public class ComponentSelect: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false &&
-            self.inputField.isResponder == false &&
-            self.isGroupViewShow == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false &&
+            inputField.isResponder == false &&
+            isGroupViewShow == false {
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -303,24 +302,24 @@ public class ComponentSelect: ComponentBaseXibView {
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
-        if self.properties.isDisabled == false {
+        if properties.isDisabled == false {
             let point = convert(event.locationInWindow, from: nil)
-            if CGRectContainsPoint(self.rightIconImage.frame, point) {
-                self.properties.state = .pressed
+            if CGRectContainsPoint(rightIconImage.frame, point) {
+                properties.state = .pressed
                 
-                self.showGroupView()
+                showGroupView()
                 
             }
             
         }
         
-        if self.properties.isDisabled == false &&
-            self.inputField.isResponder == false &&
-            self.isGroupViewShow == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false &&
+            inputField.isResponder == false &&
+            isGroupViewShow == false {
+            properties.state = .normal
             
         }
-        self.refreshUI()
+        refreshUI()
     }
 }
 
@@ -328,16 +327,18 @@ public class ComponentSelect: ComponentBaseXibView {
 extension ComponentSelect: ComponentTextFieldDelegate {
     
     func componentTextFieldDidResponderChanged(textField: NSTextField) {
-        if self.properties.isDisabled == false {
-            if self.inputField.isResponder {
-                self.properties.state = .pressed
+        if properties.isDisabled == false {
+            if inputField.isResponder {
+                properties.state = .pressed
                 
-                self.showGroupView()
+                if properties.autoShowPopupView == true {
+                    showGroupView()
+                }
             } else {
-                self.properties.state = .normal
+                properties.state = .normal
             }
         }
-        self.refreshUI()
+        refreshUI()
         
         
     }
@@ -345,25 +346,25 @@ extension ComponentSelect: ComponentTextFieldDelegate {
 
 extension ComponentSelect: ComponentGroupDelegate {
     public func componentGroupDidDismiss(group: ComponentGroup?) {
-        self.properties.state = .normal
-        self.isGroupViewShow = false
+        properties.state = .normal
+        isGroupViewShow = false
         
-        self.window?.makeFirstResponder(nil)
+        window?.makeFirstResponder(nil)
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public func componentGroupDidSelect(group: ComponentGroup?, menuItemProperty: ComponentMenuitemProperty?) {
-        self.inputField.stringValue = menuItemProperty?.text ?? ""
+        inputField.stringValue = menuItemProperty?.text ?? ""
         
-        self.properties.state = .normal
+        properties.state = .normal
         
-        self.refreshUI()
+        refreshUI()
         
-        self.selItemProperty = menuItemProperty
+        selItemProperty = menuItemProperty
         
-        self.delegate?.componentSelectDidSelect?(view: self, menuItemProperty: menuItemProperty)
+        delegate?.componentSelectDidSelect?(view: self, menuItemProperty: menuItemProperty)
         
-        self.window?.makeFirstResponder(nil)
+        window?.makeFirstResponder(nil)
     }
 }

+ 2 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Select/ComponentSelectProperty.swift

@@ -21,6 +21,8 @@ public class ComponentSelectProperties: NSObject {
     public var creatable: Bool = false            //输入框是否允许编辑
     public var text: String?                      //文字信息
     
+    public var autoShowPopupView: Bool = false
+    
     public var propertyInfo = SelectPropertyInfo()
     
     public init(size: ComponentSize = .m,

+ 21 - 24
PDF Office/KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/ComponentSideBarItem.swift

@@ -41,7 +41,6 @@ public class ComponentSideBarItem: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
         
-        
     }
     
     //MARK: - Setter and Getter
@@ -54,45 +53,43 @@ public class ComponentSideBarItem: ComponentBaseXibView {
              
             ComponentLibrary.shared.configSidebarItemComponent(properties: _properties)
             
-            self.setupUI()
-             
-            self.refreshUI()
+            setupUI()
+            
+            refreshUI()
         }
     }
-     
     
     //MARK: - SetupUI
     func setupUI() {
-        self.iconImage.image = self.properties.icon
+        iconImage.image = properties.icon
 
     }
     
     func refreshUI() {
         
-        self.contendBox.cornerRadius = self.properties.propertyInfo.cornerRadius
-        self.contendBox.borderWidth = self.properties.propertyInfo.borderWidth
-        self.contendBox.borderColor = self.properties.propertyInfo.borderColor_nor
+        contendBox.cornerRadius = properties.propertyInfo.cornerRadius
+        contendBox.borderWidth = properties.propertyInfo.borderWidth
+        contendBox.borderColor = properties.propertyInfo.borderColor_nor
         
         var fillColor: NSColor?
         
-        if self.properties.state == .normal {
-            fillColor = self.properties.propertyInfo.color_nor
-        } else if self.properties.state == .hover {
-            fillColor = self.properties.propertyInfo.color_hov
-        } else if self.properties.state == .pressed {
-            fillColor = self.properties.propertyInfo.color_active
+        if properties.state == .normal {
+            fillColor = properties.propertyInfo.color_nor
+        } else if properties.state == .hover {
+            fillColor = properties.propertyInfo.color_hov
+        } else if properties.state == .pressed {
+            fillColor = properties.propertyInfo.color_active
         }
         
         if let color = fillColor {
-            self.contendBox.fillColor = color
+            contendBox.fillColor = color
         }
         
-        
     }
     
     //MARK: - Public Method
     public func reloadData() {
-        self.refreshUI()
+        refreshUI()
         
     }
     
@@ -105,11 +102,11 @@ public class ComponentSideBarItem: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
         
-        if self.properties.state != .pressed {
-            self.properties.state = .hover
+        if properties.state != .pressed {
+            properties.state = .hover
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -120,11 +117,11 @@ public class ComponentSideBarItem: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
          
-        if self.properties.state != .pressed {
-            self.properties.state = .normal
+        if properties.state != .pressed {
+            properties.state = .normal
         }
     
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {

+ 7 - 7
PDF Office/KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/PageTurner/ComponentSidebarPageTurner.swift

@@ -81,9 +81,9 @@ public class ComponentSidebarPageTurner: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
         
-        self.contendBox.borderWidth = 0
-        self.contendBox.borderColor = NSColor.clear
-        self.contendBox.cornerRadius = 0
+        contendBox.borderWidth = 0
+        contendBox.borderColor = NSColor.clear
+        contendBox.cornerRadius = 0
         
         previousPageButton.setTarget(self, action: #selector(buttonClicked(_ :)))
         nextPageButton.setTarget(self, action: #selector(buttonClicked(_ :)))
@@ -140,9 +140,9 @@ public class ComponentSidebarPageTurner: ComponentBaseXibView {
             
             ComponentLibrary.shared.configSidebarPageTurnerComponent(properties: _properties)
             
-            self.setupUI()
+            setupUI()
             
-            self.refreshUI()
+            refreshUI()
         }
     }
     
@@ -188,9 +188,9 @@ public class ComponentSidebarPageTurner: ComponentBaseXibView {
             nextTopConst += 36
         }
         
-        self.nextPageBottomConst.constant = nextPageBottomYValue
+        nextPageBottomConst.constant = nextPageBottomYValue
         self.previouseTopConst.constant = previouseTopConst
-        self.nextButtonTopConst.constant = nextTopConst
+        nextButtonTopConst.constant = nextTopConst
         self.dividerTopConst.constant = dividerTopConst
         
     }

+ 79 - 79
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Slider/ComponentSlider.swift

@@ -63,24 +63,24 @@ public class ComponentSlider: ComponentBaseXibView {
     public override func awakeFromNib() {
         super.awakeFromNib()
         
-        self.contendBox.fillColor = .clear
-        self.contendBox.borderWidth = 0
+        contendBox.fillColor = .clear
+        contendBox.borderWidth = 0
         
-        self.bottomBox.borderWidth = 0
-        self.bottomBox.fillColor = .clear
-        self.bottomBox.autoresizingMask = [.minXMargin, .width, .maxXMargin, .minYMargin, .maxYMargin]
+        bottomBox.borderWidth = 0
+        bottomBox.fillColor = .clear
+        bottomBox.autoresizingMask = [.minXMargin, .width, .maxXMargin, .minYMargin, .maxYMargin]
         
         
-        self.sliderPoint.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
+        sliderPoint.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
         
-        self.upBox.fillColor = .clear
-        self.upBox.borderWidth = 0
+        upBox.fillColor = .clear
+        upBox.borderWidth = 0
           
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
         
-        self.sliderPoint.stateHandle = { [weak self] view, state in
+        sliderPoint.stateHandle = { [weak self] view, state in
             if self?.properties.isDisabled == false {
                 if state == .enter {
                     if let color = self?.properties.propertyInfo.lineColor_hov {
@@ -106,46 +106,46 @@ public class ComponentSlider: ComponentBaseXibView {
             
             ComponentLibrary.shared.configSliderComponent(properties: _properties)
              
-            self.sliderPoint.properties = _properties
+            sliderPoint.properties = _properties
             
-            self.reloadData()
+            reloadData()
         }
     }
     
     func setupUI() {
         
-        self.bottomBox.fillColor = properties.propertyInfo.color_nor
+        bottomBox.fillColor = properties.propertyInfo.color_nor
         
         var bottomBorRightValue: CGFloat = 0
         
-        if self.properties.showInput == true {
+        if properties.showInput == true {
             bottomBorRightValue += 96
-            self.selectItem.isHidden = false
+            selectItem.isHidden = false
         } else {
-            self.selectItem.isHidden = true
+            selectItem.isHidden = true
         }
         
-        self.rightIconImageView.isHidden = true
+        rightIconImageView.isHidden = true
         if properties.rightIcon != nil {
-            self.rightIconRightConst.constant = bottomBorRightValue
+            rightIconRightConst.constant = bottomBorRightValue
             bottomBorRightValue += 24
-            self.rightIconImageView.isHidden = false
-            self.rightIconImageView.image = properties.rightIcon
+            rightIconImageView.isHidden = false
+            rightIconImageView.image = properties.rightIcon
         }
 
         var sliderViewXValue: CGFloat = 0
-        self.leftIconImageView.isHidden = true
+        leftIconImageView.isHidden = true
         if properties.leftIcon != nil {
-            self.leftIconImageView.isHidden = false
-            self.leftIconImageView.image = properties.leftIcon
+            leftIconImageView.isHidden = false
+            leftIconImageView.image = properties.leftIcon
             sliderViewXValue += 24
         }
         
-        self.sliderBGView.frame = CGRectMake(sliderViewXValue, 0, CGRectGetWidth(self.frame)-sliderViewXValue-bottomBorRightValue, CGRectGetHeight(self.frame))
-        self.sliderBGView.autoresizingMask = [.minXMargin, .width, .maxXMargin, .minYMargin, .maxYMargin, .height]
+        sliderBGView.frame = CGRectMake(sliderViewXValue, 0, CGRectGetWidth(frame)-sliderViewXValue-bottomBorRightValue, CGRectGetHeight(frame))
+        sliderBGView.autoresizingMask = [.minXMargin, .width, .maxXMargin, .minYMargin, .maxYMargin, .height]
         
-        let size = self.properties.size
-        let isDisabled = self.properties.isDisabled
+        let size = properties.size
+        let isDisabled = properties.isDisabled
         let selectItemProperty: ComponentSelectProperties = ComponentSelectProperties.init(size: size,
                                                                                            state: .normal,
                                                                                            isDisabled: isDisabled,
@@ -160,13 +160,13 @@ public class ComponentSlider: ComponentBaseXibView {
     }
     
     func refreshUI() {
-        if self.properties.isDisabled == true {
-            self.upBox.fillColor = properties.propertyInfo.color_dis
+        if properties.isDisabled == true {
+            upBox.fillColor = properties.propertyInfo.color_dis
         } else {
-            if self.isDraging {
-                self.upBox.fillColor = properties.propertyInfo.lineColor_hov
+            if isDraging {
+                upBox.fillColor = properties.propertyInfo.lineColor_hov
             } else {
-                self.upBox.fillColor = properties.propertyInfo.lineColor_nor
+                upBox.fillColor = properties.propertyInfo.lineColor_nor
             }
         }
     }
@@ -176,30 +176,30 @@ public class ComponentSlider: ComponentBaseXibView {
         var upFrame = CGRectZero
         upFrame.origin.x = 0
         upFrame.size.height = 4
-        upFrame.origin.y = CGRectGetHeight(self.sliderBGView.frame)/2 - 2
-        upFrame.size.width = CGRectGetWidth(self.sliderBGView.frame) * properties.percent
-        self.upBox.frame = upFrame
+        upFrame.origin.y = CGRectGetHeight(sliderBGView.frame)/2 - 2
+        upFrame.size.width = CGRectGetWidth(sliderBGView.frame) * properties.percent
+        upBox.frame = upFrame
         
         var sliderPointFrame = CGRectZero
         sliderPointFrame.size.width = 16
         sliderPointFrame.size.height = 16
-        sliderPointFrame.origin.y = CGRectGetHeight(self.sliderBGView.frame)/2 - 8
-        sliderPointFrame.origin.x = CGRectGetWidth(self.sliderBGView.frame) * properties.percent - 8
-        self.sliderPoint.frame = sliderPointFrame
+        sliderPointFrame.origin.y = CGRectGetHeight(sliderBGView.frame)/2 - 8
+        sliderPointFrame.origin.x = CGRectGetWidth(sliderBGView.frame) * properties.percent - 8
+        sliderPoint.frame = sliderPointFrame
         
         if draged {
-            self.delegate?.componentSliderDidUpdate?(self)
+            delegate?.componentSliderDidUpdate?(self)
         }
     }
     
     //MARK: - Public Method
     public func reloadData() {
         
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
         
-        self.updatePercentValue()
+        updatePercentValue()
         
         DispatchQueue.main.asyncAfter(deadline: .now()+0.01) {
             self.setupUI()
@@ -210,8 +210,8 @@ public class ComponentSlider: ComponentBaseXibView {
     public override func mouseEntered(with event: NSEvent) {
         super.mouseEntered(with: event)
          
-        if self.properties.isDisabled == false {
-            self.properties.state = .hover
+        if properties.isDisabled == false {
+            properties.state = .hover
         }
     }
     
@@ -223,62 +223,62 @@ public class ComponentSlider: ComponentBaseXibView {
     public override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        if self.properties.isDisabled == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false {
+            properties.state = .normal
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
         super.mouseDown(with: event)
     
         let point = convert(event.locationInWindow, from: nil)
-        let bottomBoxPoint = self.convert(point, to: self.sliderBGView)
+        let bottomBoxPoint = convert(point, to: sliderBGView)
 
-        self.dragEnable = false
-        self.isDraging = false
+        dragEnable = false
+        isDraging = false
         
-        if CGRectContainsPoint(NSInsetRect(self.bottomBox.frame, 0, -5), bottomBoxPoint) &&
-            self.properties.isDisabled == false {
+        if CGRectContainsPoint(NSInsetRect(bottomBox.frame, 0, -5), bottomBoxPoint) &&
+            properties.isDisabled == false {
             
             //允许点击
-            self.sliderPoint.isMouseEnter = true
+            sliderPoint.isMouseEnter = true
             
-            var percent = bottomBoxPoint.x/(self.sliderBGView.bounds.size.width)
+            var percent = bottomBoxPoint.x/(sliderBGView.bounds.size.width)
             percent = min(1, max(0, percent))
             properties.percent = percent
             
-            self.updatePercentValue(true)
+            updatePercentValue(true)
  
-            self.dragEnable = true
-            self.isDraging = true
+            dragEnable = true
+            isDraging = true
             
-            self.startPoint = point
-            self.sliderPoint.reloadData()
+            startPoint = point
+            sliderPoint.reloadData()
             
         } else {
-            self.sliderPoint.isMouseEnter = false
-            self.sliderPoint.reloadData()
+            sliderPoint.isMouseEnter = false
+            sliderPoint.reloadData()
         }
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDragged(with event: NSEvent) {
         super.mouseDragged(with: event)
         
-        if self.dragEnable {
+        if dragEnable {
             
             let point = convert(event.locationInWindow, from: nil)
-            let bottomBoxPoint = self.convert(point, to: self.sliderBGView)
+            let bottomBoxPoint = convert(point, to: sliderBGView)
              
-            var percent = bottomBoxPoint.x/(self.sliderBGView.bounds.size.width)
+            var percent = bottomBoxPoint.x/(sliderBGView.bounds.size.width)
             percent = min(1, max(0, percent))
             properties.percent = percent
             
-            self.updatePercentValue(true)
+            updatePercentValue(true)
             
-            self.refreshUI()
+            refreshUI()
         }
         
     }
@@ -286,27 +286,27 @@ public class ComponentSlider: ComponentBaseXibView {
     public override func mouseUp(with event: NSEvent) {
         super.mouseUp(with: event)
         
-        if self.dragEnable {
+        if dragEnable {
             let point = convert(event.locationInWindow, from: nil)
-            let bottomBoxPoint = self.convert(point, to: self.sliderBGView)
+            let bottomBoxPoint = convert(point, to: sliderBGView)
              
-            var percent = bottomBoxPoint.x/(self.sliderBGView.bounds.size.width)
+            var percent = bottomBoxPoint.x/(sliderBGView.bounds.size.width)
             percent = min(1, max(0, percent))
             properties.percent = percent
             
-            self.updatePercentValue(true)
+            updatePercentValue(true)
             
-            self.sliderPoint.isMouseEnter = false
-            self.sliderPoint.reloadData()
+            sliderPoint.isMouseEnter = false
+            sliderPoint.reloadData()
         }
         
-        if self.properties.isDisabled == false {
-            self.properties.state = .normal
+        if properties.isDisabled == false {
+            properties.state = .normal
         }
-        self.dragEnable = false
-        self.isDraging = false
+        dragEnable = false
+        isDraging = false
         
-        self.refreshUI()
+        refreshUI()
         
     }
 }

+ 1 - 4
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Tabs/ComponentTabsItem.swift

@@ -92,8 +92,6 @@ public class ComponentTabsItem: ComponentBaseXibView {
             lineBox.fillColor = color
         }
         
-       
-        
         titleLabel.font = properties.propertyInfo.textFont
         
         titleLabel.stringValue = properties.title ?? ""
@@ -208,8 +206,7 @@ public class ComponentTabsItem: ComponentBaseXibView {
     
     public override func mouseMoved(with event: NSEvent) {
         super.mouseMoved(with: event)
-        
-        
+         
     }
     
     public override func mouseExited(with event: NSEvent) {

+ 27 - 27
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Tree/ComponentTreeItem.swift

@@ -85,9 +85,9 @@ public class ComponentTreeItem: ComponentBaseXibView {
             
             ComponentLibrary.shared.configTreeItemComponent(properties: _properties)
              
-            self.setupUI()
+            setupUI()
              
-            self.refreshUI()
+            refreshUI()
         }
     }
      
@@ -103,9 +103,9 @@ public class ComponentTreeItem: ComponentBaseXibView {
         infoLabel.isHidden = false
         
         if properties.collapse {
-            self.collapseImageView.image = ComponentLibrary.shared.image(forResource: "arrowDown")
+            collapseImageView.image = ComponentLibrary.shared.image(forResource: "arrowDown")
         } else {
-            self.collapseImageView.image = ComponentLibrary.shared.image(forResource: "arrowRight")
+            collapseImageView.image = ComponentLibrary.shared.image(forResource: "arrowRight")
         }
         
     }
@@ -135,7 +135,7 @@ public class ComponentTreeItem: ComponentBaseXibView {
         }
         infoContendBox.fillColor = fillColor
 
-        if self.infoField.isHidden == false {
+        if infoField.isHidden == false {
             infoContendBox.borderWidth = properties.propertyInfo.borderWidth_editing
             infoContendBox.borderColor = properties.propertyInfo.borderColor_editing
             infoContendBox.fillColor = properties.propertyInfo.color_editing
@@ -178,17 +178,17 @@ public class ComponentTreeItem: ComponentBaseXibView {
         }
         
         
-        self.collapseViewLeftConst.constant = collapseXvalue
-        self.infoContendLeftConst.constant = infoContendXValue
-        self.labelLeftConst.constant = labelXvalue
+        collapseViewLeftConst.constant = collapseXvalue
+        infoContendLeftConst.constant = infoContendXValue
+        labelLeftConst.constant = labelXvalue
         
     }
     
     //MARK: - Public Method
     public func reloadData() {
-        self.setupUI()
+        setupUI()
         
-        self.refreshUI()
+        refreshUI()
         
     }
     
@@ -209,9 +209,9 @@ public class ComponentTreeItem: ComponentBaseXibView {
             properties.text = infoField.stringValue
         }
         
-        self.componentDelegate?.componentTreeItemInfoDidChanged?(self)
+        componentDelegate?.componentTreeItemInfoDidChanged?(self)
         
-        self.reloadData()
+        reloadData()
     }
     
     //MARK: - MouseEvent
@@ -222,7 +222,7 @@ public class ComponentTreeItem: ComponentBaseXibView {
             properties.state = .hover
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseMoved(with event: NSEvent) {
@@ -239,7 +239,7 @@ public class ComponentTreeItem: ComponentBaseXibView {
             }
         }
         
-        self.refreshUI()
+        refreshUI()
     }
     
     public override func mouseDown(with event: NSEvent) {
@@ -249,7 +249,7 @@ public class ComponentTreeItem: ComponentBaseXibView {
             properties.state = .pressed
         }
         
-        self.refreshUI()
+        refreshUI()
         
         
     }
@@ -258,12 +258,12 @@ public class ComponentTreeItem: ComponentBaseXibView {
         super.mouseUp(with: event)
         
         if properties.isDisable == false {
-            let point = self.convert(event.locationInWindow, from: nil)
+            let point = convert(event.locationInWindow, from: nil)
             
-            var collapseImageViewPoint = self.convert(point, to: collapseImageView)
-            var infoPoint = self.convert(point, to: infoLabel)
+            var collapseImageViewPoint = convert(point, to: collapseImageView)
+            var infoPoint = convert(point, to: infoLabel)
             if infoLabel.isHidden {
-                infoPoint = self.convert(point, to: infoField)
+                infoPoint = convert(point, to: infoField)
             }
             
             if properties.showCollapse == false {
@@ -272,19 +272,19 @@ public class ComponentTreeItem: ComponentBaseXibView {
             
             if CGRectContainsPoint(collapseImageView.bounds, collapseImageViewPoint) {
                 properties.collapse = !properties.collapse
-                self.reloadData()
+                reloadData()
                 
-                self.componentDelegate?.componentTreeItemDidCollapseStateChanged?(self)
+                componentDelegate?.componentTreeItemDidCollapseStateChanged?(self)
                 
-            } else if CGRectContainsPoint(self.infoField.bounds, infoPoint) ||
-                CGRectContainsPoint(self.infoLabel.bounds, infoPoint) {
+            } else if CGRectContainsPoint(infoField.bounds, infoPoint) ||
+                CGRectContainsPoint(infoLabel.bounds, infoPoint) {
                 if event.clickCount == 2 && 
                     properties.editable == true {
                     
-                    self.infoField.isHidden = false
-                    self.infoLabel.isHidden = true
+                    infoField.isHidden = false
+                    infoLabel.isHidden = true
                     
-                    self.infoField.becomeFirstResponder()
+                    infoField.becomeFirstResponder()
                     DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
                         self.infoField.currentEditor()?.selectedRange = NSMakeRange(self.infoField.stringValue.count, 0)
                         
@@ -293,7 +293,7 @@ public class ComponentTreeItem: ComponentBaseXibView {
                     
                 }
             } else {
-                self.window?.makeFirstResponder(nil)
+                window?.makeFirstResponder(nil)
                 
             }
         }