Open ExtAnimal opened 2 weeks ago
As a quick fix, EventColorPicker.js
could just import the single mixin which defines those colours, TimelineEventRendering.js
. It does not include any other modules, so that removes 100 or so module loads, so:
import ColorPicker from '../../Core/widget/ColorPicker.js';
import TimelineEventRendering from '../view/mixin/TimelineEventRendering.js';
/**
* @module Scheduler/widget/EventColorPicker
*/
/**
* A color picker that displays a list of available event colors which the user can select by using mouse or keyboard.
* See Schedulers {@link Scheduler.view.mixin.TimelineEventRendering#config-eventColor eventColor config} for default
* available colors.
*
* {@inlineexample Scheduler/widget/EventColorPicker.js}
*
* ```javascript
* new EventColorPicker({
* appendTo : 'container',
* width : '10em',
* onColorSelected() {
* console.log(...arguments);
* }
* });
* ```
*
* @classtype colorpicker
* @extends Core/widget/ColorPicker
*/
export default class EventColorPicker extends ColorPicker {
static $name = 'EventColorPicker';
static type = 'eventcolorpicker';
static configurable = {
colorClasses : TimelineEventRendering().eventColors,
colorClassPrefix : 'b-sch-',
/**
* @hideconfigs colors
*/
colors : null,
/**
* Provide a {@link Scheduler.model.EventModel} instance to update it's
* {@link Scheduler.model.mixin.EventModelMixin#field-eventColor} field
* @config {Scheduler.model.EventModel}
*/
record : null
};
colorSelected({ color }) {
if (this.record) {
this.record.eventColor = color;
}
}
}
EventColorPicker.initClass();
The colour set should be hoisted into its own module which both
EventColorPicker
, andSchedulerBase
can then import.