@tachui/data 0.8.11 → 0.8.13
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 +16 -16
- package/dist/List.js +349 -346
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ const app = VStack({
|
|
|
47
47
|
renderItem: item => Text(item.name),
|
|
48
48
|
})
|
|
49
49
|
.modifier.padding(16)
|
|
50
|
-
|
|
50
|
+
,
|
|
51
51
|
],
|
|
52
52
|
})
|
|
53
53
|
```
|
|
@@ -73,7 +73,7 @@ const sectionedList = List({
|
|
|
73
73
|
renderItem: item => Text(item.name),
|
|
74
74
|
renderSectionHeader: section =>
|
|
75
75
|
Text(section.header).modifier.fontWeight('bold'),
|
|
76
|
-
})
|
|
76
|
+
})
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
### Contextual Menu
|
|
@@ -99,7 +99,7 @@ const menuItems = [
|
|
|
99
99
|
const menu = Menu({
|
|
100
100
|
items: menuItems,
|
|
101
101
|
placement: 'bottom-start',
|
|
102
|
-
})
|
|
102
|
+
})
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
## Components
|
|
@@ -116,7 +116,7 @@ import { List } from '@tachui/data'
|
|
|
116
116
|
const list = List({
|
|
117
117
|
data: items,
|
|
118
118
|
renderItem: (item, index) => Text(`${index + 1}. ${item.name}`),
|
|
119
|
-
})
|
|
119
|
+
})
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
#### Virtual Scrolling
|
|
@@ -130,7 +130,7 @@ const virtualList = List({
|
|
|
130
130
|
itemHeight: 50, // Fixed height for performance
|
|
131
131
|
overscan: 5, // Extra items to render
|
|
132
132
|
},
|
|
133
|
-
})
|
|
133
|
+
})
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
#### Sectioned List
|
|
@@ -155,7 +155,7 @@ const sectionedList = List({
|
|
|
155
155
|
Text(section.header).modifier.fontWeight('bold'),
|
|
156
156
|
renderSectionFooter: section =>
|
|
157
157
|
section.footer ? Text(section.footer).modifier.fontSize(12) : undefined,
|
|
158
|
-
})
|
|
158
|
+
})
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
#### Selection Modes
|
|
@@ -169,7 +169,7 @@ const selectableList = List({
|
|
|
169
169
|
onSelectionChange: selected => {
|
|
170
170
|
console.log('Selected items:', selected)
|
|
171
171
|
},
|
|
172
|
-
})
|
|
172
|
+
})
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
#### Swipe Actions
|
|
@@ -196,7 +196,7 @@ const swipeableList = List({
|
|
|
196
196
|
onTap: () => deleteItem(item),
|
|
197
197
|
},
|
|
198
198
|
],
|
|
199
|
-
})
|
|
199
|
+
})
|
|
200
200
|
```
|
|
201
201
|
|
|
202
202
|
### Menu Component
|
|
@@ -216,7 +216,7 @@ const dropdownMenu = Menu({
|
|
|
216
216
|
{ id: 'exit', title: 'Exit', action: () => exitApp() },
|
|
217
217
|
],
|
|
218
218
|
placement: 'bottom-start',
|
|
219
|
-
})
|
|
219
|
+
})
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
#### Nested Submenus
|
|
@@ -242,7 +242,7 @@ const nestedMenu = Menu({
|
|
|
242
242
|
],
|
|
243
243
|
},
|
|
244
244
|
],
|
|
245
|
-
})
|
|
245
|
+
})
|
|
246
246
|
```
|
|
247
247
|
|
|
248
248
|
#### Menu with Icons and Shortcuts
|
|
@@ -268,7 +268,7 @@ const advancedMenu = Menu({
|
|
|
268
268
|
},
|
|
269
269
|
],
|
|
270
270
|
placement: 'bottom-end',
|
|
271
|
-
})
|
|
271
|
+
})
|
|
272
272
|
```
|
|
273
273
|
|
|
274
274
|
## Advanced Features
|
|
@@ -288,7 +288,7 @@ const virtualList = List({
|
|
|
288
288
|
overscan: 10, // Extra items to render
|
|
289
289
|
threshold: 100, // Distance from viewport to trigger loading
|
|
290
290
|
},
|
|
291
|
-
})
|
|
291
|
+
})
|
|
292
292
|
```
|
|
293
293
|
|
|
294
294
|
### Infinite Scrolling
|
|
@@ -311,7 +311,7 @@ const infiniteList = List({
|
|
|
311
311
|
setHasMore(newData.length > 0)
|
|
312
312
|
},
|
|
313
313
|
},
|
|
314
|
-
})
|
|
314
|
+
})
|
|
315
315
|
```
|
|
316
316
|
|
|
317
317
|
### Reactive Data
|
|
@@ -327,7 +327,7 @@ const [items, setItems] = createSignal([
|
|
|
327
327
|
const reactiveList = List({
|
|
328
328
|
data: items, // Signal-based data
|
|
329
329
|
renderItem: item => Text(item.name),
|
|
330
|
-
})
|
|
330
|
+
})
|
|
331
331
|
|
|
332
332
|
// Update data reactively
|
|
333
333
|
setItems([...items(), { id: 3, name: 'Item 3' }])
|
|
@@ -342,7 +342,7 @@ const listWithIds = List({
|
|
|
342
342
|
data: items,
|
|
343
343
|
renderItem: item => Text(item.name),
|
|
344
344
|
getItemId: (item, index) => item.id || `item-${index}`,
|
|
345
|
-
})
|
|
345
|
+
})
|
|
346
346
|
```
|
|
347
347
|
|
|
348
348
|
## Performance Optimization
|
|
@@ -402,7 +402,7 @@ const typedList = List<CustomItem>({
|
|
|
402
402
|
data: items,
|
|
403
403
|
renderItem: item => Text(item.name),
|
|
404
404
|
// TypeScript knows item is CustomItem
|
|
405
|
-
})
|
|
405
|
+
})
|
|
406
406
|
```
|
|
407
407
|
|
|
408
408
|
## Browser Support
|