123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _react = _interopRequireDefault(require("react"));
- var _ExtendableContainer = _interopRequireDefault(require("../../base/ExtendableContainer"));
- var _InputField = _interopRequireDefault(require("../../base/InputField"));
- var _Logger = _interopRequireDefault(require("../../../systems/Logger"));
- var _Module3 = _interopRequireDefault(require("../../Module"));
- var _ModuleSystem = _interopRequireDefault(require("../../../systems/ModuleSystem"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- //import './ParameterControl.css';
- var ModuleCreation =
- /*#__PURE__*/
- function (_Module) {
- _inherits(ModuleCreation, _Module);
- function ModuleCreation(props) {
- var _this;
- _classCallCheck(this, ModuleCreation);
- _this = _possibleConstructorReturn(this, _getPrototypeOf(ModuleCreation).call(this, props));
- _this.state = {};
- _this.model = _this.createInputs(props.inputs);
- return _this;
- }
- _createClass(ModuleCreation, [{
- key: "render",
- value: function render() {
- return _react.default.createElement("div", null);
- }
- }]);
- return ModuleCreation;
- }(_Module3.default);
- var ParameterControl =
- /*#__PURE__*/
- function (_Module2) {
- _inherits(ParameterControl, _Module2);
- function ParameterControl(props) {
- var _this2;
- _classCallCheck(this, ParameterControl);
- _this2 = _possibleConstructorReturn(this, _getPrototypeOf(ParameterControl).call(this, props));
- _this2.state = {};
- _this2.model = _this2.createInputs(_this2.props.module.Inputs);
- _this2.instance = _this2.createInstance();
- return _this2;
- }
- _createClass(ParameterControl, [{
- key: "componentWillReceiveProps",
- value: function componentWillReceiveProps() {
- this.instance = this.createInstance();
- this.forceUpdate();
- }
- }, {
- key: "createInputs",
- value: function createInputs(inputs) {
- var _this3 = this;
- var res = [];
- var _loop = function _loop(key) {
- var data = inputs[key];
- _this3.state[key] = data.defaultValue;
- res.push(_react.default.createElement(_InputField.default, {
- name: key,
- metadata: data,
- key: key,
- onChange: function onChange(v) {
- return _this3.setState(_defineProperty({}, key, v));
- }
- }));
- };
- for (var key in inputs) {
- _loop(key);
- }
- return res;
- }
- }, {
- key: "createInstance",
- value: function createInstance() {
- var inputs = {};
- for (var i in this.state) {
- inputs[i] = {
- name: i,
- value: this.state[i]
- };
- }
- var nprops = {
- ctor: this.props.module.name,
- category: this.props.module.Category,
- namespace: this.props.module.Namespace,
- children: [],
- id: '123',
- //random
- inputs: inputs,
- outputs: {} // console.log("INSTANCE : " , nprops);
- };
- var module = nprops;
- return module;
- }
- }, {
- key: "render",
- value: function render() {
- var OM = _Module3.default.OutputMarker;
- var header = _react.default.createElement(OM, {
- module: this.instance,
- text: this.props.module.name
- });
- return _react.default.createElement("div", {
- className: this.props.className + ' ParameterControl'
- }, header);
- }
- }]);
- return ParameterControl;
- }(_Module3.default);
- var _default = ParameterControl;
- exports.default = _default;
|