Premium support for our pure JavaScript UI components


Post by gbrdhvndi »

alex.l wrote: Wed Oct 13, 2021 10:00 am

I do see those properties in Scheduler(Pro) locales, as example "Repeat" string used for recurrenceCombo when you edit recurrent event. Same for others - used only if recurrent event feature in use. But EventEdit is empty in Gantt since Gantt uses TaskEvent feature instead.
I would suggest you to try to merge locales instead. https://bryntum.com/docs/gantt/api/Core/localization/LocaleHelper#function-mergeLocales-static

It's not our code that does it, it's the locales being registered in a chain of imports: Core, Grid, Scheduler, SchedulerPro, Gantt, Calendar, TaskBoard. They all call LocaleHelper.mergeLocales() first but then LocaleManager.registerLocale() checks the exclude config and runs LocaleHelper.trimLocale().

We bundle all licensed products together to simplify their consumption in Salesforce Lightning Experience, so the problem might be quite unique to us. We also use many of the products directly, like the Grid or the TreeGrid, and even the basic Scheduler. Only some of our products require Gantt or Calendar.

In this situation, if Gantt isn't using EventEdit but Scheduler and SchedulerPro still do how does it affect their functionality?

Aleksei


Post by Maxim Gorkovsky »

Actually there is an intent to make thin product bundles which should resolve this kind of issues in future: https://github.com/bryntum/support/issues/2805

I was given to understand that unless reported issues is blocking you, we will not waste effort on it. Is it blocking you?


Post by gbrdhvndi »

Not blocking at the moment, just wanted to let you know.

Thanks!

P.S.
Having said that, I'd still like to understand how the locale properties excluded by Gantt affect Scheduler and SchedulerPro component instances as we don't always just use Gantt in our products.

Aleksei


Post by Maxim Gorkovsky »

Each product (main view component - GridBase, SchedulerBase etc) imports own English locale, every next locale merges with previous locale, producing bundle-level locale object. From the stack trace it appears that Gantt is trying to remove key which doesn't exist and throws exception. When you import Gantt last - all keys exist and Gantt is able to remove them. This means that in Scheduler and SchedulerPro those strings will not be localized. I suppose you could add a small override to stop Gantt from being so strict and keep all locale strings:

import Override ...
import LocaleHelper ...

Override.apply(class {
  static get target() {
    return { class : LocaleHelper }
  }

  static trimLocale(locale, trimLocale) {
    const
        remove = (key, subKey) => {
            if (subKey) {
                delete locale[key][subKey];
            }
            else {
                delete locale[key];
            }
        };

    Object.keys(trimLocale).forEach(key => {
        if (Object.keys(trimLocale[key]).length > 0) {
            Object.keys(trimLocale[key]).forEach(subKey => remove(key, subKey));
        }
        else {
            remove(key);
        }
    });
}
})

Import this class somewhere at the top of the entry file and then you should be able to import Gantt before Scheduler, SchedulerPro and locale should not have any trimmed strings.


Post by Maxim Gorkovsky »

I opened a ticket to get rid of this extra throw call: https://github.com/bryntum/support/issues/3566


Post by gbrdhvndi »

Thank you Maxim, I'll give it a try.

Aleksei


Post Reply