44 Ref ,
55 Option ,
66 InferOutputsType ,
7+ PlDataTableState ,
78 isPColumn ,
89 isPColumnSpec
910} from '@milaboratory/sdk-ui' ;
@@ -16,7 +17,11 @@ export type BlockArgs = {
1617 datasetColumns : ( Ref | null ) [ ] ;
1718} ;
1819
19- export const platforma = BlockModel . create < BlockArgs > ( 'Heavy' )
20+ export type UiState = {
21+ treeTableState ?: PlDataTableState ;
22+ } ;
23+
24+ export const platforma = BlockModel . create < BlockArgs , UiState > ( 'Heavy' )
2025
2126 . initialArgs ( {
2227 datasetColumns : [ null ]
@@ -86,29 +91,31 @@ export const platforma = BlockModel.create<BlockArgs>('Heavy')
8691 ) ;
8792 } )
8893
89- // .output('allColumnSpecs', (ctx) => {
90- // return ctx.resultPool
91- // .getSpecsFromResultPool()
92- // .entries
93- // .filter((v) => {
94- // return isPColumnSpec(v.obj);
95- // });
96- // })
94+ . output ( 'allColumnSpecs' , ( ctx ) => {
95+ return ctx . resultPool . getSpecsFromResultPool ( ) . entries . filter ( ( v ) => {
96+ return isPColumnSpec ( v . obj ) ;
97+ } ) ;
98+ } )
9799
98100 . output ( 'trees' , ( ctx ) => {
99- const collection = ctx . outputs
100- ?. resolve ( { field : 'trees' , assertFieldType : 'Input' } )
101- ?. parsePObjectCollection ( ) ;
102- if ( collection === undefined ) return undefined ;
103- // if (collection === undefined || !collection.isComplete) return undefined;
104- const pColumns = Object . entries ( collection )
105- . map ( ( [ id , obj ] ) => obj )
106- . filter ( isPColumn ) ;
107- return ctx . createPFrame ( pColumns ) ;
101+ const pCols = ctx . outputs ?. resolve ( "trees" ) ?. getPColumns ( ) ;
102+ if ( pCols === undefined ) return undefined ;
103+ return ctx . createPTable ( {
104+ columns : pCols ,
105+ filters : ctx . uiState ?. treeTableState ?. pTableParams ?. filters ?? [ ] ,
106+ sorting : ctx . uiState ?. treeTableState ?. pTableParams ?. sorting ?? [ ]
107+ } ) ;
108108 } )
109109
110110 . output ( 'temp' , ( ctx ) => {
111- return ctx . outputs ?. resolve ( 'trees' ) ?. listInputFields ( ) ;
111+ return {
112+ fields : ctx . outputs ?. resolve ( 'trees' ) ?. listInputFields ( ) ,
113+ columns : ctx . outputs ?. resolve ( "trees" ) ?. getPColumns ( ) ?. map ( ( o ) => ( {
114+ spec : o . spec ,
115+ resourseType : o . data . resourceType ,
116+ data : o . data . getDataAsJson ( )
117+ } ) )
118+ }
112119 } )
113120
114121 . output ( 'allelesLog' , ( ctx ) => {
@@ -119,7 +126,10 @@ export const platforma = BlockModel.create<BlockArgs>('Heavy')
119126 return ctx . outputs ?. resolve ( 'treesLog' ) ?. listInputFields ( ) ;
120127 } )
121128
122- . sections ( [ { type : 'link' , href : '/' , label : 'Settings' } ] )
129+ . sections ( [
130+ { type : 'link' , href : '/' , label : 'Settings' } ,
131+ { type : 'link' , href : '/trees' , label : 'Trees Table' }
132+ ] )
123133
124134 . done ( ) ;
125135
0 commit comments