UNPKG

tfp

Version:

A Web UI framework for TaskBuilder

99 lines (77 loc) 4.35 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 _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get")); 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 _render = _interopRequireDefault(require("../render.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; } } var CheckBoxRender = /*#__PURE__*/function (_TFPComponentRender) { (0, _inherits2["default"])(CheckBoxRender, _TFPComponentRender); var _super = _createSuper(CheckBoxRender); function CheckBoxRender(__tfp, _dataModel, _level) { (0, _classCallCheck2["default"])(this, CheckBoxRender); return _super.call(this, __tfp, _dataModel, _level); } (0, _createClass2["default"])(CheckBoxRender, [{ key: "getAttrHtml", value: function getAttrHtml(retainStyleAttr, otherOptions) { var attrHtml = (0, _get2["default"])((0, _getPrototypeOf2["default"])(CheckBoxRender.prototype), "getAttrHtml", this).call(this, retainStyleAttr); if (!this._tfp.isDesigning) { if (otherOptions && otherOptions.gridContainer) attrHtml += " name=\"" + this.dataModel.id + "_{{index}}\"";else attrHtml += " name=\"" + this.dataModel.id + "\""; attrHtml += " bindchange=\"bindchange_controller\""; //checked=\"{{" + this.dataModel.id + "}}\" } return attrHtml; } }, { key: "getBodyHtml", value: function getBodyHtml(getComponentsHtml) { var bodyHtml = "\r\n"; if (!this.dataModel.options) return bodyHtml; var indent = this.getHtmlIndent(); for (var i = 0; i < this.dataModel.options.length; i++) { var option = this.dataModel.options[i]; bodyHtml += this.cpt.getOptionHtml(indent, option); } return bodyHtml + indent; } }, { key: "getBodyWX", value: function getBodyWX(getComponentsHtml, retainStyleAttr, otherOptions) { var cpt_wx = { "wxjson": "", "wxjs": "", "wxml": "", "wxss": "" }; if (!this.dataModel.options) return cpt_wx; var bodyHtml = "\r\n"; var indent = this.getHtmlIndent(); for (var i = 0; i < this.dataModel.options.length; i++) { var option = this.dataModel.options[i]; bodyHtml += this.cpt.getOptionWx(indent, option, i); } cpt_wx.wxml = bodyHtml + indent; return cpt_wx; } }, { key: "getHtml", value: function getHtml(getComponentsHtml, parentIndent, retainStyleAttr) { return (0, _get2["default"])((0, _getPrototypeOf2["default"])(CheckBoxRender.prototype), "getHtml", this).call(this, "div", false, parentIndent, retainStyleAttr); } }, { key: "getWX", value: function getWX(getComponentsHtml, parentIndent, retainStyleAttr, otherOptions) { return (0, _get2["default"])((0, _getPrototypeOf2["default"])(CheckBoxRender.prototype), "getWX", this).call(this, "checkbox-group", false, parentIndent, retainStyleAttr, otherOptions); } }]); return CheckBoxRender; }(_render["default"]); exports["default"] = CheckBoxRender;