module InputTable.TestData exposing (..) import InputTable.Model as Model import Dict tableState : Model.TableState A Person tableState = { columns = columns , rows = rows , accordionColumns = Nothing , searchText = "" , showVisibleColumnsUi = False {- specifies whether to show controls to toggle columns -} , sorting = Model.NoSorting , pageSize = Just 10 {- number of rows per page, if nothing then all rows are displayed -} , currentPage = 1 , rowsAreSelectable = True , sideBarHeaders = Nothing , sideBarRowId = Nothing , tableAction = Nothing , hasSideTable = False , sideColumns = [ Model.SideColumn "Name" .name , Model.SideColumn "Email" .email ] , sideRows = [] , showSideTable = False , sideSearchText = "" , cannotAssignSideRowsReason = Nothing , sideTableIsAssigning = False , sideTableAction = "" , sideTablePreposition = "" , focussedRow = Nothing , rowIdsToTitles = Dict.empty , savingState = Model.None } type alias A = { x : String , y : Bool , z : String , n : Int , parent : String , child : Maybe String } rows : List (Model.Row A) rows = [ row1, row2, row3, row4 ] row1 : Model.Row A row1 = { id = "1" , checkboxDisabledMsg = Nothing , data = { x = "10a" , y = False , z = "20e" , n = 10 , parent = "a" , child = Just "x" } , checked = False , disabledMsg = Nothing , accordionRows = Nothing , accordionExpanded = False , rowFocusUrl = Nothing } row2 : Model.Row A row2 = { id = "2" , checkboxDisabledMsg = Nothing , data = { x = "10b" , y = True , z = "10f" , n = 2 , parent = "a" , child = Just "y" } , checked = False , disabledMsg = Nothing , accordionRows = Nothing , accordionExpanded = False , rowFocusUrl = Nothing } row3 : Model.Row A row3 = { id = "3" , checkboxDisabledMsg = Nothing , data = { x = "20a" , y = True , z = "10f" , n = 20 , parent = "b" , child = Just "x" } , checked = False , disabledMsg = Nothing , accordionRows = Nothing , accordionExpanded = False , rowFocusUrl = Nothing } row4 : Model.Row A row4 = { id = "4" , checkboxDisabledMsg = Nothing , data = { x = "20b" , y = False , z = "20g" , n = 21 , parent = "b" , child = Just "y" } , checked = False , disabledMsg = Nothing , accordionRows = Nothing , accordionExpanded = False , rowFocusUrl = Nothing } columns : List (Model.Column A) columns = [ columnX "", columnY Nothing, columnZ "", columnN, columnSubdropdown ] columnX : String -> Model.Column A columnX filter = { id = "1" , name = "Column1" , visible = True , hasNumericalValues = False , subType = Model.DisplayColumn { get = .x , filter = filter , getSortVal = Nothing } , description = "" } columnY : Maybe Bool -> Model.Column A columnY filter = { id = "2" , name = "Column3" , visible = True , hasNumericalValues = False , subType = Model.CheckboxColumn { get = .y , set = (\r b -> r) , filter = filter } , description = "" } columnZ : String -> Model.Column A columnZ filter = { id = "3" , name = "Column3" , visible = True , hasNumericalValues = False , subType = Model.DisplayColumn { get = .z , filter = filter , getSortVal = Nothing } , description = "" } columnN : Model.Column A columnN = { id = "4" , name = "Column4" , visible = True , hasNumericalValues = True , subType = Model.DisplayColumn { get = .n >> toString , filter = "" , getSortVal = Nothing } , description = "" } columnSubdropdown : Model.Column A columnSubdropdown = { id = "5" , name = "Column5" , visible = True , hasNumericalValues = True , subType = Model.SubDropdownColumn { get = (\r -> ( r.parent, r.child )) , set = (\r ( parent, child ) -> { r | parent = parent, child = child }) , focussedOption = Nothing , focussedRowId = Nothing , options = [ { parent = "a" {- parent level dropdown text -} , isSelectable = True {- decides parent can be selected -} , childHeader = Just "first parent" {- header a top of children list text -} , children = [ "x", "y" ] {- list of children -} } , { parent = "b" {- parent level dropdown text -} , isSelectable = False {- decides parent can be selected -} , childHeader = Nothing {- header a top of children list text -} , children = [ "x", "y", "z" ] {- list of children -} } ] , filter = "" } , description = "" } type alias Person = { name : String , email : String }