git.iko.soy/typeable/elm-ui
on master help sign in
fixes #32: table source order is topleft to bottom right for focus
commit464f76f04ecde1d0c605623c17aeee3d15fdae3e authorMatthew Griffith <mdg.griffith@gmail.com> dateMon 24 Sep 2018, 08:10 (8 years ago) parentaa29930
2 files changed+65−9
src/Element.elm+9−9 tests/cases/resolved/ReversedTableOrder.elm+56
src/Element.elm+9−9
@@ -938,11 +938,11 @@ tableHelper attrs config =
938938 }
939939
940940 InternalColumn col ->
941− { cursor
942− | elements =
943− onGrid cursor.row cursor.column (col.view cell)
944− :: cursor.elements
945− , column = cursor.column + 1
941+ { elements =
942+ onGrid cursor.row cursor.column (col.view cell)
943+ :: cursor.elements
944+ , column = cursor.column + 1
945+ , row = cursor.row
946946 }
947947
948948 build columns rowData cursor =
@@ -952,9 +952,9 @@ tableHelper attrs config =
952952 cursor
953953 columns
954954 in
955− { newCursor
956− | row = cursor.row + 1
957− , column = 1
955+ { elements = newCursor.elements
956+ , row = cursor.row + 1
957+ , column = 1
958958 }
959959
960960 children =
@@ -983,7 +983,7 @@ tableHelper attrs config =
983983 children.elements
984984
985985 Just renderedHeaders ->
986− renderedHeaders ++ children.elements
986+ renderedHeaders ++ List.reverse children.elements
987987 )
988988 )
989989
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+ }