comparison demo/more/grid.ur @ 960:6f34950825b6

Hopefully fixed Jscomp bug that was breaking Grid
author Adam Chlipala <adamc@hcoop.net>
date Sat, 19 Sep 2009 10:56:09 -0400
parents 3aaac251a5af
children 8c37699de273
comparison
equal deleted inserted replaced
959:53b9aeac676c 960:6f34950825b6
55 Rows : Dlist.dlist {Row : source M.row, 55 Rows : Dlist.dlist {Row : source M.row,
56 Cols : source ($(map snd3 M.cols)), 56 Cols : source ($(map snd3 M.cols)),
57 Updating : source bool, 57 Updating : source bool,
58 Selected : source bool}, 58 Selected : source bool},
59 Selection : source bool, 59 Selection : source bool,
60 Filters : $(map thd3 M.cols)} 60 Filters : $(map thd3 M.cols),
61 Sort : source (option (M.row -> M.row -> bool))}
61 62
62 fun newRow cols row = 63 fun newRow cols row =
63 rowS <- source row; 64 rowS <- source row;
64 cols <- makeAll cols row; 65 cols <- makeAll cols row;
65 colsS <- source cols; 66 colsS <- source cols;
84 (meta.Handlers state).CreateFilter) 85 (meta.Handlers state).CreateFilter)
85 [_] M.folder M.cols cols; 86 [_] M.folder M.cols cols;
86 87
87 rows <- Dlist.create; 88 rows <- Dlist.create;
88 sel <- source False; 89 sel <- source False;
90 sort <- source None;
89 91
90 return {Cols = cols, 92 return {Cols = cols,
91 Rows = rows, 93 Rows = rows,
92 Selection = sel, 94 Selection = sel,
93 Filters = filters} 95 Filters = filters,
96 Sort = sort}
94 97
95 fun sync {Cols = cols, Rows = rows, ...} = 98 fun sync {Cols = cols, Rows = rows, ...} =
96 Dlist.clear rows; 99 Dlist.clear rows;
97 init <- rpc M.list; 100 init <- rpc M.list;
98 rs <- List.mapM (newRow cols) init; 101 rs <- List.mapM (newRow cols) init;
216 previous <- combinedFilter row; 219 previous <- combinedFilter row;
217 this <- (meta.Handlers state).Filter filter row; 220 this <- (meta.Handlers state).Filter filter row;
218 return (previous && this)) 221 return (previous && this))
219 (fn _ => return True) 222 (fn _ => return True)
220 [_] M.folder M.cols grid.Cols grid.Filters row, 223 [_] M.folder M.cols grid.Cols grid.Filters row,
221 Sort = return (Some (fn _ _ => return True))} 224 Sort = f <- signal grid.Sort;
225 return (Option.mp (fn f r1 r2 => r1 <- signal r1.Row;
226 r2 <- signal r2.Row;
227 return (f r1 r2)) f)}
222 grid.Rows} 228 grid.Rows}
223 229
224 <dyn signal={rows <- Dlist.foldl (fn row => Monad.mapR2 [aggregateMeta M.row] [id] [id] 230 <dyn signal={rows <- Dlist.foldl (fn row => Monad.mapR2 [aggregateMeta M.row] [id] [id]
225 (fn [nm :: Name] [t :: Type] meta acc => 231 (fn [nm :: Name] [t :: Type] meta acc =>
226 Monad.mp (fn v => meta.Step v acc) 232 Monad.mp (fn v => meta.Step v acc)