tfp
Version:
A Web UI framework for TaskBuilder
110 lines (91 loc) • 3.76 kB
JavaScript
"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 TextArea = /*#__PURE__*/function (_FormInput) {
(0, _inherits2["default"])(TextArea, _FormInput);
var _super = _createSuper(TextArea);
function TextArea(__tfp, dataModel, parent) {
(0, _classCallCheck2["default"])(this, TextArea);
return _super.call(this, __tfp, "TextArea", dataModel, parent);
}
(0, _createClass2["default"])(TextArea, [{
key: "value",
get: function get() {
if (!this.dataModel.value) return "";
return this.dataModel.value;
},
set: function set(value) {
this.dataModel.value = value;
if (this._jqObj) {
this._jqObj.val(value);
}
if (!this._tfp.isDesigning) {
this.valueOnChange();
this.exeEventHandler("onChange", value);
}
}
/*get cols() { return this.dataModel.cols }
set cols(value) {
this.dataModel.cols = value;
if(this._jqObj) this._jqObj.attr("cols", value);
}
get rows() { return this.dataModel.rows }
set rows(value) {
this.dataModel.rows = value;
if(this._jqObj) this._jqObj.attr("rows", value);
}*/
}, {
key: "maxLength",
get: function get() {
return this.dataModel.maxLength;
},
set: function set(value) {
this.dataModel.maxLength = value;
if (this._jqObj) this._jqObj.attr("maxlength", value);
}
}, {
key: "placeHolder",
get: function get() {
return this.dataModel.placeHolder;
},
set: function set(value) {
this.dataModel.placeHolder = value;
if (this._jqObj) this._jqObj.attr("placeholder", value);
}
}, {
key: "format",
get: function get() {
return this.dataModel.format;
},
set: function set(value) {
this.dataModel.format = value;
}
}, {
key: "initRuntime",
value: function initRuntime() {
var that = this;
this._jqObj.change(function () {
that.dataModel.value = that._jqObj.val();
that.valueOnChange();
that.exeEventHandler("onChange", that.dataModel.value);
});
}
}]);
return TextArea;
}(_controller.FormInput);
exports["default"] = TextArea;