leekelleher / umbraco-contentment

Contentment for Umbraco - a state of happiness and satisfaction
https://marketplace.umbraco.com/package/umbraco.community.contentment
Mozilla Public License 2.0
155 stars 70 forks source link

"Data Picker" editor #297

Closed leekelleher closed 1 year ago

leekelleher commented 1 year ago

Description

Adds a Data Picker editor.

(Screen capture video demo coming soon.)

Types of changes

Checklist

nzdev commented 1 year ago

image For no url content, the udi overflows on the cards view

nzdev commented 1 year ago

I'd be very keen to have support (and I'm willing to contribute) for multiple inputs to add into the query so I can generate queries with additional parameters.

Examples:

Another useful thing would be the ability to switch out the list view in the overlay similar to the media picker.

nzdev commented 1 year ago

Sorry if this is too early in the process for feedback, setting the overlay size in the data picker source does not change the overlay size.

leekelleher commented 1 year ago

@nzdev Thank you for the feedback so far - and for trying it out! 🙏

Once tomorrow's Umbraco Community Day session is done, I'll review and get back to you. 😀

leekelleher commented 1 year ago

@nzdev In reply to your initial feedback...

For no url content, the udi overflows on the cards view

I've got a CSS fix to resolve this, (not committed/pushed yet).


I'd be very keen to have support (and I'm willing to contribute) for multiple inputs to add into the query so I can generate queries with additional parameters. <snip /> Another useful thing would be the ability to switch out the list view in the overlay similar to the media picker.

Great suggestions! My initial reaction was eek! 😬 But I'm definitely open this, would need a bit of brainstorming, e.g. where it'd be configured, etc. I'll give it some thought too.


Sorry if this is too early in the process for feedback, setting the overlay size in the data picker source does not change the overlay size.

Probably confusion around the OverlaySize property (in the data source class), which is intended for the overlay size of the configuration editor (in the Data Type), not on the Content editor. Since this would be an Umbraco implementer's preference, I'll look to add this as an option on the Data Type configuration (similar to how it's done for the Data List/Item Picker configuration).

nzdev commented 1 year ago

Thanks @leekelleher . Both of these suggestions I would see being done the same as the built in list views property configuration.

nzdev commented 1 year ago

Task<IEnumerable<DataPickerItem>> SearchAsync(Dictionary<string, object> config, out int totalPages, int pageNumber = 1, int pageSize = 12, string query = "")

This method on IDataPickerSource needs to change it's return type to include total pages as out parameters cannot be used with async.

nzdev commented 1 year ago

https://github.com/leekelleher/umbraco-contentment/pull/303

leekelleher commented 1 year ago

FYI, I've done a big refactor on how the data-sources for Data Picker work. I've decided to try to combine them with the existing Data List data-sources, as it felt that I was duplicating logic, e.g. the Umbraco Content data-source was largely similar to the Data List one.

Also, I've added an IDataPickerDisplayMode interface, so custom views can be developed for the editor UI. It doesn't quite support all the various querying criteria options (see https://github.com/leekelleher/umbraco-contentment/pull/297#issuecomment-1386685480 above), but could be a step towards that.

leekelleher commented 1 year ago

I've decided to merge this in to the dev/v4.x branch for the next release, Contentment 4.5.0.

I haven't written any docs yet, but will do before the release (even if they are basic/light on detail).

There are a bunch of configuration options that I wanted to add in for Data Picker, e.g. fallback icon; enable/disable filter query; allow duplicates; enable multiple; confirm removals; et al. These can be added in future release, otherwise I'll end up never releasing the Data Picker!

My last niggle is that the data-picker.overlay.html UI is tied exclusively to the "cards" and "list" UIs. I'd have liked to make this agnostic, but required much more dev time, so again, yet another thing to delay the initial release (where the majority of users may not notice this limitation).

There's only so long I could wait - given I opened this PR back in January! Just ship it Lee! :shipit: