@legendapp/spark 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/init-template.cjs +7 -1
- package/package.json +11 -6
- package/patches/dependencies.json +4 -4
- package/patches/react-native-mmkv@4.3.2.patch +2 -2
- package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
- package/patches/registry.json +615 -0
- package/patches/workspace/expo-audio@55.0.18.patch +159 -0
- package/patches/workspace/op-engineering-op-sqlite@18.2.1.patch +796 -0
- package/patches/workspace/react-native-nitro-modules@0.37.0.patch +1348 -0
- package/patches/workspace/react-native-runtimes-core@0.1.0-alpha.2.patch +276 -0
- package/patches/workspace/react-native-webview@16.0.0.patch +208 -0
- package/postinstall.cjs +10 -1
- package/skills/spark/SKILL.md +37 -4
- package/skills/spark/UPGRADING.md +174 -1
- package/skills/spark/ai-customize.md +39 -0
- package/skills/spark/app-and-documents.md +56 -0
- package/skills/spark/external-libraries.md +87 -0
- package/skills/spark/files.md +64 -0
- package/skills/spark/integrations.md +69 -0
- package/skills/spark/keyboard.md +54 -0
- package/skills/spark/library-compat.md +76 -0
- package/skills/spark/menus-tray-dock.md +83 -0
- package/skills/spark/storage-settings.md +59 -0
- package/skills/spark/ui.md +83 -0
- package/skills/spark/windows.md +91 -0
- package/ui-popover.ts +1 -0
- package/ui-progress.ts +1 -0
- package/ui-sheet.ts +1 -0
- package/ui-split-view.ts +1 -0
- package/ui-table.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -13
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +5 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +157 -106
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +16 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +19 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +57 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +12 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrate.js +65 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +15 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +35 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/package.js +4 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/patch.js +92 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +8 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/publish-directory.js +32 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release-app.js +139 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +17 -17
- package/vendor/node_modules/@legendapp/spark-cli/dist/signing.js +61 -41
- package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +5 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -7
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +51 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.h +4 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.mm +82 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.h +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +6 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +300 -71
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.cjs +318 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.d.cts +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.cjs +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +66 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +17 -5
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +7 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +235 -240
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +9 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +32 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +28 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +15 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +12 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +4 -1
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/macos/RNDesktopDragView.mm +77 -17
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -8
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +13 -4
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +5 -3
- package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +6 -1
- package/vendor/node_modules/@legendapp/spark-expo-compat/metro.cjs +44 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +20 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/clipboard.ts +40 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/document-picker.ts +52 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +5 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -11
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +122 -334
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/rows.tsx +183 -0
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +82 -14
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.h +1 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +94 -11
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +235 -18
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.mm +216 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.h +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.mm +212 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewUpdates.h +6 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +28 -13
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +17 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.mm +126 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.mm +66 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.mm +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -12
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.mm +109 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +438 -102
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.mm +179 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +9 -8
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkButtonNativeComponent.ts +10 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitView.tsx +99 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitViewNativeComponent.ts +29 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +34 -17
- package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +6 -4
- package/vendor/node_modules/@legendapp/spark-ui/src/checkbox-unavailable.tsx +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +24 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +72 -20
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +18 -12
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +21 -15
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +40 -16
- package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSelectNativeComponent.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/PopoverNativeComponent.ts +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/index.tsx +45 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/ProgressIndicatorNativeComponent.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/index.tsx +32 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/radio-group/RadioGroupNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/select.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/SheetNativeComponent.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/index.tsx +38 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +9 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +17 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +106 -22
- package/vendor/node_modules/@legendapp/spark-ui/src/switch.tsx +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/table/TableNativeComponent.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/table/index.tsx +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +52 -7
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +46 -15
- package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
- /package/{settings-window.ts → ui-settings.ts} +0 -0
|
@@ -11,20 +11,76 @@ using namespace facebook::react;
|
|
|
11
11
|
#if TARGET_OS_OSX
|
|
12
12
|
static NSUserInterfaceItemIdentifier const RNSidebarColumnIdentifier = @"RNSidebarColumn";
|
|
13
13
|
static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSidebarDataCell";
|
|
14
|
+
// Rows inset their title and count by this much from both cell edges; the count keeps this gap from the title.
|
|
15
|
+
static CGFloat const RNSidebarCellInset = 12;
|
|
16
|
+
static CGFloat const RNSidebarCountGap = 6;
|
|
14
17
|
|
|
15
18
|
@class RNSidebar;
|
|
19
|
+
@class RNSidebarItem;
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
// One row of the outline: a data item or a React row, linked to its parent by ID.
|
|
22
|
+
@interface RNSidebarNode : NSObject
|
|
18
23
|
@property (nonatomic, copy) NSString *itemId;
|
|
19
24
|
@property (nonatomic, copy) NSString *title;
|
|
25
|
+
@property (nonatomic, copy) NSString *parentId;
|
|
20
26
|
@property (nonatomic, assign) BOOL selectable;
|
|
27
|
+
@property (nonatomic, assign) BOOL group;
|
|
28
|
+
@property (nonatomic, assign) NSInteger count;
|
|
29
|
+
@property (nonatomic, strong) NSMutableArray<RNSidebarNode *> *children;
|
|
30
|
+
@property (nonatomic, weak) RNSidebarItem *view;
|
|
21
31
|
@end
|
|
22
32
|
|
|
23
|
-
@implementation
|
|
33
|
+
@implementation RNSidebarNode
|
|
34
|
+
- (instancetype)init
|
|
35
|
+
{
|
|
36
|
+
if (self = [super init]) {
|
|
37
|
+
_itemId = @"";
|
|
38
|
+
_title = @"";
|
|
39
|
+
_parentId = @"";
|
|
40
|
+
_selectable = YES;
|
|
41
|
+
_count = -1;
|
|
42
|
+
_children = [NSMutableArray new];
|
|
43
|
+
}
|
|
44
|
+
return self;
|
|
45
|
+
}
|
|
24
46
|
@end
|
|
25
47
|
|
|
26
|
-
|
|
48
|
+
static NSTextField *RNSidebarCountField(void)
|
|
49
|
+
{
|
|
50
|
+
NSTextField *field = [NSTextField labelWithString:@""];
|
|
51
|
+
field.font = [NSFont monospacedDigitSystemFontOfSize:13 weight:NSFontWeightRegular];
|
|
52
|
+
field.textColor = NSColor.secondaryLabelColor;
|
|
53
|
+
field.hidden = YES;
|
|
54
|
+
return field;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static void RNSidebarSetCount(NSTextField *field, NSInteger count)
|
|
58
|
+
{
|
|
59
|
+
field.hidden = count < 0;
|
|
60
|
+
field.stringValue = count < 0 ? @"" : [NSNumberFormatter localizedStringFromNumber:@(count) numberStyle:NSNumberFormatterDecimalStyle];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// The width a visible count takes from the trailing end of a row, including the inset and gap.
|
|
64
|
+
static CGFloat RNSidebarCountReserve(NSTextField *field)
|
|
65
|
+
{
|
|
66
|
+
return field.hidden ? 0 : ceil(field.intrinsicContentSize.width) + RNSidebarCellInset + RNSidebarCountGap;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Places a visible count at the trailing edge, vertically centered.
|
|
70
|
+
static void RNSidebarLayoutCount(NSView *cell, NSTextField *field)
|
|
71
|
+
{
|
|
72
|
+
if (field.hidden) return;
|
|
73
|
+
NSSize size = field.intrinsicContentSize;
|
|
74
|
+
CGFloat width = ceil(size.width);
|
|
75
|
+
BOOL rightToLeft = cell.userInterfaceLayoutDirection == NSUserInterfaceLayoutDirectionRightToLeft;
|
|
76
|
+
CGFloat x = rightToLeft ? RNSidebarCellInset : NSWidth(cell.bounds) - RNSidebarCellInset - width;
|
|
77
|
+
field.frame = NSMakeRect(x, round((NSHeight(cell.bounds) - size.height) / 2), width, size.height);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// A data row's title and optional count, inset at both ends and centered vertically, aligned to the row's
|
|
81
|
+
// layout direction.
|
|
27
82
|
@interface RNSidebarDataCell : NSTableCellView
|
|
83
|
+
@property (nonatomic, strong) NSTextField *countField;
|
|
28
84
|
@end
|
|
29
85
|
|
|
30
86
|
@implementation RNSidebarDataCell
|
|
@@ -32,8 +88,12 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
32
88
|
{
|
|
33
89
|
NSTextField *title = self.textField;
|
|
34
90
|
CGFloat height = title.intrinsicContentSize.height;
|
|
91
|
+
BOOL rightToLeft = self.userInterfaceLayoutDirection == NSUserInterfaceLayoutDirectionRightToLeft;
|
|
92
|
+
CGFloat reserve = MAX(RNSidebarCellInset, RNSidebarCountReserve(_countField));
|
|
35
93
|
title.alignment = RNSparkLeadingTextAlignment(self.userInterfaceLayoutDirection);
|
|
36
|
-
title.frame = NSMakeRect(
|
|
94
|
+
title.frame = NSMakeRect(rightToLeft ? reserve : RNSidebarCellInset, round((NSHeight(self.bounds) - height) / 2),
|
|
95
|
+
MAX(0, NSWidth(self.bounds) - RNSidebarCellInset - reserve), height);
|
|
96
|
+
RNSidebarLayoutCount(self, _countField);
|
|
37
97
|
}
|
|
38
98
|
|
|
39
99
|
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize
|
|
@@ -43,10 +103,23 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
43
103
|
@end
|
|
44
104
|
|
|
45
105
|
@interface RNSidebarRowView : NSTableRowView
|
|
106
|
+
@property (nonatomic, weak) NSOutlineView *outlineView;
|
|
46
107
|
@property (nonatomic, assign) BOOL contextHighlighted;
|
|
47
108
|
@end
|
|
48
109
|
|
|
49
110
|
@implementation RNSidebarRowView
|
|
111
|
+
- (BOOL)isEmphasized
|
|
112
|
+
{
|
|
113
|
+
if (self.outlineView.style == NSTableViewStyleSourceList && self.window) return self.window.isKeyWindow;
|
|
114
|
+
return [super isEmphasized];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
- (void)setEmphasized:(BOOL)emphasized
|
|
118
|
+
{
|
|
119
|
+
if (self.outlineView.style == NSTableViewStyleSourceList && self.window) emphasized = self.window.isKeyWindow;
|
|
120
|
+
[super setEmphasized:emphasized];
|
|
121
|
+
}
|
|
122
|
+
|
|
50
123
|
- (void)setContextHighlighted:(BOOL)contextHighlighted
|
|
51
124
|
{
|
|
52
125
|
_contextHighlighted = contextHighlighted;
|
|
@@ -69,7 +142,7 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
69
142
|
}
|
|
70
143
|
@end
|
|
71
144
|
|
|
72
|
-
@interface RNSidebarTableView :
|
|
145
|
+
@interface RNSidebarTableView : NSOutlineView
|
|
73
146
|
@property (nonatomic, assign) BOOL rightMouseDown;
|
|
74
147
|
@end
|
|
75
148
|
|
|
@@ -95,14 +168,58 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
95
168
|
|
|
96
169
|
@interface RNSidebarItem () <RCTSidebarItemViewProtocol>
|
|
97
170
|
@property (nonatomic, copy) NSString *itemId;
|
|
171
|
+
@property (nonatomic, copy) NSString *parentId;
|
|
98
172
|
@property (nonatomic, assign) BOOL selectable;
|
|
173
|
+
@property (nonatomic, assign) BOOL group;
|
|
174
|
+
@property (nonatomic, assign) NSInteger count;
|
|
99
175
|
@property (nonatomic, assign) CGFloat rowHeight;
|
|
100
176
|
@property (nonatomic, assign) BOOL autoHeight;
|
|
101
177
|
@property (nonatomic, assign) CGFloat measuredHeight;
|
|
178
|
+
@property (nonatomic, assign) CGFloat reportedWidth;
|
|
102
179
|
@property (nonatomic, weak) RNSidebar *sidebar;
|
|
180
|
+
- (void)reportContentWidth:(CGFloat)width;
|
|
181
|
+
@end
|
|
182
|
+
|
|
183
|
+
// Hosts a React row beside its optional count. The row takes the cell's width less the count, which
|
|
184
|
+
// depends on the outline level, so it is reported to the row for Yoga to apply.
|
|
185
|
+
@interface RNSidebarReactCell : NSTableCellView
|
|
186
|
+
@property (nonatomic, strong) RNSidebarItem *item;
|
|
187
|
+
@property (nonatomic, strong) NSTextField *countField;
|
|
188
|
+
- (void)layoutItem;
|
|
189
|
+
@end
|
|
190
|
+
|
|
191
|
+
@implementation RNSidebarReactCell
|
|
192
|
+
- (instancetype)initWithItem:(RNSidebarItem *)item
|
|
193
|
+
{
|
|
194
|
+
if (self = [super initWithFrame:NSZeroRect]) {
|
|
195
|
+
_item = item;
|
|
196
|
+
_countField = RNSidebarCountField();
|
|
197
|
+
[item removeFromSuperview];
|
|
198
|
+
item.autoresizingMask = NSViewNotSizable;
|
|
199
|
+
[self addSubview:item];
|
|
200
|
+
[self addSubview:_countField];
|
|
201
|
+
RNSidebarSetCount(_countField, item.count);
|
|
202
|
+
}
|
|
203
|
+
return self;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
- (void)layoutItem
|
|
207
|
+
{
|
|
208
|
+
CGFloat reserve = RNSidebarCountReserve(_countField);
|
|
209
|
+
CGFloat width = MAX(0, NSWidth(self.bounds) - reserve);
|
|
210
|
+
BOOL rightToLeft = self.userInterfaceLayoutDirection == NSUserInterfaceLayoutDirectionRightToLeft;
|
|
211
|
+
_item.frame = NSMakeRect(rightToLeft ? reserve : 0, 0, width, NSHeight(self.bounds));
|
|
212
|
+
RNSidebarLayoutCount(self, _countField);
|
|
213
|
+
if (NSWidth(self.bounds) > 0) [_item reportContentWidth:width];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize
|
|
217
|
+
{
|
|
218
|
+
[self layoutItem];
|
|
219
|
+
}
|
|
103
220
|
@end
|
|
104
221
|
|
|
105
|
-
@interface RNSidebar () <
|
|
222
|
+
@interface RNSidebar () <NSOutlineViewDataSource, NSOutlineViewDelegate, RCTSidebarViewProtocol>
|
|
106
223
|
- (void)sidebarItemDidChange:(RNSidebarItem *)item;
|
|
107
224
|
- (void)setContextHighlightedItem:(nullable RNSidebarItem *)item;
|
|
108
225
|
@end
|
|
@@ -123,7 +240,9 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
123
240
|
_props = std::make_shared<const SidebarItemProps>();
|
|
124
241
|
#if TARGET_OS_OSX
|
|
125
242
|
_itemId = @"";
|
|
243
|
+
_parentId = @"";
|
|
126
244
|
_selectable = YES;
|
|
245
|
+
_count = -1;
|
|
127
246
|
_rowHeight = 0;
|
|
128
247
|
_autoHeight = NO;
|
|
129
248
|
_measuredHeight = 0;
|
|
@@ -139,9 +258,20 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
139
258
|
return YES;
|
|
140
259
|
}
|
|
141
260
|
|
|
261
|
+
- (void)reportContentWidth:(CGFloat)width
|
|
262
|
+
{
|
|
263
|
+
const auto eventEmitter = std::static_pointer_cast<const SidebarItemEventEmitter>(_eventEmitter);
|
|
264
|
+
if (!eventEmitter || width <= 0 || width == _reportedWidth) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
_reportedWidth = width;
|
|
269
|
+
eventEmitter->onSidebarItemLayout(SidebarItemEventEmitter::OnSidebarItemLayout{.width = width});
|
|
270
|
+
}
|
|
271
|
+
|
|
142
272
|
- (void)rightMouseDown:(NSEvent *)event
|
|
143
273
|
{
|
|
144
|
-
[_sidebar setContextHighlightedItem:_selectable ? self : nil];
|
|
274
|
+
[_sidebar setContextHighlightedItem:_selectable && !_group ? self : nil];
|
|
145
275
|
[super rightMouseDown:event];
|
|
146
276
|
}
|
|
147
277
|
|
|
@@ -181,11 +311,19 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
181
311
|
const auto &newProps = *std::static_pointer_cast<SidebarItemProps const>(props);
|
|
182
312
|
|
|
183
313
|
#if TARGET_OS_OSX
|
|
184
|
-
|
|
314
|
+
NSString *itemId = [NSString stringWithUTF8String:newProps.itemId.c_str()];
|
|
315
|
+
NSString *parentId = [NSString stringWithUTF8String:newProps.parentId.c_str()];
|
|
316
|
+
// Style changes (such as the reported width) leave the outline alone; only row properties reload it.
|
|
317
|
+
const BOOL rowChanged = ![itemId isEqualToString:_itemId] || ![parentId isEqualToString:_parentId] || newProps.selectable != _selectable ||
|
|
318
|
+
newProps.group != _group || newProps.count != _count || newProps.rowHeight != _rowHeight || newProps.autoHeight != _autoHeight;
|
|
319
|
+
_itemId = itemId;
|
|
320
|
+
_parentId = parentId;
|
|
185
321
|
_selectable = newProps.selectable;
|
|
322
|
+
_group = newProps.group;
|
|
323
|
+
_count = newProps.count;
|
|
186
324
|
_rowHeight = newProps.rowHeight;
|
|
187
325
|
_autoHeight = newProps.autoHeight;
|
|
188
|
-
[_sidebar sidebarItemDidChange:self];
|
|
326
|
+
if (rowChanged) [_sidebar sidebarItemDidChange:self];
|
|
189
327
|
#endif
|
|
190
328
|
|
|
191
329
|
[super updateProps:props oldProps:oldProps];
|
|
@@ -205,8 +343,8 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
205
343
|
}
|
|
206
344
|
}
|
|
207
345
|
|
|
208
|
-
if (_sidebar && [self.superview isKindOfClass:
|
|
209
|
-
|
|
346
|
+
if (_sidebar && [self.superview isKindOfClass:RNSidebarReactCell.class]) {
|
|
347
|
+
[(RNSidebarReactCell *)self.superview layoutItem];
|
|
210
348
|
}
|
|
211
349
|
#endif
|
|
212
350
|
}
|
|
@@ -217,10 +355,14 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
217
355
|
|
|
218
356
|
#if TARGET_OS_OSX
|
|
219
357
|
_itemId = @"";
|
|
358
|
+
_parentId = @"";
|
|
220
359
|
_selectable = YES;
|
|
360
|
+
_group = NO;
|
|
361
|
+
_count = -1;
|
|
221
362
|
_rowHeight = 0;
|
|
222
363
|
_autoHeight = NO;
|
|
223
364
|
_measuredHeight = 0;
|
|
365
|
+
_reportedWidth = 0;
|
|
224
366
|
_sidebar = nil;
|
|
225
367
|
#endif
|
|
226
368
|
}
|
|
@@ -238,14 +380,20 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
238
380
|
RNSidebarTableView *_tableView;
|
|
239
381
|
NSTableColumn *_tableColumn;
|
|
240
382
|
NSMutableArray<RNSidebarItem *> *_itemViews;
|
|
241
|
-
NSArray<
|
|
242
|
-
|
|
383
|
+
NSArray<RNSidebarNode *> *_dataItems;
|
|
384
|
+
NSArray<RNSidebarNode *> *_roots;
|
|
385
|
+
NSArray<NSString *> *_selectedIds;
|
|
386
|
+
NSMutableSet<NSString *> *_collapsedIds;
|
|
387
|
+
NSString *_appliedCollapsedIdsJson;
|
|
388
|
+
NSArray<NSString *> *_scrolledSelectedIds;
|
|
389
|
+
NSDictionary<NSString *, RNSidebarNode *> *_nodesById;
|
|
243
390
|
CGFloat _contentInsetTop;
|
|
244
391
|
CGFloat _defaultRowHeight;
|
|
245
392
|
NSSize _lastReportedSize;
|
|
246
|
-
|
|
393
|
+
RNSidebarItem *_contextHighlightedItem;
|
|
247
394
|
CGFloat _lastReportedRowWidth;
|
|
248
395
|
BOOL _updatingSelection;
|
|
396
|
+
BOOL _applyingExpansion;
|
|
249
397
|
BOOL _rightToLeft;
|
|
250
398
|
#else
|
|
251
399
|
RCTPlatformView *_placeholderView;
|
|
@@ -260,11 +408,12 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
260
408
|
#if TARGET_OS_OSX
|
|
261
409
|
_itemViews = [NSMutableArray new];
|
|
262
410
|
_dataItems = @[];
|
|
263
|
-
|
|
411
|
+
_roots = @[];
|
|
412
|
+
_selectedIds = @[];
|
|
413
|
+
_collapsedIds = [NSMutableSet new];
|
|
264
414
|
_contentInsetTop = 0;
|
|
265
415
|
_defaultRowHeight = 28;
|
|
266
416
|
_lastReportedSize = NSZeroSize;
|
|
267
|
-
_contextHighlightedRow = -1;
|
|
268
417
|
_lastReportedRowWidth = 0;
|
|
269
418
|
_rightToLeft = NO;
|
|
270
419
|
self.wantsLayer = YES;
|
|
@@ -298,16 +447,19 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
298
447
|
_tableView.intercellSpacing = NSMakeSize(0, 0);
|
|
299
448
|
_tableView.rowHeight = _defaultRowHeight;
|
|
300
449
|
_tableView.usesAlternatingRowBackgroundColors = NO;
|
|
450
|
+
_tableView.floatsGroupRows = NO;
|
|
451
|
+
_tableView.autoresizesOutlineColumn = NO;
|
|
452
|
+
_tableView.target = self;
|
|
453
|
+
_tableView.doubleAction = @selector(rowDoubleClicked:);
|
|
301
454
|
|
|
302
|
-
|
|
303
|
-
_tableView.style = NSTableViewStyleSourceList;
|
|
304
|
-
}
|
|
455
|
+
_tableView.style = NSTableViewStyleSourceList;
|
|
305
456
|
// Follows the React layout direction (updateLayoutMetrics), not the application's.
|
|
306
457
|
_tableView.userInterfaceLayoutDirection = NSUserInterfaceLayoutDirectionLeftToRight;
|
|
307
458
|
|
|
308
459
|
_tableColumn = [[NSTableColumn alloc] initWithIdentifier:RNSidebarColumnIdentifier];
|
|
309
460
|
_tableColumn.resizingMask = NSTableColumnAutoresizingMask;
|
|
310
461
|
[_tableView addTableColumn:_tableColumn];
|
|
462
|
+
_tableView.outlineTableColumn = _tableColumn;
|
|
311
463
|
|
|
312
464
|
_scrollView = [NSScrollView new];
|
|
313
465
|
_scrollView.autohidesScrollers = YES;
|
|
@@ -321,7 +473,24 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
321
473
|
[self addSubview:_scrollView];
|
|
322
474
|
}
|
|
323
475
|
|
|
324
|
-
|
|
476
|
+
static NSArray<NSString *> *RNSidebarStringsFromJson(std::string const &json)
|
|
477
|
+
{
|
|
478
|
+
NSString *jsonString = [NSString stringWithUTF8String:json.c_str()];
|
|
479
|
+
if (jsonString.length == 0) return @[];
|
|
480
|
+
id parsed = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil];
|
|
481
|
+
if (![parsed isKindOfClass:NSArray.class]) return @[];
|
|
482
|
+
NSMutableArray<NSString *> *strings = [NSMutableArray new];
|
|
483
|
+
for (id value in (NSArray *)parsed) if ([value isKindOfClass:NSString.class]) [strings addObject:value];
|
|
484
|
+
return strings;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
static std::string RNSidebarJsonFromStrings(NSArray<NSString *> *strings)
|
|
488
|
+
{
|
|
489
|
+
NSData *data = [NSJSONSerialization dataWithJSONObject:strings options:NSJSONWritingWithoutEscapingSlashes error:nil];
|
|
490
|
+
return data ? std::string((const char *)data.bytes, data.length) : "[]";
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
- (NSArray<RNSidebarNode *> *)itemsFromJson:(std::string const &)json
|
|
325
494
|
{
|
|
326
495
|
NSString *jsonString = [NSString stringWithUTF8String:json.c_str()];
|
|
327
496
|
if (jsonString.length == 0) {
|
|
@@ -334,7 +503,7 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
334
503
|
return @[];
|
|
335
504
|
}
|
|
336
505
|
|
|
337
|
-
NSMutableArray<
|
|
506
|
+
NSMutableArray<RNSidebarNode *> *items = [NSMutableArray new];
|
|
338
507
|
for (id rawItem in (NSArray *)parsed) {
|
|
339
508
|
if (![rawItem isKindOfClass:NSDictionary.class]) {
|
|
340
509
|
continue;
|
|
@@ -347,10 +516,13 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
347
516
|
continue;
|
|
348
517
|
}
|
|
349
518
|
|
|
350
|
-
|
|
519
|
+
RNSidebarNode *item = [RNSidebarNode new];
|
|
351
520
|
item.itemId = itemId;
|
|
352
521
|
item.title = title;
|
|
353
522
|
item.selectable = ![dictionary[@"selectable"] isKindOfClass:NSNumber.class] || [dictionary[@"selectable"] boolValue];
|
|
523
|
+
item.group = [dictionary[@"group"] isKindOfClass:NSNumber.class] && [dictionary[@"group"] boolValue];
|
|
524
|
+
item.count = [dictionary[@"count"] isKindOfClass:NSNumber.class] ? MAX(-1, [dictionary[@"count"] integerValue]) : -1;
|
|
525
|
+
item.parentId = [dictionary[@"parentId"] isKindOfClass:NSString.class] ? dictionary[@"parentId"] : @"";
|
|
354
526
|
[items addObject:item];
|
|
355
527
|
}
|
|
356
528
|
|
|
@@ -362,37 +534,79 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
362
534
|
return _itemViews.count > 0;
|
|
363
535
|
}
|
|
364
536
|
|
|
365
|
-
|
|
537
|
+
// Links rows to their parents by ID, in row order. A row whose parent is unknown is a root.
|
|
538
|
+
- (NSArray<RNSidebarNode *> *)buildRoots
|
|
366
539
|
{
|
|
367
|
-
|
|
540
|
+
NSMutableArray<RNSidebarNode *> *nodes = [NSMutableArray new];
|
|
541
|
+
if (self.usesReactChildren) {
|
|
542
|
+
for (RNSidebarItem *view in _itemViews) {
|
|
543
|
+
RNSidebarNode *node = [RNSidebarNode new];
|
|
544
|
+
node.itemId = view.itemId;
|
|
545
|
+
node.parentId = view.parentId;
|
|
546
|
+
node.selectable = view.selectable;
|
|
547
|
+
node.group = view.group;
|
|
548
|
+
node.count = view.count;
|
|
549
|
+
node.view = view;
|
|
550
|
+
[nodes addObject:node];
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
553
|
+
for (RNSidebarNode *node in _dataItems) [node.children removeAllObjects];
|
|
554
|
+
[nodes addObjectsFromArray:_dataItems];
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
NSMutableDictionary<NSString *, RNSidebarNode *> *byId = [NSMutableDictionary new];
|
|
558
|
+
NSMutableArray<RNSidebarNode *> *roots = [NSMutableArray new];
|
|
559
|
+
for (RNSidebarNode *node in nodes) {
|
|
560
|
+
RNSidebarNode *parent = node.parentId.length > 0 ? byId[node.parentId] : nil;
|
|
561
|
+
if (parent) [parent.children addObject:node];
|
|
562
|
+
else [roots addObject:node];
|
|
563
|
+
byId[node.itemId] = node;
|
|
564
|
+
}
|
|
565
|
+
_nodesById = byId;
|
|
566
|
+
return roots;
|
|
368
567
|
}
|
|
369
568
|
|
|
370
569
|
- (NSString *)itemIdAtRow:(NSInteger)row
|
|
371
570
|
{
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
return self.usesReactChildren ? _itemViews[row].itemId : _dataItems[row].itemId;
|
|
571
|
+
RNSidebarNode *node = [_tableView itemAtRow:row];
|
|
572
|
+
return node ? node.itemId : @"";
|
|
377
573
|
}
|
|
378
574
|
|
|
379
575
|
- (BOOL)isRowSelectable:(NSInteger)row
|
|
380
576
|
{
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
return self.usesReactChildren ? _itemViews[row].selectable : _dataItems[row].selectable;
|
|
577
|
+
RNSidebarNode *node = [_tableView itemAtRow:row];
|
|
578
|
+
return node && node.selectable && !node.group;
|
|
386
579
|
}
|
|
387
580
|
|
|
388
581
|
- (void)reloadRows
|
|
389
582
|
{
|
|
583
|
+
_roots = [self buildRoots];
|
|
390
584
|
_tableView.rowHeight = _defaultRowHeight;
|
|
391
585
|
[_tableView reloadData];
|
|
586
|
+
[self applyExpansion];
|
|
392
587
|
[self updateSelection];
|
|
393
588
|
[self setNeedsLayout:YES];
|
|
394
589
|
}
|
|
395
590
|
|
|
591
|
+
// Rows are rebuilt on every reload, so expansion is kept by ID and reapplied, outermost first.
|
|
592
|
+
- (void)applyExpansion
|
|
593
|
+
{
|
|
594
|
+
_applyingExpansion = YES;
|
|
595
|
+
NSMutableArray<RNSidebarNode *> *pending = [_roots mutableCopy];
|
|
596
|
+
while (pending.count > 0) {
|
|
597
|
+
RNSidebarNode *node = pending.firstObject;
|
|
598
|
+
[pending removeObjectAtIndex:0];
|
|
599
|
+
if (node.children.count == 0) continue;
|
|
600
|
+
if ([_collapsedIds containsObject:node.itemId]) {
|
|
601
|
+
[_tableView collapseItem:node];
|
|
602
|
+
} else {
|
|
603
|
+
[_tableView expandItem:node];
|
|
604
|
+
[pending addObjectsFromArray:node.children];
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
_applyingExpansion = NO;
|
|
608
|
+
}
|
|
609
|
+
|
|
396
610
|
- (void)sidebarItemDidChange:(RNSidebarItem *)item
|
|
397
611
|
{
|
|
398
612
|
if (![_itemViews containsObject:item]) {
|
|
@@ -402,25 +616,24 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
402
616
|
[self reloadRows];
|
|
403
617
|
}
|
|
404
618
|
|
|
405
|
-
- (
|
|
619
|
+
- (NSInteger)rowForItemView:(RNSidebarItem *)item
|
|
406
620
|
{
|
|
407
|
-
NSInteger row =
|
|
408
|
-
|
|
409
|
-
NSInteger previousRow = _contextHighlightedRow;
|
|
410
|
-
_contextHighlightedRow = nextRow;
|
|
411
|
-
|
|
412
|
-
if (previousRow >= 0) {
|
|
413
|
-
RNSidebarRowView *previousRowView = (RNSidebarRowView *)[_tableView rowViewAtRow:previousRow makeIfNecessary:NO];
|
|
414
|
-
if ([previousRowView isKindOfClass:RNSidebarRowView.class]) {
|
|
415
|
-
previousRowView.contextHighlighted = NO;
|
|
416
|
-
}
|
|
621
|
+
for (NSInteger row = 0; row < _tableView.numberOfRows; row++) {
|
|
622
|
+
if (((RNSidebarNode *)[_tableView itemAtRow:row]).view == item) return row;
|
|
417
623
|
}
|
|
624
|
+
return -1;
|
|
625
|
+
}
|
|
418
626
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
627
|
+
- (void)setContextHighlightedItem:(RNSidebarItem *)item
|
|
628
|
+
{
|
|
629
|
+
RNSidebarItem *previous = _contextHighlightedItem;
|
|
630
|
+
_contextHighlightedItem = item;
|
|
631
|
+
|
|
632
|
+
for (RNSidebarItem *view in @[ previous ?: NSNull.null, item ?: NSNull.null ]) {
|
|
633
|
+
if (![view isKindOfClass:RNSidebarItem.class]) continue;
|
|
634
|
+
NSInteger row = [self rowForItemView:view];
|
|
635
|
+
RNSidebarRowView *rowView = row < 0 ? nil : (RNSidebarRowView *)[_tableView rowViewAtRow:row makeIfNecessary:NO];
|
|
636
|
+
if ([rowView isKindOfClass:RNSidebarRowView.class]) rowView.contextHighlighted = view == item;
|
|
424
637
|
}
|
|
425
638
|
}
|
|
426
639
|
|
|
@@ -430,22 +643,38 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
430
643
|
return;
|
|
431
644
|
}
|
|
432
645
|
|
|
433
|
-
|
|
434
|
-
for (
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
646
|
+
NSMutableIndexSet *rows = [NSMutableIndexSet new];
|
|
647
|
+
for (NSString *selectedId in _selectedIds) {
|
|
648
|
+
for (NSInteger row = 0; row < _tableView.numberOfRows; row++) {
|
|
649
|
+
if ([[self itemIdAtRow:row] isEqualToString:selectedId]) {
|
|
650
|
+
[rows addIndex:(NSUInteger)row];
|
|
651
|
+
break;
|
|
652
|
+
}
|
|
438
653
|
}
|
|
654
|
+
if (!_tableView.allowsMultipleSelection) break;
|
|
439
655
|
}
|
|
440
656
|
|
|
441
657
|
_updatingSelection = YES;
|
|
442
|
-
if (
|
|
443
|
-
[_tableView selectRowIndexes:
|
|
444
|
-
[_tableView scrollRowToVisible:selectedRow];
|
|
658
|
+
if (rows.count > 0) {
|
|
659
|
+
[_tableView selectRowIndexes:rows byExtendingSelection:NO];
|
|
445
660
|
} else {
|
|
446
661
|
[_tableView deselectAll:nil];
|
|
447
662
|
}
|
|
448
663
|
_updatingSelection = NO;
|
|
664
|
+
[self scrollToSelectionIfNeeded];
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// Reloads reapply an unchanged selection; only a new one scrolls into view. Before the list has a height,
|
|
668
|
+
// scrolling would push the first rows out of view, so it waits for the first layout.
|
|
669
|
+
- (void)scrollToSelectionIfNeeded
|
|
670
|
+
{
|
|
671
|
+
if ([_selectedIds isEqualToArray:_scrolledSelectedIds] || NSHeight(_scrollView.contentView.bounds) <= 0) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
_scrolledSelectedIds = _selectedIds;
|
|
676
|
+
NSInteger lastRow = _tableView.selectedRow;
|
|
677
|
+
if (lastRow >= 0) [_tableView scrollRowToVisible:lastRow];
|
|
449
678
|
}
|
|
450
679
|
|
|
451
680
|
- (void)reportLayoutIfNeeded
|
|
@@ -470,6 +699,7 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
470
699
|
|
|
471
700
|
// React rows are laid out by Yoga, so their width is reported for the Sidebar to apply: the column the
|
|
472
701
|
// source-list table fits inside its clip view, which excludes the row insets and a legacy scroller.
|
|
702
|
+
// Rows that are indented or show a count report their own, narrower width (RNSidebarReactCell).
|
|
473
703
|
- (void)reportRowWidthIfNeeded
|
|
474
704
|
{
|
|
475
705
|
CGFloat width = _tableColumn.width;
|
|
@@ -482,7 +712,7 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
482
712
|
eventEmitter->onSidebarRowLayout(SidebarEventEmitter::OnSidebarRowLayout{.width = width});
|
|
483
713
|
}
|
|
484
714
|
|
|
485
|
-
- (void)
|
|
715
|
+
- (void)outlineViewColumnDidResize:(NSNotification *)notification
|
|
486
716
|
{
|
|
487
717
|
[self reportRowWidthIfNeeded];
|
|
488
718
|
}
|
|
@@ -509,6 +739,7 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
509
739
|
RNSidebarItem *item = (RNSidebarItem *)childComponentView;
|
|
510
740
|
[item removeFromSuperview];
|
|
511
741
|
item.sidebar = nil;
|
|
742
|
+
if (_contextHighlightedItem == item) _contextHighlightedItem = nil;
|
|
512
743
|
[_itemViews removeObject:item];
|
|
513
744
|
[self reloadRows];
|
|
514
745
|
return;
|
|
@@ -517,104 +748,192 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
517
748
|
[super unmountChildComponentView:childComponentView index:index];
|
|
518
749
|
}
|
|
519
750
|
|
|
520
|
-
- (NSInteger)
|
|
751
|
+
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
|
|
521
752
|
{
|
|
522
|
-
return (NSInteger)
|
|
753
|
+
return (NSInteger)(item ? ((RNSidebarNode *)item).children.count : _roots.count);
|
|
523
754
|
}
|
|
524
755
|
|
|
525
|
-
- (
|
|
756
|
+
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
|
|
526
757
|
{
|
|
527
|
-
|
|
758
|
+
return item ? ((RNSidebarNode *)item).children[index] : _roots[index];
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
|
|
762
|
+
{
|
|
763
|
+
return ((RNSidebarNode *)item).children.count > 0;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item
|
|
767
|
+
{
|
|
768
|
+
return ((RNSidebarNode *)item).group;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
- (CGFloat)outlineView:(NSOutlineView *)outlineView heightOfRowByItem:(id)item
|
|
772
|
+
{
|
|
773
|
+
RNSidebarItem *view = ((RNSidebarNode *)item).view;
|
|
774
|
+
if (!view) {
|
|
528
775
|
return _defaultRowHeight;
|
|
529
776
|
}
|
|
530
777
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return item.rowHeight;
|
|
778
|
+
if (view.rowHeight > 0) {
|
|
779
|
+
return view.rowHeight;
|
|
534
780
|
}
|
|
535
781
|
|
|
536
|
-
if (
|
|
537
|
-
if (
|
|
538
|
-
return
|
|
782
|
+
if (view.autoHeight) {
|
|
783
|
+
if (view.measuredHeight > 0) {
|
|
784
|
+
return view.measuredHeight;
|
|
539
785
|
}
|
|
540
786
|
|
|
541
|
-
if (
|
|
542
|
-
return
|
|
787
|
+
if (view.frame.size.height > 0) {
|
|
788
|
+
return view.frame.size.height;
|
|
543
789
|
}
|
|
544
790
|
}
|
|
545
791
|
|
|
546
792
|
return _defaultRowHeight;
|
|
547
793
|
}
|
|
548
794
|
|
|
549
|
-
- (NSView *)
|
|
550
|
-
viewForTableColumn:(NSTableColumn *)tableColumn
|
|
551
|
-
row:(NSInteger)row
|
|
795
|
+
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
|
552
796
|
{
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
if (self.usesReactChildren) {
|
|
558
|
-
NSTableCellView *cell = [NSTableCellView new];
|
|
559
|
-
RNSidebarItem *item = _itemViews[row];
|
|
560
|
-
[item removeFromSuperview];
|
|
561
|
-
item.frame = cell.bounds;
|
|
562
|
-
item.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
563
|
-
[cell addSubview:item];
|
|
797
|
+
RNSidebarNode *node = item;
|
|
798
|
+
if (node.view) {
|
|
799
|
+
RNSidebarReactCell *cell = [[RNSidebarReactCell alloc] initWithItem:node.view];
|
|
800
|
+
cell.userInterfaceLayoutDirection = _tableView.userInterfaceLayoutDirection;
|
|
564
801
|
return cell;
|
|
565
802
|
}
|
|
566
803
|
|
|
567
|
-
RNSidebarDataCell *cell = [
|
|
804
|
+
RNSidebarDataCell *cell = [outlineView makeViewWithIdentifier:RNSidebarDataCellIdentifier owner:self];
|
|
568
805
|
if (!cell) {
|
|
569
806
|
cell = [RNSidebarDataCell new];
|
|
570
807
|
cell.identifier = RNSidebarDataCellIdentifier;
|
|
571
808
|
|
|
572
809
|
NSTextField *textField = [NSTextField labelWithString:@""];
|
|
573
|
-
textField.font = [NSFont systemFontOfSize:13 weight:NSFontWeightRegular];
|
|
574
810
|
textField.lineBreakMode = NSLineBreakByTruncatingTail;
|
|
575
|
-
textField.textColor = NSColor.labelColor;
|
|
576
811
|
|
|
577
812
|
cell.textField = textField;
|
|
813
|
+
cell.countField = RNSidebarCountField();
|
|
578
814
|
[cell addSubview:textField];
|
|
815
|
+
[cell addSubview:cell.countField];
|
|
579
816
|
}
|
|
580
817
|
|
|
818
|
+
// Group rows use the source list's section-header type: 11 pt semibold, secondary label color.
|
|
819
|
+
cell.textField.font = node.group ? [NSFont systemFontOfSize:11 weight:NSFontWeightSemibold] : [NSFont systemFontOfSize:13 weight:NSFontWeightRegular];
|
|
820
|
+
cell.textField.textColor = node.group ? NSColor.secondaryLabelColor : NSColor.labelColor;
|
|
581
821
|
cell.userInterfaceLayoutDirection = _tableView.userInterfaceLayoutDirection;
|
|
582
|
-
cell.textField.stringValue =
|
|
822
|
+
cell.textField.stringValue = node.title;
|
|
823
|
+
RNSidebarSetCount(cell.countField, node.count);
|
|
583
824
|
[cell layoutTitle];
|
|
584
825
|
return cell;
|
|
585
826
|
}
|
|
586
827
|
|
|
587
|
-
- (BOOL)
|
|
828
|
+
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
|
|
588
829
|
{
|
|
589
830
|
if (_tableView.rightMouseDown) {
|
|
590
831
|
return NO;
|
|
591
832
|
}
|
|
592
833
|
|
|
593
|
-
|
|
834
|
+
RNSidebarNode *node = item;
|
|
835
|
+
return node.selectable && !node.group;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
- (NSString *)outlineView:(NSOutlineView *)outlineView typeSelectStringForTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
|
839
|
+
{
|
|
840
|
+
RNSidebarNode *node = item;
|
|
841
|
+
return node.view ? node.view.accessibilityLabel : node.title;
|
|
594
842
|
}
|
|
595
843
|
|
|
596
|
-
- (NSTableRowView *)
|
|
844
|
+
- (NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item
|
|
597
845
|
{
|
|
598
846
|
RNSidebarRowView *rowView = [RNSidebarRowView new];
|
|
599
|
-
rowView.
|
|
847
|
+
rowView.outlineView = outlineView;
|
|
848
|
+
RNSidebarItem *view = ((RNSidebarNode *)item).view;
|
|
849
|
+
rowView.contextHighlighted = view && view == _contextHighlightedItem;
|
|
600
850
|
return rowView;
|
|
601
851
|
}
|
|
602
852
|
|
|
603
|
-
- (void)
|
|
853
|
+
- (void)outlineViewSelectionDidChange:(NSNotification *)notification
|
|
604
854
|
{
|
|
605
855
|
if (_updatingSelection) {
|
|
606
856
|
return;
|
|
607
857
|
}
|
|
608
858
|
|
|
609
|
-
|
|
610
|
-
|
|
859
|
+
NSMutableArray<NSString *> *visible = [NSMutableArray new];
|
|
860
|
+
[_tableView.selectedRowIndexes enumerateIndexesUsingBlock:^(NSUInteger row, BOOL *stop) {
|
|
861
|
+
[visible addObject:[self itemIdAtRow:(NSInteger)row]];
|
|
862
|
+
}];
|
|
863
|
+
NSMutableArray<NSString *> *hidden = [NSMutableArray new], *shown = [NSMutableArray new];
|
|
864
|
+
for (NSString *selectedId in _selectedIds) {
|
|
865
|
+
RNSidebarNode *node = _nodesById[selectedId];
|
|
866
|
+
[(node && [_tableView rowForItem:node] < 0 ? hidden : shown) addObject:selectedId];
|
|
867
|
+
}
|
|
868
|
+
// A collapsing section deselects the rows it hides; the selection itself is unchanged and returns on expand.
|
|
869
|
+
if ([[NSSet setWithArray:visible] isEqualToSet:[NSSet setWithArray:shown]]) {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// In multiple selection, rows inside collapsed sections stay selected while the user changes the visible ones.
|
|
874
|
+
NSMutableArray<NSString *> *ids = _tableView.allowsMultipleSelection ? hidden : [NSMutableArray new];
|
|
875
|
+
[ids addObjectsFromArray:visible];
|
|
876
|
+
_selectedIds = ids;
|
|
611
877
|
const auto eventEmitter = std::static_pointer_cast<const SidebarEventEmitter>(_eventEmitter);
|
|
612
878
|
if (eventEmitter) {
|
|
613
879
|
eventEmitter->onSidebarSelectionChange(SidebarEventEmitter::OnSidebarSelectionChange{
|
|
614
|
-
.id = std::string(
|
|
880
|
+
.id = std::string([self itemIdAtRow:_tableView.selectedRow].UTF8String),
|
|
881
|
+
.idsJson = RNSidebarJsonFromStrings(ids),
|
|
615
882
|
});
|
|
616
883
|
}
|
|
617
884
|
}
|
|
885
|
+
|
|
886
|
+
- (void)expansionDidChange:(NSNotification *)notification expanded:(BOOL)expanded
|
|
887
|
+
{
|
|
888
|
+
if (_applyingExpansion) {
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
RNSidebarNode *node = notification.userInfo[@"NSObject"];
|
|
893
|
+
NSString *itemId = node.itemId;
|
|
894
|
+
// AppKit also collapses and restores the rows nested in a section the user toggles; those keep their own
|
|
895
|
+
// state. Only a change of state, on a row whose ancestors are expanded, is the user's.
|
|
896
|
+
if (itemId.length == 0 || expanded != [_collapsedIds containsObject:itemId]) return;
|
|
897
|
+
for (id parent = [_tableView parentForItem:node]; parent; parent = [_tableView parentForItem:parent]) {
|
|
898
|
+
if (![_tableView isItemExpanded:parent]) return;
|
|
899
|
+
}
|
|
900
|
+
if (expanded) [_collapsedIds removeObject:itemId];
|
|
901
|
+
else [_collapsedIds addObject:itemId];
|
|
902
|
+
// Rows inside an expanded section were collapsed with it or never expanded: restore their own state.
|
|
903
|
+
if (expanded) [self applyExpansion];
|
|
904
|
+
|
|
905
|
+
const auto eventEmitter = std::static_pointer_cast<const SidebarEventEmitter>(_eventEmitter);
|
|
906
|
+
if (eventEmitter) {
|
|
907
|
+
eventEmitter->onSidebarExpandedChange(SidebarEventEmitter::OnSidebarExpandedChange{
|
|
908
|
+
.expanded = (bool)expanded,
|
|
909
|
+
.id = std::string(itemId.UTF8String),
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
- (void)outlineViewItemDidExpand:(NSNotification *)notification
|
|
915
|
+
{
|
|
916
|
+
[self expansionDidChange:notification expanded:YES];
|
|
917
|
+
[self updateSelection];
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
- (void)outlineViewItemDidCollapse:(NSNotification *)notification
|
|
921
|
+
{
|
|
922
|
+
[self expansionDidChange:notification expanded:NO];
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
- (void)rowDoubleClicked:(id)sender
|
|
926
|
+
{
|
|
927
|
+
NSInteger row = _tableView.clickedRow;
|
|
928
|
+
const auto eventEmitter = std::static_pointer_cast<const SidebarEventEmitter>(_eventEmitter);
|
|
929
|
+
if (row < 0 || !eventEmitter) {
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
eventEmitter->onSidebarDoubleClick(SidebarEventEmitter::OnSidebarDoubleClick{
|
|
934
|
+
.id = std::string([self itemIdAtRow:row].UTF8String),
|
|
935
|
+
});
|
|
936
|
+
}
|
|
618
937
|
#endif
|
|
619
938
|
|
|
620
939
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
@@ -628,12 +947,24 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
628
947
|
_contentInsetTop = newProps.contentInsetTop;
|
|
629
948
|
_defaultRowHeight = newProps.defaultRowHeight > 0 ? newProps.defaultRowHeight : 28;
|
|
630
949
|
const BOOL itemsChanged = !previous || newProps.itemsJson != previous->itemsJson;
|
|
631
|
-
|
|
950
|
+
// Only a change of the collapsed IDs is applied, so an unchanged prop never undoes a user's toggle.
|
|
951
|
+
// Compared with the last applied value rather than oldProps, which is null when a moved view is re-inserted.
|
|
952
|
+
NSString *collapsedIdsJson = [NSString stringWithUTF8String:newProps.collapsedIdsJson.c_str()];
|
|
953
|
+
const BOOL expansionChanged = ![collapsedIdsJson isEqualToString:_appliedCollapsedIdsJson];
|
|
954
|
+
_appliedCollapsedIdsJson = collapsedIdsJson;
|
|
955
|
+
const BOOL rowsChanged = itemsChanged || expansionChanged || newProps.defaultRowHeight != previous->defaultRowHeight;
|
|
632
956
|
if (itemsChanged) _dataItems = [self itemsFromJson:newProps.itemsJson];
|
|
633
|
-
|
|
957
|
+
if (expansionChanged) _collapsedIds = [NSMutableSet setWithArray:RNSidebarStringsFromJson(newProps.collapsedIdsJson)];
|
|
958
|
+
_selectedIds = RNSidebarStringsFromJson(newProps.selectedIdsJson);
|
|
959
|
+
_tableView.allowsMultipleSelection = newProps.allowsMultipleSelection;
|
|
634
960
|
_scrollView.contentInsets = NSEdgeInsetsMake(_contentInsetTop, 0, 0, 0);
|
|
961
|
+
if (!previous || newProps.listStyle != previous->listStyle) {
|
|
962
|
+
_tableView.style = newProps.listStyle == SidebarListStyle::Plain ? NSTableViewStylePlain : NSTableViewStyleSourceList;
|
|
963
|
+
[self setNeedsLayout:YES];
|
|
964
|
+
}
|
|
635
965
|
if (rowsChanged) [self reloadRows];
|
|
636
|
-
else if (newProps.
|
|
966
|
+
else if (newProps.selectedIdsJson != previous->selectedIdsJson || newProps.selectionRevision != previous->selectionRevision ||
|
|
967
|
+
newProps.allowsMultipleSelection != previous->allowsMultipleSelection) [self updateSelection];
|
|
637
968
|
if (!previous || newProps.contentInsetTop != previous->contentInsetTop) [self setNeedsLayout:YES];
|
|
638
969
|
#endif
|
|
639
970
|
|
|
@@ -670,6 +1001,7 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
670
1001
|
// source-list row insets past its trailing edge.
|
|
671
1002
|
_scrollView.frame = self.bounds;
|
|
672
1003
|
[_scrollView tile];
|
|
1004
|
+
[self scrollToSelectionIfNeeded];
|
|
673
1005
|
[self reportLayoutIfNeeded];
|
|
674
1006
|
[self reportRowWidthIfNeeded];
|
|
675
1007
|
#else
|
|
@@ -688,13 +1020,17 @@ static NSUserInterfaceItemIdentifier const RNSidebarDataCellIdentifier = @"RNSid
|
|
|
688
1020
|
}
|
|
689
1021
|
[_itemViews removeAllObjects];
|
|
690
1022
|
_dataItems = @[];
|
|
691
|
-
|
|
1023
|
+
_selectedIds = @[];
|
|
1024
|
+
[_collapsedIds removeAllObjects];
|
|
1025
|
+
_appliedCollapsedIdsJson = nil;
|
|
1026
|
+
_scrolledSelectedIds = nil;
|
|
692
1027
|
_contentInsetTop = 0;
|
|
693
1028
|
_defaultRowHeight = 28;
|
|
694
1029
|
_lastReportedSize = NSZeroSize;
|
|
695
1030
|
_lastReportedRowWidth = 0;
|
|
696
|
-
|
|
1031
|
+
_contextHighlightedItem = nil;
|
|
697
1032
|
_updatingSelection = NO;
|
|
1033
|
+
_tableView.allowsMultipleSelection = NO;
|
|
698
1034
|
_scrollView.contentInsets = NSEdgeInsetsZero;
|
|
699
1035
|
[self reloadRows];
|
|
700
1036
|
#endif
|