5
5
columnHide ,
6
6
ColumnsAggrData ,
7
7
COLUMN_CHILDREN_KEY ,
8
- filterData ,
9
- genSelectionParams ,
10
8
getColumnsAggr ,
11
9
getOriDisplayData ,
12
10
OB_ROW_ORI_INDEX ,
@@ -28,8 +26,6 @@ import {
28
26
withExposingConfigs ,
29
27
} from "comps/generators/withExposing" ;
30
28
import { withMethodExposing } from "comps/generators/withMethodExposing" ;
31
- import { MAP_KEY } from "comps/generators/withMultiContext" ;
32
- import { NameGenerator } from "comps/utils" ;
33
29
import { trans } from "i18n" ;
34
30
import _ , { isArray } from "lodash" ;
35
31
import {
@@ -39,11 +35,9 @@ import {
39
35
deferAction ,
40
36
executeQueryAction ,
41
37
fromRecord ,
42
- FunctionNode ,
43
38
Node ,
44
39
onlyEvalAction ,
45
40
RecordNode ,
46
- RecordNodeToValue ,
47
41
routeByNameAction ,
48
42
ValueAndMsg ,
49
43
withFunction ,
@@ -353,111 +347,7 @@ export class TableImplComp extends TableInitComp {
353
347
shallowEqual ( a [ 1 ] , b [ 1 ] )
354
348
) [ 0 ] ;
355
349
}
356
-
357
- displayDataIndexesNode ( ) {
358
- const nodes = {
359
- oriDisplayData : this . oriDisplayDataNode ( ) ,
360
- } ;
361
- const resNode = withFunction ( fromRecord ( nodes ) , ( input ) => {
362
- return _ ( input . oriDisplayData )
363
- . map ( ( row , idx ) => [ row [ OB_ROW_ORI_INDEX ] , idx ] as [ string , number ] )
364
- . fromPairs ( )
365
- . value ( ) ;
366
- } ) ;
367
- return lastValueIfEqual ( this , "displayDataIndexesNode" , [ resNode , nodes ] as const , ( a , b ) =>
368
- shallowEqual ( a [ 1 ] , b [ 1 ] )
369
- ) [ 0 ] ;
370
- }
371
-
372
- private getUpsertSetResNode (
373
- nodes : Record < string , RecordNode < Record < string , Node < any > > > > ,
374
- filterNewRows ?: boolean ,
375
- ) {
376
- return withFunction ( fromRecord ( nodes ) , ( input ) => {
377
- // merge input.dataIndexes and input.withParams into one structure
378
- const dataIndexRenderDict = _ ( input . dataIndexes )
379
- . mapValues ( ( dataIndex , idx ) => input . renders [ idx ] )
380
- . mapKeys ( ( render , idx ) => input . dataIndexes [ idx ] )
381
- . value ( ) ;
382
- const record : Record < string , Record < string , JSONValue > > = { } ;
383
- _ . forEach ( dataIndexRenderDict , ( render , dataIndex ) => {
384
- _ . forEach ( render [ MAP_KEY ] , ( value , key ) => {
385
- const changeValue = ( value . comp as any ) . comp . changeValue ;
386
- if ( ! _ . isNil ( changeValue ) ) {
387
- if ( ! record [ key ] ) record [ key ] = { } ;
388
- record [ key ] [ dataIndex ] = changeValue ;
389
- }
390
- } ) ;
391
- } ) ;
392
- return record ;
393
- } ) ;
394
- }
395
-
396
- changeSetNode ( ) {
397
- const nodes = {
398
- dataIndexes : this . children . columns . getColumnsNode ( "dataIndex" ) ,
399
- renders : this . children . columns . getColumnsNode ( "render" ) ,
400
- } ;
401
-
402
- const resNode = this . getUpsertSetResNode ( nodes ) ;
403
- return lastValueIfEqual ( this , "changeSetNode" , [ resNode , nodes ] as const , ( a , b ) =>
404
- shallowEqual ( a [ 1 ] , b [ 1 ] )
405
- ) [ 0 ] ;
406
- }
407
-
408
- insertSetNode ( ) {
409
- const nodes = {
410
- dataIndexes : this . children . columns . getColumnsNode ( "dataIndex" ) ,
411
- renders : this . children . columns . getColumnsNode ( "render" ) ,
412
- } ;
413
-
414
- const resNode = this . getUpsertSetResNode ( nodes , true ) ;
415
- return lastValueIfEqual ( this , "insertSetNode" , [ resNode , nodes ] as const , ( a , b ) =>
416
- shallowEqual ( a [ 1 ] , b [ 1 ] )
417
- ) [ 0 ] ;
418
- }
419
-
420
- private getToUpsertRowsResNodes (
421
- nodes : Record < string , FunctionNode < any , any > >
422
- ) {
423
- return withFunction ( fromRecord ( nodes ) , ( input ) => {
424
- const res = _ ( input . changeSet )
425
- . map ( ( changeValues , oriIndex ) => {
426
- const idx = input . indexes [ oriIndex ] ;
427
- const oriRow = _ . omit ( input . oriDisplayData [ idx ] , OB_ROW_ORI_INDEX ) ;
428
- return { ...oriRow , ...changeValues } ;
429
- } )
430
- . value ( ) ;
431
- // console.info("toUpdateRowsNode. input: ", input, " res: ", res);
432
- return res ;
433
- } ) ;
434
- }
435
-
436
- toUpdateRowsNode ( ) {
437
- const nodes = {
438
- oriDisplayData : this . oriDisplayDataNode ( ) ,
439
- indexes : this . displayDataIndexesNode ( ) ,
440
- changeSet : this . changeSetNode ( ) ,
441
- } ;
442
-
443
- const resNode = this . getToUpsertRowsResNodes ( nodes ) ;
444
- return lastValueIfEqual ( this , "toUpdateRowsNode" , [ resNode , nodes ] as const , ( a , b ) =>
445
- shallowEqual ( a [ 1 ] , b [ 1 ] )
446
- ) [ 0 ] ;
447
- }
448
-
449
- toInsertRowsNode ( ) {
450
- const nodes = {
451
- oriDisplayData : this . oriDisplayDataNode ( ) ,
452
- indexes : this . displayDataIndexesNode ( ) ,
453
- changeSet : this . insertSetNode ( ) ,
454
- } ;
455
-
456
- const resNode = this . getToUpsertRowsResNodes ( nodes ) ;
457
- return lastValueIfEqual ( this , "toInsertRowsNode" , [ resNode , nodes ] as const , ( a , b ) =>
458
- shallowEqual ( a [ 1 ] , b [ 1 ] )
459
- ) [ 0 ] ;
460
- }
350
+
461
351
462
352
columnAggrNode ( ) {
463
353
const nodes = {
@@ -652,26 +542,7 @@ TableTmpComp = withMethodExposing(TableTmpComp, [
652
542
comp . children . selection . children . selectedRowKeys . dispatchChangeValueAction ( allKeys ) ;
653
543
} ,
654
544
} ,
655
- {
656
- method : {
657
- name : "cancelChanges" ,
658
- description : "" ,
659
- params : [ ] ,
660
- } ,
661
- execute : ( comp , values ) => {
662
- comp . children . columns . dispatchClearChangeSet ( ) ;
663
- } ,
664
- } ,
665
- {
666
- method : {
667
- name : "cancelInsertChanges" ,
668
- description : "" ,
669
- params : [ ] ,
670
- } ,
671
- execute : ( comp , values ) => {
672
- comp . children . columns . dispatchClearInsertSet ( ) ;
673
- } ,
674
- } ,
545
+
675
546
] ) ;
676
547
677
548
// exposing data
@@ -740,42 +611,7 @@ export const TableLiteComp = withExposingConfigs(TableTmpComp, [
740
611
} ,
741
612
trans ( "table.selectedIndexDesc" )
742
613
) ,
743
- new CompDepsConfig (
744
- "changeSet" ,
745
- ( comp ) => ( {
746
- changeSet : comp . changeSetNode ( ) ,
747
- } ) ,
748
- ( input ) => input . changeSet ,
749
- trans ( "table.changeSetDesc" )
750
- ) ,
751
- new CompDepsConfig (
752
- "insertSet" ,
753
- ( comp ) => ( {
754
- insertSet : comp . insertSetNode ( ) ,
755
- } ) ,
756
- ( input ) => input . insertSet ,
757
- trans ( "table.changeSetDesc" )
758
- ) ,
759
- new CompDepsConfig (
760
- "toUpdateRows" ,
761
- ( comp ) => ( {
762
- toUpdateRows : comp . toUpdateRowsNode ( ) ,
763
- } ) ,
764
- ( input ) => {
765
- return input . toUpdateRows ;
766
- } ,
767
- trans ( "table.toUpdateRowsDesc" )
768
- ) ,
769
- new CompDepsConfig (
770
- "toInsertRows" ,
771
- ( comp ) => ( {
772
- toInsertRows : comp . toInsertRowsNode ( ) ,
773
- } ) ,
774
- ( input ) => {
775
- return input . toInsertRows ;
776
- } ,
777
- trans ( "table.toUpdateRowsDesc" )
778
- ) ,
614
+
779
615
new DepsConfig (
780
616
"pageNo" ,
781
617
( children ) => {
0 commit comments