@onekeyfe/react-native-native-list 6.7.0-4 → 6.7.0-41
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 +4 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +35 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
- 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 +102 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -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 +1953 -117
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
- package/docs/ROW_TEMPLATES.md +74 -13
- package/docs/SPEC.md +1206 -15
- package/docs/STYLE_SPEC.md +14 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +237 -51
- package/ios/NativeListActivityDetailsView.swift +30 -11
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +167 -30
- package/ios/NativeListDesignAssets.swift +13 -75
- package/ios/NativeListGeneratedIcons.swift +55 -0
- package/ios/NativeListIconBinding.swift +171 -0
- package/ios/NativeListIdentityRenderer.swift +256 -39
- package/ios/NativeListLeadingVisual.swift +127 -28
- package/ios/NativeListMarketRenderer.swift +120 -31
- package/ios/NativeListMediaPlaceholderView.swift +189 -0
- package/ios/NativeListMediaPreviewSlot.swift +122 -61
- package/ios/NativeListMediaTileRenderer.swift +15 -11
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListMetricCardRenderer.swift +4 -2
- 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 +100 -4
- package/ios/RNCNativeListView.swift +1053 -58
- package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
- package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
- package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
- package/ios/tests/NativeListLifecycleTests.swift +2819 -3
- package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
- package/ios/tests/NativeListMediaVisibilityTests.swift +26 -1
- package/ios/tests/NativeListSharedIconTests.swift +236 -0
- package/lib/module/NativeList.js +221 -36
- package/lib/module/NativeList.web.js +167 -46
- package/lib/module/index.js +1 -1
- package/lib/module/models.js +3 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +1246 -48
- package/lib/module/web/NativeListGeneratedIcons.js +31 -0
- package/lib/module/web/NativeListWebEngine.js +513 -275
- package/lib/module/web/templates/ActivityRowRenderer.js +120 -87
- 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 +158 -6
- package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
- package/lib/module/web/templates/MediaTileRowRenderer.js +84 -25
- 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 +3 -3
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
- package/lib/typescript/src/NativeList.types.d.ts +20 -2
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +126 -17
- package/lib/typescript/src/validation.d.ts +20 -0
- package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
- 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 +16 -10
- package/react-native-native-list.podspec +2 -6
- package/scripts/generate-icons.mjs +150 -0
- package/scripts/generate-icons.test.mjs +288 -0
- package/scripts/native-list-icons.json +260 -0
- package/src/NativeList.nitro.ts +2 -0
- package/src/NativeList.tsx +416 -89
- package/src/NativeList.types.ts +24 -2
- package/src/NativeList.web.tsx +295 -89
- package/src/index.ts +2 -0
- package/src/models.ts +263 -144
- package/src/selection.ts +1 -0
- package/src/validation.ts +3013 -152
- package/src/web/NativeListGeneratedIcons.ts +28 -0
- package/src/web/NativeListWebEngine.ts +818 -343
- package/src/web/templates/ActivityRowRenderer.ts +178 -141
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +231 -6
- package/src/web/templates/MarketTableRowRenderer.ts +53 -33
- package/src/web/templates/MediaTileRowRenderer.ts +90 -28
- 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
- package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
|
|
1
2
|
import type { ActivityAmount, ActivityRow, LeadingVisual } from '../../models';
|
|
2
3
|
import { createElement, tagSlot, markActionAnchorSource } from './RowElements';
|
|
3
4
|
import { RowVisualStyle, type RowPrimitives } from './RowVisual';
|
|
@@ -47,6 +48,7 @@ function bindLegacy(
|
|
|
47
48
|
}
|
|
48
49
|
const visualKey = JSON.stringify([
|
|
49
50
|
row.key,
|
|
51
|
+
row.hideLeading,
|
|
50
52
|
row.leading,
|
|
51
53
|
row.secondaryLeading,
|
|
52
54
|
]);
|
|
@@ -55,7 +57,7 @@ function bindLegacy(
|
|
|
55
57
|
primitives.dispose(node);
|
|
56
58
|
node.remove();
|
|
57
59
|
});
|
|
58
|
-
v.visuals = [row.leading, row.secondaryLeading]
|
|
60
|
+
v.visuals = (row.hideLeading ? [] : [row.leading, row.secondaryLeading])
|
|
59
61
|
.map((source) => primitives.visual(source))
|
|
60
62
|
.filter((node): node is HTMLElement => !!node);
|
|
61
63
|
v.visuals.forEach((node) => body.insertBefore(node, v.column));
|
|
@@ -179,6 +181,14 @@ type HistoryViews = {
|
|
|
179
181
|
actions: HTMLElement;
|
|
180
182
|
actionButtons: Map<string, HTMLButtonElement>;
|
|
181
183
|
visualKey: string;
|
|
184
|
+
visuals: {
|
|
185
|
+
node: HTMLElement;
|
|
186
|
+
style: RowVisualStyle;
|
|
187
|
+
background: string;
|
|
188
|
+
loaded: boolean;
|
|
189
|
+
fallback?: HTMLElement;
|
|
190
|
+
fallbackStyle?: RowVisualStyle;
|
|
191
|
+
}[];
|
|
182
192
|
primitives: RowPrimitives;
|
|
183
193
|
};
|
|
184
194
|
const histories = new WeakMap<HTMLElement, HistoryViews>();
|
|
@@ -255,46 +265,24 @@ function createHistory(body: HTMLElement, primitives: RowPrimitives) {
|
|
|
255
265
|
actions,
|
|
256
266
|
actionButtons: new Map(),
|
|
257
267
|
visualKey: '',
|
|
268
|
+
visuals: [],
|
|
258
269
|
primitives,
|
|
259
270
|
};
|
|
260
271
|
histories.set(body, v);
|
|
261
272
|
return v;
|
|
262
273
|
}
|
|
263
|
-
const
|
|
264
|
-
ArrowTopOutline
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
],
|
|
276
|
-
ShieldCheckDoneOutline: [
|
|
277
|
-
'M15.914 9.75 11 14.664 8.086 11.75 9.5 10.336l1.5 1.5 3.5-3.5z',
|
|
278
|
-
'M12.325 2.055 21 5.036v6.876c0 2.807-1.149 4.83-2.813 6.404-1.615 1.53-3.745 2.66-5.712 3.722l-.475.256-.475-.256c-1.967-1.061-4.097-2.192-5.713-3.722C4.15 16.741 3 14.72 3 11.912V5.036l8.675-2.981.325-.113zM5 6.463v5.45c0 2.165.851 3.686 2.188 4.951 1.275 1.208 2.965 2.154 4.812 3.154 1.847-1 3.537-1.946 4.813-3.154C18.148 15.6 19 14.078 19 11.912v-5.45l-7-2.405z',
|
|
279
|
-
],
|
|
280
|
-
UnlockedOutline: [
|
|
281
|
-
'M13 18h-2v-5h2z',
|
|
282
|
-
'M12 2a5 5 0 0 1 5 5h-2a3 3 0 0 0-6 0v2h11v13H4V9h3V7a5 5 0 0 1 5-5M6 20h12v-9H6z',
|
|
283
|
-
],
|
|
284
|
-
Document2Outline: [
|
|
285
|
-
'M12 16H8v-2h4zm4-4H8v-2h8zm0-4H8V6h8z',
|
|
286
|
-
'M20 22H4V2h16zM6 20h12V4H6z',
|
|
287
|
-
],
|
|
288
|
-
CryptoCoinOutline: [
|
|
289
|
-
'M11 16.387a4.5 4.5 0 0 1 0-8.775V6h2v1.613a4.5 4.5 0 0 1 2.856 2.067l-1.712 1.032a2.5 2.5 0 1 0 0 2.576l1.712 1.032A4.5 4.5 0 0 1 13 16.386V18h-2z',
|
|
290
|
-
'M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0',
|
|
291
|
-
],
|
|
292
|
-
ImageSquareWavesOutline: [
|
|
293
|
-
'M14.25 7a2 2 0 1 1 0 4 2 2 0 0 1 0-4',
|
|
294
|
-
'M21 21H3V3h18zM5 16.414V19h12.586L14 15.414l-2 2-4-4zm0-2.828 3-3 4 4 2-2 5 5V5H5z',
|
|
295
|
-
],
|
|
296
|
-
DotHorOutline: ['M6 14H2v-4h4zm8 0h-4v-4h4zm8 0h-4v-4h4z'],
|
|
297
|
-
};
|
|
274
|
+
const historyIconNames = new Set([
|
|
275
|
+
'ArrowTopOutline',
|
|
276
|
+
'ArrowBottomOutline',
|
|
277
|
+
'SwitchHorOutline',
|
|
278
|
+
'CoinsOutline',
|
|
279
|
+
'ShieldCheckDoneOutline',
|
|
280
|
+
'UnlockedOutline',
|
|
281
|
+
'Document2Outline',
|
|
282
|
+
'CryptoCoinOutline',
|
|
283
|
+
'ImageSquareWavesOutline',
|
|
284
|
+
'DotHorOutline',
|
|
285
|
+
]);
|
|
298
286
|
function historyIcon(
|
|
299
287
|
node: HTMLElement,
|
|
300
288
|
source: LeadingVisual | undefined,
|
|
@@ -306,8 +294,7 @@ function historyIcon(
|
|
|
306
294
|
: source?.kind === 'token'
|
|
307
295
|
? source.fallbackIcon?.name
|
|
308
296
|
: undefined;
|
|
309
|
-
|
|
310
|
-
if (!paths) return;
|
|
297
|
+
if (!name || !historyIconNames.has(name)) return;
|
|
311
298
|
const placeholder = node.querySelector<HTMLElement>(
|
|
312
299
|
'.ok-native-list-visual-fallback'
|
|
313
300
|
);
|
|
@@ -324,24 +311,9 @@ function historyIcon(
|
|
|
324
311
|
fallback.style.color = source.tintColor;
|
|
325
312
|
else if (source && 'fallbackIcon' in source && source.fallbackIcon?.tintColor)
|
|
326
313
|
fallback.style.color = source.fallbackIcon.tintColor;
|
|
327
|
-
const svg = node.ownerDocument
|
|
328
|
-
'http://www.w3.org/2000/svg',
|
|
329
|
-
'svg'
|
|
330
|
-
);
|
|
331
|
-
svg.setAttribute('viewBox', '0 0 24 24');
|
|
314
|
+
const svg = createNamedIcon(node.ownerDocument, name);
|
|
332
315
|
svg.setAttribute('width', String(size));
|
|
333
316
|
svg.setAttribute('height', String(size));
|
|
334
|
-
svg.setAttribute('fill', 'currentColor');
|
|
335
|
-
svg.setAttribute('aria-hidden', 'true');
|
|
336
|
-
for (const d of paths) {
|
|
337
|
-
const path = node.ownerDocument.createElementNS(
|
|
338
|
-
'http://www.w3.org/2000/svg',
|
|
339
|
-
'path'
|
|
340
|
-
);
|
|
341
|
-
path.setAttribute('d', d);
|
|
342
|
-
path.setAttribute('fill-rule', 'evenodd');
|
|
343
|
-
svg.append(path);
|
|
344
|
-
}
|
|
345
317
|
fallback.replaceChildren(svg);
|
|
346
318
|
}
|
|
347
319
|
function bindHistory(
|
|
@@ -380,11 +352,12 @@ function bindHistory(
|
|
|
380
352
|
Object.assign(v.identity.style, {
|
|
381
353
|
display: 'flex',
|
|
382
354
|
alignItems: 'center',
|
|
383
|
-
gap: '12px',
|
|
355
|
+
gap: row.hideLeading ? '0' : '12px',
|
|
384
356
|
minWidth: '0',
|
|
385
357
|
flex: '1 1 0',
|
|
386
358
|
});
|
|
387
359
|
Object.assign(v.visual.style, {
|
|
360
|
+
display: row.hideLeading ? 'none' : '',
|
|
388
361
|
position: 'relative',
|
|
389
362
|
width: '40px',
|
|
390
363
|
height: '40px',
|
|
@@ -392,6 +365,7 @@ function bindHistory(
|
|
|
392
365
|
});
|
|
393
366
|
const visualKey = JSON.stringify([
|
|
394
367
|
row.key,
|
|
368
|
+
row.hideLeading,
|
|
395
369
|
row.leading,
|
|
396
370
|
row.secondaryLeading,
|
|
397
371
|
]);
|
|
@@ -400,98 +374,160 @@ function bindHistory(
|
|
|
400
374
|
primitives.dispose(n as HTMLElement)
|
|
401
375
|
);
|
|
402
376
|
v.visual.replaceChildren();
|
|
403
|
-
|
|
404
|
-
sources
|
|
377
|
+
v.visuals = [];
|
|
378
|
+
const sources = row.hideLeading
|
|
379
|
+
? []
|
|
380
|
+
: [row.leading, row.secondaryLeading].filter(Boolean);
|
|
381
|
+
sources.forEach((source) => {
|
|
405
382
|
const visual = primitives.visual(source);
|
|
406
383
|
if (!visual) return;
|
|
407
|
-
const size = sources.length > 1 ? (index ? 28 : 24) : 40;
|
|
408
|
-
new RowVisualStyle(visual).apply(row.style?.image, size, size, 0);
|
|
409
|
-
Object.assign(visual.style, {
|
|
410
|
-
display: 'inline-flex',
|
|
411
|
-
alignItems: 'center',
|
|
412
|
-
justifyContent: 'center',
|
|
413
|
-
});
|
|
414
|
-
if (sources.length > 1)
|
|
415
|
-
Object.assign(visual.style, {
|
|
416
|
-
position: 'absolute',
|
|
417
|
-
left: index ? '12px' : '0',
|
|
418
|
-
top: index ? '12px' : '0',
|
|
419
|
-
border: index ? '2px solid var(--nl-row)' : '0',
|
|
420
|
-
boxSizing: 'border-box',
|
|
421
|
-
});
|
|
422
384
|
historyIcon(visual, source, table || sources.length > 1 ? 24 : 28);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
source && 'borderColor' in source && source.borderColor
|
|
442
|
-
? `1px solid ${source.borderColor}`
|
|
443
|
-
: '0',
|
|
444
|
-
});
|
|
445
|
-
token.append(
|
|
446
|
-
...Array.from(visual.children).filter(
|
|
447
|
-
(child) => !child.classList.contains('ok-native-list-visual-corner')
|
|
448
|
-
)
|
|
449
|
-
);
|
|
450
|
-
const fallback = token.querySelector<HTMLElement>(
|
|
451
|
-
':scope > .ok-native-list-visual-fallback'
|
|
452
|
-
);
|
|
453
|
-
if (fallback) {
|
|
454
|
-
fallback.style.width = '24px';
|
|
455
|
-
fallback.style.height = '24px';
|
|
456
|
-
fallback.style.flexShrink = '0';
|
|
457
|
-
}
|
|
458
|
-
const mainImage = token.querySelector<HTMLImageElement>(
|
|
459
|
-
':scope > .ok-native-list-visual-main'
|
|
460
|
-
);
|
|
461
|
-
if (mainImage) {
|
|
462
|
-
mainImage.style.width = '100%';
|
|
463
|
-
mainImage.style.height = '100%';
|
|
464
|
-
}
|
|
465
|
-
visual.append(token);
|
|
466
|
-
}
|
|
467
|
-
if (table) {
|
|
468
|
-
visual.style.background =
|
|
469
|
-
source && 'backgroundColor' in source && source.backgroundColor
|
|
470
|
-
? source.backgroundColor
|
|
471
|
-
: 'var(--nl-strong)';
|
|
472
|
-
const borderColor =
|
|
473
|
-
source && 'borderColor' in source && source.borderColor
|
|
474
|
-
? source.borderColor
|
|
475
|
-
: 'var(--nl-separator)';
|
|
476
|
-
visual.style.border = `1px solid ${borderColor}`;
|
|
477
|
-
visual.style.boxSizing = 'border-box';
|
|
478
|
-
} else if (sources.length === 1 && source?.kind === 'token') {
|
|
479
|
-
visual.style.border = source.borderColor
|
|
480
|
-
? `1px solid ${source.borderColor}`
|
|
481
|
-
: '0';
|
|
482
|
-
visual.style.boxSizing = 'border-box';
|
|
483
|
-
const mainImage = visual.querySelector<HTMLImageElement>(
|
|
484
|
-
':scope > .ok-native-list-visual-main'
|
|
485
|
-
);
|
|
486
|
-
if (mainImage) {
|
|
487
|
-
mainImage.style.width = '100%';
|
|
488
|
-
mainImage.style.height = '100%';
|
|
489
|
-
}
|
|
385
|
+
const retained = {
|
|
386
|
+
node: visual,
|
|
387
|
+
style: new RowVisualStyle(visual),
|
|
388
|
+
background: visual.style.background,
|
|
389
|
+
loaded: false,
|
|
390
|
+
};
|
|
391
|
+
// Only placeholder-backed sources restore their frame background on load.
|
|
392
|
+
const image = source && 'image' in source ? source.image : undefined;
|
|
393
|
+
if (image?.loadingStrategy && image.loadingStrategy !== 'none') {
|
|
394
|
+
visual
|
|
395
|
+
.querySelector('.ok-native-list-visual-main')
|
|
396
|
+
?.addEventListener('load', () => {
|
|
397
|
+
retained.background =
|
|
398
|
+
source && 'backgroundColor' in source && source.backgroundColor
|
|
399
|
+
? source.backgroundColor
|
|
400
|
+
: 'transparent';
|
|
401
|
+
retained.loaded = true;
|
|
402
|
+
});
|
|
490
403
|
}
|
|
404
|
+
v.visuals.push(retained);
|
|
491
405
|
v.visual.append(visual);
|
|
492
406
|
});
|
|
493
407
|
v.visualKey = visualKey;
|
|
494
408
|
}
|
|
409
|
+
const sources = row.hideLeading
|
|
410
|
+
? []
|
|
411
|
+
: [row.leading, row.secondaryLeading].filter(Boolean);
|
|
412
|
+
v.visuals.forEach((retained, index) => {
|
|
413
|
+
const { node: visual, style, background, loaded } = retained;
|
|
414
|
+
const source = sources[index];
|
|
415
|
+
const previousToken = visual.querySelector<HTMLElement>(
|
|
416
|
+
':scope > .ok-native-list-history-token'
|
|
417
|
+
);
|
|
418
|
+
if (previousToken) {
|
|
419
|
+
visual.append(...Array.from(previousToken.children));
|
|
420
|
+
previousToken.remove();
|
|
421
|
+
}
|
|
422
|
+
const currentFallback = visual.querySelector<HTMLElement>(
|
|
423
|
+
':scope > .ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)'
|
|
424
|
+
);
|
|
425
|
+
if (currentFallback && retained.fallback !== currentFallback) {
|
|
426
|
+
retained.fallback = currentFallback;
|
|
427
|
+
retained.fallbackStyle = new RowVisualStyle(currentFallback);
|
|
428
|
+
}
|
|
429
|
+
// A terminal image error creates a new fallback node after the factory bind.
|
|
430
|
+
retained.fallbackStyle?.restore();
|
|
431
|
+
const size = sources.length > 1 ? (index ? 28 : 24) : 40;
|
|
432
|
+
style.apply(row.style?.image, size, size, 0);
|
|
433
|
+
Object.assign(visual.style, {
|
|
434
|
+
background,
|
|
435
|
+
position: '',
|
|
436
|
+
left: '',
|
|
437
|
+
top: '',
|
|
438
|
+
});
|
|
439
|
+
const svg = visual.querySelector<SVGElement>(
|
|
440
|
+
'.ok-native-list-visual-fallback > svg'
|
|
441
|
+
);
|
|
442
|
+
if (svg) {
|
|
443
|
+
const iconSize = String(table || sources.length > 1 ? 24 : 28);
|
|
444
|
+
svg.setAttribute('width', iconSize);
|
|
445
|
+
svg.setAttribute('height', iconSize);
|
|
446
|
+
}
|
|
447
|
+
Object.assign(visual.style, {
|
|
448
|
+
display: 'inline-flex',
|
|
449
|
+
alignItems: 'center',
|
|
450
|
+
justifyContent: 'center',
|
|
451
|
+
});
|
|
452
|
+
if (sources.length > 1)
|
|
453
|
+
Object.assign(visual.style, {
|
|
454
|
+
position: 'absolute',
|
|
455
|
+
left: index ? '12px' : '0',
|
|
456
|
+
top: index ? '12px' : '0',
|
|
457
|
+
border: index ? '2px solid var(--nl-row)' : '0',
|
|
458
|
+
boxSizing: 'border-box',
|
|
459
|
+
});
|
|
460
|
+
if (!table && sources.length > 1) {
|
|
461
|
+
const token = visual.ownerDocument.createElement('span');
|
|
462
|
+
token.className = 'ok-native-list-history-token';
|
|
463
|
+
Object.assign(token.style, {
|
|
464
|
+
display: 'flex',
|
|
465
|
+
alignItems: 'center',
|
|
466
|
+
justifyContent: 'center',
|
|
467
|
+
position: 'relative',
|
|
468
|
+
width: '24px',
|
|
469
|
+
height: '24px',
|
|
470
|
+
flex: '0 0 24px',
|
|
471
|
+
borderRadius: 'inherit',
|
|
472
|
+
boxSizing: 'border-box',
|
|
473
|
+
overflow: 'hidden',
|
|
474
|
+
background:
|
|
475
|
+
source && 'backgroundColor' in source
|
|
476
|
+
? source.backgroundColor ?? ''
|
|
477
|
+
: '',
|
|
478
|
+
border:
|
|
479
|
+
source && 'borderColor' in source && source.borderColor
|
|
480
|
+
? `1px solid ${source.borderColor}`
|
|
481
|
+
: '0',
|
|
482
|
+
});
|
|
483
|
+
token.append(
|
|
484
|
+
...Array.from(visual.children).filter(
|
|
485
|
+
(child) => !child.classList.contains('ok-native-list-visual-corner')
|
|
486
|
+
)
|
|
487
|
+
);
|
|
488
|
+
const fallback = token.querySelector<HTMLElement>(
|
|
489
|
+
':scope > .ok-native-list-visual-fallback'
|
|
490
|
+
);
|
|
491
|
+
if (fallback) {
|
|
492
|
+
fallback.style.width = '24px';
|
|
493
|
+
fallback.style.height = '24px';
|
|
494
|
+
fallback.style.flexShrink = '0';
|
|
495
|
+
}
|
|
496
|
+
const mainImage = token.querySelector<HTMLImageElement>(
|
|
497
|
+
':scope > .ok-native-list-visual-main'
|
|
498
|
+
);
|
|
499
|
+
if (mainImage) {
|
|
500
|
+
mainImage.style.width = '100%';
|
|
501
|
+
mainImage.style.height = '100%';
|
|
502
|
+
}
|
|
503
|
+
visual.append(token);
|
|
504
|
+
}
|
|
505
|
+
if (table) {
|
|
506
|
+
visual.style.background = loaded
|
|
507
|
+
? background
|
|
508
|
+
: source && 'backgroundColor' in source && source.backgroundColor
|
|
509
|
+
? source.backgroundColor
|
|
510
|
+
: 'var(--nl-strong)';
|
|
511
|
+
const borderColor =
|
|
512
|
+
source && 'borderColor' in source && source.borderColor
|
|
513
|
+
? source.borderColor
|
|
514
|
+
: 'var(--nl-separator)';
|
|
515
|
+
visual.style.border = `1px solid ${borderColor}`;
|
|
516
|
+
visual.style.boxSizing = 'border-box';
|
|
517
|
+
} else if (sources.length === 1 && source?.kind === 'token') {
|
|
518
|
+
visual.style.border = source.borderColor
|
|
519
|
+
? `1px solid ${source.borderColor}`
|
|
520
|
+
: '0';
|
|
521
|
+
visual.style.boxSizing = 'border-box';
|
|
522
|
+
const mainImage = visual.querySelector<HTMLImageElement>(
|
|
523
|
+
':scope > .ok-native-list-visual-main'
|
|
524
|
+
);
|
|
525
|
+
if (mainImage) {
|
|
526
|
+
mainImage.style.width = '100%';
|
|
527
|
+
mainImage.style.height = '100%';
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
});
|
|
495
531
|
Object.assign(v.text.style, {
|
|
496
532
|
minWidth: '0',
|
|
497
533
|
flex: '1 1 auto',
|
|
@@ -706,8 +742,9 @@ function bindHistory(
|
|
|
706
742
|
20,
|
|
707
743
|
400
|
|
708
744
|
);
|
|
709
|
-
v.actions.style.cssText =
|
|
710
|
-
|
|
745
|
+
v.actions.style.cssText = `display:flex;gap:12px;padding-left:${
|
|
746
|
+
row.hideLeading ? 0 : 52
|
|
747
|
+
}px;padding-bottom:4px;`;
|
|
711
748
|
v.actions.style.display = footer ? 'flex' : 'none';
|
|
712
749
|
const actionKeys = new Set<string>();
|
|
713
750
|
for (const [index, action] of (row.footerActions ?? []).entries()) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ButtonGroupRow } from '../../models';
|
|
2
|
+
import { markActionAnchorSource } from './RowElements';
|
|
3
|
+
import type { RowPrimitives } from './RowVisual';
|
|
4
|
+
|
|
5
|
+
function bind(body: HTMLElement, row: ButtonGroupRow) {
|
|
6
|
+
body.replaceChildren();
|
|
7
|
+
body.className = 'ok-native-list-row ok-native-list-button-group';
|
|
8
|
+
body.removeAttribute('data-nl-container-background');
|
|
9
|
+
body.removeAttribute('data-nl-container-border');
|
|
10
|
+
row.buttons.forEach((descriptor, index) => {
|
|
11
|
+
const button = body.ownerDocument.createElement('button');
|
|
12
|
+
button.type = 'button';
|
|
13
|
+
button.className = 'ok-native-list-block-button';
|
|
14
|
+
button.dataset.nativeListAction = descriptor.actionKey;
|
|
15
|
+
button.dataset.nlButtonKey = descriptor.key;
|
|
16
|
+
button.dataset.nlSlot = `button-${index}`;
|
|
17
|
+
if (descriptor.testID) button.dataset.testid = descriptor.testID;
|
|
18
|
+
button.setAttribute(
|
|
19
|
+
'aria-label',
|
|
20
|
+
descriptor.accessibilityLabel ?? descriptor.label
|
|
21
|
+
);
|
|
22
|
+
button.disabled = Boolean(
|
|
23
|
+
row.disabled || descriptor.disabled || descriptor.loading
|
|
24
|
+
);
|
|
25
|
+
button.setAttribute('aria-busy', descriptor.loading ? 'true' : 'false');
|
|
26
|
+
markActionAnchorSource(button, 'buttonGroup', index);
|
|
27
|
+
const label = body.ownerDocument.createElement('span');
|
|
28
|
+
label.textContent = descriptor.label;
|
|
29
|
+
if (descriptor.loading) {
|
|
30
|
+
const spinner = body.ownerDocument.createElement('span');
|
|
31
|
+
spinner.className = 'ok-native-list-spinner';
|
|
32
|
+
spinner.setAttribute('role', 'progressbar');
|
|
33
|
+
button.appendChild(spinner);
|
|
34
|
+
}
|
|
35
|
+
button.appendChild(label);
|
|
36
|
+
body.appendChild(button);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function create(
|
|
41
|
+
document: Document,
|
|
42
|
+
row: ButtonGroupRow,
|
|
43
|
+
_primitives: RowPrimitives
|
|
44
|
+
) {
|
|
45
|
+
const body = document.createElement('div');
|
|
46
|
+
body.dataset.nlRenderer = 'buttonGroup';
|
|
47
|
+
bind(body, row);
|
|
48
|
+
return body;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const buttonGroupRowRenderer = {
|
|
52
|
+
key: 'buttonGroup' as const,
|
|
53
|
+
create,
|
|
54
|
+
bind,
|
|
55
|
+
recycle: (body: HTMLElement) => body.replaceChildren(),
|
|
56
|
+
measure: (_row: ButtonGroupRow, _width: number) => 64,
|
|
57
|
+
measureRendered: (body: HTMLElement) => body.scrollHeight,
|
|
58
|
+
};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { DataRow, TextTone } from '../../models';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createElement,
|
|
4
|
+
markActionAnchorSource,
|
|
5
|
+
setData,
|
|
6
|
+
tagSlot,
|
|
7
|
+
} from './RowElements';
|
|
8
|
+
import { applyValueSegments, fontWeight } from './RowText';
|
|
3
9
|
import { RowVisualStyle, type RowPrimitives } from './RowVisual';
|
|
4
10
|
type ColumnViews = {
|
|
5
11
|
body: HTMLElement;
|
|
6
12
|
primaryLine: HTMLElement;
|
|
7
13
|
primary: HTMLElement;
|
|
14
|
+
titleIcons: HTMLElement;
|
|
8
15
|
badges: HTMLElement;
|
|
9
16
|
secondaryLine: HTMLElement;
|
|
10
17
|
secondary: HTMLElement[];
|
|
@@ -13,6 +20,7 @@ type Views = {
|
|
|
13
20
|
favorite: HTMLElement;
|
|
14
21
|
index: HTMLElement;
|
|
15
22
|
controls: HTMLElement;
|
|
23
|
+
trailing: HTMLElement;
|
|
16
24
|
columns: ColumnViews[];
|
|
17
25
|
visual?: HTMLElement;
|
|
18
26
|
visualStyle?: RowVisualStyle;
|
|
@@ -43,6 +51,11 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
|
|
|
43
51
|
if (row.checkbox)
|
|
44
52
|
v.controls.appendChild(primitives.accessory(row.key, row.checkbox, 0));
|
|
45
53
|
v.controls.style.display = 'contents';
|
|
54
|
+
v.trailing.replaceChildren();
|
|
55
|
+
row.trailing?.forEach((accessory, index) =>
|
|
56
|
+
v.trailing.appendChild(primitives.accessory(row.key, accessory, index))
|
|
57
|
+
);
|
|
58
|
+
v.trailing.hidden = !row.trailing?.length;
|
|
46
59
|
v.index.style.cssText = '';
|
|
47
60
|
v.index.hidden = row.index === undefined;
|
|
48
61
|
v.index.textContent = String(row.index ?? '');
|
|
@@ -88,7 +101,41 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
|
|
|
88
101
|
cell.primaryLine.style.gap = `${style.titleBadgeGap}px`;
|
|
89
102
|
cell.primary.style.cssText = '';
|
|
90
103
|
cell.primary.textContent = column.text;
|
|
104
|
+
applyValueSegments(
|
|
105
|
+
cell.primary,
|
|
106
|
+
column.textSegments,
|
|
107
|
+
style?.columns?.fontSize ?? 14,
|
|
108
|
+
style?.columns?.lineHeight ?? 20,
|
|
109
|
+
fontWeight(style?.columns?.fontWeight, 500)
|
|
110
|
+
);
|
|
91
111
|
if (style?.columns) primitives.textStyle(cell.primary, style.columns);
|
|
112
|
+
cell.titleIcons.replaceChildren();
|
|
113
|
+
if (column.titleIcon || column.secondaryTitleIcon) {
|
|
114
|
+
cell.primary.style.minWidth = '0';
|
|
115
|
+
cell.primary.style.overflow = 'hidden';
|
|
116
|
+
cell.primary.style.textOverflow = 'ellipsis';
|
|
117
|
+
cell.primary.style.whiteSpace = 'nowrap';
|
|
118
|
+
[column.titleIcon, column.secondaryTitleIcon]
|
|
119
|
+
.filter((icon): icon is NonNullable<typeof icon> => icon !== undefined)
|
|
120
|
+
.forEach((descriptor) => {
|
|
121
|
+
const icon = primitives.iconAction(
|
|
122
|
+
descriptor.name,
|
|
123
|
+
undefined,
|
|
124
|
+
undefined,
|
|
125
|
+
descriptor.tintColor
|
|
126
|
+
);
|
|
127
|
+
icon.className = 'ok-native-list-identity-title-icon';
|
|
128
|
+
if (descriptor.hoverActionKey) {
|
|
129
|
+
setData(icon, 'nativeListHoverAction', descriptor.hoverActionKey);
|
|
130
|
+
setData(icon, 'nativeListIconHelp', true);
|
|
131
|
+
markActionAnchorSource(icon, 'leadingAction');
|
|
132
|
+
}
|
|
133
|
+
if (descriptor.accessibilityLabel)
|
|
134
|
+
icon.setAttribute('aria-label', descriptor.accessibilityLabel);
|
|
135
|
+
else icon.setAttribute('aria-hidden', 'true');
|
|
136
|
+
cell.titleIcons.appendChild(icon);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
92
139
|
cell.badges.replaceChildren();
|
|
93
140
|
cell.badges.style.display = 'contents';
|
|
94
141
|
if (column.key === 'asset')
|
|
@@ -107,25 +154,34 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
|
|
|
107
154
|
});
|
|
108
155
|
// Legacy Web layout: secondary leading text sits inline before the primary
|
|
109
156
|
// text; secondary text is a direct line below it, toned by secondaryTone.
|
|
110
|
-
|
|
111
|
-
? '
|
|
112
|
-
:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
157
|
+
const secondaryText = column.secondaryTextSegments?.length
|
|
158
|
+
? column.secondaryTextSegments.map((segment) => segment.text).join('')
|
|
159
|
+
: column.secondaryText;
|
|
160
|
+
cell.secondaryLine.style.display = secondaryText ? 'contents' : 'none';
|
|
161
|
+
[column.secondaryLeadingText, secondaryText].forEach((text, slot) => {
|
|
162
|
+
const label = cell.secondary[slot]!;
|
|
163
|
+
label.hidden = !text;
|
|
164
|
+
if (!text) label.remove();
|
|
165
|
+
else if (slot === 0) cell.primaryLine.insertBefore(label, cell.primary);
|
|
166
|
+
else cell.secondaryLine.appendChild(label);
|
|
167
|
+
label.style.cssText = '';
|
|
168
|
+
label.textContent = text ?? '';
|
|
169
|
+
if (slot === 1) {
|
|
170
|
+
applyValueSegments(
|
|
171
|
+
label,
|
|
172
|
+
column.secondaryTextSegments,
|
|
173
|
+
style?.columnSecondary?.fontSize ?? 12,
|
|
174
|
+
style?.columnSecondary?.lineHeight ?? 16,
|
|
175
|
+
fontWeight(style?.columnSecondary?.fontWeight, 400)
|
|
176
|
+
);
|
|
126
177
|
}
|
|
127
|
-
|
|
178
|
+
if (slot === 1)
|
|
179
|
+
label.style.color = tone(column.secondaryTone, 'secondary');
|
|
180
|
+
if (style?.columnSecondary)
|
|
181
|
+
primitives.textStyle(label, style.columnSecondary);
|
|
182
|
+
});
|
|
128
183
|
});
|
|
184
|
+
body.appendChild(v.trailing);
|
|
129
185
|
}
|
|
130
186
|
function create(document: Document, row: DataRow, primitives: RowPrimitives) {
|
|
131
187
|
const body = createElement(
|
|
@@ -140,6 +196,11 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
|
|
|
140
196
|
);
|
|
141
197
|
const favorite = createElement(document, 'span', 'ok-native-list-favorite');
|
|
142
198
|
const controls = createElement(document, 'span');
|
|
199
|
+
const trailing = createElement(
|
|
200
|
+
document,
|
|
201
|
+
'span',
|
|
202
|
+
'ok-native-list-accessories'
|
|
203
|
+
);
|
|
143
204
|
body.append(controls, index, favorite);
|
|
144
205
|
const columns = Array.from({ length: 4 }, () => {
|
|
145
206
|
const cell = createElement(document, 'span', 'ok-native-list-data-cell');
|
|
@@ -149,8 +210,10 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
|
|
|
149
210
|
'ok-native-list-data-primary'
|
|
150
211
|
);
|
|
151
212
|
const primary = tagSlot(createElement(document, 'span'), 'columns');
|
|
213
|
+
const titleIcons = createElement(document, 'span');
|
|
214
|
+
titleIcons.style.display = 'contents';
|
|
152
215
|
const badges = createElement(document, 'span');
|
|
153
|
-
primaryLine.append(primary, badges);
|
|
216
|
+
primaryLine.append(primary, titleIcons, badges);
|
|
154
217
|
const secondaryLine = createElement(
|
|
155
218
|
document,
|
|
156
219
|
'span',
|
|
@@ -169,15 +232,18 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
|
|
|
169
232
|
body: cell,
|
|
170
233
|
primaryLine,
|
|
171
234
|
primary,
|
|
235
|
+
titleIcons,
|
|
172
236
|
badges,
|
|
173
237
|
secondaryLine,
|
|
174
238
|
secondary,
|
|
175
239
|
};
|
|
176
240
|
});
|
|
241
|
+
body.appendChild(trailing);
|
|
177
242
|
views.set(body, {
|
|
178
243
|
favorite,
|
|
179
244
|
index,
|
|
180
245
|
controls,
|
|
246
|
+
trailing,
|
|
181
247
|
columns,
|
|
182
248
|
visualKey: '',
|
|
183
249
|
primitives,
|
|
@@ -196,6 +262,7 @@ function recycle(body: HTMLElement) {
|
|
|
196
262
|
v.visualStyle = undefined;
|
|
197
263
|
v.visualKey = '';
|
|
198
264
|
v.controls.replaceChildren();
|
|
265
|
+
v.trailing.replaceChildren();
|
|
199
266
|
}
|
|
200
267
|
export const dataRowRenderer = {
|
|
201
268
|
key: 'dataRow' as const,
|
|
@@ -204,7 +271,13 @@ export const dataRowRenderer = {
|
|
|
204
271
|
recycle,
|
|
205
272
|
// Legacy presets: table rows without secondary text are 8 units shorter.
|
|
206
273
|
measure: (row: DataRow, _width: number, layout?: string) => {
|
|
207
|
-
const secondary = row.columns.some((column) =>
|
|
274
|
+
const secondary = row.columns.some((column) =>
|
|
275
|
+
column.secondaryTextSegments?.length
|
|
276
|
+
? column.secondaryTextSegments.some(
|
|
277
|
+
(segment) => segment.text.length > 0
|
|
278
|
+
)
|
|
279
|
+
: !!column.secondaryText
|
|
280
|
+
);
|
|
208
281
|
return (secondary ? 60 : 56) + (layout === 'table' && !secondary ? -8 : 0);
|
|
209
282
|
},
|
|
210
283
|
measureRendered: (_body: HTMLElement, _row: DataRow): number | undefined =>
|