Commit b92b96af authored by Steffen Michels's avatar Steffen Michels

Merge branch '371-remove-uniqueness-attributes-from-Editor-type' into 'master'

Remove uniqueness from EditMode parameter of genUI; use binumap for gEditor

Closes #371

See merge request !432
parents 1840cd2c 9464b04e
Pipeline #44328 passed with stage
in 9 minutes and 18 seconds
......@@ -25,8 +25,8 @@ from Control.GenBimap import generic bimap
*/
:: Editor a =
//Generating the initial UI
{ genUI :: !UIAttributes DataPath *(EditMode a) *VSt ->
*(MaybeErrorString (!UI, !EditState), *VSt)
{ genUI :: !UIAttributes DataPath (EditMode a) -> *(*VSt ->
*(MaybeErrorString (!UI, !EditState), *VSt))
//React to edit events
, onEdit :: !DataPath (!DataPath, !JSONNode) EditState *VSt ->
*(MaybeErrorString (!UIChange, !EditState), *VSt)
......@@ -180,6 +180,6 @@ isCompound :: !EditState -> Bool
*/
withClientSideInit ::
!(JSVal *JSWorld -> *JSWorld)
!(UIAttributes DataPath a *VSt -> *(MaybeErrorString (!UI, !st), *VSt))
!UIAttributes !DataPath !a !*VSt ->
*(!MaybeErrorString (!UI, !st), !*VSt)
!(UIAttributes -> DataPath -> .(.a -> *(*VSt -> *(MaybeErrorString (!UI, !st),*VSt))))
!UIAttributes !DataPath !.a !*VSt
-> *(!MaybeErrorString (!UI, !st), !*VSt)
......@@ -150,8 +150,9 @@ isCompound (CompoundState _ _) = True
withClientSideInit ::
!(JSVal *JSWorld -> *JSWorld)
!(UIAttributes DataPath a *VSt -> *(MaybeErrorString (!UI, !st), *VSt))
!UIAttributes !DataPath !a !*VSt -> *(!MaybeErrorString (!UI, !st), !*VSt)
!(UIAttributes -> DataPath -> .(.a -> *(*VSt -> *(MaybeErrorString (!UI, !st),*VSt))))
!UIAttributes !DataPath !.a !*VSt
-> *(!MaybeErrorString (!UI, !st), !*VSt)
withClientSideInit initUI genUI attr dp val vst=:{VSt| taskId} = case genUI attr dp val vst of
(Ok (UI type attr items,mask),vst)
# (initUI, vst) = serializeForClient (wrapInitFunction initUI) vst
......
......@@ -13,7 +13,7 @@ from iTasks.Internal.Generic.Visualization import generic gText, :: TextFormat
/**
* Main generic editor function
*/
generic gEditor a | gText a, JSONEncode a, JSONDecode a :: Editor a
generic gEditor a | gText a, JSONEncode a, JSONDecode a *! :: Editor a
derive gEditor
UNIT,
......@@ -26,5 +26,3 @@ derive gEditor
derive gEditor Int, Real, Char, Bool, String, [], (), (,), (,,), (,,,), (,,,,), (,,,,,), (->), Dynamic, {}, {!}
derive gEditor Maybe, Either, MaybeError, Map, JSONNode, HtmlTag, Timestamp, Integer
derive bimap Editor
......@@ -16,8 +16,7 @@ import Text.Language
import System.Time
import Data.GenEq, Data.Func, Control.GenBimap, Data.Functor, Data.Tuple, Data.Integer, Data.Integer.GenJSON
generic gEditor a | gText a, JSONEncode a, JSONDecode a :: Editor a
derive bimap Editor, MaybeError
generic gEditor a | gText a, JSONEncode a, JSONDecode a *! :: Editor a
gEditor{|UNIT|} = emptyEditorWithDefaultInEnterMode_ (\_ _ -> [JSONNull]) (\_ [JSONNull: json] -> (Just UNIT, json)) UNIT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment