From 128bf60b54b18a41791f749289a5fc52f1df5659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=98=84=EC=84=B1=ED=95=84?= Date: Mon, 13 May 2024 16:52:10 +0900 Subject: [PATCH] Flat Message Layout --- .../components/ApiLayoutItemTreeBuilder.js | 2 +- .../src/components/EditableInput.js | 78 ++++--- ApiTestManager/src/components/LayoutGrid.js | 206 ++++++++++-------- .../src/components/LayoutTreeGrid.js | 43 +--- .../src/components/TCPClientView.js | 35 ++- .../controller/ApiRequestMgmtController.java | 1 + .../client/mapper/ApiRequestMapper.java | 7 +- .../client/service/ApiLayoutMgmtService.java | 9 +- .../plugins/apitestmanager/app.bundle.js | 10 +- 9 files changed, 209 insertions(+), 182 deletions(-) diff --git a/ApiTestManager/src/components/ApiLayoutItemTreeBuilder.js b/ApiTestManager/src/components/ApiLayoutItemTreeBuilder.js index c8fba9d..21b9d62 100644 --- a/ApiTestManager/src/components/ApiLayoutItemTreeBuilder.js +++ b/ApiTestManager/src/components/ApiLayoutItemTreeBuilder.js @@ -23,7 +23,7 @@ class ApiLayoutItemTreeBuilder { if (nodeMap.has(parseInt(item.parent))) { nodeMap.get(parseInt(item.parent)).children.push(item); - console.log(item.id + ' to ' + item.parent); + // console.log(item.id + ' to ' + item.parent); } else { console.log('Parent not found: ' + item.parent); } diff --git a/ApiTestManager/src/components/EditableInput.js b/ApiTestManager/src/components/EditableInput.js index 0a0018f..99374c7 100644 --- a/ApiTestManager/src/components/EditableInput.js +++ b/ApiTestManager/src/components/EditableInput.js @@ -161,7 +161,12 @@ class EditableInputController { const preCaretRange = range.cloneRange(); preCaretRange.selectNodeContents(element); preCaretRange.setEnd(range.endContainer, range.endOffset); - return preCaretRange.toString().trim().length; + const content = preCaretRange.toString().trim(); + if (content === '\u200B') { + return 0; // Return 0 if the content is only the zero-width space character + } + console.log(content); + return content.replace('\u200B', '').length; } handleInput(editableDiv) { @@ -181,15 +186,50 @@ class EditableInputController { }) .join(''); - var result = mergedString.replace(/[\u200B-\u200D\uFEFF]/g, ''); + let result = mergedString.replace(/[\u200B-\u200D\uFEFF]/g, ''); let content = this.parseContent(result); this.model.setValue(content.join('')); // Optionally, update the view if needed this.view.updateUI(); - this.restoreCursor(editableDiv, cursor); + + } + + restoreCursor(element, position) { + const selection = window.getSelection(); + const range = document.createRange(); + range.setStart(element, 0); + range.collapse(true); + + const nodeStack = [element]; + let node, foundStart = false, stop = false; + let charIndex = 0; + console.log('restoreCursor', position); + while (!stop && (node = nodeStack.pop())) { + if (node.nodeType === 3) { + console.log(node); + const nextCharIndex = charIndex + node.length; + if (!foundStart && position >= charIndex && position <= nextCharIndex) { + range.setStart(node, position - charIndex); + foundStart = true; + } + if (foundStart && position >= charIndex && position <= nextCharIndex) { + range.setEnd(node, position - charIndex); + stop = true; + } + charIndex = nextCharIndex; + } else { + let i = node.childNodes.length; + while (i--) { + nodeStack.push(node.childNodes[i]); + } + } + } + + selection.removeAllRanges(); + selection.addRange(range); } parseContent(inputString) { @@ -218,39 +258,7 @@ class EditableInputController { return returnStringArray; } - restoreCursor(element, position) { - const selection = window.getSelection(); - const range = document.createRange(); - range.setStart(element, 0); - range.collapse(true); - const nodeStack = [element]; - let node, foundStart = false, stop = false; - let charIndex = 0; - - while (!stop && (node = nodeStack.pop())) { - if (node.nodeType === 3) { - const nextCharIndex = charIndex + node.length; - if (!foundStart && position >= charIndex && position <= nextCharIndex) { - range.setStart(node, position - charIndex); - foundStart = true; - } - if (foundStart && position >= charIndex && position <= nextCharIndex) { - range.setEnd(node, position - charIndex); - stop = true; - } - charIndex = nextCharIndex; - } else { - let i = node.childNodes.length; - while (i--) { - nodeStack.push(node.childNodes[i]); - } - } - } - - selection.removeAllRanges(); - selection.addRange(range); - } updateUI() { this.view.updateUI(); diff --git a/ApiTestManager/src/components/LayoutGrid.js b/ApiTestManager/src/components/LayoutGrid.js index ec99430..65c40af 100644 --- a/ApiTestManager/src/components/LayoutGrid.js +++ b/ApiTestManager/src/components/LayoutGrid.js @@ -4,23 +4,31 @@ class LayoutGridModel { constructor(items) { this.items = items; } + + setItems(items) { + this.items = items; + } } class LayoutGridView { - constructor(model, controller) { + constructor(selector, model, controller) { + this.selector = selector; this.model = model; this.controller = controller; - } render() { this.renderApiLayout(); } + clear(){ + this.selector.children().remove(); + } + renderApiLayout() { - const requestContainer = this.targetContent.find('.request_layout'); - requestContainer.empty(); + const requestContainer = $(this.selector); + requestContainer.children().remove();; const headerHtml = ` @@ -72,12 +80,11 @@ class LayoutGridView { const editableInput = new EditableInput({ name: editableElement.dataset.name, value: editableElement.dataset.value, - style : {width : '120px'} + style: {width: '120px'} }); editableInput.init(editableElement, async (value) => { - _.set(this.model, editableElement.dataset.name, value); - await this.controller.additionalCallback(this.model); + this.controller.setValue(editableElement.dataset.name, value); }); }); @@ -86,7 +93,6 @@ class LayoutGridView { totalLength += parseInt(item.loutItemLength); }); - this.setupListeners(); } @@ -99,13 +105,6 @@ class LayoutGridView { } } - recalculateSerno() { - // Reassign loutItemSerno sequentially based on the current order - this.model.items.forEach((item, index) => { - item.loutItemSerno = index + 1; // Assuming you want to start numbering from 1 - }); - } - async handleUIUpdate(event) { if (event) { event.preventDefault(); @@ -113,8 +112,7 @@ class LayoutGridView { const fieldName = $(element).attr('name'); const newValue = this.getFieldValue(element); if (fieldName !== '') { - _.set(this.model, fieldName, newValue); - await this.controller.additionalCallback(this.model); + this.controller.setValue(fieldName, newValue); } } let totalLength = 0; @@ -123,82 +121,31 @@ class LayoutGridView { }); } - getLastId (){ - let lastId = 0; - this.model.items.forEach(item => { - if (item.id > lastId) { - lastId = item.id; - } - }); - return lastId + 1; - } - setupListeners() { - const table = this.targetContent.find('.layout_table'); + const table = this.selector.find('.layout_table'); table.on('change', 'select.field, input.field', this.handleUIUpdate.bind(this)); - table.on('click', '.add-layout-item', async(event) => { - let item = { - 'id' : this.getLastId(), - 'parent': 0, - 'level': 1, - 'loutName': '', - 'loutItemName': '', - 'loutItemDesc': '', - 'loutItemDepth': 1, - 'loutItemType': 'Field', - 'loutItemOccCnt': '', - 'loutItemOccRef': '', - 'loutItemDataType': 'String', - 'loutItemLength': 1, - 'loutItemDecimal': 0, - 'loutItemDefault': '', - 'loutItemMaskYn': 'N', - 'loutItemMaskOffset': 0, - 'loutItemMaskLength': 0, - 'parentLoutItemIndex': 0, - 'expanded': true, - 'isLeaf': true, - 'LOUTITEMPATH': '', - 'value': '', - 'loutItemSerno': 0 - }; - this.model.items.push(item); - this.recalculateSerno(); + table.on('click', '.add-layout-item', async (event) => { + await this.controller.addItem(); this.renderApiLayout(); - await this.controller.additionalCallback(this.model); }); table.on('click', '.move-up', async (event) => { const index = $(event.currentTarget).data('index'); - if (index > 0) { - const temp = this.model.items[index]; - this.model.items[index] = this.model.items[index - 1]; - this.model.items[index - 1] = temp; - this.recalculateSerno(); - this.renderApiLayout(); - await this.controller.additionalCallback(this.model); - } + await this.controller.moveUp(index); + this.renderApiLayout(); }); table.on('click', '.move-down', async (event) => { const index = $(event.currentTarget).data('index'); - if (index < this.model.items.length - 1) { - const temp = this.model.items[index]; - this.model.items[index] = this.model.items[index + 1]; - this.model.items[index + 1] = temp; - this.recalculateSerno(); - this.renderApiLayout(); - await this.controller.additionalCallback(this.model); - } + await this.controller.moveDown(index); + this.renderApiLayout(); }); table.on('click', '.delete', async (event) => { const index = $(event.currentTarget).data('index'); - this.model.items.splice(index, 1); - this.recalculateSerno(); + await this.controller.deleteItem(index); this.renderApiLayout(); - await this.controller.additionalCallback(this.model); }); } @@ -244,7 +191,7 @@ class LayoutGridView { ').addClass('treegrid-' + node.id).data('nodeId', node.id); // Storing node ID for easy access later - // - // if (depth === 0) { - // tr.css({'display': 'none'}); - // } - // - // if (node.parent || (node.parent !== null && parseInt(node.parent) !== this.model.rootId)) { - // // if (node.parent !== undefined && node.parent !== null) { - // const parentSelector = `.treegrid-${node.parent}`; - // const lastChildSelector = `.treegrid-parent-${node.parent}`; - // // console.log('lastChild:', $(this.view.table).find(lastChildSelector), 'length: ', $(this.view.table).find(lastChildSelector).length); - // - // if ($(this.view.table).find(lastChildSelector).length > 0) { - // const lastChild = $(this.view.table).find(lastChildSelector).last(); - // tr.insertAfter(lastChild); - // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterLastChild: ', lastChild); - // } else { - // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterParent: ', parentSelector); - // tr.insertAfter($(this.view.table).find(parentSelector)); - // // tr.appendTo(this.view.table); - // } - // tr.addClass('treegrid-parent-' + node.parent); - // } else { - // tr.appendTo(this.view.table); - // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'no parent'); - // } - // - // console.log('================================ row Added'); - // return tr; - // } - addRow(node, depth) { - console.log('================================ addRow: ', node.id); + // console.log('================================ addRow: ', node.id); const tr = $('').addClass('treegrid-' + node.id).data('nodeId', node.id); if (depth === 0) { @@ -164,18 +131,18 @@ class LayoutTreeGridController { if ($(this.view.table).find(lastChildSelector).length > 0) { const lastChild = $(this.view.table).find(lastChildSelector).last(); tr.insertAfter(lastChild); - console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterLastChild: ', lastChild); + // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterLastChild: ', lastChild); } else { - console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterParent: ', parentSelector); + // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterParent: ', parentSelector); tr.insertAfter($(this.view.table).find(parentSelector)); } tr.addClass('treegrid-parent-' + node.parent); } else { tr.appendTo(this.view.table); - console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'no parent'); + // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'no parent'); } - console.log('================================ row Added'); + // console.log('================================ row Added'); return tr; } addCell(row, node, fieldInfo, depth) { diff --git a/ApiTestManager/src/components/TCPClientView.js b/ApiTestManager/src/components/TCPClientView.js index efd4b7a..ff2dd4c 100644 --- a/ApiTestManager/src/components/TCPClientView.js +++ b/ApiTestManager/src/components/TCPClientView.js @@ -34,8 +34,8 @@ class TCPClientView { const layoutDataTreeOptions = [ {name: 'loutItemSerno', width: 100, isFirst: true, label: '#'}, - {name: 'loutItemName', width: 100, align: 'center', label: '항목명(영문)'}, - {name: 'loutItemDesc', width: 100, align: 'center', label: '항목설명'}, + {name: 'loutItemName', width: 100, align: 'left', label: '항목명(영문)'}, + {name: 'loutItemDesc', width: 100, align: 'left', label: '항목설명'}, {name: 'loutItemDepth', width: 60, align: 'center', label: '깊이'}, {name: 'loutItemType', width: 100, align: 'center', label: '아이템 유형'}, {name: 'loutItemOccCnt', width: 100, align: 'center', label: '반복 횟수'}, @@ -48,13 +48,10 @@ class TCPClientView { let replicator = new ApiLayoutItemTreeDataBuilder(10000); let layoutDataRoot = replicator.createReplicatedTree(layoutRoot); - console.log(this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.request_layout_data_tree')); - console.log(this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.request_layout_tree')); - console.log(this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.total_message_length')); - let layoutTreeDataGrid = new LayoutTreeDataGrid(this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.request_layout_data_tree'), layoutDataRoot, this.model, layoutDataTreeOptions, this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.total_message_length')); layoutTreeDataGrid.init( async (finalMessage) => { - const prefix = await this.serverManager.renderServerPrefix(this.server.serverOptions, this.model); + const prefix = this.server.serverOptions ? await this.serverManager.renderServerPrefix(this.server.serverOptions, this.model) : ''; + this.requestBodyEditor.setValue(prefix + finalMessage); }); @@ -64,8 +61,7 @@ class TCPClientView { layoutTreeDataGrid.rebuild(layoutDataRoot); }); - let layoutGrid = new LayoutGrid(this.model.layout); - layoutGrid.init(this.apiRequestTabContent.find(`#api_request_${this.model.id}`), (model) => { + let layoutGrid = new LayoutGrid(this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.request_layout'), this.model.layout, (model) => { model.items.forEach((item) => { item.children = []; }); @@ -75,6 +71,7 @@ class TCPClientView { let layoutDataRoot = replicator.createReplicatedTree(root); layoutTreeDataGrid.rebuild(layoutDataRoot); }); + this.layoutJsonEditor.setValue(JSON.stringify(this.model.layout, null, 2)); $('span.variable').off('mouseover'); $('span.variable').off('mouseout'); @@ -85,6 +82,22 @@ class TCPClientView { }); }); + this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.load_layout').on('click', () => { + try { + this.model.layout = JSON.parse(this.layoutJsonEditor.getValue()); + this.model.layout.layoutItems.forEach((item) => { + if (item.value === undefined){ + item.value = ''; + } + }); + console.log(this.model); + layoutGrid.rebuild(this.model.layout); + } catch (e) { + console.error(e); + alert(e); + } + }); + window.addEventListener('resize', this.resizeEditor.bind(this)); } @@ -157,15 +170,17 @@ class TCPClientView {
-
+
+
+
diff --git a/src/main/java/com/eactive/testmaster/client/controller/ApiRequestMgmtController.java b/src/main/java/com/eactive/testmaster/client/controller/ApiRequestMgmtController.java index 2089edd..eea5a86 100644 --- a/src/main/java/com/eactive/testmaster/client/controller/ApiRequestMgmtController.java +++ b/src/main/java/com/eactive/testmaster/client/controller/ApiRequestMgmtController.java @@ -86,6 +86,7 @@ public class ApiRequestMgmtController { if (dto.getLayout() != null) { dto.getLayout().setApiRequestId(apiId); + dto.getLayout().setId(apiId); apiLayoutMgmtService.saveLayout(apiLayoutMapper.map(dto.getLayout())); } return ResponseEntity.ok(apiId); diff --git a/src/main/java/com/eactive/testmaster/client/mapper/ApiRequestMapper.java b/src/main/java/com/eactive/testmaster/client/mapper/ApiRequestMapper.java index d07c8c7..5155c58 100644 --- a/src/main/java/com/eactive/testmaster/client/mapper/ApiRequestMapper.java +++ b/src/main/java/com/eactive/testmaster/client/mapper/ApiRequestMapper.java @@ -1,6 +1,7 @@ package com.eactive.testmaster.client.mapper; import com.eactive.testmaster.client.dto.ApiCollectionDTO; +import com.eactive.testmaster.client.dto.ApiLayoutDTO; import com.eactive.testmaster.client.dto.ApiRequestDTO; import com.eactive.testmaster.client.entity.ApiCollection; import com.eactive.testmaster.client.entity.ApiLayout; @@ -61,15 +62,17 @@ public abstract class ApiRequestMapper { public void handleTypeSpecificMapping(ApiRequestInfo entity, @MappingTarget ApiRequestDTO dto) { if ("TCP".equals(entity.getType())) { ApiLayout layout = apiLayoutRepository.findFirstByApiRequestInfo(entity); - if (layout!=null) { + if (layout != null) { layout.getLayoutItems().sort(Comparator.comparingInt(ApiLayoutItem::getLoutItemSerno)); dto.setLayout(apiLayoutMapper.map(layout)); + } else { + dto.setLayout(new ApiLayoutDTO()); } + } } - public abstract List mapApis(List apis); public abstract List mapCollections(List apis); diff --git a/src/main/java/com/eactive/testmaster/client/service/ApiLayoutMgmtService.java b/src/main/java/com/eactive/testmaster/client/service/ApiLayoutMgmtService.java index ecf865c..4cb248c 100644 --- a/src/main/java/com/eactive/testmaster/client/service/ApiLayoutMgmtService.java +++ b/src/main/java/com/eactive/testmaster/client/service/ApiLayoutMgmtService.java @@ -6,6 +6,7 @@ import com.eactive.testmaster.client.entity.ApiRequestInfo; import com.eactive.testmaster.client.repository.ApiLayoutRepository; import com.eactive.testmaster.client.repository.ApiRequestRepository; import com.eactive.testmaster.common.exception.NotFoundException; +import java.util.Optional; import java.util.UUID; import javax.transaction.Transactional; import org.springframework.stereotype.Service; @@ -31,11 +32,9 @@ public class ApiLayoutMgmtService { } public ApiLayout saveLayout(ApiLayout layout) { - if (layout.getId() == null) { - return createLayout(layout); - } else { - return updateLayout(layout.getId(), layout); - } + ApiLayout apiLayout = apiLayoutRepository.findFirstByApiRequestInfo(layout.getApiRequestInfo()); + + return apiLayout == null ? createLayout(layout) : updateLayout(apiLayout.getId(), layout); } public ApiLayout createLayout(ApiLayout layout) { diff --git a/src/main/resources/static/plugins/apitestmanager/app.bundle.js b/src/main/resources/static/plugins/apitestmanager/app.bundle.js index 8af18e9..50fb1d3 100644 --- a/src/main/resources/static/plugins/apitestmanager/app.bundle.js +++ b/src/main/resources/static/plugins/apitestmanager/app.bundle.js @@ -565,7 +565,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar ApiLayoutItemTreeBuilder = /*#__PURE__*/function () {\n function ApiLayoutItemTreeBuilder() {\n _classCallCheck(this, ApiLayoutItemTreeBuilder);\n }\n _createClass(ApiLayoutItemTreeBuilder, null, [{\n key: \"createTree\",\n value: function createTree(layoutItems) {\n layoutItems.sort(function (a, b) {\n return a.loutItemSerno - b.loutItemSerno;\n });\n var rootId = layoutItems.length === 0 ? 0 : parseInt(layoutItems[0].parent);\n var root = {\n id: rootId,\n children: [],\n loutItemSerno: 0,\n loutItemName: 'Root',\n loutItemDesc: 'Root',\n loutItemType: '',\n loutItemDepth: 0,\n parent: null\n };\n var nodeMap = new Map();\n nodeMap.set(rootId, root);\n var _iterator = _createForOfIteratorHelper(layoutItems),\n _step;\n try {\n var _loop = function _loop() {\n var item = _step.value;\n if (['Grid', 'Group'].includes(item.loutItemType)) {\n if (item.loutItemOccCnt !== null) {\n if (item.loutItemOccCnt === '*') {\n var refItem = layoutItems.find(function (p) {\n return p.loutItemName === item.loutItemOccRef;\n });\n if (refItem) {\n item.childOccCnt = parseInt(refItem.value, 10);\n }\n } else {\n item.childOccCnt = parseInt(item.loutItemOccCnt, 10);\n }\n }\n }\n if (nodeMap.has(parseInt(item.parent))) {\n nodeMap.get(parseInt(item.parent)).children.push(item);\n console.log(item.id + ' to ' + item.parent);\n } else {\n console.log('Parent not found: ' + item.parent);\n }\n nodeMap.set(item.id, item);\n };\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n _loop();\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return root;\n }\n }, {\n key: \"moveNode\",\n value: function moveNode(root, node, moveUp) {\n var parent = this.getParentNode(root, node);\n if (parent === null) {\n // Node is the root node, cannot be moved\n return;\n }\n var siblings = parent.children;\n var currentIndex = siblings.indexOf(node);\n if (currentIndex === -1) {\n // Node not found in parent's children list\n return;\n }\n var newIndex = moveUp ? currentIndex - 1 : currentIndex + 1;\n if (newIndex >= 0 && newIndex < siblings.length) {\n // Swap the positions of the current node and the node at the new index\n var _ref = [siblings[newIndex], siblings[currentIndex]];\n siblings[currentIndex] = _ref[0];\n siblings[newIndex] = _ref[1];\n }\n }\n }, {\n key: \"getParentNode\",\n value: function getParentNode(root, node) {\n if (node.parent === null) {\n return null; // Node is the root node\n }\n return this.getNodeById(root, node.parent);\n }\n }, {\n key: \"getNodeIndex\",\n value: function getNodeIndex(parent, node) {\n return parent.children.indexOf(node);\n }\n }, {\n key: \"getNodeById\",\n value: function getNodeById(node, id) {\n if (node.id == id) {\n return node;\n }\n var _iterator2 = _createForOfIteratorHelper(node.children),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var child = _step2.value;\n var found = this.getNodeById(child, id);\n if (found !== null) {\n return found;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return null;\n }\n }, {\n key: \"findParent\",\n value: function findParent(root, node) {\n if (root === null || node === null) {\n return null; // Invalid input\n }\n if (root.children.includes(node)) {\n return root; // The root is the parent of the node\n }\n var _iterator3 = _createForOfIteratorHelper(root.children),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var child = _step3.value;\n var parent = this.findParent(child, node);\n if (parent !== null) {\n return parent;\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n return null; // Node not found in the tree\n }\n }, {\n key: \"printTree\",\n value: function printTree(root) {\n console.log('====================================');\n this.printNode(root, 0);\n console.log('====================================');\n }\n }, {\n key: \"printNode\",\n value: function printNode(node, level) {\n if (node === null) {\n return;\n }\n\n // Print indentation based on the level\n var indent = '';\n for (var i = 0; i < level; i++) {\n indent += ' ';\n }\n\n // Print the node information\n console.log(\"\".concat(indent).concat(node.id, \": \").concat(node.loutName, \"[\").concat(node.loutItemType, \", Level: \").concat(node.loutItemDepth, \", Serno: \").concat(node.loutItemSerno, \"]\"));\n\n // Recursively print the children\n if (node.children.length > 0) {\n var _iterator4 = _createForOfIteratorHelper(node.children),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var child = _step4.value;\n this.printNode(child, level + 1);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n }\n }\n }, {\n key: \"moveNodeDepth\",\n value: function moveNodeDepth(root, node, newDepth) {\n if (node === null || root === null || newDepth < 0) {\n // Invalid input\n return;\n }\n var parent = this.getParentNode(root, node);\n if (parent === null) {\n // Node is the root node, cannot be moved to a different level\n return;\n }\n var currentDepth = node.loutItemDepth;\n var nodeIndex = this.getNodeIndex(parent, node);\n var nextSibling = this.findClosestSibling(parent.children, nodeIndex);\n parent.children.splice(nodeIndex, 1);\n if (newDepth > currentDepth) {\n // Moving to a higher depth\n if (nextSibling !== null) {\n nextSibling.children.push(node);\n node.parent = nextSibling.id;\n node.loutItemDepth = newDepth;\n this.adjustChildrenDepth(node, newDepth + 1);\n } else {\n // No next sibling found, add the node back to the original parent\n parent.children.push(node);\n }\n } else {\n // Moving to a lower depth\n var newParent = this.findParent(root, parent);\n if (newParent !== null) {\n newParent.children.push(node);\n node.parent = newParent.id;\n node.loutItemDepth = newDepth;\n this.adjustChildrenDepth(node, newDepth + 1);\n } else {\n // No parent found at the desired level, add the node back to the original parent\n parent.children.push(node);\n }\n }\n }\n }, {\n key: \"adjustChildrenDepth\",\n value: function adjustChildrenDepth(node, depth) {\n var _iterator5 = _createForOfIteratorHelper(node.children),\n _step5;\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var child = _step5.value;\n child.loutItemDepth = depth;\n this.adjustChildrenDepth(child, depth + 1);\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n }\n }, {\n key: \"findNextSibling\",\n value: function findNextSibling(siblings) {\n if (siblings === null || siblings.length === 0) {\n return null;\n }\n return siblings[0];\n }\n }, {\n key: \"findClosestSibling\",\n value: function findClosestSibling(siblings, nodeIndex) {\n if (siblings === null || siblings.length === 0) {\n return null;\n }\n if (nodeIndex < 1 || nodeIndex >= siblings.length) {\n return this.findNextSibling(siblings);\n }\n return siblings[nodeIndex - 1];\n }\n }]);\n return ApiLayoutItemTreeBuilder;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ApiLayoutItemTreeBuilder);\n\n//# sourceURL=webpack://APITestManager/./src/components/ApiLayoutItemTreeBuilder.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar ApiLayoutItemTreeBuilder = /*#__PURE__*/function () {\n function ApiLayoutItemTreeBuilder() {\n _classCallCheck(this, ApiLayoutItemTreeBuilder);\n }\n _createClass(ApiLayoutItemTreeBuilder, null, [{\n key: \"createTree\",\n value: function createTree(layoutItems) {\n layoutItems.sort(function (a, b) {\n return a.loutItemSerno - b.loutItemSerno;\n });\n var rootId = layoutItems.length === 0 ? 0 : parseInt(layoutItems[0].parent);\n var root = {\n id: rootId,\n children: [],\n loutItemSerno: 0,\n loutItemName: 'Root',\n loutItemDesc: 'Root',\n loutItemType: '',\n loutItemDepth: 0,\n parent: null\n };\n var nodeMap = new Map();\n nodeMap.set(rootId, root);\n var _iterator = _createForOfIteratorHelper(layoutItems),\n _step;\n try {\n var _loop = function _loop() {\n var item = _step.value;\n if (['Grid', 'Group'].includes(item.loutItemType)) {\n if (item.loutItemOccCnt !== null) {\n if (item.loutItemOccCnt === '*') {\n var refItem = layoutItems.find(function (p) {\n return p.loutItemName === item.loutItemOccRef;\n });\n if (refItem) {\n item.childOccCnt = parseInt(refItem.value, 10);\n }\n } else {\n item.childOccCnt = parseInt(item.loutItemOccCnt, 10);\n }\n }\n }\n if (nodeMap.has(parseInt(item.parent))) {\n nodeMap.get(parseInt(item.parent)).children.push(item);\n // console.log(item.id + ' to ' + item.parent);\n } else {\n console.log('Parent not found: ' + item.parent);\n }\n nodeMap.set(item.id, item);\n };\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n _loop();\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return root;\n }\n }, {\n key: \"moveNode\",\n value: function moveNode(root, node, moveUp) {\n var parent = this.getParentNode(root, node);\n if (parent === null) {\n // Node is the root node, cannot be moved\n return;\n }\n var siblings = parent.children;\n var currentIndex = siblings.indexOf(node);\n if (currentIndex === -1) {\n // Node not found in parent's children list\n return;\n }\n var newIndex = moveUp ? currentIndex - 1 : currentIndex + 1;\n if (newIndex >= 0 && newIndex < siblings.length) {\n // Swap the positions of the current node and the node at the new index\n var _ref = [siblings[newIndex], siblings[currentIndex]];\n siblings[currentIndex] = _ref[0];\n siblings[newIndex] = _ref[1];\n }\n }\n }, {\n key: \"getParentNode\",\n value: function getParentNode(root, node) {\n if (node.parent === null) {\n return null; // Node is the root node\n }\n return this.getNodeById(root, node.parent);\n }\n }, {\n key: \"getNodeIndex\",\n value: function getNodeIndex(parent, node) {\n return parent.children.indexOf(node);\n }\n }, {\n key: \"getNodeById\",\n value: function getNodeById(node, id) {\n if (node.id == id) {\n return node;\n }\n var _iterator2 = _createForOfIteratorHelper(node.children),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var child = _step2.value;\n var found = this.getNodeById(child, id);\n if (found !== null) {\n return found;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return null;\n }\n }, {\n key: \"findParent\",\n value: function findParent(root, node) {\n if (root === null || node === null) {\n return null; // Invalid input\n }\n if (root.children.includes(node)) {\n return root; // The root is the parent of the node\n }\n var _iterator3 = _createForOfIteratorHelper(root.children),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var child = _step3.value;\n var parent = this.findParent(child, node);\n if (parent !== null) {\n return parent;\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n return null; // Node not found in the tree\n }\n }, {\n key: \"printTree\",\n value: function printTree(root) {\n console.log('====================================');\n this.printNode(root, 0);\n console.log('====================================');\n }\n }, {\n key: \"printNode\",\n value: function printNode(node, level) {\n if (node === null) {\n return;\n }\n\n // Print indentation based on the level\n var indent = '';\n for (var i = 0; i < level; i++) {\n indent += ' ';\n }\n\n // Print the node information\n console.log(\"\".concat(indent).concat(node.id, \": \").concat(node.loutName, \"[\").concat(node.loutItemType, \", Level: \").concat(node.loutItemDepth, \", Serno: \").concat(node.loutItemSerno, \"]\"));\n\n // Recursively print the children\n if (node.children.length > 0) {\n var _iterator4 = _createForOfIteratorHelper(node.children),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var child = _step4.value;\n this.printNode(child, level + 1);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n }\n }\n }, {\n key: \"moveNodeDepth\",\n value: function moveNodeDepth(root, node, newDepth) {\n if (node === null || root === null || newDepth < 0) {\n // Invalid input\n return;\n }\n var parent = this.getParentNode(root, node);\n if (parent === null) {\n // Node is the root node, cannot be moved to a different level\n return;\n }\n var currentDepth = node.loutItemDepth;\n var nodeIndex = this.getNodeIndex(parent, node);\n var nextSibling = this.findClosestSibling(parent.children, nodeIndex);\n parent.children.splice(nodeIndex, 1);\n if (newDepth > currentDepth) {\n // Moving to a higher depth\n if (nextSibling !== null) {\n nextSibling.children.push(node);\n node.parent = nextSibling.id;\n node.loutItemDepth = newDepth;\n this.adjustChildrenDepth(node, newDepth + 1);\n } else {\n // No next sibling found, add the node back to the original parent\n parent.children.push(node);\n }\n } else {\n // Moving to a lower depth\n var newParent = this.findParent(root, parent);\n if (newParent !== null) {\n newParent.children.push(node);\n node.parent = newParent.id;\n node.loutItemDepth = newDepth;\n this.adjustChildrenDepth(node, newDepth + 1);\n } else {\n // No parent found at the desired level, add the node back to the original parent\n parent.children.push(node);\n }\n }\n }\n }, {\n key: \"adjustChildrenDepth\",\n value: function adjustChildrenDepth(node, depth) {\n var _iterator5 = _createForOfIteratorHelper(node.children),\n _step5;\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var child = _step5.value;\n child.loutItemDepth = depth;\n this.adjustChildrenDepth(child, depth + 1);\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n }\n }, {\n key: \"findNextSibling\",\n value: function findNextSibling(siblings) {\n if (siblings === null || siblings.length === 0) {\n return null;\n }\n return siblings[0];\n }\n }, {\n key: \"findClosestSibling\",\n value: function findClosestSibling(siblings, nodeIndex) {\n if (siblings === null || siblings.length === 0) {\n return null;\n }\n if (nodeIndex < 1 || nodeIndex >= siblings.length) {\n return this.findNextSibling(siblings);\n }\n return siblings[nodeIndex - 1];\n }\n }]);\n return ApiLayoutItemTreeBuilder;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ApiLayoutItemTreeBuilder);\n\n//# sourceURL=webpack://APITestManager/./src/components/ApiLayoutItemTreeBuilder.js?"); /***/ }), @@ -587,7 +587,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n// const ZERO_WIDTH_SPACE = '​';\nvar ZERO_WIDTH_SPACE = '​';\nvar EditableInputModel = /*#__PURE__*/function () {\n function EditableInputModel() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n _classCallCheck(this, EditableInputModel);\n this.value = value;\n }\n _createClass(EditableInputModel, [{\n key: \"setValue\",\n value: function setValue(newValue) {\n this.value = newValue;\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.value;\n }\n }]);\n return EditableInputModel;\n}();\nvar EditableInputView = /*#__PURE__*/function () {\n function EditableInputView(model, controller, options) {\n _classCallCheck(this, EditableInputView);\n this.model = model;\n this.controller = controller;\n this.options = options;\n }\n _createClass(EditableInputView, [{\n key: \"render\",\n value: function render(element) {\n this.element = element;\n this.element.innerHTML = this.generateInputHtml();\n this.editableDiv = this.element.querySelector('.editableInputContent');\n this.attachEventListeners();\n }\n }, {\n key: \"generateInputHtml\",\n value: function generateInputHtml() {\n var contentHtml = this.model.getValue() ? this.renderContent(this.parseContent(this.model.getValue())) : ZERO_WIDTH_SPACE;\n var styleString = '';\n if (this.options.style && _typeof(this.options.style) === 'object') {\n var styles = Object.entries(this.options.style);\n styleString = styles.map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n prop = _ref2[0],\n value = _ref2[1];\n return \"\".concat(prop, \": \").concat(value, \";\");\n }).join(' ');\n }\n var style = styleString ? \"style=\\\"\".concat(styleString, \"\\\"\") : '';\n return \"\\n
\\n \").concat(contentHtml, \"\\n
\\n \");\n }\n }, {\n key: \"attachEventListeners\",\n value: function attachEventListeners() {\n var _this = this;\n this.editableDiv.addEventListener('input', function (event) {\n _this.controller.handleInput(_this.editableDiv);\n if (_this.controller.additionalCallback) {\n _this.controller.additionalCallback(_this.model.getValue());\n }\n });\n this.editableDiv.addEventListener('paste', function (event) {\n event.preventDefault();\n if (navigator.clipboard && navigator.clipboard.readText) {\n navigator.clipboard.readText().then(function (text) {\n _this.insertTextAtCursor(text);\n })[\"catch\"](function (err) {\n console.error('Failed to read clipboard contents: ', err);\n // Fallback to using clipboardData from the paste event\n var text = (event.clipboardData || window.clipboardData).getData('text');\n _this.insertTextAtCursor(text);\n });\n } else {\n var text = (event.clipboardData || window.clipboardData).getData('text');\n _this.insertTextAtCursor(text);\n }\n });\n }\n }, {\n key: \"insertTextAtCursor\",\n value: function insertTextAtCursor(text) {\n var selection = window.getSelection();\n if (!selection.rangeCount) return;\n var range = selection.getRangeAt(0);\n range.deleteContents();\n var textNode = document.createTextNode(text);\n range.insertNode(textNode);\n range.setStartAfter(textNode);\n range.setEndAfter(textNode);\n selection.removeAllRanges();\n selection.addRange(range);\n this.controller.handleInput(this.editableDiv);\n }\n }, {\n key: \"updateUI\",\n value: function updateUI() {\n var content = this.model.getValue();\n if (content) {\n this.editableDiv.innerHTML = this.renderContent(this.parseContent(content));\n } else {\n this.editableDiv.innerHTML = ZERO_WIDTH_SPACE; // Insert a zero-width space\n }\n this.editableDiv.setAttribute('data-value', content);\n }\n }, {\n key: \"renderContent\",\n value: function renderContent(contentArray) {\n var content = '';\n contentArray.forEach(function (item) {\n if (item.startsWith('{{') && item.endsWith('}}')) {\n content += \"\".concat(item, \"\");\n } else {\n content += \"\".concat(item, \"\");\n }\n });\n return content;\n }\n }, {\n key: \"parseContent\",\n value: function parseContent(inputString) {\n var returnStringArray = [];\n var regex = /{{.*?}}/g;\n var lastIndex = 0;\n inputString.replace(regex, function (match, index) {\n // Add the string before the match\n if (index > lastIndex) {\n returnStringArray.push(inputString.slice(lastIndex, index));\n }\n\n // Add the matched string including the delimiters\n returnStringArray.push(match);\n\n // Update lastIndex for the next iteration\n lastIndex = index + match.length;\n });\n\n // Add any remaining string after the last match\n if (lastIndex < inputString.length) {\n returnStringArray.push(inputString.slice(lastIndex));\n }\n return returnStringArray;\n }\n }]);\n return EditableInputView;\n}();\nvar EditableInputController = /*#__PURE__*/function () {\n function EditableInputController(model, options) {\n _classCallCheck(this, EditableInputController);\n this.model = model;\n this.view = new EditableInputView(this.model, this, options);\n }\n _createClass(EditableInputController, [{\n key: \"init\",\n value: function init(element, callback) {\n this.view.render(element);\n this.additionalCallback = callback;\n }\n }, {\n key: \"getCurrentCursor\",\n value: function getCurrentCursor(element) {\n var selection = window.getSelection();\n if (selection.rangeCount === 0) return null;\n var range = selection.getRangeAt(0);\n var preCaretRange = range.cloneRange();\n preCaretRange.selectNodeContents(element);\n preCaretRange.setEnd(range.endContainer, range.endOffset);\n return preCaretRange.toString().trim().length;\n }\n }, {\n key: \"handleInput\",\n value: function handleInput(editableDiv) {\n // Check and remove zero-width space if it's the only content\n if (editableDiv.innerHTML === '​') {\n editableDiv.innerHTML = '';\n }\n var cursor = this.getCurrentCursor(editableDiv);\n var mergedString = Array.from(editableDiv.childNodes).filter(function (node) {\n // Keep only SPAN elements and text nodes\n return node.nodeName.toUpperCase() === 'SPAN' || node.nodeType === 3;\n }).map(function (node) {\n return node.nodeType === 3 ? node.data.trim() : node.innerText.trim();\n }).join('');\n var result = mergedString.replace(/[\\u200B-\\u200D\\uFEFF]/g, '');\n var content = this.parseContent(result);\n this.model.setValue(content.join(''));\n // Optionally, update the view if needed\n this.view.updateUI();\n this.restoreCursor(editableDiv, cursor);\n }\n }, {\n key: \"parseContent\",\n value: function parseContent(inputString) {\n var returnStringArray = [];\n var regex = /{{.*?}}/g;\n var lastIndex = 0;\n inputString.replace(regex, function (match, index) {\n // Add the string before the match\n if (index > lastIndex) {\n returnStringArray.push(inputString.slice(lastIndex, index));\n }\n\n // Add the matched string including the delimiters\n returnStringArray.push(match);\n\n // Update lastIndex for the next iteration\n lastIndex = index + match.length;\n });\n\n // Add any remaining string after the last match\n if (lastIndex < inputString.length) {\n returnStringArray.push(inputString.slice(lastIndex));\n }\n return returnStringArray;\n }\n }, {\n key: \"restoreCursor\",\n value: function restoreCursor(element, position) {\n var selection = window.getSelection();\n var range = document.createRange();\n range.setStart(element, 0);\n range.collapse(true);\n var nodeStack = [element];\n var node,\n foundStart = false,\n stop = false;\n var charIndex = 0;\n while (!stop && (node = nodeStack.pop())) {\n if (node.nodeType === 3) {\n var nextCharIndex = charIndex + node.length;\n if (!foundStart && position >= charIndex && position <= nextCharIndex) {\n range.setStart(node, position - charIndex);\n foundStart = true;\n }\n if (foundStart && position >= charIndex && position <= nextCharIndex) {\n range.setEnd(node, position - charIndex);\n stop = true;\n }\n charIndex = nextCharIndex;\n } else {\n var i = node.childNodes.length;\n while (i--) {\n nodeStack.push(node.childNodes[i]);\n }\n }\n }\n selection.removeAllRanges();\n selection.addRange(range);\n }\n }, {\n key: \"updateUI\",\n value: function updateUI() {\n this.view.updateUI();\n }\n }]);\n return EditableInputController;\n}();\nvar EditableInput = /*#__PURE__*/function () {\n function EditableInput() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, EditableInput);\n // Initialize the model with the value\n this.model = new EditableInputModel(options.value || '');\n this.controller = new EditableInputController(this.model, options);\n\n // Additional properties as required\n this.name = options.name || '';\n this.id = options.id || '';\n this[\"class\"] = options[\"class\"] || 'form-control';\n this.placeholder = options.placeholder || '';\n }\n _createClass(EditableInput, [{\n key: \"init\",\n value: function init(element, callback) {\n // Initialize the controller with the DOM element\n this.controller.init(element, callback);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n // Delegate to the model\n return this.model.getValue();\n }\n }, {\n key: \"setValue\",\n value: function setValue(newValue) {\n // Delegate to the model and update the view\n this.model.setValue(newValue);\n this.controller.updateUI();\n }\n\n // Any additional methods required for interaction with this component\n }]);\n return EditableInput;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EditableInput);\n\n//# sourceURL=webpack://APITestManager/./src/components/EditableInput.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n// const ZERO_WIDTH_SPACE = '​';\nvar ZERO_WIDTH_SPACE = '​';\nvar EditableInputModel = /*#__PURE__*/function () {\n function EditableInputModel() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n _classCallCheck(this, EditableInputModel);\n this.value = value;\n }\n _createClass(EditableInputModel, [{\n key: \"setValue\",\n value: function setValue(newValue) {\n this.value = newValue;\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.value;\n }\n }]);\n return EditableInputModel;\n}();\nvar EditableInputView = /*#__PURE__*/function () {\n function EditableInputView(model, controller, options) {\n _classCallCheck(this, EditableInputView);\n this.model = model;\n this.controller = controller;\n this.options = options;\n }\n _createClass(EditableInputView, [{\n key: \"render\",\n value: function render(element) {\n this.element = element;\n this.element.innerHTML = this.generateInputHtml();\n this.editableDiv = this.element.querySelector('.editableInputContent');\n this.attachEventListeners();\n }\n }, {\n key: \"generateInputHtml\",\n value: function generateInputHtml() {\n var contentHtml = this.model.getValue() ? this.renderContent(this.parseContent(this.model.getValue())) : ZERO_WIDTH_SPACE;\n var styleString = '';\n if (this.options.style && _typeof(this.options.style) === 'object') {\n var styles = Object.entries(this.options.style);\n styleString = styles.map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n prop = _ref2[0],\n value = _ref2[1];\n return \"\".concat(prop, \": \").concat(value, \";\");\n }).join(' ');\n }\n var style = styleString ? \"style=\\\"\".concat(styleString, \"\\\"\") : '';\n return \"\\n
\\n \").concat(contentHtml, \"\\n
\\n \");\n }\n }, {\n key: \"attachEventListeners\",\n value: function attachEventListeners() {\n var _this = this;\n this.editableDiv.addEventListener('input', function (event) {\n _this.controller.handleInput(_this.editableDiv);\n if (_this.controller.additionalCallback) {\n _this.controller.additionalCallback(_this.model.getValue());\n }\n });\n this.editableDiv.addEventListener('paste', function (event) {\n event.preventDefault();\n if (navigator.clipboard && navigator.clipboard.readText) {\n navigator.clipboard.readText().then(function (text) {\n _this.insertTextAtCursor(text);\n })[\"catch\"](function (err) {\n console.error('Failed to read clipboard contents: ', err);\n // Fallback to using clipboardData from the paste event\n var text = (event.clipboardData || window.clipboardData).getData('text');\n _this.insertTextAtCursor(text);\n });\n } else {\n var text = (event.clipboardData || window.clipboardData).getData('text');\n _this.insertTextAtCursor(text);\n }\n });\n }\n }, {\n key: \"insertTextAtCursor\",\n value: function insertTextAtCursor(text) {\n var selection = window.getSelection();\n if (!selection.rangeCount) return;\n var range = selection.getRangeAt(0);\n range.deleteContents();\n var textNode = document.createTextNode(text);\n range.insertNode(textNode);\n range.setStartAfter(textNode);\n range.setEndAfter(textNode);\n selection.removeAllRanges();\n selection.addRange(range);\n this.controller.handleInput(this.editableDiv);\n }\n }, {\n key: \"updateUI\",\n value: function updateUI() {\n var content = this.model.getValue();\n if (content) {\n this.editableDiv.innerHTML = this.renderContent(this.parseContent(content));\n } else {\n this.editableDiv.innerHTML = ZERO_WIDTH_SPACE; // Insert a zero-width space\n }\n this.editableDiv.setAttribute('data-value', content);\n }\n }, {\n key: \"renderContent\",\n value: function renderContent(contentArray) {\n var content = '';\n contentArray.forEach(function (item) {\n if (item.startsWith('{{') && item.endsWith('}}')) {\n content += \"\".concat(item, \"\");\n } else {\n content += \"\".concat(item, \"\");\n }\n });\n return content;\n }\n }, {\n key: \"parseContent\",\n value: function parseContent(inputString) {\n var returnStringArray = [];\n var regex = /{{.*?}}/g;\n var lastIndex = 0;\n inputString.replace(regex, function (match, index) {\n // Add the string before the match\n if (index > lastIndex) {\n returnStringArray.push(inputString.slice(lastIndex, index));\n }\n\n // Add the matched string including the delimiters\n returnStringArray.push(match);\n\n // Update lastIndex for the next iteration\n lastIndex = index + match.length;\n });\n\n // Add any remaining string after the last match\n if (lastIndex < inputString.length) {\n returnStringArray.push(inputString.slice(lastIndex));\n }\n return returnStringArray;\n }\n }]);\n return EditableInputView;\n}();\nvar EditableInputController = /*#__PURE__*/function () {\n function EditableInputController(model, options) {\n _classCallCheck(this, EditableInputController);\n this.model = model;\n this.view = new EditableInputView(this.model, this, options);\n }\n _createClass(EditableInputController, [{\n key: \"init\",\n value: function init(element, callback) {\n this.view.render(element);\n this.additionalCallback = callback;\n }\n }, {\n key: \"getCurrentCursor\",\n value: function getCurrentCursor(element) {\n var selection = window.getSelection();\n if (selection.rangeCount === 0) return null;\n var range = selection.getRangeAt(0);\n var preCaretRange = range.cloneRange();\n preCaretRange.selectNodeContents(element);\n preCaretRange.setEnd(range.endContainer, range.endOffset);\n var content = preCaretRange.toString().trim();\n if (content === \"\\u200B\") {\n return 0; // Return 0 if the content is only the zero-width space character\n }\n console.log(content);\n return content.replace(\"\\u200B\", '').length;\n }\n }, {\n key: \"handleInput\",\n value: function handleInput(editableDiv) {\n // Check and remove zero-width space if it's the only content\n if (editableDiv.innerHTML === '​') {\n editableDiv.innerHTML = '';\n }\n var cursor = this.getCurrentCursor(editableDiv);\n var mergedString = Array.from(editableDiv.childNodes).filter(function (node) {\n // Keep only SPAN elements and text nodes\n return node.nodeName.toUpperCase() === 'SPAN' || node.nodeType === 3;\n }).map(function (node) {\n return node.nodeType === 3 ? node.data.trim() : node.innerText.trim();\n }).join('');\n var result = mergedString.replace(/[\\u200B-\\u200D\\uFEFF]/g, '');\n var content = this.parseContent(result);\n this.model.setValue(content.join(''));\n // Optionally, update the view if needed\n this.view.updateUI();\n this.restoreCursor(editableDiv, cursor);\n }\n }, {\n key: \"restoreCursor\",\n value: function restoreCursor(element, position) {\n var selection = window.getSelection();\n var range = document.createRange();\n range.setStart(element, 0);\n range.collapse(true);\n var nodeStack = [element];\n var node,\n foundStart = false,\n stop = false;\n var charIndex = 0;\n console.log('restoreCursor', position);\n while (!stop && (node = nodeStack.pop())) {\n if (node.nodeType === 3) {\n console.log(node);\n var nextCharIndex = charIndex + node.length;\n if (!foundStart && position >= charIndex && position <= nextCharIndex) {\n range.setStart(node, position - charIndex);\n foundStart = true;\n }\n if (foundStart && position >= charIndex && position <= nextCharIndex) {\n range.setEnd(node, position - charIndex);\n stop = true;\n }\n charIndex = nextCharIndex;\n } else {\n var i = node.childNodes.length;\n while (i--) {\n nodeStack.push(node.childNodes[i]);\n }\n }\n }\n selection.removeAllRanges();\n selection.addRange(range);\n }\n }, {\n key: \"parseContent\",\n value: function parseContent(inputString) {\n var returnStringArray = [];\n var regex = /{{.*?}}/g;\n var lastIndex = 0;\n inputString.replace(regex, function (match, index) {\n // Add the string before the match\n if (index > lastIndex) {\n returnStringArray.push(inputString.slice(lastIndex, index));\n }\n\n // Add the matched string including the delimiters\n returnStringArray.push(match);\n\n // Update lastIndex for the next iteration\n lastIndex = index + match.length;\n });\n\n // Add any remaining string after the last match\n if (lastIndex < inputString.length) {\n returnStringArray.push(inputString.slice(lastIndex));\n }\n return returnStringArray;\n }\n }, {\n key: \"updateUI\",\n value: function updateUI() {\n this.view.updateUI();\n }\n }]);\n return EditableInputController;\n}();\nvar EditableInput = /*#__PURE__*/function () {\n function EditableInput() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, EditableInput);\n // Initialize the model with the value\n this.model = new EditableInputModel(options.value || '');\n this.controller = new EditableInputController(this.model, options);\n\n // Additional properties as required\n this.name = options.name || '';\n this.id = options.id || '';\n this[\"class\"] = options[\"class\"] || 'form-control';\n this.placeholder = options.placeholder || '';\n }\n _createClass(EditableInput, [{\n key: \"init\",\n value: function init(element, callback) {\n // Initialize the controller with the DOM element\n this.controller.init(element, callback);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n // Delegate to the model\n return this.model.getValue();\n }\n }, {\n key: \"setValue\",\n value: function setValue(newValue) {\n // Delegate to the model and update the view\n this.model.setValue(newValue);\n this.controller.updateUI();\n }\n\n // Any additional methods required for interaction with this component\n }]);\n return EditableInput;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EditableInput);\n\n//# sourceURL=webpack://APITestManager/./src/components/EditableInput.js?"); /***/ }), @@ -609,7 +609,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _EditableInput__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EditableInput */ \"./src/components/EditableInput.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar LayoutGridModel = /*#__PURE__*/_createClass(function LayoutGridModel(items) {\n _classCallCheck(this, LayoutGridModel);\n this.items = items;\n});\nvar LayoutGridView = /*#__PURE__*/function () {\n function LayoutGridView(model, controller) {\n _classCallCheck(this, LayoutGridView);\n this.model = model;\n this.controller = controller;\n }\n _createClass(LayoutGridView, [{\n key: \"render\",\n value: function render() {\n this.renderApiLayout();\n }\n }, {\n key: \"renderApiLayout\",\n value: function renderApiLayout() {\n var _this = this;\n var requestContainer = this.targetContent.find('.request_layout');\n requestContainer.empty();\n var headerHtml = \"\\n
- ${ item.loutItemType ==='Field'? `
`:''} + ${item.loutItemType === 'Field' ? `
` : ''}
@@ -260,27 +207,114 @@ class LayoutGridView { } class LayoutGridController { - constructor(model) { + constructor(model, view, callback) { this.model = model; - this.view = new LayoutGridView(this.model, this); + this.view = view; + this.view.controller = this; + this.callback = callback; + this.init(); } - init(targetContent, callback) { - this.additionalCallback = callback; - this.view.targetContent = targetContent; + init() { this.view.render(); } + recalculateSerno() { + // Reassign loutItemSerno sequentially based on the current order + this.model.items.forEach((item, index) => { + item.loutItemSerno = index + 1; // Assuming you want to start numbering from 1 + }); + } + + async addItem() { + let item = { + 'id': this.getLastId(), + 'parent': 0, + 'level': 1, + 'loutName': '', + 'loutItemName': '', + 'loutItemDesc': '', + 'loutItemDepth': 1, + 'loutItemType': 'Field', + 'loutItemOccCnt': '', + 'loutItemOccRef': '', + 'loutItemDataType': 'String', + 'loutItemLength': 1, + 'loutItemDecimal': 0, + 'loutItemDefault': '', + 'loutItemMaskYn': 'N', + 'loutItemMaskOffset': 0, + 'loutItemMaskLength': 0, + 'parentLoutItemIndex': 0, + 'expanded': true, + 'isLeaf': true, + 'LOUTITEMPATH': '', + 'value': '', + 'loutItemSerno': 0 + }; + this.model.items.push(item); + this.recalculateSerno(); + await this.callback(this.model); + } + + async moveUp(index) { + if (index > 0) { + const temp = this.model.items[index]; + this.model.items[index] = this.model.items[index - 1]; + this.model.items[index - 1] = temp; + this.recalculateSerno(); + await this.callback(this.model); + } + } + + async moveDown(index) { + if (index < this.model.items.length - 1) { + const temp = this.model.items[index]; + this.model.items[index] = this.model.items[index + 1]; + this.model.items[index + 1] = temp; + this.recalculateSerno(); + await this.callback(this.model); + } + } + + async setValue(name, value){ + _.set(this.model, name, value); + await this.callback(this.model); + } + + async deleteItem(index) { + this.model.items.splice(index, 1); + this.recalculateSerno(); + await this.callback(this.model); + } + + getLastId() { + let lastId = 0; + this.model.items.forEach(item => { + if (item.id > lastId) { + lastId = item.id; + } + }); + return lastId + 1; + } + + rebuild(newItems) { + this.model.setItems(newItems); + this.view.clear(); + this.init(); + } } class LayoutGrid { - constructor(layout) { + constructor(selector, layout, callback) { this.model = new LayoutGridModel(layout.layoutItems); - this.controller = new LayoutGridController(this.model); + this.view = new LayoutGridView(selector, this.model, this); + this.controller = new LayoutGridController(this.model, this.view, callback); } - init(targetContent, callback) { - this.controller.init(targetContent, callback); + rebuild(layout) { + this.controller.rebuild(layout.layoutItems); + this.controller.callback(this.model); } } diff --git a/ApiTestManager/src/components/LayoutTreeGrid.js b/ApiTestManager/src/components/LayoutTreeGrid.js index b8ff3c8..d0f3ba9 100644 --- a/ApiTestManager/src/components/LayoutTreeGrid.js +++ b/ApiTestManager/src/components/LayoutTreeGrid.js @@ -116,41 +116,8 @@ class LayoutTreeGridController { return new Array(depth + 1).join(''); } - // addRow(node, depth) { - // console.log('================================ addRow: ', node.id); - // const tr = $('
\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \";\n var footerHtml = \"\\n \\n
#IDParent\\uD56D\\uBAA9\\uBA85(\\uC601\\uBB38)\\uD56D\\uBAA9\\uC124\\uBA85\\uAE4A\\uC774\\uC544\\uC774\\uD15C \\uC720\\uD615\\uBC18\\uBCF5 \\uD69F\\uC218 \\uBC18\\uBCF5 \\uCC38\\uC870 \\uD544\\uB4DC\\uB370\\uC774\\uD130 \\uAE38\\uC774\\uAC12\\uBE44\\uACE0
\\n \";\n var fieldsHtml = this.model.items ? this.model.items.map(function (item, index) {\n return _this.renderApiLayoutItem(item, index);\n }).join('') : '';\n requestContainer.append(headerHtml + fieldsHtml + footerHtml);\n requestContainer.find('.editable').each(function (index, editableElement) {\n var editableInput = new _EditableInput__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n name: editableElement.dataset.name,\n value: editableElement.dataset.value,\n style: {\n width: '120px'\n }\n });\n editableInput.init(editableElement, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _.set(_this.model, editableElement.dataset.name, value);\n _context.next = 3;\n return _this.controller.additionalCallback(_this.model);\n case 3:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n });\n var totalLength = 0;\n this.model.items.forEach(function (item) {\n totalLength += parseInt(item.loutItemLength);\n });\n this.setupListeners();\n }\n }, {\n key: \"getFieldValue\",\n value: function getFieldValue(element) {\n if ($(element).is('select') || $(element).is('input[type=\"text\"]') || $(element).is('input[type=\"number\"]')) {\n return $(element).val();\n }\n if ($(element).is('input[type=\"checkbox\"]')) {\n return $(element).is(':checked');\n }\n }\n }, {\n key: \"recalculateSerno\",\n value: function recalculateSerno() {\n // Reassign loutItemSerno sequentially based on the current order\n this.model.items.forEach(function (item, index) {\n item.loutItemSerno = index + 1; // Assuming you want to start numbering from 1\n });\n }\n }, {\n key: \"handleUIUpdate\",\n value: function () {\n var _handleUIUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {\n var element, fieldName, newValue, totalLength;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n if (!event) {\n _context2.next = 9;\n break;\n }\n event.preventDefault();\n element = event.currentTarget;\n fieldName = $(element).attr('name');\n newValue = this.getFieldValue(element);\n if (!(fieldName !== '')) {\n _context2.next = 9;\n break;\n }\n _.set(this.model, fieldName, newValue);\n _context2.next = 9;\n return this.controller.additionalCallback(this.model);\n case 9:\n totalLength = 0;\n this.model.items.forEach(function (item) {\n totalLength += parseInt(item.loutItemLength);\n });\n case 11:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function handleUIUpdate(_x2) {\n return _handleUIUpdate.apply(this, arguments);\n }\n return handleUIUpdate;\n }()\n }, {\n key: \"getLastId\",\n value: function getLastId() {\n var lastId = 0;\n this.model.items.forEach(function (item) {\n if (item.id > lastId) {\n lastId = item.id;\n }\n });\n return lastId + 1;\n }\n }, {\n key: \"setupListeners\",\n value: function setupListeners() {\n var _this2 = this;\n var table = this.targetContent.find('.layout_table');\n table.on('change', 'select.field, input.field', this.handleUIUpdate.bind(this));\n table.on('click', '.add-layout-item', /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(event) {\n var item;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n item = {\n 'id': _this2.getLastId(),\n 'parent': 0,\n 'level': 1,\n 'loutName': '',\n 'loutItemName': '',\n 'loutItemDesc': '',\n 'loutItemDepth': 1,\n 'loutItemType': 'Field',\n 'loutItemOccCnt': '',\n 'loutItemOccRef': '',\n 'loutItemDataType': 'String',\n 'loutItemLength': 1,\n 'loutItemDecimal': 0,\n 'loutItemDefault': '',\n 'loutItemMaskYn': 'N',\n 'loutItemMaskOffset': 0,\n 'loutItemMaskLength': 0,\n 'parentLoutItemIndex': 0,\n 'expanded': true,\n 'isLeaf': true,\n 'LOUTITEMPATH': '',\n 'value': '',\n 'loutItemSerno': 0\n };\n _this2.model.items.push(item);\n _this2.recalculateSerno();\n _this2.renderApiLayout();\n _context3.next = 6;\n return _this2.controller.additionalCallback(_this2.model);\n case 6:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n }));\n return function (_x3) {\n return _ref2.apply(this, arguments);\n };\n }());\n table.on('click', '.move-up', /*#__PURE__*/function () {\n var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(event) {\n var index, temp;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n index = $(event.currentTarget).data('index');\n if (!(index > 0)) {\n _context4.next = 9;\n break;\n }\n temp = _this2.model.items[index];\n _this2.model.items[index] = _this2.model.items[index - 1];\n _this2.model.items[index - 1] = temp;\n _this2.recalculateSerno();\n _this2.renderApiLayout();\n _context4.next = 9;\n return _this2.controller.additionalCallback(_this2.model);\n case 9:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4);\n }));\n return function (_x4) {\n return _ref3.apply(this, arguments);\n };\n }());\n table.on('click', '.move-down', /*#__PURE__*/function () {\n var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(event) {\n var index, temp;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n index = $(event.currentTarget).data('index');\n if (!(index < _this2.model.items.length - 1)) {\n _context5.next = 9;\n break;\n }\n temp = _this2.model.items[index];\n _this2.model.items[index] = _this2.model.items[index + 1];\n _this2.model.items[index + 1] = temp;\n _this2.recalculateSerno();\n _this2.renderApiLayout();\n _context5.next = 9;\n return _this2.controller.additionalCallback(_this2.model);\n case 9:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5);\n }));\n return function (_x5) {\n return _ref4.apply(this, arguments);\n };\n }());\n table.on('click', '.delete', /*#__PURE__*/function () {\n var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(event) {\n var index;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n index = $(event.currentTarget).data('index');\n _this2.model.items.splice(index, 1);\n _this2.recalculateSerno();\n _this2.renderApiLayout();\n _context6.next = 6;\n return _this2.controller.additionalCallback(_this2.model);\n case 6:\n case \"end\":\n return _context6.stop();\n }\n }, _callee6);\n }));\n return function (_x6) {\n return _ref5.apply(this, arguments);\n };\n }());\n }\n }, {\n key: \"renderApiLayoutItem\",\n value: function renderApiLayoutItem(item, index) {\n if (item.value === null) {\n item.value = '';\n }\n return \"\\n \\n \\n \".concat(item.loutItemSerno, \"\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \").concat(item.loutItemType === 'Field' ? \"
\") : '', \"\\n \\n \\n
\\n \\n \\n \\n
\\n \\n \\n \");\n }\n }]);\n return LayoutGridView;\n}();\nvar LayoutGridController = /*#__PURE__*/function () {\n function LayoutGridController(model) {\n _classCallCheck(this, LayoutGridController);\n this.model = model;\n this.view = new LayoutGridView(this.model, this);\n }\n _createClass(LayoutGridController, [{\n key: \"init\",\n value: function init(targetContent, callback) {\n this.additionalCallback = callback;\n this.view.targetContent = targetContent;\n this.view.render();\n }\n }]);\n return LayoutGridController;\n}();\nvar LayoutGrid = /*#__PURE__*/function () {\n function LayoutGrid(layout) {\n _classCallCheck(this, LayoutGrid);\n this.model = new LayoutGridModel(layout.layoutItems);\n this.controller = new LayoutGridController(this.model);\n }\n _createClass(LayoutGrid, [{\n key: \"init\",\n value: function init(targetContent, callback) {\n this.controller.init(targetContent, callback);\n }\n }]);\n return LayoutGrid;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LayoutGrid);\n\n//# sourceURL=webpack://APITestManager/./src/components/LayoutGrid.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _EditableInput__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EditableInput */ \"./src/components/EditableInput.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\nvar LayoutGridModel = /*#__PURE__*/function () {\n function LayoutGridModel(items) {\n _classCallCheck(this, LayoutGridModel);\n this.items = items;\n }\n _createClass(LayoutGridModel, [{\n key: \"setItems\",\n value: function setItems(items) {\n this.items = items;\n }\n }]);\n return LayoutGridModel;\n}();\nvar LayoutGridView = /*#__PURE__*/function () {\n function LayoutGridView(selector, model, controller) {\n _classCallCheck(this, LayoutGridView);\n this.selector = selector;\n this.model = model;\n this.controller = controller;\n }\n _createClass(LayoutGridView, [{\n key: \"render\",\n value: function render() {\n this.renderApiLayout();\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.selector.children().remove();\n }\n }, {\n key: \"renderApiLayout\",\n value: function renderApiLayout() {\n var _this = this;\n var requestContainer = $(this.selector);\n requestContainer.children().remove();\n ;\n var headerHtml = \"\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \";\n var footerHtml = \"\\n \\n
#IDParent\\uD56D\\uBAA9\\uBA85(\\uC601\\uBB38)\\uD56D\\uBAA9\\uC124\\uBA85\\uAE4A\\uC774\\uC544\\uC774\\uD15C \\uC720\\uD615\\uBC18\\uBCF5 \\uD69F\\uC218 \\uBC18\\uBCF5 \\uCC38\\uC870 \\uD544\\uB4DC\\uB370\\uC774\\uD130 \\uAE38\\uC774\\uAC12\\uBE44\\uACE0
\\n \";\n var fieldsHtml = this.model.items ? this.model.items.map(function (item, index) {\n return _this.renderApiLayoutItem(item, index);\n }).join('') : '';\n requestContainer.append(headerHtml + fieldsHtml + footerHtml);\n requestContainer.find('.editable').each(function (index, editableElement) {\n var editableInput = new _EditableInput__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n name: editableElement.dataset.name,\n value: editableElement.dataset.value,\n style: {\n width: '120px'\n }\n });\n editableInput.init(editableElement, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _this.controller.setValue(editableElement.dataset.name, value);\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n });\n var totalLength = 0;\n this.model.items.forEach(function (item) {\n totalLength += parseInt(item.loutItemLength);\n });\n this.setupListeners();\n }\n }, {\n key: \"getFieldValue\",\n value: function getFieldValue(element) {\n if ($(element).is('select') || $(element).is('input[type=\"text\"]') || $(element).is('input[type=\"number\"]')) {\n return $(element).val();\n }\n if ($(element).is('input[type=\"checkbox\"]')) {\n return $(element).is(':checked');\n }\n }\n }, {\n key: \"handleUIUpdate\",\n value: function () {\n var _handleUIUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {\n var element, fieldName, newValue, totalLength;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n if (event) {\n event.preventDefault();\n element = event.currentTarget;\n fieldName = $(element).attr('name');\n newValue = this.getFieldValue(element);\n if (fieldName !== '') {\n this.controller.setValue(fieldName, newValue);\n }\n }\n totalLength = 0;\n this.model.items.forEach(function (item) {\n totalLength += parseInt(item.loutItemLength);\n });\n case 3:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function handleUIUpdate(_x2) {\n return _handleUIUpdate.apply(this, arguments);\n }\n return handleUIUpdate;\n }()\n }, {\n key: \"setupListeners\",\n value: function setupListeners() {\n var _this2 = this;\n var table = this.selector.find('.layout_table');\n table.on('change', 'select.field, input.field', this.handleUIUpdate.bind(this));\n table.on('click', '.add-layout-item', /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(event) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return _this2.controller.addItem();\n case 2:\n _this2.renderApiLayout();\n case 3:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n }));\n return function (_x3) {\n return _ref2.apply(this, arguments);\n };\n }());\n table.on('click', '.move-up', /*#__PURE__*/function () {\n var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(event) {\n var index;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n index = $(event.currentTarget).data('index');\n _context4.next = 3;\n return _this2.controller.moveUp(index);\n case 3:\n _this2.renderApiLayout();\n case 4:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4);\n }));\n return function (_x4) {\n return _ref3.apply(this, arguments);\n };\n }());\n table.on('click', '.move-down', /*#__PURE__*/function () {\n var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(event) {\n var index;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n index = $(event.currentTarget).data('index');\n _context5.next = 3;\n return _this2.controller.moveDown(index);\n case 3:\n _this2.renderApiLayout();\n case 4:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5);\n }));\n return function (_x5) {\n return _ref4.apply(this, arguments);\n };\n }());\n table.on('click', '.delete', /*#__PURE__*/function () {\n var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(event) {\n var index;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n index = $(event.currentTarget).data('index');\n _context6.next = 3;\n return _this2.controller.deleteItem(index);\n case 3:\n _this2.renderApiLayout();\n case 4:\n case \"end\":\n return _context6.stop();\n }\n }, _callee6);\n }));\n return function (_x6) {\n return _ref5.apply(this, arguments);\n };\n }());\n }\n }, {\n key: \"renderApiLayoutItem\",\n value: function renderApiLayoutItem(item, index) {\n if (item.value === null) {\n item.value = '';\n }\n return \"\\n \\n \\n \".concat(item.loutItemSerno, \"\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \").concat(item.loutItemType === 'Field' ? \"
\") : '', \"\\n \\n \\n
\\n \\n \\n \\n
\\n \\n \\n \");\n }\n }]);\n return LayoutGridView;\n}();\nvar LayoutGridController = /*#__PURE__*/function () {\n function LayoutGridController(model, view, callback) {\n _classCallCheck(this, LayoutGridController);\n this.model = model;\n this.view = view;\n this.view.controller = this;\n this.callback = callback;\n this.init();\n }\n _createClass(LayoutGridController, [{\n key: \"init\",\n value: function init() {\n this.view.render();\n }\n }, {\n key: \"recalculateSerno\",\n value: function recalculateSerno() {\n // Reassign loutItemSerno sequentially based on the current order\n this.model.items.forEach(function (item, index) {\n item.loutItemSerno = index + 1; // Assuming you want to start numbering from 1\n });\n }\n }, {\n key: \"addItem\",\n value: function () {\n var _addItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n var item;\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) switch (_context7.prev = _context7.next) {\n case 0:\n item = {\n 'id': this.getLastId(),\n 'parent': 0,\n 'level': 1,\n 'loutName': '',\n 'loutItemName': '',\n 'loutItemDesc': '',\n 'loutItemDepth': 1,\n 'loutItemType': 'Field',\n 'loutItemOccCnt': '',\n 'loutItemOccRef': '',\n 'loutItemDataType': 'String',\n 'loutItemLength': 1,\n 'loutItemDecimal': 0,\n 'loutItemDefault': '',\n 'loutItemMaskYn': 'N',\n 'loutItemMaskOffset': 0,\n 'loutItemMaskLength': 0,\n 'parentLoutItemIndex': 0,\n 'expanded': true,\n 'isLeaf': true,\n 'LOUTITEMPATH': '',\n 'value': '',\n 'loutItemSerno': 0\n };\n this.model.items.push(item);\n this.recalculateSerno();\n _context7.next = 5;\n return this.callback(this.model);\n case 5:\n case \"end\":\n return _context7.stop();\n }\n }, _callee7, this);\n }));\n function addItem() {\n return _addItem.apply(this, arguments);\n }\n return addItem;\n }()\n }, {\n key: \"moveUp\",\n value: function () {\n var _moveUp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(index) {\n var temp;\n return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n while (1) switch (_context8.prev = _context8.next) {\n case 0:\n if (!(index > 0)) {\n _context8.next = 7;\n break;\n }\n temp = this.model.items[index];\n this.model.items[index] = this.model.items[index - 1];\n this.model.items[index - 1] = temp;\n this.recalculateSerno();\n _context8.next = 7;\n return this.callback(this.model);\n case 7:\n case \"end\":\n return _context8.stop();\n }\n }, _callee8, this);\n }));\n function moveUp(_x7) {\n return _moveUp.apply(this, arguments);\n }\n return moveUp;\n }()\n }, {\n key: \"moveDown\",\n value: function () {\n var _moveDown = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(index) {\n var temp;\n return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n while (1) switch (_context9.prev = _context9.next) {\n case 0:\n if (!(index < this.model.items.length - 1)) {\n _context9.next = 7;\n break;\n }\n temp = this.model.items[index];\n this.model.items[index] = this.model.items[index + 1];\n this.model.items[index + 1] = temp;\n this.recalculateSerno();\n _context9.next = 7;\n return this.callback(this.model);\n case 7:\n case \"end\":\n return _context9.stop();\n }\n }, _callee9, this);\n }));\n function moveDown(_x8) {\n return _moveDown.apply(this, arguments);\n }\n return moveDown;\n }()\n }, {\n key: \"setValue\",\n value: function () {\n var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(name, value) {\n return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n while (1) switch (_context10.prev = _context10.next) {\n case 0:\n _.set(this.model, name, value);\n _context10.next = 3;\n return this.callback(this.model);\n case 3:\n case \"end\":\n return _context10.stop();\n }\n }, _callee10, this);\n }));\n function setValue(_x9, _x10) {\n return _setValue.apply(this, arguments);\n }\n return setValue;\n }()\n }, {\n key: \"deleteItem\",\n value: function () {\n var _deleteItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(index) {\n return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n while (1) switch (_context11.prev = _context11.next) {\n case 0:\n this.model.items.splice(index, 1);\n this.recalculateSerno();\n _context11.next = 4;\n return this.callback(this.model);\n case 4:\n case \"end\":\n return _context11.stop();\n }\n }, _callee11, this);\n }));\n function deleteItem(_x11) {\n return _deleteItem.apply(this, arguments);\n }\n return deleteItem;\n }()\n }, {\n key: \"getLastId\",\n value: function getLastId() {\n var lastId = 0;\n this.model.items.forEach(function (item) {\n if (item.id > lastId) {\n lastId = item.id;\n }\n });\n return lastId + 1;\n }\n }, {\n key: \"rebuild\",\n value: function rebuild(newItems) {\n this.model.setItems(newItems);\n this.view.clear();\n this.init();\n }\n }]);\n return LayoutGridController;\n}();\nvar LayoutGrid = /*#__PURE__*/function () {\n function LayoutGrid(selector, layout, callback) {\n _classCallCheck(this, LayoutGrid);\n this.model = new LayoutGridModel(layout.layoutItems);\n this.view = new LayoutGridView(selector, this.model, this);\n this.controller = new LayoutGridController(this.model, this.view, callback);\n }\n _createClass(LayoutGrid, [{\n key: \"rebuild\",\n value: function rebuild(layout) {\n this.controller.rebuild(layout.layoutItems);\n this.controller.callback(this.model);\n }\n }]);\n return LayoutGrid;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LayoutGrid);\n\n//# sourceURL=webpack://APITestManager/./src/components/LayoutGrid.js?"); /***/ }), @@ -631,7 +631,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _EditableInput__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EditableInput */ \"./src/components/EditableInput.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\nvar LayoutTreeGridModel = /*#__PURE__*/function () {\n function LayoutTreeGridModel(root) {\n _classCallCheck(this, LayoutTreeGridModel);\n this.root = root;\n this.rootId = root.id;\n }\n _createClass(LayoutTreeGridModel, [{\n key: \"setRoot\",\n value: function setRoot(newRoot) {\n this.root = newRoot;\n }\n }, {\n key: \"getNodePath\",\n value: function getNodePath(node, targetId) {\n var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n // Check if the current node is the target node\n if (node.id === targetId) {\n return path;\n }\n\n // If the current node has children, iterate over them\n if (node.children) {\n for (var i = 0; i < node.children.length; i++) {\n // Construct the path to the current child\n var currentPath = path ? \"\".concat(path, \".children[\").concat(i, \"]\") : \"children[\".concat(i, \"]\");\n\n // Recursively call findPath on the child\n var resultPath = this.getNodePath(node.children[i], targetId, currentPath);\n\n // If resultPath is not null, the target has been found in the subtree\n if (resultPath) {\n return resultPath;\n }\n }\n }\n\n // Return null if the target is not found in this subtree\n return null;\n }\n }]);\n return LayoutTreeGridModel;\n}();\nvar LayoutTreeGridView = /*#__PURE__*/function () {\n function LayoutTreeGridView(selector) {\n _classCallCheck(this, LayoutTreeGridView);\n this.selector = selector;\n this.table = $('').appendTo($(this.selector));\n this.table.addClass('layout_table');\n this.table.css({\n 'width': 'inherit',\n 'border-collapse': 'collapse',\n 'border': '1px gray solid'\n });\n this.init();\n }\n _createClass(LayoutTreeGridView, [{\n key: \"init\",\n value: function init() {\n this.table.children().remove();\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.init();\n }\n }, {\n key: \"addHeaders\",\n value: function addHeaders(fields) {\n var thead = $('').appendTo(this.table);\n var tr = $('').appendTo(thead);\n tr.addClass('layout-grid-row');\n fields.forEach(function (field) {\n var th = $('').addClass('treegrid-' + node.id).data('nodeId', node.id); // Storing node ID for easy access later\n //\n // if (depth === 0) {\n // tr.css({'display': 'none'});\n // }\n //\n // if (node.parent || (node.parent !== null && parseInt(node.parent) !== this.model.rootId)) {\n // // if (node.parent !== undefined && node.parent !== null) {\n // const parentSelector = `.treegrid-${node.parent}`;\n // const lastChildSelector = `.treegrid-parent-${node.parent}`;\n // // console.log('lastChild:', $(this.view.table).find(lastChildSelector), 'length: ', $(this.view.table).find(lastChildSelector).length);\n //\n // if ($(this.view.table).find(lastChildSelector).length > 0) {\n // const lastChild = $(this.view.table).find(lastChildSelector).last();\n // tr.insertAfter(lastChild);\n // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterLastChild: ', lastChild);\n // } else {\n // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterParent: ', parentSelector);\n // tr.insertAfter($(this.view.table).find(parentSelector));\n // // tr.appendTo(this.view.table);\n // }\n // tr.addClass('treegrid-parent-' + node.parent);\n // } else {\n // tr.appendTo(this.view.table);\n // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'no parent');\n // }\n //\n // console.log('================================ row Added');\n // return tr;\n // }\n }, {\n key: \"addRow\",\n value: function addRow(node, depth) {\n console.log('================================ addRow: ', node.id);\n var tr = $('').addClass('treegrid-' + node.id).data('nodeId', node.id);\n if (depth === 0) {\n tr.css({\n 'display': 'none'\n });\n }\n if (node.parent !== undefined && node.parent !== null && parseInt(node.parent) !== this.model.rootId) {\n var parentSelector = \".treegrid-\".concat(node.parent);\n var lastChildSelector = \".treegrid-parent-\".concat(node.parent);\n if ($(this.view.table).find(lastChildSelector).length > 0) {\n var lastChild = $(this.view.table).find(lastChildSelector).last();\n tr.insertAfter(lastChild);\n console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterLastChild: ', lastChild);\n } else {\n console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterParent: ', parentSelector);\n tr.insertAfter($(this.view.table).find(parentSelector));\n }\n tr.addClass('treegrid-parent-' + node.parent);\n } else {\n tr.appendTo(this.view.table);\n console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'no parent');\n }\n console.log('================================ row Added');\n return tr;\n }\n }, {\n key: \"addCell\",\n value: function addCell(row, node, fieldInfo, depth) {\n var td = $('
').html(field.label).appendTo(tr);\n th.css({\n 'width': field.width + 'px',\n 'border': '1px gray solid',\n 'text-align': 'center'\n });\n });\n }\n }, {\n key: \"toggleChildrenVisibility\",\n value: function toggleChildrenVisibility(nodeId, isExpanded) {\n var _this = this;\n var selector = \".treegrid-parent-\".concat(nodeId);\n $(selector).each(function (_, el) {\n $(el).toggle(!isExpanded);\n if (isExpanded) {\n // If we are hiding the children\n var childNodeId = $(el).data('nodeId'); // Assume data-nodeId is set when rows are created\n _this.toggleChildrenVisibility(childNodeId, true); // Recursively hide all descendants\n var expander = $(\".treegrid-\".concat(nodeId, \" .treegrid-expander\"));\n expander.html(isExpanded ? '+' : '-');\n }\n });\n }\n }, {\n key: \"setupExpander\",\n value: function setupExpander(cell, callback) {\n var expander = $('').addClass('treegrid-expander').html('-').appendTo(cell);\n expander.click(callback);\n }\n }]);\n return LayoutTreeGridView;\n}();\nvar LayoutTreeGridController = /*#__PURE__*/function () {\n function LayoutTreeGridController(model, view, options, callback) {\n _classCallCheck(this, LayoutTreeGridController);\n this.model = model;\n this.view = view;\n this.options = options;\n this.callback = callback;\n this.init();\n }\n _createClass(LayoutTreeGridController, [{\n key: \"init\",\n value: function init() {\n var _this2 = this;\n this.view.init();\n this.view.addHeaders(this.options);\n this.processNode(this.model.root, 0);\n this.view.table.find('.editable').each(function (index, editableElement) {\n var editableInput = new _EditableInput__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n name: editableElement.dataset.name,\n value: editableElement.dataset.value,\n path: editableElement.dataset.path\n });\n editableInput.init(editableElement, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _.set(_this2.model.root, editableElement.dataset.path, value);\n _this2.callback(_this2.model.root);\n case 2:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n });\n }\n }, {\n key: \"getIndent\",\n value: function getIndent(depth) {\n return new Array(depth + 1).join('');\n }\n\n // addRow(node, depth) {\n // console.log('================================ addRow: ', node.id);\n // const tr = $('
').appendTo(row);\n var padding = fieldInfo.isFirst ? this.getIndent(depth) : '';\n var nodePath = this.model.getNodePath(this.model.root, node.id) + '.value';\n if (node.loutItemType === 'Field' && fieldInfo.type === 'textfield') {\n var div = $('
');\n div.addClass('editable');\n div.appendTo(td);\n div.attr('data-name', fieldInfo.name);\n div.attr('data-value', node[fieldInfo.name]);\n div.attr('data-path', nodePath);\n } else {\n td.html(padding); // Default to just displaying the content\n }\n if (fieldInfo.width) {\n td.css({\n 'width': fieldInfo.width + 'px',\n 'border': '1px gray solid'\n });\n }\n if (fieldInfo.align) {\n td.css({\n 'text-align': fieldInfo.align\n });\n }\n return td;\n }\n }, {\n key: \"processNode\",\n value: function processNode(node, depth) {\n var _this3 = this;\n // console.log('node: ', node.id);\n var tr = this.addRow(node, depth);\n this.options.forEach(function (fieldInfo) {\n var content = node[fieldInfo.name];\n var td = _this3.addCell(tr, node, fieldInfo, depth);\n if (fieldInfo.isFirst) {\n if (node.children && node.children.length > 0) {\n _this3.view.setupExpander($(tr.children()[0]), function () {\n return _this3.handleExpanderClick(node.id);\n });\n }\n }\n if (fieldInfo.type !== 'textfield') {\n td.append(content);\n }\n });\n\n // Recursively process each child node if any\n if (node.children && node.children.length > 0) {\n node.children.forEach(function (child) {\n _this3.processNode(child, depth + 1); // Increment depth for each child\n });\n }\n }\n }, {\n key: \"handleExpanderClick\",\n value: function handleExpanderClick(nodeId) {\n var expander = $(\".treegrid-\".concat(nodeId, \" .treegrid-expander\"));\n var isExpanded = expander.html() === '-';\n expander.html(isExpanded ? '+' : '-');\n this.view.toggleChildrenVisibility(nodeId, isExpanded);\n }\n }, {\n key: \"rebuild\",\n value: function rebuild(newRoot) {\n this.model.setRoot(newRoot);\n this.view.clear();\n this.init();\n }\n }]);\n return LayoutTreeGridController;\n}();\nvar LayoutTreeGrid = /*#__PURE__*/function () {\n function LayoutTreeGrid(selector, root, options, callback) {\n _classCallCheck(this, LayoutTreeGrid);\n this.model = new LayoutTreeGridModel(root);\n this.view = new LayoutTreeGridView(selector);\n this.controller = new LayoutTreeGridController(this.model, this.view, options, callback);\n }\n _createClass(LayoutTreeGrid, [{\n key: \"rebuild\",\n value: function rebuild(root, callback) {\n this.controller.rebuild(root);\n callback(root);\n }\n }]);\n return LayoutTreeGrid;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LayoutTreeGrid);\n\n//# sourceURL=webpack://APITestManager/./src/components/LayoutTreeGrid.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _EditableInput__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EditableInput */ \"./src/components/EditableInput.js\");\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\nvar LayoutTreeGridModel = /*#__PURE__*/function () {\n function LayoutTreeGridModel(root) {\n _classCallCheck(this, LayoutTreeGridModel);\n this.root = root;\n this.rootId = root.id;\n }\n _createClass(LayoutTreeGridModel, [{\n key: \"setRoot\",\n value: function setRoot(newRoot) {\n this.root = newRoot;\n }\n }, {\n key: \"getNodePath\",\n value: function getNodePath(node, targetId) {\n var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n // Check if the current node is the target node\n if (node.id === targetId) {\n return path;\n }\n\n // If the current node has children, iterate over them\n if (node.children) {\n for (var i = 0; i < node.children.length; i++) {\n // Construct the path to the current child\n var currentPath = path ? \"\".concat(path, \".children[\").concat(i, \"]\") : \"children[\".concat(i, \"]\");\n\n // Recursively call findPath on the child\n var resultPath = this.getNodePath(node.children[i], targetId, currentPath);\n\n // If resultPath is not null, the target has been found in the subtree\n if (resultPath) {\n return resultPath;\n }\n }\n }\n\n // Return null if the target is not found in this subtree\n return null;\n }\n }]);\n return LayoutTreeGridModel;\n}();\nvar LayoutTreeGridView = /*#__PURE__*/function () {\n function LayoutTreeGridView(selector) {\n _classCallCheck(this, LayoutTreeGridView);\n this.selector = selector;\n this.table = $('').appendTo($(this.selector));\n this.table.addClass('layout_table');\n this.table.css({\n 'width': 'inherit',\n 'border-collapse': 'collapse',\n 'border': '1px gray solid'\n });\n this.init();\n }\n _createClass(LayoutTreeGridView, [{\n key: \"init\",\n value: function init() {\n this.table.children().remove();\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.init();\n }\n }, {\n key: \"addHeaders\",\n value: function addHeaders(fields) {\n var thead = $('').appendTo(this.table);\n var tr = $('').appendTo(thead);\n tr.addClass('layout-grid-row');\n fields.forEach(function (field) {\n var th = $('').addClass('treegrid-' + node.id).data('nodeId', node.id);\n if (depth === 0) {\n tr.css({\n 'display': 'none'\n });\n }\n if (node.parent !== undefined && node.parent !== null && parseInt(node.parent) !== this.model.rootId) {\n var parentSelector = \".treegrid-\".concat(node.parent);\n var lastChildSelector = \".treegrid-parent-\".concat(node.parent);\n if ($(this.view.table).find(lastChildSelector).length > 0) {\n var lastChild = $(this.view.table).find(lastChildSelector).last();\n tr.insertAfter(lastChild);\n // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterLastChild: ', lastChild);\n } else {\n // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterParent: ', parentSelector);\n tr.insertAfter($(this.view.table).find(parentSelector));\n }\n tr.addClass('treegrid-parent-' + node.parent);\n } else {\n tr.appendTo(this.view.table);\n // console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'no parent');\n }\n\n // console.log('================================ row Added');\n return tr;\n }\n }, {\n key: \"addCell\",\n value: function addCell(row, node, fieldInfo, depth) {\n var td = $('
').html(field.label).appendTo(tr);\n th.css({\n 'width': field.width + 'px',\n 'border': '1px gray solid',\n 'text-align': 'center'\n });\n });\n }\n }, {\n key: \"toggleChildrenVisibility\",\n value: function toggleChildrenVisibility(nodeId, isExpanded) {\n var _this = this;\n var selector = \".treegrid-parent-\".concat(nodeId);\n $(selector).each(function (_, el) {\n $(el).toggle(!isExpanded);\n if (isExpanded) {\n // If we are hiding the children\n var childNodeId = $(el).data('nodeId'); // Assume data-nodeId is set when rows are created\n _this.toggleChildrenVisibility(childNodeId, true); // Recursively hide all descendants\n var expander = $(\".treegrid-\".concat(nodeId, \" .treegrid-expander\"));\n expander.html(isExpanded ? '+' : '-');\n }\n });\n }\n }, {\n key: \"setupExpander\",\n value: function setupExpander(cell, callback) {\n var expander = $('').addClass('treegrid-expander').html('-').appendTo(cell);\n expander.click(callback);\n }\n }]);\n return LayoutTreeGridView;\n}();\nvar LayoutTreeGridController = /*#__PURE__*/function () {\n function LayoutTreeGridController(model, view, options, callback) {\n _classCallCheck(this, LayoutTreeGridController);\n this.model = model;\n this.view = view;\n this.options = options;\n this.callback = callback;\n this.init();\n }\n _createClass(LayoutTreeGridController, [{\n key: \"init\",\n value: function init() {\n var _this2 = this;\n this.view.init();\n this.view.addHeaders(this.options);\n this.processNode(this.model.root, 0);\n this.view.table.find('.editable').each(function (index, editableElement) {\n var editableInput = new _EditableInput__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n name: editableElement.dataset.name,\n value: editableElement.dataset.value,\n path: editableElement.dataset.path\n });\n editableInput.init(editableElement, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _.set(_this2.model.root, editableElement.dataset.path, value);\n _this2.callback(_this2.model.root);\n case 2:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n });\n }\n }, {\n key: \"getIndent\",\n value: function getIndent(depth) {\n return new Array(depth + 1).join('');\n }\n }, {\n key: \"addRow\",\n value: function addRow(node, depth) {\n // console.log('================================ addRow: ', node.id);\n var tr = $('
').appendTo(row);\n var padding = fieldInfo.isFirst ? this.getIndent(depth) : '';\n var nodePath = this.model.getNodePath(this.model.root, node.id) + '.value';\n if (node.loutItemType === 'Field' && fieldInfo.type === 'textfield') {\n var div = $('
');\n div.addClass('editable');\n div.appendTo(td);\n div.attr('data-name', fieldInfo.name);\n div.attr('data-value', node[fieldInfo.name]);\n div.attr('data-path', nodePath);\n } else {\n td.html(padding); // Default to just displaying the content\n }\n if (fieldInfo.width) {\n td.css({\n 'width': fieldInfo.width + 'px',\n 'border': '1px gray solid'\n });\n }\n if (fieldInfo.align) {\n td.css({\n 'text-align': fieldInfo.align\n });\n }\n return td;\n }\n }, {\n key: \"processNode\",\n value: function processNode(node, depth) {\n var _this3 = this;\n // console.log('node: ', node.id);\n var tr = this.addRow(node, depth);\n this.options.forEach(function (fieldInfo) {\n var content = node[fieldInfo.name];\n var td = _this3.addCell(tr, node, fieldInfo, depth);\n if (fieldInfo.isFirst) {\n if (node.children && node.children.length > 0) {\n _this3.view.setupExpander($(tr.children()[0]), function () {\n return _this3.handleExpanderClick(node.id);\n });\n }\n }\n if (fieldInfo.type !== 'textfield') {\n td.append(content);\n }\n });\n\n // Recursively process each child node if any\n if (node.children && node.children.length > 0) {\n node.children.forEach(function (child) {\n _this3.processNode(child, depth + 1); // Increment depth for each child\n });\n }\n }\n }, {\n key: \"handleExpanderClick\",\n value: function handleExpanderClick(nodeId) {\n var expander = $(\".treegrid-\".concat(nodeId, \" .treegrid-expander\"));\n var isExpanded = expander.html() === '-';\n expander.html(isExpanded ? '+' : '-');\n this.view.toggleChildrenVisibility(nodeId, isExpanded);\n }\n }, {\n key: \"rebuild\",\n value: function rebuild(newRoot) {\n this.model.setRoot(newRoot);\n this.view.clear();\n this.init();\n }\n }]);\n return LayoutTreeGridController;\n}();\nvar LayoutTreeGrid = /*#__PURE__*/function () {\n function LayoutTreeGrid(selector, root, options, callback) {\n _classCallCheck(this, LayoutTreeGrid);\n this.model = new LayoutTreeGridModel(root);\n this.view = new LayoutTreeGridView(selector);\n this.controller = new LayoutTreeGridController(this.model, this.view, options, callback);\n }\n _createClass(LayoutTreeGrid, [{\n key: \"rebuild\",\n value: function rebuild(root, callback) {\n this.controller.rebuild(root);\n callback(root);\n }\n }]);\n return LayoutTreeGrid;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LayoutTreeGrid);\n\n//# sourceURL=webpack://APITestManager/./src/components/LayoutTreeGrid.js?"); /***/ }), @@ -708,7 +708,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _LayoutGrid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LayoutGrid */ \"./src/components/LayoutGrid.js\");\n/* harmony import */ var _LayoutTreeGrid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LayoutTreeGrid */ \"./src/components/LayoutTreeGrid.js\");\n/* harmony import */ var _LayoutTreeDataGrid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LayoutTreeDataGrid */ \"./src/components/LayoutTreeDataGrid.js\");\n/* harmony import */ var monaco_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! monaco-editor */ \"include-loader!./node_modules/monaco-editor/esm/vs/editor/editor.main.js\");\n/* harmony import */ var _ApiLayoutItemTreeBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ApiLayoutItemTreeBuilder */ \"./src/components/ApiLayoutItemTreeBuilder.js\");\n/* harmony import */ var _ApiLayoutItemTreeDataBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ApiLayoutItemTreeDataBuilder */ \"./src/components/ApiLayoutItemTreeDataBuilder.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\n\n\nvar TCPClientView = /*#__PURE__*/function () {\n function TCPClientView(parent, serverManager, apiRequestTabContent, model, index) {\n _classCallCheck(this, TCPClientView);\n this.parent = parent;\n this.serverManager = serverManager;\n this.apiRequestTabContent = apiRequestTabContent;\n this.model = model;\n this.index = index;\n this.server = this.serverManager.getServer(this.model.server);\n }\n _createClass(TCPClientView, [{\n key: \"init\",\n value: function init() {\n var _this = this;\n console.log('TCPClientView init');\n this.apiRequestTabContent.append(this.tcpApiRequestTemplate(this.model, this.index));\n if (this.server && this.server.headers === undefined) {\n this.server.headers = [];\n }\n if (this.server) {\n this.serverManager.renderTcpServerOptions('.server_options', this.server.serverOptions, this.model.headers, this.parent);\n }\n var layoutJson = JSON.stringify(this.model.layout, null, 2);\n this.layoutJsonEditor = monaco_editor__WEBPACK_IMPORTED_MODULE_3__.editor.create(this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.layout-json')[0], {\n value: layoutJson,\n language: 'json',\n automaticLayout: true,\n quickSuggestions: false\n });\n var layoutDataTreeOptions = [{\n name: 'loutItemSerno',\n width: 100,\n isFirst: true,\n label: '#'\n }, {\n name: 'loutItemName',\n width: 100,\n align: 'center',\n label: '항목명(영문)'\n }, {\n name: 'loutItemDesc',\n width: 100,\n align: 'center',\n label: '항목설명'\n }, {\n name: 'loutItemDepth',\n width: 60,\n align: 'center',\n label: '깊이'\n }, {\n name: 'loutItemType',\n width: 100,\n align: 'center',\n label: '아이템 유형'\n }, {\n name: 'loutItemOccCnt',\n width: 100,\n align: 'center',\n label: '반복 횟수'\n }, {\n name: 'loutItemOccRef',\n width: 120,\n align: 'center',\n label: '반복 참조 필드'\n }, {\n name: 'loutItemLength',\n width: 100,\n align: 'center',\n label: '데이터 길이'\n }, {\n name: 'value',\n width: 200,\n align: 'left',\n label: '값',\n type: 'textfield'\n }];\n var layoutRoot = _ApiLayoutItemTreeBuilder__WEBPACK_IMPORTED_MODULE_4__[\"default\"].createTree(this.model.layout.layoutItems);\n var replicator = new _ApiLayoutItemTreeDataBuilder__WEBPACK_IMPORTED_MODULE_5__[\"default\"](10000);\n var layoutDataRoot = replicator.createReplicatedTree(layoutRoot);\n console.log(this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.request_layout_data_tree'));\n console.log(this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.request_layout_tree'));\n console.log(this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.total_message_length'));\n var layoutTreeDataGrid = new _LayoutTreeDataGrid__WEBPACK_IMPORTED_MODULE_2__[\"default\"](this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.request_layout_data_tree'), layoutDataRoot, this.model, layoutDataTreeOptions, this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.total_message_length'));\n layoutTreeDataGrid.init( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(finalMessage) {\n var prefix;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return _this.serverManager.renderServerPrefix(_this.server.serverOptions, _this.model);\n case 2:\n prefix = _context.sent;\n _this.requestBodyEditor.setValue(prefix + finalMessage);\n case 4:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n var layoutTreeGrid = new _LayoutTreeGrid__WEBPACK_IMPORTED_MODULE_1__[\"default\"](this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.request_layout_tree'), layoutRoot, layoutDataTreeOptions, function (root) {\n var replicator = new _ApiLayoutItemTreeDataBuilder__WEBPACK_IMPORTED_MODULE_5__[\"default\"](10000);\n var layoutDataRoot = replicator.createReplicatedTree(root);\n layoutTreeDataGrid.rebuild(layoutDataRoot);\n });\n var layoutGrid = new _LayoutGrid__WEBPACK_IMPORTED_MODULE_0__[\"default\"](this.model.layout);\n layoutGrid.init(this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)), function (model) {\n model.items.forEach(function (item) {\n item.children = [];\n });\n var updatedRoot = _ApiLayoutItemTreeBuilder__WEBPACK_IMPORTED_MODULE_4__[\"default\"].createTree(model.items);\n layoutTreeGrid.rebuild(updatedRoot, function (root) {\n var replicator = new _ApiLayoutItemTreeDataBuilder__WEBPACK_IMPORTED_MODULE_5__[\"default\"](10000);\n var layoutDataRoot = replicator.createReplicatedTree(root);\n layoutTreeDataGrid.rebuild(layoutDataRoot);\n });\n $('span.variable').off('mouseover');\n $('span.variable').off('mouseout');\n document.querySelectorAll('span.variable').forEach(function (element) {\n var text = element.innerText;\n element.addEventListener('mouseover', function () {\n return _this.parent.showPopper(element, text);\n });\n element.addEventListener('mouseout', function () {\n return _this.parent.hidePopper(element);\n });\n });\n });\n window.addEventListener('resize', this.resizeEditor.bind(this));\n }\n }, {\n key: \"resizeEditor\",\n value: function resizeEditor() {\n this.requestBodyEditor.layout({\n width: 0\n });\n this.requestBodyEditor.layout({});\n this.layoutJsonEditor.layout({\n width: 0\n });\n this.layoutJsonEditor.layout({});\n }\n }, {\n key: \"tcpApiRequestTemplate\",\n value: function tcpApiRequestTemplate(apiRequest, index) {\n console.log('tcpApiRequestTemplate');\n return \"\\n
\\n
\").concat(apiRequest.collectionName, \" > \").concat(apiRequest.name, \"
\\n
\\n
\\n \").concat(this.serverManager.renderTcpServers(apiRequest.server), \"\\n \\n
\\n \\n \\n
\\n
\\n
\\n
\\n
\\n
    \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\uC804\\uCCB4 \\uBA54\\uC2DC\\uC9C0 \\uAE38\\uC774: \\n \\n
\\n
\\n
\\n
\\n
\\n Response\\n \\n \\n
\\n
    \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n \");\n }\n }]);\n return TCPClientView;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TCPClientView);\n\n//# sourceURL=webpack://APITestManager/./src/components/TCPClientView.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _LayoutGrid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LayoutGrid */ \"./src/components/LayoutGrid.js\");\n/* harmony import */ var _LayoutTreeGrid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LayoutTreeGrid */ \"./src/components/LayoutTreeGrid.js\");\n/* harmony import */ var _LayoutTreeDataGrid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LayoutTreeDataGrid */ \"./src/components/LayoutTreeDataGrid.js\");\n/* harmony import */ var monaco_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! monaco-editor */ \"include-loader!./node_modules/monaco-editor/esm/vs/editor/editor.main.js\");\n/* harmony import */ var _ApiLayoutItemTreeBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ApiLayoutItemTreeBuilder */ \"./src/components/ApiLayoutItemTreeBuilder.js\");\n/* harmony import */ var _ApiLayoutItemTreeDataBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ApiLayoutItemTreeDataBuilder */ \"./src/components/ApiLayoutItemTreeDataBuilder.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\n\n\nvar TCPClientView = /*#__PURE__*/function () {\n function TCPClientView(parent, serverManager, apiRequestTabContent, model, index) {\n _classCallCheck(this, TCPClientView);\n this.parent = parent;\n this.serverManager = serverManager;\n this.apiRequestTabContent = apiRequestTabContent;\n this.model = model;\n this.index = index;\n this.server = this.serverManager.getServer(this.model.server);\n }\n _createClass(TCPClientView, [{\n key: \"init\",\n value: function init() {\n var _this = this;\n console.log('TCPClientView init');\n this.apiRequestTabContent.append(this.tcpApiRequestTemplate(this.model, this.index));\n if (this.server && this.server.headers === undefined) {\n this.server.headers = [];\n }\n if (this.server) {\n this.serverManager.renderTcpServerOptions('.server_options', this.server.serverOptions, this.model.headers, this.parent);\n }\n var layoutJson = JSON.stringify(this.model.layout, null, 2);\n this.layoutJsonEditor = monaco_editor__WEBPACK_IMPORTED_MODULE_3__.editor.create(this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.layout-json')[0], {\n value: layoutJson,\n language: 'json',\n automaticLayout: true,\n quickSuggestions: false\n });\n var layoutDataTreeOptions = [{\n name: 'loutItemSerno',\n width: 100,\n isFirst: true,\n label: '#'\n }, {\n name: 'loutItemName',\n width: 100,\n align: 'left',\n label: '항목명(영문)'\n }, {\n name: 'loutItemDesc',\n width: 100,\n align: 'left',\n label: '항목설명'\n }, {\n name: 'loutItemDepth',\n width: 60,\n align: 'center',\n label: '깊이'\n }, {\n name: 'loutItemType',\n width: 100,\n align: 'center',\n label: '아이템 유형'\n }, {\n name: 'loutItemOccCnt',\n width: 100,\n align: 'center',\n label: '반복 횟수'\n }, {\n name: 'loutItemOccRef',\n width: 120,\n align: 'center',\n label: '반복 참조 필드'\n }, {\n name: 'loutItemLength',\n width: 100,\n align: 'center',\n label: '데이터 길이'\n }, {\n name: 'value',\n width: 200,\n align: 'left',\n label: '값',\n type: 'textfield'\n }];\n var layoutRoot = _ApiLayoutItemTreeBuilder__WEBPACK_IMPORTED_MODULE_4__[\"default\"].createTree(this.model.layout.layoutItems);\n var replicator = new _ApiLayoutItemTreeDataBuilder__WEBPACK_IMPORTED_MODULE_5__[\"default\"](10000);\n var layoutDataRoot = replicator.createReplicatedTree(layoutRoot);\n var layoutTreeDataGrid = new _LayoutTreeDataGrid__WEBPACK_IMPORTED_MODULE_2__[\"default\"](this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.request_layout_data_tree'), layoutDataRoot, this.model, layoutDataTreeOptions, this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.total_message_length'));\n layoutTreeDataGrid.init( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(finalMessage) {\n var prefix;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!_this.server.serverOptions) {\n _context.next = 6;\n break;\n }\n _context.next = 3;\n return _this.serverManager.renderServerPrefix(_this.server.serverOptions, _this.model);\n case 3:\n _context.t0 = _context.sent;\n _context.next = 7;\n break;\n case 6:\n _context.t0 = '';\n case 7:\n prefix = _context.t0;\n _this.requestBodyEditor.setValue(prefix + finalMessage);\n case 9:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n var layoutTreeGrid = new _LayoutTreeGrid__WEBPACK_IMPORTED_MODULE_1__[\"default\"](this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.request_layout_tree'), layoutRoot, layoutDataTreeOptions, function (root) {\n var replicator = new _ApiLayoutItemTreeDataBuilder__WEBPACK_IMPORTED_MODULE_5__[\"default\"](10000);\n var layoutDataRoot = replicator.createReplicatedTree(root);\n layoutTreeDataGrid.rebuild(layoutDataRoot);\n });\n var layoutGrid = new _LayoutGrid__WEBPACK_IMPORTED_MODULE_0__[\"default\"](this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.request_layout'), this.model.layout, function (model) {\n model.items.forEach(function (item) {\n item.children = [];\n });\n var updatedRoot = _ApiLayoutItemTreeBuilder__WEBPACK_IMPORTED_MODULE_4__[\"default\"].createTree(model.items);\n layoutTreeGrid.rebuild(updatedRoot, function (root) {\n var replicator = new _ApiLayoutItemTreeDataBuilder__WEBPACK_IMPORTED_MODULE_5__[\"default\"](10000);\n var layoutDataRoot = replicator.createReplicatedTree(root);\n layoutTreeDataGrid.rebuild(layoutDataRoot);\n });\n _this.layoutJsonEditor.setValue(JSON.stringify(_this.model.layout, null, 2));\n $('span.variable').off('mouseover');\n $('span.variable').off('mouseout');\n document.querySelectorAll('span.variable').forEach(function (element) {\n var text = element.innerText;\n element.addEventListener('mouseover', function () {\n return _this.parent.showPopper(element, text);\n });\n element.addEventListener('mouseout', function () {\n return _this.parent.hidePopper(element);\n });\n });\n });\n this.apiRequestTabContent.find(\"#api_request_\".concat(this.model.id)).find('.load_layout').on('click', function () {\n try {\n _this.model.layout = JSON.parse(_this.layoutJsonEditor.getValue());\n _this.model.layout.layoutItems.forEach(function (item) {\n if (item.value === undefined) {\n item.value = '';\n }\n });\n console.log(_this.model);\n layoutGrid.rebuild(_this.model.layout);\n } catch (e) {\n console.error(e);\n alert(e);\n }\n });\n window.addEventListener('resize', this.resizeEditor.bind(this));\n }\n }, {\n key: \"resizeEditor\",\n value: function resizeEditor() {\n this.requestBodyEditor.layout({\n width: 0\n });\n this.requestBodyEditor.layout({});\n this.layoutJsonEditor.layout({\n width: 0\n });\n this.layoutJsonEditor.layout({});\n }\n }, {\n key: \"tcpApiRequestTemplate\",\n value: function tcpApiRequestTemplate(apiRequest, index) {\n console.log('tcpApiRequestTemplate');\n return \"\\n
\\n
\").concat(apiRequest.collectionName, \" > \").concat(apiRequest.name, \"
\\n
\\n
\\n \").concat(this.serverManager.renderTcpServers(apiRequest.server), \"\\n \\n
\\n \\n \\n
\\n
\\n
\\n
\\n
\\n
    \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\uC804\\uCCB4 \\uBA54\\uC2DC\\uC9C0 \\uAE38\\uC774: \\n \\n
\\n
\\n
\\n
\\n
\\n Response\\n \\n \\n
\\n
    \\n
  • \\n \\n
  • \\n
  • \\n \\n
  • \\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \\n \");\n }\n }]);\n return TCPClientView;\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TCPClientView);\n\n//# sourceURL=webpack://APITestManager/./src/components/TCPClientView.js?"); /***/ }),