Hello Team,
I'm refactoring code and I found a little problem when organize my project as an example that you provide.
At the beginning the config is inside the component.ts and my method's are accesible but when I separate and put on config.ts the problem I have is how to call my custom method's for validations.
On Config.ts
export const calendarConfig : Partial<CalendarConfig> = {
//.......config.....
features : {
eventMenu : {
processItems : ({eventRecord, items})=>{
if((eventRecord.data.type == "shift")){
items.showSessionItem ={
text : "Shift Menu Item",
onItem({eventRecord}){
console.log(eventRecord)
}
}
};
if((eventRecord.data.type == "Period")){
items.showSessionItem ={
text : "Period Menu Item",
onItem({eventRecord}){
console.log(eventRecord)
}
}
};
if((eventRecord.data.type == "Break")){
items.showSessionItem ={
text : "Break Menu Item",
onItem({eventRecord}){
console.log(eventRecord)
}
}
};
},
items : {
editEvent:false,
copyEvent: false,
cutEvent: false,
deleteEvent: false,
duplicate : false,
copyFromView : {
text : '<div>Copy current view to..</div>',
icon: 'b-fa b-fa-fw b-fa-plus-circle',
onItem: function($event){this.copyFromView()}, <----------Method on component.ts
},
},
},
scheduleMenu : {
items : {
// Knocks out the predefined addEvent item
addEvent : false,
copyFromView : {
text : '<div>Copy current view on..</div>',
icon: 'b-fa b-fa-fw b-fa-plus-circle',
onItem: function($event){this.copyFromView()}, <----------Method on component.ts
}
}
},
drag:{
async validateResizeFn({eventRecord, drag}){
console.log("validation in course");
if(this.authorizeShiftCalendarChange(eventRecord)){ }<----------Method on component.ts
}
},
I know these questions maybe is more related to know Angular languages and structure and not in your component logic, but I didn't found the correct way to solve, if can bring me a little help to solve it will be a great help for me.
Thanks in advance