@web-atoms/core-docs
Version:
37 lines • 1.53 kB
JavaScript
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./AtomControl"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AtomViewStack = void 0;
const AtomControl_1 = require("./AtomControl");
class AtomViewStack extends AtomControl_1.AtomControl {
append(e) {
const ee = e instanceof AtomControl_1.AtomControl ? e.element : e;
ee._logicalParent = this.element;
this.children = this.children || [];
const index = this.children.length;
this.children.push(e instanceof AtomControl_1.AtomControl ? e.element : e);
if (this.selectedIndex === undefined) {
this.selectedIndex = 0;
}
const style = ee.style;
style.position = "absolute";
style.top = style.left = style.right = style.bottom = "0";
this.bind(ee, "styleVisibility", [["selectedIndex"]], false, (v) => v === index ? "visible" : "hidden");
this.element.appendChild(ee);
return this;
}
preCreate() {
this.selectedIndex = -1;
}
}
exports.AtomViewStack = AtomViewStack;
});
//# sourceMappingURL=AtomViewStack.js.map