Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Typetable #1105

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions cli/src/Morphir/Web/DevelopApp.elm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import Morphir.Visual.Components.InputComponent as InputComponent
import Morphir.Visual.Components.ModalComponent exposing (attachModal)
import Morphir.Visual.Components.SectionComponent as SectionComponent
import Morphir.Visual.Components.SelectableElement as SelectableElement
import Morphir.Visual.Components.TableView as TableView
import Morphir.Visual.Components.TabsComponent as TabsComponent
import Morphir.Visual.Components.TreeViewComponent as TreeViewComponent
import Morphir.Visual.Components.TypeBuilder as TypeBuilder
Expand Down Expand Up @@ -146,6 +147,7 @@ type alias Model =
, modalContent : Element Msg
, version : String
, showSaveTestError : Bool
, tableViewConfig : TableView.Config Msg
, unsavedChanges : Bool
}

Expand Down Expand Up @@ -238,6 +240,10 @@ init flags url key =
, modalContent = none
, version = flags.version
, showSaveTestError = False
, tableViewConfig =
{ state = TableView.init
, onStateChange = TableViewChanged
}
, unsavedChanges = False
}
in
Expand Down Expand Up @@ -279,6 +285,7 @@ type Msg
| Insight InsightMsg
| Testing TestingMsg
| Decoration DecorationMsg
| TableViewChanged TableView.State
| DoNothing


Expand Down Expand Up @@ -761,6 +768,14 @@ update msg model =
DoNothing ->
( model, Cmd.none )

TableViewChanged newTableViewState ->
let
tableViewConfig : TableView.Config Msg
tableViewConfig =
model.tableViewConfig
in
( { model | tableViewConfig = { tableViewConfig | state = newTableViewState } }, Cmd.none )



-- SUBSCRIPTIONS
Expand Down Expand Up @@ -1367,6 +1382,33 @@ viewDecorationValues model node =
[ attributeToEditors ]


decorationEditor theme editorStates decorationID decorationDetail node =
let
irValue : Maybe (Value () ())
irValue =
decorationDetail.data
|> SDKDict.get node
nodeDetail : DecorationNodeID
nodeDetail =
{ decorationID = decorationID, nodeID = node }
editorState : ValueEditor.EditorState
editorState =
editorStates
|> SDKDict.get nodeDetail
|> Maybe.withDefault
(ValueEditor.initEditorState
decorationDetail.iR
(Type.Reference () decorationDetail.entryPoint [])
irValue
)
in
ValueEditor.view
theme
decorationDetail.iR
(Type.Reference () decorationDetail.entryPoint [])
(Decoration << DecorationValueUpdated nodeDetail)
editorState

{-| Display the home UI
-}
viewHome : Model -> PackageName -> Package.Definition () (Type ()) -> Element Msg
Expand Down Expand Up @@ -1496,6 +1538,19 @@ viewHome model packageName packageDef =
moduleName
]
}
, { name = "Type Table"
, content =
col
[ TableView.viewTypeTable
model.theme
model.tableViewConfig
packageName
packageDef
(model.homeState.selectedModule |> Maybe.map Tuple.second)
model.allDecorationConfigAndData
(decorationEditor model.theme model.decorationEditorStates)
]
}
]

Nothing ->
Expand Down
9 changes: 9 additions & 0 deletions cli/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
padding: 0;
margin: 0;
}

.sticky-headers {
position: relative;
}
.sticky-headers div[class^="gp grid-pos-1-"] {
position: sticky;
top: 0;
z-index: 9999;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.6/standalone/umd/vis-network.min.js" integrity="sha512-OwMVEyxgfpnZtZDE4ZH1/SB3Xgvx5CwX+/xJJx7men0Vh6VjWp4uEytx34AHQKbh+Ve4KogeyYqZbujEmAQXLA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "morphir-elm",
"version": "2.83.0",
"version": "2.83.1-typetable.1",
"description": "Elm bindings for Morphir",
"types": "lib/dist/main.d.ts",
"main": "lib/dist/main.js",
"engines": {
"npm": "8.5.5",
"node": "v16.14.0"
},
"scripts": {
"clean": "gulp clean",
"test": "gulp test",
Expand Down
Loading