tfp
Version:
A Web UI framework for TaskBuilder
162 lines (139 loc) • 4.57 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 Video = /*#__PURE__*/function (_VisibleComponent) {
(0, _inherits2["default"])(Video, _VisibleComponent);
var _super = _createSuper(Video);
// 全局组件tfp 数据模型 上级组件 最上层的是窗口
function Video(__tfp, dataModel, parent) {
(0, _classCallCheck2["default"])(this, Video);
return _super.call(this, __tfp, "Video", dataModel, parent);
}
(0, _createClass2["default"])(Video, [{
key: "src",
get: function get() {
return this.dataModel.src;
},
set: function set(value) {
this.dataModel.src = value;
if (this._jqObj) {
//
this._jqObj.attr("src", value);
}
}
}, {
key: "width",
get: function get() {
return this.dataModel.width;
},
set: function set(value) {
this.dataModel.width = value;
if (this._jqObj) {
//
this._jqObj.css("width", value + "px");
}
}
}, {
key: "height",
get: function get() {
return this.dataModel.height;
},
set: function set(value) {
this.dataModel.height = value;
if (this._jqObj) {
//
this._jqObj.css("height", value + "px");
}
}
}, {
key: "controls",
get: function get() {
return this.dataModel.controls;
},
set: function set(value) {
this.dataModel.controls = value;
}
}, {
key: "loop",
get: function get() {
return this.dataModel.loop;
},
set: function set(value) {
this.dataModel.loop = value;
}
}, {
key: "muted",
get: function get() {
return this.dataModel.muted;
},
set: function set(value) {
this.dataModel.muted = value;
}
}, {
key: "autoplay",
get: function get() {
return this.dataModel.autoplay;
},
set: function set(value) {
this.dataModel.autoplay = value;
}
}, {
key: "poster",
get: function get() {
return this.dataModel.poster;
},
set: function set(value) {
this.dataModel.poster = value;
} // 初始化 运行时 页面渲染完成执行
}, {
key: "initRuntime",
value: function initRuntime() {
var that = this;
this._jqObj.click(function () {
if (that.dataModel.onClick) {
eval(that.dataModel.onClick);
}
});
this._jqObj.click(function () {
if (that.dataModel.onMouseOver) {
eval(that.dataModel.onMouseOver);
}
});
this._jqObj.click(function () {
if (that.dataModel.onMouseOut) {
eval(that.dataModel.onMouseOut);
}
});
}
}, {
key: "play",
value: function play() {
// Play the video
this._jqObj.trigger('play');
}
}, {
key: "pause",
value: function pause() {
this._jqObj.trigger('pause');
}
}]);
return Video;
}(_controller.VisibleComponent);
exports["default"] = Video;