@onekeyfe/react-native-native-list 6.8.0-2 → 6.8.0-21
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/build.gradle +3 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +18 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +70 -33
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +8 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +21 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +24 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListRowUpdates.kt +34 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +11 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +84 -9
- package/android/src/main/res/values/native_scroll_coordinator_ids.xml +1 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentitySubtitleBindingTest.kt +177 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +2 -0
- package/docs/ROW_TEMPLATES.md +3 -1
- package/docs/SPEC.md +165 -4
- package/docs/STYLE_SPEC.md +7 -1
- package/ios/NativeListAccessoryStack.swift +22 -0
- package/ios/NativeListDataRowRenderer.swift +12 -5
- package/ios/NativeListIdentityRenderer.swift +36 -58
- package/ios/NativeListLeadingVisual.swift +8 -0
- package/ios/NativeListMarketRenderer.swift +6 -2
- package/ios/NativeListModels.swift +7 -0
- package/ios/NativeListResolvedText.swift +9 -7
- package/ios/NativeListSectionHeaderRenderer.swift +9 -43
- package/ios/NativeListTextStyles.swift +72 -12
- package/ios/RNCNativeListView.swift +203 -45
- package/ios/tests/NativeListLifecycleTests.swift +298 -24
- package/lib/module/validation.js +55 -12
- package/lib/module/web/NativeListGeneratedIcons.js +1 -0
- package/lib/module/web/NativeListWebEngine.js +213 -23
- package/lib/module/web/templates/ActivityRowRenderer.js +1 -1
- package/lib/module/web/templates/DataRowRenderer.js +38 -1
- package/lib/module/web/templates/IdentityRowRenderer.js +12 -1
- package/lib/module/web/templates/MarketRowRenderer.js +2 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +1 -0
- package/lib/module/web/templates/RowElements.js +2 -2
- package/lib/module/web/templates/RowText.js +2 -0
- package/lib/typescript/src/models.d.ts +24 -1
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +8 -1
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +6 -2
- package/lib/typescript/src/web/templates/RowVisual.d.ts +1 -1
- package/package.json +1 -1
- package/scripts/generate-icons.test.mjs +1 -0
- package/scripts/native-list-icons.json +1 -1
- package/src/models.ts +24 -0
- package/src/validation.ts +129 -5
- package/src/web/NativeListGeneratedIcons.ts +1 -0
- package/src/web/NativeListWebEngine.ts +382 -27
- package/src/web/templates/ActivityRowRenderer.ts +1 -1
- package/src/web/templates/DataRowRenderer.ts +48 -1
- package/src/web/templates/IdentityRowRenderer.ts +23 -1
- package/src/web/templates/MarketRowRenderer.ts +2 -0
- package/src/web/templates/MediaTileRowRenderer.ts +1 -0
- package/src/web/templates/RowElements.ts +3 -2
- package/src/web/templates/RowText.ts +6 -0
- package/src/web/templates/RowVisual.ts +2 -1
|
@@ -11,6 +11,7 @@ type ColumnViews = {
|
|
|
11
11
|
body: HTMLElement;
|
|
12
12
|
primaryLine: HTMLElement;
|
|
13
13
|
primary: HTMLElement;
|
|
14
|
+
leadingBadge: HTMLElement;
|
|
14
15
|
titleIcons: HTMLElement;
|
|
15
16
|
badges: HTMLElement;
|
|
16
17
|
secondaryLine: HTMLElement;
|
|
@@ -137,6 +138,45 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
|
|
|
137
138
|
fontWeight(style?.columns?.fontWeight, 500)
|
|
138
139
|
);
|
|
139
140
|
if (style?.columns) primitives.textStyle(cell.primary, style.columns);
|
|
141
|
+
const leadingBadge = column.webLeadingBadge;
|
|
142
|
+
cell.leadingBadge.hidden = !leadingBadge;
|
|
143
|
+
cell.leadingBadge.style.cssText = '';
|
|
144
|
+
cell.leadingBadge.textContent = leadingBadge?.text ?? '';
|
|
145
|
+
if (leadingBadge) {
|
|
146
|
+
// The line spans the column so the badge cap is a share of the column
|
|
147
|
+
// rather than of the line's own content; justifyContent then carries
|
|
148
|
+
// the column alignment the shrink-to-fit line got from its cell.
|
|
149
|
+
cell.primaryLine.style.alignSelf = 'stretch';
|
|
150
|
+
cell.primaryLine.style.justifyContent =
|
|
151
|
+
column.alignment === 'end'
|
|
152
|
+
? 'flex-end'
|
|
153
|
+
: column.alignment === 'center'
|
|
154
|
+
? 'center'
|
|
155
|
+
: 'flex-start';
|
|
156
|
+
cell.primaryLine.style.gap = '8px';
|
|
157
|
+
// A long label truncates at half the column; the primary text keeps the
|
|
158
|
+
// rest and truncates after it, so neither can leave the column.
|
|
159
|
+
cell.leadingBadge.style.display = 'block';
|
|
160
|
+
cell.leadingBadge.style.boxSizing = 'border-box';
|
|
161
|
+
cell.leadingBadge.style.flexShrink = '0';
|
|
162
|
+
cell.leadingBadge.style.maxWidth = '50%';
|
|
163
|
+
cell.leadingBadge.style.overflow = 'hidden';
|
|
164
|
+
cell.leadingBadge.style.textOverflow = 'ellipsis';
|
|
165
|
+
cell.leadingBadge.style.whiteSpace = 'nowrap';
|
|
166
|
+
cell.leadingBadge.style.padding = '2px 6px';
|
|
167
|
+
cell.leadingBadge.style.borderRadius = '4px';
|
|
168
|
+
cell.leadingBadge.style.fontSize = '12px';
|
|
169
|
+
cell.leadingBadge.style.lineHeight = '16px';
|
|
170
|
+
cell.leadingBadge.style.fontWeight = '400';
|
|
171
|
+
cell.leadingBadge.style.fontFamily = 'var(--nl-font-regular)';
|
|
172
|
+
cell.leadingBadge.style.color = leadingBadge.textColor;
|
|
173
|
+
cell.leadingBadge.style.backgroundColor = leadingBadge.backgroundColor;
|
|
174
|
+
cell.leadingBadge.style.pointerEvents = 'none';
|
|
175
|
+
cell.primary.style.minWidth = '0';
|
|
176
|
+
cell.primary.style.overflow = 'hidden';
|
|
177
|
+
cell.primary.style.textOverflow = 'ellipsis';
|
|
178
|
+
cell.primary.style.whiteSpace = 'nowrap';
|
|
179
|
+
}
|
|
140
180
|
cell.titleIcons.replaceChildren();
|
|
141
181
|
if (column.titleIcon || column.secondaryTitleIcon) {
|
|
142
182
|
cell.primary.style.minWidth = '0';
|
|
@@ -238,10 +278,16 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
|
|
|
238
278
|
'ok-native-list-data-primary'
|
|
239
279
|
);
|
|
240
280
|
const primary = tagSlot(createElement(document, 'span'), 'columns');
|
|
281
|
+
const leadingBadge = createElement(
|
|
282
|
+
document,
|
|
283
|
+
'span',
|
|
284
|
+
'ok-native-list-data-leading-badge'
|
|
285
|
+
);
|
|
286
|
+
leadingBadge.hidden = true;
|
|
241
287
|
const titleIcons = createElement(document, 'span');
|
|
242
288
|
titleIcons.style.display = 'contents';
|
|
243
289
|
const badges = createElement(document, 'span');
|
|
244
|
-
primaryLine.append(primary, titleIcons, badges);
|
|
290
|
+
primaryLine.append(leadingBadge, primary, titleIcons, badges);
|
|
245
291
|
const secondaryLine = createElement(
|
|
246
292
|
document,
|
|
247
293
|
'span',
|
|
@@ -260,6 +306,7 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
|
|
|
260
306
|
body: cell,
|
|
261
307
|
primaryLine,
|
|
262
308
|
primary,
|
|
309
|
+
leadingBadge,
|
|
263
310
|
titleIcons,
|
|
264
311
|
badges,
|
|
265
312
|
secondaryLine,
|
|
@@ -44,6 +44,16 @@ function appendAccessories(
|
|
|
44
44
|
'ok-native-list-accessories'
|
|
45
45
|
);
|
|
46
46
|
|
|
47
|
+
// ListItem's rename + drag pair sits in <XStack gap="$6">; iOS and Android
|
|
48
|
+
// lay the same pair out natively.
|
|
49
|
+
if (
|
|
50
|
+
accessories.length === 2 &&
|
|
51
|
+
accessories[0].kind === 'icon' &&
|
|
52
|
+
accessories[0].name === 'PencilOutline' &&
|
|
53
|
+
accessories[1].kind === 'drag'
|
|
54
|
+
)
|
|
55
|
+
container.style.gap = '24px';
|
|
56
|
+
|
|
47
57
|
if (
|
|
48
58
|
row &&
|
|
49
59
|
hasExplicitRowHeight(row) &&
|
|
@@ -111,9 +121,21 @@ function createIdentityRow(
|
|
|
111
121
|
row.leadingAction.name,
|
|
112
122
|
row.leadingAction.actionKey,
|
|
113
123
|
row.leadingAction.disabled,
|
|
114
|
-
row.leadingAction.tintColor
|
|
124
|
+
row.leadingAction.tintColor,
|
|
125
|
+
row.leadingAction.accessibilityLabel
|
|
115
126
|
);
|
|
116
127
|
markActionAnchorSource(action, 'leadingAction');
|
|
128
|
+
// ListItem.IconButton geometry, as on iOS and Android: the medium tertiary
|
|
129
|
+
// frame overhangs its 24-point slot by 7 on each side.
|
|
130
|
+
action.classList.add('ok-native-list-tertiary-icon');
|
|
131
|
+
const glyph = createElement(
|
|
132
|
+
document,
|
|
133
|
+
'span',
|
|
134
|
+
'ok-native-list-action-glyph'
|
|
135
|
+
);
|
|
136
|
+
glyph.dataset.nativeListAnchorGlyph = '';
|
|
137
|
+
glyph.append(...action.childNodes);
|
|
138
|
+
action.append(glyph);
|
|
117
139
|
body.appendChild(action);
|
|
118
140
|
}
|
|
119
141
|
const visual = primitives.visual(
|
|
@@ -66,6 +66,8 @@ function applyMarketTextStyle(
|
|
|
66
66
|
String(fontWeight(style?.fontWeight, defaults.weight))
|
|
67
67
|
);
|
|
68
68
|
element.style.color = style?.color ?? '';
|
|
69
|
+
element.style.letterSpacing = '';
|
|
70
|
+
element.style.fontVariantNumeric = '';
|
|
69
71
|
element.style.textAlign = style?.alignment ?? defaults.alignment;
|
|
70
72
|
element.style.whiteSpace = (style?.lines ?? 1) > 1 ? 'normal' : 'nowrap';
|
|
71
73
|
element.style.display = '';
|
|
@@ -102,8 +102,9 @@ export function createBadge(
|
|
|
102
102
|
// Selector digits retain their font family, including explicit button fonts.
|
|
103
103
|
export function applyTabularNumbers(body: HTMLElement): void {
|
|
104
104
|
body.style.fontVariantNumeric = 'tabular-nums';
|
|
105
|
-
body.querySelectorAll
|
|
106
|
-
|
|
105
|
+
body.querySelectorAll('button').forEach((button) => {
|
|
106
|
+
if (!button.style.fontVariantNumeric)
|
|
107
|
+
button.style.fontVariantNumeric = 'inherit';
|
|
107
108
|
});
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -150,6 +150,12 @@ export function applyTextStyleToSlot(
|
|
|
150
150
|
if (style.fontWeight !== undefined)
|
|
151
151
|
applyTextWeight(element, String(fontWeight(style.fontWeight, 400)));
|
|
152
152
|
if (style.color !== undefined) element.style.color = style.color;
|
|
153
|
+
if (style.tabularNumbers !== undefined)
|
|
154
|
+
element.style.fontVariantNumeric = style.tabularNumbers
|
|
155
|
+
? 'tabular-nums'
|
|
156
|
+
: 'proportional-nums';
|
|
157
|
+
if (style.letterSpacing !== undefined)
|
|
158
|
+
element.style.letterSpacing = String(style.letterSpacing) + 'px';
|
|
153
159
|
// Explicit overrides also apply to rich text runs, but never to sibling badges.
|
|
154
160
|
// Subscript segments keep their legacy size relative to the field size.
|
|
155
161
|
element.querySelectorAll<HTMLElement>('span').forEach((run) => {
|