UNPKG

uicore-ts

Version:

UICore is a library to build native-like user interfaces using pure Typescript. No HTML is needed at all. Components are described as TS classes and all user interactions are handled explicitly. This library is strongly inspired by the UIKit framework tha

74 lines (73 loc) 2.7 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var UIActionIndicator_exports = {}; __export(UIActionIndicator_exports, { UIActionIndicator: () => UIActionIndicator }); module.exports = __toCommonJS(UIActionIndicator_exports); var import_UIObject = require("./UIObject"); var import_UIView = require("./UIView"); class UIActionIndicator extends import_UIView.UIView { constructor(elementID) { super(elementID); this._size = 50; this.indicatorView = new import_UIView.UIView(this.elementID + "IndicatorView"); this.indicatorView.viewHTMLElement.classList.add("LukeHaasLoader"); this.addSubview(this.indicatorView); this.hidden = import_UIObject.YES; } set size(size) { this._size = size; this.setNeedsLayoutUpToRootView(); } get size() { return this._size; } set hidden(hidden) { super.hidden = hidden; if (hidden) { this.indicatorView.removeFromSuperview(); } else { this.addSubview(this.indicatorView); } } start() { this.hidden = import_UIObject.NO; } stop() { this.hidden = import_UIObject.YES; } layoutSubviews() { super.layoutSubviews(); const bounds = this.bounds; this.indicatorView.style.height = "" + this._size.integerValue + "px"; this.indicatorView.style.width = "" + this._size.integerValue + "px"; const minSize = Math.min(this.bounds.height, this.bounds.width); this.indicatorView.style.maxHeight = "" + minSize.integerValue + "px"; this.indicatorView.style.maxWidth = "" + minSize.integerValue + "px"; const size = Math.min(this._size, minSize); this.indicatorView.style.left = "" + ((bounds.width - size) * 0.5 - 11).integerValue + "px"; this.indicatorView.style.top = "" + ((bounds.height - size) * 0.5 - 11).integerValue + "px"; } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { UIActionIndicator }); //# sourceMappingURL=UIActionIndicator.js.map