UNPKG

@web-atoms/core

Version:
73 lines (72 loc) 3.16 kB
System.register(["tslib", "../../../../App", "../../../../core/AtomBinder", "../../../../core/BindableProperty", "../../../../di/Inject", "../../../../view-model/AtomViewModel", "../../../../web/services/WindowService"], function (_export, _context) { "use strict"; var __awaiter, __decorate, __metadata, __param, App, AtomBinder, BindableProperty, Inject, AtomViewModel, Validate, WindowService, MovieListViewModel; return { setters: [function (_tslib) { __awaiter = _tslib.__awaiter; __decorate = _tslib.__decorate; __metadata = _tslib.__metadata; __param = _tslib.__param; }, function (_App) { App = _App.App; }, function (_coreAtomBinder) { AtomBinder = _coreAtomBinder.AtomBinder; }, function (_coreBindableProperty) { BindableProperty = _coreBindableProperty.BindableProperty; }, function (_diInject) { Inject = _diInject.Inject; }, function (_viewModelAtomViewModel) { AtomViewModel = _viewModelAtomViewModel.AtomViewModel; Validate = _viewModelAtomViewModel.Validate; }, function (_webServicesWindowService) { WindowService = _webServicesWindowService.WindowService; }], execute: function () { _export("MovieListViewModel", MovieListViewModel = class MovieListViewModel extends AtomViewModel { constructor(app, windowService) { super(app); this.windowService = windowService; this.movies = [{ label: "First", category: "None" }, { label: "True Lies", category: "Action" }, { label: "Jurassic Park", category: "Adventure" }, { label: "Big", category: "Kids" }, { label: "Inception", category: "Suspense" }, { label: "Last", category: "None" }]; } get errorSelectedMovie() { return this.selectedMovie ? "" : "Please select any movie"; } onItemClick(data) { this.selectedMovie = data; } onDelete(data) { return __awaiter(this, void 0, void 0, function* () { if (!(yield this.windowService.confirm("Are you sure you want to delete?", "Confirm"))) { return; } AtomBinder.removeItem(this.movies, data); yield this.windowService.alert("Movie deleted successfully."); }); } }); __decorate([BindableProperty, __metadata("design:type", Array)], MovieListViewModel.prototype, "movies", void 0); __decorate([BindableProperty, __metadata("design:type", Object)], MovieListViewModel.prototype, "selectedMovie", void 0); __decorate([Validate, __metadata("design:type", String), __metadata("design:paramtypes", [])], MovieListViewModel.prototype, "errorSelectedMovie", null); _export("MovieListViewModel", MovieListViewModel = __decorate([__param(0, Inject), __param(1, Inject), __metadata("design:paramtypes", [App, WindowService])], MovieListViewModel)); } }; }); //# sourceMappingURL=MovieListViewModel.js.map