@@ -574,6 +574,16 @@ export const createStore: typeof createStoreDecl = (): Store => {
574574 } ,
575575 ) ;
576576
577+ const setOrDelCell = (
578+ tableId : Id ,
579+ rowId : Id ,
580+ cellId : Id ,
581+ cell : CellOrUndefined ,
582+ ) : Store =>
583+ isUndefined ( cell )
584+ ? delCell ( tableId , rowId , cellId , true )
585+ : setCell ( tableId , rowId , cellId , cell ) ;
586+
577587 const setCellIntoNewRow = (
578588 tableId : Id ,
579589 tableMap : TableMap ,
@@ -1348,29 +1358,6 @@ export const createStore: typeof createStoreDecl = (): Store => {
13481358 cellId ,
13491359 ) ;
13501360
1351- const _setOrDelCell = (
1352- tableId : Id ,
1353- rowId : Id ,
1354- cellId : Id ,
1355- cell : CellOrUndefined ,
1356- ) : void => {
1357- if ( isUndefined ( cell ) ) {
1358- delCell ( tableId , rowId , cellId , true ) ;
1359- } else {
1360- ifNotUndefined (
1361- getValidatedCell ( tableId , rowId , cellId , cell ) ,
1362- ( validCell ) =>
1363- setCellIntoNewRow (
1364- tableId ,
1365- getOrCreateTable ( tableId ) ,
1366- rowId ,
1367- cellId ,
1368- validCell ,
1369- ) ,
1370- ) ;
1371- }
1372- } ;
1373-
13741361 const setValues = ( values : Values ) : Store =>
13751362 fluentTransaction ( ( ) =>
13761363 validateValues ( values ) ? setValidValues ( values ) : 0 ,
@@ -1414,7 +1401,7 @@ export const createStore: typeof createStoreDecl = (): Store => {
14141401 isUndefined ( row )
14151402 ? delRow ( tableId , rowId )
14161403 : objMap ( row , ( cell , cellId ) =>
1417- _setOrDelCell (
1404+ setOrDelCell (
14181405 tableId ,
14191406 rowId ,
14201407 cellId ,
@@ -1645,7 +1632,7 @@ export const createStore: typeof createStoreDecl = (): Store => {
16451632 collForEach ( changedCells , ( table , tableId ) =>
16461633 collForEach ( table , ( row , rowId ) =>
16471634 collForEach ( row , ( [ oldCell ] , cellId ) =>
1648- _setOrDelCell ( tableId , rowId , cellId , oldCell ) ,
1635+ setOrDelCell ( tableId , rowId , cellId , oldCell ) ,
16491636 ) ,
16501637 ) ,
16511638 ) ;
0 commit comments