@onekeyfe/react-native-native-list 6.7.0-alpha.378 → 6.7.0-alpha.382
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/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +240 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +87 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +177 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +43 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +33 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +22 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1912 -107
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +1 -0
- package/docs/ROW_TEMPLATES.md +60 -9
- package/docs/SPEC.md +450 -5
- package/docs/STYLE_SPEC.md +6 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +227 -39
- package/ios/NativeListActivityDetailsView.swift +18 -8
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +155 -27
- package/ios/NativeListDesignAssets.swift +3 -0
- package/ios/NativeListIdentityRenderer.swift +166 -30
- package/ios/NativeListLeadingVisual.swift +49 -14
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListModels.swift +42 -2
- package/ios/NativeListRendererRegistry.swift +1 -0
- package/ios/NativeListResolvedText.swift +2 -1
- package/ios/NativeListRowHost.swift +14 -0
- package/ios/NativeListSectionHeaderRenderer.swift +88 -0
- package/ios/RNCNativeListView.swift +1013 -55
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
- package/ios/tests/NativeListLifecycleTests.swift +2720 -3
- package/lib/module/NativeList.js +175 -28
- package/lib/module/NativeList.web.js +129 -30
- package/lib/module/index.js +1 -1
- package/lib/module/models.js +1 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +421 -8
- package/lib/module/web/NativeListWebEngine.js +507 -19
- package/lib/module/web/templates/ActivityRowRenderer.js +8 -7
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
- package/lib/module/web/templates/DataRowRenderer.js +40 -5
- package/lib/module/web/templates/IdentityRowRenderer.js +90 -4
- package/lib/module/web/templates/MessageRowRenderer.js +18 -2
- package/lib/module/web/templates/RowContainerStyle.js +1 -0
- package/lib/module/web/templates/RowRendererRegistry.js +3 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/lib/typescript/src/NativeList.d.ts +1 -1
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
- package/lib/typescript/src/NativeList.types.d.ts +18 -0
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +105 -9
- package/lib/typescript/src/validation.d.ts +12 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -0
- package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/package.json +3 -3
- package/react-native-native-list.podspec +1 -0
- package/src/NativeList.nitro.ts +2 -0
- package/src/NativeList.tsx +313 -44
- package/src/NativeList.types.ts +22 -0
- package/src/NativeList.web.tsx +204 -48
- package/src/index.ts +2 -0
- package/src/models.ts +117 -3
- package/src/selection.ts +1 -0
- package/src/validation.ts +852 -6
- package/src/web/NativeListWebEngine.ts +803 -20
- package/src/web/templates/ActivityRowRenderer.ts +14 -6
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +150 -5
- package/src/web/templates/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +11 -1
- package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { applyTextWeight } from './RowText';
|
|
2
2
|
import { applyTabularNumbers, hasExplicitRowHeight } from './RowElements';
|
|
3
|
-
import type { SectionHeaderRow } from '../../models';
|
|
3
|
+
import type { RowTextHelp, SectionHeaderRow } from '../../models';
|
|
4
4
|
import {
|
|
5
5
|
createElement,
|
|
6
6
|
setData,
|
|
@@ -10,6 +10,21 @@ import {
|
|
|
10
10
|
} from './RowElements';
|
|
11
11
|
import { applyValueSegments } from './RowText';
|
|
12
12
|
import type { RowPrimitives } from './RowVisual';
|
|
13
|
+
|
|
14
|
+
function bindHelp(target: HTMLElement, help: RowTextHelp) {
|
|
15
|
+
markActionAnchorSource(target, 'trailingAccessory', 0);
|
|
16
|
+
if (help.presentation === 'tooltip') {
|
|
17
|
+
setData(target, 'nativeListHoverAction', help.actionKey);
|
|
18
|
+
setData(target, 'nativeListIconHelp', true);
|
|
19
|
+
} else {
|
|
20
|
+
setData(target, 'nativeListAction', help.actionKey);
|
|
21
|
+
target.setAttribute('role', 'button');
|
|
22
|
+
}
|
|
23
|
+
if (help.underline === 'dashed') {
|
|
24
|
+
target.style.textDecoration = 'underline dashed';
|
|
25
|
+
target.style.textUnderlineOffset = '4px';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
13
28
|
function createSectionHeader(
|
|
14
29
|
document: Document,
|
|
15
30
|
primitives: RowPrimitives,
|
|
@@ -36,6 +51,16 @@ function createSectionHeader(
|
|
|
36
51
|
const column = createTextColumn(document, row.title, row.subtitle);
|
|
37
52
|
const title = column.firstElementChild as HTMLElement;
|
|
38
53
|
title.classList.add('ok-native-list-section-title');
|
|
54
|
+
if (row.leadingBadge) {
|
|
55
|
+
const badge = createElement(
|
|
56
|
+
document,
|
|
57
|
+
'span',
|
|
58
|
+
'ok-native-list-badge',
|
|
59
|
+
row.leadingBadge.text
|
|
60
|
+
);
|
|
61
|
+
if (row.leadingBadge.tone) setData(badge, 'tone', row.leadingBadge.tone);
|
|
62
|
+
body.appendChild(badge);
|
|
63
|
+
}
|
|
39
64
|
if (row.titleActionKey) {
|
|
40
65
|
setData(title, 'nativeListAction', row.titleActionKey);
|
|
41
66
|
markActionAnchorSource(title, 'leadingAction');
|
|
@@ -50,6 +75,12 @@ function createSectionHeader(
|
|
|
50
75
|
}
|
|
51
76
|
if (row.titleActionOnHover) setData(title, 'nativeListHoverAction', true);
|
|
52
77
|
}
|
|
78
|
+
if (row.style?.titleDecoration === 'none')
|
|
79
|
+
title.style.textDecoration = 'none';
|
|
80
|
+
if (row.style?.titleDecoration === 'dashed') {
|
|
81
|
+
title.style.textDecoration = 'underline dashed';
|
|
82
|
+
title.style.textUnderlineOffset = '4px';
|
|
83
|
+
}
|
|
53
84
|
if (row.presentation === 'networkSelector' && hasExplicitRowHeight(row)) {
|
|
54
85
|
body.style.padding =
|
|
55
86
|
row.variant === 'summary' ? '24px 12px 20px' : '0 12px';
|
|
@@ -160,8 +191,10 @@ function createSectionHeader(
|
|
|
160
191
|
const value = tagSlot(
|
|
161
192
|
createElement(
|
|
162
193
|
document,
|
|
163
|
-
row.valueActionKey
|
|
164
|
-
|
|
194
|
+
row.valueActionKey || row.valueHelp?.presentation === 'popover'
|
|
195
|
+
? 'button'
|
|
196
|
+
: 'span',
|
|
197
|
+
row.valueActionKey || row.valueHelp?.presentation === 'popover'
|
|
165
198
|
? 'ok-native-list-action-button ok-native-list-section-value'
|
|
166
199
|
: 'ok-native-list-value ok-native-list-section-value',
|
|
167
200
|
row.value
|
|
@@ -186,7 +219,17 @@ function createSectionHeader(
|
|
|
186
219
|
setData(value, 'nativeListAction', row.valueActionKey);
|
|
187
220
|
markActionAnchorSource(value, 'trailingAccessory', 0);
|
|
188
221
|
}
|
|
189
|
-
|
|
222
|
+
if (row.valueHelp) bindHelp(value, row.valueHelp);
|
|
223
|
+
if (row.style?.valuePlacement === 'afterTitle') {
|
|
224
|
+
value.style.marginLeft = '0';
|
|
225
|
+
value.style.flexShrink = '0';
|
|
226
|
+
value.style.alignSelf = 'center';
|
|
227
|
+
title.insertAdjacentElement('afterend', value);
|
|
228
|
+
column.style.flexDirection = 'row';
|
|
229
|
+
column.style.alignItems = 'center';
|
|
230
|
+
column.style.justifyContent = 'flex-start';
|
|
231
|
+
column.style.gap = '8px';
|
|
232
|
+
} else body.appendChild(value);
|
|
190
233
|
}
|
|
191
234
|
if (row.valueIcon) {
|
|
192
235
|
const valueIcon = primitives.iconAction(
|