@narmafzam/jalali-datepicker
Version:
just a jalali-datepicker
40 lines (33 loc) • 1.21 kB
JavaScript
let State = require('./state');
let Toolbox = require('./toolbox');
let View = require('./view');
let Input = require('./input');
let API = require('./api');
let Navigator = require('./navigator');
let Options = require('./options');
let JalaliDateWrapper = require('./jalali-date-wrapper');
class Model {
constructor(inputElement, options) {
return this.components(inputElement, options);
}
components(inputElement, options) {
this.initialUnix = null;
this.inputElement = inputElement;
this.options = new Options(options, this);
this.JalaliDate = new JalaliDateWrapper(this);
this.state = new State(this);
this.api = new API(this);
this.input = new Input(this, inputElement);
this.view = new View(this);
this.toolbox = new Toolbox(this);
this.updateInput = function (unix) {
this.input.update(unix);
};
this.state.setViewDateTime('unix', this.input.getOnInitState());
this.state.setSelectedDateTime('unix', this.input.getOnInitState());
this.view.render();
this.navigator = new Navigator(this);
return this.api;
}
}
module.exports = Model;