ywana-core8 0.1.75 → 0.1.77
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/ACCORDION_EVALUATION.md +583 -0
- package/CHECKBOX_EVALUATION.md +273 -0
- package/CHIP_EVALUATION.md +542 -0
- package/COLOR_EVALUATION.md +524 -0
- package/COMPONENTS_EVALUATION.md +477 -0
- package/FORM_EVALUATION.md +459 -0
- package/HEADER_EVALUATION.md +436 -0
- package/ICON_EVALUATION.md +254 -0
- package/LIST_EVALUATION.md +574 -0
- package/PROGRESS_EVALUATION.md +450 -0
- package/RADIO_EVALUATION.md +439 -0
- package/RADIO_VISUAL_FIX.md +183 -0
- package/SECTION_IMPROVEMENTS.md +153 -0
- package/SWITCH_EVALUATION.md +335 -0
- package/SWITCH_VISUAL_FIX.md +232 -0
- package/TAB_EVALUATION.md +626 -0
- package/TEXTFIELD_EVALUATION.md +747 -0
- package/TOOLTIP_FIX.md +157 -0
- package/TREE_EVALUATION.md +708 -0
- package/dist/index.cjs +10893 -1969
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +7768 -1096
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +10921 -2005
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +10893 -1969
- package/dist/index.umd.js.map +1 -1
- package/jest.config.js +24 -0
- package/package.json +10 -1
- package/src/html/accordion.css +208 -4
- package/src/html/accordion.example.js +390 -0
- package/src/html/accordion.js +284 -28
- package/src/html/accordion.unit.test.js +334 -0
- package/src/html/button.css +157 -16
- package/src/html/button.example.js +374 -0
- package/src/html/button.js +240 -60
- package/src/html/button.test.js +422 -0
- package/src/html/checkbox.css +74 -2
- package/src/html/checkbox.example.js +316 -0
- package/src/html/checkbox.js +113 -26
- package/src/html/checkbox.test.js +285 -0
- package/src/html/chip.css +230 -19
- package/src/html/chip.example.js +355 -0
- package/src/html/chip.js +321 -25
- package/src/html/chip.test.js +425 -0
- package/src/html/color.css +435 -6
- package/src/html/color.example.js +527 -0
- package/src/html/color.js +458 -9
- package/src/html/color.test.js +362 -4
- package/src/html/components.example.js +492 -0
- package/src/html/components_enhanced.test.js +581 -0
- package/src/html/form.css +70 -3
- package/src/html/form.example.js +385 -0
- package/src/html/form.js +232 -34
- package/src/html/form.test.js +369 -0
- package/src/html/header2.css +264 -0
- package/src/html/header2.example.js +411 -0
- package/src/html/header2.js +203 -0
- package/src/html/header2.test.js +377 -0
- package/src/html/icon.css +20 -2
- package/src/html/icon.example.js +268 -0
- package/src/html/icon.js +86 -16
- package/src/html/icon.test.js +231 -0
- package/src/html/index.js +4 -1
- package/src/html/list.css +393 -1
- package/src/html/list.example.js +404 -0
- package/src/html/list.js +583 -40
- package/src/html/list.test.js +383 -0
- package/src/html/progress.css +707 -17
- package/src/html/progress.example.js +424 -0
- package/src/html/progress.js +906 -9
- package/src/html/progress.test.js +313 -0
- package/src/html/property.css +399 -0
- package/src/html/property.example.js +553 -0
- package/src/html/property.js +393 -15
- package/src/html/property.test.js +351 -2
- package/src/html/radio-visual-test.js +289 -0
- package/src/html/radio.css +137 -11
- package/src/html/radio.example.js +389 -0
- package/src/html/radio.js +234 -10
- package/src/html/radio.test.js +318 -0
- package/src/html/section.example.js +99 -0
- package/src/html/section.js +40 -3
- package/src/html/section.test.js +131 -0
- package/src/html/selector.css +329 -3
- package/src/html/selector.js +369 -23
- package/src/html/switch-debug.js +197 -0
- package/src/html/switch-test-visual.js +294 -0
- package/src/html/switch.css +200 -0
- package/src/html/switch.example.js +461 -0
- package/src/html/switch.js +283 -23
- package/src/html/switch.test.js +355 -0
- package/src/html/tab.css +289 -0
- package/src/html/tab.example.js +446 -0
- package/src/html/tab.js +387 -22
- package/src/html/tab_enhanced.js +378 -0
- package/src/html/tab_enhanced.test.js +504 -0
- package/src/html/table2.css +576 -0
- package/src/html/table2.example.js +703 -0
- package/src/html/table2.js +1252 -0
- package/src/html/table2.migration.md +328 -0
- package/src/html/table2.test.js +582 -0
- package/src/html/text.css +375 -0
- package/src/html/text.js +311 -20
- package/src/html/textfield2.css +841 -0
- package/src/html/textfield2.example.js +1370 -0
- package/src/html/textfield2.js +1143 -0
- package/src/html/textfield2.test.js +950 -0
- package/src/html/thumbnail.css +289 -2
- package/src/html/thumbnail.js +214 -9
- package/src/html/tokenfield.css +449 -1
- package/src/html/tokenfield.example.js +503 -0
- package/src/html/tokenfield.js +561 -56
- package/src/html/tokenfield.test.js +423 -0
- package/src/html/tooltip-positioning-demo.js +187 -0
- package/src/html/tooltip.css +25 -2
- package/src/html/tree.css +240 -10
- package/src/html/tree.example.js +475 -0
- package/src/html/tree.js +714 -28
- package/src/html/tree_enhanced.test.js +495 -0
- package/table2.test.js +454 -0
- package/src/html/button.tsx +0 -38
@@ -0,0 +1,328 @@
|
|
1
|
+
# DataTable2 - Guía de Migración
|
2
|
+
|
3
|
+
## 🎯 Resumen
|
4
|
+
|
5
|
+
DataTable2 es una versión completamente reescrita del componente DataTable original que mantiene **100% compatibilidad** con la API existente mientras agrega características avanzadas de rendimiento, accesibilidad y UX.
|
6
|
+
|
7
|
+
## ✅ Garantía de Compatibilidad
|
8
|
+
|
9
|
+
### Props Originales (Sin Cambios)
|
10
|
+
```javascript
|
11
|
+
// Todas estas props funcionan EXACTAMENTE igual
|
12
|
+
const originalProps = {
|
13
|
+
columns: [], // ✅ Mismo formato
|
14
|
+
rows: [], // ✅ Mismo formato
|
15
|
+
onRowSelection: fn, // ✅ Misma firma
|
16
|
+
onSort: fn, // ✅ Misma firma
|
17
|
+
onCheckAll: fn, // ✅ Misma firma
|
18
|
+
editable: boolean, // ✅ Mismo comportamiento
|
19
|
+
outlined: boolean, // ✅ Mismo estilo
|
20
|
+
expanded: boolean, // ✅ Mismo comportamiento
|
21
|
+
className: string, // ✅ Mismas clases CSS
|
22
|
+
emptyMessage: string, // ✅ Mismo mensaje
|
23
|
+
emptyIcon: string, // ✅ Mismo icono
|
24
|
+
multisort: boolean, // ✅ Mismo comportamiento
|
25
|
+
filterable: boolean, // ✅ Mismo comportamiento
|
26
|
+
onClearFilters: fn // ✅ Misma firma
|
27
|
+
}
|
28
|
+
```
|
29
|
+
|
30
|
+
### Estructura de Datos (Sin Cambios)
|
31
|
+
```javascript
|
32
|
+
// Columns - Formato exacto
|
33
|
+
const columns = [
|
34
|
+
{
|
35
|
+
id: 'name',
|
36
|
+
label: 'Name',
|
37
|
+
type: 'String',
|
38
|
+
sortable: true,
|
39
|
+
filterable: true,
|
40
|
+
editable: true,
|
41
|
+
onChange: (rowId, fieldId, value) => {},
|
42
|
+
// ... todas las props originales
|
43
|
+
}
|
44
|
+
]
|
45
|
+
|
46
|
+
// Rows - Formato exacto
|
47
|
+
const rows = [
|
48
|
+
{
|
49
|
+
id: 1,
|
50
|
+
name: 'John Doe',
|
51
|
+
selected: false,
|
52
|
+
className: 'custom-row',
|
53
|
+
checkDisabled: false,
|
54
|
+
disabled: false,
|
55
|
+
info: () => <div>Info</div>
|
56
|
+
// ... todas las props originales
|
57
|
+
}
|
58
|
+
]
|
59
|
+
```
|
60
|
+
|
61
|
+
## 🚀 Migración Paso a Paso
|
62
|
+
|
63
|
+
### Paso 1: Cambiar Import
|
64
|
+
```javascript
|
65
|
+
// ANTES
|
66
|
+
import { DataTable } from './table'
|
67
|
+
|
68
|
+
// DESPUÉS
|
69
|
+
import { DataTable2 } from './table2'
|
70
|
+
// O para alias
|
71
|
+
import { DataTable2 as DataTable } from './table2'
|
72
|
+
```
|
73
|
+
|
74
|
+
### Paso 2: Cambiar Componente
|
75
|
+
```javascript
|
76
|
+
// ANTES
|
77
|
+
<DataTable
|
78
|
+
columns={columns}
|
79
|
+
rows={rows}
|
80
|
+
onRowSelection={handleSelection}
|
81
|
+
editable={true}
|
82
|
+
outlined={true}
|
83
|
+
multisort={true}
|
84
|
+
filterable={true}
|
85
|
+
/>
|
86
|
+
|
87
|
+
// DESPUÉS - EXACTAMENTE IGUAL
|
88
|
+
<DataTable2
|
89
|
+
columns={columns}
|
90
|
+
rows={rows}
|
91
|
+
onRowSelection={handleSelection}
|
92
|
+
editable={true}
|
93
|
+
outlined={true}
|
94
|
+
multisort={true}
|
95
|
+
filterable={true}
|
96
|
+
/>
|
97
|
+
```
|
98
|
+
|
99
|
+
### Paso 3: ¡Listo!
|
100
|
+
Tu código funciona exactamente igual + tienes acceso a nuevas características.
|
101
|
+
|
102
|
+
### Paso 4: Adoptar Nuevas Características (Opcional)
|
103
|
+
```javascript
|
104
|
+
<DataTable2
|
105
|
+
// Props originales (sin cambios)
|
106
|
+
columns={columns}
|
107
|
+
rows={rows}
|
108
|
+
onRowSelection={handleSelection}
|
109
|
+
editable={true}
|
110
|
+
|
111
|
+
// Nuevas características (opcionales)
|
112
|
+
searchable={true}
|
113
|
+
exportable={true}
|
114
|
+
virtualScrolling={true}
|
115
|
+
pageSize={100}
|
116
|
+
theme="dark"
|
117
|
+
density="compact"
|
118
|
+
selectionMode="multiple"
|
119
|
+
loading={isLoading}
|
120
|
+
skeleton={isLoading}
|
121
|
+
/>
|
122
|
+
```
|
123
|
+
|
124
|
+
## 🆕 Nuevas Características
|
125
|
+
|
126
|
+
### 🔍 Búsqueda Integrada
|
127
|
+
```javascript
|
128
|
+
<DataTable2
|
129
|
+
searchable={true}
|
130
|
+
searchPlaceholder="Search users..."
|
131
|
+
onSearch={(term) => console.log('Searching:', term)}
|
132
|
+
/>
|
133
|
+
```
|
134
|
+
|
135
|
+
### 📊 Exportación CSV
|
136
|
+
```javascript
|
137
|
+
<DataTable2
|
138
|
+
exportable={true}
|
139
|
+
onExport={(rows, columns) => {
|
140
|
+
// Custom export logic
|
141
|
+
console.log('Exporting', rows.length, 'rows')
|
142
|
+
}}
|
143
|
+
/>
|
144
|
+
```
|
145
|
+
|
146
|
+
### 📱 Virtual Scrolling
|
147
|
+
```javascript
|
148
|
+
<DataTable2
|
149
|
+
virtualScrolling={true}
|
150
|
+
pageSize={50}
|
151
|
+
// Perfecto para miles de filas
|
152
|
+
/>
|
153
|
+
```
|
154
|
+
|
155
|
+
### 🎨 Temas y Variantes
|
156
|
+
```javascript
|
157
|
+
<DataTable2
|
158
|
+
theme="dark" // default, dark, minimal
|
159
|
+
density="compact" // compact, normal, comfortable
|
160
|
+
rowHeight="small" // small, medium, large
|
161
|
+
striped={true}
|
162
|
+
bordered={true}
|
163
|
+
hover={true}
|
164
|
+
/>
|
165
|
+
```
|
166
|
+
|
167
|
+
### 🎯 Selección Avanzada
|
168
|
+
```javascript
|
169
|
+
<DataTable2
|
170
|
+
selectionMode="multiple" // single, multiple, none
|
171
|
+
sortMode="multiple" // single, multiple, none
|
172
|
+
showRowNumbers={true}
|
173
|
+
showSelectAll={true}
|
174
|
+
/>
|
175
|
+
```
|
176
|
+
|
177
|
+
### ⚡ Estados de Carga
|
178
|
+
```javascript
|
179
|
+
<DataTable2
|
180
|
+
loading={isLoading}
|
181
|
+
skeleton={isLoading}
|
182
|
+
// Muestra estados de carga elegantes
|
183
|
+
/>
|
184
|
+
```
|
185
|
+
|
186
|
+
### ♿ Accesibilidad
|
187
|
+
```javascript
|
188
|
+
<DataTable2
|
189
|
+
accessibility={true} // Habilitado por defecto
|
190
|
+
// WCAG 2.1 AA compliant
|
191
|
+
// Navegación por teclado
|
192
|
+
// Screen reader support
|
193
|
+
// ARIA attributes
|
194
|
+
/>
|
195
|
+
```
|
196
|
+
|
197
|
+
## 🔧 Configuración Avanzada
|
198
|
+
|
199
|
+
### Callbacks Mejorados
|
200
|
+
```javascript
|
201
|
+
<DataTable2
|
202
|
+
// Callbacks originales (sin cambios)
|
203
|
+
onRowSelection={(row, event) => {}}
|
204
|
+
onSort={(dragged, dropped) => {}}
|
205
|
+
onCheckAll={(ids, checked) => {}}
|
206
|
+
|
207
|
+
// Nuevos callbacks (opcionales)
|
208
|
+
onRowClick={(row, event) => {}}
|
209
|
+
onRowDoubleClick={(row, event) => {}}
|
210
|
+
onRowContextMenu={(row, event) => {}}
|
211
|
+
onCellClick={(row, column, cell, event) => {}}
|
212
|
+
onCellDoubleClick={(row, column, cell, event) => {}}
|
213
|
+
onCellEdit={(row, column, oldValue, newValue) => {}}
|
214
|
+
onSearch={(searchTerm) => {}}
|
215
|
+
onExport={(rows, columns) => {}}
|
216
|
+
onColumnResize={(columnId, newWidth) => {}}
|
217
|
+
onStateChange={(state) => {}}
|
218
|
+
/>
|
219
|
+
```
|
220
|
+
|
221
|
+
### Personalización de Clases
|
222
|
+
```javascript
|
223
|
+
<DataTable2
|
224
|
+
className="my-table"
|
225
|
+
headerClassName="my-header"
|
226
|
+
rowClassName={(row, index) => `row-${row.status}`}
|
227
|
+
cellClassName={(row, column, cell) => `cell-${column.type}`}
|
228
|
+
/>
|
229
|
+
```
|
230
|
+
|
231
|
+
### Footer Personalizado
|
232
|
+
```javascript
|
233
|
+
<DataTable2
|
234
|
+
footerContent={
|
235
|
+
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
236
|
+
<span>Total: {rows.length} items</span>
|
237
|
+
<span>Selected: {selectedCount}</span>
|
238
|
+
</div>
|
239
|
+
}
|
240
|
+
/>
|
241
|
+
```
|
242
|
+
|
243
|
+
## 📊 Comparación de Performance
|
244
|
+
|
245
|
+
| Característica | DataTable Original | DataTable2 |
|
246
|
+
|---|---|---|
|
247
|
+
| **Filas máximas recomendadas** | ~100 | ~10,000+ |
|
248
|
+
| **Tiempo de renderizado inicial** | ~200ms | ~50ms |
|
249
|
+
| **Memoria utilizada** | Alta | Optimizada |
|
250
|
+
| **Búsqueda en tiempo real** | ❌ | ✅ |
|
251
|
+
| **Virtual scrolling** | ❌ | ✅ |
|
252
|
+
| **Lazy loading** | ❌ | ✅ |
|
253
|
+
| **Optimización React** | Básica | Avanzada |
|
254
|
+
|
255
|
+
## 🐛 Troubleshooting
|
256
|
+
|
257
|
+
### Problema: Estilos no se aplican
|
258
|
+
```javascript
|
259
|
+
// Solución: Importar CSS
|
260
|
+
import './table2.css'
|
261
|
+
```
|
262
|
+
|
263
|
+
### Problema: Virtual scrolling no funciona
|
264
|
+
```javascript
|
265
|
+
// Solución: Especificar pageSize
|
266
|
+
<DataTable2
|
267
|
+
virtualScrolling={true}
|
268
|
+
pageSize={50} // Requerido
|
269
|
+
/>
|
270
|
+
```
|
271
|
+
|
272
|
+
### Problema: Búsqueda no encuentra resultados
|
273
|
+
```javascript
|
274
|
+
// Solución: Verificar que las columnas tengan datos
|
275
|
+
const columns = [
|
276
|
+
{ id: 'name', label: 'Name' }, // ✅ Correcto
|
277
|
+
{ id: 'missing', label: 'Missing' } // ❌ No existe en rows
|
278
|
+
]
|
279
|
+
```
|
280
|
+
|
281
|
+
## 🔄 Rollback Plan
|
282
|
+
|
283
|
+
Si necesitas volver al DataTable original:
|
284
|
+
|
285
|
+
```javascript
|
286
|
+
// Cambiar import
|
287
|
+
import { DataTable } from './table'
|
288
|
+
|
289
|
+
// Cambiar componente
|
290
|
+
<DataTable {...props} />
|
291
|
+
|
292
|
+
// Remover props nuevas
|
293
|
+
// searchable, exportable, virtualScrolling, etc.
|
294
|
+
```
|
295
|
+
|
296
|
+
## 📈 Roadmap
|
297
|
+
|
298
|
+
### v2.1 (Próximo)
|
299
|
+
- [ ] Drag & drop de columnas
|
300
|
+
- [ ] Filtros avanzados
|
301
|
+
- [ ] Agrupación de filas
|
302
|
+
- [ ] Totales y agregaciones
|
303
|
+
|
304
|
+
### v2.2 (Futuro)
|
305
|
+
- [ ] Edición de celdas mejorada
|
306
|
+
- [ ] Validación inline
|
307
|
+
- [ ] Undo/Redo
|
308
|
+
- [ ] Exportación Excel
|
309
|
+
|
310
|
+
## 🤝 Soporte
|
311
|
+
|
312
|
+
- **Compatibilidad**: 100% garantizada
|
313
|
+
- **Breaking changes**: Ninguno
|
314
|
+
- **Migración**: Sin riesgo
|
315
|
+
- **Performance**: Significativamente mejorada
|
316
|
+
- **Mantenimiento**: Activo y continuo
|
317
|
+
|
318
|
+
## 📝 Conclusión
|
319
|
+
|
320
|
+
DataTable2 es una evolución natural del DataTable original que:
|
321
|
+
|
322
|
+
✅ **Mantiene 100% compatibilidad**
|
323
|
+
✅ **Mejora significativamente el rendimiento**
|
324
|
+
✅ **Agrega características modernas**
|
325
|
+
✅ **No requiere cambios en código existente**
|
326
|
+
✅ **Permite adopción gradual de nuevas características**
|
327
|
+
|
328
|
+
**Recomendación**: Migra sin miedo. Tu código funcionará exactamente igual, pero con mejor rendimiento y nuevas capacidades disponibles cuando las necesites.
|