Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iTasks-SDK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
74
Issues
74
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
iTasks-SDK
Commits
c19e0a92
Commit
c19e0a92
authored
Nov 05, 2018
by
Bas Lijnse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Design sketch for editor improvements
parent
4312a995
Pipeline
#15908
passed with stage
in 3 minutes and 45 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
0 deletions
+114
-0
Libraries/iTasks/UI/RefinedEditor.dcl
Libraries/iTasks/UI/RefinedEditor.dcl
+114
-0
No files found.
Libraries/iTasks/UI/RefinedEditor.dcl
0 → 100644
View file @
c19e0a92
definition
module
iTasks
.
UI
.
RefinedEditor
//Collaboration with a distributed message set and versions needs to be built into
//interact. The state and message queue will be shared between tasks instead of the editor value
CollabModel
s
:==
(
Versioned
s
,
[
Versioned
EditorUpdate
])
Versioned
a
:==
(!
Int
,!
a
)
SDS
Int
(
Either
(
Version
s
)
[
Version
s
])
//Tasks to handle side-effects
//Definition of an editor
//Each editor defines a client and a server component with their own state.
//They communicate through a shared message type
::
[(
String
,
c
->
(
c
,
Maybe
msg
))]
->
EditorClient
c
msg
::
Editor
v
s
c
=
E
.
msg
:
{
client
::
EditorClient
c
msg
,
server
::
EditorServer
v
s
c
msg
}
::
EditorClient
c
msg
=
{
init
::
c
!
JSObject
*
JSWorld
->
*(!
Maybe
msg
,
!*
JSWorld
)
,
destroy
::
!
JSObject
*
JSWorld
->
*
JSWorld
,
onEvent
::
!
String
!
JSObject
!
JSObject
!*
JSWorld
->
(!
Maybe
msg
,
!*
JSWorld
)
,
onMessage
::
msg
!
JSObject
!*
JSWorld
->
*(!
Maybe
msg
,
!*
JSWorld
)
,
setState
::
c
!
JSObject
!*
JSWorld
->
*(!
Maybe
msg
,
*
JSWorld
)
,
getState
::
!
JSObject
!*
JSWorld
->
*(!
c
,
*
JSWorld
)
}
::
EditorServer
v
s
c
msg
=
{
init
::
s
->
c
//Derive the initial client state from the server state
,
onSet
::
s
s
->
(
s
,
Maybe
msg
)
,
onMessage
::
msg
s
->
(
s
,
Maybe
msg
)
,
toValue
::
s
->
EditorValue
v
,
fromValue
::
(
EditorValue
v
)
->
s
}
class
EditorMessage
m
where
encodeEditorMessage
::
m
->
EditStateUpdate
decodeEditorMessage
::
EditStateUpdate
->
m
class
EditorState
s
where
encodeEditorState
::
s
->
EditState
decodeEditorState
::
EditState
->
s
//Exposing editors valid/invalid/empty judgement
::
EditorValue
a
=
ValidValue
a
|
InvalidValue
|
EmptyValue
//Generic untyped edit state
::
EditState
=
{
attributes
::
Map
AttributeName
AttributeValue
,
children
::
[
EditState
]
}
::
AttributeName
:==
String
::
AttributeValue
:==
JSONNode
::
EditStateUpdate
// (basically current UIChange type)
=
Replace
EditState
|
Change
[
AttributeUpdate
]
[
ChildUpdate
]
|
Nop
::
AttributeUpdate
=
SetAttribute
AttributeName
AttributeValue
|
DelAttribute
AttributeName
::
ChildUpdate
=
RemoveChild
Int
|
InsertChild
Int
EditState
|
UpdateChild
Int
EditStateUpdate
::
ClientState
:==
EditState
::
ServerState
:==
EditState
//Editor composition
//- client side without communication
//- service
//Example: Dynamic [Int] editor built from textField, textView and button controls
// - Editor for each item in the list
// - Button to add a blank new item
// - Dynamic label that shows the number of items
// - Buttons with each item for moving i
listEditor
::
(
Editor
a
s
c
)
->
Editor
[
a
]
[
s
]
[
c
]
label
::
String
->
Editor
String
()
LabelDef
button
::
String
->
Editor
Bool
Bool
ButtonDef
textView
::
Editor
String
TextViewDef
TextViewDef
textField
::
Editor
String
TextFieldDef
TextFieldDef
integerField
::
Editor
Int
TextFieldDef
TextFieldDef
::
ButtonDef
=
{
clicked
::
Bool
,
label
::
Maybe
String
,
icon
::
Maybe
String
}
::
TextFieldDef
=
{
text
::
String
,
touched
::
Bool
}
::
TextViewDef
=
{
text
::
String
}
::
LabelDef
=
{
text
::
String
}
//editor voor getal
//editor voor boolean (checkbox)
//combinatie voor (maybe getal)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment