I want to use JSON from Mongo in my defaultConfig for my custom widget.
The reason for this is this JSON will eventually be loaded from Mongo and should be globally available.
Although I am getting a Webpack error: _JobTypesWEBPACK_IMPORTED_MODULE_1.default.map is not a function
Content.js:
...
import JobTypeCombo from '../js/JobTypeCombo';
JobTypeCombo.initClass();
...
JobTypes.js:
const JobTypes = {
delivery: {
color: 'red',
complete: 'Delivered',
statuses: {
'open': 'Awaiting delivery',
'closed': 'Delivered',
}
},
collection: {
complete: 'Collected',
color: 'indigo'
},
problem_bike: {
color: 'black',
complete: 'Collected',
}
}
export default JobTypes;
JobTypeCombo:
import {Combo} from "bryntum-scheduler/scheduler.umd";
import JobTypes from "./JobTypes";
export default class JobTypeCombo extends Combo {
static get type() {
return 'jobtypecombo';
}
static get defaultConfig() {
//
// I want to create the item array from JobTypes.
// _JobTypes__WEBPACK_IMPORTED_MODULE_1__.default.map is not a function
JobTypes.map((i, e) => {
console.log(e);
})
// return {
// items : [
// { value : 'delivery', text : 'Delivery' },
// { value : 'collection', text : 'Collection' },
// { value : 'problem_bike', text : 'Problem Bike' }
// ],
// };
}
}
Thanks for any help you can offer.