瀏覽代碼

【2025】【综合】
1、最近文档列表数量限制修改
2、下拉组件UI完善

niehaoyu 1 月之前
父節點
當前提交
7a3ede8317

+ 11 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.swift

@@ -12,6 +12,8 @@ import AppKit
     
     @objc optional func componentDropdownToolDidShowPopupView(_ view: ComponentDropdownTool)
     
+    @objc optional func componentDropdownToolDidDismissPopupView(_ view: ComponentDropdownTool)
+    
     @objc optional func componentDropdownToolDidClicked(_ view: ComponentDropdownTool, menuItem: ComponentMenuitemProperty?)
     
 }
@@ -24,6 +26,7 @@ public class ComponentDropdownTool: ComponentBaseXibView {
     @IBOutlet var titleLabel: NSTextField!
     
     @IBOutlet var imageLeftConst: NSLayoutConstraint!
+    @IBOutlet var imageWidthConst: NSLayoutConstraint!
     @IBOutlet var labelLeftConst: NSLayoutConstraint!
     
     private var _properties : ComponentDropdownToolProperty = ComponentDropdownToolProperty()
@@ -94,6 +97,8 @@ public class ComponentDropdownTool: ComponentBaseXibView {
             dropImage.isHidden = true
         }
         
+        imageWidthConst.constant = 20
+        
         if let text = properties.text {
             titleLabel.stringValue = text
             titleLabel.isHidden = false
@@ -107,6 +112,10 @@ public class ComponentDropdownTool: ComponentBaseXibView {
             titleLabel.isHidden = true
             
             imageLeftConst.constant = 4
+            
+            if properties.showDropdown == false {
+                imageWidthConst.constant = CGRectGetWidth(self.frame) - 8
+            }
         }
         
     }
@@ -256,6 +265,8 @@ extension ComponentDropdownTool: ComponentGroupDelegate {
         properties.state = .normal
         
         refreshUI()
+        
+        delegate?.componentDropdownToolDidDismissPopupView?(self)
     }
     
     public func componentGroupDidSelect(group: ComponentGroup?, menuItemProperty: ComponentMenuitemProperty?) {

+ 2 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.xib

@@ -12,6 +12,7 @@
                 <outlet property="dropImage" destination="bCx-g4-O4c" id="7Ln-A0-dTE"/>
                 <outlet property="iconImage" destination="3Q8-Jd-E0Q" id="fvm-VZ-KII"/>
                 <outlet property="imageLeftConst" destination="Pt2-SL-L13" id="9oA-lE-pEn"/>
+                <outlet property="imageWidthConst" destination="XUp-4U-paZ" id="uv9-p6-xKB"/>
                 <outlet property="labelLeftConst" destination="Qxb-uP-jlP" id="nHa-Eq-wkV"/>
                 <outlet property="titleLabel" destination="lEZ-As-k9B" id="Iac-Cd-HaT"/>
             </connections>
@@ -31,8 +32,8 @@
                             <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="3Q8-Jd-E0Q">
                                 <rect key="frame" x="4" y="4" width="20" height="20"/>
                                 <constraints>
+                                    <constraint firstAttribute="width" secondItem="3Q8-Jd-E0Q" secondAttribute="height" multiplier="1:1" id="Cel-rm-uNw"/>
                                     <constraint firstAttribute="width" constant="20" id="XUp-4U-paZ"/>
-                                    <constraint firstAttribute="height" constant="20" id="tTn-Yt-alR"/>
                                 </constraints>
                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="test" id="LAY-Nf-0Yy"/>
                             </imageView>

+ 4 - 0
PDF Office/PDF Master/Class/Document/KMDocumentController.swift

@@ -109,6 +109,10 @@ class KMDocumentController: NSDocumentController {
     @IBAction func importFromScanner(_ sender: Any) {
         
     }
+    
+    override var maximumRecentDocumentCount: Int {
+        return SettingsManager.sharedInstance.fileListCount
+    }
 }
 
 extension NSDocumentController {

+ 1 - 1
PDF Office/PDF Master/KMClass/KMHomeViewController/HistoryFilesManager/HistoryFilesManager.swift

@@ -43,7 +43,7 @@ class HistoryFilesManager: NSObject {
     
     func refreshHistoryFile() -> Void {
         files.removeAll()
-        for url in NSDocumentController.shared.recentDocumentURLs {
+        for url in KMDocumentController.shared.recentDocumentURLs {
             if FileManager.default.fileExists(atPath: url.path) {
                 files.append(url)
             }

+ 18 - 3
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Forms/Forms_List/Items/KMFormListItem.swift

@@ -32,6 +32,7 @@ class KMFormListItem: NSCollectionViewItem {
     
     private var area: NSTrackingArea?
     private var isMouseEnter: Bool = false
+    private var isPopupShow: Bool = false
     
     private var choicesList: [String] = []
     
@@ -129,13 +130,27 @@ class KMFormListItem: NSCollectionViewItem {
     override func mouseExited(with event: NSEvent) {
         super.mouseExited(with: event)
         
-        self.isMouseEnter = false
-        
-        refreshUI()
+        if self.isPopupShow == false {
+            self.isMouseEnter = false
+            
+            refreshUI()
+        }
     }
 }
 
 extension KMFormListItem: ComponentDropdownToolDelegate {
+    func componentDropdownToolDidShowPopupView(_ view: ComponentDropdownTool) {
+        isPopupShow = true
+    }
+    
+    func componentDropdownToolDidDismissPopupView(_ view: ComponentDropdownTool) {
+        isPopupShow = false
+         
+        self.isMouseEnter = false
+        
+        refreshUI()
+    }
+    
     func componentDropdownToolDidClicked(_ view: ComponentDropdownTool, menuItem: ComponentMenuitemProperty?) {
         if menuItem == deleteItem {
             delegate?.KMFormListItemDidDelete?(self)

+ 1 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/Toolbar/KMPDFToolbarController.swift

@@ -411,6 +411,7 @@ class KMPDFToolbarController: NSViewController {
                 let dropdownTool = ComponentDropdownTool.init()
                 dropdownTool.properties = property as! ComponentDropdownToolProperty
                 dropdownTool.frame = CGRectMake(itemXvalue, 0, 28, 28)
+                dropdownTool.reloadData()
                 dropdownTool.delegate = self
                 rightToolsView.addSubview(dropdownTool)
                 

+ 1 - 1
PDF Office/PDF Master/KMClass/Property/InfoWindow.xib

@@ -17,7 +17,7 @@
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <window title="Document Info" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window" customClass="NSPanel">
-            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES"/>
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <rect key="contentRect" x="50" y="489" width="460" height="375"/>
             <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
             <value key="minSize" type="size" width="280" height="273"/>