created: 20191214071309583 creator: EricShulman modified: 20230109220547803 modifier: EricShulman tags: $:/tags/Macro TiddlyTools title: $:/ThirdParty/TiddlyTools/Macros/edit-list \define edit-list( id:"", tiddler:"", field:"text", index:"", timestamp:"yes", default:"", placeholder:"", tooltip:"", type:"", width:"15em", filter:"", find:"", goto:"no", confirm:"no", focus:"no", focusPopup:"", cancelPopups:"no", listwidth:"100%", listheight:"10", stretch:"no", show:"no", fontsize:"100%", colors:"no", multiple:"no", view:"<>", mobile:"auto" ) \whitespace trim \define filter() $filter$ <$vars tid={{{ [[$tiddler$]!match[]else] }}} re="[^a-zA-Z0-9\-\_]"> <$vars id={{{ [[$index$]!match[]else[$field$]] +[addprefix[/]addprefixaddsuffix[_$id$]] }}}> <$vars id={{{ [search-replace[$:/],[]search-replace:g:regexp,[_]addsuffixsearch-replace:g:[--],[-]search-replace:g:[__],[_]] }}}> <$vars modal={{{ [[$:/state/modal/edit-list/]addsuffix] }}}> <$vars popup={{{ [[$:/state/popup/edit-list/]addsuffix] }}}> <$vars popup={{{ [!match[]] [[$type$]match[calendar]] +[limit[1]then[$show$]match[no]then] }}}> <$vars minmax={{{ [[$:/state/popup/edit-list/minmax/]addsuffix] }}}> <$vars field={{{ [[$index$]match[]then[$field$]else[]] }}} index="""$index$""" timestamp="""$timestamp$""" goto_button={{{ [[$goto$]match[yes]] }}} default="""$default$""" placeholder="""$placeholder$""" tooltip="""$tooltip$""" width={{{ [[$width$]match[auto]then[15em]else[$width$]] }}} filter=<> find="""$find$""" confirm="""$confirm$""" listwidth={{{ [[$listwidth$]match[fit]then[auto]else[$listwidth$]] }}} listheight="""$listheight$""" show="""$show$""" fontsize="""$fontsize$""" stretch={{{ [[$stretch$]match[yes]then[auto]else[$stretch$]] }}} focus="""$focus$""" focusPopup={{{ [[$focusPopup$]!match[]thenelse[$focusPopup$]] }}} multiple={{{ [[$multiple$]match[yes]] }}} calendar={{{ [[$type$]match[calendar]then[TiddlyTools/Time/Calendar]is[tiddler]then[yes]] }}} type={{{ [[$type$]match[calendar]then[TiddlyTools/Time/Calendar]is[missing]then[date]else[$type$]] }}} show={{{ [[$type$]match[calendar]then[TiddlyTools/Time/Calendar]is[missing]then[no]else[$show$]] }}} > <$vars openpopup=""" <$action-deletetiddler $filter="[prefix[$:/state/popup/edit-list/]] -[prefix[$:/state/popup/edit-list/currentitem/]] -[]"/> <$action-setfield $tiddler=<> text="show"/>""" closepopup=""" <$action-deletetiddler $filter="[]"/>""" gotoinput=""" <$action-sendmessage $message="tm-focus-selector" $param={{{ [[.editlist_input_]addsuffix] }}}/>""" gotoselect=""" <$action-sendmessage $message="tm-focus-selector" $param={{{ [[.editlist_popup_select_]addsuffix] }}}/>""" startmodal=""" <$list filter="[match[yes]then!is[tiddler]]"><$action-setfield $tiddler=<> title=<>/>""" maximize=""" <$action-setfield $tiddler=<> hmax="yes" vmax="yes"/>""" minimize=""" <$action-deletetiddler $filter="[]"/>""" input=""" <$eventcatcher $focusin="<$list filter='[!match[]]'><><>"> <$eventcatcher $focusout="<$list filter='[!is[tiddler]]'><>"> <$edit-text tiddler={{{ [is[tiddler]else] }}} class={{{ [[tc-popup-handle editlist_input editlist_input_]addsuffix] }}} tag="input" type=<> field=<> index=<> default=<> placeholder=<> cancelPopups="$cancelPopups$" focus={{{ [is[tiddler]then[yes]else] }}} focusPopup={{{ [[$focusPopup$]!match[yes]then[$focusPopup$]] }}}/>""" select=""" <$eventcatcher $focusin="<><>"> <$eventcatcher $focusout="<$list filter='[!is[tiddler]]'><>"> <$eventcatcher $click="<$list filter='[!is[tiddler]then!match[yes]]'><><>"> <> <$select tiddler={{{ [is[tiddler]else] }}} field=<> index=<> multiple=<> class={{{ [[editlist_select editlist_popup_select_]addsuffix] }}} size={{{ [get[vmax]match[yes]then[2]] ~[regexp[^\d+$]!match[1]else[2]] }}}> <>""" option=""" <$vars fg={{{ [enlistmatchthen[white;]else[black;]] }}}> <$vars colors={{{ [[$colors$]match[yes]then[background-color:]addsuffixaddsuffix[;color:]addsuffix] }}}> """ dark=""" Black Blue DarkBlue DarkGreen DarkOliveGreen DarkSlateBlue DarkSlateGrey DimGrey ForestGreen Grey Indigo Maroon MediumBlue MidnightBlue Navy Purple""" save=""" <$list filter="[is[tiddler]]"> <$vars newval={{{ [getindex] ~[get] }}}> <$action-setfield $timestamp=<> $tiddler=<> $field=<> $index=<> $value=<>/> <$list filter="[match[]]"><>""" clear=""" <$action-setfield $timestamp=<> $tiddler=<> $field=<> $index=<> $value=""/> <$action-deletetiddler $tiddler=<>/> <><>""" done=""" <$action-deletetiddler $filter="[] []"/>""" goto=""" <$list filter="[[$goto$]match[yes]]"> <$vars tid={{{ [is[tiddler]else] }}}> <$list filter="[!match[yes]]"><$action-navigate $to={{{ [getindex] ~[get] }}}/> <$list filter="[match[yes]]" ><$list filter="[getindex] ~[get] +[enlist-input[]]"><$action-navigate/>""" reset=""" <$list filter="[match[shift]]"><$action-setfield $timestamp=<> $tiddler=<> $field=<> $index=<>/> <$list filter="[!match[]thenget[text]match[{}]]"> <$action-setfield $timestamp=<> $tiddler=<> $field="text"/> <$action-setfield $timestamp=<> $tiddler=<> $field="type"/>""" > <$vars currentitem= {{{ [[$:/state/popup/edit-list/currentitem/]addsuffix] }}} showitem=""" <$list filter='[!match[]]' emptyMessage=""> <$text text=$view$/>""" toggleitem=""" <$list filter='[!match[yes]]'><$action-setfield $tiddler=<> $field=<> $index=<> $value={{{ [match[]then] }}}/> <$list filter='[match[yes]]' ><$action-listops $tiddler=<> $field=<> $index=<> $subfilter='+[toggle]' />""" trackitem=""" <$action-setfield $tiddler=<> offset=<> item=<>/>""" gotoitem=""" <$vars i={{{ [get[offset]else] }}}> <$vars i={{{ [!match[]thenminmax[1]else] }}}> <$action-sendmessage $message="tm-focus-selector" $param={{{ [[.editlist_popup_select_]addsuffixaddsuffix[_]addsuffix] }}}/> <$action-deletetiddler $tiddler=<>/>""" select_mobile=""" <$eventcatcher $focusin="<><>"> <$eventcatcher $focusout="<$list filter='[!is[tiddler]]'><>"> <$eventcatcher $click="<$list filter='[!is[tiddler]then!match[yes]]'><><>"> <> <$vars listwidth={{{ [match[100%]thenelse] }}}> <$wikify name="fg" text=<>><$vars fg={{{ [!match[]thenelse[black;]] }}}> <$wikify name="bg" text=<>><$vars bg={{{ [!match[]thenelse[white;]] }}}> <$keyboard key="down" actions="<$vars i=1><>">