git.iko.soy/typeable/elm-ui
on master help sign in
fixes #32: table source order is topleft to bottom right for focus
464f76fMatthew Griffith
src/Element.elm+9−9
@@ -938,11 +938,11 @@ tableHelper attrs config =
938 }
938 }
939
939
940 InternalColumn col ->
940 InternalColumn col ->
941− { cursor
942− | elements =
941+ { elements =
943− onGrid cursor.row cursor.column (col.view cell)
942+ onGrid cursor.row cursor.column (col.view cell)
944− :: cursor.elements
943+ :: cursor.elements
945− , column = cursor.column + 1
944+ , column = cursor.column + 1
945+ , row = cursor.row
946 }
946 }
947
947
948 build columns rowData cursor =
948 build columns rowData cursor =
@@ -952,9 +952,9 @@ tableHelper attrs config =
952 cursor
952 cursor
953 columns
953 columns
954 in
954 in
955− { newCursor
955+ { elements = newCursor.elements
956− | row = cursor.row + 1
956+ , row = cursor.row + 1
957− , column = 1
957+ , column = 1
958 }
958 }
959
959
960 children =
960 children =
@@ -983,7 +983,7 @@ tableHelper attrs config =
983 children.elements
983 children.elements
984
984
985 Just renderedHeaders ->
985 Just renderedHeaders ->
986− renderedHeaders ++ children.elements
986+ renderedHeaders ++ List.reverse children.elements
987 )
987 )
988 )
988 )
989
989
tests/cases/resolved/ReversedTableOrder.elmnew file+56
@@ -0,0 +1,56 @@
1+module Main exposing (Person, main, persons)
2+
3+{-| -}
4+
5+import Element exposing (..)
6+import Element.Background as Background
7+import Element.Font as Font
8+import Element.Input
9+
10+
11+type alias Person =
12+ { firstName : String
13+ , lastName : String
14+ }
15+
16+
17+persons : List Person
18+persons =
19+ [ { firstName = "David"
20+ , lastName = "Bowie"
21+ }
22+ , { firstName = "Florence"
23+ , lastName = "Welch"
24+ }
25+ ]
26+
27+
28+main =
29+ Element.layout [] <|
30+ Element.table []
31+ { data = persons
32+ , columns =
33+ [ { header = Element.text "First Name"
34+ , width = fill
35+ , view =
36+ \person ->
37+ Element.Input.text []
38+ { text = person.firstName
39+ , placeholder = Nothing
40+ , onChange = always Nothing
41+ , label = Element.Input.labelAbove [] Element.none
42+ }
43+ }
44+ , { header = Element.text "Last Name"
45+ , width = fill
46+ , view =
47+ \person ->
48+ Element.Input.text []
49+ { text = person.lastName
50+ , placeholder = Nothing
51+ , onChange = always Nothing
52+ , label = Element.Input.labelAbove [] Element.none
53+ }
54+ }
55+ ]
56+ }