cuba-platform / cuba

CUBA Platform is a high level framework for enterprise applications development
https://www.cuba-platform.com
Apache License 2.0
1.34k stars 219 forks source link

Suggestion Field improvements #2040

Open alexbudarov opened 5 years ago

alexbudarov commented 5 years ago

Description of the bug or enhancement

After using SuggestionPickerField (desktop) in Sherlock booking screen and adapting web version of the field - there is feeling that SuggestionPickerField is the best entity selection field: responsive, versatile, easy to use. Below is the list of improvement ideas how we can widen usage of suggestion field in platform for everyone's convenience:

1 Create SuggestionLookupPickerField

It is a kind of LookupPickerField, just with suggestions. If you click "triangle" button - it shows list of somehow loaded options. In Sherlock currently this field is emulated as SuggestionPickerField with button which looks like triangle and calls showSuggestions() method. Usage example: address search field. When you type search string - the field searches global addresses. If you click triangle button - it should show you the list of recent/favourite addresses. image

2 Ability to replace all built-in picker fields by SuggestionPickerField for some entities

If SuggestionField is so good - we want it to be used everywhere in the system, at least for some entities which are easy/convenient to search by string. For example: sec$User could be searched by login, name(s), group name. Such SuggestionPicker fields can retain "..." button if user needs to find entity via lookup screen.

There should be a configuration point in the system (like ComponentFactory or FieldGroupFactory or xml file) which allows you to register that sec$User's default selection field is SuggestionPickerField with particular properties. The field should be generated everywhere:

3 System-wide SuggestionFields may have various suggestion loading functions, separately for each entity. It can be:

4 If entity's name pattern is not unique database-wide than it's possible that suggestion field needs to have custom options formatter. Example: In a big company we have two separate instances (employees) with the same name+surname like "Ivan Petrov". So even if name pattern "firstName lastName" is sensible, it makes sense to set custom caption formatting function for user suggestion field.

5 Suggestion picker field to be able to integrate with FTS

This field should be able to specify a certain search config (see the related issue).

Example: Contract (fields: customer, name, number, date) Customer (fields: documents, name, banking number)

So in Contract browser, typing a banking number or any other field the field will invoke search and return all corresponding contracts.

jreznot commented 5 years ago

Relates to https://github.com/cuba-platform/cuba/issues/68

jreznot commented 5 years ago

Depends on https://github.com/cuba-platform/cuba/issues/371

alexbudarov commented 5 years ago

related forum topic: https://www.cuba-platform.com/discuss/t/pickerfield-edit/10170/3