@web-atoms/core
Version:
61 lines (60 loc) • 3.14 kB
JavaScript
System.register(["tslib", "../../core/Bind", "../../core/BindableProperty", "../../core/XNode", "../../view-model/AtomWindowViewModel", "../styles/AtomAlertWindowStyle", "./AtomWindow"], function (_export, _context) {
"use strict";
var __decorate, __metadata, Bind, BindableProperty, XNode, AtomWindowViewModel, AtomAlertWindowStyle, AtomWindow, AtomAlertWindow, AtomAlertViewModel;
_export("default", void 0);
return {
setters: [function (_tslib) {
__decorate = _tslib.__decorate;
__metadata = _tslib.__metadata;
}, function (_coreBind) {
Bind = _coreBind.default;
}, function (_coreBindableProperty) {
BindableProperty = _coreBindableProperty.BindableProperty;
}, function (_coreXNode) {
XNode = _coreXNode.default;
}, function (_viewModelAtomWindowViewModel) {
AtomWindowViewModel = _viewModelAtomWindowViewModel.AtomWindowViewModel;
}, function (_stylesAtomAlertWindowStyle) {
AtomAlertWindowStyle = _stylesAtomAlertWindowStyle.default;
}, function (_AtomWindow) {
AtomWindow = _AtomWindow.AtomWindow;
}],
execute: function () {
_export("default", AtomAlertWindow = class AtomAlertWindow extends AtomWindow {
create() {
this.defaultControlStyle = AtomAlertWindowStyle;
this.viewModel = this.resolve(AtomAlertViewModel);
this.render(XNode.create(AtomWindow, {
title: Bind.oneWay(() => this.viewModel.title)
}, XNode.create(AtomWindow.windowTemplate, null, XNode.create("div", {
formattedText: Bind.oneWay(() => this.viewModel.message)
})), XNode.create(AtomWindow.commandTemplate, null, XNode.create("div", null, XNode.create("button", {
class: "yes-button",
styleDisplay: Bind.oneWay(() => this.viewModel.okTitle ? "" : "none"),
text: Bind.oneWay(() => this.viewModel.okTitle),
eventClick: () => this.viewModel.onOkClicked()
}), XNode.create("button", {
class: "no-button",
styleMarginBottom: Bind.oneWay(() => this.viewModel.cancelTitle ? "0" : "10px"),
styleDisplay: Bind.oneWay(() => this.viewModel.cancelTitle ? "" : "none"),
text: Bind.oneWay(() => this.viewModel.cancelTitle),
eventClick: () => this.viewModel.onCancelClicked()
})))));
}
});
AtomAlertViewModel = class AtomAlertViewModel extends AtomWindowViewModel {
onOkClicked() {
this.close(true);
}
onCancelClicked() {
this.cancel();
}
};
__decorate([BindableProperty, __metadata("design:type", String)], AtomAlertViewModel.prototype, "title", void 0);
__decorate([BindableProperty, __metadata("design:type", String)], AtomAlertViewModel.prototype, "message", void 0);
__decorate([BindableProperty, __metadata("design:type", String)], AtomAlertViewModel.prototype, "okTitle", void 0);
__decorate([BindableProperty, __metadata("design:type", String)], AtomAlertViewModel.prototype, "cancelTitle", void 0);
}
};
});
//# sourceMappingURL=AtomAlertWindow.js.map