76 lines
1.9 KiB
JavaScript
76 lines
1.9 KiB
JavaScript
goog.loadJs('common', () => {
|
|
|
|
goog.require('Mixly.Env');
|
|
goog.require('Mixly.Msg');
|
|
goog.require('Mixly.Layer');
|
|
goog.require('Mixly.HTMLTemplate');
|
|
goog.provide('Mixly.LayerNewFile');
|
|
|
|
const {
|
|
Env,
|
|
Msg,
|
|
Layer,
|
|
HTMLTemplate
|
|
} = Mixly;
|
|
|
|
|
|
class LayerNewFile extends Layer {
|
|
static {
|
|
HTMLTemplate.add(
|
|
'html/dialog/new-file.html',
|
|
new HTMLTemplate(goog.readFileSync(path.join(Env.templatePath, 'html/dialog/new-file.html')))
|
|
);
|
|
}
|
|
|
|
#dialog_ = null;
|
|
#$dialogContent_ = null;
|
|
#$cancel_ = null;
|
|
#$ok_ = null;
|
|
|
|
constructor(config = {}, shadowType = 'all') {
|
|
const $dialogContent_ = $(HTMLTemplate.get('html/dialog/new-file.html').render({
|
|
message: Msg.Lang['file.emptyInfo'],
|
|
cancel: Msg.Lang['nav.btn.cancel'],
|
|
ok: Msg.Lang['nav.btn.ok']
|
|
}));
|
|
config.title = Msg.Lang['nav.btn.file.new'];
|
|
config.cancelValue = Msg.Lang['nav.btn.cancel'];
|
|
config.cancel = () => {
|
|
this.hide();
|
|
return false;
|
|
};
|
|
config.cancelDisplay = false;
|
|
config.content = $dialogContent_;
|
|
super(config, shadowType);
|
|
this.#$dialogContent_ = $dialogContent_;
|
|
this.#$cancel_ = $dialogContent_.find('.cancel');
|
|
this.#$ok_ = $dialogContent_.find('.ok');
|
|
this.addEventsType(['empty']);
|
|
this.#addEventsListener_();
|
|
}
|
|
|
|
#addEventsListener_() {
|
|
this.#$cancel_.click(() => {
|
|
this.hide();
|
|
});
|
|
|
|
this.#$ok_.click(() => {
|
|
this.hide();
|
|
this.runEvent('empty');
|
|
});
|
|
}
|
|
|
|
dispose() {
|
|
this.#$cancel_.remove();
|
|
this.#$cancel_ = null;
|
|
this.#$ok_.remove();
|
|
this.#$ok_ = null;
|
|
this.#$dialogContent_.remove();
|
|
this.#$dialogContent_ = null;
|
|
super.dispose();
|
|
}
|
|
}
|
|
|
|
Mixly.LayerNewFile = LayerNewFile;
|
|
|
|
}); |