Commit 80b4a861 authored by Steffen Michels's avatar Steffen Michels

Merge branch 'editor-gtext-for-array' into 'master'

add editor and gtext instances for arrays and strict arrays

See merge request !370
parents 06a2a439 a378ccb7
Pipeline #36840 passed with stage
in 6 minutes and 55 seconds
......@@ -22,7 +22,7 @@ generic gText a :: !TextFormat (Maybe a) -> [String]
//Default available instances
derive gText UNIT, PAIR, EITHER, CONS of {gcd_name,gcd_type_def}, OBJECT, RECORD, FIELD of {gfd_name}
derive gText Int, Real, Char, Bool, String, [], (), (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,), (->), Dynamic
derive gText Int, Real, Char, Bool, String, [], (), (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,), (->), Dynamic, {}, {!}
derive gText Maybe, Either, MaybeError, Map, JSONNode, HtmlTag, Timestamp, Timespec, ClockParameter
//Wrapper functions for visualization
......
......@@ -58,6 +58,10 @@ gText{|[]|} fx mode Nothing = [""]
gText{|Maybe|} fx mode (Just val) = fromMaybe ["-"] (fmap (\v -> fx mode (Just v)) val)
gText{|Maybe|} fx mode Nothing = fx AsHeader Nothing
gText{|{}|} fx mode (Just val) = [concat (["{": flatten ('DL'.intersperse [", "] [fx mode (Just x) \\ x <-: val])] ++ ["}"])]
gText{|{}|} fx mode Nothing = [""]
gText{|{!}|} fx mode (Just val) = [concat (["{!": flatten ('DL'.intersperse [", "] [fx mode (Just x) \\ x <-: val])] ++ ["}"])]
gText{|{!}|} fx mode Nothing = [""]
gText{|Dynamic|} _ _ = []
gText{|(->)|} _ _ _ _ = []
gText{|JSONNode|} _ val = [maybe "" toString val]
......
......@@ -23,7 +23,7 @@ derive gEditor
RECORD of {grd_arity} with ex _ _ _,
FIELD of {gfd_name} with ex _ _ _
derive gEditor Int, Real, Char, Bool, String, [], (), (,), (,,), (,,,), (,,,,), (,,,,,), (->), Dynamic
derive gEditor Int, Real, Char, Bool, String, [], (), (,), (,,), (,,,), (,,,,), (,,,,,), (->), Dynamic, {}, {!}
derive gEditor Maybe, Either, MaybeError, Map, JSONNode, HtmlTag, Timestamp
derive bimap Editor
......@@ -551,4 +551,15 @@ gEditor{|(->)|} _ _ tjx fjx _ _ tjy fjy =
gEditor{|Dynamic|} = emptyEditorWithErrorInEnterMode "A dynamic value cannot be entered."
gEditor{|HtmlTag|} = htmlView
gEditor{|{}|} gtx jex jdx edx =
bijectEditorValue
(\x->[x\\x<-:x])
(\x->{x\\x<-x})
(gEditor{|*->*|} gtx jex jdx edx)
gEditor{|{!}|} gtx jex jdx edx =
bijectEditorValue
(\x->[x\\x<-:x])
(\x->{x\\x<-x})
(gEditor{|*->*|} gtx jex jdx edx)
derive gEditor JSONNode, Either, MaybeError, (,), (,,), (,,,), (,,,,), (,,,,,), Timestamp, Map
......@@ -26,9 +26,6 @@ derive gText HtmlAttr
derive gEditor SVGElt, SVGAttr, SVGAlign, SVGColor, SVGDefer, SVGFillOpacity, SVGFuncIRI, SVGLengthAdjust, SVGLengthUnit, SVGLineCap, SVGFillRule, SVGLineJoin, SVGMeetOrSlice, SVGStrokeMiterLimit, SVGPaint, SVGStrokeDashArray, SVGStrokeDashOffset, SVGStrokeWidth, SVGTransform, SVGZoomAndPan, SVGLength, SVGICCColor
derive gText SVGElt, SVGAttr, SVGAlign, SVGColor, SVGDefer, SVGFillOpacity, SVGFuncIRI, SVGLengthAdjust, SVGLengthUnit, SVGLineCap, SVGFillRule, SVGLineJoin, SVGMeetOrSlice, SVGStrokeMiterLimit, SVGPaint, SVGStrokeDashArray, SVGStrokeDashOffset, SVGStrokeWidth, SVGTransform, SVGZoomAndPan, SVGLength, SVGICCColor
derive gEditor {}
derive gText {}
//Common iTasks system types
derive class iTask TaskId, TaskListFilter, AttachmentStatus
......
......@@ -17,9 +17,6 @@ import StdArray
gEq{|(->)|} _ _ fa fb = False // HACK: Compare string representations of graphs functions are never equal
gEq{|Dynamic|} _ _ = False // dynamics are never equal
gEditor{|{}|} _ _ tjx fjx = emptyEditorWithDefaultInEnterMode_ (JSONEncode{|* -> *|} tjx) (JSONDecode{|* -> *|} fjx) {}
gText{|{}|} _ _ _ = []
derive gEditor SVGElt, SVGAttr, SVGAlign, SVGColor, SVGDefer, SVGFillOpacity, SVGFuncIRI, SVGLengthAdjust, SVGLengthUnit, SVGLineCap, SVGFillRule, SVGLineJoin, SVGMeetOrSlice, SVGStrokeMiterLimit, SVGPaint, SVGStrokeDashArray, SVGStrokeDashOffset, SVGStrokeWidth, SVGTransform, SVGZoomAndPan, SVGLength, SVGICCColor
derive gText SVGElt, SVGAttr, SVGAlign, SVGColor, SVGDefer, SVGFillOpacity, SVGFuncIRI, SVGLengthAdjust, SVGLengthUnit, SVGLineCap, SVGFillRule, SVGLineJoin, SVGMeetOrSlice, SVGStrokeMiterLimit, SVGPaint, SVGStrokeDashArray, SVGStrokeDashOffset, SVGStrokeWidth, SVGTransform, SVGZoomAndPan, SVGLength, SVGICCColor
derive gEditor HtmlAttr
......
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