bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
54 stars 6 forks source link

Make `recurrenceEditor` a config of the EventEdit #8656

Open ghulamghousdev opened 7 months ago

ghulamghousdev commented 7 months ago

Forum post

I want to limit the items that appear in the frequency field dropdown of the "recurrence editor" popup. I see the docs here Scheduler.view.recurrence.RecurrenceEditor, but I cannot figure out where / how in my config to customize the RecurrenceEditor config. (I'm using BryntumSchedulerProProps for my react component)

ExtAnimal commented 7 months ago

The RecurrenceEditor Popup imports and adds as its sole child a RecurrenceEditorPanel. This is overnesting unless the RecurrenceEditorPanel is intended to be used elsewhere. If not, it's just an extra layer and makes more DOM and deeper reconfiguration code, eg:

    features : {
        eventEdit : {
            recurrenceEditor : {
                items : {                       // <-- extra layer here
                    recurrenceEditorPanel : {   // <-- extra layer here
                        items : {
                            // Limit options we can see in stop combo
                            stopRecurrenceField : {
                                store : {
                                    filters : {
                                        filterBy(rec) {
                                            return ['never', 'count'].includes(rec.value);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

For that to work, RecurrenceStopConditionCombo.js needs to be simpler. That buildItems callback is not needed. It's just a Store data config:

Screenshot 2024-02-22 at 07 30 54

Check for unnecessary buildItems in other combos. It makes the Field impossible to reconfigure by an app. The above reconfiguration does not work with buildItems

Also, recurrenceEditor needs to be documented config of RecurringEventEdit and have its items documented the same as they are in the event editor so apps can modify them as above. It is already a property, but should be upgraded to a config and documented.

This work should result in a net reduction of code (Documentation lines will increase)