Feature Request - A General list-picker Macro

Are you wikitext savvy enough to PR this?

We need a general “list-picker macro” that takes a filter as input and lists its contents as buttons, via some template!

It ought to be easy to make “picker lists” - click a button, get a dropdown that shows the list of items. Clicking on an item triggers some action, typically set the title value of that item in a field.

I think potential components are already in the core, but integrated into specialized picker solutions:

  • $:/TagManager defines the iconEditor(not public facing)
  • $:/core/macros/colour-picker (public) defines colour-picker which features a neat grid display and a wonderful “Recent”(-ly picked) area. But it is totally specialized (including a hard coded list of colour names).
  • $:/core/macros/tag-picker (public) This seems to be the most general one
    tag-picker(actions, tagField:"tags", tiddler, tagListFilter:"[tags[]sort[]]")

(more?)

A general macro would not necessarily need to replace the macros listed above to be useful even if, I guess, that would be desirable in the longer term. It may be that some of the above implementations serve purposes that are too special for the requested general solution.

Do you agree/disagree - why?
Is it “picker list” or “list picker”? Pist licker?

4 Likes

The tag-picker is a very special macro. Super complex because of backwards compatibility concerns and integrated keyboard handling. Replacing this one, probably is a no go without a huge backlash.

But you are right. There should be a more general picker, that is easy accessible for users.

I agree one should be provided out of the box, especialy since the keyboard widget is so hard to use.

In the editor there is the link editor toolbar button, with its ctrl-L invocation that is ideal for inserting titles into the text field. This could be generalised including permitting a filter to “scope the list” even before searching, to nominate the field and if it has one entry or is a list.

  • The ability to trigger an action would allow many forms of action to be triggered on the selected title but there is an importiant set of standard actions that should be available out of the box.

I have sucessfully cloned $:/core/ui/EditorToolbar/link-dropdown to make variations on the link button.

[Edited]

Please however look more deeply at the tag-picker macro

This may seem missleading however it permits other fields to be nominated, provides the selection interface and a scope filter that need not include tags but any title, and trigger actions.

  • Once selected you have to ensure the selected titles in the field are listed.
  • A couple of strings need to be changed/configurable such as the placeholder and list title.

I may have a look at cloning $:/core/macros/tag-picker
into $:/core/macros/title-picker to get much of what you are after.

  • Keep in mind a title can be any string provided by the filter.

What other requirrments that are variations of the tag-picker would suit @twMat?

Note: I also have a tool I call a filter pill.

I think it would already help to work through the new examples. They do contain working examples to work with other field names than tags.

See: https://tiddlywiki.com/#tag-picker%20Macro%20(Examples) → Example 2 to 5 (The ones with the “Tip” icon)

1 Like

Oooh, that’s a very nice trick! Is there a way to set the default text for the empty input box so it doesn’t say “tag name”? It confuses me :sweat_smile:

Not at present, thats why I proposed reengeneering this to a tiddler or title picker idealy with the ability to override these text lables.

As a workaround you can change the $:/language/EditTemplate/Tags/Add/Placeholder tiddler to something like eg: tag / title or something similar that makes sense in your context.

image

1 Like

Perhaps “name” is a good general term?

So if I clone the tag-picker macro I can modify references to an alternate to $:/language/EditTemplate/Tags/Add/Placeholder.

So before I go ahead with this (once again) I would like to select a good default name, then change the place holder accordingly. Before I do so I would invite suggestions; Keeping in mind;

  • “title” is more generic than “tiddler”
  • name more generic than title
  • option? Input?
  • [Edited] perhaps an action eg “select”

Note:
When cloning reverse engineering of existing tiddlywiki code, there is a manual way to track down all references and related tiddlers, macros. The more complex the thing is one is reengineering the harder and less reliable. It seems to me it would be useful to have a tool or set of tools that helps us automaticaly explore all relationships. Could we build one, has someone already?

  • Such a tool may also help tiddlywiki users work out how the core does things when the are learning to emulate what they can already find in tiddlywiki.

[Edited 2] That reminds me, the select widget can provide very similar functionality.

2 Likes

I’d go for “name”. “Title” is linked to a very central and specific field in TW parlance. “Option” and “Input” are also quite specific HTML terms. I think"name" is descriptive but also generic enough to avoid potential confusions.

Oh now I’m daydreaming of a TW5-Graph tool for debugging, code & documentation exploration. Start from an entry point and see all connections from/to that point. References, definitions, uses etc :drooling_face:

2 Likes

This has being done before a number of times and a key advantage of tiddlywiki, it tends to list tiddlers or show content found in other tiddlers in the view template. I suggest we look for good examples of this and find a way to project this data into a graph.

:100:

    

A case I was think of is what if the item to select is a name of a fruit it would be fine but what if the value was a number or percentage. So perhaps the idea to add select item, or item?

[continued]

It is possible to use a core widget through the genesis widget (although no examples are given this includes tiddlywiki widgets), this allows us to leverage the $select widget whilst in effect wrapping it in a custom widget, this could be used to define a set of widgets that are easy to use versions that invoke the select widget. To do various forms of tiddler picker and more.

  • Including by filter or search tiddler/field/variable.