sqlite-wasm-viewer 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ #viewer {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ background-color: whitesmoke;
8
+ display: flex;
9
+ padding: 10px;
10
+ padding-top: 20px;
11
+ gap: 8px;
12
+ }
13
+
14
+ #viewer * {
15
+ all: revert;
16
+ }
17
+
18
+ #viewer .viewHeader {
19
+ max-height: 20px;
20
+ flex-basis: 20px;
21
+ line-height: 1.1rem;
22
+ padding: 8px;
23
+ display: flex;
24
+ align-items: center;
25
+ gap: 8px;
26
+ background-color: lightgray;
27
+ }
28
+
29
+ #viewer #close_btn {
30
+ position: absolute;
31
+ left: 10px;
32
+ top: 0px;
33
+ cursor: pointer;
34
+ }
35
+
36
+ #viewer #db_list {
37
+ width: 200px;
38
+ padding: 5px;
39
+ background-color: darkgray;
40
+ display: flex;
41
+ flex-direction: column;
42
+ }
43
+
44
+ #viewer #tree_root {
45
+ flex-grow: 1;
46
+ padding: 5px;
47
+ background-color: darkgray;
48
+ }
49
+
50
+ #viewer #middle_panel {
51
+ background-color: darkgray;
52
+ flex: 1;
53
+ flex-basis: 800px;
54
+ display: flex;
55
+ flex-direction: column;
56
+ }
57
+
58
+ #viewer #right_panel {
59
+ padding: 5px;
60
+ background-color: darkgray;
61
+ flex: 1;
62
+ display: flex;
63
+ flex-direction: column;
64
+ gap: 5px;
65
+ }
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ViewerState = void 0;
7
+ exports.initState = initState;
8
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
15
+ var ViewerState = /*#__PURE__*/function () {
16
+ function ViewerState(viewerElem) {
17
+ _classCallCheck(this, ViewerState);
18
+ _defineProperty(this, "hasChanges", false);
19
+ this.viewerElem = viewerElem;
20
+ ViewerState._instance = this;
21
+ }
22
+ _createClass(ViewerState, [{
23
+ key: "setSelectedCell",
24
+ value: function setSelectedCell(cell) {
25
+ this.selectedCell = cell;
26
+ var event = new CustomEvent('cellSelected', {
27
+ detail: cell
28
+ });
29
+ this.viewerElem.dispatchEvent(event);
30
+ }
31
+ }, {
32
+ key: "setSelectedTable",
33
+ value: function setSelectedTable(table) {
34
+ this.selectedTable = table;
35
+ var event = new CustomEvent('tableSelected', {
36
+ detail: table
37
+ });
38
+ this.viewerElem.dispatchEvent(event);
39
+ }
40
+ }, {
41
+ key: "setHasChanges",
42
+ value: function setHasChanges(hasChanges) {
43
+ this.hasChanges = hasChanges;
44
+ var event = new CustomEvent('dbHasChanges', {
45
+ detail: hasChanges
46
+ });
47
+ this.viewerElem.dispatchEvent(event);
48
+ }
49
+ }], [{
50
+ key: "instance",
51
+ get: function get() {
52
+ return ViewerState._instance;
53
+ }
54
+ }]);
55
+ return ViewerState;
56
+ }();
57
+ exports.ViewerState = ViewerState;
58
+ function initState(viewerElem) {
59
+ return new ViewerState(viewerElem);
60
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EditCellView = void 0;
7
+ var _viewerState = require("../../viewerState");
8
+ require("./styles.css");
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
15
+ var EditCellView = /*#__PURE__*/function () {
16
+ function EditCellView(viewerElem, rootEl) {
17
+ var _this = this;
18
+ _classCallCheck(this, EditCellView);
19
+ this.viewerElem = viewerElem;
20
+ this.rootEl = rootEl;
21
+ this.buildDom();
22
+ viewerElem.addEventListener('cellSelected', function (event) {
23
+ var cell = event.detail;
24
+ _this.currentCell = cell;
25
+ _this.textArea.value = cell.value;
26
+ _this.textArea.select();
27
+ });
28
+ }
29
+ _createClass(EditCellView, [{
30
+ key: "buildDom",
31
+ value: function buildDom() {
32
+ var container = document.createElement('div');
33
+ container.id = 'execute_sql_container';
34
+ var header = document.createElement('div');
35
+ header.className = 'viewHeader';
36
+ header.innerText = 'Edit Cell';
37
+ container.appendChild(header);
38
+ this.textArea = document.createElement('textarea');
39
+ this.textArea.id = 'execute_sql_textarea';
40
+ container.appendChild(this.textArea);
41
+ var executeBtn = document.createElement('button');
42
+ executeBtn.innerText = 'Apply';
43
+ executeBtn.onclick = this.handleApplyEdit.bind(this);
44
+ container.appendChild(executeBtn);
45
+ this.rootEl.appendChild(container);
46
+ }
47
+ }, {
48
+ key: "handleApplyEdit",
49
+ value: function handleApplyEdit() {
50
+ if (this.textArea.value) {
51
+ var _this$queryRunner2, _this$currentCell, _this$currentCell2, _this$currentCell3;
52
+ if (!_viewerState.ViewerState.instance.hasChanges) {
53
+ var _this$queryRunner;
54
+ (_this$queryRunner = this.queryRunner) === null || _this$queryRunner === void 0 ? void 0 : _this$queryRunner.runQuery({
55
+ sql: 'SAVEPOINT "RESTOREPOINT"',
56
+ parameters: []
57
+ });
58
+ }
59
+ (_this$queryRunner2 = this.queryRunner) === null || _this$queryRunner2 === void 0 ? void 0 : _this$queryRunner2.runQuery({
60
+ sql: "UPDATE ".concat((_this$currentCell = this.currentCell) === null || _this$currentCell === void 0 ? void 0 : _this$currentCell.tableName, " SET \"").concat((_this$currentCell2 = this.currentCell) === null || _this$currentCell2 === void 0 ? void 0 : _this$currentCell2.columnName, "\"=? WHERE \"_rowid_\"='").concat((_this$currentCell3 = this.currentCell) === null || _this$currentCell3 === void 0 ? void 0 : _this$currentCell3.cellRowId, "'"),
61
+ parameters: [this.textArea.value]
62
+ });
63
+ _viewerState.ViewerState.instance.setHasChanges(true);
64
+ }
65
+ }
66
+ }, {
67
+ key: "setDb",
68
+ value: function setDb(queryRunner) {
69
+ this.queryRunner = queryRunner;
70
+ }
71
+ }]);
72
+ return EditCellView;
73
+ }();
74
+ exports.EditCellView = EditCellView;
@@ -0,0 +1,23 @@
1
+ #execute_sql_container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
5
+
6
+ #execute_sql_editor {
7
+ position: relative;
8
+ background-color: white;
9
+ height: 300px;
10
+ }
11
+
12
+ #execute_sql_textarea {
13
+ resize: none;
14
+ height: 300px;
15
+ background-color: white;
16
+ overflow: auto;
17
+ white-space: nowrap;
18
+ font-size: 10pt;
19
+ font-family: monospace;
20
+ line-height: 1.5;
21
+ tab-size: 2;
22
+ caret-color: black;
23
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExecuteSQLView = void 0;
7
+ require("./styles.css");
8
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
+ var ExecuteSQLView = /*#__PURE__*/function () {
15
+ function ExecuteSQLView(rootEl) {
16
+ _classCallCheck(this, ExecuteSQLView);
17
+ this.rootEl = rootEl;
18
+ this.buildDom();
19
+ }
20
+ _createClass(ExecuteSQLView, [{
21
+ key: "buildDom",
22
+ value: function buildDom() {
23
+ var container = document.createElement('div');
24
+ container.id = 'execute_sql_container';
25
+ var header = document.createElement('div');
26
+ header.className = 'viewHeader';
27
+ header.innerText = 'Execute SQL';
28
+ container.appendChild(header);
29
+ this.textArea = document.createElement('textarea');
30
+ this.textArea.id = 'execute_sql_textarea';
31
+ container.appendChild(this.textArea);
32
+ var executeBtn = document.createElement('button');
33
+ executeBtn.innerText = 'Execute SQL';
34
+ executeBtn.onclick = this.handleExecuteSql.bind(this);
35
+ container.appendChild(executeBtn);
36
+ this.rootEl.appendChild(container);
37
+ }
38
+ }, {
39
+ key: "handleExecuteSql",
40
+ value: function handleExecuteSql() {
41
+ if (this.textArea.value) {
42
+ var _this$queryRunner;
43
+ (_this$queryRunner = this.queryRunner) === null || _this$queryRunner === void 0 ? void 0 : _this$queryRunner.runQuery({
44
+ sql: this.textArea.value,
45
+ parameters: []
46
+ });
47
+ }
48
+ }
49
+ }, {
50
+ key: "setDb",
51
+ value: function setDb(queryRunner) {
52
+ this.queryRunner = queryRunner;
53
+ }
54
+ }]);
55
+ return ExecuteSQLView;
56
+ }();
57
+ exports.ExecuteSQLView = ExecuteSQLView;
@@ -0,0 +1,47 @@
1
+ #execute_sql_container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
5
+
6
+ #execute_sql_editor {
7
+ position: relative;
8
+ background-color: white;
9
+ height: 300px;
10
+ }
11
+
12
+ #execute_sql_textarea, #execute_sql_highlighting {
13
+ resize: none;
14
+ height: 300px;
15
+ background-color: white;
16
+ overflow: auto;
17
+ white-space: nowrap;
18
+ font-size: 10pt;
19
+ font-family: monospace;
20
+ line-height: 1.5;
21
+ tab-size: 2;
22
+ caret-color: black;
23
+ }
24
+
25
+ #execute_sql_highlighting {
26
+ z-index: 0;
27
+ margin: 0;
28
+ padding: 2px;
29
+ }
30
+
31
+ .highlighting {
32
+ color: blue;
33
+ }
34
+
35
+ .sql-hl-keyword {
36
+ color: purple;
37
+ /* font-weight: 600; */
38
+ }
39
+
40
+ .sql-hl-special {
41
+ color: black;
42
+ }
43
+
44
+ .sql-hl-string {
45
+ color: red;
46
+ /* font-weight: 600; */
47
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExplorerView = void 0;
7
+ var _viewerState = require("../../viewerState");
8
+ require("./styles.css");
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
+ var ExplorerView = /*#__PURE__*/function () {
17
+ function ExplorerView(rootEl) {
18
+ _classCallCheck(this, ExplorerView);
19
+ _defineProperty(this, "expandedItems", {});
20
+ _defineProperty(this, "selectedItem", null);
21
+ this.dbs = [];
22
+ var dbListHeader = document.createElement('div');
23
+ dbListHeader.className = 'viewHeader';
24
+ dbListHeader.innerText = 'Database List';
25
+ rootEl.appendChild(dbListHeader);
26
+ this.containerEl = document.createElement('div');
27
+ this.containerEl.id = 'explorer_tree';
28
+ rootEl.appendChild(this.containerEl);
29
+ }
30
+ _createClass(ExplorerView, [{
31
+ key: "addDatabaseItem",
32
+ value: function addDatabaseItem(databaseItem) {
33
+ this.dbs.push(databaseItem);
34
+ this.addDbToDom(databaseItem);
35
+ if (this.selectedItem === null) {
36
+ var firstTable = document.querySelector('#explorer_tree > .table');
37
+ if (firstTable) {
38
+ this.selectTable(firstTable, databaseItem);
39
+ }
40
+ }
41
+ }
42
+ }, {
43
+ key: "addDbToDom",
44
+ value: function addDbToDom(databaseItem) {
45
+ var _this = this;
46
+ var dbRoot = document.createDocumentFragment();
47
+ var dbItem = document.createElement('div');
48
+ dbItem.innerText = databaseItem.filename;
49
+ dbItem.className = 'db';
50
+ var expandArrow = document.createElement('div');
51
+ expandArrow.className = 'expand';
52
+ expandArrow.innerText = '>';
53
+ expandArrow.style.cursor = 'pointer';
54
+ expandArrow.onclick = function () {
55
+ _this.expandedItems[databaseItem.filename] = !_this.expandedItems[databaseItem.filename];
56
+ expandArrow.classList.toggle('expanded');
57
+ };
58
+ expandArrow.classList.add('expanded');
59
+ dbItem.appendChild(expandArrow);
60
+ dbRoot.appendChild(dbItem);
61
+ databaseItem.tables.forEach(function (table) {
62
+ var tableItem = document.createElement('div');
63
+ tableItem.innerText = table;
64
+ tableItem.className = 'table';
65
+ tableItem.onclick = function () {
66
+ _this.selectTable(tableItem, databaseItem);
67
+ };
68
+ dbRoot.appendChild(tableItem);
69
+ });
70
+ this.containerEl.appendChild(dbRoot);
71
+ }
72
+ }, {
73
+ key: "selectTable",
74
+ value: function selectTable(tableEl, databaseItem) {
75
+ if (tableEl) {
76
+ var _this$selectedItem;
77
+ var tableName = tableEl.innerText;
78
+ (_this$selectedItem = this.selectedItem) === null || _this$selectedItem === void 0 ? void 0 : _this$selectedItem.classList.remove('selected');
79
+ tableEl.classList.add('selected');
80
+ this.selectedItem = tableEl;
81
+ var databasePath = databaseItem.filename;
82
+ _viewerState.ViewerState.instance.setSelectedTable({
83
+ tableName: tableName,
84
+ databasePath: databasePath
85
+ });
86
+ }
87
+ }
88
+ }]);
89
+ return ExplorerView;
90
+ }();
91
+ exports.ExplorerView = ExplorerView;
@@ -0,0 +1,30 @@
1
+ #explorer_tree {
2
+ padding: 8px;
3
+ padding-left: 20px;
4
+ }
5
+
6
+ #explorer_tree > .db {
7
+ position: relative;
8
+ text-overflow: ellipsis;
9
+ overflow-y: clip;
10
+ }
11
+
12
+ #explorer_tree .expand {
13
+ position: absolute;
14
+ top: 0;
15
+ left: -15px;
16
+ transition: all .3s ease-in;
17
+ }
18
+
19
+ #explorer_tree .expanded {
20
+ transform: rotate(90deg);
21
+ }
22
+
23
+ #explorer_tree > .table {
24
+ margin-left: 20px;
25
+ cursor: pointer;
26
+ }
27
+
28
+ #explorer_tree > .table.selected {
29
+ background-color: rgb(128, 128, 128);
30
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initSqlLogView = initSqlLogView;
7
+ require("./styles.css");
8
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
+ var SqlLogView = /*#__PURE__*/function () {
15
+ function SqlLogView(rootEl, queryRunner) {
16
+ _classCallCheck(this, SqlLogView);
17
+ queryRunner.addListener(this.handleQueryRun.bind(this));
18
+ var container = document.createElement('div');
19
+ container.id = 'sql_log_container';
20
+ var header = document.createElement('div');
21
+ header.className = 'viewHeader';
22
+ header.innerText = 'SQL Log';
23
+ container.appendChild(header);
24
+ this.textArea = document.createElement('textarea');
25
+ this.textArea.id = 'query_log_text';
26
+ this.textArea.readOnly = true;
27
+ container.appendChild(this.textArea);
28
+ rootEl.appendChild(container);
29
+ }
30
+ _createClass(SqlLogView, [{
31
+ key: "handleQueryRun",
32
+ value: function handleQueryRun(query) {
33
+ this.textArea.value += "".concat(query.sql, "\n");
34
+ }
35
+ }]);
36
+ return SqlLogView;
37
+ }();
38
+ function initSqlLogView(rootEl, queryRunner) {
39
+ return new SqlLogView(rootEl, queryRunner);
40
+ }
@@ -0,0 +1,10 @@
1
+ #sql_log_container {
2
+ flex-grow: 1;
3
+ display: flex;
4
+ flex-direction: column;
5
+ }
6
+
7
+ #query_log_text {
8
+ resize: none;
9
+ height: 100%;
10
+ }