mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-12 11:10:27 +00:00
62bb8affa4
* Add data attribute support to button widget * Fix typo * Refactor ready for making mechanism more generic * Apply more generic implementation to multiplate widgets * Refactor to use existing widget.assignAttributes() method * Fix typo * Clarify docs * Update docs * Update select widget to support style.* attributes * Remove obsolete comment * Fixes refresh issues for checkbox and links widgets for data attributes (#7846) * fix: refresh issues with checkbox and links widgets * fix: indenting * Feat: add support for data attributes to Draggable and Droppable widgets (#7845) * Docs clarification * docs: add style and data attributes to Draggable and Droppable widget docs (#7850) * Refactors Select widget to directly create DOM node (#7848) * fix: refactored SelectWidget to directly create DOM nodes * fix: refactored SelectWidget to directly create DOM nodes * fix: improve refresh handling for select widget * Fixes issues in the PR "Button widget data attributes" (#7852) * fix: fixed ordered attributes handling and improved tests to catch event attributes * fix: clean up code from testing * fix: more tests and refactoring * fix: use lowercase when checking for event attribute prefix * fix: use lowercase when checking for event attribute prefix * fix: changed comment wording * fix: minor refactoring * refactor: for brevity --------- Co-authored-by: Saq Imtiaz <saq.imtiaz@gmail.com>
71 lines
1.9 KiB
Plaintext
71 lines
1.9 KiB
Plaintext
title: $:/core/macros/tabs
|
|
tags: $:/tags/Macro
|
|
code-body: yes
|
|
|
|
\define tabs-button()
|
|
\whitespace trim
|
|
<$button
|
|
set=<<tabsState>>
|
|
setTo=<<currentTab>>
|
|
default=<<__default__>>
|
|
selectedClass="tc-tab-selected"
|
|
tooltip={{!!tooltip}}
|
|
role="switch"
|
|
data-tab-title=<<currentTab>>
|
|
>
|
|
<$tiddler tiddler=<<save-currentTiddler>>>
|
|
<$set name="tv-wikilinks" value="no">
|
|
<$transclude tiddler=<<__buttonTemplate__>> mode="inline">
|
|
<$transclude tiddler=<<currentTab>> field="caption">
|
|
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
|
|
</$transclude>
|
|
</$transclude>
|
|
</$set>
|
|
</$tiddler>
|
|
<<__actions__>>
|
|
</$button>
|
|
\end
|
|
|
|
\define tabs-tab()
|
|
\whitespace trim
|
|
<$set name="save-currentTiddler" value=<<currentTiddler>>>
|
|
<$tiddler tiddler=<<currentTab>>>
|
|
<<tabs-button>>
|
|
</$tiddler>
|
|
</$set>
|
|
\end
|
|
|
|
\define tabs-tab-list()
|
|
\whitespace trim
|
|
<$list filter=<<__tabsList__>> variable="currentTab" storyview="pop">
|
|
<<tabs-tab>>
|
|
</$list>
|
|
\end
|
|
|
|
\define tabs-tab-body()
|
|
\whitespace trim
|
|
<$list filter=<<__tabsList__>> variable="currentTab">
|
|
<$reveal type="match" state=<<tabsState>> text=<<currentTab>> default=<<__default__>> retain=<<__retain__>> tag="div">
|
|
<$transclude tiddler=<<__template__>> mode="block">
|
|
<$transclude tiddler=<<currentTab>> mode="block"/>
|
|
</$transclude>
|
|
</$reveal>
|
|
</$list>
|
|
\end
|
|
|
|
\define tabs(tabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState)
|
|
\whitespace trim
|
|
<$qualify title=<<__state__>> name="qualifiedState">
|
|
<$let tabsState={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>
|
|
<div class={{{ [[tc-tab-set]addsuffix[ ]addsuffix<__class__>] }}}>
|
|
<div class={{{ [[tc-tab-buttons]addsuffix[ ]addsuffix<__class__>] }}}>
|
|
<<tabs-tab-list>>
|
|
</div>
|
|
<div class={{{ [[tc-tab-divider]addsuffix[ ]addsuffix<__class__>] }}}/>
|
|
<div class={{{ [[tc-tab-content]addsuffix[ ]addsuffix<__class__>] }}}>
|
|
<<tabs-tab-body>>
|
|
</div>
|
|
</div>
|
|
</$let>
|
|
</$qualify>
|
|
\end |