@onekeyfe/react-native-native-list 3.0.105
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/README.md +342 -0
- package/android/CMakeLists.txt +20 -0
- package/android/build.gradle +105 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +125 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +165 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +147 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListPackage.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +2939 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1794 -0
- package/common/fonts/Roobert-Bold.ttf +0 -0
- package/common/fonts/Roobert-Medium.ttf +0 -0
- package/common/fonts/Roobert-Regular.ttf +0 -0
- package/common/fonts/Roobert-SemiBold.ttf +0 -0
- package/docs/DESIGN.md +129 -0
- package/ios/HybridNativeList.swift +131 -0
- package/ios/NativeListCell.swift +2858 -0
- package/ios/NativeListDesignAssets.swift +110 -0
- package/ios/NativeListModels.swift +215 -0
- package/ios/RNCNativeListView.swift +1737 -0
- package/ios/Resources/NativeListIcons.xcassets/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +1 -0
- package/lib/module/NativeList.js +183 -0
- package/lib/module/NativeList.nitro.js +4 -0
- package/lib/module/NativeList.types.js +4 -0
- package/lib/module/NativeList.web.js +167 -0
- package/lib/module/index.js +6 -0
- package/lib/module/models.js +2 -0
- package/lib/module/package.json +1 -0
- package/lib/module/scrolling.js +121 -0
- package/lib/module/selection.js +85 -0
- package/lib/module/validation.js +562 -0
- package/lib/module/web/NativeListWebEngine.js +2238 -0
- package/lib/nitrogen/generated/.gitattributes +1 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +201 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +84 -0
- package/lib/nitrogen/generated/android/c++/JNativeListScrollAlignment.hpp +64 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +104 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.hpp +54 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_std__string.kt +78 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +177 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollAlignment.kt +25 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/nativelistOnLoad.kt +35 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +96 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/android/nativelist+autolinking.cmake +83 -0
- package/lib/nitrogen/generated/android/nativelist+autolinking.gradle +27 -0
- package/lib/nitrogen/generated/android/nativelistOnLoad.cpp +58 -0
- package/lib/nitrogen/generated/android/nativelistOnLoad.hpp +34 -0
- package/lib/nitrogen/generated/ios/NativeListModule+autolinking.rb +62 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +41 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +91 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +49 -0
- package/lib/nitrogen/generated/ios/NativeListModuleAutolinking.mm +33 -0
- package/lib/nitrogen/generated/ios/NativeListModuleAutolinking.swift +26 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +180 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +180 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +69 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +447 -0
- package/lib/nitrogen/generated/ios/swift/NativeListScrollAlignment.swift +48 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +87 -0
- package/lib/nitrogen/generated/shared/c++/NativeListScrollAlignment.hpp +84 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +46 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +103 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +16 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeList.d.ts +18 -0
- package/lib/typescript/src/NativeList.nitro.d.ts +29 -0
- package/lib/typescript/src/NativeList.types.d.ts +87 -0
- package/lib/typescript/src/NativeList.web.d.ts +19 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/models.d.ts +456 -0
- package/lib/typescript/src/scrolling.d.ts +32 -0
- package/lib/typescript/src/selection.d.ts +27 -0
- package/lib/typescript/src/validation.d.ts +7 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +203 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +201 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +84 -0
- package/nitrogen/generated/android/c++/JNativeListScrollAlignment.hpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +104 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/Func_void_std__string.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +177 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollAlignment.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/nativelistOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/views/HybridNativeListStateUpdater.kt +23 -0
- package/nitrogen/generated/android/nativelist+autolinking.cmake +83 -0
- package/nitrogen/generated/android/nativelist+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nativelistOnLoad.cpp +58 -0
- package/nitrogen/generated/android/nativelistOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NativeListModule+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.cpp +41 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Bridge.hpp +91 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +49 -0
- package/nitrogen/generated/ios/NativeListModuleAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NativeListModuleAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +180 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +180 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +69 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +447 -0
- package/nitrogen/generated/ios/swift/NativeListScrollAlignment.swift +48 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +87 -0
- package/nitrogen/generated/shared/c++/NativeListScrollAlignment.hpp +84 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +46 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +103 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +16 -0
- package/package.json +126 -0
- package/react-native-native-list.podspec +38 -0
- package/react-native.config.js +19 -0
- package/src/NativeList.nitro.ts +48 -0
- package/src/NativeList.tsx +298 -0
- package/src/NativeList.types.ts +125 -0
- package/src/NativeList.web.tsx +258 -0
- package/src/index.ts +35 -0
- package/src/models.ts +604 -0
- package/src/scrolling.ts +189 -0
- package/src/selection.ts +159 -0
- package/src/validation.ts +877 -0
- package/src/web/NativeListWebEngine.ts +3767 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A class implementation that bridges HybridNativeListSpec over to C++.
|
|
12
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
13
|
+
*
|
|
14
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
15
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
16
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
17
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
18
|
+
*/
|
|
19
|
+
open class HybridNativeListSpec_cxx {
|
|
20
|
+
/**
|
|
21
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::nativelist::bridge::swift`)
|
|
22
|
+
* from `NativeListModule-Swift-Cxx-Bridge.hpp`.
|
|
23
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
24
|
+
*/
|
|
25
|
+
public typealias bridge = margelo.nitro.nativelist.bridge.swift
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Holds an instance of the `HybridNativeListSpec` Swift protocol.
|
|
29
|
+
*/
|
|
30
|
+
private var __implementation: any HybridNativeListSpec
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
34
|
+
*/
|
|
35
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridNativeListSpec_
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create a new `HybridNativeListSpec_cxx` that wraps the given `HybridNativeListSpec`.
|
|
39
|
+
* All properties and methods bridge to C++ types.
|
|
40
|
+
*/
|
|
41
|
+
public init(_ implementation: any HybridNativeListSpec) {
|
|
42
|
+
self.__implementation = implementation
|
|
43
|
+
self.__cxxPart = .init()
|
|
44
|
+
/* no base class */
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the actual `HybridNativeListSpec` instance this class wraps.
|
|
49
|
+
*/
|
|
50
|
+
@inline(__always)
|
|
51
|
+
public func getHybridNativeListSpec() -> any HybridNativeListSpec {
|
|
52
|
+
return __implementation
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
57
|
+
* This acquires one additional strong reference on the object!
|
|
58
|
+
*/
|
|
59
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
60
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Casts an unsafe pointer to a `HybridNativeListSpec_cxx`.
|
|
65
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridNativeListSpec_cxx>`.
|
|
66
|
+
* This removes one strong reference from the object!
|
|
67
|
+
*/
|
|
68
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridNativeListSpec_cxx {
|
|
69
|
+
return Unmanaged<HybridNativeListSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
74
|
+
* The C++ part is a `std::shared_ptr<HybridNativeListSpec>`.
|
|
75
|
+
*/
|
|
76
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridNativeListSpec_ {
|
|
77
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
78
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
79
|
+
return cachedCxxPart
|
|
80
|
+
} else {
|
|
81
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridNativeListSpec_(self.toUnsafe())
|
|
82
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridNativeListSpec_(newCxxPart)
|
|
83
|
+
return newCxxPart
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
91
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
92
|
+
*/
|
|
93
|
+
@inline(__always)
|
|
94
|
+
public var memorySize: Int {
|
|
95
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Compares this object with the given [other] object for reference equality.
|
|
100
|
+
*/
|
|
101
|
+
@inline(__always)
|
|
102
|
+
public func equals(other: HybridNativeListSpec_cxx) -> Bool {
|
|
103
|
+
return self.__implementation === other.__implementation
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Call dispose() on the Swift class.
|
|
108
|
+
* This _may_ be called manually from JS.
|
|
109
|
+
*/
|
|
110
|
+
@inline(__always)
|
|
111
|
+
public func dispose() {
|
|
112
|
+
self.__implementation.dispose()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Call toString() on the Swift class.
|
|
117
|
+
*/
|
|
118
|
+
@inline(__always)
|
|
119
|
+
public func toString() -> String {
|
|
120
|
+
return self.__implementation.toString()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Properties
|
|
124
|
+
public final var snapshotJson: std.string {
|
|
125
|
+
@inline(__always)
|
|
126
|
+
get {
|
|
127
|
+
return std.string(self.__implementation.snapshotJson)
|
|
128
|
+
}
|
|
129
|
+
@inline(__always)
|
|
130
|
+
set {
|
|
131
|
+
self.__implementation.snapshotJson = String(newValue)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public final var onRowAction: bridge.std__optional_std__function_void_const_std__string_____payloadJson______ {
|
|
136
|
+
@inline(__always)
|
|
137
|
+
get {
|
|
138
|
+
return { () -> bridge.std__optional_std__function_void_const_std__string_____payloadJson______ in
|
|
139
|
+
if let __unwrappedValue = self.__implementation.onRowAction {
|
|
140
|
+
return bridge.create_std__optional_std__function_void_const_std__string_____payloadJson______({ () -> bridge.Func_void_std__string in
|
|
141
|
+
let __closureWrapper = Func_void_std__string(__unwrappedValue)
|
|
142
|
+
return bridge.create_Func_void_std__string(__closureWrapper.toUnsafe())
|
|
143
|
+
}())
|
|
144
|
+
} else {
|
|
145
|
+
return .init()
|
|
146
|
+
}
|
|
147
|
+
}()
|
|
148
|
+
}
|
|
149
|
+
@inline(__always)
|
|
150
|
+
set {
|
|
151
|
+
self.__implementation.onRowAction = { () -> ((_ payloadJson: String) -> Void)? in
|
|
152
|
+
if bridge.has_value_std__optional_std__function_void_const_std__string_____payloadJson______(newValue) {
|
|
153
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_std__string_____payloadJson______(newValue)
|
|
154
|
+
return { () -> (String) -> Void in
|
|
155
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string(__unwrapped)
|
|
156
|
+
return { (__payloadJson: String) -> Void in
|
|
157
|
+
__wrappedFunction.call(std.string(__payloadJson))
|
|
158
|
+
}
|
|
159
|
+
}()
|
|
160
|
+
} else {
|
|
161
|
+
return nil
|
|
162
|
+
}
|
|
163
|
+
}()
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public final var onActionAnchorInvalidated: bridge.std__optional_std__function_void_const_std__string_____payloadJson______ {
|
|
168
|
+
@inline(__always)
|
|
169
|
+
get {
|
|
170
|
+
return { () -> bridge.std__optional_std__function_void_const_std__string_____payloadJson______ in
|
|
171
|
+
if let __unwrappedValue = self.__implementation.onActionAnchorInvalidated {
|
|
172
|
+
return bridge.create_std__optional_std__function_void_const_std__string_____payloadJson______({ () -> bridge.Func_void_std__string in
|
|
173
|
+
let __closureWrapper = Func_void_std__string(__unwrappedValue)
|
|
174
|
+
return bridge.create_Func_void_std__string(__closureWrapper.toUnsafe())
|
|
175
|
+
}())
|
|
176
|
+
} else {
|
|
177
|
+
return .init()
|
|
178
|
+
}
|
|
179
|
+
}()
|
|
180
|
+
}
|
|
181
|
+
@inline(__always)
|
|
182
|
+
set {
|
|
183
|
+
self.__implementation.onActionAnchorInvalidated = { () -> ((_ payloadJson: String) -> Void)? in
|
|
184
|
+
if bridge.has_value_std__optional_std__function_void_const_std__string_____payloadJson______(newValue) {
|
|
185
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_std__string_____payloadJson______(newValue)
|
|
186
|
+
return { () -> (String) -> Void in
|
|
187
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string(__unwrapped)
|
|
188
|
+
return { (__payloadJson: String) -> Void in
|
|
189
|
+
__wrappedFunction.call(std.string(__payloadJson))
|
|
190
|
+
}
|
|
191
|
+
}()
|
|
192
|
+
} else {
|
|
193
|
+
return nil
|
|
194
|
+
}
|
|
195
|
+
}()
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
public final var onSelectionDelta: bridge.std__optional_std__function_void_const_std__string_____payloadJson______ {
|
|
200
|
+
@inline(__always)
|
|
201
|
+
get {
|
|
202
|
+
return { () -> bridge.std__optional_std__function_void_const_std__string_____payloadJson______ in
|
|
203
|
+
if let __unwrappedValue = self.__implementation.onSelectionDelta {
|
|
204
|
+
return bridge.create_std__optional_std__function_void_const_std__string_____payloadJson______({ () -> bridge.Func_void_std__string in
|
|
205
|
+
let __closureWrapper = Func_void_std__string(__unwrappedValue)
|
|
206
|
+
return bridge.create_Func_void_std__string(__closureWrapper.toUnsafe())
|
|
207
|
+
}())
|
|
208
|
+
} else {
|
|
209
|
+
return .init()
|
|
210
|
+
}
|
|
211
|
+
}()
|
|
212
|
+
}
|
|
213
|
+
@inline(__always)
|
|
214
|
+
set {
|
|
215
|
+
self.__implementation.onSelectionDelta = { () -> ((_ payloadJson: String) -> Void)? in
|
|
216
|
+
if bridge.has_value_std__optional_std__function_void_const_std__string_____payloadJson______(newValue) {
|
|
217
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_std__string_____payloadJson______(newValue)
|
|
218
|
+
return { () -> (String) -> Void in
|
|
219
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string(__unwrapped)
|
|
220
|
+
return { (__payloadJson: String) -> Void in
|
|
221
|
+
__wrappedFunction.call(std.string(__payloadJson))
|
|
222
|
+
}
|
|
223
|
+
}()
|
|
224
|
+
} else {
|
|
225
|
+
return nil
|
|
226
|
+
}
|
|
227
|
+
}()
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
public final var onReorder: bridge.std__optional_std__function_void_const_std__string_____payloadJson______ {
|
|
232
|
+
@inline(__always)
|
|
233
|
+
get {
|
|
234
|
+
return { () -> bridge.std__optional_std__function_void_const_std__string_____payloadJson______ in
|
|
235
|
+
if let __unwrappedValue = self.__implementation.onReorder {
|
|
236
|
+
return bridge.create_std__optional_std__function_void_const_std__string_____payloadJson______({ () -> bridge.Func_void_std__string in
|
|
237
|
+
let __closureWrapper = Func_void_std__string(__unwrappedValue)
|
|
238
|
+
return bridge.create_Func_void_std__string(__closureWrapper.toUnsafe())
|
|
239
|
+
}())
|
|
240
|
+
} else {
|
|
241
|
+
return .init()
|
|
242
|
+
}
|
|
243
|
+
}()
|
|
244
|
+
}
|
|
245
|
+
@inline(__always)
|
|
246
|
+
set {
|
|
247
|
+
self.__implementation.onReorder = { () -> ((_ payloadJson: String) -> Void)? in
|
|
248
|
+
if bridge.has_value_std__optional_std__function_void_const_std__string_____payloadJson______(newValue) {
|
|
249
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_std__string_____payloadJson______(newValue)
|
|
250
|
+
return { () -> (String) -> Void in
|
|
251
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string(__unwrapped)
|
|
252
|
+
return { (__payloadJson: String) -> Void in
|
|
253
|
+
__wrappedFunction.call(std.string(__payloadJson))
|
|
254
|
+
}
|
|
255
|
+
}()
|
|
256
|
+
} else {
|
|
257
|
+
return nil
|
|
258
|
+
}
|
|
259
|
+
}()
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
public final var onEndReached: bridge.std__optional_std__function_void_const_std__string_____payloadJson______ {
|
|
264
|
+
@inline(__always)
|
|
265
|
+
get {
|
|
266
|
+
return { () -> bridge.std__optional_std__function_void_const_std__string_____payloadJson______ in
|
|
267
|
+
if let __unwrappedValue = self.__implementation.onEndReached {
|
|
268
|
+
return bridge.create_std__optional_std__function_void_const_std__string_____payloadJson______({ () -> bridge.Func_void_std__string in
|
|
269
|
+
let __closureWrapper = Func_void_std__string(__unwrappedValue)
|
|
270
|
+
return bridge.create_Func_void_std__string(__closureWrapper.toUnsafe())
|
|
271
|
+
}())
|
|
272
|
+
} else {
|
|
273
|
+
return .init()
|
|
274
|
+
}
|
|
275
|
+
}()
|
|
276
|
+
}
|
|
277
|
+
@inline(__always)
|
|
278
|
+
set {
|
|
279
|
+
self.__implementation.onEndReached = { () -> ((_ payloadJson: String) -> Void)? in
|
|
280
|
+
if bridge.has_value_std__optional_std__function_void_const_std__string_____payloadJson______(newValue) {
|
|
281
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_std__string_____payloadJson______(newValue)
|
|
282
|
+
return { () -> (String) -> Void in
|
|
283
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string(__unwrapped)
|
|
284
|
+
return { (__payloadJson: String) -> Void in
|
|
285
|
+
__wrappedFunction.call(std.string(__payloadJson))
|
|
286
|
+
}
|
|
287
|
+
}()
|
|
288
|
+
} else {
|
|
289
|
+
return nil
|
|
290
|
+
}
|
|
291
|
+
}()
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
public final var onVisibleRangeChanged: bridge.std__optional_std__function_void_const_std__string_____payloadJson______ {
|
|
296
|
+
@inline(__always)
|
|
297
|
+
get {
|
|
298
|
+
return { () -> bridge.std__optional_std__function_void_const_std__string_____payloadJson______ in
|
|
299
|
+
if let __unwrappedValue = self.__implementation.onVisibleRangeChanged {
|
|
300
|
+
return bridge.create_std__optional_std__function_void_const_std__string_____payloadJson______({ () -> bridge.Func_void_std__string in
|
|
301
|
+
let __closureWrapper = Func_void_std__string(__unwrappedValue)
|
|
302
|
+
return bridge.create_Func_void_std__string(__closureWrapper.toUnsafe())
|
|
303
|
+
}())
|
|
304
|
+
} else {
|
|
305
|
+
return .init()
|
|
306
|
+
}
|
|
307
|
+
}()
|
|
308
|
+
}
|
|
309
|
+
@inline(__always)
|
|
310
|
+
set {
|
|
311
|
+
self.__implementation.onVisibleRangeChanged = { () -> ((_ payloadJson: String) -> Void)? in
|
|
312
|
+
if bridge.has_value_std__optional_std__function_void_const_std__string_____payloadJson______(newValue) {
|
|
313
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_std__string_____payloadJson______(newValue)
|
|
314
|
+
return { () -> (String) -> Void in
|
|
315
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string(__unwrapped)
|
|
316
|
+
return { (__payloadJson: String) -> Void in
|
|
317
|
+
__wrappedFunction.call(std.string(__payloadJson))
|
|
318
|
+
}
|
|
319
|
+
}()
|
|
320
|
+
} else {
|
|
321
|
+
return nil
|
|
322
|
+
}
|
|
323
|
+
}()
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Methods
|
|
328
|
+
@inline(__always)
|
|
329
|
+
public final func applySnapshot(snapshotJson: std.string) -> bridge.Result_void_ {
|
|
330
|
+
do {
|
|
331
|
+
try self.__implementation.applySnapshot(snapshotJson: String(snapshotJson))
|
|
332
|
+
return bridge.create_Result_void_()
|
|
333
|
+
} catch (let __error) {
|
|
334
|
+
let __exceptionPtr = __error.toCpp()
|
|
335
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
@inline(__always)
|
|
340
|
+
public final func applyPatches(patchesJson: std.string) -> bridge.Result_void_ {
|
|
341
|
+
do {
|
|
342
|
+
try self.__implementation.applyPatches(patchesJson: String(patchesJson))
|
|
343
|
+
return bridge.create_Result_void_()
|
|
344
|
+
} catch (let __error) {
|
|
345
|
+
let __exceptionPtr = __error.toCpp()
|
|
346
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
@inline(__always)
|
|
351
|
+
public final func reconcileSelection(selectedKeysJson: std.string) -> bridge.Result_void_ {
|
|
352
|
+
do {
|
|
353
|
+
try self.__implementation.reconcileSelection(selectedKeysJson: String(selectedKeysJson))
|
|
354
|
+
return bridge.create_Result_void_()
|
|
355
|
+
} catch (let __error) {
|
|
356
|
+
let __exceptionPtr = __error.toCpp()
|
|
357
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@inline(__always)
|
|
362
|
+
public final func scrollToKey(key: std.string, animated: Bool, alignment: Int32, viewPosition: Double, viewOffset: Double) -> bridge.Result_void_ {
|
|
363
|
+
do {
|
|
364
|
+
try self.__implementation.scrollToKey(key: String(key), animated: animated, alignment: margelo.nitro.nativelist.NativeListScrollAlignment(rawValue: alignment)!, viewPosition: viewPosition, viewOffset: viewOffset)
|
|
365
|
+
return bridge.create_Result_void_()
|
|
366
|
+
} catch (let __error) {
|
|
367
|
+
let __exceptionPtr = __error.toCpp()
|
|
368
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
@inline(__always)
|
|
373
|
+
public final func scrollToIndex(index: Double, animated: Bool, alignment: Int32, viewPosition: Double, viewOffset: Double) -> bridge.Result_void_ {
|
|
374
|
+
do {
|
|
375
|
+
try self.__implementation.scrollToIndex(index: index, animated: animated, alignment: margelo.nitro.nativelist.NativeListScrollAlignment(rawValue: alignment)!, viewPosition: viewPosition, viewOffset: viewOffset)
|
|
376
|
+
return bridge.create_Result_void_()
|
|
377
|
+
} catch (let __error) {
|
|
378
|
+
let __exceptionPtr = __error.toCpp()
|
|
379
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@inline(__always)
|
|
384
|
+
public final func scrollToOffset(offset: Double, animated: Bool) -> bridge.Result_void_ {
|
|
385
|
+
do {
|
|
386
|
+
try self.__implementation.scrollToOffset(offset: offset, animated: animated)
|
|
387
|
+
return bridge.create_Result_void_()
|
|
388
|
+
} catch (let __error) {
|
|
389
|
+
let __exceptionPtr = __error.toCpp()
|
|
390
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
@inline(__always)
|
|
395
|
+
public final func scrollToEnd(animated: Bool) -> bridge.Result_void_ {
|
|
396
|
+
do {
|
|
397
|
+
try self.__implementation.scrollToEnd(animated: animated)
|
|
398
|
+
return bridge.create_Result_void_()
|
|
399
|
+
} catch (let __error) {
|
|
400
|
+
let __exceptionPtr = __error.toCpp()
|
|
401
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
@inline(__always)
|
|
406
|
+
public final func setActionAnchorState(stateJson: std.string) -> bridge.Result_void_ {
|
|
407
|
+
do {
|
|
408
|
+
try self.__implementation.setActionAnchorState(stateJson: String(stateJson))
|
|
409
|
+
return bridge.create_Result_void_()
|
|
410
|
+
} catch (let __error) {
|
|
411
|
+
let __exceptionPtr = __error.toCpp()
|
|
412
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@inline(__always)
|
|
417
|
+
public final func setRefreshing(refreshing: Bool) -> bridge.Result_void_ {
|
|
418
|
+
do {
|
|
419
|
+
try self.__implementation.setRefreshing(refreshing: refreshing)
|
|
420
|
+
return bridge.create_Result_void_()
|
|
421
|
+
} catch (let __error) {
|
|
422
|
+
let __exceptionPtr = __error.toCpp()
|
|
423
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
public final func getView() -> UnsafeMutableRawPointer {
|
|
428
|
+
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
public final func beforeUpdate() {
|
|
432
|
+
__implementation.beforeUpdate()
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
public final func afterUpdate() {
|
|
436
|
+
__implementation.afterUpdate()
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
public final func maybePrepareForRecycle() {
|
|
440
|
+
guard let recyclable = __implementation as? any RecyclableView else { return }
|
|
441
|
+
recyclable.prepareForRecycle()
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
public final func onDropView() {
|
|
445
|
+
__implementation.onDropView()
|
|
446
|
+
}
|
|
447
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListScrollAlignment.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `NativeListScrollAlignment`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias NativeListScrollAlignment = margelo.nitro.nativelist.NativeListScrollAlignment
|
|
12
|
+
|
|
13
|
+
public extension NativeListScrollAlignment {
|
|
14
|
+
/**
|
|
15
|
+
* Get a NativeListScrollAlignment for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "start":
|
|
21
|
+
self = .start
|
|
22
|
+
case "center":
|
|
23
|
+
self = .center
|
|
24
|
+
case "end":
|
|
25
|
+
self = .end
|
|
26
|
+
case "nearest":
|
|
27
|
+
self = .nearest
|
|
28
|
+
default:
|
|
29
|
+
return nil
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the String value this NativeListScrollAlignment represents.
|
|
35
|
+
*/
|
|
36
|
+
var stringValue: String {
|
|
37
|
+
switch self {
|
|
38
|
+
case .start:
|
|
39
|
+
return "start"
|
|
40
|
+
case .center:
|
|
41
|
+
return "center"
|
|
42
|
+
case .end:
|
|
43
|
+
return "end"
|
|
44
|
+
case .nearest:
|
|
45
|
+
return "nearest"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNativeListSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nativelist {
|
|
11
|
+
|
|
12
|
+
void HybridNativeListSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("snapshotJson", &HybridNativeListSpec::getSnapshotJson);
|
|
18
|
+
prototype.registerHybridSetter("snapshotJson", &HybridNativeListSpec::setSnapshotJson);
|
|
19
|
+
prototype.registerHybridGetter("onRowAction", &HybridNativeListSpec::getOnRowAction);
|
|
20
|
+
prototype.registerHybridSetter("onRowAction", &HybridNativeListSpec::setOnRowAction);
|
|
21
|
+
prototype.registerHybridGetter("onActionAnchorInvalidated", &HybridNativeListSpec::getOnActionAnchorInvalidated);
|
|
22
|
+
prototype.registerHybridSetter("onActionAnchorInvalidated", &HybridNativeListSpec::setOnActionAnchorInvalidated);
|
|
23
|
+
prototype.registerHybridGetter("onSelectionDelta", &HybridNativeListSpec::getOnSelectionDelta);
|
|
24
|
+
prototype.registerHybridSetter("onSelectionDelta", &HybridNativeListSpec::setOnSelectionDelta);
|
|
25
|
+
prototype.registerHybridGetter("onReorder", &HybridNativeListSpec::getOnReorder);
|
|
26
|
+
prototype.registerHybridSetter("onReorder", &HybridNativeListSpec::setOnReorder);
|
|
27
|
+
prototype.registerHybridGetter("onEndReached", &HybridNativeListSpec::getOnEndReached);
|
|
28
|
+
prototype.registerHybridSetter("onEndReached", &HybridNativeListSpec::setOnEndReached);
|
|
29
|
+
prototype.registerHybridGetter("onVisibleRangeChanged", &HybridNativeListSpec::getOnVisibleRangeChanged);
|
|
30
|
+
prototype.registerHybridSetter("onVisibleRangeChanged", &HybridNativeListSpec::setOnVisibleRangeChanged);
|
|
31
|
+
prototype.registerHybridMethod("applySnapshot", &HybridNativeListSpec::applySnapshot);
|
|
32
|
+
prototype.registerHybridMethod("applyPatches", &HybridNativeListSpec::applyPatches);
|
|
33
|
+
prototype.registerHybridMethod("reconcileSelection", &HybridNativeListSpec::reconcileSelection);
|
|
34
|
+
prototype.registerHybridMethod("scrollToKey", &HybridNativeListSpec::scrollToKey);
|
|
35
|
+
prototype.registerHybridMethod("scrollToIndex", &HybridNativeListSpec::scrollToIndex);
|
|
36
|
+
prototype.registerHybridMethod("scrollToOffset", &HybridNativeListSpec::scrollToOffset);
|
|
37
|
+
prototype.registerHybridMethod("scrollToEnd", &HybridNativeListSpec::scrollToEnd);
|
|
38
|
+
prototype.registerHybridMethod("setActionAnchorState", &HybridNativeListSpec::setActionAnchorState);
|
|
39
|
+
prototype.registerHybridMethod("setRefreshing", &HybridNativeListSpec::setRefreshing);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
} // namespace margelo::nitro::nativelist
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeListSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
18
|
+
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <functional>
|
|
21
|
+
#include <optional>
|
|
22
|
+
#include "NativeListScrollAlignment.hpp"
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::nativelist {
|
|
25
|
+
|
|
26
|
+
using namespace margelo::nitro;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An abstract base class for `NativeList`
|
|
30
|
+
* Inherit this class to create instances of `HybridNativeListSpec` in C++.
|
|
31
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
32
|
+
* @example
|
|
33
|
+
* ```cpp
|
|
34
|
+
* class HybridNativeList: public HybridNativeListSpec {
|
|
35
|
+
* public:
|
|
36
|
+
* HybridNativeList(...): HybridObject(TAG) { ... }
|
|
37
|
+
* // ...
|
|
38
|
+
* };
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
class HybridNativeListSpec: public virtual HybridObject {
|
|
42
|
+
public:
|
|
43
|
+
// Constructor
|
|
44
|
+
explicit HybridNativeListSpec(): HybridObject(TAG) { }
|
|
45
|
+
|
|
46
|
+
// Destructor
|
|
47
|
+
~HybridNativeListSpec() override = default;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
// Properties
|
|
51
|
+
virtual std::string getSnapshotJson() = 0;
|
|
52
|
+
virtual void setSnapshotJson(const std::string& snapshotJson) = 0;
|
|
53
|
+
virtual std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnRowAction() = 0;
|
|
54
|
+
virtual void setOnRowAction(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onRowAction) = 0;
|
|
55
|
+
virtual std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnActionAnchorInvalidated() = 0;
|
|
56
|
+
virtual void setOnActionAnchorInvalidated(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onActionAnchorInvalidated) = 0;
|
|
57
|
+
virtual std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnSelectionDelta() = 0;
|
|
58
|
+
virtual void setOnSelectionDelta(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onSelectionDelta) = 0;
|
|
59
|
+
virtual std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnReorder() = 0;
|
|
60
|
+
virtual void setOnReorder(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onReorder) = 0;
|
|
61
|
+
virtual std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnEndReached() = 0;
|
|
62
|
+
virtual void setOnEndReached(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onEndReached) = 0;
|
|
63
|
+
virtual std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnVisibleRangeChanged() = 0;
|
|
64
|
+
virtual void setOnVisibleRangeChanged(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onVisibleRangeChanged) = 0;
|
|
65
|
+
|
|
66
|
+
public:
|
|
67
|
+
// Methods
|
|
68
|
+
virtual void applySnapshot(const std::string& snapshotJson) = 0;
|
|
69
|
+
virtual void applyPatches(const std::string& patchesJson) = 0;
|
|
70
|
+
virtual void reconcileSelection(const std::string& selectedKeysJson) = 0;
|
|
71
|
+
virtual void scrollToKey(const std::string& key, bool animated, NativeListScrollAlignment alignment, double viewPosition, double viewOffset) = 0;
|
|
72
|
+
virtual void scrollToIndex(double index, bool animated, NativeListScrollAlignment alignment, double viewPosition, double viewOffset) = 0;
|
|
73
|
+
virtual void scrollToOffset(double offset, bool animated) = 0;
|
|
74
|
+
virtual void scrollToEnd(bool animated) = 0;
|
|
75
|
+
virtual void setActionAnchorState(const std::string& stateJson) = 0;
|
|
76
|
+
virtual void setRefreshing(bool refreshing) = 0;
|
|
77
|
+
|
|
78
|
+
protected:
|
|
79
|
+
// Hybrid Setup
|
|
80
|
+
void loadHybridMethods() override;
|
|
81
|
+
|
|
82
|
+
protected:
|
|
83
|
+
// Tag for logging
|
|
84
|
+
static constexpr auto TAG = "NativeList";
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro::nativelist
|