ModuleLoader.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _react = _interopRequireDefault(require("react"));
  7. var _Logger = _interopRequireDefault(require("./Logger"));
  8. var _API = _interopRequireDefault(require("./services/API.js"));
  9. require("./ModuleLoader.css");
  10. var _reactMaterialize = require("react-materialize");
  11. var _fontawesomeSvgCore = require("@fortawesome/fontawesome-svg-core");
  12. var _reactFontawesome = require("@fortawesome/react-fontawesome");
  13. var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
  14. var _ModuleUtilities = require("../modules/ModuleUtilities");
  15. var _Types = _interopRequireDefault(require("../modules/Types"));
  16. var _Systems = _interopRequireDefault(require("./Systems"));
  17. var _CoreSystem = _interopRequireDefault(require("./CoreSystem"));
  18. var _modules = _interopRequireDefault(require("../modules/"));
  19. var _services = _interopRequireDefault(require("../modules/services"));
  20. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
  22. 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; }
  23. 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); }
  24. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  25. 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); } }
  26. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  27. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  28. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  29. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  30. 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); }
  31. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  32. _Systems.default.addModules(_modules.default);
  33. _Systems.default.addServices(_services.default);
  34. var Extendable = _modules.default.ExtendableContainer;
  35. var Core = new _CoreSystem.default();
  36. _Systems.default.setCore(Core); ////////////////////////////////////////////
  37. _fontawesomeSvgCore.library.add(_freeSolidSvgIcons.faEraser);
  38. _fontawesomeSvgCore.library.add(_freeSolidSvgIcons.faTrash);
  39. _fontawesomeSvgCore.library.add(_freeSolidSvgIcons.faEye);
  40. _fontawesomeSvgCore.library.add(_freeSolidSvgIcons.faEyeSlash);
  41. var ModuleLoader =
  42. /*#__PURE__*/
  43. function (_React$Component) {
  44. _inherits(ModuleLoader, _React$Component);
  45. function ModuleLoader(props) {
  46. var _this;
  47. _classCallCheck(this, ModuleLoader);
  48. _this = _possibleConstructorReturn(this, _getPrototypeOf(ModuleLoader).call(this, props));
  49. _this._searchModules();
  50. return _this;
  51. }
  52. _createClass(ModuleLoader, [{
  53. key: "_searchModules",
  54. value: function _searchModules() {
  55. this.modules = _Systems.default.getModules(); //this.modules = [...this.modules, Systems.getLoadedServices()];
  56. _Logger.default.log('Modules Loaded :', this.modules);
  57. this.services = _Systems.default.getServices();
  58. _Logger.default.log('Services Loaded :', this.services);
  59. }
  60. }, {
  61. key: "render",
  62. value: function render() {
  63. var ModuleList = _Systems.default.getModule("ModulesList", "Base");
  64. return _react.default.createElement("div", {
  65. className: "ModuleLoader"
  66. }, _react.default.createElement("h5", null, "ModuleList"), _react.default.createElement("div", {
  67. className: "row"
  68. }, _react.default.createElement(ModuleList, {
  69. list: this.modules,
  70. className: "col s12"
  71. }), _react.default.createElement(ModuleList, {
  72. list: this.services,
  73. className: "col s12"
  74. })));
  75. }
  76. }]);
  77. return ModuleLoader;
  78. }(_react.default.Component); // {
  79. // ctor: Container,
  80. // inputs: {
  81. // width:1,
  82. // children: [{
  83. // ...item
  84. // }]
  85. // }
  86. // }
  87. var MemoryLoader =
  88. /*#__PURE__*/
  89. function (_React$Component2) {
  90. _inherits(MemoryLoader, _React$Component2);
  91. function MemoryLoader(props) {
  92. var _this2;
  93. _classCallCheck(this, MemoryLoader);
  94. _this2 = _possibleConstructorReturn(this, _getPrototypeOf(MemoryLoader).call(this, props));
  95. _this2.state = {
  96. tree: null,
  97. main: null,
  98. export: false,
  99. counter: 0,
  100. vision: localStorage.getItem("AdminVision")
  101. };
  102. _this2.tree = {}; // this.systemAdmin = <SystemAdmin />;
  103. _API.default.setUrl("/");
  104. Core.onUpdate(function () {
  105. _this2.onUpdate();
  106. });
  107. _this2._elist = window.addEventListener("keydown", function (event) {
  108. if (!((window.navigator.platform.match("Mac") ? event.metaKey : event.ctrlKey) && event.which == 83)) return true;
  109. _this2._save(Core.export());
  110. if (window.M) window.M.toast({
  111. html: 'Project saved! -------',
  112. displayLength: 5000
  113. });else if (window.Materialize) window.Materialize.toast('Project saved! --------------', 5000);
  114. event.preventDefault();
  115. return false;
  116. });
  117. return _this2;
  118. }
  119. _createClass(MemoryLoader, [{
  120. key: "onUpdate",
  121. value: function onUpdate() {
  122. if (this.mounted) {
  123. console.log("UPDATE OK");
  124. this.forceUpdate();
  125. }
  126. }
  127. }, {
  128. key: "componentDidMount",
  129. value: function componentDidMount() {
  130. this.mounted = true;
  131. this._load();
  132. }
  133. }, {
  134. key: "componentWillUnmount",
  135. value: function componentWillUnmount() {
  136. window.removeEventListener("keydown", this._elist);
  137. this.mounted = false;
  138. }
  139. }, {
  140. key: "addService",
  141. value: function addService(m) {
  142. m.id = parseInt(Math.random() * 1234567890) % 7654321;
  143. Core.loadService(m);
  144. Core.refresh();
  145. }
  146. }, {
  147. key: "toggleMode",
  148. value: function toggleMode() {
  149. if (localStorage.getItem("AdminMode") === "admin") {
  150. localStorage.setItem("AdminMode", "");
  151. } else {
  152. localStorage.setItem("AdminMode", "admin");
  153. }
  154. Core.refresh(true);
  155. this.forceUpdate();
  156. }
  157. }, {
  158. key: "toggle",
  159. value: function toggle() {
  160. if (localStorage.getItem("AdminVision") === "admin") {
  161. localStorage.setItem("AdminVision", "");
  162. this.setState({
  163. vision: false
  164. });
  165. } else {
  166. localStorage.setItem("AdminVision", "admin");
  167. this.setState({
  168. vision: true
  169. });
  170. }
  171. }
  172. }, {
  173. key: "addRoot",
  174. value: function addRoot(mod) {
  175. var answer = prompt("Add Name");
  176. if (answer) {
  177. mod.id = answer;
  178. var route = prompt("Add Route");
  179. this.setState({
  180. main: [mod]
  181. });
  182. Core.loadModule(mod, true);
  183. Core.RoutingSystem.addRoute(route, mod.id);
  184. Core.go(route);
  185. this._save(Core.export());
  186. }
  187. }
  188. }, {
  189. key: "_save",
  190. value: function _save(structure) {
  191. console.log(structure);
  192. localStorage.setItem('Site', JSON.stringify(structure));
  193. }
  194. }, {
  195. key: "_load",
  196. value: function _load() {
  197. if (localStorage.getItem('Site')) {
  198. try {
  199. var structure = JSON.parse(localStorage.getItem('Site'));
  200. this.setState({
  201. main: structure,
  202. counter: 0
  203. });
  204. Core.import(structure);
  205. console.log("Loaded", structure, this);
  206. } catch (e) {
  207. _Logger.default.error("Memory Loader : Failed to parse localStorage Site.", e);
  208. }
  209. }
  210. }
  211. }, {
  212. key: "exportToFile",
  213. value: function exportToFile() {
  214. function download(filename, text) {
  215. var element = document.createElement('a');
  216. element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
  217. element.setAttribute('download', filename);
  218. element.style.display = 'none';
  219. document.body.appendChild(element);
  220. element.click();
  221. document.body.removeChild(element);
  222. }
  223. download('Modularity' + new Date().toISOString() + '.txt', JSON.stringify(Core.export()));
  224. }
  225. }, {
  226. key: "importFromFile",
  227. value: function importFromFile(event) {
  228. var self = this;
  229. var input = event.target;
  230. var reader = new FileReader();
  231. reader.onload = function () {
  232. var text = reader.result;
  233. var answer = window.confirm("Import : " + text);
  234. if (answer) {
  235. try {
  236. Core.import(JSON.parse(text));
  237. Core.refresh(true);
  238. } catch (e) {
  239. alert("No good file!");
  240. }
  241. }
  242. };
  243. reader.readAsText(input.files[0]);
  244. }
  245. }, {
  246. key: "render",
  247. value: function render() {
  248. var _this3 = this;
  249. var modules = Core.renderModules();
  250. var services = Core.renderServices();
  251. if (!modules) console.log("Core Modules rendered: " + modules);
  252. if (!services) console.log("Core services rendered: " + services);
  253. return _react.default.createElement("div", null, this.state.vision ? _react.default.createElement("div", null, _react.default.createElement(_reactMaterialize.Card, {
  254. className: "MemoryLoaderUI",
  255. key: 'UI'
  256. }, _react.default.createElement("div", {
  257. className: "row"
  258. }, _react.default.createElement(_reactMaterialize.Button, {
  259. type: "button",
  260. className: "btn btn-primary col s6",
  261. onClick: function onClick() {
  262. return _this3.toggle();
  263. }
  264. }, _react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
  265. icon: "eye"
  266. })), _react.default.createElement(_reactMaterialize.Button, {
  267. className: "btn btn-primary darken-1 col s6",
  268. onClick: function onClick() {
  269. return _this3.toggleMode();
  270. }
  271. }, "Admin"), _react.default.createElement(_reactMaterialize.Button, {
  272. className: "btn btn-primary col s6",
  273. onClick: function onClick() {
  274. return _this3._save(Core.export());
  275. }
  276. }, _react.default.createElement(_reactMaterialize.Icon, null, "save")), _react.default.createElement(_reactMaterialize.Button, {
  277. className: "btn btn-primary col s6",
  278. onClick: function onClick() {
  279. return _this3.exportToFile();
  280. }
  281. }, _react.default.createElement(_reactMaterialize.Icon, null, "file_download")), _react.default.createElement(_reactMaterialize.TextInput, {
  282. type: "file",
  283. label: _react.default.createElement(_reactMaterialize.Icon, null, "file_upload"),
  284. s: 12,
  285. onChange: function onChange(e) {
  286. return _this3.importFromFile(e);
  287. }
  288. }), _react.default.createElement("div", {
  289. className: "col s12"
  290. }, _react.default.createElement("div", null, _react.default.createElement(_ModuleUtilities.InputMarker, {
  291. name: "root",
  292. onDrop: function onDrop(mod) {
  293. return _this3.addRoot(mod);
  294. }
  295. })), _react.default.createElement("div", null, _react.default.createElement(_ModuleUtilities.InputMarker, {
  296. name: "services",
  297. onDrop: function onDrop(mod) {
  298. return _this3.addService(mod);
  299. }
  300. })), _react.default.createElement("div", null, _react.default.createElement(Extendable, {
  301. header: "Add input"
  302. }, _react.default.createElement(InputGeneratorUI, null))), _react.default.createElement("div", null, _react.default.createElement(Extendable, {
  303. header: "Add output"
  304. }, _react.default.createElement(OutputGeneratorUI, null))), _react.default.createElement("div", null, _react.default.createElement(Extendable, {
  305. header: "Core I/O"
  306. }, _react.default.createElement(IO, null)))))), services ? services : '', _react.default.createElement(ModuleLoader, null)) : _react.default.createElement(_reactMaterialize.Card, {
  307. className: "MemoryLoaderUI mini",
  308. key: 'UI'
  309. }, _react.default.createElement("div", {
  310. className: "row"
  311. }, _react.default.createElement("button", {
  312. type: "button",
  313. className: "btn btn-primary col s12",
  314. onClick: function onClick() {
  315. return _this3.toggle();
  316. }
  317. }, _react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
  318. icon: "eye-slash"
  319. })))), modules ? modules : 'No render');
  320. }
  321. }]);
  322. return MemoryLoader;
  323. }(_react.default.Component);
  324. var SolidLoader =
  325. /*#__PURE__*/
  326. function (_React$Component3) {
  327. _inherits(SolidLoader, _React$Component3);
  328. function SolidLoader(props) {
  329. var _this4;
  330. _classCallCheck(this, SolidLoader);
  331. _this4 = _possibleConstructorReturn(this, _getPrototypeOf(SolidLoader).call(this, props));
  332. _this4.state = {
  333. script: props.script || {}
  334. };
  335. _API.default.setUrl("/");
  336. Core.onUpdate(function () {
  337. return _this4.onUpdate();
  338. });
  339. return _this4;
  340. }
  341. _createClass(SolidLoader, [{
  342. key: "onUpdate",
  343. value: function onUpdate() {
  344. this.forceUpdate();
  345. }
  346. }, {
  347. key: "componentDidMount",
  348. value: function componentDidMount() {
  349. this._load();
  350. }
  351. }, {
  352. key: "_load",
  353. value: function _load() {
  354. if (this.state.script) {
  355. try {
  356. var structure = this.props.script;
  357. this.setState({
  358. main: structure,
  359. counter: 0
  360. });
  361. Core.import(structure);
  362. console.log("Loaded", structure, this);
  363. } catch (e) {
  364. _Logger.default.error("Solid Loader : Failed to parse SiteScript.", e);
  365. }
  366. }
  367. }
  368. }, {
  369. key: "render",
  370. value: function render() {
  371. var modules = Core.renderModules();
  372. var services = Core.renderServices();
  373. return _react.default.createElement("div", null, modules ? modules : 'No render');
  374. }
  375. }]);
  376. return SolidLoader;
  377. }(_react.default.Component);
  378. var IO =
  379. /*#__PURE__*/
  380. function (_React$Component4) {
  381. _inherits(IO, _React$Component4);
  382. function IO(props) {
  383. var _this5;
  384. _classCallCheck(this, IO);
  385. _this5 = _possibleConstructorReturn(this, _getPrototypeOf(IO).call(this, props));
  386. _this5.state = {};
  387. return _this5;
  388. }
  389. _createClass(IO, [{
  390. key: "render",
  391. value: function render() {
  392. var _this6 = this;
  393. console.log(Core.inputs);
  394. var inputs = Core.inputs || {};
  395. var outputs = Core.outputs || {};
  396. var renderedInputs = Object.keys(inputs).map(function (key, indx) {
  397. Core.getInput(key).onUpdate(function () {
  398. return _this6.forceUpdate();
  399. });
  400. return _react.default.createElement("div", {
  401. key: indx + Math.random()
  402. }, (0, _ModuleUtilities.RendererInput)(Core.getInput(key), function (name, value) {
  403. return Core.updateInput(_objectSpread({}, inputs[key], {
  404. value: value
  405. }));
  406. }), _react.default.createElement("span", {
  407. onClick: function onClick() {
  408. return Core.removeInput(key);
  409. }
  410. }, _react.default.createElement(_reactMaterialize.Icon, null, "delete")));
  411. });
  412. var renderedOutputs = Object.keys(outputs).map(function (key, indx) {
  413. return _react.default.createElement("div", {
  414. key: indx
  415. }, (0, _ModuleUtilities.RendererOutput)(Core.getOutput(key), function (name, value) {
  416. return Core.updateOutput(_objectSpread({}, outputs[key], {
  417. value: value
  418. }));
  419. }), _react.default.createElement("span", {
  420. onClick: function onClick() {
  421. return Core.removeOutput(key);
  422. }
  423. }, _react.default.createElement(_reactMaterialize.Icon, null, "delete")));
  424. });
  425. return _react.default.createElement("div", null, _react.default.createElement("div", null, renderedInputs), _react.default.createElement("div", null, renderedOutputs));
  426. }
  427. }]);
  428. return IO;
  429. }(_react.default.Component);
  430. var InputGeneratorUI =
  431. /*#__PURE__*/
  432. function (_React$Component5) {
  433. _inherits(InputGeneratorUI, _React$Component5);
  434. function InputGeneratorUI(props) {
  435. var _this7;
  436. _classCallCheck(this, InputGeneratorUI);
  437. _this7 = _possibleConstructorReturn(this, _getPrototypeOf(InputGeneratorUI).call(this, props));
  438. _this7.state = {
  439. type: _Types.default.Text,
  440. arrType: _Types.default.Text,
  441. name: '',
  442. defaultValue: ''
  443. };
  444. return _this7;
  445. }
  446. _createClass(InputGeneratorUI, [{
  447. key: "submit",
  448. value: function submit() {
  449. Core.addInput(_objectSpread({}, this.state));
  450. }
  451. }, {
  452. key: "render",
  453. value: function render() {
  454. var _this8 = this;
  455. return _react.default.createElement("div", {
  456. className: "InputGenerator",
  457. style: {
  458. background: "white"
  459. }
  460. }, _react.default.createElement("div", {
  461. className: "row"
  462. }, _react.default.createElement(_reactMaterialize.Select, {
  463. s: 12,
  464. type: "select",
  465. label: "Type",
  466. defaultValue: _Types.default.Text,
  467. onChange: function onChange(e) {
  468. return _this8.setState({
  469. type: parseInt(e.target.value)
  470. });
  471. }
  472. }, Object.keys(_Types.default).map(function (key, indx) {
  473. return _react.default.createElement("option", {
  474. key: indx,
  475. value: _Types.default[key]
  476. }, key);
  477. }))), _react.default.createElement("div", {
  478. className: "row"
  479. }, this.state.type === _Types.default["Array"] ? _react.default.createElement(_reactMaterialize.Select, {
  480. s: 12,
  481. type: "select",
  482. label: "Array Type",
  483. defaultValue: _Types.default.Text,
  484. onChange: function onChange(e) {
  485. return _this8.setState({
  486. arrType: parseInt(e.target.value)
  487. });
  488. }
  489. }, Object.keys(_Types.default).map(function (key, indx) {
  490. return _react.default.createElement("option", {
  491. key: indx,
  492. value: _Types.default[key],
  493. disabled: key == "Array"
  494. }, key);
  495. })) : ''), _react.default.createElement("div", {
  496. className: "row"
  497. }, _react.default.createElement("input", {
  498. className: "col s12",
  499. type: "text",
  500. onChange: function onChange(e) {
  501. return _this8.setState({
  502. name: e.target.value
  503. });
  504. },
  505. placeholder: "Name"
  506. })), _react.default.createElement("div", {
  507. className: "row"
  508. }, _react.default.createElement("input", {
  509. className: "col s12",
  510. type: "text",
  511. onChange: function onChange(e) {
  512. return _this8.setState({
  513. defaultValue: e.target.value
  514. });
  515. },
  516. placeholder: "Default"
  517. })), _react.default.createElement("div", {
  518. className: "row"
  519. }, _react.default.createElement(_reactMaterialize.Button, {
  520. className: "btn btn-primary col s12",
  521. type: "text",
  522. onClick: function onClick(e) {
  523. return _this8.submit();
  524. }
  525. }, "Add")));
  526. }
  527. }]);
  528. return InputGeneratorUI;
  529. }(_react.default.Component);
  530. var OutputGeneratorUI =
  531. /*#__PURE__*/
  532. function (_React$Component6) {
  533. _inherits(OutputGeneratorUI, _React$Component6);
  534. function OutputGeneratorUI(props) {
  535. var _this9;
  536. _classCallCheck(this, OutputGeneratorUI);
  537. _this9 = _possibleConstructorReturn(this, _getPrototypeOf(OutputGeneratorUI).call(this, props));
  538. _this9.state = {
  539. type: 0,
  540. arrType: 0,
  541. name: ''
  542. };
  543. return _this9;
  544. }
  545. _createClass(OutputGeneratorUI, [{
  546. key: "submit",
  547. value: function submit() {
  548. Core.addOutput(_objectSpread({}, this.state));
  549. }
  550. }, {
  551. key: "render",
  552. value: function render() {
  553. var _this10 = this;
  554. return _react.default.createElement("div", {
  555. className: "OutputGenerator",
  556. style: {
  557. background: "white"
  558. }
  559. }, _react.default.createElement("div", {
  560. className: "row"
  561. }, _react.default.createElement(_reactMaterialize.Select, {
  562. s: 12,
  563. type: "select",
  564. label: "Type",
  565. defaultValue: "2",
  566. onChange: function onChange(e) {
  567. return _this10.setState({
  568. type: parseInt(e.target.value)
  569. });
  570. }
  571. }, Object.keys(_Types.default).map(function (key, indx) {
  572. return _react.default.createElement("option", {
  573. key: indx,
  574. value: _Types.default[key]
  575. }, key);
  576. }))), _react.default.createElement("div", {
  577. className: "row"
  578. }, this.state.type === _Types.default["Array"] ? _react.default.createElement(_reactMaterialize.Select, {
  579. s: 12,
  580. type: "select",
  581. label: "Array Type",
  582. defaultValue: "2",
  583. onChange: function onChange(e) {
  584. return _this10.setState({
  585. arrType: parseInt(e.target.value)
  586. });
  587. }
  588. }, Object.keys(_Types.default).map(function (key, indx) {
  589. return _react.default.createElement("option", {
  590. key: indx,
  591. value: _Types.default[key],
  592. disabled: key == "Array"
  593. }, key);
  594. })) : ''), _react.default.createElement("div", {
  595. className: "row"
  596. }, _react.default.createElement("input", {
  597. className: "col s12",
  598. type: "text",
  599. onChange: function onChange(e) {
  600. return _this10.setState({
  601. name: e.target.value
  602. });
  603. },
  604. placeholder: "Name"
  605. })), _react.default.createElement("div", {
  606. className: "row"
  607. }, _react.default.createElement(_reactMaterialize.Button, {
  608. className: "btn btn-primary col s12",
  609. type: "text",
  610. onClick: function onClick(e) {
  611. return _this10.submit();
  612. }
  613. }, "Add")));
  614. }
  615. }]);
  616. return OutputGeneratorUI;
  617. }(_react.default.Component);
  618. ModuleLoader.MemoryLoader = MemoryLoader;
  619. ModuleLoader.SolidLoader = SolidLoader;
  620. var _default = ModuleLoader;
  621. exports.default = _default;