I try to create a custom Calendar's view for embedded a custom Scheduler component (yours but encapsulated inside another which contains our specific).
I do not find real example inside the documentation and other topics are not clear.
Yes, I have seen this example but sorry, it's for pure Javascript, not for an Angular component.
I have created a regular Angular component which extends/configures your Scheduler with some service dependency injections and other things. All it's working for this.
@Component({
selector: 'isi-scheduler',
templateUrl: './isi-scheduler.component.html',
styleUrls: ['./isi-scheduler.component.css']
})
export class IsiSchedulerComponent implements AfterViewInit { //, OnDestroy
static type = "IsiSchedulerComponent"
scheduler: SchedulerPro;
public grid: Grid;
public eventStore: SchedulerEventStore | EventStore;
private _viewModel1: IsiSchedulerViewModel;
private _viewModel2: IsiSchedulerViewModel;
// @Input()
// infiniteScroll: boolean = false;
currentLanguage: string = 'en';
@Input() autoRescheduleTasks = false;
@Input() viewModelId: string;
@Input() dual: boolean;
@Input() dualShareBar: boolean;
@ViewChild('scheduler1', { static: true }) scheduler1Component: BryntumSchedulerProComponent;
private scheduler2Component: BryntumSchedulerProComponent;
@ViewChild('scheduler2', { static: false }) set content(child) {
if (!child) return;
this.scheduler2Component = child;
};
@ViewChild(BryntumGridComponent, { static: true }) gridComponent: BryntumGridComponent;
constructor(
public router: Router,
public route: ActivatedRoute,
public store: Store<{ barMargin: { barMargin: number } }>,
@Inject(I18NEXT_SERVICE) private i18NextService: ITranslationService,
private taskCardRendererService: TaskCardRendererService,
public schedulerViewModelService: IsiSchedulerViewModelService,
private groupFeatureConfigService: IsiSchedulerGroupFeatureConfigService,
public tbarConfigService: SchedulerTBarConfigService,
public presetStoreService: SchedulerPresetStoreService,
public projectService: SchedulerProjectService,
) {
}
...
I want to reuse my component and not redeclare/duplicate all scheduler configuration and all of these behaviours in another place. It's the first goal to do components.
With the same model, I have created another angular component which extends/configures your Calendar.
With this, I have created my custom view and registered it (after having added a "bad" any to the line to have compilation success) :
//Bad need to use any
(<any>Calendar).Modes.register('isischeduler', IsiSchedulerView);
@Component({
selector: 'isi-calendar',
templateUrl: './isi-calendar.component.html',
styleUrls: ['./isi-calendar.component.scss']
})
export class IsiCalendarComponent implements AfterViewInit {
@ViewChild(BryntumCalendarComponent) calendarComponent: BryntumCalendarComponent;
private calendar: Calendar;
private eventStore: EventStore;
@Input() viewModelId: string;
...
What is the contract of the class "IsiSchedulerView" and what does it need to implement ?
It doesn't really matter if it's pure JS or Angular. Our classes are cross-platformed and will incapsulate all the logic inside.
You just need to register JS class in modes, as you did according to code snippet, and use registered mode in calendar modes. That mode should be a JS class and not Angular component. We do not support Angular components as mode.