@@ -2435,6 +2435,12 @@ class DataHarmonizer {
2435
2435
*/
2436
2436
2437
2437
/**
2438
+ * fieldChangeRules() is triggered when user changes a value on a cell,
2439
+ * before that change is committed.
2440
+ *
2441
+ * IMPORTANT: Value of cell user is changing is in change[3], not in
2442
+ * this.hot.getDataAtCell(row, col) - the getDataAtCell() is old value.
2443
+ *
2438
2444
* Iterate through rules set up for named columns
2439
2445
* Like matrixFieldChangeRules but this is triggered by a single change
2440
2446
* by a user edit on a field cell. This creates complexity for fields that
@@ -2481,13 +2487,13 @@ class DataHarmonizer {
2481
2487
// Don't attempt to reformat x/y/z dates here.
2482
2488
const dateGranularity = this . hot . getDataAtCell ( row , col + 1 ) . split ( ' ' ) [ 0 ] ;
2483
2489
// previously had to block x/y/z with change[3].indexOf('/') === -1 &&
2490
+ // ISSUE: not multilingual?
2484
2491
if ( dateGranularity === 'year' || dateGranularity === 'month' ) {
2485
2492
change [ 3 ] = this . setDateChange ( dateGranularity , change [ 3 ] ) ;
2486
2493
}
2487
2494
return ;
2488
2495
}
2489
2496
2490
- /* Deprecating this. Users need to change unit to trigger bin
2491
2497
// Match <field> [field]_unit [field]_bin
2492
2498
const nextNextName =
2493
2499
fields . length > col + 2 ? fields [ col + 2 ] . name : null ;
@@ -2497,7 +2503,6 @@ class DataHarmonizer {
2497
2503
this . binChangeTest ( matrix , col , fields , 2 , triggered_changes ) ;
2498
2504
return ;
2499
2505
}
2500
- */
2501
2506
}
2502
2507
2503
2508
// On [field] here, where next column is "[field]_bin".
@@ -2513,7 +2518,7 @@ class DataHarmonizer {
2513
2518
console . log ( "on" , prevName + '_unit' )
2514
2519
// trigger reevaluation of bin from field
2515
2520
matrixRow [ col - 1 ] = this . hot . getDataAtCell ( row , col - 1 ) ;
2516
- matrixRow [ col ] = this . hot . getDataAtCell ( row , col ) ;
2521
+ matrixRow [ col ] = change [ 3 ] ;
2517
2522
this . binChangeTest ( matrix , col - 1 , fields , 2 , triggered_changes ) ;
2518
2523
return ;
2519
2524
}
0 commit comments