UNPKG

nativescript-keyboard-toolbar

Version:
67 lines (66 loc) 2.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var content_view_1 = require("tns-core-modules/ui/content-view"); var properties_1 = require("tns-core-modules/ui/core/properties"); var view_base_1 = require("tns-core-modules/ui/core/view-base"); exports.forIdProperty = new properties_1.Property({ name: "forId" }); exports.showWhenKeyboardHiddenProperty = new properties_1.Property({ name: "showWhenKeyboardHidden", defaultValue: false, valueConverter: view_base_1.booleanConverter }); exports.showAtBottomWhenKeyboardHiddenProperty = new properties_1.Property({ name: "showAtBottomWhenKeyboardHidden", defaultValue: false, valueConverter: view_base_1.booleanConverter }); var ToolbarBase = (function (_super) { __extends(ToolbarBase, _super); function ToolbarBase() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.hasFocus = false; return _this; } ToolbarBase.prototype._layout = function (left, top, right, bottom) { }; ToolbarBase.prototype.log = function (what) { if (ToolbarBase.DEBUG) { console.log("⌨︎ " + what); } }; ToolbarBase.prototype.onLoaded = function () { _super.prototype.onLoaded.call(this); if (isNaN(+this.height)) { console.log("\n\u2328 \u2328 \u2328 Please specify height=\"<nr of px>\" or the toolbar won't render correctly! Example: <Toolbar forId=\"" + this.forId + "\" height=\"44\">\n\n"); } this._loaded(); }; ToolbarBase.prototype.onUnloaded = function () { _super.prototype.onUnloaded.call(this); this._unloaded(); }; ToolbarBase.prototype.onLayout = function (left, top, right, bottom) { _super.prototype.onLayout.call(this, left, top, right, bottom); this._layout(left, top, right, bottom); }; ToolbarBase.prototype._addChildFromBuilder = function (name, value) { this.content = value; }; ToolbarBase.prototype[exports.forIdProperty.setNative] = function (value) { this.forId = value; }; ToolbarBase.prototype[exports.showWhenKeyboardHiddenProperty.setNative] = function (value) { this.showWhenKeyboardHidden = value; }; ToolbarBase.prototype[exports.showAtBottomWhenKeyboardHiddenProperty.setNative] = function (value) { this.showAtBottomWhenKeyboardHidden = value; }; ToolbarBase.DEBUG = false; return ToolbarBase; }(content_view_1.ContentView)); exports.ToolbarBase = ToolbarBase; exports.forIdProperty.register(ToolbarBase); exports.showWhenKeyboardHiddenProperty.register(ToolbarBase); exports.showAtBottomWhenKeyboardHiddenProperty.register(ToolbarBase);