UNPKG

tfp

Version:

A Web UI framework for TaskBuilder

159 lines (134 loc) 4.92 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); var _controller = require("../controller.js"); function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** * 弹性面板组件 * @param {[type]} dataModel [description] */ var FlexPanel = /*#__PURE__*/function (_ContainerComponent) { (0, _inherits2["default"])(FlexPanel, _ContainerComponent); var _super = _createSuper(FlexPanel); function FlexPanel(__tfp, dataModel, parent) { (0, _classCallCheck2["default"])(this, FlexPanel); return _super.call(this, __tfp, "FlexPanel", dataModel, parent); } (0, _createClass2["default"])(FlexPanel, [{ key: "containerEl", get: function get() { return this.el; } }, { key: "direction", get: function get() { if (!this.dataModel.styles) { this.dataModel.styles = { "flex-direction": "row" }; } return this.dataModel.styles["flex-direction"]; }, set: function set(value) { if (!this.dataModel.styles) { this.dataModel.styles = { "flex-direction": "row" }; } this.dataModel.styles["flex-direction"] = value; if (this._jqObj) this._jqObj.css("flex-direction", value); } }, { key: "wrap", get: function get() { if (!this.dataModel.styles) { this.dataModel.styles = { "flex-wrap": "nowrap" }; } return this.dataModel.styles["flex-wrap"]; }, set: function set(value) { if (!this.dataModel.styles) { this.dataModel.styles = { "flex-wrap": "nowrap" }; } this.dataModel.styles["flex-wrap"] = value ? "wrap" : "nowrap"; if (this._jqObj) this._jqObj.css("flex-wrap", value); } }, { key: "align", get: function get() { if (!this.dataModel.styles) { this.dataModel.styles = { "justify-content": "flex-start" }; } return this.dataModel.styles["justify-content"]; }, set: function set(value) { if (!this.dataModel.styles) { this.dataModel.styles = { "justify-content": "flex-start" }; } this.dataModel.styles["justify-content"] = value; if (this._jqObj) this._jqObj.css("justify-content", value); } }, { key: "valign", get: function get() { if (!this.dataModel.styles) { this.dataModel.styles = { "align-items": "stretch" }; } return this.dataModel.styles["align-items"]; }, set: function set(value) { if (!this.dataModel.styles) { this.dataModel.styles = { "align-items": "stretch" }; } this.dataModel.styles["align-items"] = value; if (this._jqObj) this._jqObj.css("align-items", value); } }, { key: "alignContent", get: function get() { if (!this.dataModel.styles) { this.dataModel.styles = { "align-content": "stretch" }; } return this.dataModel.styles["align-content"]; }, set: function set(value) { if (!this.dataModel.styles) { this.dataModel.styles = { "align-content": "stretch" }; } this.dataModel.styles["align-content"] = value; if (this._jqObj) this._jqObj.css("align-content", value); } }, { key: "show", value: function show() { if (this._jqObj) this._jqObj.css("display", "flex"); } }]); return FlexPanel; }(_controller.ContainerComponent); exports["default"] = FlexPanel;