@web-atoms/core
Version:
68 lines (67 loc) • 2.55 kB
JavaScript
System.register(["tslib", "../../core/AtomBinder", "../../core/AtomLoader", "../../core/AtomUri", "./AtomContentControl", "./AtomItemsControl"], function (_export, _context) {
"use strict";
var __awaiter, AtomBinder, AtomLoader, AtomUri, AtomContentControl, AtomItemsControl, AtomViewPager;
_export("AtomViewPager", void 0);
return {
setters: [function (_tslib) {
__awaiter = _tslib.__awaiter;
}, function (_coreAtomBinder) {
AtomBinder = _coreAtomBinder.AtomBinder;
}, function (_coreAtomLoader) {
AtomLoader = _coreAtomLoader.AtomLoader;
}, function (_coreAtomUri) {
AtomUri = _coreAtomUri.AtomUri;
}, function (_AtomContentControl) {
AtomContentControl = _AtomContentControl.AtomContentControl;
}, function (_AtomItemsControl) {
AtomItemsControl = _AtomItemsControl.AtomItemsControl;
}],
execute: function () {
_export("AtomViewPager", AtomViewPager = class AtomViewPager extends AtomItemsControl {
dispose(e) {
if (!e) {
for (const iterator of this.items) {
iterator.dispose();
}
}
this.selectedItem = null;
super.dispose(e);
}
onCollectionChanged() {}
create() {
super.create();
const eStyle = this.element.style;
eStyle.position = "absolute";
eStyle.left = eStyle.right = eStyle.bottom = eStyle.top = "0";
const cc = new AtomContentControl(this.app);
this.append(cc);
const style = cc.element.style;
style.position = "absolute";
style.top = style.left = style.right = style.bottom = "0";
cc.bind(cc.element, "content", [["this", "selectedItem"]], false, si => {
if (!si) {
return undefined;
}
if (si.view) {
return si.view;
}
this.app.runAsync(() => __awaiter(this, void 0, void 0, function* () {
const {
view: ctrl
} = yield AtomLoader.loadView(new AtomUri(si.value), this.app, false);
si.view = ctrl;
ctrl.element._logicalParent = this.element;
AtomBinder.refreshValue(this, "selectedItem");
si.dispose = () => {
ctrl.dispose();
ctrl.element._logicalParent = null;
};
}));
return undefined;
}, this);
}
});
}
};
});
//# sourceMappingURL=AtomViewPager.js.map